summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
Diffstat (limited to 'unix')
-rw-r--r--unix/Makefile.in829
-rw-r--r--unix/README256
-rw-r--r--unix/aclocal.m42
-rwxr-xr-xunix/configure13326
-rw-r--r--unix/configure.in475
-rw-r--r--unix/install-sh580
-rwxr-xr-xunix/installManPage132
-rw-r--r--unix/tcl.m41142
-rw-r--r--unix/tk.pc.in15
-rw-r--r--unix/tk.spec59
-rw-r--r--unix/tkAppInit.c123
-rw-r--r--unix/tkConfig.h.in250
-rw-r--r--unix/tkConfig.sh.in8
-rw-r--r--unix/tkUnix.c211
-rw-r--r--unix/tkUnix3d.c291
-rw-r--r--unix/tkUnixButton.c698
-rw-r--r--unix/tkUnixColor.c285
-rw-r--r--unix/tkUnixConfig.c35
-rw-r--r--unix/tkUnixCursor.c501
-rw-r--r--unix/tkUnixDefault.h150
-rw-r--r--unix/tkUnixDialog.c163
-rw-r--r--unix/tkUnixDraw.c141
-rw-r--r--unix/tkUnixEmbed.c755
-rw-r--r--unix/tkUnixEvent.c457
-rw-r--r--unix/tkUnixFocus.c109
-rw-r--r--unix/tkUnixFont.c1986
-rw-r--r--unix/tkUnixInit.c94
-rw-r--r--unix/tkUnixInt.h20
-rw-r--r--unix/tkUnixKey.c373
-rw-r--r--unix/tkUnixMenu.c1107
-rw-r--r--unix/tkUnixMenubu.c331
-rw-r--r--unix/tkUnixPort.h35
-rw-r--r--unix/tkUnixRFont.c1101
-rw-r--r--unix/tkUnixScale.c266
-rw-r--r--unix/tkUnixScrlbr.c155
-rw-r--r--unix/tkUnixSelect.c803
-rw-r--r--unix/tkUnixSend.c1391
-rw-r--r--unix/tkUnixWm.c4146
-rw-r--r--unix/tkUnixXId.c556
39 files changed, 21432 insertions, 11925 deletions
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 27bbb19..2ab5913 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -34,6 +34,7 @@ exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
includedir = @includedir@
+datarootdir = @datarootdir@
mandir = @mandir@
# The following definition can be set to non-null for special systems
@@ -49,7 +50,7 @@ INSTALL_ROOT = $(DESTDIR)
TK_LIBRARY = @TK_LIBRARY@
# Path to use at runtime to refer to LIB_INSTALL_DIR:
-LIB_RUNTIME_DIR = $(libdir)
+LIB_RUNTIME_DIR = @LIB_RUNTIME_DIR@
# Directory in which to install the program wish:
BIN_INSTALL_DIR = $(INSTALL_ROOT)$(bindir)
@@ -89,11 +90,21 @@ HTML_DIR = @HTML_DIR@
# Directory in which to install html documentation:
HTML_INSTALL_DIR = $(INSTALL_ROOT)$(HTML_DIR)
+# Directory in which to install the configuration file tkConfig.sh:
+CONFIG_INSTALL_DIR = $(INSTALL_ROOT)$(libdir)
+
+# Directory in which to install the demo files:
+DEMO_INSTALL_DIR = $(INSTALL_ROOT)$(TK_LIBRARY)/demos
+
# The directory containing the Tcl sources and headers appropriate
# for this version of Tk ("srcdir" will be replaced or has already
# been replaced by the configure script):
TCL_GENERIC_DIR = @TCL_SRC_DIR@/generic
+# The directory containing the platform specific Tcl sources and headers
+# appropriate for this version of Tk:
+TCL_PLATFORM_DIR = @TCL_SRC_DIR@/unix
+
# The directory containing the Tcl library archive file appropriate
# for this version of Tk:
TCL_BIN_DIR = @TCL_BIN_DIR@
@@ -101,9 +112,6 @@ TCL_BIN_DIR = @TCL_BIN_DIR@
# The linker flags needed to link in the Tcl library (ex: -ltcl8.2)
TCL_LIB_FLAG = @TCL_LIB_FLAG@
-# Libraries built with optimization switches have this additional extension
-TK_DBGX = @TK_DBGX@
-
# Flag, 1: we're building a shared lib, 0 we're not
TK_SHARED_BUILD = @TK_SHARED_BUILD@
@@ -121,7 +129,7 @@ CFLAGS_WARNING = @CFLAGS_WARNING@
# The default switches for optimization or debugging
CFLAGS_DEBUG = @CFLAGS_DEBUG@
-CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@
+CFLAGS_OPTIMIZE = -DNDEBUG @CFLAGS_OPTIMIZE@
# To change the compiler switches, for example to change from optimization to
# debugging symbols, change the following line:
@@ -146,7 +154,7 @@ AQUA_INCLUDES = -I$(MAC_OSX_DIR) -I$(XLIB_DIR)
# Linker switch(es) to use to link with the X11 library archive (the
# configure script will try to set this value automatically, but you
# can override it).
-X11_LIB_SWITCHES = @XLIBSW@
+X11_LIB_SWITCHES = $(XFT_LIBS) @XLIBSW@
# To turn off the security checks that disallow incoming sends when
@@ -183,7 +191,7 @@ NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED
# Some versions of make, like SGI's, use the following variable to
# determine which shell to use for executing commands:
-SHELL = /bin/sh
+SHELL = @SHELL@
# BUILD_TCLSH is the fully qualified path name of the tclsh shell
# in the Tcl build directory. Test that need to be run in the
@@ -198,7 +206,9 @@ BUILD_TCLSH = @BUILD_TCLSH@
# need it to be available on the PATH. This executable should *NOT* be
# required just to do a normal build although it can be required to run
# make dist. This variable is set to "" if no tclsh is available.
+EXE_SUFFIX = @EXEEXT@
TCL_EXE = @TCLSH_PROG@
+WISH_EXE = wish${EXE_SUFFIX}
# Tk used to let the configure script choose which program to use
# for installing, but there are just too many different versions of
@@ -206,18 +216,19 @@ TCL_EXE = @TCLSH_PROG@
# with the distribution, which is slower but guaranteed to work.
INSTALL_STRIP_PROGRAM = -s
-INSTALL_STRIP_LIBRARY = -S -S
+INSTALL_STRIP_LIBRARY = -S -x
-INSTALL = @srcdir@/install-sh -c
+INSTALL = $(SHELL) $(UNIX_DIR)/install-sh -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_LIBRARY = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_DATA_DIR = ${INSTALL} -d -m 755
# The symbol below provides support for dynamic loading and shared
# libraries. See configure.in for a description of what it means.
# The value of the symbol is normally set by the configure script.
-SHLIB_CFLAGS = @SHLIB_CFLAGS@
+SHLIB_CFLAGS = @SHLIB_CFLAGS@ -DBUILD_tk
# To enable support for stubs in Tcl.
STUB_LIB_FILE = @TK_STUB_LIB_FILE@
@@ -244,15 +255,13 @@ TCL_LIB_SPEC = @TCL_LIB_SPEC@
TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@
TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@
-TK_EXP_FILE = @TK_EXP_FILE@
-TK_BUILD_EXP_FILE = @TK_BUILD_EXP_FILE@
TCL_STUB_FLAGS = @TCL_STUB_FLAGS@
# Libraries to use when linking. This definition is determined by the
# configure script.
-LIBS = @LIBS@ $(X11_LIB_SWITCHES) @DL_LIBS@ @MATH_LIBS@
-WISH_LIBS = $(TCL_LIB_SPEC) @LIBS@ $(X11_LIB_SWITCHES) @DL_LIBS@ @MATH_LIBS@ @EXTRA_WISH_LIBS@
+LIBS = @LIBS@ $(X11_LIB_SWITCHES) @TCL_LIBS@
+WISH_LIBS = $(TCL_LIB_SPEC) @LIBS@ $(X11_LIB_SWITCHES) @TCL_LIBS@ @EXTRA_WISH_LIBS@
# The symbols below provide support for dynamic loading and shared
# libraries. See configure.in for a description of what the
@@ -280,6 +289,10 @@ WISH_RSRC_FILE = @WISH_RSRC_FILE@
REZ = @REZ@
REZ_SWITCHES = @REZ_FLAGS@ -i $(GENERIC_DIR) -i $(TCL_GENERIC_DIR)
+# support for Xft:
+XFT_CFLAGS = @XFT_CFLAGS@
+XFT_LIBS = @XFT_LIBS@
+
#----------------------------------------------------------------
# The information below is modified by the configure script when
# Makefile is generated from Makefile.in. You shouldn't normally
@@ -292,10 +305,12 @@ RANLIB = @RANLIB@
SRC_DIR = @srcdir@
TOP_DIR = $(SRC_DIR)/..
GENERIC_DIR = $(TOP_DIR)/generic
-UNIX_DIR = $(SRC_DIR)
+TTK_DIR = $(GENERIC_DIR)/ttk
+UNIX_DIR = $(TOP_DIR)/unix
BMAP_DIR = $(TOP_DIR)/bitmaps
TOOL_DIR = @TCL_SRC_DIR@/tools
-MAC_OSX_DIR = $(TOP_DIR)/macosx
+TEST_DIR = $(TOP_DIR)/tests
+MAC_OSX_DIR = $(TOP_DIR)/@MACOSX_SRC_DIR@
XLIB_DIR = $(TOP_DIR)/xlib
#----------------------------------------------------------------
@@ -304,30 +319,31 @@ XLIB_DIR = $(TOP_DIR)/xlib
# either.
#----------------------------------------------------------------
-# Flags to be passed to installManPage to control whether the manpages
-# should be compressed and linked with softlinks
+# Flags to be passed to installManPage to control how the manpages
+# should be installed (symlinks, compression, package name suffix).
MAN_FLAGS = @MAN_FLAGS@
CC = @CC@
CC_SWITCHES_NO_STUBS = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \
-I${UNIX_DIR} -I${GENERIC_DIR} -I${BMAP_DIR} -I${TCL_GENERIC_DIR} \
-${@TK_WINDOWINGSYSTEM@_INCLUDES} ${AC_FLAGS} ${PROTO_FLAGS} ${SECURITY_FLAGS} \
-${MEM_DEBUG_FLAGS} ${KEYSYM_FLAGS} ${NO_DEPRECATED_FLAGS} @EXTRA_CC_SWITCHES@
+-I${TCL_PLATFORM_DIR} ${@TK_WINDOWINGSYSTEM@_INCLUDES} ${AC_FLAGS} \
+${PROTO_FLAGS} ${SECURITY_FLAGS} ${MEM_DEBUG_FLAGS} ${KEYSYM_FLAGS} \
+${NO_DEPRECATED_FLAGS} @EXTRA_CC_SWITCHES@
-CC_SWITCHES = $(CC_SWITCHES_NO_STUBS) ${TCL_STUB_FLAGS}
+CC_SWITCHES = $(CC_SWITCHES_NO_STUBS) @TCL_STUB_FLAGS@
APP_CC_SWITCHES = $(CC_SWITCHES_NO_STUBS) @EXTRA_APP_CC_SWITCHES@
-DEPEND_SWITCHES = ${CFLAGS} -I${UNIX_DIR} -I${GENERIC_DIR} \
--I${BMAP_DIR} \
--I${TCL_GENERIC_DIR} ${@TK_WINDOWINGSYSTEM@_INCLUDES} \
+DEPEND_SWITCHES = ${CFLAGS} -I${UNIX_DIR} -I${GENERIC_DIR} -I${BMAP_DIR} \
+-I${TCL_GENERIC_DIR} -I${TCL_PLATFORM_DIR} ${@TK_WINDOWINGSYSTEM@_INCLUDES} \
${AC_FLAGS} ${PROTO_FLAGS} ${SECURITY_FLAGS} ${MEM_DEBUG_FLAGS} \
${KEYSYM_FLAGS} @EXTRA_CC_SWITCHES@
WISH_OBJS = tkAppInit.o
-TKTEST_OBJS = tkTestInit.o tkTest.o tkSquare.o
+TKTEST_OBJS = tkTestInit.o tkTest.o tkSquare.o tkOldTest.o \
+ $(@TK_WINDOWINGSYSTEM@_TKTEST_OBJS)
WIDG_OBJS = tkButton.o tkEntry.o tkFrame.o tkListbox.o \
tkMenu.o tkMenubutton.o tkMenuDraw.o tkMessage.o \
@@ -337,24 +353,39 @@ CANV_OBJS = tkCanvas.o tkCanvArc.o tkCanvBmap.o tkCanvImg.o \
tkCanvLine.o tkCanvPoly.o tkCanvPs.o tkCanvText.o \
tkCanvUtil.o tkCanvWind.o tkRectOval.o tkTrig.o
-IMAGE_OBJS = tkImage.o tkImgBmap.o tkImgGIF.o tkImgPPM.o tkImgPhoto.o
+IMAGE_OBJS = tkImage.o tkImgBmap.o tkImgGIF.o tkImgPNG.o tkImgPPM.o \
+ tkImgPhoto.o tkImgPhInstance.o
TEXT_OBJS = tkText.o tkTextBTree.o tkTextDisp.o tkTextImage.o tkTextIndex.o \
tkTextMark.o tkTextTag.o tkTextWind.o
-GENERIC_OBJS = tk3d.o tkArgv.o tkAtom.o tkBind.o tkBitmap.o tkClipboard.o \
+# either tkUnixFont.o (default) or tkUnixRFont.o (if --enable-xft)
+#
+FONT_OBJS = @UNIX_FONT_OBJS@
+
+GENERIC_OBJS = tk3d.o tkArgv.o tkAtom.o tkBind.o tkBitmap.o tkBusy.o \
+ tkClipboard.o \
tkCmds.o tkColor.o tkConfig.o tkConsole.o tkCursor.o tkError.o \
tkEvent.o tkFocus.o tkFont.o tkGet.o tkGC.o tkGeometry.o tkGrab.o \
tkGrid.o tkMain.o tkObj.o tkOldConfig.o tkOption.o tkPack.o tkPlace.o \
tkSelect.o tkStyle.o tkUndo.o tkUtil.o tkVisual.o tkWindow.o
-STUB_OBJS = tkStubInit.o tkStubLib.o
+TTK_OBJS = \
+ ttkBlink.o ttkButton.o ttkCache.o ttkClamTheme.o ttkClassicTheme.o \
+ ttkDefaultTheme.o ttkElements.o ttkEntry.o ttkFrame.o ttkImage.o \
+ ttkInit.o ttkLabel.o ttkLayout.o ttkManager.o ttkNotebook.o \
+ ttkPanedwindow.o ttkProgress.o ttkScale.o ttkScrollbar.o ttkScroll.o \
+ ttkSeparator.o ttkSquare.o ttkState.o \
+ ttkTagSet.o ttkTheme.o ttkTrace.o ttkTrack.o ttkTreeview.o \
+ ttkWidget.o ttkStubInit.o
+
+STUB_OBJS = tkStubInit.o
-STUB_LIB_OBJS = tkStubLib.o tkStubImg.o
+STUB_LIB_OBJS = tkStubLib.o ttkStubLib.o
X11_OBJS = tkUnix.o tkUnix3d.o tkUnixButton.o tkUnixColor.o tkUnixConfig.o \
tkUnixCursor.o tkUnixDraw.o tkUnixEmbed.o tkUnixEvent.o \
- tkUnixFocus.o tkUnixFont.o tkUnixInit.o tkUnixKey.o tkUnixMenu.o \
+ tkUnixFocus.o $(FONT_OBJS) tkUnixInit.o tkUnixKey.o tkUnixMenu.o \
tkUnixMenubu.o tkUnixScale.o tkUnixScrlbr.o tkUnixSelect.o \
tkUnixSend.o tkUnixWm.o tkUnixXId.o
@@ -365,22 +396,30 @@ AQUA_OBJS = tkMacOSXBitmap.o tkMacOSXButton.o tkMacOSXClipboard.o \
tkMacOSXKeyboard.o tkMacOSXKeyEvent.o tkMacOSXMenu.o \
tkMacOSXMenubutton.o tkMacOSXMenus.o tkMacOSXMouseEvent.o \
tkMacOSXNotify.o tkMacOSXRegion.o tkMacOSXScrlbr.o tkMacOSXSend.o \
- tkMacOSXSubwindows.o tkMacOSXTest.o tkMacOSXWindowEvent.o \
- tkMacOSXWm.o tkMacOSXXStubs.o tkMacOSXCarbonEvents.o \
+ tkMacOSXSubwindows.o tkMacOSXWindowEvent.o \
+ tkMacOSXWm.o tkMacOSXXStubs.o @EXTRA_AQUA_OBJS@ \
tkFileFilter.o tkMacWinMenu.o tkPointer.o tkUnix3d.o tkUnixScale.o \
- xcolors.o xdraw.o xgc.o ximage.o xutil.o
+ xcolors.o xdraw.o xgc.o ximage.o xutil.o \
+ ttkMacOSXTheme.o
+
+AQUA_TKTEST_OBJS = tkMacOSXTest.o
OBJS = $(GENERIC_OBJS) $(WIDG_OBJS) $(CANV_OBJS) $(IMAGE_OBJS) $(TEXT_OBJS) \
- $(STUB_OBJS) $(@TK_WINDOWINGSYSTEM@_OBJS) @PLAT_OBJS@
+ $(STUB_OBJS) $(TTK_OBJS) \
+ $(@TK_WINDOWINGSYSTEM@_OBJS) @PLAT_OBJS@
TK_DECLS = \
$(GENERIC_DIR)/tk.decls \
$(GENERIC_DIR)/tkInt.decls
+TTK_DECLS = \
+ $(TTK_DIR)/ttk.decls
+
GENERIC_SRCS = \
$(GENERIC_DIR)/tk3d.c $(GENERIC_DIR)/tkArgv.c \
$(GENERIC_DIR)/tkAtom.c $(GENERIC_DIR)/tkBind.c \
- $(GENERIC_DIR)/tkBitmap.c $(GENERIC_DIR)/tkClipboard.c \
+ $(GENERIC_DIR)/tkBitmap.c $(GENERIC_DIR)/tkBusy.c \
+ $(GENERIC_DIR)/tkClipboard.c \
$(GENERIC_DIR)/tkCmds.c $(GENERIC_DIR)/tkColor.c \
$(GENERIC_DIR)/tkConfig.c $(GENERIC_DIR)/tkCursor.c \
$(GENERIC_DIR)/tkError.c $(GENERIC_DIR)/tkEvent.c \
@@ -407,15 +446,50 @@ GENERIC_SRCS = \
$(GENERIC_DIR)/tkCanvWind.c $(GENERIC_DIR)/tkRectOval.c \
$(GENERIC_DIR)/tkTrig.c $(GENERIC_DIR)/tkImage.c \
$(GENERIC_DIR)/tkImgBmap.c $(GENERIC_DIR)/tkImgGIF.c \
- $(GENERIC_DIR)/tkImgPPM.c \
- $(GENERIC_DIR)/tkImgPhoto.c $(GENERIC_DIR)/tkText.c \
+ $(GENERIC_DIR)/tkImgPNG.c $(GENERIC_DIR)/tkImgPPM.c \
+ $(GENERIC_DIR)/tkImgPhoto.c $(GENERIC_DIR)/tkImgPhInstance.c \
+ $(GENERIC_DIR)/tkText.c \
$(GENERIC_DIR)/tkTextBTree.c $(GENERIC_DIR)/tkTextDisp.c \
$(GENERIC_DIR)/tkTextImage.c \
$(GENERIC_DIR)/tkTextIndex.c $(GENERIC_DIR)/tkTextMark.c \
$(GENERIC_DIR)/tkTextTag.c $(GENERIC_DIR)/tkTextWind.c \
- $(GENERIC_DIR)/tkOldConfig.c \
+ $(GENERIC_DIR)/tkOldConfig.c $(GENERIC_DIR)/tkOldTest.c \
$(GENERIC_DIR)/tkSquare.c $(GENERIC_DIR)/tkTest.c \
- $(GENERIC_DIR)/tkStubInit.c $(GENERIC_DIR)/tkStubLib.c
+ $(GENERIC_DIR)/tkStubInit.c
+
+TTK_SRCS = \
+ $(TTK_DIR)/ttkBlink.c \
+ $(TTK_DIR)/ttkButton.c \
+ $(TTK_DIR)/ttkCache.c \
+ $(TTK_DIR)/ttkClamTheme.c \
+ $(TTK_DIR)/ttkClassicTheme.c \
+ $(TTK_DIR)/ttkDefaultTheme.c \
+ $(TTK_DIR)/ttkElements.c \
+ $(TTK_DIR)/ttkEntry.c \
+ $(TTK_DIR)/ttkFrame.c \
+ $(TTK_DIR)/ttkImage.c \
+ $(TTK_DIR)/ttkInit.c \
+ $(TTK_DIR)/ttkLabel.c \
+ $(TTK_DIR)/ttkLayout.c \
+ $(TTK_DIR)/ttkManager.c \
+ $(TTK_DIR)/ttkNotebook.c \
+ $(TTK_DIR)/ttkPanedwindow.c \
+ $(TTK_DIR)/ttkProgress.c \
+ $(TTK_DIR)/ttkScale.c \
+ $(TTK_DIR)/ttkScrollbar.c \
+ $(TTK_DIR)/ttkScroll.c \
+ $(TTK_DIR)/ttkSeparator.c \
+ $(TTK_DIR)/ttkSquare.c \
+ $(TTK_DIR)/ttkState.c \
+ $(TTK_DIR)/ttkTagSet.c \
+ $(TTK_DIR)/ttkTheme.c \
+ $(TTK_DIR)/ttkTrace.c \
+ $(TTK_DIR)/ttkTrack.c \
+ $(TTK_DIR)/ttkTreeview.c \
+ $(TTK_DIR)/ttkWidget.c
+
+TTK_STUB_SRCS = \
+ $(TTK_DIR)/ttkStubInit.c $(TTK_DIR)/ttkStubLib.c
X11_SRCS = \
$(UNIX_DIR)/tkAppInit.c $(UNIX_DIR)/tkUnix.c \
@@ -426,6 +500,7 @@ X11_SRCS = \
$(UNIX_DIR)/tkUnixDraw.c \
$(UNIX_DIR)/tkUnixEmbed.c $(UNIX_DIR)/tkUnixEvent.c \
$(UNIX_DIR)/tkUnixFocus.c \
+ $(UNIX_DIR)/tkUnixRFont.c \
$(UNIX_DIR)/tkUnixFont.c $(UNIX_DIR)/tkUnixInit.c \
$(UNIX_DIR)/tkUnixKey.c \
$(UNIX_DIR)/tkUnixMenu.c $(UNIX_DIR)/tkUnixMenubu.c \
@@ -450,11 +525,12 @@ AQUA_SRCS = \
$(MAC_OSX_DIR)/tkMacOSXSend.c $(MAC_OSX_DIR)/tkMacOSXSubwindows.c \
$(MAC_OSX_DIR)/tkMacOSXTest.c $(MAC_OSX_DIR)/tkMacOSXWindowEvent.c \
$(MAC_OSX_DIR)/tkMacOSXWm.c $(MAC_OSX_DIR)/tkMacOSXXStubs.c \
- $(MAC_OSX_DIR)/tkMacOSXCarbonEvents.c \
+ @EXTRA_AQUA_SRCS@ \
$(GENERIC_DIR)/tkFileFilter.c $(GENERIC_DIR)/tkMacWinMenu.c \
$(GENERIC_DIR)/tkPointer.c $(UNIX_DIR)/tkUnix3d.c \
$(UNIX_DIR)/tkUnixScale.c $(XLIB_DIR)/xcolors.c $(XLIB_DIR)/xdraw.c \
- $(XLIB_DIR)/xgc.c $(XLIB_DIR)/ximage.c $(XLIB_DIR)/xutil.c
+ $(XLIB_DIR)/xgc.c $(XLIB_DIR)/ximage.c $(XLIB_DIR)/xutil.c \
+ $(TTK_DIR)/ttkMacOSXTheme.c
SRCS = $(GENERIC_SRCS) $(@TK_WINDOWINGSYSTEM@_SRCS) @PLAT_SRCS@
@@ -472,20 +548,32 @@ AQUA_PRIVATE_HDRS = $(MAC_OSX_DIR)/tkMacOSXPort.h $(MAC_OSX_DIR)/tkMacOSXInt.h
X11_PRIVATE_HDRS = $(UNIX_DIR)/tkUnixPort.h $(UNIX_DIR)/tkUnixInt.h
-HDRS = bltList.h \
- default.h ks_names.h tkPatch.h tk.h tkButton.h tkCanvas.h tkInt.h \
- tkPort.h tkScrollbar.h tkText.h
+# Currently private, eventually public
+TTK_HDRS = $(TTK_DIR)/ttkTheme.h $(TTK_DIR)/ttkDecls.h
+
+PUBLIC_HDRS = $(GENERIC_DIR)/tk.h $(GENERIC_DIR)/tkDecls.h \
+ $(GENERIC_DIR)/tkPlatDecls.h $(@TK_WINDOWINGSYSTEM@_HDRS)
+
+# The private headers we want installed for install-private-headers
+PRIVATE_HDRS = $(GENERIC_DIR)/tkInt.h $(GENERIC_DIR)/tkIntDecls.h \
+ $(GENERIC_DIR)/tkIntPlatDecls.h $(GENERIC_DIR)/tkPort.h \
+ $(TTK_HDRS) $(@TK_WINDOWINGSYSTEM@_PRIVATE_HDRS)
DEMOPROGS = browse hello ixset rmt rolodex square tcolor timer widget
+SHELL_ENV = \
+ @LD_LIBRARY_PATH_VAR@="`pwd`:${TCL_BIN_DIR}:$${@LD_LIBRARY_PATH_VAR@}"; \
+ export @LD_LIBRARY_PATH_VAR@; \
+ TCL_LIBRARY=@TCL_SRC_DIR@/library; export TCL_LIBRARY; \
+ TK_LIBRARY=@TK_SRC_DIR@/library; export TK_LIBRARY;
+
all: binaries libraries doc
-binaries: ${LIB_FILE} ${STUB_LIB_FILE} wish
+binaries: ${LIB_FILE} ${STUB_LIB_FILE} ${WISH_EXE}
libraries:
$(TOP_DIR)/doc/man.macros:
- chmod +x $(UNIX_DIR)/install-sh
$(INSTALL_DATA) @TCL_SRC_DIR@/doc/man.macros $(TOP_DIR)/doc/man.macros
doc: $(TOP_DIR)/doc/man.macros
@@ -521,9 +609,9 @@ tkLibObjs:
objs: ${OBJS}
-wish: $(WISH_OBJS) $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) @APP_RSRC_FILE@
+${WISH_EXE}: $(WISH_OBJS) $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) @APP_RSRC_FILE@
${CC} ${CFLAGS} ${LDFLAGS} $(WISH_OBJS) @TK_BUILD_LIB_SPEC@ \
- $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o wish
+ $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o ${WISH_EXE}
# Resetting the LIB_RUNTIME_DIR below is required so that
# the generated tktest executable gets the build directory
@@ -531,21 +619,21 @@ wish: $(WISH_OBJS) $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) @APP_RSRC_FILE@
# picking up an already installed version of the Tcl or
# Tk shared libraries.
-tktest: $(TKTEST_OBJS) $(TK_LIB_FILE)
- $(MAKE) tktest-real LIB_RUNTIME_DIR=`pwd`:$(TCL_BIN_DIR)
+tktest${EXE_SUFFIX}: $(TKTEST_OBJS) $(TK_LIB_FILE)
+ $(MAKE) tktest-real LIB_RUNTIME_DIR="`pwd`:$(TCL_BIN_DIR)"
-tktest-real:
- ${CC} ${CFLAGS} ${LDFLAGS} $(TKTEST_OBJS) @TK_BUILD_LIB_SPEC@ \
- $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o tktest
+tktest-real: ${TK_STUB_LIB_FILE}
+ ${CC} ${CFLAGS} ${LDFLAGS} $(TKTEST_OBJS) ${TK_STUB_LIB_FILE} ${TCL_STUB_LIB_SPEC} @TK_BUILD_LIB_SPEC@ \
+ $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o tktest${EXE_SUFFIX}
-# FIXME: This xttest rule seems to be broken in a number of ways.
-# It should use CC_SEARCH_FLAGS, it does not include the shared
-# lib location logic from tktest, and it is not clear where this
-# test.o object file comes from.
-xttest: test.o tkTest.o tkSquare.o $(TK_LIB_FILE)
- ${CC} ${CFLAGS} ${LDFLAGS} test.o tkTest.o tkSquare.o \
- @TK_BUILD_LIB_SPEC@ \
- $(WISH_LIBS) $(LD_SEARCH_FLAGS) -lXt -o xttest
+# # FIXME: This xttest rule seems to be broken in a number of ways. It should
+# # use CC_SEARCH_FLAGS, it does not include the shared lib location logic from
+# # tktest, and it is not clear where this test.o object file comes from.
+#
+# xttest: test.o tkTest.o tkSquare.o $(TK_LIB_FILE) ${TK_STUB_LIB_FILE}
+# ${CC} ${CFLAGS} ${LDFLAGS} test.o tkTest.o tkSquare.o \
+# @TK_BUILD_LIB_SPEC@ ${TK_STUB_LIB_FILE} ${TCL_STUB_LIB_SPEC} \
+# $(WISH_LIBS) $(LD_SEARCH_FLAGS) -lXt -o xttest
# Note, in the target below TCL_LIBRARY needs to be set or else
# "make test" won't work in the case where the compilation directory
@@ -554,53 +642,60 @@ xttest: test.o tkTest.o tkSquare.o $(TK_LIB_FILE)
# args to tcltest, ie:
# % make test TESTFLAGS="-verbose bps -file fileName.test"
-test: tktest
- @LD_LIBRARY_PATH_VAR@=`pwd`:${TCL_BIN_DIR}:$${@LD_LIBRARY_PATH_VAR@}; \
- export @LD_LIBRARY_PATH_VAR@; \
- TCL_LIBRARY=@TCL_SRC_DIR@/library; export TCL_LIBRARY; \
- TK_LIBRARY=@TK_SRC_DIR@/library; export TK_LIBRARY; \
- ./tktest $(TOP_DIR)/tests/all.tcl -geometry +0+0 \
- $(TESTFLAGS) $(TCLTESTARGS)
+test: test-classic test-ttk
+
+test-classic: tktest${EXE_SUFFIX}
+ $(SHELL_ENV) ./tktest${EXE_SUFFIX} $(TEST_DIR)/all.tcl -geometry +0+0 $(TESTFLAGS)
+
+test-ttk: tktest${EXE_SUFFIX}
+ $(SHELL_ENV) ./tktest${EXE_SUFFIX} $(TEST_DIR)/ttk/all.tcl -geometry +0+0 \
+ $(TESTFLAGS)
# Tests with different languages
-testlang: tktest
- @LD_LIBRARY_PATH_VAR@=`pwd`:${TCL_BIN_DIR}:$${@LD_LIBRARY_PATH_VAR@}; \
- export @LD_LIBRARY_PATH_VAR@; \
- TCL_LIBRARY=@TCL_SRC_DIR@/library; export TCL_LIBRARY; \
- TK_LIBRARY=@TK_SRC_DIR@/library; export TK_LIBRARY; \
+testlang: tktest${EXE_SUFFIX}
+ $(SHELL_ENV) \
for lang in $(LOCALES) ; \
do \
LANG=$(lang); export LANG; \
- ./tktest $(TOP_DIR)/tests/all.tcl -geometry +0+0 \
- $(TESTFLAGS) $(TCLTESTARGS); \
+ ./tktest${EXE_SUFFIX} $(TEST_DIR)/all.tcl -geometry +0+0 \
+ $(TESTFLAGS); \
done
# Useful target to launch a built tktest with the proper path,...
-runtest: tktest
- @LD_LIBRARY_PATH_VAR@=`pwd`:${TCL_BIN_DIR}:$${@LD_LIBRARY_PATH_VAR@}; \
- export @LD_LIBRARY_PATH_VAR@; \
- TCL_LIBRARY=@TCL_SRC_DIR@/library; export TCL_LIBRARY; \
- TK_LIBRARY=@TK_SRC_DIR@/library; export TK_LIBRARY; \
- ./tktest
+runtest: tktest${EXE_SUFFIX}
+ $(SHELL_ENV) ./tktest${EXE_SUFFIX}
# This target can be used to run wish from the build directory
# via `make shell` or `make shell SCRIPT=/tmp/foo.tcl`
-shell: wish
- @LD_LIBRARY_PATH_VAR@=`pwd`:${TCL_BIN_DIR}:$${@LD_LIBRARY_PATH_VAR@}; \
- export @LD_LIBRARY_PATH_VAR@; \
- TCL_LIBRARY=@TCL_SRC_DIR@/library; export TCL_LIBRARY; \
- TK_LIBRARY=@TK_SRC_DIR@/library; export TK_LIBRARY; \
- ./wish $(SCRIPT)
+shell: ${WISH_EXE}
+ $(SHELL_ENV) ./${WISH_EXE} $(SCRIPT)
+
+demo:
+ $(SHELL_ENV) ./${WISH_EXE} $(TOP_DIR)/library/demos/widget
# This target can be used to run wish inside either gdb or insight
-gdb: wish
+gdb: ${WISH_EXE}
@echo "set env @LD_LIBRARY_PATH_VAR@=`pwd`:${TCL_BIN_DIR}:$${@LD_LIBRARY_PATH_VAR@}" > gdb.run
@echo "set env TCL_LIBRARY=@TCL_SRC_DIR@/library" >> gdb.run
@echo "set env TK_LIBRARY=@TK_SRC_DIR@/library" >> gdb.run
- gdb ./wish --command=gdb.run
+ gdb ./${WISH_EXE} --command=gdb.run
rm gdb.run
-INSTALL_TARGETS = install-binaries install-libraries install-demos install-doc @EXTRA_INSTALL@
+VALGRINDARGS=--tool=memcheck --num-callers=8 --leak-resolution=high --leak-check=yes --show-reachable=yes -v
+
+valgrind: tktest@EXEEXT@
+ $(SHELL_ENV) valgrind $(VALGRINDARGS) ./tktest${EXE_SUFFIX} $(TEST_DIR)/all.tcl -geometry +0+0 -singleproc 1 $(TESTFLAGS)
+
+valgrindshell: tktest@EXEEXT@
+ $(SHELL_ENV) valgrind $(VALGRINDARGS) ./tktest${EXE_SUFFIX} $(SCRIPT)
+
+INSTALL_BASE_TARGETS = install-binaries install-libraries
+INSTALL_DOC_TARGETS = install-doc
+INSTALL_DEV_TARGETS = install-headers
+INSTALL_DEMO_TARGETS = install-demos
+INSTALL_EXTRA_TARGETS = @EXTRA_INSTALL@
+INSTALL_TARGETS = $(INSTALL_BASE_TARGETS) $(INSTALL_DOC_TARGETS) $(INSTALL_DEV_TARGETS) \
+ $(INSTALL_DEMO_TARGETS) $(INSTALL_EXTRA_TARGETS)
install: $(INSTALL_TARGETS)
@@ -613,194 +708,187 @@ install-strip:
# some ranlibs write to current directory, and this might not always be
# possible (e.g. if installing as root).
-install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) $(TK_BUILD_EXP_FILE) wish
- @for i in $(LIB_INSTALL_DIR) $(BIN_INSTALL_DIR) $(PKG_INSTALL_DIR); \
+install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) ${WISH_EXE}
+ @for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)" \
+ "$(PKG_INSTALL_DIR)" "$(CONFIG_INSTALL_DIR)" ; \
do \
- if [ ! -d $$i ] ; then \
+ if [ ! -d "$$i" ] ; then \
echo "Making directory $$i"; \
- mkdir -p $$i; \
- chmod 755 $$i; \
+ $(INSTALL_DATA_DIR) "$$i"; \
else true; \
fi; \
done;
- @if test ! -x $(SRC_DIR)/install-sh; then \
- chmod +x $(SRC_DIR)/install-sh; \
- fi
@if test "x$(TK_SHARED_BUILD)" = "x1"; then \
echo "Creating package index $(PKG_INDEX)"; \
- rm -f $(PKG_INDEX); \
+ rm -f "$(PKG_INDEX)"; \
(\
+ echo "if {[catch {package present Tcl $(TCLVERSION)$(TCLPATCHL)}]} return";\
relative=`echo | awk '{ORS=" "; split("$(TK_PKG_DIR)",a,"/"); for (f in a) {print ".."}}'`;\
- echo "if {[package vcompare [package provide Tcl] $(TCLVERSION)] != 0} { return }";\
- echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)\
+ echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL)\
[list load [file join \$$dir $${relative}$(TK_LIB_FILE)] Tk]";\
- ) > $(PKG_INDEX); \
+ ) > "$(PKG_INDEX)"; \
fi
- @echo "Installing $(LIB_FILE) to $(LIB_INSTALL_DIR)/"
+ @echo "Installing $(LIB_FILE) to @DLL_INSTALL_DIR@/"
@@INSTALL_LIB@
- @chmod 555 $(LIB_INSTALL_DIR)/$(LIB_FILE)
- @if test "$(TK_BUILD_EXP_FILE)" != ""; then \
- echo "Installing $(TK_EXP_FILE) to $(LIB_INSTALL_DIR)/"; \
- $(INSTALL_DATA) $(TK_BUILD_EXP_FILE) \
- $(LIB_INSTALL_DIR)/$(TK_EXP_FILE); \
- fi
- @echo "Installing wish as $(BIN_INSTALL_DIR)/wish$(VERSION)"
- @$(INSTALL_PROGRAM) wish $(BIN_INSTALL_DIR)/wish$(VERSION)
- @echo "Installing tkConfig.sh to $(LIB_INSTALL_DIR)/"
- @$(INSTALL_DATA) tkConfig.sh $(LIB_INSTALL_DIR)/tkConfig.sh
+ @chmod 555 "@DLL_INSTALL_DIR@"/$(LIB_FILE)
+ @echo "Installing ${WISH_EXE} as $(BIN_INSTALL_DIR)/wish$(VERSION)${EXE_SUFFIX}"
+ @$(INSTALL_PROGRAM) ${WISH_EXE} "$(BIN_INSTALL_DIR)"/wish$(VERSION)${EXE_SUFFIX}
+ @echo "Installing tkConfig.sh to $(CONFIG_INSTALL_DIR)/"
+ @$(INSTALL_DATA) tkConfig.sh "$(CONFIG_INSTALL_DIR)"/tkConfig.sh
@if test "$(STUB_LIB_FILE)" != "" ; then \
echo "Installing $(STUB_LIB_FILE) to $(LIB_INSTALL_DIR)/"; \
@INSTALL_STUB_LIB@ ; \
fi
@EXTRA_INSTALL_BINARIES@
+ @echo "Installing pkg-config file to $(LIB_INSTALL_DIR)/pkgconfig/"
+ @$(INSTALL_DATA_DIR) $(LIB_INSTALL_DIR)/pkgconfig
+ @$(INSTALL_DATA) tk.pc $(LIB_INSTALL_DIR)/pkgconfig/tk.pc
install-libraries: libraries
- @if test "$(@TK_WINDOWINGSYSTEM@_XLIB_HDRS)" != ""; then \
- XLIB_INCLUDE_INSTALL_DIR=$(INCLUDE_INSTALL_DIR)/X11; fi; \
- for i in $(INCLUDE_INSTALL_DIR) $${XLIB_INCLUDE_INSTALL_DIR} \
- $(SCRIPT_INSTALL_DIR) $(SCRIPT_INSTALL_DIR)/images \
- $(SCRIPT_INSTALL_DIR)/msgs; \
+ @for i in "$(SCRIPT_INSTALL_DIR)" "$(SCRIPT_INSTALL_DIR)"/images \
+ "$(SCRIPT_INSTALL_DIR)"/msgs "$(SCRIPT_INSTALL_DIR)"/ttk; \
do \
- if [ ! -d $$i ] ; then \
+ if [ -n "$$i" -a ! -d "$$i" ] ; then \
echo "Making directory $$i"; \
- mkdir -p $$i; \
- chmod 755 $$i; \
+ $(INSTALL_DATA_DIR) "$$i"; \
else true; \
fi; \
done;
- @if test ! -x $(SRC_DIR)/install-sh; then \
- chmod +x $(SRC_DIR)/install-sh; \
- fi
- @echo "Installing header files";
- @for i in $(GENERIC_DIR)/tk.h $(GENERIC_DIR)/tkDecls.h \
- $(GENERIC_DIR)/tkPlatDecls.h $(@TK_WINDOWINGSYSTEM@_HDRS) ; \
- do \
- $(INSTALL_DATA) $$i $(INCLUDE_INSTALL_DIR); \
- done;
- @list='$(@TK_WINDOWINGSYSTEM@_XLIB_HDRS)'; for i in $$list ; \
+ @echo "Installing library files to $(SCRIPT_INSTALL_DIR)/";
+ @for i in $(TOP_DIR)/library/*.tcl $(TOP_DIR)/library/tclIndex \
+ $(UNIX_DIR)/tkAppInit.c; \
do \
- $(INSTALL_DATA) $$i $(INCLUDE_INSTALL_DIR)/X11; \
+ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"; \
done;
- @echo "Installing library files to $(SCRIPT_INSTALL_DIR)";
- @for i in $(TOP_DIR)/library/*.tcl $(GENERIC_DIR)/prolog.ps \
- $(TOP_DIR)/library/tclIndex $(UNIX_DIR)/tkAppInit.c; \
+ @echo "Installing library ttk files to $(SCRIPT_INSTALL_DIR)/ttk/";
+ @for i in $(TOP_DIR)/library/ttk/*.tcl; \
do \
- $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
+ if [ -f $$i ] ; then \
+ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/ttk; \
+ fi; \
done;
- @echo "Installing library images directory";
+ @echo "Installing library image files to $(SCRIPT_INSTALL_DIR)/images/";
@for i in $(TOP_DIR)/library/images/*; \
do \
if [ -f $$i ] ; then \
- $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/images; \
+ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/images; \
fi; \
done;
- @echo "Installing translation directory";
+ @echo "Installing message catalog files to $(SCRIPT_INSTALL_DIR)/msgs/";
@for i in $(TOP_DIR)/library/msgs/*.msg; \
do \
if [ -f $$i ] ; then \
- $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/msgs; \
+ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/msgs; \
fi; \
done;
install-demos:
- @for i in $(SCRIPT_INSTALL_DIR) \
- $(SCRIPT_INSTALL_DIR)/demos \
- $(SCRIPT_INSTALL_DIR)/demos/images ; \
+ @for i in "$(DEMO_INSTALL_DIR)" "$(DEMO_INSTALL_DIR)"/images ; \
do \
- if [ ! -d $$i ] ; then \
+ if [ ! -d "$$i" ] ; then \
echo "Making directory $$i"; \
- mkdir -p $$i; \
- chmod 755 $$i; \
+ $(INSTALL_DATA_DIR) "$$i"; \
else true; \
fi; \
done;
- @echo "Installing demos to $(SCRIPT_INSTALL_DIR)/demos/";
+ @echo "Installing demo files to $(DEMO_INSTALL_DIR)/";
@for i in $(TOP_DIR)/library/demos/*; \
do \
if [ -f $$i ] ; then \
sed -e '3 s|exec wish|exec wish$(VERSION)|' \
- $$i > $(SCRIPT_INSTALL_DIR)/demos/`basename $$i`; \
+ $$i > "$(DEMO_INSTALL_DIR)"/`basename $$i`; \
fi; \
done;
@for i in $(DEMOPROGS); \
do \
if test $$i = "square"; then \
- rm -f $(SCRIPT_INSTALL_DIR)/demos/$$i; \
+ rm -f "$(DEMO_INSTALL_DIR)"/$$i; \
else \
- chmod 755 $(SCRIPT_INSTALL_DIR)/demos/$$i; \
+ chmod 755 "$(DEMO_INSTALL_DIR)"/$$i; \
fi; \
done;
- @echo "Installing demo images";
+ @echo "Installing demo images to $(DEMO_INSTALL_DIR)/images/";
@for i in $(TOP_DIR)/library/demos/images/*; \
do \
if [ -f $$i ] ; then \
- $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/demos/images; \
+ $(INSTALL_DATA) $$i "$(DEMO_INSTALL_DIR)"/images; \
fi; \
done;
install-doc:
- @if test ! -x $(UNIX_DIR)/installManPage; then \
- chmod +x $(UNIX_DIR)/installManPage; \
- fi
- @for i in $(MAN_INSTALL_DIR) $(MAN1_INSTALL_DIR) $(MAN3_INSTALL_DIR) $(MANN_INSTALL_DIR) ; \
+ @for i in "$(MAN_INSTALL_DIR)" "$(MAN1_INSTALL_DIR)" "$(MAN3_INSTALL_DIR)" "$(MANN_INSTALL_DIR)" ; \
do \
- if [ ! -d $$i ] ; then \
+ if [ ! -d "$$i" ] ; then \
echo "Making directory $$i"; \
- mkdir -p $$i; \
- chmod 755 $$i; \
+ $(INSTALL_DATA_DIR) "$$i"; \
else true; \
fi; \
done;
- @echo "Installing and cross-linking top-level (.1) docs";
+ @echo "Installing and cross-linking top-level (.1) docs to $(MAN1_INSTALL_DIR)/";
@for i in $(TOP_DIR)/doc/*.1; do \
- $(UNIX_DIR)/installManPage $(MAN_FLAGS) $$i $(MAN1_INSTALL_DIR); \
+ $(SHELL) $(UNIX_DIR)/installManPage $(MAN_FLAGS) $$i "$(MAN1_INSTALL_DIR)"; \
done
-
- @echo "Installing and cross-linking C API (.3) docs";
+ @echo "Installing and cross-linking C API (.3) docs to $(MAN3_INSTALL_DIR)/";
@for i in $(TOP_DIR)/doc/*.3; do \
- $(UNIX_DIR)/installManPage $(MAN_FLAGS) $$i $(MAN3_INSTALL_DIR); \
+ $(SHELL) $(UNIX_DIR)/installManPage $(MAN_FLAGS) $$i "$(MAN3_INSTALL_DIR)"; \
done
-
- @echo "Installing and cross-linking command (.n) docs";
+ @echo "Installing and cross-linking command (.n) docs to $(MANN_INSTALL_DIR)/";
@for i in $(TOP_DIR)/doc/*.n; do \
- $(UNIX_DIR)/installManPage $(MAN_FLAGS) $$i $(MANN_INSTALL_DIR); \
+ $(SHELL) $(UNIX_DIR)/installManPage $(MAN_FLAGS) $$i "$(MANN_INSTALL_DIR)"; \
done
+install-headers:
+ @if test "$(@TK_WINDOWINGSYSTEM@_XLIB_HDRS)" != ""; then \
+ XLIB_INCLUDE_INSTALL_DIR="$(INCLUDE_INSTALL_DIR)"/X11; fi; \
+ for i in "$(INCLUDE_INSTALL_DIR)" "$${XLIB_INCLUDE_INSTALL_DIR}"; \
+ do \
+ if [ -n "$$i" -a ! -d "$$i" ] ; then \
+ echo "Making directory $$i"; \
+ $(INSTALL_DATA_DIR) "$$i"; \
+ else true; \
+ fi; \
+ done;
+ @echo "Installing header files to $(INCLUDE_INSTALL_DIR)/";
+ @for i in $(PUBLIC_HDRS); \
+ do \
+ $(INSTALL_DATA) $$i "$(INCLUDE_INSTALL_DIR)"; \
+ done;
+ @list='$(@TK_WINDOWINGSYSTEM@_XLIB_HDRS)'; for i in $$list ; \
+ do \
+ $(INSTALL_DATA) $$i "$(INCLUDE_INSTALL_DIR)"/X11; \
+ done;
+
# Optional target to install private headers
-install-private-headers: libraries
- @for i in $(PRIVATE_INCLUDE_INSTALL_DIR); \
+install-private-headers:
+ @for i in "$(PRIVATE_INCLUDE_INSTALL_DIR)"; \
do \
- if [ ! -d $$i ] ; then \
+ if [ ! -d "$$i" ] ; then \
echo "Making directory $$i"; \
- mkdir -p $$i; \
- chmod 755 $$i; \
+ $(INSTALL_DATA_DIR) "$$i"; \
else true; \
fi; \
done;
- @if test ! -x $(SRC_DIR)/install-sh; then \
- chmod +x $(SRC_DIR)/install-sh; \
- fi
- @echo "Installing private header files";
- @for i in $(GENERIC_DIR)/tkInt.h $(GENERIC_DIR)/tkIntDecls.h \
- $(GENERIC_DIR)/tkIntPlatDecls.h \
- $(@TK_WINDOWINGSYSTEM@_PRIVATE_HDRS); \
+ @echo "Installing private header files to $(PRIVATE_INCLUDE_INSTALL_DIR)/";
+ @for i in $(PRIVATE_HDRS); \
do \
- $(INSTALL_DATA) $$i $(PRIVATE_INCLUDE_INSTALL_DIR); \
+ $(INSTALL_DATA) $$i "$(PRIVATE_INCLUDE_INSTALL_DIR)"; \
done;
- @sed -e 's#\.\./unix/##' $(GENERIC_DIR)/tkPort.h > tkPort.h; \
- $(INSTALL_DATA) tkPort.h $(PRIVATE_INCLUDE_INSTALL_DIR); \
- rm -f tkPort.h
+ @if test -f tkConfig.h; then\
+ $(INSTALL_DATA) tkConfig.h "$(PRIVATE_INCLUDE_INSTALL_DIR)"; \
+ fi;
Makefile: $(UNIX_DIR)/Makefile.in
$(SHELL) config.status
+#tkConfig.h: $(UNIX_DIR)/tkConfig.h.in
+# $(SHELL) config.status
clean:
rm -f *.a *.o libtk* core errs *~ \#* TAGS *.E a.out \
- errors wish tktest lib.exp Tk *.rsrc
+ errors ${WISH_EXE} tktest${EXE_SUFFIX} lib.exp Tk *.rsrc
distclean: clean
rm -rf Makefile config.status config.cache config.log tkConfig.sh \
- $(PACKAGE).* prototype *.plist Tk.framework
+ tkConfig.h *.plist Tk.framework tk.pc
depend:
makedepend -- $(DEPEND_SWITCHES) -- $(SRCS)
@@ -813,7 +901,7 @@ depend:
# execute concurrently with the renaming and recompiling of that same object
# file in the target below.
-tkTestInit.o: $(UNIX_DIR)/tkAppInit.c wish
+tkTestInit.o: $(UNIX_DIR)/tkAppInit.c ${WISH_EXE}
@if test -f tkAppInit.o ; then \
rm -f tkAppInit.sav; \
mv tkAppInit.o tkAppInit.sav; \
@@ -843,6 +931,9 @@ tkBind.o: $(GENERIC_DIR)/tkBind.c
tkBitmap.o: $(GENERIC_DIR)/tkBitmap.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkBitmap.c
+tkBusy.o: $(GENERIC_DIR)/tkBusy.c
+ $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkBusy.c
+
tkClipboard.o: $(GENERIC_DIR)/tkClipboard.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkClipboard.c
@@ -1002,12 +1093,21 @@ tkImgBmap.o: $(GENERIC_DIR)/tkImgBmap.c
tkImgGIF.o: $(GENERIC_DIR)/tkImgGIF.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgGIF.c
+tkImgPNG.o: $(GENERIC_DIR)/tkImgPNG.c
+ $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPNG.c
+
tkImgPPM.o: $(GENERIC_DIR)/tkImgPPM.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPPM.c
-tkImgPhoto.o: $(GENERIC_DIR)/tkImgPhoto.c
+tkImgPhoto.o: $(GENERIC_DIR)/tkImgPhoto.c $(GENERIC_DIR)/tkImgPhoto.h
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhoto.c
+tkImgPhInstance.o: $(GENERIC_DIR)/tkImgPhInstance.c $(GENERIC_DIR)/tkImgPhoto.h
+ $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhInstance.c
+
+tkOldTest.o: $(GENERIC_DIR)/tkOldTest.c
+ $(CC) -c $(APP_CC_SWITCHES) $(GENERIC_DIR)/tkOldTest.c
+
tkTest.o: $(GENERIC_DIR)/tkTest.c
$(CC) -c $(APP_CC_SWITCHES) $(GENERIC_DIR)/tkTest.c
@@ -1044,9 +1144,6 @@ tkStubInit.o: $(GENERIC_DIR)/tkStubInit.c
tkStubLib.o: $(GENERIC_DIR)/tkStubLib.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkStubLib.c
-tkStubImg.o: $(GENERIC_DIR)/tkStubImg.c
- $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkStubImg.c
-
tkUndo.o: $(GENERIC_DIR)/tkUndo.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkUndo.c
@@ -1083,7 +1180,11 @@ tkUnixFocus.o: $(UNIX_DIR)/tkUnixFocus.c
tkUnixFont.o: $(UNIX_DIR)/tkUnixFont.c
$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixFont.c
-tkUnixInit.o: $(UNIX_DIR)/tkUnixInit.c $(GENERIC_DIR)/tkInitScript.h tkConfig.sh
+# NB: tkUnixRFont.o uses nondefault CFLAGS
+tkUnixRFont.o: $(UNIX_DIR)/tkUnixRFont.c
+ $(CC) -c $(CC_SWITCHES) $(XFT_CFLAGS) $(UNIX_DIR)/tkUnixRFont.c
+
+tkUnixInit.o: $(UNIX_DIR)/tkUnixInit.c tkConfig.sh
$(CC) -c $(CC_SWITCHES) -DTK_LIBRARY=\"${TK_LIBRARY}\" \
$(UNIX_DIR)/tkUnixInit.c
@@ -1120,9 +1221,6 @@ tkMacOSXBitmap.o: $(MAC_OSX_DIR)/tkMacOSXBitmap.c
tkMacOSXButton.o: $(MAC_OSX_DIR)/tkMacOSXButton.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXButton.c
-tkMacOSXCarbonEvents.o: $(MAC_OSX_DIR)/tkMacOSXCarbonEvents.c
- $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXCarbonEvents.c
-
tkMacOSXClipboard.o: $(MAC_OSX_DIR)/tkMacOSXClipboard.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXClipboard.c
@@ -1159,8 +1257,8 @@ tkMacOSXFont.o: $(MAC_OSX_DIR)/tkMacOSXFont.c
tkMacOSXHLEvents.o: $(MAC_OSX_DIR)/tkMacOSXHLEvents.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXHLEvents.c
-tkMacOSXInit.o: $(MAC_OSX_DIR)/tkMacOSXInit.c $(GENERIC_DIR)/tkInitScript.h tkConfig.sh
- $(CC) -c $(CC_SWITCHES) -DTK_LIBRARY=\"${TK_LIBRARY}\" \
+tkMacOSXInit.o: $(MAC_OSX_DIR)/tkMacOSXInit.c tkConfig.sh
+ $(CC) -c $(CC_SWITCHES) -DTK_LIBRARY=\"${TK_LIBRARY}\" \
$(MAC_OSX_DIR)/tkMacOSXInit.c
tkMacOSXKeyboard.o: $(MAC_OSX_DIR)/tkMacOSXKeyboard.c
@@ -1187,6 +1285,9 @@ tkMacOSXNotify.o: $(MAC_OSX_DIR)/tkMacOSXNotify.c
tkMacOSXRegion.o: $(MAC_OSX_DIR)/tkMacOSXRegion.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXRegion.c
+tkMacOSXScale.o: $(MAC_OSX_DIR)/tkMacOSXScale.c
+ $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXScale.c
+
tkMacOSXScrlbr.o: $(MAC_OSX_DIR)/tkMacOSXScrlbr.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXScrlbr.c
@@ -1197,7 +1298,7 @@ tkMacOSXSubwindows.o: $(MAC_OSX_DIR)/tkMacOSXSubwindows.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXSubwindows.c
tkMacOSXTest.o: $(MAC_OSX_DIR)/tkMacOSXTest.c
- $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXTest.c
+ $(CC) -c $(APP_CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXTest.c
tkMacOSXWindowEvent.o: $(MAC_OSX_DIR)/tkMacOSXWindowEvent.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXWindowEvent.c
@@ -1208,6 +1309,9 @@ tkMacOSXWm.o: $(MAC_OSX_DIR)/tkMacOSXWm.c
tkMacOSXXStubs.o: $(MAC_OSX_DIR)/tkMacOSXXStubs.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXXStubs.c
+tkMacOSXCarbonEvents.o: $(TOP_DIR)/carbon/tkMacOSXCarbonEvents.c
+ $(CC) -c $(CC_SWITCHES) $(TOP_DIR)/carbon/tkMacOSXCarbonEvents.c
+
tkFileFilter.o: $(GENERIC_DIR)/tkFileFilter.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkFileFilter.c
@@ -1232,6 +1336,102 @@ ximage.o: $(XLIB_DIR)/ximage.c
xutil.o: $(XLIB_DIR)/xutil.c
$(CC) -c $(CC_SWITCHES) $(XLIB_DIR)/xutil.c
+ttkBlink.o: $(TTK_DIR)/ttkBlink.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkBlink.c
+
+ttkButton.o: $(TTK_DIR)/ttkButton.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkButton.c
+
+ttkCache.o: $(TTK_DIR)/ttkCache.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkCache.c
+
+ttkClamTheme.o: $(TTK_DIR)/ttkClamTheme.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkClamTheme.c
+
+ttkClassicTheme.o: $(TTK_DIR)/ttkClassicTheme.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkClassicTheme.c
+
+ttkDefaultTheme.o: $(TTK_DIR)/ttkDefaultTheme.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkDefaultTheme.c
+
+ttkElements.o: $(TTK_DIR)/ttkElements.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkElements.c
+
+ttkEntry.o: $(TTK_DIR)/ttkEntry.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkEntry.c
+
+ttkFrame.o: $(TTK_DIR)/ttkFrame.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkFrame.c
+
+ttkImage.o: $(TTK_DIR)/ttkImage.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkImage.c
+
+ttkInit.o: $(TTK_DIR)/ttkInit.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkInit.c
+
+ttkLabel.o: $(TTK_DIR)/ttkLabel.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkLabel.c
+
+ttkLayout.o: $(TTK_DIR)/ttkLayout.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkLayout.c
+
+ttkManager.o: $(TTK_DIR)/ttkManager.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkManager.c
+
+ttkNotebook.o: $(TTK_DIR)/ttkNotebook.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkNotebook.c
+
+ttkPanedwindow.o: $(TTK_DIR)/ttkPanedwindow.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkPanedwindow.c
+
+ttkProgress.o: $(TTK_DIR)/ttkProgress.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkProgress.c
+
+ttkScale.o: $(TTK_DIR)/ttkScale.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkScale.c
+
+ttkScroll.o: $(TTK_DIR)/ttkScroll.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkScroll.c
+
+ttkScrollbar.o: $(TTK_DIR)/ttkScrollbar.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkScrollbar.c
+
+ttkSeparator.o: $(TTK_DIR)/ttkSeparator.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkSeparator.c
+
+ttkSquare.o: $(TTK_DIR)/ttkSquare.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkSquare.c
+
+ttkState.o: $(TTK_DIR)/ttkState.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkState.c
+
+ttkStubInit.o: $(TTK_DIR)/ttkStubInit.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkStubInit.c
+
+ttkStubLib.o: $(TTK_DIR)/ttkStubLib.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkStubLib.c
+
+ttkTagSet.o: $(TTK_DIR)/ttkTagSet.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkTagSet.c
+
+ttkTheme.o: $(TTK_DIR)/ttkTheme.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkTheme.c
+
+ttkTrace.o: $(TTK_DIR)/ttkTrace.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkTrace.c
+
+ttkTrack.o: $(TTK_DIR)/ttkTrack.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkTrack.c
+
+ttkTreeview.o: $(TTK_DIR)/ttkTreeview.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkTreeview.c
+
+ttkWidget.o: $(TTK_DIR)/ttkWidget.c
+ $(CC) -c $(CC_SWITCHES) $(TTK_DIR)/ttkWidget.c
+
+ttkMacOSXTheme.o: $(MAC_OSX_DIR)/ttkMacOSXTheme.c
+ $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/ttkMacOSXTheme.c
+
.c.o:
$(CC) -c $(CC_SWITCHES) $<
@@ -1245,9 +1445,15 @@ $(GENERIC_DIR)/tkStubInit.c: $(GENERIC_DIR)/tk.decls \
@echo "Developers may want to run \"make genstubs\" to regenerate."
@echo "This warning can be safely ignored, do not report as a bug!"
+$(TTK_DIR)/ttkStubInit.c: $(TTK_DIR)/ttk.decls
+ @echo "Warning: ttkStubInit.c may be out of date."
+ @echo "Developers may want to run \"make genstubs\" to regenerate."
+ @echo "This warning can be safely ignored, do not report as a bug!"
+
genstubs:
$(TCL_EXE) $(TOOL_DIR)/genStubs.tcl $(GENERIC_DIR) \
$(GENERIC_DIR)/tk.decls $(GENERIC_DIR)/tkInt.decls
+ $(TCL_EXE) $(TTK_DIR)/ttkGenStubs.tcl $(TTK_DIR) $(TTK_DIR)/ttk.decls
#
# Target to check that all exported functions have an entry in the stubs
@@ -1259,7 +1465,7 @@ checkstubs: $(TK_LIB_FILE)
| awk '$$2 ~ /^[TDBCS]$$/ { sub("^_", "", $$3); print $$3 }' \
| sort -n`; do \
match=0; \
- for j in $(TK_DECLS); do \
+ for j in $(TK_DECLS) $(TTK_DECLS); do \
if [ `grep -c "$$i *(" $$j` -gt 0 ]; then \
match=1; \
fi; \
@@ -1275,27 +1481,27 @@ checkuchar:
-egrep isalnum\|isalpha\|iscntrl\|isdigit\|islower\|isprint\|ispunct\|isspace\|isupper\|isxdigit\|toupper\|tolower $(SRCS) | grep -v UCHAR
#
-# Target to make sure that only symbols with "Tk" prefixes are
-# exported.
+# Target to make sure that only symbols with "Tk", "tk", "Ttk", "ttk" or "X"
+# prefixes are exported.
#
checkexports: $(TK_LIB_FILE)
-@nm -p $(TK_LIB_FILE) \
| awk '$$2 ~ /^[TDBCS]$$/ { sub("^_", "", $$3); print $$3 }' \
- | sort -n | grep -E -v '^([Tt]k|_?X)' || true
+ | sort -n | grep -E -v '^([Tt]t?k|_?X)' || true
#
# Target to create a Tk RPM for Linux. Requires that you be on a Linux
# system.
#
-rpm: all /bin/rpm
+rpm: all
rm -f THIS.TCL.SPEC
echo "%define _builddir `pwd`" > THIS.TK.SPEC
echo "%define _rpmdir `pwd`/RPMS" >> THIS.TK.SPEC
cat tk.spec >> THIS.TK.SPEC
mkdir -p RPMS/i386
- rpm -bb THIS.TK.SPEC
+ rpmbuild -bb THIS.TK.SPEC
mv RPMS/i386/*.rpm .
rm -rf RPMS THIS.TK.SPEC
@@ -1310,8 +1516,15 @@ DISTNAME = tk${VERSION}${PATCH_LEVEL}
ZIPNAME = tk${MAJOR_VERSION}${MINOR_VERSION}${PATCH_LEVEL}-src.zip
DISTDIR = $(DISTROOT)/$(DISTNAME)
TCLDIR = @TCL_SRC_DIR@
-
-dist:
+$(UNIX_DIR)/configure: $(UNIX_DIR)/configure.in $(UNIX_DIR)/tcl.m4 \
+ $(UNIX_DIR)/aclocal.m4
+ cd $(UNIX_DIR); autoconf
+$(MAC_OSX_DIR)/configure: $(MAC_OSX_DIR)/configure.ac $(UNIX_DIR)/configure
+ cd $(MAC_OSX_DIR); autoconf
+$(UNIX_DIR)/tkConfig.h.in: $(MAC_OSX_DIR)/configure
+ cd $(MAC_OSX_DIR); autoheader; touch $@
+
+dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(MAC_OSX_DIR)/configure genstubs
rm -rf $(DISTDIR)
mkdir -p $(DISTDIR)/unix
cp -p $(UNIX_DIR)/*.c $(UNIX_DIR)/*.h $(DISTDIR)/unix
@@ -1320,7 +1533,8 @@ dist:
cp $(UNIX_DIR)/configure $(UNIX_DIR)/configure.in $(UNIX_DIR)/tk.spec \
$(UNIX_DIR)/aclocal.m4 $(UNIX_DIR)/tcl.m4 \
$(UNIX_DIR)/tkConfig.sh.in $(TCLDIR)/unix/install-sh \
- $(UNIX_DIR)/README $(UNIX_DIR)/installManPage $(DISTDIR)/unix
+ $(UNIX_DIR)/README $(UNIX_DIR)/installManPage \
+ $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(DISTDIR)/unix
chmod 775 $(DISTDIR)/unix/configure $(DISTDIR)/unix/configure.in
chmod +x $(DISTDIR)/unix/install-sh
mkdir $(DISTDIR)/bitmaps
@@ -1331,13 +1545,16 @@ dist:
fi; \
done;)
mkdir $(DISTDIR)/generic
- cp -p $(GENERIC_DIR)/*.c $(GENERIC_DIR)/*.h $(GENERIC_DIR)/prolog.ps \
- $(DISTDIR)/generic
+ cp -p $(GENERIC_DIR)/*.[ch] $(DISTDIR)/generic
cp -p $(GENERIC_DIR)/*.decls $(DISTDIR)/generic
cp -p $(GENERIC_DIR)/README $(DISTDIR)/generic
- cp -p $(TOP_DIR)/changes $(TOP_DIR)/ChangeLog $(TOP_DIR)/README \
+ cp -p $(TOP_DIR)/changes $(TOP_DIR)/ChangeLog \
+ $(TOP_DIR)/ChangeLog.2??? $(TOP_DIR)/README \
$(TOP_DIR)/license.terms $(DISTDIR)
rm -f $(DISTDIR)/generic/blt*.[ch]
+ mkdir $(DISTDIR)/generic/ttk
+ cp -p $(TTK_DIR)/*.[ch] $(TTK_DIR)/ttk.decls \
+ $(TTK_DIR)/ttkGenStubs.tcl $(DISTDIR)/generic/ttk
mkdir $(DISTDIR)/win
cp $(TOP_DIR)/win/Makefile.in $(DISTDIR)/win
cp $(TOP_DIR)/win/configure.in \
@@ -1345,46 +1562,55 @@ dist:
$(TOP_DIR)/win/tkConfig.sh.in \
$(TOP_DIR)/win/aclocal.m4 $(TOP_DIR)/win/tcl.m4 \
$(DISTDIR)/win
- cp -p $(TOP_DIR)/win/*.c $(TOP_DIR)/win/*.h $(DISTDIR)/win
- cp -p $(TOP_DIR)/win/*.bat $(DISTDIR)/win
+ cp -p $(TOP_DIR)/win/*.[ch] $(TOP_DIR)/win/*.bat $(DISTDIR)/win
$(TCL_EXE) $(TOOL_DIR)/eolFix.tcl -crlf $(DISTDIR)/win/*.bat
cp -p $(TOP_DIR)/win/makefile.* $(DISTDIR)/win
$(TCL_EXE) $(TOOL_DIR)/eolFix.tcl -crlf $(DISTDIR)/win/makefile.*
cp -p $(TOP_DIR)/win/rules.vc $(DISTDIR)/win
$(TCL_EXE) $(TOOL_DIR)/eolFix.tcl -crlf $(DISTDIR)/win/rules.vc
cp -p $(TOP_DIR)/win/README $(DISTDIR)/win
- cp -p $(TOP_DIR)/win/lamp.bmp $(DISTDIR)/win
cp -p $(TOP_DIR)/license.terms $(DISTDIR)/win
mkdir $(DISTDIR)/win/rc
cp -p $(TOP_DIR)/win/wish.exe.manifest.in $(DISTDIR)/win/
- cp -p $(TOP_DIR)/win/rc/*.rc $(TOP_DIR)/win/rc/*.cur \
- $(TOP_DIR)/win/rc/*.ico $(TOP_DIR)/win/rc/*.bmp \
- $(DISTDIR)/win/rc
+ cp -p $(TOP_DIR)/win/rc/*.{rc,cur,ico,bmp} $(DISTDIR)/win/rc
$(TCL_EXE) $(TOOL_DIR)/eolFix.tcl -crlf $(DISTDIR)/win/rc/*.rc
$(TCL_EXE) $(TOOL_DIR)/eolFix.tcl -crlf $(DISTDIR)/win/wish.exe.manifest.in
- mkdir $(DISTDIR)/mac
- cp -p $(TOP_DIR)/mac/tkMacProjects.sea.hqx $(DISTDIR)/mac
- cp -p $(TOP_DIR)/mac/*.c $(TOP_DIR)/mac/*.h $(TOP_DIR)/mac/*.r \
- $(DISTDIR)/mac
- cp -p $(TOP_DIR)/mac/README $(DISTDIR)/mac
- cp -p $(TOP_DIR)/license.terms $(DISTDIR)/mac
- cp -p $(TOP_DIR)/mac/*.pch $(DISTDIR)/mac
- cp -p $(TOP_DIR)/mac/*.doc $(DISTDIR)/mac
- cp -p $(TOP_DIR)/mac/*.tcl $(DISTDIR)/mac
mkdir $(DISTDIR)/macosx
- cp -p $(MAC_OSX_DIR)/Makefile $(MAC_OSX_DIR)/README \
- $(MAC_OSX_DIR)/Wish.icns $(MAC_OSX_DIR)/*.c \
- $(MAC_OSX_DIR)/*.h $(MAC_OSX_DIR)/*.in \
- $(MAC_OSX_DIR)/*.r $(DISTDIR)/macosx
+ cp -p $(TOP_DIR)/macosx/GNUmakefile $(TOP_DIR)/macosx/README \
+ $(TOP_DIR)/macosx/*.icns $(TOP_DIR)/macosx/*.tiff \
+ $(TOP_DIR)/macosx/*.[ch] $(TOP_DIR)/macosx/*.in \
+ $(TOP_DIR)/macosx/*.ac $(TOP_DIR)/macosx/*.xcconfig \
+ $(TOP_DIR)/macosx/*.sdef $(TOP_DIR)/macosx/configure \
+ $(DISTDIR)/macosx
cp -p $(TOP_DIR)/license.terms $(DISTDIR)/macosx
- mkdir $(DISTDIR)/macosx/Wish.pbproj
- cp -p $(MAC_OSX_DIR)/Wish.pbproj/*.pbx* $(DISTDIR)/macosx/Wish.pbproj
+ mkdir $(DISTDIR)/macosx/Tk.xcode
+ cp -p $(TOP_DIR)/macosx/Tk.xcode/project.pbxproj \
+ $(TOP_DIR)/macosx/Tk.xcode/default.pbxuser \
+ $(DISTDIR)/macosx/Tk.xcode
+ mkdir $(DISTDIR)/macosx/Tk.xcodeproj
+ cp -p $(TOP_DIR)/macosx/Tk.xcodeproj/project.pbxproj \
+ $(TOP_DIR)/macosx/Tk.xcodeproj/default.pbxuser \
+ $(DISTDIR)/macosx/Tk.xcodeproj
+ mkdir $(DISTDIR)/carbon
+ cp -p $(TOP_DIR)/carbon/GNUmakefile $(TOP_DIR)/carbon/README \
+ $(TOP_DIR)/carbon/Wish.icns $(TOP_DIR)/carbon/*.[chr] \
+ $(TOP_DIR)/carbon/*.in $(TOP_DIR)/carbon/*.ac \
+ $(TOP_DIR)/carbon/*.xcconfig $(DISTDIR)/carbon
+ cp -p $(TOP_DIR)/license.terms $(DISTDIR)/carbon
+ mkdir $(DISTDIR)/carbon/Wish.xcode
+ cp -p $(TOP_DIR)/carbon/Wish.xcode/project.pbxproj \
+ $(TOP_DIR)/carbon/Wish.xcode/default.pbxuser \
+ $(DISTDIR)/carbon/Wish.xcode
+ mkdir $(DISTDIR)/carbon/Wish.xcodeproj
+ cp -p $(TOP_DIR)/carbon/Wish.xcodeproj/project.pbxproj \
+ $(TOP_DIR)/carbon/Wish.xcodeproj/default.pbxuser \
+ $(DISTDIR)/carbon/Wish.xcodeproj
mkdir $(DISTDIR)/compat
cp -p $(TOP_DIR)/license.terms $(TCLDIR)/compat/unistd.h \
$(TCLDIR)/compat/stdlib.h $(TCLDIR)/compat/limits.h \
$(DISTDIR)/compat
mkdir $(DISTDIR)/xlib
- cp -p $(XLIB_DIR)/*.h $(XLIB_DIR)/*.c $(DISTDIR)/xlib
+ cp -p $(XLIB_DIR)/*.[ch] $(DISTDIR)/xlib
cp -p $(TOP_DIR)/license.terms $(DISTDIR)/xlib
mkdir $(DISTDIR)/xlib/X11
cp -p $(XLIB_DIR)/X11/*.h $(DISTDIR)/xlib/X11
@@ -1393,6 +1619,8 @@ dist:
cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/library/*.tcl \
$(TOP_DIR)/library/tclIndex \
$(DISTDIR)/library
+ mkdir $(DISTDIR)/library/ttk
+ cp -p $(TOP_DIR)/library/ttk/*.tcl $(DISTDIR)/library/ttk
mkdir $(DISTDIR)/library/images
@(cd $(TOP_DIR); for i in library/images/* ; do \
if [ -f $$i ] ; then \
@@ -1407,6 +1635,7 @@ dist:
done;)
mkdir $(DISTDIR)/library/demos
cp -pr $(TOP_DIR)/library/demos/*.tcl \
+ $(TOP_DIR)/library/demos/*.msg \
$(TOP_DIR)/library/demos/tclIndex \
$(TOP_DIR)/library/demos/browse \
$(TOP_DIR)/library/demos/hello $(TOP_DIR)/library/demos/ixset \
@@ -1427,14 +1656,11 @@ dist:
cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/doc/*.[13n] \
$(TCLDIR)/doc/man.macros $(DISTDIR)/doc
mkdir $(DISTDIR)/tests
- cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/tests/*.test \
- $(TOP_DIR)/tests/*.tcl $(TOP_DIR)/tests/README \
- $(TOP_DIR)/tests/option.file* $(DISTDIR)/tests
-
-#
-# The following target can only be used for non-patch releases. Use
-# the "allpatch" target below for patch releases.
-#
+ cp -p $(TOP_DIR)/license.terms $(TEST_DIR)/*.{test,tcl} \
+ $(TEST_DIR)/README $(TEST_DIR)/*.{gif,ppm,xbm} \
+ $(TEST_DIR)/option.file* $(DISTDIR)/tests
+ mkdir $(DISTDIR)/tests/ttk
+ cp -p $(TEST_DIR)/ttk/*.{test,tcl} $(DISTDIR)/tests/ttk
alldist: dist
rm -f $(DISTROOT)/$(DISTNAME)-src.tar.gz $(DISTROOT)/$(ZIPNAME)
@@ -1442,23 +1668,6 @@ alldist: dist
gzip -9 $(DISTNAME)-src.tar; zip -qr8 $(ZIPNAME) $(DISTNAME)
#
-# The target below is similar to "alldist" except it works for patch
-# releases. It is needed because patch releases are peculiar: the
-# patch designation appears in the name of the compressed file
-# (e.g. tk8.0p1.tar.gz) but the extracted source directory doesn't
-# include the patch designation (e.g. tk8.0).
-#
-
-allpatch: dist
- rm -f $(DISTROOT)/$(DISTNAME)-src.tar.gz $(DISTROOT)/$(ZIPNAME)
- mv $(DISTROOT)/tk${VERSION} $(DISTROOT)/old
- mv $(DISTROOT)/$(DISTNAME) $(DISTROOT)/tk${VERSION}
- cd $(DISTROOT); tar cf $(DISTNAME)-src.tar tk${VERSION}; \
- gzip -9 $(DISTNAME)-src.tar; zip -r8 $(ZIPNAME) tk${VERSION}
- mv $(DISTROOT)/tk${VERSION} $(DISTROOT)/$(DISTNAME)
- mv $(DISTROOT)/old $(DISTROOT)/tk${VERSION}
-
-#
# This target creates the HTML folder for Tcl & Tk and places it
# in DISTDIR/html. It uses the tcltk-man2html.tcl tool from
# the Tcl group's tool workspace. It depends on the Tcl & Tk being
@@ -1478,108 +1687,22 @@ html-tk:
BUILD_HTML = \
@if test -f "$(BUILD_TCLSH)"; then \
- @LD_LIBRARY_PATH_VAR@=$(TCL_BIN_DIR):$${@LD_LIBRARY_PATH_VAR@}; export @LD_LIBRARY_PATH_VAR@; \
- TCL_LIBRARY=@TCL_SRC_DIR@/library; export TCL_LIBRARY; \
- TCLSH="$(BUILD_TCLSH)"; else \
+ $(SHELL_ENV) TCLSH="$(BUILD_TCLSH)"; else \
TCLSH="$(TCL_EXE)"; fi ;\
- $${TCLSH} $(TOOL_DIR)/tcltk-man2html.tcl --htmldir=$(HTML_INSTALL_DIR) \
+ "$${TCLSH}" $(TOOL_DIR)/tcltk-man2html.tcl --htmldir="$(HTML_INSTALL_DIR)" \
--srcdir=$(TOP_DIR)/.. $(BUILD_HTML_FLAGS)
#
-# Target to create a Macintosh version of the distribution. This will
-# do a normal distribution and then massage the output to prepare it
-# for moving to the Mac platform. This requires a few scripts and
-# programs found only in the Tcl greoup's tool workspace.
-#
-
-macdist: dist
- rm -f $(DISTDIR)/mac/tkMacProjects.sea.hqx
- $(TCL_EXE) $(TOOL_DIR)/man2html.tcl $(DISTDIR)/tmp ../.. tk$(VERSION)
- mv $(DISTDIR)/tmp/tk$(VERSION) $(DISTDIR)/html
- rm -rf $(DISTDIR)/doc
- rm -rf $(DISTDIR)/tmp
- $(TCL_EXE) $(TOOL_DIR)/cvtEOL.tcl $(DISTDIR)
-
-#
-# Targets to build Solaris package of the distribution for the current
-# architecture. To build stream packages for both sun4 and i86pc
-# architectures:
-#
-# On the sun4 machine, execute the following:
-# make distclean; ./configure
-# make DISTDIR=<distdir> package
-#
-# Once the build is complete, execute the following on the i86pc
-# machine:
-# make DISTDIR=<distdir> package-quick
-#
-# <distdir> is the absolute path to a directory where the build should
-# take place. These steps will generate the $(PACKAGE).sun4 and
-# $(PACKAGE).i86pc stream packages. It is important that the packages be
-# built in this fashion in order to ensure that the architecture
-# independent files are exactly the same, including timestamps, in
-# both packages.
-#
-
-PACKAGE=SCRPtk
-
-package: dist package-config package-common package-binaries package-generate
-package-quick: package-config package-binaries package-generate
-
-#
-# Configure for the current architecture in the dist directory.
-#
-package-config:
- mkdir -p $(DISTDIR)/unix/`arch`
- cd $(DISTDIR)/unix/`arch`; \
- ../configure --prefix=/opt/SUNWtcl/$(TCLVERSION) \
- --exec_prefix=/opt/SUNWtcl/$(TCLVERSION)/`arch` \
- --with-tcl=$(DISTDIR)/../tcl$(TCLVERSION)/unix/`arch` \
- --enable-shared
- mkdir -p $(DISTDIR)/SUNWtcl/$(TCLVERSION)
- mkdir -p $(DISTDIR)/SUNWtcl/$(TCLVERSION)/`arch`
-
-#
-# Build and install the architecture independent files in the dist directory.
-#
-
-package-common:
- cd $(DISTDIR)/unix/`arch`;\
- $(MAKE); \
- $(MAKE) install-libraries install-doc \
- prefix=$(DISTDIR)/SUNWtcl/$(TCLVERSION) \
- exec_prefix=$(DISTDIR)/SUNWtcl/$(TCLVERSION)/`arch`
- mkdir -p $(DISTDIR)/SUNWtcl/$(TCLVERSION)/bin
- sed -e "s/TCLVERSION/$(TCLVERSION)/g" \
- -e "s/TKVERSION/$(VERSION)/g" < $(UNIX_DIR)/wish.sh \
- > $(DISTDIR)/SUNWtcl/$(TCLVERSION)/bin/wish$(VERSION)
- chmod 755 $(DISTDIR)/SUNWtcl/$(TCLVERSION)/bin/wish$(VERSION)
-
-#
-# Build and install the architecture specific files in the dist directory.
-#
-
-package-binaries:
- cd $(DISTDIR)/unix/`arch`; \
- $(MAKE); \
- $(MAKE) install-binaries prefix=$(DISTDIR)/SUNWtcl/$(TCLVERSION) \
- exec_prefix=$(DISTDIR)/SUNWtcl/$(TCLVERSION)/`arch`
-
-#
-# Generate a package from the installed files in the dist directory for the
-# current architecture.
+# The list of all the targets that do not correspond to real files. This stops
+# 'make' from getting confused when someone makes an error in a rule.
#
-package-generate:
- pkgproto $(DISTDIR)/SUNWtcl/$(TCLVERSION)/bin=bin \
- $(DISTDIR)/SUNWtcl/$(TCLVERSION)/include=include \
- $(DISTDIR)/SUNWtcl/$(TCLVERSION)/lib=lib \
- $(DISTDIR)/SUNWtcl/$(TCLVERSION)/man=man \
- $(DISTDIR)/SUNWtcl/$(TCLVERSION)/`arch`=`arch` \
- | $(TCL_EXE) $(TCLDIR)/unix/mkProto.tcl $(TCLVERSION) \
- $(UNIX_DIR) > prototype
- pkgmk -o -d . -f prototype -a `arch`
- pkgtrans -s . $(PACKAGE).`arch` $(PACKAGE)
- rm -rf $(PACKAGE)
+.PHONY: all binaries libraries objs doc html html-tcl html-tk test runtest
+.PHONY: install install-strip install-binaries install-libraries
+.PHONY: install-headers install-private-headers install-doc
+.PHONY: clean distclean depend genstubs checkstubs checkexports checkuchar
+.PHONY: shell gdb valgrind valgrindshell dist alldist rpm
+.PHONY: tkLibObjs tktest-real test-classic test-ttk testlang
+.PHONY: demo install-demos
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/unix/README b/unix/README
index cafe2c4..ea5c8fe 100644
--- a/unix/README
+++ b/unix/README
@@ -1,153 +1,173 @@
Tk UNIX README
--------------
-This is the directory where you configure, compile, test, and install
-UNIX versions of Tk. This directory also contains source files for Tk
-that are specific to UNIX.
+This is the directory where you configure, compile, test, and install UNIX
+versions of Tk. This directory also contains source files for Tk that are
+specific to UNIX.
The information in this file is maintained at:
http://www.tcl.tk/doc/howto/compile.html
-For information on platforms where Tcl/Tk is known to compile, along
-with any porting notes for getting it to work on those platforms, see:
+For information on platforms where Tcl/Tk is known to compile, along with any
+porting notes for getting it to work on those platforms, see:
http://www.tcl.tk/software/tcltk/platforms.html
-The rest of this file contains instructions on how to do this. The
-release should compile and run either "out of the box" or with trivial
-changes on any UNIX-like system that approximates POSIX, BSD, or System
-V. We know that it runs on workstations from Sun, H-P, DEC, IBM, and
-SGI, as well as PCs running Linux, BSDI, and SCO UNIX. To compile for
-a PC running Windows, see the README file in the directory ../win. To
-compile for Mac OS X, see the README file in the directory ../macosx. To
-compile for a classic Macintosh, see the README file in the directory ../mac.
+The rest of this file contains instructions on how to do this. The release
+should compile and run either "out of the box" or with trivial changes on any
+UNIX-like system that approximates POSIX, BSD, or System V. We know that it
+runs on workstations from Sun, H-P, DEC, IBM, and SGI, as well as PCs running
+Linux, BSDI, and SCO UNIX. To compile for a PC running Windows, see the README
+file in the directory ../win. To compile for MacOSX, see the README file in
+the directory ../macosx.
How To Compile And Install Tk:
------------------------------
(a) Make sure that the Tcl release is present in the directory
- ../../tcl<version> (or else use the "--with-tcl" switch described
- below). This release of Tk will only work with the equivalently
- version Tcl release. Also, be sure that you have configured Tcl before
- you configure Tk.
+ ../../tcl<version> (or else use the "--with-tcl" switch described below).
+ This release of Tk will only work with the equivalently versioned Tcl
+ release. Also, be sure that you have configured Tcl before you configure
+ Tk.
-(b) If you have already compiled Tk once in this directory and are now
+(b) Check for patches as described in ../README.
+
+(c) If you have already compiled Tk once in this directory and are now
preparing to compile again in the same directory but for a different
- platform, type "make distclean" to discard all the configuration
- information computed previously.
-
-(d) Type "./configure". This runs a configuration script created by GNU
- autoconf, which configures Tk for your system and creates a
- Makefile. The configure script allows you to customize the Tk
- configuration for your site; for details on how you can do this,
- type "./configure -help" or refer to the autoconf documentation (not
- included here). Tk's "configure" script supports the following
- special switches in addition to the standard ones:
+ platform, or if you have applied patches, type "make distclean" to discard
+ all the configuration information computed previously.
+
+(d) Type "./configure". This runs a configuration script created by GNU
+ autoconf, which configures Tk for your system and creates a Makefile. The
+ configure script allows you to customize the Tk configuration for your
+ site; for details on how you can do this, type "./configure -help" or
+ refer to the autoconf documentation (not included here). Tk's "configure"
+ script supports the following special switches in addition to the standard
+ ones:
+
--with-tcl=DIR Specifies the directory containing the Tcl
binaries and Tcl's platform-dependent
- configuration information. By default
- the Tcl directory is assumed to be in the
- location given by (a) above.
- --enable-threads If this switch is set, Tk will compile
- itself with multithreading support.
+ configuration information. By default the Tcl
+ directory is assumed to be in the location
+ given by (a) above.
+ --with-x=DIR Tells configure where to find an installation
+ of the X Window System. Not normally needed.
+ --enable-threads If this switch is set, Tk will compile itself
+ with multithreading support.
--enable-shared If this switch is specified, Tk will compile
itself as a shared library if it can figure
- out how to do that on this platform. This
- is the default on platforms where we know
- how to build shared libraries.
+ out how to do that on this platform. This is
+ the default on platforms where we know how to
+ build shared libraries.
--disable-shared If this switch is specified, Tk will compile
itself as a static library.
- --enable-symbols build with debugging symbols By default
- standard debugging symbols are used. You
- can specify the value "mem" to include
+ --disable-rpath Turns off use of the rpath link option on
+ platforms that would otherwise use it.
+ --enable-symbols Build with debugging symbols. By default
+ standard debugging symbols are used. You can
+ specify the value "mem" to include
TCL_MEM_DEBUG memory debugging.
- --disable-symbols build without debugging symbols
- --enable-64bit enable 64bit support (where applicable)
- --disable-64bit disable 64bit support (where applicable)
- --enable-64bit-vis enable 64bit Sparc VIS support
- --disable-64bit-vis disable 64bit Sparc VIS support
+ --disable-symbols Build without debugging symbols
+ --enable-64bit Enable 64bit support (where applicable)
+ --disable-64bit Disable 64bit support (where applicable)
+ --enable-64bit-vis Enable 64bit Sparc VIS support
+ --disable-64bit-vis Disable 64bit Sparc VIS support
+ --disable-xft Disable support for antialiased fonts via the
+ Freetype/xft library. By default, this is
+ switched on whenever the configure script can
+ detect the required libraries.
--enable-man-symlinks Use symlinks for linking the manpages that
should be reachable under several names.
--enable-man-compression=PROG
Compress the manpages using PROG.
- Mac OS X only:
- --enable-framework package Tk as a framework.
- --disable-corefoundation disable use of CoreFoundation API.
- --enable-aqua use Aqua windowingsystem rather than X11,
- requires --enable-corefoundation with tcl & tk.
-
- Note: by default gcc will be used if it can be located on the PATH.
- if you want to use cc instead of gcc, set the CC environment variable
- to "cc" before running configure. It is not safe to change the Makefile
- to use gcc after configure is run.
-
- Note: be sure to use only absolute path names (those starting with "/")
- in the --prefix and --exec-prefix options.
-
-(e) Type "make". This will create a library archive called
- "libtk<version>.a" or "libtk<version>.so" and an interpreter
- application called "wish" that allows you to type Tcl commands
- interactively or execute script files.
-
-(f) If the make fails then you'll have to personalize the Makefile
- for your site or possibly modify the distribution in other ways.
- First check the porting Web page above to see if there are hints
- for compiling on your system. If you need to modify Makefile,
- there are comments at the beginning of it that describe the things
- you might want to change and how to change them.
-
-(g) Type "make install" to install Tk's binaries and script files in
- standard places. You'll need write permission on the installation
- directories to do this. The installation directories are
- determined by the "configure" script and may be specified with
- the --prefix and --exec-prefix options to "configure". See the
- Makefile for information on what directories were chosen; you
- can override these choices by modifying the "prefix" and
- "exec_prefix" variables in the Makefile.
-
-(h) At this point you can play with Tk by invoking the "wish"
- program and typing Tcl commands. However, if you haven't installed
- Tk then you'll first need to set your TK_LIBRARY environment
- variable to hold the full path name of the "library" subdirectory.
- If you haven't installed Tcl either then you'll need to set your
- TCL_LIBRARY environment variable as well (see the Tcl README file
- for information on this). Note that installed versions of wish,
- libtk.a, libtk.so, and the Tk library have a version number in their
- names, such as "wish8.4" or "libtk8.4.so"; to use the installed
- versions, either specify the version number or create a symbolic
- link (e.g. from "wish" to "wish8.4").
+ --enable-man-suffix=STRING
+ Add STRING to the name of each of the manual
+ pages. If specified without giving STRING, the
+ suffix will be "tk".
+
+ Mac OS X only:
+
+ --enable-framework Package Tk as a framework.
+ --disable-corefoundation Disable use of CoreFoundation API.
+ --enable-aqua Use Aqua windowingsystem rather than X11,
+ requires --enable-corefoundation with Tcl and
+ Tk.
+
+ Note: by default gcc will be used if it can be located on the PATH. If you
+ want to use cc instead of gcc, set the CC environment variable to "cc"
+ before running configure. It is not safe to change the Makefile to use gcc
+ after configure is run.
+
+ Note: be sure to use only absolute path names (those starting with "/") in
+ the --prefix and --exec-prefix options.
+
+(e) Type "make". This will create a library archive called "libtk<version>.a"
+ or "libtk<version>.so" and an interpreter application called "wish" that
+ allows you to type Tcl/Tk commands interactively or execute script files.
+ It will also create a stub library archive "libtkstub<version>.a" that
+ developers may link against other C code to produce loadable extensions
+ that call into Tk's public interface routines.
+
+(f) If the make fails then you'll have to personalize the Makefile for your
+ site or possibly modify the distribution in other ways. First check the
+ porting Web page above to see if there are hints for compiling on your
+ system. If you need to modify Makefile, there are comments at the
+ beginning of it that describe the things you might want to change and how
+ to change them.
+
+(g) Type "make install" to install Tk's binaries and script files in standard
+ places. You'll need write permission on the installation directories to do
+ this. The installation directories are determined by the "configure"
+ script and may be specified with the --prefix and --exec-prefix options to
+ "configure". See the Makefile for information on what directories were
+ chosen. You should not override these choices by modifying the Makefile,
+ or by copying files post-install. The installed binaries have embedded
+ within them path values relative to the install directory. If you change
+ your mind about where Tk should be installed, start this procedure over
+ again from step (a) so that the path embedded in the binaries agrees with
+ the install location.
+
+(h) At this point you can play with Tk by running the installed "wish"
+ executable, or via the "make shell" target, and typing Tcl/Tk commands at
+ the interactive prompt.
If you have trouble compiling Tk, see the URL noted above about working
-platforms. It contains information that people have provided about changes
-they had to make to compile Tk in various environments. We're also
-interested in hearing how to change the configuration setup so that Tk
-compiles on additional platforms "out of the box".
+platforms. It contains information that people have provided about changes
+they had to make to compile Tk in various environments. We're also interested
+in hearing how to change the configuration setup so that Tk compiles on
+additional platforms "out of the box".
+
+Note: Do not specify either of the TCL_LIBRARY and TK_LIBRARY environment
+variables in a production installation, as this can cause conflicts between
+different versions of the libraries. Instead, the libraries should have the
+correct locations of their associated script directories built into them.
Test suite
----------
-Tk has a substantial self-test suite, consisting of a set of scripts in
-the subdirectory "tests". To run the test suite just type "make test"
-in this directory. You should then see a printout of the test files
-processed. If any errors occur, you'll see a much more substantial
-printout for each error. In order to avoid false error reports, be sure
-to run the tests with an empty resource database (e.g., remove your
-.Xdefaults file or delete any entries starting with *). Also, don't
-try to do anything else with your display or keyboard while the tests
-are running, or you may get false violations. See the README file in
-the "tests" directory for more information on the test suite.
-
-If the test suite generates errors, most likely they are due to non-
-portable tests that are interacting badly with your system configuration.
-We are gradually eliminating the non-portable tests, but this release
-includes many new tests so there will probably be some portability
-problems. As long as the test suite doesn't core dump, it's probably
-safe to conclude that any errors represent portability problems in the
-test suite and not fundamental flaws with Tk.
+Tk has a substantial self-test suite, consisting of a set of scripts in the
+subdirectory "tests". To run the test suite just type "make test" in this
+directory. You should then see a printout of the test files processed. If any
+errors occur, you'll see a much more substantial printout for each error. In
+order to avoid false error reports, be sure to run the tests with an empty
+resource database (e.g., remove your .Xdefaults file or delete any entries
+starting with *). Also, don't try to do anything else with your display or
+keyboard while the tests are running, or you may get false violations. See the
+README file in the "tests" directory for more information on the test suite.
+
+If the test suite generates errors, most likely they are due to non-portable
+tests that are interacting badly with your system configuration. We are
+gradually eliminating the non-portable tests, but this release includes many
+new tests so there will probably be some portability problems. As long as the
+test suite doesn't core dump, it's probably safe to conclude that any errors
+represent portability problems in the test suite and not fundamental flaws
+with Tk.
There are also a number of visual tests for things such as screen layout,
-Postscript generation, etc. These tests all have to be run by manually
-enabling the "userInteraction" constraint when testing, and the results
-have to be verified visually.. This can be done with
- make test TESTFLAGS="-constraints userInteraction"
-Some tests will present a main window with a bunch of menus, which you can
-use to select various tests.
+Postscript generation, etc. These tests all have to be run by manually
+enabling the "userInteraction" constraint when testing, and the results have
+to be verified visually. This can be done with:
+
+ make test TESTFLAGS="-constraints userInteraction"
+
+Some tests will present a main window with a bunch of menus, which you can use
+to select various tests.
diff --git a/unix/aclocal.m4 b/unix/aclocal.m4
index bc7540d..90d2e39 100644
--- a/unix/aclocal.m4
+++ b/unix/aclocal.m4
@@ -1 +1 @@
-builtin(include,tcl.m4)
+builtin(include,../unix/tcl.m4)
diff --git a/unix/configure b/unix/configure
index ac5a7ed..5b28fa9 100755
--- a/unix/configure
+++ b/unix/configure
@@ -1,59 +1,324 @@
#! /bin/sh
-
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+# Generated by GNU Autoconf 2.59 for tk 8.6.
#
+# 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. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs 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
+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
+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
+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
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+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'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+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 |
+ 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: 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= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+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
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# 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'"
-# Defaults:
-ac_help=
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, 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
-# Any additions from configure.in:
-ac_help="$ac_help
- --with-tcl directory containing tcl configuration (tclConfig.sh)"
-ac_help="$ac_help
- --enable-man-symlinks use symlinks for the manpages"
-ac_help="$ac_help
- --enable-man-compression=PROG
- compress the manpages with PROG"
-ac_help="$ac_help
- --enable-man-suffix=STRING
- use STRING as a suffix to manpage file names
- (default: tk)"
-ac_help="$ac_help
- --enable-threads build with threads"
-ac_help="$ac_help
- --enable-shared build and link with shared libraries [--enable-shared]"
-ac_help="$ac_help
- --enable-64bit enable 64bit support (where applicable)"
-ac_help="$ac_help
- --enable-64bit-vis enable 64bit Sparc VIS support"
-ac_help="$ac_help
- --disable-rpath disable rpath support (default: on)"
-ac_help="$ac_help
- --enable-corefoundation use CoreFoundation API [--enable-corefoundation]"
-ac_help="$ac_help
- --disable-load disallow dynamic loading and "load" command"
-ac_help="$ac_help
- --enable-symbols build with debugging symbols [--disable-symbols]"
-ac_help="$ac_help
- --enable-aqua enable Aqua windowingsystem on Mac OS X [--disable-aqua]"
-ac_help="$ac_help
- --with-x use the X Window System"
-ac_help="$ac_help
- --enable-framework package shared libraries in MacOSX frameworks [--disable-framework]"
+ac_config_libobj_dir=.
+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_BUGREPORT=''
+
+# 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>
+#endif
+#if STDC_HEADERS
+# 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
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+#endif
+#if 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 TCL_VERSION TCL_PATCH_LEVEL 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 TCLSH_PROG BUILD_TCLSH MAN_FLAGS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP TCL_THREADS RANLIB ac_ct_RANLIB AR ac_ct_AR LIBOBJS TCL_LIBS DL_LIBS DL_OBJS PLAT_OBJS PLAT_SRCS LDAIX_SRC CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING LDFLAGS_DEBUG LDFLAGS_OPTIMIZE CC_SEARCH_FLAGS LD_SEARCH_FLAGS STLIB_LD SHLIB_LD TCL_SHLIB_LD_EXTRAS TK_SHLIB_LD_EXTRAS SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX MAKE_LIB MAKE_STUB_LIB INSTALL_LIB DLL_INSTALL_DIR INSTALL_STUB_LIB CFLAGS_DEFAULT LDFLAGS_DEFAULT XFT_CFLAGS XFT_LIBS UNIX_FONT_OBJS TK_VERSION TK_MAJOR_VERSION TK_MINOR_VERSION TK_PATCH_LEVEL TK_YEAR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_STUB_LIB_PATH TK_INCLUDE_SPEC TK_BUILD_STUB_LIB_SPEC TK_BUILD_STUB_LIB_PATH TK_SRC_DIR TK_SHARED_BUILD LD_LIBRARY_PATH_VAR TK_BUILD_LIB_SPEC TCL_STUB_FLAGS XINCLUDES XLIBSW LOCALES TK_WINDOWINGSYSTEM TK_PKG_DIR TK_LIBRARY LIB_RUNTIME_DIR PRIVATE_INCLUDE_DIR HTML_DIR EXTRA_CC_SWITCHES EXTRA_APP_CC_SWITCHES EXTRA_INSTALL EXTRA_INSTALL_BINARIES EXTRA_BUILD_HTML EXTRA_WISH_LIBS EXTRA_AQUA_OBJS EXTRA_AQUA_SRCS CFBUNDLELOCALIZATIONS MACOSX_SRC_DIR TK_RSRC_FILE WISH_RSRC_FILE LIB_RSRC_FILE APP_RSRC_FILE REZ REZ_FLAGS LTLIBOBJS'
+ac_subst_files=''
# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
# The variables have the same names as the options, with
# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
+cache_file=/dev/null
exec_prefix=NONE
-host=NONE
no_create=
-nonopt=NONE
no_recursion=
prefix=NONE
program_prefix=NONE
@@ -62,10 +327,15 @@ program_transform_name=s,x,x,
silent=
site=
srcdir=
-target=NONE
verbose=
x_includes=NONE
x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# 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.
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
@@ -79,17 +349,9 @@ oldincludedir='/usr/include'
infodir='${prefix}/info'
mandir='${prefix}/man'
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
ac_prev=
for ac_option
do
-
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval "$ac_prev=\$ac_option"
@@ -97,59 +359,59 @@ do
continue
fi
- case "$ac_option" in
- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
# Accept the important Cygnus configure options, so we can diagnose typos.
- case "$ac_option" in
+ case $ac_option in
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir="$ac_optarg" ;;
+ bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
- ac_prev=build ;;
+ ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$ac_optarg" ;;
+ build_alias=$ac_optarg ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file="$ac_optarg" ;;
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
| --da=*)
- datadir="$ac_optarg" ;;
+ datadir=$ac_optarg ;;
-disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
+ 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" ;;
-enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
+ 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 ;;
esac
- eval "enable_${ac_feature}='$ac_optarg'" ;;
+ eval "enable_$ac_feature='$ac_optarg'" ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -158,95 +420,47 @@ do
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
- exec_prefix="$ac_optarg" ;;
+ exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
- -help | --help | --hel | --he)
- # 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 << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --program-prefix=PREFIX prepend PREFIX to installed program names
- --program-suffix=SUFFIX append SUFFIX to installed program names
- --program-transform-name=PROGRAM
- run sed PROGRAM on installed program names
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
-host | --host | --hos | --ho)
- ac_prev=host ;;
+ ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
- host="$ac_optarg" ;;
+ host_alias=$ac_optarg ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir="$ac_optarg" ;;
+ includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir="$ac_optarg" ;;
+ infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir="$ac_optarg" ;;
+ libdir=$ac_optarg ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
- libexecdir="$ac_optarg" ;;
+ libexecdir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst \
@@ -255,19 +469,19 @@ EOF
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* \
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir="$ac_optarg" ;;
+ localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir="$ac_optarg" ;;
+ mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c)
+ | --no-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
@@ -281,26 +495,26 @@ EOF
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir="$ac_optarg" ;;
+ oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix="$ac_optarg" ;;
+ prefix=$ac_optarg ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix="$ac_optarg" ;;
+ program_prefix=$ac_optarg ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix="$ac_optarg" ;;
+ program_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
@@ -317,7 +531,7 @@ EOF
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name="$ac_optarg" ;;
+ program_transform_name=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
@@ -327,7 +541,7 @@ EOF
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
- sbindir="$ac_optarg" ;;
+ sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
@@ -338,58 +552,57 @@ EOF
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
- sharedstatedir="$ac_optarg" ;;
+ sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
- site="$ac_optarg" ;;
+ site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir="$ac_optarg" ;;
+ srcdir=$ac_optarg ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir="$ac_optarg" ;;
+ sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target ;;
+ ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
+ target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
-with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
+ 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
- *=*) ;;
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
- eval "with_${ac_package}='$ac_optarg'" ;;
+ eval "with_$ac_package='$ac_optarg'" ;;
-without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=no" ;;
+ 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" ;;
--x)
# Obsolete; use --with-x.
@@ -400,99 +613,110 @@ EOF
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes="$ac_optarg" ;;
+ x_includes=$ac_optarg ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries="$ac_optarg" ;;
+ x_libraries=$ac_optarg ;;
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
;;
+ *=*)
+ 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'"
+ export $ac_envvar ;;
+
*)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$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}
;;
esac
done
if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
fi
-exec 5>./config.log
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
+# 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; }; };;
+ esac
+done
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+ localstatedir libdir includedir oldincludedir infodir mandir
do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
esac
done
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+# 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
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+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
+fi
-# 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
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=../generic/tk.h
# 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_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ 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'`
srcdir=$ac_confdir
if test ! -r $srcdir/$ac_unique_file; then
srcdir=..
@@ -502,13 +726,495 @@ else
fi
if test ! -r $srcdir/$ac_unique_file; then
if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+ { (exit 1); exit 1; }; }
else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
fi
fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+(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
+
+#
+# Report the --help message.
+#
+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.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --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
+ --cache-file=FILE cache test results in FILE [disabled]
+ -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 \`..']
+
+_ACEOF
+
+ cat <<_ACEOF
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [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'.
+
+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]
+_ACEOF
+
+ cat <<\_ACEOF
+
+X features:
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of tk 8.6:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-man-symlinks use symlinks for the manpages (default: off)
+ --enable-man-compression=PROG
+ compress the manpages with PROG (default: off)
+ --enable-man-suffix=STRING
+ use STRING as a suffix to manpage file names
+ (default: no, tk if enabled without
+ specifying STRING)
+ --enable-threads build with threads (default: on)
+ --enable-shared build and link with shared libraries (default: on)
+ --enable-64bit enable 64bit support (default: off)
+ --enable-64bit-vis enable 64bit Sparc VIS support (default: off)
+ --disable-rpath disable rpath support (default: on)
+ --enable-corefoundation use CoreFoundation API on MacOSX (default: on)
+ --enable-load allow dynamic loading and "load" command (default:
+ on)
+ --enable-symbols build with debugging symbols (default: off)
+ --enable-aqua=yes|carbon|no
+ use Aqua windowingsystem on Mac OS X (default: no)
+ --enable-xss use XScreenSaver for activity timer (default: on)
+ --enable-xft use freetype/fontconfig/xft (default: on)
+ --enable-framework package shared libraries in MacOSX frameworks
+ (default: off)
+
+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-x use the X Window System
+
+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>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+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
+ 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 $srcdir in
+ .) # No --srcdir option. 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_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;;
+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
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi
+ cd $ac_popdir
+ done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+ cat <<\_ACEOF
+tk configure 8.6
+generated by GNU Autoconf 2.59
+
+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.
+_ACEOF
+ exit 0
+fi
+exec 5>config.log
+cat >&5 <<_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
+
+ $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 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`
+/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`
+
+_ASUNAME
+
+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
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) 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=" "
+ ;;
+ 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; }
+
+# 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.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+{
+ (set) 2>&1 |
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ sed -n \
+ "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"
+ ;;
+ esac;
+}
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ sed "/^$/d" confdefs.h | sort
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core &&
+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+ ' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); 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
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# 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
@@ -519,49 +1225,123 @@ if test -z "$CONFIG_SITE"; then
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file"
fi
done
if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
+ # 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;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
+ esac
+ fi
else
- echo "creating cache $cache_file"
- > $cache_file
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# 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
+ 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"
+ 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;}
+ 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;}
+ 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=:
+ 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=$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'" ;;
+ 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; }; }
fi
ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-TK_VERSION=8.4
+
+
+
+
+
+
+
+
+
+
+
+
+TK_VERSION=8.6
TK_MAJOR_VERSION=8
-TK_MINOR_VERSION=4
-TK_PATCH_LEVEL=".19"
+TK_MINOR_VERSION=6
+TK_PATCH_LEVEL="b2"
VERSION=${TK_VERSION}
-LOCALES="cs de el en en_gb eo es fr hu it nl pl pt ru"
+LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"
#--------------------------------------------------------------------
# Find and load the tclConfig.sh file
@@ -577,32 +1357,35 @@ LOCALES="cs de el en en_gb eo es fr hu it nl pl pt ru"
if test x"${no_tcl}" = x ; then
# we reset no_tcl in case something fails here
no_tcl=true
- # Check whether --with-tcl or --without-tcl was given.
+
+# Check whether --with-tcl or --without-tcl was given.
if test "${with_tcl+set}" = set; then
withval="$with_tcl"
- with_tclconfig=${withval}
-fi
-
- echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6
-echo "configure:588: checking for Tcl configuration" >&5
- if eval "test \"`echo '$''{'ac_cv_c_tclconfig'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ 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
-
+
# 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 "configure: warning: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" 1>&2
+ { 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;}
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 "configure: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" 1>&2; exit 1; }
+ { { 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; }; }
fi
fi
@@ -672,29 +1455,34 @@ else
fi
done
fi
-
+
fi
if test x"${ac_cv_c_tclconfig}" = x ; then
TCL_BIN_DIR="# no Tcl configs found"
- { echo "configure: error: Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" 1>&2; exit 1; }
+ { { 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; }; }
else
no_tcl=
TCL_BIN_DIR="${ac_cv_c_tclconfig}"
- echo "$ac_t""found ${TCL_BIN_DIR}/tclConfig.sh" 1>&6
+ echo "$as_me:$LINENO: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5
+echo "${ECHO_T}found ${TCL_BIN_DIR}/tclConfig.sh" >&6
fi
fi
- echo $ac_n "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh""... $ac_c" 1>&6
-echo "configure:692: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5
+ 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
if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
- echo "$ac_t""loading" 1>&6
+ echo "$as_me:$LINENO: result: loading" >&5
+echo "${ECHO_T}loading" >&6
. "${TCL_BIN_DIR}/tclConfig.sh"
else
- echo "$ac_t""could not find ${TCL_BIN_DIR}/tclConfig.sh" 1>&6
+ 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
fi
# eval is required to do the TCL_DBGX substitution
@@ -740,27 +1528,27 @@ echo "configure:692: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5
eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
-
-
-
-
-
-
-
-
-
-
- echo $ac_n "checking for tclsh""... $ac_c" 1>&6
-echo "configure:760: checking for tclsh" >&5
- if eval "test \"`echo '$''{'ac_cv_path_tclsh'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&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
-
+
search_path=`echo ${PATH} | sed -e 's/:/ /g'`
for dir in $search_path ; do
for j in `ls -r $dir/tclsh[8-9]* 2> /dev/null` \
@@ -773,33 +1561,30 @@ else
fi
done
done
-
+
fi
if test -f "$ac_cv_path_tclsh" ; then
TCLSH_PROG="$ac_cv_path_tclsh"
- echo "$ac_t""$TCLSH_PROG" 1>&6
+ echo "$as_me:$LINENO: result: $TCLSH_PROG" >&5
+echo "${ECHO_T}$TCLSH_PROG" >&6
else
# It is not an error if an installed version of Tcl can't be located.
TCLSH_PROG=""
- echo "$ac_t""No tclsh found on PATH" 1>&6
+ echo "$as_me:$LINENO: result: No tclsh found on PATH" >&5
+echo "${ECHO_T}No tclsh found on PATH" >&6
fi
-
- echo $ac_n "checking for tclsh in Tcl build directory""... $ac_c" 1>&6
-echo "configure:793: checking for tclsh in Tcl build directory" >&5
+
+ 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
BUILD_TCLSH="${TCL_BIN_DIR}"/tclsh
- echo "$ac_t""$BUILD_TCLSH" 1>&6
-
+ echo "$as_me:$LINENO: result: $BUILD_TCLSH" >&5
+echo "${ECHO_T}$BUILD_TCLSH" >&6
-if test "${TCL_VERSION}" != "${TK_VERSION}"; then
- { echo "configure: 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}." 1>&2; exit 1; }
-fi
#------------------------------------------------------------------------
# Handle the --prefix=... option
@@ -812,54 +1597,57 @@ if test "${exec_prefix}" = "NONE"; then
exec_prefix=$prefix
fi
# Make sure srcdir is fully qualified!
-srcdir=`cd $srcdir ; pwd`
-TK_SRC_DIR=`cd $srcdir/..; pwd`
+srcdir="`cd "$srcdir" ; pwd`"
+TK_SRC_DIR="`cd "$srcdir"/..; pwd`"
#------------------------------------------------------------------------
# Compress and/or soft link the manpages?
#------------------------------------------------------------------------
- echo $ac_n "checking whether to use symlinks for manpages""... $ac_c" 1>&6
-echo "configure:825: checking whether to use symlinks for manpages" >&5
+ echo "$as_me:$LINENO: checking whether to use symlinks for manpages" >&5
+echo $ECHO_N "checking whether to use symlinks for manpages... $ECHO_C" >&6
# Check whether --enable-man-symlinks or --disable-man-symlinks was given.
if test "${enable_man_symlinks+set}" = set; then
enableval="$enable_man_symlinks"
test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks"
else
enableval="no"
-fi
+fi;
+ echo "$as_me:$LINENO: result: $enableval" >&5
+echo "${ECHO_T}$enableval" >&6
- echo "$ac_t""$enableval" 1>&6
-
- echo $ac_n "checking whether to compress the manpages""... $ac_c" 1>&6
-echo "configure:837: checking whether to compress the manpages" >&5
+ echo "$as_me:$LINENO: checking whether to compress the manpages" >&5
+echo $ECHO_N "checking whether to compress the manpages... $ECHO_C" >&6
# Check whether --enable-man-compression or --disable-man-compression was given.
if test "${enable_man_compression+set}" = set; then
enableval="$enable_man_compression"
case $enableval in
- yes) { echo "configure: error: missing argument to --enable-man-compression" 1>&2; exit 1; };;
+ yes) { { echo "$as_me:$LINENO: error: missing argument to --enable-man-compression" >&5
+echo "$as_me: error: missing argument to --enable-man-compression" >&2;}
+ { (exit 1); exit 1; }; };;
no) ;;
*) MAN_FLAGS="$MAN_FLAGS --compress $enableval";;
esac
else
enableval="no"
-fi
-
- echo "$ac_t""$enableval" 1>&6
+fi;
+ echo "$as_me:$LINENO: result: $enableval" >&5
+echo "${ECHO_T}$enableval" >&6
if test "$enableval" != "no"; then
- echo $ac_n "checking for compressed file suffix""... $ac_c" 1>&6
-echo "configure:853: checking for compressed file suffix" >&5
+ echo "$as_me:$LINENO: checking for compressed file suffix" >&5
+echo $ECHO_N "checking for compressed file suffix... $ECHO_C" >&6
touch TeST
$enableval TeST
Z=`ls TeST* | sed 's/^....//'`
rm -f TeST*
MAN_FLAGS="$MAN_FLAGS --extension $Z"
- echo "$ac_t""$Z" 1>&6
+ echo "$as_me:$LINENO: result: $Z" >&5
+echo "${ECHO_T}$Z" >&6
fi
- echo $ac_n "checking whether to add a package name suffix for the manpages""... $ac_c" 1>&6
-echo "configure:863: checking whether to add a package name suffix for the manpages" >&5
+ echo "$as_me:$LINENO: checking whether to add a package name suffix for the manpages" >&5
+echo $ECHO_N "checking whether to add a package name suffix for the manpages... $ECHO_C" >&6
# Check whether --enable-man-suffix or --disable-man-suffix was given.
if test "${enable_man_suffix+set}" = set; then
enableval="$enable_man_suffix"
@@ -870,11 +1658,11 @@ if test "${enable_man_suffix+set}" = set; then
esac
else
enableval="no"
-fi
+fi;
+ echo "$as_me:$LINENO: result: $enableval" >&5
+echo "${ECHO_T}$enableval" >&6
- echo "$ac_t""$enableval" 1>&6
-
#------------------------------------------------------------------------
@@ -887,214 +1675,659 @@ if test "${CFLAGS+set}" != "set" ; then
CFLAGS=""
fi
-# Extract the first word of "gcc", so it can be a program name with args.
+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
+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
+ 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
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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 $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:894: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+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="gcc"
+ 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
+
+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.
+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
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
+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_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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 "$ac_t""no" 1>&6
+ 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
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 $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:924: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+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
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_save_ifs"
+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
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
- if test $# -gt 0; then
+ if test $# != 0; then
# We chose a different compiler from the bogus one.
# 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
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test -z "$CC"; then
- case "`uname -s`" in
- *win32* | *WIN32*)
- # Extract the first word of "cl", so it can be a program name with args.
-set dummy cl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:975: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ 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
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="cl"
- break
- fi
- done
- IFS="$ac_save_ifs"
+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_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- echo "$ac_t""no" 1>&6
-fi
- ;;
- esac
- fi
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1007: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 1018 "configure"
-#include "confdefs.h"
-
-main(){return(0);}
-EOF
-if { (eval echo configure:1023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- ac_cv_prog_cc_works=yes
- # If we can't run a trivial program, we are probably using a cross compiler.
- if (./conftest; exit) 2>/dev/null; then
- ac_cv_prog_cc_cross=no
- else
- ac_cv_prog_cc_cross=yes
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+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
+ 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="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
+done
+done
+
fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1049: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1054: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1063: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
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
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+ test -n "$ac_ct_CC" && break
+done
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
+ CC=$ac_ct_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; }; }
+
+# 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
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out 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
+ 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
+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.
+ ;;
+ [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
+ break;;
+ * )
+ break;;
+ esac
+done
else
- GCC=
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { 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; }; }
+fi
+
+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
fi
-
-ac_test_CFLAGS="${CFLAGS+set}"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1082: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out 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
+ 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'.
+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_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ { { 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; }; }
+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.$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. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$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; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$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
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ 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_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+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_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
+/* end confdefs.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_prog_cc_g=yes
else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ac_cv_prog_cc_g=no
fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+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
- CFLAGS="$ac_save_CFLAGS"
+ CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
@@ -1108,169 +2341,984 @@ 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_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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;
+}
+_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__"
+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
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+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" ;;
+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
+/* end confdefs.h. */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+ ;
+ 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
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+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
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ 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
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+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'
+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 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
+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
+/* 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; }
+#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
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
+echo "${ECHO_T}$ac_cv_c_inline" >&6
+
+
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
+esac
# limits header checks must come early to prevent
# an autoconf bug that throws errors on configure
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1117: checking how to run the C preprocessor" >&5
+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 eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ 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
+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
- # This must be in double quotes, not single quotes, because CPP may get
- # substituted into the Makefile and "${CC-cc}" will confuse make.
- CPP="${CC-cc} -E"
+ 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.
- cat > conftest.$ac_ext <<EOF
-#line 1132 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1138: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+ # 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 "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -E -traditional-cpp"
- cat > conftest.$ac_ext <<EOF
-#line 1149 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1155: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+ 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
:
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -nologo -E"
- cat > conftest.$ac_ext <<EOF
-#line 1166 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+ { { 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_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>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
:
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP=/lib/cpp
+ ac_cv_header_stdc=no
fi
rm -f conftest*
+
fi
-rm -f conftest*
+
+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*
- ac_cv_prog_CPP="$CPP"
+
fi
- CPP="$ac_cv_prog_CPP"
+
+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
- ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
+ 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>
+#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
-ac_safe=`echo "limits.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for limits.h""... $ac_c" 1>&6
-echo "configure:1198: checking for limits.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+#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
- cat > conftest.$ac_ext <<EOF
-#line 1203 "configure"
-#include "confdefs.h"
-#include <limits.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1208: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
+ 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 conftest*
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<\EOF
-#define HAVE_LIMITS_H 1
-EOF
+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
-else
- echo "$ac_t""no" 1>&6
-cat >> confdefs.h <<\EOF
-#define NO_LIMITS_H 1
-EOF
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
fi
-for ac_hdr in unistd.h
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+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
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1240: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1245 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1250: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
+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
+
fi
-rm -f conftest*
+
+done
+
+
+if test "${ac_cv_header_limits_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for limits.h" >&5
+echo $ECHO_N "checking for limits.h... $ECHO_C" >&6
+if test "${ac_cv_header_limits_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5
+echo "${ECHO_T}$ac_cv_header_limits_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking limits.h usability" >&5
+echo $ECHO_N "checking limits.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 <limits.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 limits.h presence" >&5
+echo $ECHO_N "checking limits.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 <limits.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 eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
fi
-done
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# 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: limits.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: limits.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: limits.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: limits.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: limits.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: limits.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: limits.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: limits.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: limits.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: limits.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: limits.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: limits.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: limits.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
+ ;;
+esac
+echo "$as_me:$LINENO: checking for limits.h" >&5
+echo $ECHO_N "checking for limits.h... $ECHO_C" >&6
+if test "${ac_cv_header_limits_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_limits_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5
+echo "${ECHO_T}$ac_cv_header_limits_h" >&6
+
+fi
+if test $ac_cv_header_limits_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIMITS_H 1
+_ACEOF
+
+else
+
+cat >>confdefs.h <<\_ACEOF
+#define NO_LIMITS_H 1
+_ACEOF
+
+fi
+
#--------------------------------------------------------------------
@@ -1278,58 +3326,208 @@ done
# strtoul, or strtod (which it doesn't in some versions of SunOS).
#--------------------------------------------------------------------
-echo $ac_n "checking stdlib.h""... $ac_c" 1>&6
-echo "configure:1283: checking stdlib.h" >&5
-cat > conftest.$ac_ext <<EOF
-#line 1285 "configure"
-#include "confdefs.h"
+if test "${ac_cv_header_stdlib_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for stdlib.h" >&5
+echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_stdlib_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking stdlib.h usability" >&5
+echo $ECHO_N "checking stdlib.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 <stdlib.h>
-EOF
+_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 stdlib.h presence" >&5
+echo $ECHO_N "checking stdlib.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 <stdlib.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
+
+ 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
+
+# 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: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: stdlib.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: stdlib.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: stdlib.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: stdlib.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: stdlib.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: stdlib.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: stdlib.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
+ ;;
+esac
+echo "$as_me:$LINENO: checking for stdlib.h" >&5
+echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_stdlib_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_stdlib_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6
+
+fi
+if test $ac_cv_header_stdlib_h = yes; then
+ tk_ok=1
+else
+ tk_ok=0
+fi
+
+
+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 "strtol" >/dev/null 2>&1; then
- rm -rf conftest*
- tk_ok=yes
+ $EGREP "strtol" >/dev/null 2>&1; then
+ :
else
- rm -rf conftest*
- tk_ok=no
+ tk_ok=0
fi
rm -f conftest*
-cat > conftest.$ac_ext <<EOF
-#line 1300 "configure"
-#include "confdefs.h"
+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>
-EOF
+
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "strtoul" >/dev/null 2>&1; then
+ $EGREP "strtoul" >/dev/null 2>&1; then
:
else
- rm -rf conftest*
- tk_ok=no
+ tk_ok=0
fi
rm -f conftest*
-cat > conftest.$ac_ext <<EOF
-#line 1314 "configure"
-#include "confdefs.h"
+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>
-EOF
+
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "strtod" >/dev/null 2>&1; then
+ $EGREP "strtod" >/dev/null 2>&1; then
:
else
- rm -rf conftest*
- tk_ok=no
+ tk_ok=0
fi
rm -f conftest*
-if test $tk_ok = no; then
- cat >> confdefs.h <<\EOF
+if test $tk_ok = 0; then
+
+cat >>confdefs.h <<\_ACEOF
#define NO_STDLIB_H 1
-EOF
+_ACEOF
fi
-echo "$ac_t""$tk_ok" 1>&6
#------------------------------------------------------------------------
# If we're using GCC, see if the compiler understands -pipe. If so, use it.
@@ -1337,35 +3535,62 @@ echo "$ac_t""$tk_ok" 1>&6
#------------------------------------------------------------------------
if test -z "$no_pipe" && test -n "$GCC"; then
- echo $ac_n "checking if the compiler understands -pipe""... $ac_c" 1>&6
-echo "configure:1342: checking if the compiler understands -pipe" >&5
-if eval "test \"`echo '$''{'tcl_cv_cc_pipe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking if the compiler understands -pipe" >&5
+echo $ECHO_N "checking if the compiler understands -pipe... $ECHO_C" >&6
+if test "${tcl_cv_cc_pipe+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
- hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
- cat > conftest.$ac_ext <<EOF
-#line 1349 "configure"
-#include "confdefs.h"
-
-int main() {
-; return 0; }
-EOF
-if { (eval echo configure:1356: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.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
tcl_cv_cc_pipe=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_cc_pipe=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cc_pipe=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS=$hold_cflags
fi
-
-echo "$ac_t""$tcl_cv_cc_pipe" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_cc_pipe" >&5
+echo "${ECHO_T}$tcl_cv_cc_pipe" >&6
if test $tcl_cv_cc_pipe = yes; then
CFLAGS="$CFLAGS -pipe"
fi
@@ -1381,9 +3606,8 @@ if test "${enable_threads+set}" = set; then
enableval="$enable_threads"
tcl_ok=$enableval
else
- tcl_ok=no
-fi
-
+ tcl_ok=yes
+fi;
if test "${TCL_THREADS}" = 1; then
tcl_threaded_core=1;
@@ -1393,63 +3617,96 @@ fi
TCL_THREADS=1
# USE_THREAD_ALLOC tells us to try the special thread-based
# allocator that significantly reduces lock contention
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define USE_THREAD_ALLOC 1
-EOF
+_ACEOF
+
- cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
#define _REENTRANT 1
-EOF
+_ACEOF
if test "`uname -s`" = "SunOS" ; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _POSIX_PTHREAD_SEMANTICS 1
-EOF
+_ACEOF
fi
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _THREAD_SAFE 1
-EOF
+_ACEOF
- echo $ac_n "checking for pthread_mutex_init in -lpthread""... $ac_c" 1>&6
-echo "configure:1416: checking for pthread_mutex_init in -lpthread" >&5
-ac_lib_var=`echo pthread'_'pthread_mutex_init | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthread" >&5
+echo $ECHO_N "checking for pthread_mutex_init in -lpthread... $ECHO_C" >&6
+if test "${ac_cv_lib_pthread_pthread_mutex_init+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lpthread $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1424 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char pthread_mutex_init();
-
-int main() {
-pthread_mutex_init()
-; return 0; }
-EOF
-if { (eval echo configure:1435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char pthread_mutex_init ();
+int
+main ()
+{
+pthread_mutex_init ();
+ ;
+ 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
+ ac_cv_lib_pthread_pthread_mutex_init=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_pthread_pthread_mutex_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5
+echo "${ECHO_T}$ac_cv_lib_pthread_pthread_mutex_init" >&6
+if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then
tcl_ok=yes
else
- echo "$ac_t""no" 1>&6
-tcl_ok=no
+ tcl_ok=no
fi
if test "$tcl_ok" = "no"; then
@@ -1458,45 +3715,74 @@ fi
# defined. We could alternatively do an AC_TRY_COMPILE with
# pthread.h, but that will work with libpthread really doesn't
# exist, like AIX 4.2. [Bug: 4359]
- echo $ac_n "checking for __pthread_mutex_init in -lpthread""... $ac_c" 1>&6
-echo "configure:1463: checking for __pthread_mutex_init in -lpthread" >&5
-ac_lib_var=`echo pthread'_'__pthread_mutex_init | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for __pthread_mutex_init in -lpthread" >&5
+echo $ECHO_N "checking for __pthread_mutex_init in -lpthread... $ECHO_C" >&6
+if test "${ac_cv_lib_pthread___pthread_mutex_init+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lpthread $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1471 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char __pthread_mutex_init();
-
-int main() {
-__pthread_mutex_init()
-; return 0; }
-EOF
-if { (eval echo configure:1482: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char __pthread_mutex_init ();
+int
+main ()
+{
+__pthread_mutex_init ();
+ ;
+ 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
+ ac_cv_lib_pthread___pthread_mutex_init=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_pthread___pthread_mutex_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_pthread___pthread_mutex_init" >&5
+echo "${ECHO_T}$ac_cv_lib_pthread___pthread_mutex_init" >&6
+if test $ac_cv_lib_pthread___pthread_mutex_init = yes; then
tcl_ok=yes
else
- echo "$ac_t""no" 1>&6
-tcl_ok=no
+ tcl_ok=no
fi
fi
@@ -1505,132 +3791,219 @@ fi
# The space is needed
THREADS_LIBS=" -lpthread"
else
- echo $ac_n "checking for pthread_mutex_init in -lpthreads""... $ac_c" 1>&6
-echo "configure:1510: checking for pthread_mutex_init in -lpthreads" >&5
-ac_lib_var=`echo pthreads'_'pthread_mutex_init | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthreads" >&5
+echo $ECHO_N "checking for pthread_mutex_init in -lpthreads... $ECHO_C" >&6
+if test "${ac_cv_lib_pthreads_pthread_mutex_init+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lpthreads $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1518 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char pthread_mutex_init();
-
-int main() {
-pthread_mutex_init()
-; return 0; }
-EOF
-if { (eval echo configure:1529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char pthread_mutex_init ();
+int
+main ()
+{
+pthread_mutex_init ();
+ ;
+ 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
+ ac_cv_lib_pthreads_pthread_mutex_init=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_pthreads_pthread_mutex_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_pthreads_pthread_mutex_init" >&5
+echo "${ECHO_T}$ac_cv_lib_pthreads_pthread_mutex_init" >&6
+if test $ac_cv_lib_pthreads_pthread_mutex_init = yes; then
tcl_ok=yes
else
- echo "$ac_t""no" 1>&6
-tcl_ok=no
+ tcl_ok=no
fi
if test "$tcl_ok" = "yes"; then
# The space is needed
THREADS_LIBS=" -lpthreads"
else
- echo $ac_n "checking for pthread_mutex_init in -lc""... $ac_c" 1>&6
-echo "configure:1555: checking for pthread_mutex_init in -lc" >&5
-ac_lib_var=`echo c'_'pthread_mutex_init | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc" >&5
+echo $ECHO_N "checking for pthread_mutex_init in -lc... $ECHO_C" >&6
+if test "${ac_cv_lib_c_pthread_mutex_init+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lc $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1563 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char pthread_mutex_init();
-
-int main() {
-pthread_mutex_init()
-; return 0; }
-EOF
-if { (eval echo configure:1574: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char pthread_mutex_init ();
+int
+main ()
+{
+pthread_mutex_init ();
+ ;
+ 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
+ ac_cv_lib_c_pthread_mutex_init=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_c_pthread_mutex_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_c_pthread_mutex_init" >&5
+echo "${ECHO_T}$ac_cv_lib_c_pthread_mutex_init" >&6
+if test $ac_cv_lib_c_pthread_mutex_init = yes; then
tcl_ok=yes
else
- echo "$ac_t""no" 1>&6
-tcl_ok=no
+ tcl_ok=no
fi
if test "$tcl_ok" = "no"; then
- echo $ac_n "checking for pthread_mutex_init in -lc_r""... $ac_c" 1>&6
-echo "configure:1597: checking for pthread_mutex_init in -lc_r" >&5
-ac_lib_var=`echo c_r'_'pthread_mutex_init | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc_r" >&5
+echo $ECHO_N "checking for pthread_mutex_init in -lc_r... $ECHO_C" >&6
+if test "${ac_cv_lib_c_r_pthread_mutex_init+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lc_r $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1605 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char pthread_mutex_init();
-
-int main() {
-pthread_mutex_init()
-; return 0; }
-EOF
-if { (eval echo configure:1616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char pthread_mutex_init ();
+int
+main ()
+{
+pthread_mutex_init ();
+ ;
+ 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
+ ac_cv_lib_c_r_pthread_mutex_init=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_c_r_pthread_mutex_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_mutex_init" >&5
+echo "${ECHO_T}$ac_cv_lib_c_r_pthread_mutex_init" >&6
+if test $ac_cv_lib_c_r_pthread_mutex_init = yes; then
tcl_ok=yes
else
- echo "$ac_t""no" 1>&6
-tcl_ok=no
+ tcl_ok=no
fi
if test "$tcl_ok" = "yes"; then
@@ -1638,7 +4011,8 @@ fi
THREADS_LIBS=" -pthread"
else
TCL_THREADS=0
- echo "configure: warning: Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..." 1>&2
+ { echo "$as_me:$LINENO: WARNING: Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..." >&5
+echo "$as_me: WARNING: Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..." >&2;}
fi
fi
fi
@@ -1647,250 +4021,147 @@ fi
# Does the pthread-implementation provide
# 'pthread_attr_setstacksize' ?
- ac_saved_libs=$LIBS
- LIBS="$LIBS $THREADS_LIBS"
- for ac_func in pthread_attr_setstacksize
+for ac_func in pthread_attr_setstacksize
do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1656: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1661 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+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 $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
-int main() {
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
+#ifdef __STDC__
+# include <limits.h>
#else
-$ac_func();
+# include <assert.h>
#endif
-; return 0; }
-EOF
-if { (eval echo configure:1684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
+#undef $ac_func
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
- for ac_func in pthread_atfork
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1711: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1716 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
-$ac_func();
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:1739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ 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
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
fi
done
- LIBS=$ac_saved_libs
else
TCL_THREADS=0
fi
# Do checking message here to not mess up interleaved configure output
- echo $ac_n "checking for building with threads""... $ac_c" 1>&6
-echo "configure:1769: checking for building with threads" >&5
+ echo "$as_me:$LINENO: checking for building with threads" >&5
+echo $ECHO_N "checking for building with threads... $ECHO_C" >&6
if test "${TCL_THREADS}" = 1; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define TCL_THREADS 1
-EOF
+_ACEOF
if test "${tcl_threaded_core}" = 1; then
- echo "$ac_t""yes (threaded core)" 1>&6
+ echo "$as_me:$LINENO: result: yes (threaded core)" >&5
+echo "${ECHO_T}yes (threaded core)" >&6
else
- echo "$ac_t""yes" 1>&6
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
fi
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
-
-
-#--------------------------------------------------------------------
-# On a few very rare systems, all of the libm.a stuff is
-# already in libc.a. Set compiler flags accordingly.
-# Also, Linux requires the "ieee" library for math to work
-# right (and it must appear before "-lm").
-#--------------------------------------------------------------------
-
-MATH_LIBS=""
-echo $ac_n "checking for sin""... $ac_c" 1>&6
-echo "configure:1796: checking for sin" >&5
-if eval "test \"`echo '$''{'ac_cv_func_sin'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1801 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char sin(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char sin();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_sin) || defined (__stub___sin)
-choke me
-#else
-sin();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_sin=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_sin=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'sin`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- :
-else
- echo "$ac_t""no" 1>&6
-MATH_LIBS="-lm"
-fi
-echo $ac_n "checking for main in -lieee""... $ac_c" 1>&6
-echo "configure:1845: checking for main in -lieee" >&5
-ac_lib_var=`echo ieee'_'main | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lieee $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1853 "configure"
-#include "confdefs.h"
-
-int main() {
-main()
-; return 0; }
-EOF
-if { (eval echo configure:1860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- MATH_LIBS="-lieee $MATH_LIBS"
-else
- echo "$ac_t""no" 1>&6
-fi
# Add the threads support libraries
LIBS="$LIBS$THREADS_LIBS"
- echo $ac_n "checking how to build libraries""... $ac_c" 1>&6
-echo "configure:1886: checking how to build libraries" >&5
+ 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
-
+fi;
if test "${enable_shared+set}" = set; then
enableval="$enable_shared"
@@ -1900,14 +4171,17 @@ fi
fi
if test "$tcl_ok" = "yes" ; then
- echo "$ac_t""shared" 1>&6
+ echo "$as_me:$LINENO: result: shared" >&5
+echo "${ECHO_T}shared" >&6
SHARED_BUILD=1
else
- echo "$ac_t""static" 1>&6
+ echo "$as_me:$LINENO: result: static" >&5
+echo "${ECHO_T}static" >&6
SHARED_BUILD=0
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define STATIC_BUILD 1
-EOF
+_ACEOF
fi
@@ -1918,101 +4192,299 @@ EOF
# after SC_ENABLE_SHARED checks the configure switches.
#--------------------------------------------------------------------
-# Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1925: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+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
ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+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_RANLIB="${ac_tool_prefix}ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-RANLIB="$ac_cv_prog_RANLIB"
+RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
+ echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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
+ 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
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+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
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ RANLIB=$ac_ct_RANLIB
+else
+ RANLIB="$ac_cv_prog_RANLIB"
fi
# Step 0.a: Enable 64 bit support?
- echo $ac_n "checking if 64bit support is requested""... $ac_c" 1>&6
-echo "configure:1957: checking if 64bit support is requested" >&5
+ 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 "$ac_t""$do64bit" 1>&6
+fi;
+ echo "$as_me:$LINENO: result: $do64bit" >&5
+echo "${ECHO_T}$do64bit" >&6
# Step 0.b: Enable Solaris 64 bit VIS support?
- echo $ac_n "checking if 64bit Sparc VIS support is requested""... $ac_c" 1>&6
-echo "configure:1971: checking if 64bit Sparc VIS support is requested" >&5
+ echo "$as_me:$LINENO: checking if 64bit Sparc VIS support is requested" >&5
+echo $ECHO_N "checking if 64bit Sparc VIS support is requested... $ECHO_C" >&6
# Check whether --enable-64bit-vis or --disable-64bit-vis was given.
if test "${enable_64bit_vis+set}" = set; then
enableval="$enable_64bit_vis"
do64bitVIS=$enableval
else
do64bitVIS=no
+fi;
+ echo "$as_me:$LINENO: result: $do64bitVIS" >&5
+echo "${ECHO_T}$do64bitVIS" >&6
+ # Force 64bit on with VIS
+ if test "$do64bitVIS" = "yes"; then
+ do64bit=yes
fi
- echo "$ac_t""$do64bitVIS" 1>&6
- if test "$do64bitVIS" = "yes"; then
- # Force 64bit on with VIS
- do64bit=yes
- fi
+ # Step 0.c: Check if visibility support is available. Do this here so
+ # that platform specific alternatives can be used below if this fails.
+
+ echo "$as_me:$LINENO: checking if compiler supports visibility \"hidden\"" >&5
+echo $ECHO_N "checking if compiler supports visibility \"hidden\"... $ECHO_C" >&6
+if test "${tcl_cv_cc_visibility_hidden+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ if test "$SHARED_BUILD" = 1; then
+
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fvisibility=hidden -Werror"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#if !defined(__GNUC__) || __GNUC__ < 4
+#error visibility hidden is not supported for this compiler
+#endif
+
+ ;
+ 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_cc_visibility_hidden=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cc_visibility_hidden=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS=$hold_cflags
+
+else
+
+ tcl_cv_cc_visibility_hidden=no
+
+fi
+
+
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_cc_visibility_hidden" >&5
+echo "${ECHO_T}$tcl_cv_cc_visibility_hidden" >&6
+ if test $tcl_cv_cc_visibility_hidden = yes; then
+
+ CFLAGS="$CFLAGS -fvisibility=hidden"
+
+cat >>confdefs.h <<\_ACEOF
+#define MODULE_SCOPE extern
+_ACEOF
+
+
+else
+
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ extern __attribute__((__visibility__("hidden"))) void f(void);
+ void f(void) {}
+int
+main ()
+{
+f();
+ ;
+ 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
+ tcl_cv_cc_visibility_hidden=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cc_visibility_hidden=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS=$hold_cflags
+ if test $tcl_cv_cc_visibility_hidden = yes; then
+
+
+cat >>confdefs.h <<\_ACEOF
+#define MODULE_SCOPE extern __attribute__((__visibility__("hidden")))
+_ACEOF
+
+
+fi
+
+
+fi
+
# Step 0.d: Disable -rpath support?
- echo $ac_n "checking if rpath support is requested""... $ac_c" 1>&6
-echo "configure:1990: checking if rpath support is requested" >&5
+ echo "$as_me:$LINENO: checking if rpath support is requested" >&5
+echo $ECHO_N "checking if rpath support is requested... $ECHO_C" >&6
# Check whether --enable-rpath or --disable-rpath was given.
if test "${enable_rpath+set}" = set; then
enableval="$enable_rpath"
doRpath=$enableval
else
doRpath=yes
-fi
-
- echo "$ac_t""$doRpath" 1>&6
+fi;
+ echo "$as_me:$LINENO: result: $doRpath" >&5
+echo "${ECHO_T}$doRpath" >&6
# Step 1: set the variable "system" to hold the name and version number
# for the system.
-
- echo $ac_n "checking system version""... $ac_c" 1>&6
-echo "configure:2006: checking system version" >&5
-if eval "test \"`echo '$''{'tcl_cv_sys_version'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+ echo "$as_me:$LINENO: checking system version" >&5
+echo $ECHO_N "checking system version... $ECHO_C" >&6
+if test "${tcl_cv_sys_version+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
if test -f /usr/lib/NextStep/software_version; then
tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
else
tcl_cv_sys_version=`uname -s`-`uname -r`
if test "$?" -ne 0 ; then
- echo "configure: warning: can't find uname command" 1>&2
+ { echo "$as_me:$LINENO: WARNING: can't find uname command" >&5
+echo "$as_me: WARNING: can't find uname command" >&2;}
tcl_cv_sys_version=unknown
else
# Special check for weird MP-RAS system (uname returns weird
@@ -2026,61 +4498,90 @@ else
fi
fi
fi
-
-fi
-echo "$ac_t""$tcl_cv_sys_version" 1>&6
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_sys_version" >&5
+echo "${ECHO_T}$tcl_cv_sys_version" >&6
system=$tcl_cv_sys_version
# Step 2: check for existence of -ldl library. This is needed because
# Linux can use either -ldl or -ldld for dynamic loading.
- echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:2041: checking for dlopen in -ldl" >&5
-ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-ldl $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2049 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char dlopen();
-
-int main() {
-dlopen()
-; return 0; }
-EOF
-if { (eval echo configure:2060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+ ;
+ 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
+ ac_cv_lib_dl_dlopen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dl_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
have_dl=yes
else
- echo "$ac_t""no" 1>&6
-have_dl=no
+ have_dl=no
fi
# Require ranlib early so we can override it in special cases below.
-
+
# Step 3: set configuration options based on system name and version.
@@ -2088,60 +4589,119 @@ fi
# default to '{$LIBS}' and set to "" on per-platform necessary basis
SHLIB_LD_LIBS='${LIBS}'
LDFLAGS_ORIG="$LDFLAGS"
- TCL_EXPORT_FILE_SUFFIX=""
+ # When ld needs options to work in 64-bit mode, put them in
+ # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
+ # is disabled by the user. [Bug 1016796]
+ LDFLAGS_ARCH=""
UNSHARED_LIB_SUFFIX=""
TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
ECHO_VERSION='`echo ${VERSION}`'
TCL_LIB_VERSIONS_OK=ok
CFLAGS_DEBUG=-g
- CFLAGS_OPTIMIZE=-O
- if test "$GCC" = "yes" ; then
- CFLAGS_WARNING="-Wall -fno-strict-aliasing"
- else
+ if test "$GCC" = yes; then
+
+ CFLAGS_OPTIMIZE=-O2
+ CFLAGS_WARNING="-Wall"
+
+else
+
+ CFLAGS_OPTIMIZE=-O
CFLAGS_WARNING=""
- fi
- TCL_NEEDS_EXP_FILE=0
- TCL_BUILD_EXP_FILE=""
- TCL_EXP_FILE=""
- # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2110: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+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
ac_cv_prog_AR="$AR" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AR="ar"
- break
- fi
- done
- IFS="$ac_save_ifs"
+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_AR="${ac_tool_prefix}ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
fi
fi
-AR="$ac_cv_prog_AR"
+AR=$ac_cv_prog_AR
if test -n "$AR"; then
- echo "$ac_t""$AR" 1>&6
+ echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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
+ 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
+ ac_cv_prog_ac_ct_AR="ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+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
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ AR=$ac_ct_AR
+else
+ AR="$ac_cv_prog_AR"
fi
- if test "${AR}" = "" ; then
- { echo "configure: error: Required archive tool 'ar' not found on PATH." 1>&2; exit 1; }
- fi
STLIB_LD='${AR} cr'
LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
PLAT_OBJS=""
PLAT_SRCS=""
+ LDAIX_SRC=""
+ if test x"${SHLIB_VERSION}" = x; then
+ SHLIB_VERSION="1.0"
+fi
+
case $system in
AIX-*)
- if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
+ if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"; then
+
# AIX requires the _r compiler when gcc isn't being used
case "${CC}" in
*_r|*_r\ *)
@@ -2152,8 +4712,11 @@ fi
CC=`echo "$CC" | sed -e 's/^\([^ ]*\)/\1_r/'`
;;
esac
- echo "$ac_t""Using $CC for compiling with threads" 1>&6
- fi
+ echo "$as_me:$LINENO: result: Using $CC for compiling with threads" >&5
+echo "${ECHO_T}Using $CC for compiling with threads" >&6
+
+fi
+
LIBS="$LIBS -lc"
SHLIB_CFLAGS=""
SHLIB_SUFFIX=".so"
@@ -2161,111 +4724,71 @@ fi
DL_OBJS="tclLoadDl.o"
LD_LIBRARY_PATH_VAR="LIBPATH"
- # Check to enable 64-bit flags for compiler/linker on AIX 4+
- if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then
- if test "$GCC" = "yes" ; then
- echo "configure: warning: 64bit mode not supported with GCC on $system" 1>&2
- else
+ # ldAix No longer needed with use of -bexpall/-brtl
+ # but some extensions may still reference it
+ LDAIX_SRC='$(UNIX_DIR)/ldAix'
+
+ # Check to enable 64-bit flags for compiler/linker
+ if test "$do64bit" = yes; then
+
+ if test "$GCC" = yes; then
+
+ { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5
+echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;}
+
+else
+
do64bit_ok=yes
CFLAGS="$CFLAGS -q64"
- LDFLAGS="$LDFLAGS -q64"
+ LDFLAGS_ARCH="-q64"
RANLIB="${RANLIB} -X64"
AR="${AR} -X64"
SHLIB_LD_FLAGS="-b64"
- fi
- fi
- if test "`uname -m`" = "ia64" ; then
+fi
+
+
+fi
+
+
+ if test "`uname -m`" = ia64; then
+
# AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
# AIX-5 has dl* in libc.so
DL_LIBS=""
- if test "$GCC" = "yes" ; then
+ if test "$GCC" = yes; then
+
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
- else
+
+else
+
CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
- fi
+
+fi
+
LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
- else
- if test "$GCC" = "yes" ; then
- SHLIB_LD="gcc -shared"
- else
- SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
- fi
- SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}"
- DL_LIBS="-ldl"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- TCL_NEEDS_EXP_FILE=1
- TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
- fi
- # AIX v<=4.1 has some different flags than 4.2+
- if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
- LIBOBJS="$LIBOBJS tclLoadAix.o"
- DL_LIBS="-lld"
- fi
+else
- # On AIX <=v4 systems, libbsd.a has to be linked in to support
- # non-blocking file IO. This library has to be linked in after
- # the MATH_LIBS or it breaks the pow() function. The way to
- # insure proper sequencing, is to add it to the tail of MATH_LIBS.
- # This library also supplies gettimeofday.
- #
- # AIX does not have a timezone field in struct tm. When the AIX
- # bsd library is used, the timezone global and the gettimeofday
- # methods are to be avoided for timezone deduction instead, we
- # deduce the timezone by comparing the localtime result on a
- # known GMT value.
-
- echo $ac_n "checking for gettimeofday in -lbsd""... $ac_c" 1>&6
-echo "configure:2223: checking for gettimeofday in -lbsd" >&5
-ac_lib_var=`echo bsd'_'gettimeofday | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lbsd $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2231 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char gettimeofday();
-
-int main() {
-gettimeofday()
-; return 0; }
-EOF
-if { (eval echo configure:2242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
+ if test "$GCC" = yes; then
+
+ SHLIB_LD='${CC} -shared -Wl,-bexpall'
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- libbsd=yes
else
- echo "$ac_t""no" 1>&6
-libbsd=no
+
+ SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry"
+ LDFLAGS="$LDFLAGS -brtl"
+
fi
- if test $libbsd = yes; then
- MATH_LIBS="$MATH_LIBS -lbsd"
- cat >> confdefs.h <<\EOF
-#define USE_DELTA_FOR_TZ 1
-EOF
+ SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}"
+ DL_LIBS="-ldl"
+ CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+
+fi
- fi
;;
BeOS*)
SHLIB_CFLAGS="-fPIC"
@@ -2279,44 +4802,72 @@ EOF
# -lsocket, even if the network functions are in -lnet which
# is always linked to, for compatibility.
#-----------------------------------------------------------
- echo $ac_n "checking for inet_ntoa in -lbind""... $ac_c" 1>&6
-echo "configure:2284: checking for inet_ntoa in -lbind" >&5
-ac_lib_var=`echo bind'_'inet_ntoa | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for inet_ntoa in -lbind" >&5
+echo $ECHO_N "checking for inet_ntoa in -lbind... $ECHO_C" >&6
+if test "${ac_cv_lib_bind_inet_ntoa+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lbind $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2292 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char inet_ntoa();
-
-int main() {
-inet_ntoa()
-; return 0; }
-EOF
-if { (eval echo configure:2303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char inet_ntoa ();
+int
+main ()
+{
+inet_ntoa ();
+ ;
+ 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
+ ac_cv_lib_bind_inet_ntoa=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_bind_inet_ntoa=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_bind_inet_ntoa" >&5
+echo "${ECHO_T}$ac_cv_lib_bind_inet_ntoa" >&6
+if test $ac_cv_lib_bind_inet_ntoa = yes; then
LIBS="$LIBS -lbind -lsocket"
-else
- echo "$ac_t""no" 1>&6
fi
;;
@@ -2368,106 +4919,171 @@ fi
SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
DL_OBJS="tclLoadDl.o"
DL_LIBS="-lroot"
- echo $ac_n "checking for inet_ntoa in -lnetwork""... $ac_c" 1>&6
-echo "configure:2373: checking for inet_ntoa in -lnetwork" >&5
-ac_lib_var=`echo network'_'inet_ntoa | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for inet_ntoa in -lnetwork" >&5
+echo $ECHO_N "checking for inet_ntoa in -lnetwork... $ECHO_C" >&6
+if test "${ac_cv_lib_network_inet_ntoa+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lnetwork $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2381 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char inet_ntoa();
-
-int main() {
-inet_ntoa()
-; return 0; }
-EOF
-if { (eval echo configure:2392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char inet_ntoa ();
+int
+main ()
+{
+inet_ntoa ();
+ ;
+ 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
+ ac_cv_lib_network_inet_ntoa=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_network_inet_ntoa=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_network_inet_ntoa" >&5
+echo "${ECHO_T}$ac_cv_lib_network_inet_ntoa" >&6
+if test $ac_cv_lib_network_inet_ntoa = yes; then
LIBS="$LIBS -lnetwork"
-else
- echo "$ac_t""no" 1>&6
fi
;;
HP-UX-*.11.*)
# Use updated header definitions where possible
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _XOPEN_SOURCE_EXTENDED 1
-EOF
+_ACEOF
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _XOPEN_SOURCE 1
-EOF
+_ACEOF
LIBS="$LIBS -lxnet" # Use the XOPEN network library
- if test "`uname -m`" = "ia64" ; then
+ if test "`uname -m`" = ia64; then
+
SHLIB_SUFFIX=".so"
- else
+
+else
+
SHLIB_SUFFIX=".sl"
- fi
- echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
-echo "configure:2431: checking for shl_load in -ldld" >&5
-ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+fi
+
+ echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-ldld $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2439 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char shl_load();
-
-int main() {
-shl_load()
-; return 0; }
-EOF
-if { (eval echo configure:2450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char shl_load ();
+int
+main ()
+{
+shl_load ();
+ ;
+ 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
+ ac_cv_lib_dld_shl_load=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_shl_load=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
+if test $ac_cv_lib_dld_shl_load = yes; then
tcl_ok=yes
else
- echo "$ac_t""no" 1>&6
-tcl_ok=no
+ tcl_ok=no
fi
if test "$tcl_ok" = yes; then
+
SHLIB_CFLAGS="+z"
SHLIB_LD="ld -b"
DL_OBJS="tclLoadShl.o"
@@ -2476,83 +5092,132 @@ fi
CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
LD_LIBRARY_PATH_VAR="SHLIB_PATH"
- fi
- if test "$GCC" = "yes" ; then
+
+fi
+
+ if test "$GCC" = yes; then
+
SHLIB_LD='${CC} -shared'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- fi
+
+else
+
+ CFLAGS="$CFLAGS -z"
+
+fi
+
# Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
#CFLAGS="$CFLAGS +DAportable"
# Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
- if test "$GCC" = "yes" ; then
+ if test "$do64bit" = "yes"; then
+
+ if test "$GCC" = yes; then
+
case `${CC} -dumpmachine` in
hppa64*)
# 64-bit gcc in use. Fix flags for GNU ld.
do64bit_ok=yes
SHLIB_LD='${CC} -shared'
- if test $doRpath = yes ; then
+ if test $doRpath = yes; then
+
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
+fi
+
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
;;
*)
- echo "configure: warning: 64bit mode not supported with GCC on $system" 1>&2
+ { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5
+echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;}
;;
esac
- else
+
+else
+
do64bit_ok=yes
CFLAGS="$CFLAGS +DD64"
- LDFLAGS="$LDFLAGS +DD64"
- fi
- fi
- ;;
+ LDFLAGS_ARCH="+DD64"
+
+fi
+
+
+fi
+ ;;
HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
SHLIB_SUFFIX=".sl"
- echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
-echo "configure:2516: checking for shl_load in -ldld" >&5
-ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-ldld $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2524 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char shl_load();
-
-int main() {
-shl_load()
-; return 0; }
-EOF
-if { (eval echo configure:2535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char shl_load ();
+int
+main ()
+{
+shl_load ();
+ ;
+ 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
+ ac_cv_lib_dld_shl_load=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_shl_load=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
+if test $ac_cv_lib_dld_shl_load = yes; then
tcl_ok=yes
else
- echo "$ac_t""no" 1>&6
-tcl_ok=no
+ tcl_ok=no
fi
if test "$tcl_ok" = yes; then
+
SHLIB_CFLAGS="+z"
SHLIB_LD="ld -b"
SHLIB_LD_LIBS=""
@@ -2562,29 +5227,29 @@ fi
CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
LD_LIBRARY_PATH_VAR="SHLIB_PATH"
- fi
- ;;
- IRIX-4.*)
- SHLIB_CFLAGS="-G 0"
- SHLIB_SUFFIX=".a"
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS="$LDFLAGS -Wl,-D,08000000"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
- ;;
+
+fi
+ ;;
IRIX-5.*)
SHLIB_CFLAGS=""
SHLIB_LD="ld -shared -rdata_shared"
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
+ case $LIBOBJS in
+ "mkstemp.$ac_objext" | \
+ *" mkstemp.$ac_objext" | \
+ "mkstemp.$ac_objext "* | \
+ *" mkstemp.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" ;;
+esac
+
+ if test $doRpath = yes; then
+
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
+fi
+
;;
IRIX-6.*)
SHLIB_CFLAGS=""
@@ -2592,14 +5257,27 @@ fi
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
+ case $LIBOBJS in
+ "mkstemp.$ac_objext" | \
+ *" mkstemp.$ac_objext" | \
+ "mkstemp.$ac_objext "* | \
+ *" mkstemp.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" ;;
+esac
+
+ if test $doRpath = yes; then
+
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
- if test "$GCC" = "yes" ; then
+fi
+
+ if test "$GCC" = yes; then
+
CFLAGS="$CFLAGS -mabi=n32"
LDFLAGS="$LDFLAGS -mabi=n32"
- else
+
+else
+
case $system in
IRIX-6.3)
# Use to build 6.2 compatible binaries on 6.3.
@@ -2610,7 +5288,9 @@ fi
;;
esac
LDFLAGS="$LDFLAGS -n32"
- fi
+
+fi
+
;;
IRIX64-6.*)
SHLIB_CFLAGS=""
@@ -2618,23 +5298,42 @@ fi
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
+ case $LIBOBJS in
+ "mkstemp.$ac_objext" | \
+ *" mkstemp.$ac_objext" | \
+ "mkstemp.$ac_objext "* | \
+ *" mkstemp.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" ;;
+esac
+
+ if test $doRpath = yes; then
+
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
+fi
+
# Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
- if test "$GCC" = "yes" ; then
- echo "configure: warning: 64bit mode not supported by gcc" 1>&2
- else
+ if test "$do64bit" = yes; then
+
+ if test "$GCC" = yes; then
+
+ { echo "$as_me:$LINENO: WARNING: 64bit mode not supported by gcc" >&5
+echo "$as_me: WARNING: 64bit mode not supported by gcc" >&2;}
+
+else
+
do64bit_ok=yes
SHLIB_LD="ld -64 -shared -rdata_shared"
CFLAGS="$CFLAGS -64"
- LDFLAGS="$LDFLAGS -64"
- fi
- fi
+ LDFLAGS_ARCH="-64"
+
+fi
+
+
+fi
+
;;
Linux*)
SHLIB_CFLAGS="-fPIC"
@@ -2646,167 +5345,116 @@ fi
# get rid of the warnings.
#CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
- if test "$have_dl" = yes; then
- SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
- if test $doRpath = yes ; then
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- else
- ac_safe=`echo "dld.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for dld.h""... $ac_c" 1>&6
-echo "configure:2662: checking for dld.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2667 "configure"
-#include "confdefs.h"
-#include <dld.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2672: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
+ SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ if test $doRpath = yes; then
+
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
-
- SHLIB_LD="ld -shared"
- DL_OBJS="tclLoadDld.o"
- DL_LIBS="-ldld"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
-else
- echo "$ac_t""no" 1>&6
+
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ if test "`uname -m`" = "alpha"; then
+ CFLAGS="$CFLAGS -mieee"
fi
- fi
- if test "`uname -m`" = "alpha" ; then
- CFLAGS="$CFLAGS -mieee"
- fi
if test $do64bit = yes; then
- echo $ac_n "checking if compiler accepts -m64 flag""... $ac_c" 1>&6
-echo "configure:2704: checking if compiler accepts -m64 flag" >&5
-if eval "test \"`echo '$''{'tcl_cv_cc_m64'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+ echo "$as_me:$LINENO: checking if compiler accepts -m64 flag" >&5
+echo $ECHO_N "checking if compiler accepts -m64 flag... $ECHO_C" >&6
+if test "${tcl_cv_cc_m64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
hold_cflags=$CFLAGS
CFLAGS="$CFLAGS -m64"
- cat > conftest.$ac_ext <<EOF
-#line 2712 "configure"
-#include "confdefs.h"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:2719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ 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
tcl_cv_cc_m64=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_cc_m64=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cc_m64=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
CFLAGS=$hold_cflags
fi
-
-echo "$ac_t""$tcl_cv_cc_m64" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_cc_m64" >&5
+echo "${ECHO_T}$tcl_cv_cc_m64" >&6
if test $tcl_cv_cc_m64 = yes; then
+
CFLAGS="$CFLAGS -m64"
do64bit_ok=yes
- fi
- fi
- # The combo of gcc + glibc has a bug related
- # to inlining of functions like strtod(). The
- # -fno-builtin flag should address this problem
- # but it does not work. The -fno-inline flag
- # is kind of overkill but it works.
- # Disable inlining only when one of the
- # files in compat/*.c is being linked in.
- if test x"${LIBOBJS}" != x ; then
- CFLAGS="$CFLAGS -fno-inline"
- fi
+fi
+
- # XIM peeking works under XFree86.
- cat >> confdefs.h <<\EOF
-#define PEEK_XCLOSEIM 1
-EOF
+fi
+
+
+ # The combo of gcc + glibc has a bug related to inlining of
+ # functions like strtod(). The -fno-builtin flag should address
+ # this problem but it does not work. The -fno-inline flag is kind
+ # of overkill but it works. Disable inlining only when one of the
+ # files in compat/*.c is being linked in.
+ if test x"${USE_COMPAT}" != x; then
+ CFLAGS="$CFLAGS -fno-inline"
+fi
;;
GNU*)
SHLIB_CFLAGS="-fPIC"
SHLIB_SUFFIX=".so"
- if test "$have_dl" = yes; then
- SHLIB_LD='${CC} -shared'
- DL_OBJS=""
- DL_LIBS="-ldl"
- LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- else
- ac_safe=`echo "dld.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for dld.h""... $ac_c" 1>&6
-echo "configure:2771: checking for dld.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2776 "configure"
-#include "confdefs.h"
-#include <dld.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2781: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
-
- SHLIB_LD="ld -shared"
- DL_OBJS=""
- DL_LIBS="-ldld"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
-else
- echo "$ac_t""no" 1>&6
+ SHLIB_LD='${CC} -shared'
+ DL_OBJS=""
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ if test "`uname -m`" = "alpha"; then
+ CFLAGS="$CFLAGS -mieee"
fi
- fi
- if test "`uname -m`" = "alpha" ; then
- CFLAGS="$CFLAGS -mieee"
- fi
;;
Lynx*)
SHLIB_CFLAGS="-fPIC"
@@ -2816,10 +5464,12 @@ fi
DL_OBJS="tclLoadDl.o"
DL_LIBS="-mshared -ldl"
LD_FLAGS="-Wl,--export-dynamic"
- if test $doRpath = yes ; then
+ if test $doRpath = yes; then
+
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
+fi
+
;;
MP-RAS-02*)
SHLIB_CFLAGS="-K PIC"
@@ -2843,169 +5493,145 @@ fi
LD_SEARCH_FLAGS=""
;;
NetBSD-1.*|FreeBSD-[1-2].*)
- # Not available on all versions: check for include file.
- ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
-echo "configure:2850: checking for dlfcn.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2855 "configure"
-#include "confdefs.h"
-#include <dlfcn.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2860: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ if test $doRpath = yes; then
+
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
-
- # NetBSD/SPARC needs -fPIC, -fpic will not do.
- SHLIB_CFLAGS="-fPIC"
- SHLIB_LD="ld -Bshareable -x"
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- if test $doRpath = yes ; then
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
- echo $ac_n "checking for ELF""... $ac_c" 1>&6
-echo "configure:2888: checking for ELF" >&5
-if eval "test \"`echo '$''{'tcl_cv_ld_elf'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+ echo "$as_me:$LINENO: checking for ELF" >&5
+echo $ECHO_N "checking for ELF... $ECHO_C" >&6
+if test "${tcl_cv_ld_elf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
- cat > conftest.$ac_ext <<EOF
-#line 2894 "configure"
-#include "confdefs.h"
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#ifdef __ELF__
yes
#endif
-
-EOF
+
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "yes" >/dev/null 2>&1; then
- rm -rf conftest*
+ $EGREP "yes" >/dev/null 2>&1; then
tcl_cv_ld_elf=yes
else
- rm -rf conftest*
tcl_cv_ld_elf=no
fi
rm -f conftest*
fi
+echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5
+echo "${ECHO_T}$tcl_cv_ld_elf" >&6
+ if test $tcl_cv_ld_elf = yes; then
+
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
-echo "$ac_t""$tcl_cv_ld_elf" 1>&6
- if test $tcl_cv_ld_elf = yes; then
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
- else
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
- fi
-
else
- echo "$ac_t""no" 1>&6
- SHLIB_CFLAGS=""
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
- SHLIB_SUFFIX=".a"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
-
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
+
fi
- # FreeBSD doesn't handle version numbers with dots.
+ # Ancient FreeBSD doesn't handle version numbers with dots.
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
OpenBSD-*)
arch=`arch -s`
case "$arch" in
m88k|vax)
- SHLIB_CFLAGS=""
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
- SHLIB_SUFFIX=".a"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ # Equivalent using configure option --disable-load
+ # Step 4 will set the necessary variables
+ DL_OBJS=""
+ SHLIB_LD_LIBS=""
;;
*)
- # OpenBSD/SPARC[64] needs -fPIC, -fpic will not do.
- case `machine` in
- sparc|sparc64)
- SHLIB_CFLAGS="-fPIC";;
- *)
- SHLIB_CFLAGS="-fpic";;
- esac
- SHLIB_LD="${CC} -shared ${SHLIB_CFLAGS}"
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
+ if test $doRpath = yes; then
+
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
+fi
+
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
- echo $ac_n "checking for ELF""... $ac_c" 1>&6
-echo "configure:2973: checking for ELF" >&5
-if eval "test \"`echo '$''{'tcl_cv_ld_elf'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
+ ;;
+ esac
+ case "$arch" in
+ m88k|vax)
+ CFLAGS_OPTIMIZE="-O1"
+ ;;
+ sh)
+ CFLAGS_OPTIMIZE="-O0"
+ ;;
+ *)
+ CFLAGS_OPTIMIZE="-O2"
+ ;;
+ esac
+ echo "$as_me:$LINENO: checking for ELF" >&5
+echo $ECHO_N "checking for ELF... $ECHO_C" >&6
+if test "${tcl_cv_ld_elf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
- cat > conftest.$ac_ext <<EOF
-#line 2979 "configure"
-#include "confdefs.h"
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#ifdef __ELF__
yes
#endif
-
-EOF
+
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "yes" >/dev/null 2>&1; then
- rm -rf conftest*
+ $EGREP "yes" >/dev/null 2>&1; then
tcl_cv_ld_elf=yes
else
- rm -rf conftest*
tcl_cv_ld_elf=no
fi
rm -f conftest*
fi
+echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5
+echo "${ECHO_T}$tcl_cv_ld_elf" >&6
+ if test $tcl_cv_ld_elf = yes; then
-echo "$ac_t""$tcl_cv_ld_elf" 1>&6
- if test $tcl_cv_ld_elf = yes; then
- LDFLAGS=-Wl,-export-dynamic
- else
- LDFLAGS=""
- fi
- ;;
- esac
+ LDFLAGS=-Wl,-export-dynamic
+
+else
+ LDFLAGS=""
+fi
+
+ if test "${TCL_THREADS}" = "1"; then
+
+ # On OpenBSD: Compile with -pthread
+ # Don't link with -lpthread
+ LIBS=`echo $LIBS | sed s/-lpthread//`
+ CFLAGS="$CFLAGS -pthread"
+
+fi
# OpenBSD doesn't do version numbers with dots.
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
NetBSD-*|FreeBSD-[3-4].*)
@@ -3017,16 +5643,21 @@ echo "$ac_t""$tcl_cv_ld_elf" 1>&6
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
LDFLAGS="$LDFLAGS -export-dynamic"
- if test $doRpath = yes ; then
+ if test $doRpath = yes; then
+
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
+fi
+
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- if test "${TCL_THREADS}" = "1" ; then
+ if test "${TCL_THREADS}" = "1"; then
+
# The -pthread needs to go in the CFLAGS, not LIBS
LIBS=`echo $LIBS | sed s/-pthread//`
CFLAGS="$CFLAGS -pthread"
LDFLAGS="$LDFLAGS -pthread"
- fi
+
+fi
+
case $system in
FreeBSD-3.*)
# FreeBSD-3 doesn't handle version numbers with dots.
@@ -3045,16 +5676,20 @@ echo "$ac_t""$tcl_cv_ld_elf" 1>&6
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
LDFLAGS=""
- if test $doRpath = yes ; then
+ if test $doRpath = yes; then
+
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
- if test "${TCL_THREADS}" = "1" ; then
+fi
+
+ if test "${TCL_THREADS}" = "1"; then
+
# The -pthread needs to go in the LDFLAGS, not LIBS
LIBS=`echo $LIBS | sed s/-pthread//`
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
- fi
+fi
+
# Version numbers are dot-stripped by system policy.
TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .`
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
@@ -3074,270 +5709,499 @@ echo "$ac_t""$tcl_cv_ld_elf" 1>&6
awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
if (!($i~/^(isysroot|mmacosx-version-min)/)) print "-"$i}'`"
if test $do64bit = yes; then
+
case `arch` in
ppc)
- echo $ac_n "checking if compiler accepts -arch ppc64 flag""... $ac_c" 1>&6
-echo "configure:3081: checking if compiler accepts -arch ppc64 flag" >&5
-if eval "test \"`echo '$''{'tcl_cv_cc_arch_ppc64'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking if compiler accepts -arch ppc64 flag" >&5
+echo $ECHO_N "checking if compiler accepts -arch ppc64 flag... $ECHO_C" >&6
+if test "${tcl_cv_cc_arch_ppc64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
hold_cflags=$CFLAGS
CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
- cat > conftest.$ac_ext <<EOF
-#line 3089 "configure"
-#include "confdefs.h"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:3096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ 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
tcl_cv_cc_arch_ppc64=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_cc_arch_ppc64=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cc_arch_ppc64=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
CFLAGS=$hold_cflags
fi
-
-echo "$ac_t""$tcl_cv_cc_arch_ppc64" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_cc_arch_ppc64" >&5
+echo "${ECHO_T}$tcl_cv_cc_arch_ppc64" >&6
if test $tcl_cv_cc_arch_ppc64 = yes; then
+
CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
do64bit_ok=yes
- fi;;
+
+fi
+;;
i386)
- echo $ac_n "checking if compiler accepts -arch x86_64 flag""... $ac_c" 1>&6
-echo "configure:3116: checking if compiler accepts -arch x86_64 flag" >&5
-if eval "test \"`echo '$''{'tcl_cv_cc_arch_x86_64'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking if compiler accepts -arch x86_64 flag" >&5
+echo $ECHO_N "checking if compiler accepts -arch x86_64 flag... $ECHO_C" >&6
+if test "${tcl_cv_cc_arch_x86_64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
hold_cflags=$CFLAGS
CFLAGS="$CFLAGS -arch x86_64"
- cat > conftest.$ac_ext <<EOF
-#line 3124 "configure"
-#include "confdefs.h"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:3131: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ 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
tcl_cv_cc_arch_x86_64=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_cc_arch_x86_64=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cc_arch_x86_64=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
CFLAGS=$hold_cflags
fi
-
-echo "$ac_t""$tcl_cv_cc_arch_x86_64" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_cc_arch_x86_64" >&5
+echo "${ECHO_T}$tcl_cv_cc_arch_x86_64" >&6
if test $tcl_cv_cc_arch_x86_64 = yes; then
+
CFLAGS="$CFLAGS -arch x86_64"
do64bit_ok=yes
- fi;;
+
+fi
+;;
*)
- echo "configure: warning: Don't know how enable 64-bit on architecture `arch`" 1>&2;;
+ { echo "$as_me:$LINENO: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&5
+echo "$as_me: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&2;};;
esac
- else
+
+else
+
# Check for combined 32-bit and 64-bit fat build
- echo "$CFLAGS " | grep -E -q -- '-arch (ppc64|x86_64) ' && \
- echo "$CFLAGS " | grep -E -q -- '-arch (ppc|i386) ' && \
+ if echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \
+ && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '; then
+
fat_32_64=yes
- fi
+fi
+
+
+fi
+
SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}'
- echo $ac_n "checking if ld accepts -single_module flag""... $ac_c" 1>&6
-echo "configure:3160: checking if ld accepts -single_module flag" >&5
-if eval "test \"`echo '$''{'tcl_cv_ld_single_module'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking if ld accepts -single_module flag" >&5
+echo $ECHO_N "checking if ld accepts -single_module flag... $ECHO_C" >&6
+if test "${tcl_cv_ld_single_module+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
- cat > conftest.$ac_ext <<EOF
-#line 3168 "configure"
-#include "confdefs.h"
-
-int main() {
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
int i;
-; return 0; }
-EOF
-if { (eval echo configure:3175: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ ;
+ 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
tcl_cv_ld_single_module=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_ld_single_module=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_ld_single_module=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$hold_ldflags
fi
-
-echo "$ac_t""$tcl_cv_ld_single_module" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_ld_single_module" >&5
+echo "${ECHO_T}$tcl_cv_ld_single_module" >&6
if test $tcl_cv_ld_single_module = yes; then
+
SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
- fi
+
+fi
+
SHLIB_SUFFIX=".dylib"
DL_OBJS="tclLoadDyld.o"
DL_LIBS=""
# Don't use -prebind when building for Mac OS X 10.4 or later only:
- test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int($2)}'`" -lt 4 -a \
- "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4 && \
+ if test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int($2)}'`" -lt 4 -a \
+ "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4; then
+
LDFLAGS="$LDFLAGS -prebind"
+fi
+
LDFLAGS="$LDFLAGS -headerpad_max_install_names"
- echo $ac_n "checking if ld accepts -search_paths_first flag""... $ac_c" 1>&6
-echo "configure:3201: checking if ld accepts -search_paths_first flag" >&5
-if eval "test \"`echo '$''{'tcl_cv_ld_search_paths_first'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking if ld accepts -search_paths_first flag" >&5
+echo $ECHO_N "checking if ld accepts -search_paths_first flag... $ECHO_C" >&6
+if test "${tcl_cv_ld_search_paths_first+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
- cat > conftest.$ac_ext <<EOF
-#line 3209 "configure"
-#include "confdefs.h"
-
-int main() {
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
int i;
-; return 0; }
-EOF
-if { (eval echo configure:3216: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ ;
+ 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
tcl_cv_ld_search_paths_first=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_ld_search_paths_first=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_ld_search_paths_first=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$hold_ldflags
fi
-
-echo "$ac_t""$tcl_cv_ld_search_paths_first" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_ld_search_paths_first" >&5
+echo "${ECHO_T}$tcl_cv_ld_search_paths_first" >&6
if test $tcl_cv_ld_search_paths_first = yes; then
+
LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
- fi
+
+fi
+
+ if test "$tcl_cv_cc_visibility_hidden" != yes; then
+
+
+cat >>confdefs.h <<\_ACEOF
+#define MODULE_SCOPE __private_extern__
+_ACEOF
+
+ tcl_cv_cc_visibility_hidden=yes
+
+fi
+
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
- PLAT_OBJS=\$\(MAC\_OSX_OBJS\)
- PLAT_SRCS=\$\(MAC\_OSX_SRCS\)
- echo $ac_n "checking whether to use CoreFoundation""... $ac_c" 1>&6
-echo "configure:3239: checking whether to use CoreFoundation" >&5
+
+cat >>confdefs.h <<\_ACEOF
+#define MAC_OSX_TCL 1
+_ACEOF
+
+ PLAT_OBJS='${MAC_OSX_OBJS}'
+ PLAT_SRCS='${MAC_OSX_SRCS}'
+ echo "$as_me:$LINENO: checking whether to use CoreFoundation" >&5
+echo $ECHO_N "checking whether to use CoreFoundation... $ECHO_C" >&6
# Check whether --enable-corefoundation or --disable-corefoundation was given.
if test "${enable_corefoundation+set}" = set; then
enableval="$enable_corefoundation"
tcl_corefoundation=$enableval
else
tcl_corefoundation=yes
-fi
-
- echo "$ac_t""$tcl_corefoundation" 1>&6
+fi;
+ echo "$as_me:$LINENO: result: $tcl_corefoundation" >&5
+echo "${ECHO_T}$tcl_corefoundation" >&6
if test $tcl_corefoundation = yes; then
- echo $ac_n "checking for CoreFoundation.framework""... $ac_c" 1>&6
-echo "configure:3251: checking for CoreFoundation.framework" >&5
-if eval "test \"`echo '$''{'tcl_cv_lib_corefoundation'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+ echo "$as_me:$LINENO: checking for CoreFoundation.framework" >&5
+echo $ECHO_N "checking for CoreFoundation.framework... $ECHO_C" >&6
+if test "${tcl_cv_lib_corefoundation+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
hold_libs=$LIBS
- if test "$fat_32_64" = yes; then for v in CFLAGS CPPFLAGS LDFLAGS; do
- # On Tiger there is no 64-bit CF, so remove 64-bit archs
- # from CFLAGS et al. while testing for presence of CF.
- # 64-bit CF is disabled in tclUnixPort.h if necessary.
- eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
- done; fi
+ if test "$fat_32_64" = yes; then
+
+ for v in CFLAGS CPPFLAGS LDFLAGS; do
+ # On Tiger there is no 64-bit CF, so remove 64-bit
+ # archs from CFLAGS et al. while testing for
+ # presence of CF. 64-bit CF is disabled in
+ # tclUnixPort.h if necessary.
+ eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
+ done
+fi
+
LIBS="$LIBS -framework CoreFoundation"
- cat > conftest.$ac_ext <<EOF
-#line 3265 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <CoreFoundation/CoreFoundation.h>
-int main() {
+int
+main ()
+{
CFBundleRef b = CFBundleGetMainBundle();
-; return 0; }
-EOF
-if { (eval echo configure:3272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ ;
+ 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
tcl_cv_lib_corefoundation=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_lib_corefoundation=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_lib_corefoundation=no
fi
-rm -f conftest*
- if test "$fat_32_64" = yes; then for v in CFLAGS CPPFLAGS LDFLAGS; do
- eval $v'="$hold_'$v'"'
- done; fi; LIBS=$hold_libs
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test "$fat_32_64" = yes; then
+
+ for v in CFLAGS CPPFLAGS LDFLAGS; do
+ eval $v'="$hold_'$v'"'
+ done
fi
-echo "$ac_t""$tcl_cv_lib_corefoundation" 1>&6
+ LIBS=$hold_libs
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_lib_corefoundation" >&5
+echo "${ECHO_T}$tcl_cv_lib_corefoundation" >&6
if test $tcl_cv_lib_corefoundation = yes; then
+
LIBS="$LIBS -framework CoreFoundation"
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_COREFOUNDATION 1
-EOF
+_ACEOF
+
+
+else
+ tcl_corefoundation=no
+fi
- else
- tcl_corefoundation=no
- fi
if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then
- echo $ac_n "checking for 64-bit CoreFoundation""... $ac_c" 1>&6
-echo "configure:3299: checking for 64-bit CoreFoundation" >&5
-if eval "test \"`echo '$''{'tcl_cv_lib_corefoundation_64'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+ echo "$as_me:$LINENO: checking for 64-bit CoreFoundation" >&5
+echo $ECHO_N "checking for 64-bit CoreFoundation... $ECHO_C" >&6
+if test "${tcl_cv_lib_corefoundation_64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
done
- cat > conftest.$ac_ext <<EOF
-#line 3308 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <CoreFoundation/CoreFoundation.h>
-int main() {
+int
+main ()
+{
CFBundleRef b = CFBundleGetMainBundle();
-; return 0; }
-EOF
-if { (eval echo configure:3315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ ;
+ 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
tcl_cv_lib_corefoundation_64=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_lib_corefoundation_64=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_lib_corefoundation_64=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval $v'="$hold_'$v'"'
done
fi
-
-echo "$ac_t""$tcl_cv_lib_corefoundation_64" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_lib_corefoundation_64" >&5
+echo "${ECHO_T}$tcl_cv_lib_corefoundation_64" >&6
if test $tcl_cv_lib_corefoundation_64 = no; then
- cat >> confdefs.h <<\EOF
+
+
+cat >>confdefs.h <<\_ACEOF
#define NO_COREFOUNDATION_64 1
-EOF
+_ACEOF
+
+ LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings"
+
+fi
- fi
- fi
- fi
- cat >> confdefs.h <<\EOF
-#define MAC_OSX_TCL 1
-EOF
+
+fi
+
+
+fi
;;
NEXTSTEP-*)
@@ -3353,9 +6217,10 @@ EOF
OS/390-*)
SHLIB_LD_LIBS=""
CFLAGS_OPTIMIZE="" # Optimizer is buggy
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _OE_SOCKETS 1
-EOF
+_ACEOF
;;
OSF1-1.0|OSF1-1.1|OSF1-1.2)
@@ -3373,11 +6238,14 @@ EOF
OSF1-1.*)
# OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
SHLIB_CFLAGS="-fPIC"
- if test "$SHARED_BUILD" = "1" ; then
- SHLIB_LD="ld -shared"
- else
+ if test "$SHARED_BUILD" = 1; then
+ SHLIB_LD="ld -shared"
+else
+
SHLIB_LD="ld -non_shared"
- fi
+
+fi
+
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
@@ -3388,35 +6256,51 @@ EOF
OSF1-V*)
# Digital OSF/1
SHLIB_CFLAGS=""
- if test "$SHARED_BUILD" = "1" ; then
+ if test "$SHARED_BUILD" = 1; then
+
SHLIB_LD='ld -shared -expect_unresolved "*"'
- else
+
+else
+
SHLIB_LD='ld -non_shared -expect_unresolved "*"'
- fi
+
+fi
+
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
+ if test $doRpath = yes; then
+
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
- if test "$GCC" = "yes" ; then
- CFLAGS="$CFLAGS -mieee"
- else
+fi
+
+ if test "$GCC" = yes; then
+ CFLAGS="$CFLAGS -mieee"
+else
+
CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"
- fi
+fi
+
# see pthread_intro(3) for pthread support on osf1, k.furukawa
- if test "${TCL_THREADS}" = "1" ; then
+ if test "${TCL_THREADS}" = 1; then
+
CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
LIBS=`echo $LIBS | sed s/-lpthreads//`
- if test "$GCC" = "yes" ; then
+ if test "$GCC" = yes; then
+
LIBS="$LIBS -lpthread -lmach -lexc"
- else
+
+else
+
CFLAGS="$CFLAGS -pthread"
LDFLAGS="$LDFLAGS -pthread"
- fi
- fi
+
+fi
+
+
+fi
;;
QNX-6*)
@@ -3432,27 +6316,22 @@ EOF
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
;;
- RISCos-*)
- SHLIB_CFLAGS="-G 0"
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
- SHLIB_SUFFIX=".a"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS="$LDFLAGS -Wl,-D,08000000"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- ;;
SCO_SV-3.2*)
# Note, dlopen is available only on SCO 3.2.5 and greater. However,
# this test works, since "uname -s" was non-standard in 3.2.4 and
# below.
- if test "$GCC" = "yes" ; then
+ if test "$GCC" = yes; then
+
SHLIB_CFLAGS="-fPIC -melf"
LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
- else
+
+else
+
SHLIB_CFLAGS="-Kpic -belf"
LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
- fi
+
+fi
+
SHLIB_LD="ld -G"
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
@@ -3486,8 +6365,8 @@ EOF
# requires an extra version number at the end of .so file names.
# So, the library has to have a name like libtcl75.so.1.0
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
SunOS-5.[0-6])
@@ -3496,81 +6375,114 @@ EOF
# Note: If _REENTRANT isn't defined, then Solaris
# won't define thread-safe library routines.
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _REENTRANT 1
-EOF
+_ACEOF
+
- cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
#define _POSIX_PTHREAD_SEMANTICS 1
-EOF
+_ACEOF
SHLIB_CFLAGS="-KPIC"
-
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
- if test "$GCC" = "yes" ; then
+ if test "$GCC" = yes; then
+
SHLIB_LD='${CC} -shared'
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- else
+
+else
+
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- fi
+
+fi
+
;;
SunOS-5*)
# Note: If _REENTRANT isn't defined, then Solaris
# won't define thread-safe library routines.
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _REENTRANT 1
-EOF
+_ACEOF
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _POSIX_PTHREAD_SEMANTICS 1
-EOF
+_ACEOF
SHLIB_CFLAGS="-KPIC"
# Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
+ if test "$do64bit" = yes; then
+
arch=`isainfo`
- if test "$arch" = "sparcv9 sparc" ; then
- if test "$GCC" = "yes" ; then
- if test "`gcc -dumpversion | awk -F. '{print $1}'`" -lt "3" ; then
- echo "configure: warning: 64bit mode not supported with GCC < 3.2 on $system" 1>&2
- else
- do64bit_ok=yes
- CFLAGS="$CFLAGS -m64 -mcpu=v9"
- LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
- SHLIB_CFLAGS="-fPIC"
- fi
- else
+ if test "$arch" = "sparcv9 sparc"; then
+
+ if test "$GCC" = yes; then
+
+ if test "`${CC} -dumpversion | awk -F. '{print $1}'`" -lt 3; then
+
+ { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&5
+echo "$as_me: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&2;}
+
+else
+
do64bit_ok=yes
- if test "$do64bitVIS" = "yes" ; then
- CFLAGS="$CFLAGS -xarch=v9a"
- LDFLAGS="$LDFLAGS -xarch=v9a"
- else
- CFLAGS="$CFLAGS -xarch=v9"
- LDFLAGS="$LDFLAGS -xarch=v9"
- fi
- # Solaris 64 uses this as well
- #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
- fi
- elif test "$arch" = "amd64 i386" ; then
- if test "$GCC" = "yes" ; then
+ CFLAGS="$CFLAGS -m64 -mcpu=v9"
+ LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
+ SHLIB_CFLAGS="-fPIC"
+
+fi
+
+
+else
+
+ do64bit_ok=yes
+ if test "$do64bitVIS" = yes; then
+
+ CFLAGS="$CFLAGS -xarch=v9a"
+ LDFLAGS_ARCH="-xarch=v9a"
+
+else
+
+ CFLAGS="$CFLAGS -xarch=v9"
+ LDFLAGS_ARCH="-xarch=v9"
+
+fi
+
+ # Solaris 64 uses this as well
+ #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
+
+fi
+
+
+else
+ if test "$arch" = "amd64 i386"; then
+
+ if test "$GCC" = yes; then
+
case $system in
SunOS-5.1[1-9]*|SunOS-5.[2-9][0-9]*)
do64bit_ok=yes
CFLAGS="$CFLAGS -m64"
LDFLAGS="$LDFLAGS -m64";;
*)
- echo "configure: warning: 64bit mode not supported with GCC on $system" 1>&2;;
+ { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5
+echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;};;
esac
- else
+
+else
+
do64bit_ok=yes
case $system in
SunOS-5.1[1-9]*|SunOS-5.[2-9][0-9]*)
@@ -3580,21 +6492,201 @@ EOF
CFLAGS="$CFLAGS -xarch=amd64"
LDFLAGS="$LDFLAGS -xarch=amd64";;
esac
- fi
- else
- echo "configure: warning: 64bit mode not supported for $arch" 1>&2
- fi
- fi
+
+fi
+
+
+else
+ { echo "$as_me:$LINENO: WARNING: 64bit mode not supported for $arch" >&5
+echo "$as_me: WARNING: 64bit mode not supported for $arch" >&2;}
+fi
+
+fi
+
+
+fi
+
+
+ #--------------------------------------------------------------------
+ # On Solaris 5.x i386 with the sunpro compiler we need to link
+ # with sunmath to get floating point rounding control
+ #--------------------------------------------------------------------
+ if test "$GCC" = yes; then
+ use_sunmath=no
+else
+
+ arch=`isainfo`
+ echo "$as_me:$LINENO: checking whether to use -lsunmath for fp rounding control" >&5
+echo $ECHO_N "checking whether to use -lsunmath for fp rounding control... $ECHO_C" >&6
+ if test "$arch" = "amd64 i386"; then
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ MATH_LIBS="-lsunmath $MATH_LIBS"
+ if test "${ac_cv_header_sunmath_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for sunmath.h" >&5
+echo $ECHO_N "checking for sunmath.h... $ECHO_C" >&6
+if test "${ac_cv_header_sunmath_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_sunmath_h" >&5
+echo "${ECHO_T}$ac_cv_header_sunmath_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking sunmath.h usability" >&5
+echo $ECHO_N "checking sunmath.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 <sunmath.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 sunmath.h presence" >&5
+echo $ECHO_N "checking sunmath.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 <sunmath.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
+
+ 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
+
+# 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: sunmath.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sunmath.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sunmath.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: sunmath.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: sunmath.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sunmath.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sunmath.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sunmath.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sunmath.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: sunmath.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sunmath.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: sunmath.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sunmath.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sunmath.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sunmath.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: sunmath.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
+ ;;
+esac
+echo "$as_me:$LINENO: checking for sunmath.h" >&5
+echo $ECHO_N "checking for sunmath.h... $ECHO_C" >&6
+if test "${ac_cv_header_sunmath_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_sunmath_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_sunmath_h" >&5
+echo "${ECHO_T}$ac_cv_header_sunmath_h" >&6
+
+fi
+
+
+ use_sunmath=yes
+
+else
+
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ use_sunmath=no
+
+fi
+
+
+fi
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
- if test "$GCC" = "yes" ; then
- SHLIB_LD="$CC -shared"
+ if test "$GCC" = yes; then
+
+ SHLIB_LD='${CC} -shared'
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- if test "$do64bit_ok" = "yes" ; then
- if test "$arch" = "sparcv9 sparc" ; then
+ if test "$do64bit_ok" = yes; then
+
+ if test "$arch" = "sparcv9 sparc"; then
+
# We need to specify -static-libgcc or we need to
# add the path to the sparv9 libgcc.
SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
@@ -3602,33 +6694,39 @@ EOF
# path, remove so name and append 'sparcv9'
#v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
#CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
- elif test "$arch" = "amd64 i386" ; then
+
+else
+ if test "$arch" = "amd64 i386"; then
+
SHLIB_LD="$SHLIB_LD -m64 -static-libgcc"
- fi
- fi
- else
+
+fi
+
+fi
+
+
+fi
+
+
+else
+
+ if test "$use_sunmath" = yes; then
+ textmode=textoff
+else
+ textmode=text
+fi
+
case $system in
SunOS-5.[1-9][0-9]*)
- SHLIB_LD='${CC} -G -z text ${LDFLAGS}';;
+ SHLIB_LD="\${CC} -G -z $textmode \${LDFLAGS}";;
*)
- SHLIB_LD="/usr/ccs/bin/ld -G -z text";;
+ SHLIB_LD="/usr/ccs/bin/ld -G -z $textmode";;
esac
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
- fi
- ;;
- ULTRIX-4.*)
- SHLIB_CFLAGS="-G 0"
- SHLIB_SUFFIX=".a"
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS="$LDFLAGS -Wl,-D,08000000"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- if test "$GCC" != "yes" ; then
- CFLAGS="$CFLAGS -DHAVE_TZSET -std1"
- fi
+
+fi
+
;;
UNIX_SV* | UnixWare-5*)
SHLIB_CFLAGS="-KPIC"
@@ -3639,210 +6737,97 @@ EOF
DL_LIBS="-ldl"
# Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
# that don't grok the -Bexport option. Test that it does.
- echo $ac_n "checking for ld accepts -Bexport flag""... $ac_c" 1>&6
-echo "configure:3644: checking for ld accepts -Bexport flag" >&5
-if eval "test \"`echo '$''{'tcl_cv_ld_Bexport'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for ld accepts -Bexport flag" >&5
+echo $ECHO_N "checking for ld accepts -Bexport flag... $ECHO_C" >&6
+if test "${tcl_cv_ld_Bexport+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-Bexport"
- cat > conftest.$ac_ext <<EOF
-#line 3652 "configure"
-#include "confdefs.h"
-
-int main() {
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
int i;
-; return 0; }
-EOF
-if { (eval echo configure:3659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ ;
+ 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
tcl_cv_ld_Bexport=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_ld_Bexport=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_ld_Bexport=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$hold_ldflags
fi
-
-echo "$ac_t""$tcl_cv_ld_Bexport" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_ld_Bexport" >&5
+echo "${ECHO_T}$tcl_cv_ld_Bexport" >&6
if test $tcl_cv_ld_Bexport = yes; then
+
LDFLAGS="$LDFLAGS -Wl,-Bexport"
- fi
+
+fi
+
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
;;
esac
- if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
- echo "configure: warning: 64bit support being disabled -- don't know magic for this platform" 1>&2
- fi
+ if test "$do64bit" = yes -a "$do64bit_ok" = no; then
+
+ { echo "$as_me:$LINENO: WARNING: 64bit support being disabled -- don't know magic for this platform" >&5
+echo "$as_me: WARNING: 64bit support being disabled -- don't know magic for this platform" >&2;}
-
-
-
- # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
- # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop,
- # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
- # to determine which of several header files defines the a.out file
- # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we
- # support only a file format that is more or less version-7-compatible.
- # In particular,
- # - a.out files must begin with `struct exec'.
- # - the N_TXTOFF on the `struct exec' must compute the seek address
- # of the text segment
- # - The `struct exec' must contain a_magic, a_text, a_data, a_bss
- # and a_entry fields.
- # The following compilation should succeed if and only if either sys/exec.h
- # or a.out.h is usable for the purpose.
- #
- # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
- # `struct exec' includes a second header that contains information that
- # duplicates the v7 fields that are needed.
-
- if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
- echo $ac_n "checking sys/exec.h""... $ac_c" 1>&6
-echo "configure:3709: checking sys/exec.h" >&5
-if eval "test \"`echo '$''{'tcl_cv_sysexec_h'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
-
- cat > conftest.$ac_ext <<EOF
-#line 3715 "configure"
-#include "confdefs.h"
-#include <sys/exec.h>
-int main() {
-
- struct exec foo;
- unsigned long seek;
- int flag;
-#if defined(__mips) || defined(mips)
- seek = N_TXTOFF (foo.ex_f, foo.ex_o);
-#else
- seek = N_TXTOFF (foo);
-#endif
- flag = (foo.a_magic == OMAGIC);
- return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
-
-; return 0; }
-EOF
-if { (eval echo configure:3733: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- tcl_cv_sysexec_h=usable
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_sysexec_h=unusable
-fi
-rm -f conftest*
fi
-echo "$ac_t""$tcl_cv_sysexec_h" 1>&6
- if test $tcl_cv_sysexec_h = usable; then
- cat >> confdefs.h <<\EOF
-#define USE_SYS_EXEC_H 1
-EOF
- else
- echo $ac_n "checking a.out.h""... $ac_c" 1>&6
-echo "configure:3753: checking a.out.h" >&5
-if eval "test \"`echo '$''{'tcl_cv_aout_h'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
-
- cat > conftest.$ac_ext <<EOF
-#line 3759 "configure"
-#include "confdefs.h"
-#include <a.out.h>
-int main() {
-
- struct exec foo;
- unsigned long seek;
- int flag;
-#if defined(__mips) || defined(mips)
- seek = N_TXTOFF (foo.ex_f, foo.ex_o);
-#else
- seek = N_TXTOFF (foo);
-#endif
- flag = (foo.a_magic == OMAGIC);
- return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
-
-; return 0; }
-EOF
-if { (eval echo configure:3777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- tcl_cv_aout_h=usable
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_aout_h=unusable
-fi
-rm -f conftest*
-fi
+ if test "$do64bit" = yes -a "$do64bit_ok" = yes; then
+
+
+cat >>confdefs.h <<\_ACEOF
+#define TCL_CFG_DO64BIT 1
+_ACEOF
-echo "$ac_t""$tcl_cv_aout_h" 1>&6
- if test $tcl_cv_aout_h = usable; then
- cat >> confdefs.h <<\EOF
-#define USE_A_OUT_H 1
-EOF
- else
- echo $ac_n "checking sys/exec_aout.h""... $ac_c" 1>&6
-echo "configure:3797: checking sys/exec_aout.h" >&5
-if eval "test \"`echo '$''{'tcl_cv_sysexecaout_h'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
-
- cat > conftest.$ac_ext <<EOF
-#line 3803 "configure"
-#include "confdefs.h"
-#include <sys/exec_aout.h>
-int main() {
-
- struct exec foo;
- unsigned long seek;
- int flag;
-#if defined(__mips) || defined(mips)
- seek = N_TXTOFF (foo.ex_f, foo.ex_o);
-#else
- seek = N_TXTOFF (foo);
-#endif
- flag = (foo.a_midmag == OMAGIC);
- return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
-
-; return 0; }
-EOF
-if { (eval echo configure:3821: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- tcl_cv_sysexecaout_h=usable
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_sysexecaout_h=unusable
-fi
-rm -f conftest*
fi
-echo "$ac_t""$tcl_cv_sysexecaout_h" 1>&6
- if test $tcl_cv_sysexecaout_h = usable; then
- cat >> confdefs.h <<\EOF
-#define USE_SYS_EXEC_AOUT_H 1
-EOF
- else
- DL_OBJS=""
- fi
- fi
- fi
- fi
- # Step 5: disable dynamic loading if requested via a command-line switch.
+
+ # Step 4: disable dynamic loading if requested via a command-line switch.
# Check whether --enable-load or --disable-load was given.
if test "${enable_load+set}" = set; then
@@ -3850,17 +6835,18 @@ if test "${enable_load+set}" = set; then
tcl_ok=$enableval
else
tcl_ok=yes
+fi;
+ if test "$tcl_ok" = no; then
+ DL_OBJS=""
fi
- if test "$tcl_ok" = "no"; then
- DL_OBJS=""
- fi
- if test "x$DL_OBJS" != "x" ; then
- BUILD_DLTEST="\$(DLTEST_TARGETS)"
- else
- echo "Can't figure out how to do dynamic loading or shared libraries"
- echo "on this system."
+ if test "x$DL_OBJS" != x; then
+ BUILD_DLTEST="\$(DLTEST_TARGETS)"
+else
+
+ { echo "$as_me:$LINENO: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&5
+echo "$as_me: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&2;}
SHLIB_CFLAGS=""
SHLIB_LD=""
SHLIB_SUFFIX=""
@@ -3870,13 +6856,17 @@ fi
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
BUILD_DLTEST=""
- fi
+
+fi
+
+ LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
# If we're running gcc, then change the C flags for compiling shared
# libraries to the right flags for gcc, instead of those for the
# standard manufacturer compiler.
- if test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes ; then
+ if test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes; then
+
case $system in
AIX-*) ;;
BSD/OS*) ;;
@@ -3884,526 +6874,952 @@ fi
IRIX*) ;;
NetBSD-*|FreeBSD-*|OpenBSD-*) ;;
Darwin-*) ;;
- RISCos-*) ;;
SCO_SV-3.2*) ;;
- ULTRIX-4.*) ;;
*) SHLIB_CFLAGS="-fPIC" ;;
esac
- fi
+fi
- if test "$SHARED_LIB_SUFFIX" = "" ; then
- SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
- fi
- if test "$UNSHARED_LIB_SUFFIX" = "" ; then
- UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
- fi
- if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then
+ if test "$tcl_cv_cc_visibility_hidden" != yes; then
+
+
+cat >>confdefs.h <<\_ACEOF
+#define MODULE_SCOPE extern
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define NO_VIZ
+_ACEOF
+
+
+fi
+
+
+ if test "$SHARED_LIB_SUFFIX" = ""; then
+
+ SHARED_LIB_SUFFIX='${VERSION}${SHLIB_SUFFIX}'
+fi
+
+ if test "$UNSHARED_LIB_SUFFIX" = ""; then
+
+ UNSHARED_LIB_SUFFIX='${VERSION}.a'
+fi
+
+ DLL_INSTALL_DIR="\$(LIB_INSTALL_DIR)"
+
+ if test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""; then
+
LIB_SUFFIX=${SHARED_LIB_SUFFIX}
MAKE_LIB='${SHLIB_LD} -o $@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
- else
+ if test "${SHLIB_SUFFIX}" = ".dll"; then
+
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)"/$(LIB_FILE)'
+ DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)"
+
+else
+
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)"/$(LIB_FILE)'
+
+fi
+
+
+else
+
LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
- if test "$RANLIB" = "" ; then
+ if test "$RANLIB" = ""; then
+
MAKE_LIB='$(STLIB_LD) $@ ${OBJS}'
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
- else
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)"/$(LIB_FILE)'
+
+else
+
MAKE_LIB='${STLIB_LD} $@ ${OBJS} ; ${RANLIB} $@'
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(LIB_FILE))'
- fi
- fi
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)"/$(LIB_FILE) ; (cd "$(LIB_INSTALL_DIR)" ; $(RANLIB) $(LIB_FILE))'
+
+fi
+
+
+fi
# Stub lib does not depend on shared/static configuration
- if test "$RANLIB" = "" ; then
+ if test "$RANLIB" = ""; then
+
MAKE_STUB_LIB='${STLIB_LD} $@ ${STUB_LIB_OBJS}'
- INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)'
- else
+ INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)"'
+
+else
+
MAKE_STUB_LIB='${STLIB_LD} $@ ${STUB_LIB_OBJS} ; ${RANLIB} $@'
- INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(STUB_LIB_FILE))'
- fi
+ INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)"/$(STUB_LIB_FILE) ; (cd "$(LIB_INSTALL_DIR)" ; $(RANLIB) $(STUB_LIB_FILE))'
+
+fi
+
+
+ # Define TCL_LIBS now that we know what DL_LIBS is.
+ # The trick here is that we don't want to change the value of TCL_LIBS if
+ # it is already set when tclConfig.sh had been loaded by Tk.
+ if test "x${TCL_LIBS}" = x; then
+
+ TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}"
+fi
+
+
+
+ # FIXME: This subst was left in only because the TCL_DL_LIBS
+ # entry in tclConfig.sh uses it. It is not clear why someone
+ # would use TCL_DL_LIBS instead of TCL_LIBS.
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- echo $ac_n "checking for build with symbols""... $ac_c" 1>&6
-echo "configure:3962: checking for build with symbols" >&5
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define TCL_SHLIB_EXT "${SHLIB_SUFFIX}"
+_ACEOF
+
+
+
+
+
+
+
+
+
+
+
+ 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
-
+fi;
# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
+ DBGX=""
if test "$tcl_ok" = "no"; then
CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
- DBGX=""
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define TCL_CFG_OPTIMIZED 1
+_ACEOF
+
else
CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
- DBGX=g
if test "$tcl_ok" = "yes"; then
- echo "$ac_t""yes (standard debugging)" 1>&6
+ echo "$as_me:$LINENO: result: yes (standard debugging)" >&5
+echo "${ECHO_T}yes (standard debugging)" >&6
fi
fi
-
-
+
+
+ ### FIXME: Surely TCL_CFG_DEBUG should be set to whether we're debugging?
+
+cat >>confdefs.h <<\_ACEOF
+#define TCL_CFG_DEBUG 1
+_ACEOF
+
if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define TCL_MEM_DEBUG 1
-EOF
+_ACEOF
fi
- if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
- cat >> confdefs.h <<\EOF
-#define TCL_COMPILE_DEBUG 1
-EOF
- cat >> confdefs.h <<\EOF
-#define TCL_COMPILE_STATS 1
-EOF
-
- fi
if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
if test "$tcl_ok" = "all"; then
- echo "$ac_t""enabled symbols mem compile debugging" 1>&6
+ echo "$as_me:$LINENO: result: enabled symbols mem debugging" >&5
+echo "${ECHO_T}enabled symbols mem debugging" >&6
else
- echo "$ac_t""enabled $tcl_ok debugging" 1>&6
+ echo "$as_me:$LINENO: result: enabled $tcl_ok debugging" >&5
+echo "${ECHO_T}enabled $tcl_ok debugging" >&6
fi
fi
-TK_DBGX=${DBGX}
-
#--------------------------------------------------------------------
# Detect what compiler flags to set for 64-bit support.
#--------------------------------------------------------------------
- echo $ac_n "checking for required early compiler flags""... $ac_c" 1>&6
-echo "configure:4023: checking for required early compiler flags" >&5
+ echo "$as_me:$LINENO: checking for required early compiler flags" >&5
+echo $ECHO_N "checking for required early compiler flags... $ECHO_C" >&6
tcl_flags=""
-
- if eval "test \"`echo '$''{'tcl_cv_flag__isoc99_source'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+ if test "${tcl_cv_flag__isoc99_source+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 4030 "configure"
-#include "confdefs.h"
+ 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>
-int main() {
+int
+main ()
+{
char *p = (char *)strtoll; char *q = (char *)strtoull;
-; return 0; }
-EOF
-if { (eval echo configure:4037: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ 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_flag__isoc99_source=no
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- cat > conftest.$ac_ext <<EOF
-#line 4045 "configure"
-#include "confdefs.h"
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _ISOC99_SOURCE 1
#include <stdlib.h>
-int main() {
+int
+main ()
+{
char *p = (char *)strtoll; char *q = (char *)strtoull;
-; return 0; }
-EOF
-if { (eval echo configure:4053: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ 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_flag__isoc99_source=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_flag__isoc99_source=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_flag__isoc99_source=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test "x${tcl_cv_flag__isoc99_source}" = "xyes" ; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _ISOC99_SOURCE 1
-EOF
+_ACEOF
tcl_flags="$tcl_flags _ISOC99_SOURCE"
fi
-
- if eval "test \"`echo '$''{'tcl_cv_flag__largefile64_source'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+ if test "${tcl_cv_flag__largefile64_source+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 4080 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/stat.h>
-int main() {
+int
+main ()
+{
struct stat64 buf; int i = stat64("/", &buf);
-; return 0; }
-EOF
-if { (eval echo configure:4087: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ 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_flag__largefile64_source=no
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- cat > conftest.$ac_ext <<EOF
-#line 4095 "configure"
-#include "confdefs.h"
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _LARGEFILE64_SOURCE 1
#include <sys/stat.h>
-int main() {
+int
+main ()
+{
struct stat64 buf; int i = stat64("/", &buf);
-; return 0; }
-EOF
-if { (eval echo configure:4103: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ 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_flag__largefile64_source=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_flag__largefile64_source=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_flag__largefile64_source=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test "x${tcl_cv_flag__largefile64_source}" = "xyes" ; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _LARGEFILE64_SOURCE 1
-EOF
+_ACEOF
tcl_flags="$tcl_flags _LARGEFILE64_SOURCE"
fi
-
- if eval "test \"`echo '$''{'tcl_cv_flag__largefile_source64'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+
+ if test "${tcl_cv_flag__largefile_source64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 4130 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/stat.h>
-int main() {
+int
+main ()
+{
char *p = (char *)open64;
-; return 0; }
-EOF
-if { (eval echo configure:4137: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ 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_flag__largefile_source64=no
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- cat > conftest.$ac_ext <<EOF
-#line 4145 "configure"
-#include "confdefs.h"
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define _LARGEFILE_SOURCE64 1
#include <sys/stat.h>
-int main() {
+int
+main ()
+{
char *p = (char *)open64;
-; return 0; }
-EOF
-if { (eval echo configure:4153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ 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_flag__largefile_source64=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_flag__largefile_source64=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_flag__largefile_source64=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test "x${tcl_cv_flag__largefile_source64}" = "xyes" ; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define _LARGEFILE_SOURCE64 1
-EOF
+_ACEOF
tcl_flags="$tcl_flags _LARGEFILE_SOURCE64"
fi
if test "x${tcl_flags}" = "x" ; then
- echo "$ac_t""none" 1>&6
+ echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6
else
- echo "$ac_t""${tcl_flags}" 1>&6
+ echo "$as_me:$LINENO: result: ${tcl_flags}" >&5
+echo "${ECHO_T}${tcl_flags}" >&6
fi
- echo $ac_n "checking for 64-bit integer type""... $ac_c" 1>&6
-echo "configure:4184: checking for 64-bit integer type" >&5
- if eval "test \"`echo '$''{'tcl_cv_type_64bit'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for 64-bit integer type" >&5
+echo $ECHO_N "checking for 64-bit integer type... $ECHO_C" >&6
+ if test "${tcl_cv_type_64bit+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
tcl_cv_type_64bit=none
# See if the compiler knows natively about __int64
- cat > conftest.$ac_ext <<EOF
-#line 4192 "configure"
-#include "confdefs.h"
-
-int main() {
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
__int64 value = (__int64) 0;
-; return 0; }
-EOF
-if { (eval echo configure:4199: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ 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_type_64bit=__int64
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_type_64bit="long long"
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_type_64bit="long long"
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
# See if we should use long anyway Note that we substitute in the
# type that is our current guess for a 64-bit type inside this check
# program, so it should be modified only carefully...
- cat > conftest.$ac_ext <<EOF
-#line 4213 "configure"
-#include "confdefs.h"
-
-int main() {
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
switch (0) {
case 1: case (sizeof(${tcl_type_64bit})==sizeof(long)): ;
}
-; return 0; }
-EOF
-if { (eval echo configure:4222: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ 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_type_64bit=${tcl_type_64bit}
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test "${tcl_cv_type_64bit}" = none ; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define TCL_WIDE_INT_IS_LONG 1
-EOF
+_ACEOF
- echo "$ac_t""using long" 1>&6
+ echo "$as_me:$LINENO: result: using long" >&5
+echo "${ECHO_T}using long" >&6
else
- cat >> confdefs.h <<EOF
+
+cat >>confdefs.h <<_ACEOF
#define TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit}
-EOF
+_ACEOF
- echo "$ac_t""${tcl_cv_type_64bit}" 1>&6
+ echo "$as_me:$LINENO: result: ${tcl_cv_type_64bit}" >&5
+echo "${ECHO_T}${tcl_cv_type_64bit}" >&6
# Now check for auxiliary declarations
- echo $ac_n "checking for struct dirent64""... $ac_c" 1>&6
-echo "configure:4247: checking for struct dirent64" >&5
-if eval "test \"`echo '$''{'tcl_cv_struct_dirent64'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
-
- cat > conftest.$ac_ext <<EOF
-#line 4253 "configure"
-#include "confdefs.h"
+ echo "$as_me:$LINENO: checking for struct dirent64" >&5
+echo $ECHO_N "checking for struct dirent64... $ECHO_C" >&6
+if test "${tcl_cv_struct_dirent64+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 <sys/types.h>
#include <sys/dirent.h>
-int main() {
+int
+main ()
+{
struct dirent64 p;
-; return 0; }
-EOF
-if { (eval echo configure:4261: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ 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_struct_dirent64=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_struct_dirent64=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_struct_dirent64=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$tcl_cv_struct_dirent64" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_struct_dirent64" >&5
+echo "${ECHO_T}$tcl_cv_struct_dirent64" >&6
if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_STRUCT_DIRENT64 1
-EOF
+_ACEOF
fi
- echo $ac_n "checking for struct stat64""... $ac_c" 1>&6
-echo "configure:4282: checking for struct stat64" >&5
-if eval "test \"`echo '$''{'tcl_cv_struct_stat64'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for struct stat64" >&5
+echo $ECHO_N "checking for struct stat64... $ECHO_C" >&6
+if test "${tcl_cv_struct_stat64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
- cat > conftest.$ac_ext <<EOF
-#line 4288 "configure"
-#include "confdefs.h"
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/stat.h>
-int main() {
+int
+main ()
+{
struct stat64 p;
-; return 0; }
-EOF
-if { (eval echo configure:4296: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ 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_struct_stat64=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_struct_stat64=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_struct_stat64=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$tcl_cv_struct_stat64" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_struct_stat64" >&5
+echo "${ECHO_T}$tcl_cv_struct_stat64" >&6
if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_STRUCT_STAT64 1
-EOF
+_ACEOF
fi
- for ac_func in open64 lseek64
+
+
+for ac_func in open64 lseek64
do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4319: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 4324 "configure"
-#include "confdefs.h"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+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 $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
-int main() {
+#undef $ac_func
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
-$ac_func();
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:4347: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ 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
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
fi
done
- echo $ac_n "checking for off64_t""... $ac_c" 1>&6
-echo "configure:4372: checking for off64_t" >&5
- if eval "test \"`echo '$''{'tcl_cv_type_off64_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for off64_t" >&5
+echo $ECHO_N "checking for off64_t... $ECHO_C" >&6
+ if test "${tcl_cv_type_off64_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
- cat > conftest.$ac_ext <<EOF
-#line 4378 "configure"
-#include "confdefs.h"
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
-int main() {
+int
+main ()
+{
off64_t offset;
-; return 0; }
-EOF
-if { (eval echo configure:4386: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ 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_type_off64_t=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_type_off64_t=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_type_off64_t=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test "x${tcl_cv_type_off64_t}" = "xyes" && \
test "x${ac_cv_func_lseek64}" = "xyes" && \
test "x${ac_cv_func_open64}" = "xyes" ; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_TYPE_OFF64_T 1
-EOF
+_ACEOF
- echo "$ac_t""yes" 1>&6
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
fi
@@ -4412,63 +7828,182 @@ EOF
# Check endianness because we can optimize some operations
#--------------------------------------------------------------------
-echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:4417: checking whether byte ordering is bigendian" >&5
-if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_cv_c_bigendian=unknown
-# See if sys/param.h defines the BYTE_ORDER macro.
-cat > conftest.$ac_ext <<EOF
-#line 4424 "configure"
-#include "confdefs.h"
+echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
+echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6
+if test "${ac_cv_c_bigendian+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # See if sys/param.h defines the BYTE_ORDER macro.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
#include <sys/param.h>
-int main() {
+int
+main ()
+{
#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
bogus endian macros
#endif
-; return 0; }
-EOF
-if { (eval echo configure:4435: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+
+ ;
+ 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
# It does; now see whether it defined to BIG_ENDIAN or not.
-cat > conftest.$ac_ext <<EOF
-#line 4439 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
#include <sys/param.h>
-int main() {
+int
+main ()
+{
#if BYTE_ORDER != BIG_ENDIAN
not big endian
#endif
-; return 0; }
-EOF
-if { (eval echo configure:4450: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+
+ ;
+ 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_c_bigendian=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_c_bigendian=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_bigendian=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
-if test $ac_cv_c_bigendian = unknown; then
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+# It does not; compile a test program.
if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+ # try to guess the endianness by grepping values into an object file
+ ac_cv_c_bigendian=unknown
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
+short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
+int
+main ()
+{
+ _ascii (); _ebcdic ();
+ ;
+ 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 grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
+ ac_cv_c_bigendian=yes
+fi
+if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+ if test "$ac_cv_c_bigendian" = unknown; then
+ ac_cv_c_bigendian=no
+ else
+ # finding both strings is unlikely to happen, but who knows?
+ ac_cv_c_bigendian=unknown
+ fi
+fi
else
- cat > conftest.$ac_ext <<EOF
-#line 4470 "configure"
-#include "confdefs.h"
-main () {
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+int
+main ()
+{
/* Are we little or big endian? From Harbison&Steele. */
union
{
@@ -4478,29 +8013,50 @@ main () {
u.l = 1;
exit (u.c[sizeof (long) - 1] == 1);
}
-EOF
-if { (eval echo configure:4483: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_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
ac_cv_c_bigendian=no
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_c_bigendian=yes
+ 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_c_bigendian=yes
fi
-rm -fr conftest*
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+echo "${ECHO_T}$ac_cv_c_bigendian" >&6
+case $ac_cv_c_bigendian in
+ yes)
-echo "$ac_t""$ac_cv_c_bigendian" 1>&6
-if test $ac_cv_c_bigendian = yes; then
- cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
#define WORDS_BIGENDIAN 1
-EOF
-
-fi
+_ACEOF
+ ;;
+ no)
+ ;;
+ *)
+ { { echo "$as_me:$LINENO: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&5
+echo "$as_me: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
#------------------------------------------------------------------------
@@ -4508,16 +8064,19 @@ fi
# search path to reflect this.
#------------------------------------------------------------------------
-LIB_RUNTIME_DIR='${LIB_RUNTIME_DIR}'
+LIB_RUNTIME_DIR='$(libdir)'
if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then
LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}/lib"
fi
if test "$TCL_PREFIX" != "$prefix"; then
- echo "configure: warning:
+ { echo "$as_me:$LINENO: WARNING:
Different --prefix selected for Tk and Tcl!
- [package require Tk] may not work correctly in tclsh." 1>&2
+ [package require Tk] may not work correctly in tclsh." >&5
+echo "$as_me: WARNING:
+ Different --prefix selected for Tk and Tcl!
+ [package require Tk] may not work correctly in tclsh." >&2;}
fi
#--------------------------------------------------------------------
@@ -4530,71 +8089,102 @@ fi
# special flag.
#--------------------------------------------------------------------
-echo $ac_n "checking for fd_set in sys/types""... $ac_c" 1>&6
-echo "configure:4535: checking for fd_set in sys/types" >&5
-if eval "test \"`echo '$''{'tcl_cv_type_fd_set'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for fd_set in sys/types" >&5
+echo $ECHO_N "checking for fd_set in sys/types... $ECHO_C" >&6
+if test "${tcl_cv_type_fd_set+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
- cat > conftest.$ac_ext <<EOF
-#line 4541 "configure"
-#include "confdefs.h"
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
-int main() {
+int
+main ()
+{
fd_set readMask, writeMask;
-; return 0; }
-EOF
-if { (eval echo configure:4548: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ 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_type_fd_set=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_type_fd_set=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_type_fd_set=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$tcl_cv_type_fd_set" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_type_fd_set" >&5
+echo "${ECHO_T}$tcl_cv_type_fd_set" >&6
tk_ok=$tcl_cv_type_fd_set
if test $tk_ok = no; then
- echo $ac_n "checking for fd_mask in sys/select""... $ac_c" 1>&6
-echo "configure:4564: checking for fd_mask in sys/select" >&5
-if eval "test \"`echo '$''{'tcl_cv_grep_fd_mask'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
-
- cat > conftest.$ac_ext <<EOF
-#line 4570 "configure"
-#include "confdefs.h"
+ echo "$as_me:$LINENO: checking for fd_mask in sys/select" >&5
+echo $ECHO_N "checking for fd_mask in sys/select... $ECHO_C" >&6
+if test "${tcl_cv_grep_fd_mask+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 <sys/select.h>
-EOF
+
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "fd_mask" >/dev/null 2>&1; then
- rm -rf conftest*
+ $EGREP "fd_mask" >/dev/null 2>&1; then
tcl_cv_grep_fd_mask=present
else
- rm -rf conftest*
tcl_cv_grep_fd_mask=missing
fi
rm -f conftest*
fi
-
-echo "$ac_t""$tcl_cv_grep_fd_mask" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_grep_fd_mask" >&5
+echo "${ECHO_T}$tcl_cv_grep_fd_mask" >&6
if test $tcl_cv_grep_fd_mask = present; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_SYS_SELECT_H 1
-EOF
+_ACEOF
tk_ok=yes
fi
fi
if test $tk_ok = no; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define NO_FD_SET 1
-EOF
+_ACEOF
fi
@@ -4602,78 +8192,218 @@ fi
# Find out all about time handling differences.
#------------------------------------------------------------------------------
-for ac_hdr in sys/time.h
+
+for ac_header in sys/time.h
do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4610: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 4615 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4620: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ 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
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header 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 <$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
+ 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 $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header 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 <$ac_header>
+_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
-rm -f conftest*
+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
+
+ ac_header_preproc=no
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# 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: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ----------------------------- ##
+## Report this to the tk lists. ##
+## ----------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+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
- echo "$ac_t""no" 1>&6
+ eval "$as_ac_Header=\$ac_header_preproc"
fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
done
-echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:4647: checking whether time.h and sys/time.h may both be included" >&5
-if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 4652 "configure"
-#include "confdefs.h"
+echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
+if test "${ac_cv_header_time+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 <sys/types.h>
#include <sys/time.h>
#include <time.h>
-int main() {
-struct tm *tp;
-; return 0; }
-EOF
-if { (eval echo configure:4661: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+
+int
+main ()
+{
+if ((struct tm *) 0)
+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_header_time=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_time=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_time=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$ac_cv_header_time" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6
if test $ac_cv_header_time = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define TIME_WITH_SYS_TIME 1
-EOF
+_ACEOF
fi
@@ -4686,68 +8416,118 @@ fi
#--------------------------------------------------------------------
- echo $ac_n "checking for strtod""... $ac_c" 1>&6
-echo "configure:4691: checking for strtod" >&5
-if eval "test \"`echo '$''{'ac_cv_func_strtod'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for strtod" >&5
+echo $ECHO_N "checking for strtod... $ECHO_C" >&6
+if test "${ac_cv_func_strtod+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 4696 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define strtod to an innocuous variant, in case <limits.h> declares strtod.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define strtod innocuous_strtod
+
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char strtod(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char strtod();
+ which can conflict with char strtod (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
-int main() {
+#undef strtod
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char strtod ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_strtod) || defined (__stub___strtod)
choke me
#else
-strtod();
+char (*f) () = strtod;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:4719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_strtod=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_strtod=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'strtod`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+int
+main ()
+{
+return f != strtod;
+ ;
+ 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
+ ac_cv_func_strtod=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_strtod=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_strtod" >&5
+echo "${ECHO_T}$ac_cv_func_strtod" >&6
+if test $ac_cv_func_strtod = yes; then
tcl_strtod=1
else
- echo "$ac_t""no" 1>&6
-tcl_strtod=0
+ tcl_strtod=0
fi
if test "$tcl_strtod" = 1; then
- echo $ac_n "checking for Solaris2.4/Tru64 strtod bugs""... $ac_c" 1>&6
-echo "configure:4741: checking for Solaris2.4/Tru64 strtod bugs" >&5
-if eval "test \"`echo '$''{'tcl_cv_strtod_buggy'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for Solaris2.4/Tru64 strtod bugs" >&5
+echo $ECHO_N "checking for Solaris2.4/Tru64 strtod bugs... $ECHO_C" >&6
+if test "${tcl_cv_strtod_buggy+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
if test "$cross_compiling" = yes; then
tcl_cv_strtod_buggy=buggy
else
- cat > conftest.$ac_ext <<EOF
-#line 4750 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
extern double strtod();
int main() {
@@ -4768,27 +8548,46 @@ else
}
exit(0);
}
-EOF
-if { (eval echo configure:4773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_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
tcl_cv_strtod_buggy=ok
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- tcl_cv_strtod_buggy=buggy
+ 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_strtod_buggy=buggy
fi
-rm -fr conftest*
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
fi
-
-echo "$ac_t""$tcl_cv_strtod_buggy" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_strtod_buggy" >&5
+echo "${ECHO_T}$tcl_cv_strtod_buggy" >&6
if test "$tcl_cv_strtod_buggy" = buggy; then
- LIBOBJS="$LIBOBJS fixstrtod.o"
- cat >> confdefs.h <<\EOF
+ case $LIBOBJS in
+ "fixstrtod.$ac_objext" | \
+ *" fixstrtod.$ac_objext" | \
+ "fixstrtod.$ac_objext "* | \
+ *" fixstrtod.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS fixstrtod.$ac_objext" ;;
+esac
+
+ USE_COMPAT=1
+
+cat >>confdefs.h <<\_ACEOF
#define strtod fixstrtod
-EOF
+_ACEOF
fi
fi
@@ -4799,240 +8598,511 @@ EOF
# they don't exist.
#--------------------------------------------------------------------
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:4804: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 4809 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4817: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- ac_cv_header_stdc=yes
+echo "$as_me:$LINENO: checking for mode_t" >&5
+echo $ECHO_N "checking for mode_t... $ECHO_C" >&6
+if test "${ac_cv_type_mode_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 ((mode_t *) 0)
+ return 0;
+if (sizeof (mode_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_mode_t=yes
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 4834 "configure"
-#include "confdefs.h"
-#include <string.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "memchr" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- ac_cv_header_stdc=no
+ac_cv_type_mode_t=no
fi
-rm -f conftest*
-
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
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 <<EOF
-#line 4852 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "free" >/dev/null 2>&1; then
+echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5
+echo "${ECHO_T}$ac_cv_type_mode_t" >&6
+if test $ac_cv_type_mode_t = yes; then
:
else
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-fi
+cat >>confdefs.h <<_ACEOF
+#define mode_t int
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for pid_t" >&5
+echo $ECHO_N "checking for pid_t... $ECHO_C" >&6
+if test "${ac_cv_type_pid_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 ((pid_t *) 0)
+ return 0;
+if (sizeof (pid_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_pid_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
-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
+ac_cv_type_pid_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
+echo "${ECHO_T}$ac_cv_type_pid_t" >&6
+if test $ac_cv_type_pid_t = yes; then
:
else
- cat > conftest.$ac_ext <<EOF
-#line 4873 "configure"
-#include "confdefs.h"
-#include <ctype.h>
-#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#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); }
-EOF
-if { (eval echo configure:4884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- :
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6
+if test "${ac_cv_type_size_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 ((size_t *) 0)
+ return 0;
+if (sizeof (size_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_size_t=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_header_stdc=no
-fi
-rm -fr conftest*
-fi
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ac_cv_type_size_t=no
fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6
+if test $ac_cv_type_size_t = yes; then
+ :
+else
-echo "$ac_t""$ac_cv_header_stdc" 1>&6
-if test $ac_cv_header_stdc = yes; then
- cat >> confdefs.h <<\EOF
-#define STDC_HEADERS 1
-EOF
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned
+_ACEOF
fi
-echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:4908: checking for mode_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5
+echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6
+if test "${ac_cv_type_uid_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 4913 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
+
+_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_mode_t=yes
+ $EGREP "uid_t" >/dev/null 2>&1; then
+ ac_cv_type_uid_t=yes
else
- rm -rf conftest*
- ac_cv_type_mode_t=no
+ ac_cv_type_uid_t=no
fi
rm -f conftest*
fi
-echo "$ac_t""$ac_cv_type_mode_t" 1>&6
-if test $ac_cv_type_mode_t = no; then
- cat >> confdefs.h <<\EOF
-#define mode_t int
-EOF
+echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5
+echo "${ECHO_T}$ac_cv_type_uid_t" >&6
+if test $ac_cv_type_uid_t = no; then
-fi
+cat >>confdefs.h <<\_ACEOF
+#define uid_t int
+_ACEOF
-echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:4941: checking for pid_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 4946 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_pid_t=yes
+
+cat >>confdefs.h <<\_ACEOF
+#define gid_t int
+_ACEOF
+
+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_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
+
+
+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
+
+ for tcl_cv_intptr_t in "int" "long" "long long" 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
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_intptr_t))];
+test_array [0] = 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
+ tcl_ok=yes
else
- rm -rf conftest*
- ac_cv_type_pid_t=no
-fi
-rm -f conftest*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+tcl_ok=no
fi
-echo "$ac_t""$ac_cv_type_pid_t" 1>&6
-if test $ac_cv_type_pid_t = no; then
- cat >> confdefs.h <<\EOF
-#define pid_t int
-EOF
-
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$tcl_ok" = yes && break; fi
+ done
fi
+echo "$as_me:$LINENO: result: $tcl_cv_intptr_t" >&5
+echo "${ECHO_T}$tcl_cv_intptr_t" >&6
+ if test "$tcl_cv_intptr_t" != none; then
-echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:4974: checking for size_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 4979 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_size_t=yes
-else
- rm -rf conftest*
- ac_cv_type_size_t=no
-fi
-rm -f conftest*
+cat >>confdefs.h <<_ACEOF
+#define intptr_t $tcl_cv_intptr_t
+_ACEOF
-fi
-echo "$ac_t""$ac_cv_type_size_t" 1>&6
-if test $ac_cv_type_size_t = no; then
- cat >> confdefs.h <<\EOF
-#define size_t unsigned
-EOF
+ fi
fi
-echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:5007: checking for uid_t in sys/types.h" >&5
-if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5012 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "uid_t" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_uid_t=yes
+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
+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
+
+
+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
+
+ for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned long long" \
+ 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
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_uintptr_t))];
+test_array [0] = 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
+ tcl_ok=yes
else
- rm -rf conftest*
- ac_cv_type_uid_t=no
-fi
-rm -f conftest*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+tcl_ok=no
fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$tcl_ok" = yes && break; fi
+ done
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_uintptr_t" >&5
+echo "${ECHO_T}$tcl_cv_uintptr_t" >&6
+ if test "$tcl_cv_uintptr_t" != none; then
-echo "$ac_t""$ac_cv_type_uid_t" 1>&6
-if test $ac_cv_type_uid_t = no; then
- cat >> confdefs.h <<\EOF
-#define uid_t int
-EOF
+cat >>confdefs.h <<_ACEOF
+#define uintptr_t $tcl_cv_uintptr_t
+_ACEOF
- cat >> confdefs.h <<\EOF
-#define gid_t int
-EOF
+ fi
fi
@@ -5041,37 +9111,65 @@ fi
# In OS/390 struct pwd has no pw_gecos field
#-------------------------------------------
-echo $ac_n "checking pw_gecos in struct pwd""... $ac_c" 1>&6
-echo "configure:5046: checking pw_gecos in struct pwd" >&5
-if eval "test \"`echo '$''{'tcl_cv_pwd_pw_gecos'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking pw_gecos in struct pwd" >&5
+echo $ECHO_N "checking pw_gecos in struct pwd... $ECHO_C" >&6
+if test "${tcl_cv_pwd_pw_gecos+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
- cat > conftest.$ac_ext <<EOF
-#line 5052 "configure"
-#include "confdefs.h"
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <pwd.h>
-int main() {
+int
+main ()
+{
struct passwd pwd; pwd.pw_gecos;
-; return 0; }
-EOF
-if { (eval echo configure:5059: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ 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_pwd_pw_gecos=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_pwd_pw_gecos=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_pwd_pw_gecos=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$tcl_cv_pwd_pw_gecos" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_pwd_pw_gecos" >&5
+echo "${ECHO_T}$tcl_cv_pwd_pw_gecos" >&6
if test $tcl_cv_pwd_pw_gecos = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define HAVE_PW_GECOS 1
-EOF
+_ACEOF
fi
@@ -5079,95 +9177,514 @@ fi
# On Mac OS X, we can build either with X11 or with Aqua
#--------------------------------------------------------------------
+MACOSX_SRC_DIR=macosx
if test "`uname -s`" = "Darwin" ; then
- echo $ac_n "checking whether to use Aqua""... $ac_c" 1>&6
-echo "configure:5085: checking whether to use Aqua" >&5
+ echo "$as_me:$LINENO: checking whether to use Aqua" >&5
+echo $ECHO_N "checking whether to use Aqua... $ECHO_C" >&6
# Check whether --enable-aqua or --disable-aqua was given.
if test "${enable_aqua+set}" = set; then
enableval="$enable_aqua"
tk_aqua=$enableval
else
tk_aqua=no
-fi
-
- if test $tk_aqua = yes; then
- if test $tcl_corefoundation = no; then
- echo "configure: warning: Aqua can only be used when CoreFoundation is available" 1>&2
+fi;
+ if test $tk_aqua = yes -o $tk_aqua = cocoa; then
+ tk_aqua=yes
+ if test ! -d /System/Library/Frameworks/Cocoa.framework; then
+ { echo "$as_me:$LINENO: WARNING: Aqua can only be used when Cocoa is available" >&5
+echo "$as_me: WARNING: Aqua can only be used when Cocoa is available" >&2;}
tk_aqua=no
fi
+ if test "`uname -r | awk -F. '{print $1}'`" -lt 9; then
+ { echo "$as_me:$LINENO: WARNING: Aqua requires Mac OS X 10.5 or later" >&5
+echo "$as_me: WARNING: Aqua requires Mac OS X 10.5 or later" >&2;}
+ tk_aqua=no
+ fi
+ elif test $tk_aqua = carbon; then
if test ! -d /System/Library/Frameworks/Carbon.framework; then
- echo "configure: warning: Aqua can only be used when Carbon is available" 1>&2
+ { echo "$as_me:$LINENO: WARNING: Aqua can only be used when Carbon is available" >&5
+echo "$as_me: WARNING: Aqua can only be used when Carbon is available" >&2;}
tk_aqua=no
fi
if test "`uname -r | awk -F. '{print $1}'`" -lt 6; then
- echo "configure: warning: Aqua requires Mac OS X 10.2 or later" 1>&2
+ { echo "$as_me:$LINENO: WARNING: Aqua requires Mac OS X 10.2 or later" >&5
+echo "$as_me: WARNING: Aqua requires Mac OS X 10.2 or later" >&2;}
tk_aqua=no
fi
+ else
+ tk_aqua=no
+ fi
+ if test $tk_aqua != no -a $tcl_corefoundation = no; then
+ { echo "$as_me:$LINENO: WARNING: Aqua can only be used when CoreFoundation is available" >&5
+echo "$as_me: WARNING: Aqua can only be used when CoreFoundation is available" >&2;}
+ tk_aqua=no
+ fi
+ if test $tk_aqua = carbon; then
+ MACOSX_SRC_DIR=carbon
+ echo "$as_me:$LINENO: result: yes (deprecated legacy Carbon implementation)" >&5
+echo "${ECHO_T}yes (deprecated legacy Carbon implementation)" >&6
+ else
+ echo "$as_me:$LINENO: result: $tk_aqua" >&5
+echo "${ECHO_T}$tk_aqua" >&6
fi
- echo "$ac_t""$tk_aqua" 1>&6
if test "$fat_32_64" = yes; then
if test $tk_aqua = no; then
- echo $ac_n "checking for 64-bit X11""... $ac_c" 1>&6
-echo "configure:5112: checking for 64-bit X11" >&5
-if eval "test \"`echo '$''{'tcl_cv_lib_x11_64'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for 64-bit X11" >&5
+echo $ECHO_N "checking for 64-bit X11... $ECHO_C" >&6
+if test "${tcl_cv_lib_x11_64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
+
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
done
CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include"
LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
- cat > conftest.$ac_ext <<EOF
-#line 5123 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <X11/Xlib.h>
-int main() {
+int
+main ()
+{
XrmInitialize();
-; return 0; }
-EOF
-if { (eval echo configure:5130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
+ ;
+ 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
tcl_cv_lib_x11_64=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- tcl_cv_lib_x11_64=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_lib_x11_64=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval $v'="$hold_'$v'"'
done
fi
-
-echo "$ac_t""$tcl_cv_lib_x11_64" 1>&6
+echo "$as_me:$LINENO: result: $tcl_cv_lib_x11_64" >&5
+echo "${ECHO_T}$tcl_cv_lib_x11_64" >&6
fi
# remove 64-bit arch flags from CFLAGS et al. for combined 32 & 64 bit
# fat builds if configuration does not support 64-bit.
- if test $tk_aqua = yes -o "$tcl_cv_lib_x11_64" = no; then
- echo "configure: warning: Removing 64-bit architectures from compiler & linker flags" 1>&2
+ if test $tk_aqua = carbon -o "$tcl_cv_lib_x11_64" = no; then
+ { echo "$as_me:$LINENO: Removing 64-bit architectures from compiler & linker flags" >&5
+echo "$as_me: Removing 64-bit architectures from compiler & linker flags" >&6;}
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
done
fi
fi
+ if test $tk_aqua = no; then
+ # check if weak linking whole libraries is possible.
+ echo "$as_me:$LINENO: checking if ld accepts -weak-l flag" >&5
+echo $ECHO_N "checking if ld accepts -weak-l flag... $ECHO_C" >&6
+if test "${tcl_cv_ld_weak_l+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ hold_ldflags=$LDFLAGS
+ LDFLAGS="$LDFLAGS -Wl,-weak-lm"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <math.h>
+int
+main ()
+{
+double f = sin(1.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
+ tcl_cv_ld_weak_l=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_ld_weak_l=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$hold_ldflags
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_ld_weak_l" >&5
+echo "${ECHO_T}$tcl_cv_ld_weak_l" >&6
+ fi
+
+for ac_header in AvailabilityMacros.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ 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
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header 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 <$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
+ 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 $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header 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 <$ac_header>
+_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
+
+ 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
+
+# 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: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ----------------------------- ##
+## Report this to the tk lists. ##
+## ----------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+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
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+ if test "$ac_cv_header_AvailabilityMacros_h" = yes; then
+ echo "$as_me:$LINENO: checking if weak import is available" >&5
+echo $ECHO_N "checking if weak import is available... $ECHO_C" >&6
+if test "${tcl_cv_cc_weak_import+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+ #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
+ #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
+ #endif
+ #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1020
+ #error MAC_OS_X_VERSION_MIN_REQUIRED < 1020
+ #endif
+ int rand(void) __attribute__((weak_import));
+
+int
+main ()
+{
+rand();
+ ;
+ 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
+ tcl_cv_cc_weak_import=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cc_weak_import=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS=$hold_cflags
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_cc_weak_import" >&5
+echo "${ECHO_T}$tcl_cv_cc_weak_import" >&6
+ if test $tcl_cv_cc_weak_import = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_WEAK_IMPORT 1
+_ACEOF
+
+ fi
+ echo "$as_me:$LINENO: checking if Darwin SUSv3 extensions are available" >&5
+echo $ECHO_N "checking if Darwin SUSv3 extensions are available... $ECHO_C" >&6
+if test "${tcl_cv_cc_darwin_c_source+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+ #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
+ #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
+ #endif
+ #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+ #error MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+ #endif
+ #define _DARWIN_C_SOURCE 1
+ #include <sys/cdefs.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
+ tcl_cv_cc_darwin_c_source=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cc_darwin_c_source=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS=$hold_cflags
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_cc_darwin_c_source" >&5
+echo "${ECHO_T}$tcl_cv_cc_darwin_c_source" >&6
+ if test $tcl_cv_cc_darwin_c_source = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _DARWIN_C_SOURCE 1
+_ACEOF
+
+ fi
+ fi
else
tk_aqua=no
fi
-if test $tk_aqua = yes; then
- cat >> confdefs.h <<\EOF
+if test $tk_aqua != no; then
+ if test $tk_aqua = yes; then
+ LIBS="$LIBS -framework Cocoa -framework Carbon -framework IOKit"
+ EXTRA_CC_SWITCHES='-std=gnu99 -x objective-c -fobjc-gc'
+ else
+ LIBS="$LIBS -framework Carbon -framework IOKit"
+ CFLAGS="$CFLAGS -fpascal-strings"
+ fi
+
+cat >>confdefs.h <<\_ACEOF
#define MAC_OSX_TK 1
-EOF
+_ACEOF
- LIBS="$LIBS -framework Carbon"
- CFLAGS="$CFLAGS -fpascal-strings"
TK_WINDOWINGSYSTEM=AQUA
if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define TK_MAC_DEBUG 1
-EOF
+_ACEOF
fi
else
@@ -5179,21 +9696,17 @@ else
# autoconf macro will return an include directory that contains
# no include files, so double-check its result just to be safe.
#--------------------------------------------------------------------
-
-
- # If we find X, set shell vars x_includes and x_libraries to the
-# paths, otherwise set no_x=yes.
-# Uses ac_ vars as temps to allow command line to override cache and checks.
-# --without-x overrides everything else, but does not touch the cache.
-echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:5190: checking for X" >&5
+
+
+ echo "$as_me:$LINENO: checking for X" >&5
+echo $ECHO_N "checking for X... $ECHO_C" >&6
+
# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
withval="$with_x"
- :
-fi
+fi;
# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
if test "x$with_x" = xno; then
# The user explicitly disabled X.
@@ -5203,207 +9716,210 @@ else
# Both variables are already set.
have_x=yes
else
-if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ if test "${ac_cv_have_x+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
# One or both of the vars are not set, and there is no cached value.
-ac_x_includes=NO ac_x_libraries=NO
-rm -fr conftestdir
-if mkdir conftestdir; then
- cd conftestdir
+ac_x_includes=no ac_x_libraries=no
+rm -fr conftest.dir
+if mkdir conftest.dir; then
+ cd conftest.dir
# Make sure to not put "make" in the Imakefile rules, since we grep it out.
- cat > Imakefile <<'EOF'
+ cat >Imakefile <<'_ACEOF'
acfindx:
@echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
-EOF
+_ACEOF
if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
# Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
for ac_extension in a so sl; do
if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
- test -f $ac_im_libdir/libX11.$ac_extension; then
- ac_im_usrlibdir=$ac_im_libdir; break
+ test -f $ac_im_libdir/libX11.$ac_extension; then
+ ac_im_usrlibdir=$ac_im_libdir; break
fi
done
# Screen out bogus values from the imake configuration. They are
# bogus both because they are the default anyway, and because
# using them would break gcc on systems where it needs fixed includes.
- case "$ac_im_incroot" in
+ case $ac_im_incroot in
/usr/include) ;;
- *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;;
+ *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
esac
- case "$ac_im_usrlibdir" in
+ case $ac_im_usrlibdir in
/usr/lib | /lib) ;;
- *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;;
+ *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;
esac
fi
cd ..
- rm -fr conftestdir
+ rm -fr conftest.dir
fi
-if test "$ac_x_includes" = NO; then
- # Guess where to find include files, by looking for this one X11 .h file.
- test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
-
+# Standard set of common directories for X headers.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+ac_x_header_dirs='
+/usr/X11/include
+/usr/X11R6/include
+/usr/X11R5/include
+/usr/X11R4/include
+
+/usr/include/X11
+/usr/include/X11R6
+/usr/include/X11R5
+/usr/include/X11R4
+
+/usr/local/X11/include
+/usr/local/X11R6/include
+/usr/local/X11R5/include
+/usr/local/X11R4/include
+
+/usr/local/include/X11
+/usr/local/include/X11R6
+/usr/local/include/X11R5
+/usr/local/include/X11R4
+
+/usr/X386/include
+/usr/x386/include
+/usr/XFree86/include/X11
+
+/usr/include
+/usr/local/include
+/usr/unsupported/include
+/usr/athena/include
+/usr/local/x11r5/include
+/usr/lpp/Xamples/include
+
+/usr/openwin/include
+/usr/openwin/share/include'
+
+if test "$ac_x_includes" = no; then
+ # Guess where to find include files, by looking for Intrinsic.h.
# First, try using that file with no special directory specified.
-cat > conftest.$ac_ext <<EOF
-#line 5252 "configure"
-#include "confdefs.h"
-#include <$x_direct_test_include>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5257: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <X11/Intrinsic.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
# We can compile using X headers with no special include directory.
ac_x_includes=
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- # Look for the header file in a standard set of common directories.
-# Check X11 before X11Rn because it is often a symlink to the current release.
- for ac_dir in \
- /usr/X11/include \
- /usr/X11R6/include \
- /usr/X11R5/include \
- /usr/X11R4/include \
- \
- /usr/include/X11 \
- /usr/include/X11R6 \
- /usr/include/X11R5 \
- /usr/include/X11R4 \
- \
- /usr/local/X11/include \
- /usr/local/X11R6/include \
- /usr/local/X11R5/include \
- /usr/local/X11R4/include \
- \
- /usr/local/include/X11 \
- /usr/local/include/X11R6 \
- /usr/local/include/X11R5 \
- /usr/local/include/X11R4 \
- \
- /usr/X386/include \
- /usr/x386/include \
- /usr/XFree86/include/X11 \
- \
- /usr/include \
- /usr/local/include \
- /usr/unsupported/include \
- /usr/athena/include \
- /usr/local/x11r5/include \
- /usr/lpp/Xamples/include \
- \
- /usr/openwin/include \
- /usr/openwin/share/include \
- ; \
- do
- if test -r "$ac_dir/$x_direct_test_include"; then
- ac_x_includes=$ac_dir
- break
- fi
- done
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ for ac_dir in $ac_x_header_dirs; do
+ if test -r "$ac_dir/X11/Intrinsic.h"; then
+ ac_x_includes=$ac_dir
+ break
+ fi
+done
fi
-rm -f conftest*
-fi # $ac_x_includes = NO
+rm -f conftest.err conftest.$ac_ext
+fi # $ac_x_includes = no
-if test "$ac_x_libraries" = NO; then
+if test "$ac_x_libraries" = no; then
# Check for the libraries.
-
- test -z "$x_direct_test_library" && x_direct_test_library=Xt
- test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
-
# See if we find them without any special options.
# Don't add to $LIBS permanently.
- ac_save_LIBS="$LIBS"
- LIBS="-l$x_direct_test_library $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5326 "configure"
-#include "confdefs.h"
-
-int main() {
-${x_direct_test_function}()
-; return 0; }
-EOF
-if { (eval echo configure:5333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- LIBS="$ac_save_LIBS"
+ ac_save_LIBS=$LIBS
+ LIBS="-lXt $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <X11/Intrinsic.h>
+int
+main ()
+{
+XtMalloc (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
+ LIBS=$ac_save_LIBS
# We can link X programs with no special library path.
ac_x_libraries=
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- LIBS="$ac_save_LIBS"
-# First see if replacing the include by lib works.
-# Check X11 before X11Rn because it is often a symlink to the current release.
-for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
- /usr/X11/lib \
- /usr/X11R6/lib \
- /usr/X11R5/lib \
- /usr/X11R4/lib \
- \
- /usr/lib/X11 \
- /usr/lib/X11R6 \
- /usr/lib/X11R5 \
- /usr/lib/X11R4 \
- \
- /usr/local/X11/lib \
- /usr/local/X11R6/lib \
- /usr/local/X11R5/lib \
- /usr/local/X11R4/lib \
- \
- /usr/local/lib/X11 \
- /usr/local/lib/X11R6 \
- /usr/local/lib/X11R5 \
- /usr/local/lib/X11R4 \
- \
- /usr/X386/lib \
- /usr/x386/lib \
- /usr/XFree86/lib/X11 \
- \
- /usr/lib \
- /usr/local/lib \
- /usr/unsupported/lib \
- /usr/athena/lib \
- /usr/local/x11r5/lib \
- /usr/lpp/Xamples/lib \
- /lib/usr/lib/X11 \
- \
- /usr/openwin/lib \
- /usr/openwin/share/lib \
- ; \
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+LIBS=$ac_save_LIBS
+for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
do
+ # Don't even attempt the hair of trying to link an X program!
for ac_extension in a so sl; do
- if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
+ if test -r $ac_dir/libXt.$ac_extension; then
ac_x_libraries=$ac_dir
break 2
fi
done
done
fi
-rm -f conftest*
-fi # $ac_x_libraries = NO
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi # $ac_x_libraries = no
-if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
+if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then
# Didn't find X anywhere. Cache the known absence of X.
ac_cv_have_x="have_x=no"
else
# Record where we found X for the cache.
ac_cv_have_x="have_x=yes \
- ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
+ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
fi
fi
+
fi
eval "$ac_cv_have_x"
fi # $with_x != no
if test "$have_x" != yes; then
- echo "$ac_t""$have_x" 1>&6
+ echo "$as_me:$LINENO: result: $have_x" >&5
+echo "${ECHO_T}$have_x" >&6
no_x=yes
else
# If each of the values was on the command line, it overrides each guess.
@@ -5412,30 +9928,47 @@ else
# Update the cache value to reflect the command line values.
ac_cv_have_x="have_x=yes \
ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
- echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6
+ echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5
+echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6
fi
not_really_there=""
if test "$no_x" = ""; then
if test "$x_includes" = ""; then
- cat > conftest.$ac_ext <<EOF
-#line 5423 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <X11/XIntrinsic.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5428: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+_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 "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
not_really_there="yes"
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_ext
else
if test ! -r $x_includes/X11/Intrinsic.h; then
not_really_there="yes"
@@ -5443,33 +9976,49 @@ rm -f conftest*
fi
fi
if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
- echo $ac_n "checking for X11 header files""... $ac_c" 1>&6
-echo "configure:5448: checking for X11 header files" >&5
+ echo "$as_me:$LINENO: checking for X11 header files" >&5
+echo $ECHO_N "checking for X11 header files... $ECHO_C" >&6
found_xincludes="no"
- cat > conftest.$ac_ext <<EOF
-#line 5451 "configure"
-#include "confdefs.h"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <X11/Intrinsic.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5456: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
+_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
found_xincludes="yes"
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
found_xincludes="no"
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_ext
if test "$found_xincludes" = "no"; then
dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
for i in $dirs ; do
if test -r $i/X11/Intrinsic.h; then
- echo "$ac_t""$i" 1>&6
+ echo "$as_me:$LINENO: result: $i" >&5
+echo "${ECHO_T}$i" >&6
XINCLUDES=" -I$i"
found_xincludes="yes"
break
@@ -5483,17 +10032,19 @@ rm -f conftest*
fi
fi
if test "$found_xincludes" = "no"; then
- echo "$ac_t""couldn't find any!" 1>&6
+ echo "$as_me:$LINENO: result: couldn't find any!" >&5
+echo "${ECHO_T}couldn't find any!" >&6
fi
if test "$no_x" = yes; then
- echo $ac_n "checking for X11 libraries""... $ac_c" 1>&6
-echo "configure:5492: checking for X11 libraries" >&5
+ echo "$as_me:$LINENO: checking for X11 libraries" >&5
+echo $ECHO_N "checking for X11 libraries... $ECHO_C" >&6
XLIBSW=nope
dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
for i in $dirs ; do
if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl -o -r $i/libX11.dylib; then
- echo "$ac_t""$i" 1>&6
+ echo "$as_me:$LINENO: result: $i" >&5
+echo "${ECHO_T}$i" >&6
XLIBSW="-L$i -lX11"
x_libraries="$i"
break
@@ -5507,49 +10058,78 @@ echo "configure:5492: checking for X11 libraries" >&5
fi
fi
if test "$XLIBSW" = nope ; then
- echo $ac_n "checking for XCreateWindow in -lXwindow""... $ac_c" 1>&6
-echo "configure:5512: checking for XCreateWindow in -lXwindow" >&5
-ac_lib_var=`echo Xwindow'_'XCreateWindow | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for XCreateWindow in -lXwindow" >&5
+echo $ECHO_N "checking for XCreateWindow in -lXwindow... $ECHO_C" >&6
+if test "${ac_cv_lib_Xwindow_XCreateWindow+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lXwindow $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5520 "configure"
-#include "confdefs.h"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char XCreateWindow();
-
-int main() {
-XCreateWindow()
-; return 0; }
-EOF
-if { (eval echo configure:5531: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+ builtin and then its argument prototype would still apply. */
+char XCreateWindow ();
+int
+main ()
+{
+XCreateWindow ();
+ ;
+ 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
+ ac_cv_lib_Xwindow_XCreateWindow=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_Xwindow_XCreateWindow=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xwindow_XCreateWindow" >&5
+echo "${ECHO_T}$ac_cv_lib_Xwindow_XCreateWindow" >&6
+if test $ac_cv_lib_Xwindow_XCreateWindow = yes; then
XLIBSW=-lXwindow
-else
- echo "$ac_t""no" 1>&6
fi
fi
if test "$XLIBSW" = nope ; then
- echo "$ac_t""could not find any! Using -lX11." 1>&6
+ echo "$as_me:$LINENO: result: could not find any! Using -lX11." >&5
+echo "${ECHO_T}could not find any! Using -lX11." >&6
XLIBSW=-lX11
fi
@@ -5571,19 +10151,14 @@ fi
#--------------------------------------------------------------------
if test "x${x_libraries}" != "x"; then
+ if test "x${x_libraries}" != "xNONE"; then
LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${x_libraries}"
+ fi
fi
if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then
LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'`
fi
-# The statement below is very tricky! It actually *evaluates* the
-# string in TCL_CC_SEARCH_FLAGS and TCL_LD_SEARCH_FLAGS which
-# causes a substitution of the variable LIB_RUNTIME_DIR.
-
-eval "CC_SEARCH_FLAGS=\"$TCL_CC_SEARCH_FLAGS\""
-eval "LD_SEARCH_FLAGS=\"$TCL_LD_SEARCH_FLAGS\""
-
#--------------------------------------------------------------------
# Check for the existence of various libraries. The order here
# is important, so that then end up in the right order in the
@@ -5603,317 +10178,697 @@ eval "LD_SEARCH_FLAGS=\"$TCL_LD_SEARCH_FLAGS\""
#--------------------------------------------------------------------
if test $tk_aqua = no; then
- echo $ac_n "checking for main in -lXbsd""... $ac_c" 1>&6
-echo "configure:5608: checking for main in -lXbsd" >&5
-ac_lib_var=`echo Xbsd'_'main | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:$LINENO: checking for main in -lXbsd" >&5
+echo $ECHO_N "checking for main in -lXbsd... $ECHO_C" >&6
+if test "${ac_cv_lib_Xbsd_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lXbsd $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5616 "configure"
-#include "confdefs.h"
-
-int main() {
-main()
-; return 0; }
-EOF
-if { (eval echo configure:5623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+main ();
+ ;
+ 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
+ ac_cv_lib_Xbsd_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_Xbsd_main=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xbsd_main" >&5
+echo "${ECHO_T}$ac_cv_lib_Xbsd_main" >&6
+if test $ac_cv_lib_Xbsd_main = yes; then
LIBS="$LIBS -lXbsd"
-else
- echo "$ac_t""no" 1>&6
fi
fi
-tk_checkBoth=0
-echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:5647: checking for connect" >&5
-if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5652 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char connect(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char connect();
+#--------------------------------------------------------------------
+# One more check related to the X libraries. The standard releases
+# of Ultrix don't support the "xauth" mechanism, so send won't work
+# unless TK_NO_SECURITY is defined. However, there are usually copies
+# of the MIT X server available as well, which do support xauth.
+# Check for the MIT stuff and use it if it exists.
+#
+# Note: can't use ac_check_lib macro (at least, not in Autoconf 2.1)
+# because it can't deal with the "-" in the library name.
+#--------------------------------------------------------------------
-int main() {
+if test -d /usr/include/mit -a $tk_aqua = no; then
+ echo "$as_me:$LINENO: checking MIT X libraries" >&5
+echo $ECHO_N "checking MIT X libraries... $ECHO_C" >&6
+ tk_oldCFlags=$CFLAGS
+ CFLAGS="$CFLAGS -I/usr/include/mit"
+ tk_oldLibs=$LIBS
+ LIBS="$LIBS -lX11-mit"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_connect) || defined (__stub___connect)
-choke me
-#else
-connect();
-#endif
+ #include <X11/Xlib.h>
-; return 0; }
-EOF
-if { (eval echo configure:5675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_connect=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_connect=no"
-fi
-rm -f conftest*
-fi
+int
+main ()
+{
-if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- tk_checkSocket=0
-else
- echo "$ac_t""no" 1>&6
-tk_checkSocket=1
-fi
+ XOpenDisplay(0);
-if test "$tk_checkSocket" = 1; then
- echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:5697: checking for main in -lsocket" >&5
-ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lsocket $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5705 "configure"
-#include "confdefs.h"
+ ;
+ 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
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ XLIBSW="-lX11-mit"
+ XINCLUDES="-I/usr/include/mit"
-int main() {
-main()
-; return 0; }
-EOF
-if { (eval echo configure:5712: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- LIBS="$LIBS -lsocket"
-else
- echo "$ac_t""no" 1>&6
-tk_checkBoth=1
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS=$tk_oldCFlags
+ LIBS=$tk_oldLibs
fi
-fi
-if test "$tk_checkBoth" = 1; then
+#--------------------------------------------------------------------
+# Check whether the header and library for the XScreenSaver
+# extension are available, and set HAVE_XSS if so.
+# XScreenSaver is needed for Tk_GetUserInactiveTime().
+#--------------------------------------------------------------------
+
+if test $tk_aqua = no; then
+ tk_oldCFlags=$CFLAGS
+ CFLAGS="$CFLAGS $XINCLUDES"
tk_oldLibs=$LIBS
- LIBS="$LIBS -lsocket -lnsl"
- echo $ac_n "checking for accept""... $ac_c" 1>&6
-echo "configure:5738: checking for accept" >&5
-if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5743 "configure"
-#include "confdefs.h"
+ LIBS="$tk_oldLibs $XLIBSW"
+ xss_header_found=no
+ xss_lib_found=no
+ echo "$as_me:$LINENO: checking whether to try to use XScreenSaver" >&5
+echo $ECHO_N "checking whether to try to use XScreenSaver... $ECHO_C" >&6
+ # Check whether --enable-xss or --disable-xss was given.
+if test "${enable_xss+set}" = set; then
+ enableval="$enable_xss"
+ enable_xss=$enableval
+else
+ enable_xss=yes
+fi;
+ if test "$enable_xss" = "no" ; then
+ echo "$as_me:$LINENO: result: $enable_xss" >&5
+echo "${ECHO_T}$enable_xss" >&6
+ else
+ echo "$as_me:$LINENO: result: $enable_xss" >&5
+echo "${ECHO_T}$enable_xss" >&6
+ echo "$as_me:$LINENO: checking for X11/extensions/scrnsaver.h" >&5
+echo $ECHO_N "checking for X11/extensions/scrnsaver.h... $ECHO_C" >&6
+if test "${ac_cv_header_X11_extensions_scrnsaver_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 <X11/Xlib.h>
+
+#include <X11/extensions/scrnsaver.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_X11_extensions_scrnsaver_h=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_X11_extensions_scrnsaver_h=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_scrnsaver_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_extensions_scrnsaver_h" >&6
+if test $ac_cv_header_X11_extensions_scrnsaver_h = yes; then
+
+ xss_header_found=yes
+
+fi
+
+
+ echo "$as_me:$LINENO: checking for XScreenSaverQueryInfo" >&5
+echo $ECHO_N "checking for XScreenSaverQueryInfo... $ECHO_C" >&6
+if test "${ac_cv_func_XScreenSaverQueryInfo+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 XScreenSaverQueryInfo to an innocuous variant, in case <limits.h> declares XScreenSaverQueryInfo.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define XScreenSaverQueryInfo innocuous_XScreenSaverQueryInfo
+
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char accept(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char accept();
+ which can conflict with char XScreenSaverQueryInfo (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
-int main() {
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef XScreenSaverQueryInfo
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char XScreenSaverQueryInfo ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
-#if defined (__stub_accept) || defined (__stub___accept)
+#if defined (__stub_XScreenSaverQueryInfo) || defined (__stub___XScreenSaverQueryInfo)
choke me
#else
-accept();
+char (*f) () = XScreenSaverQueryInfo;
+#endif
+#ifdef __cplusplus
+}
#endif
-; return 0; }
-EOF
-if { (eval echo configure:5766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_accept=yes"
+int
+main ()
+{
+return f != XScreenSaverQueryInfo;
+ ;
+ 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
+ ac_cv_func_XScreenSaverQueryInfo=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_XScreenSaverQueryInfo=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_XScreenSaverQueryInfo" >&5
+echo "${ECHO_T}$ac_cv_func_XScreenSaverQueryInfo" >&6
+if test $ac_cv_func_XScreenSaverQueryInfo = yes; then
+ :
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_accept=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_func_'accept`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- tk_checkNsl=0
+ echo "$as_me:$LINENO: checking for XScreenSaverQueryInfo in -lXext" >&5
+echo $ECHO_N "checking for XScreenSaverQueryInfo in -lXext... $ECHO_C" >&6
+if test "${ac_cv_lib_Xext_XScreenSaverQueryInfo+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- echo "$ac_t""no" 1>&6
-LIBS=$tk_oldLibs
-fi
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXext $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-fi
-echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:5788: checking for gethostbyname" >&5
-if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 5793 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char gethostbyname(); below. */
-#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char gethostbyname();
-
-int main() {
+ builtin and then its argument prototype would still apply. */
+char XScreenSaverQueryInfo ();
+int
+main ()
+{
+XScreenSaverQueryInfo ();
+ ;
+ 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
+ ac_cv_lib_Xext_XScreenSaverQueryInfo=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_Xext_XScreenSaverQueryInfo=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XScreenSaverQueryInfo" >&5
+echo "${ECHO_T}$ac_cv_lib_Xext_XScreenSaverQueryInfo" >&6
+if test $ac_cv_lib_Xext_XScreenSaverQueryInfo = yes; then
+
+ XLIBSW="$XLIBSW -lXext"
+ xss_lib_found=yes
+
+else
+
+ echo "$as_me:$LINENO: checking for XScreenSaverQueryInfo in -lXss" >&5
+echo $ECHO_N "checking for XScreenSaverQueryInfo in -lXss... $ECHO_C" >&6
+if test "${ac_cv_lib_Xss_XScreenSaverQueryInfo+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXss -lXext $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
-choke me
-#else
-gethostbyname();
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char XScreenSaverQueryInfo ();
+int
+main ()
+{
+XScreenSaverQueryInfo ();
+ ;
+ 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
+ ac_cv_lib_Xss_XScreenSaverQueryInfo=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_Xss_XScreenSaverQueryInfo=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xss_XScreenSaverQueryInfo" >&5
+echo "${ECHO_T}$ac_cv_lib_Xss_XScreenSaverQueryInfo" >&6
+if test $ac_cv_lib_Xss_XScreenSaverQueryInfo = yes; then
+
+ if test "$tcl_cv_ld_weak_l" = yes; then
+ # On Darwin, weak link libXss if possible,
+ # as it is only available on Tiger or later.
+ XLIBSW="$XLIBSW -Wl,-weak-lXss -lXext"
+ else
+ XLIBSW="$XLIBSW -lXss -lXext"
+ fi
+ xss_lib_found=yes
-; return 0; }
-EOF
-if { (eval echo configure:5816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_gethostbyname=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_gethostbyname=no"
-fi
-rm -f conftest*
fi
-if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- :
-else
- echo "$ac_t""no" 1>&6
-echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:5834: checking for main in -lnsl" >&5
-ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lnsl $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5842 "configure"
-#include "confdefs.h"
-
-int main() {
-main()
-; return 0; }
-EOF
-if { (eval echo configure:5849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- LIBS="$LIBS -lnsl"
-else
- echo "$ac_t""no" 1>&6
-fi
+
fi
+ fi
+ if test $enable_xss = yes -a $xss_lib_found = yes -a $xss_header_found = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_XSS 1
+_ACEOF
+
+ fi
+ CFLAGS=$tk_oldCFlags
+ LIBS=$tk_oldLibs
+fi
#--------------------------------------------------------------------
-# One more check related to the X libraries. The standard releases
-# of Ultrix don't support the "xauth" mechanism, so send won't work
-# unless TK_NO_SECURITY is defined. However, there are usually copies
-# of the MIT X server available as well, which do support xauth.
-# Check for the MIT stuff and use it if it exists.
-#
-# Note: can't use ac_check_lib macro (at least, not in Autoconf 2.1)
-# because it can't deal with the "-" in the library name.
+# Check for freetype / fontconfig / Xft support.
#--------------------------------------------------------------------
-if test -d /usr/include/mit -a $tk_aqua = no; then
- echo $ac_n "checking MIT X libraries""... $ac_c" 1>&6
-echo "configure:5885: checking MIT X libraries" >&5
- tk_oldCFlags=$CFLAGS
- CFLAGS="$CFLAGS -I/usr/include/mit"
- tk_oldLibs=$LIBS
- LIBS="$LIBS -lX11-mit"
- cat > conftest.$ac_ext <<EOF
-#line 5891 "configure"
-#include "confdefs.h"
-
- #include <X11/Xlib.h>
-
-int main() {
+if test $tk_aqua = no; then
+ echo "$as_me:$LINENO: checking whether to use xft" >&5
+echo $ECHO_N "checking whether to use xft... $ECHO_C" >&6
+ # Check whether --enable-xft or --disable-xft was given.
+if test "${enable_xft+set}" = set; then
+ enableval="$enable_xft"
+ enable_xft=$enableval
+else
+ enable_xft="default"
+fi;
+ XFT_CFLAGS=""
+ XFT_LIBS=""
+ if test "$enable_xft" = "no" ; then
+ echo "$as_me:$LINENO: result: $enable_xft" >&5
+echo "${ECHO_T}$enable_xft" >&6
+ else
+ found_xft="yes"
+ XFT_CFLAGS=`xft-config --cflags 2>/dev/null` || found_xft="no"
+ XFT_LIBS=`xft-config --libs 2>/dev/null` || found_xft="no"
+ if test "$found_xft" = "no" ; then
+ found_xft=yes
+ XFT_CFLAGS=`pkg-config --cflags xft 2>/dev/null` || found_xft="no"
+ XFT_LIBS=`pkg-config --libs xft 2>/dev/null` || found_xft="no"
+ fi
+ echo "$as_me:$LINENO: result: $found_xft" >&5
+echo "${ECHO_T}$found_xft" >&6
+ if test "$found_xft" = "yes" ; then
+ tk_oldCFlags=$CFLAGS
+ CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS"
+ tk_oldLibs=$LIBS
+ LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW"
+ echo "$as_me:$LINENO: checking for X11/Xft/Xft.h" >&5
+echo $ECHO_N "checking for X11/Xft/Xft.h... $ECHO_C" >&6
+if test "${ac_cv_header_X11_Xft_Xft_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 <X11/Xlib.h>
- XOpenDisplay(0);
-
-; return 0; }
-EOF
-if { (eval echo configure:5902: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
-
- echo "$ac_t""yes" 1>&6
- XLIBSW="-lX11-mit"
- XINCLUDES="-I/usr/include/mit"
-
+#include <X11/Xft/Xft.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_X11_Xft_Xft_h=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_X11_Xft_Xft_h=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xft_Xft_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_Xft_Xft_h" >&6
+if test $ac_cv_header_X11_Xft_Xft_h = yes; then
+ :
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- echo "$ac_t""no" 1>&6
+
+ found_xft=no
+
fi
-rm -f conftest*
- CFLAGS=$tk_oldCFlags
- LIBS=$tk_oldLibs
+
+
+ CFLAGS=$tk_oldCFlags
+ LIBS=$tk_oldLibs
+ fi
+ if test "$found_xft" = "yes" ; then
+ tk_oldCFlags=$CFLAGS
+ CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS"
+ tk_oldLibs=$LIBS
+ LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW"
+
+echo "$as_me:$LINENO: checking for XftFontOpen in -lXft" >&5
+echo $ECHO_N "checking for XftFontOpen in -lXft... $ECHO_C" >&6
+if test "${ac_cv_lib_Xft_XftFontOpen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXft $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char XftFontOpen ();
+int
+main ()
+{
+XftFontOpen ();
+ ;
+ 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
+ ac_cv_lib_Xft_XftFontOpen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_Xft_XftFontOpen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xft_XftFontOpen" >&5
+echo "${ECHO_T}$ac_cv_lib_Xft_XftFontOpen" >&6
+if test $ac_cv_lib_Xft_XftFontOpen = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBXFT 1
+_ACEOF
+
+ LIBS="-lXft $LIBS"
+
+else
+
+ found_xft=no
+
+fi
+
+ CFLAGS=$tk_oldCFlags
+ LIBS=$tk_oldLibs
+ fi
+ if test "$found_xft" = "no" ; then
+ if test "$enable_xft" = "yes" ; then
+ { echo "$as_me:$LINENO: WARNING: Can't find xft configuration, or xft is unusable" >&5
+echo "$as_me: WARNING: Can't find xft configuration, or xft is unusable" >&2;}
+ fi
+ enable_xft=no
+ XFT_CFLAGS=""
+ XFT_LIBS=""
+ else
+ enable_xft=yes
+ fi
+ fi
+ if test $enable_xft = "yes" ; then
+ UNIX_FONT_OBJS=tkUnixRFont.o
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_XFT 1
+_ACEOF
+
+ else
+ UNIX_FONT_OBJS=tkUnixFont.o
+ fi
+
+
+
fi
#--------------------------------------------------------------------
@@ -5921,66 +10876,66 @@ fi
# #define for __CHAR_UNSIGNED__.
#--------------------------------------------------------------------
-echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6
-echo "configure:5926: checking whether char is unsigned" >&5
-if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$GCC" = yes; then
- # GCC predefines this symbol on systems where it applies.
-cat > conftest.$ac_ext <<EOF
-#line 5933 "configure"
-#include "confdefs.h"
-#ifdef __CHAR_UNSIGNED__
- yes
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "yes" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_c_char_unsigned=yes
-else
- rm -rf conftest*
- ac_cv_c_char_unsigned=no
-fi
-rm -f conftest*
-
-else
-if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
-else
- cat > conftest.$ac_ext <<EOF
-#line 5955 "configure"
-#include "confdefs.h"
-/* volatile prevents gcc2 from optimizing the test away on sparcs. */
-#if !defined(__STDC__) || __STDC__ != 1
-#define volatile
-#endif
-main() {
- volatile char c = 255; exit(c < 0);
+echo "$as_me:$LINENO: checking whether char is unsigned" >&5
+echo $ECHO_N "checking whether char is unsigned... $ECHO_C" >&6
+if test "${ac_cv_c_char_unsigned+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 ()
+{
+static int test_array [1 - 2 * !(((char) -1) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
}
-EOF
-if { (eval echo configure:5965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- ac_cv_c_char_unsigned=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
+_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_char_unsigned=no
-fi
-rm -fr conftest*
-fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ac_cv_c_char_unsigned=yes
fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
-echo "$ac_t""$ac_cv_c_char_unsigned" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_c_char_unsigned" >&5
+echo "${ECHO_T}$ac_cv_c_char_unsigned" >&6
if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
- cat >> confdefs.h <<\EOF
+ cat >>confdefs.h <<\_ACEOF
#define __CHAR_UNSIGNED__ 1
-EOF
+_ACEOF
fi
@@ -5995,10 +10950,8 @@ eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}"
eval "TK_LIB_FILE=libtk${LIB_SUFFIX}"
# tkConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed
-# so that the backslashes quoting the DBX braces are dropped.
+# since on some platforms TK_LIB_FILE contains shell escapes.
-# Trick to replace DBGX with TK_DBGX
-DBGX='${TK_DBGX}'
eval "TK_LIB_FILE=${TK_LIB_FILE}"
if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then
@@ -6009,7 +10962,7 @@ fi
TK_LIBRARY='$(prefix)/lib/tk$(VERSION)'
PRIVATE_INCLUDE_DIR='$(includedir)'
HTML_DIR='$(DISTDIR)/html'
-TK_PKG_DIR='tk$(VERSION)$(TK_DBGX)'
+TK_PKG_DIR='tk$(VERSION)'
TK_RSRC_FILE='tk$(VERSION).rsrc'
WISH_RSRC_FILE='wish$(VERSION).rsrc'
@@ -6019,60 +10972,70 @@ WISH_RSRC_FILE='wish$(VERSION).rsrc'
# up the Tcl library.
if test "`uname -s`" = "Darwin" ; then
-
+
if test "`uname -s`" = "Darwin" ; then
- echo $ac_n "checking how to package libraries""... $ac_c" 1>&6
-echo "configure:6026: checking how to package libraries" >&5
+ echo "$as_me:$LINENO: checking how to package libraries" >&5
+echo $ECHO_N "checking how to package libraries... $ECHO_C" >&6
# Check whether --enable-framework or --disable-framework was given.
if test "${enable_framework+set}" = set; then
enableval="$enable_framework"
enable_framework=$enableval
else
enable_framework=no
-fi
-
+fi;
if test $enable_framework = yes; then
if test $SHARED_BUILD = 0; then
- echo "configure: warning: Frameworks can only be built if --enable-shared is yes" 1>&2
+ { echo "$as_me:$LINENO: WARNING: Frameworks can only be built if --enable-shared is yes" >&5
+echo "$as_me: WARNING: Frameworks can only be built if --enable-shared is yes" >&2;}
enable_framework=no
fi
if test $tcl_corefoundation = no; then
- echo "configure: warning: Frameworks can only be used when CoreFoundation is available" 1>&2
+ { echo "$as_me:$LINENO: WARNING: Frameworks can only be used when CoreFoundation is available" >&5
+echo "$as_me: WARNING: Frameworks can only be used when CoreFoundation is available" >&2;}
enable_framework=no
fi
fi
if test $enable_framework = yes; then
- echo "$ac_t""framework" 1>&6
+ echo "$as_me:$LINENO: result: framework" >&5
+echo "${ECHO_T}framework" >&6
FRAMEWORK_BUILD=1
else
if test $SHARED_BUILD = 1; then
- echo "$ac_t""shared library" 1>&6
+ echo "$as_me:$LINENO: result: shared library" >&5
+echo "${ECHO_T}shared library" >&6
else
- echo "$ac_t""static library" 1>&6
+ echo "$as_me:$LINENO: result: static library" >&5
+echo "${ECHO_T}static library" >&6
fi
FRAMEWORK_BUILD=0
fi
fi
TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version ${TK_VERSION}`echo ${TK_PATCH_LEVEL} | awk '{match($0, "\\\.[0-9]+"); print substr($0,RSTART,RLENGTH)}'`"
- TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name ${DYLIB_INSTALL_DIR}/${TK_LIB_FILE} -unexported_symbols_list $$(f=$(TCL_STUB_LIB_FILE).E && nm -gjp $(TCL_BIN_DIR)/$(TCL_STUB_LIB_FILE) | grep ^_[^_] > $$f && echo $$f)'
+ TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name "${DYLIB_INSTALL_DIR}"/${TK_LIB_FILE}'
+ if test $tk_aqua = yes; then
+ TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -unexported_symbols_list $$(f=$(TK_LIB_FILE).E && nm -gp tkMacOSX*.o 2>/dev/null | awk "/^[0-9a-f]+ . \.objc/ {print \$$3}" > $$f && echo $$f)'
+ fi
echo "$LDFLAGS " | grep -q -- '-prebind ' && TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -seg1addr 0xb000000'
TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -sectcreate __TEXT __info_plist Tk-Info.plist'
EXTRA_WISH_LIBS='-sectcreate __TEXT __info_plist Wish-Info.plist'
- EXTRA_APP_CC_SWITCHES='-mdynamic-no-pic'
- tk_config_files="${tk_config_files} Tk-Info.plist:../macosx/Tk-Info.plist.in Wish-Info.plist:../macosx/Wish-Info.plist.in"
+ EXTRA_APP_CC_SWITCHES="${EXTRA_APP_CC_SWITCHES}"' -mdynamic-no-pic'
+ ac_config_files="$ac_config_files Tk-Info.plist:../${MACOSX_SRC_DIR}/Tk-Info.plist.in Wish-Info.plist:../${MACOSX_SRC_DIR}/Wish-Info.plist.in"
+
for l in ${LOCALES}; do CFBUNDLELOCALIZATIONS="${CFBUNDLELOCALIZATIONS}<string>$l</string>"; done
TK_YEAR="`date +%Y`"
fi
if test "$FRAMEWORK_BUILD" = "1" ; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
#define TK_FRAMEWORK 1
-EOF
+_ACEOF
# Construct a fake local framework structure to make linking with
# '-framework Tk' and running of tktest work
-
+ ac_config_commands="$ac_config_commands Tk.framework"
+
LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH"
if test "${libdir}" = '${exec_prefix}/lib'; then
# override libdir default
@@ -6080,7 +11043,7 @@ EOF
fi
TK_LIB_FILE="Tk"
TK_LIB_FLAG="-framework Tk"
- TK_BUILD_LIB_SPEC="-F`pwd` -framework Tk"
+ TK_BUILD_LIB_SPEC="-F`pwd | sed -e 's/ /\\\\ /g'` -framework Tk"
TK_LIB_SPEC="-F${libdir} -framework Tk"
libdir="${libdir}/Tk.framework/Versions/\${VERSION}"
TK_LIBRARY="${libdir}/Resources/Scripts"
@@ -6091,58 +11054,59 @@ EOF
PRIVATE_INCLUDE_DIR="${libdir}/PrivateHeaders"
HTML_DIR="${libdir}/Resources/Documentation/Reference/Tk"
EXTRA_INSTALL="install-private-headers html-tk"
- EXTRA_BUILD_HTML='@ln -fs contents.htm $(HTML_INSTALL_DIR)/TkTOC.html'
+ EXTRA_BUILD_HTML='@ln -fs contents.htm "$(HTML_INSTALL_DIR)"/TkTOC.html'
EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tk-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"'
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing license.terms to $(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "$(TOP_DIR)/license.terms" "$(LIB_INSTALL_DIR)/Resources"'
- if test $tk_aqua = yes; then
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing ${TK_RSRC_FILE} to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "${TK_RSRC_FILE}" "$(LIB_INSTALL_DIR)/Resources"'
+ if test $tk_aqua != no; then
+ if test $tk_aqua = yes; then
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Images to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)/Resources"; done'
+ else
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing ${TK_RSRC_FILE} to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "${TK_RSRC_FILE}" "$(LIB_INSTALL_DIR)/Resources"'
+ fi
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing wish$(VERSION) script to $(INSTALL_ROOT)/'"${bindir}"'" && mkdir -p "$(INSTALL_ROOT)/'"${bindir}"'" && printf > "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)" "#!/bin/sh\n\"\$$(dirname \$$0)'"`eval d="${bindir}"; echo "$d" | sed -e 's#/[^/][^/]*#/..#g'`"'$(bindir)/Wish\" \"\$$@\"" && chmod +x "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)"'
bindir="${libdir}/Resources/Wish.app/Contents/MacOS"
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Info.plist to $(BIN_INSTALL_DIR)/.." && $(INSTALL_DATA) Wish-Info.plist "$(BIN_INSTALL_DIR)/../Info.plist" && mv -f "$(BIN_INSTALL_DIR)/wish$(VERSION)" "$(BIN_INSTALL_DIR)/Wish"'
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && mkdir -p "$(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "'\$\(MAC\_OSX_DIR\)'/Wish.icns" "$(BIN_INSTALL_DIR)/../Resources"'
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing ${WISH_RSRC_FILE} to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "${WISH_RSRC_FILE}" "$(BIN_INSTALL_DIR)/../Resources"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && mkdir -p "$(BIN_INSTALL_DIR)/../Resources"'
+ if test $tk_aqua = yes; then
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Tk.icns" "$(BIN_INSTALL_DIR)/../Resources/Wish.icns"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.sdef to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.sdef" "$(BIN_INSTALL_DIR)/../Resources"'
+ else
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.icns" "$(BIN_INSTALL_DIR)/../Resources" && echo "Installing ${WISH_RSRC_FILE} to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "${WISH_RSRC_FILE}" "$(BIN_INSTALL_DIR)/../Resources"'
+ fi
fi
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."'
- # Don't use AC_DEFINE for the following as the framework version define
- # needs to go into the Makefile even when using autoheader, so that we
+ # Don't use AC_DEFINE for the following as the framework version define
+ # needs to go into the Makefile even when using autoheader, so that we
# can pick up a potential make override of VERSION. Also, don't put this
# into CFLAGS as it should not go into tkConfig.sh
- EXTRA_CC_SWITCHES='-DTK_FRAMEWORK_VERSION=\"$(VERSION)\"'
+ EXTRA_CC_SWITCHES="$EXTRA_CC_SWITCHES"' -DTK_FRAMEWORK_VERSION=\"$(VERSION)\"'
else
+ if test $tk_aqua = yes; then
+ EXTRA_INSTALL_BINARIES='@echo "Installing Images to $(LIB_INSTALL_DIR)" && mkdir -p "$(LIB_INSTALL_DIR)" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)"; done'
+ fi
# libdir must be a fully qualified path and not ${exec_prefix}/lib
eval libdir="$libdir"
- if test "$SHARED_BUILD" = "0" || test "$TCL_NEEDS_EXP_FILE" = "0"; then
- if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
- eval TK_LIB_FLAG="-ltk${VERSION}\${TK_DBGX}"
- else
- eval TK_LIB_FLAG="-ltk`echo ${VERSION} | tr -d .`\${TK_DBGX}"
- fi
- TK_BUILD_LIB_SPEC="-L`pwd` ${TK_LIB_FLAG}"
- TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}"
+ if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
+ TK_LIB_FLAG="-ltk${TK_VERSION}"
else
- TK_BUILD_EXP_FILE="lib.exp"
- eval "TK_EXP_FILE=libtk${TCL_EXPORT_FILE_SUFFIX}"
-
- if test "$GCC" = "yes" ; then
- TK_BUILD_LIB_SPEC="-Wl,-bI:`pwd`/${TK_BUILD_EXP_FILE} -L`pwd`"
- TK_LIB_SPEC="-Wl,-bI:${libdir}/${TK_EXP_FILE} -L`pwd`"
- else
- TK_BUILD_LIB_SPEC="-bI:`pwd`/${TK_BUILD_EXP_FILE}"
- TK_LIB_SPEC="-bI:${libdir}/${TK_EXP_FILE}"
- fi
+ TK_LIB_FLAG="-ltk`echo ${TK_VERSION} | tr -d .`"
fi
+ TK_BUILD_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_LIB_FLAG}"
+ TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}"
fi
-# Support for building the Aqua resource files
-if test $tk_aqua = yes; then
+# Extra bits for legacy Aqua Carbon build (carbon sources and resource files)
+if test $tk_aqua = carbon; then
+ EXTRA_AQUA_OBJS='tkMacOSXCarbonEvents.o'
+ EXTRA_AQUA_SRCS='$(TOP_DIR)/carbon/tkMacOSXCarbonEvents.c'
LIB_RSRC_FILE='${TK_RSRC_FILE}'
APP_RSRC_FILE='${WISH_RSRC_FILE}'
REZ=/Developer/Tools/Rez
REZ_FLAGS='-d "SystemSevenOrLater=1" -useDF -ro'
if test "$SHARED_BUILD" = 0; then
- EXTRA_INSTALL_BINARIES='@echo "Installing $(TK_RSRC_FILE) to $(LIB_INSTALL_DIR)" && $(INSTALL_DATA) $(TK_RSRC_FILE) $(LIB_INSTALL_DIR)'
- TK_BUILD_LIB_SPEC="$TK_BUILD_LIB_SPEC -sectcreate __TEXT __tk_rsrc `pwd`/\${TK_RSRC_FILE}"
- TK_LIB_SPEC="$TK_LIB_SPEC -sectcreate __TEXT __tk_rsrc ${libdir}/\${TK_RSRC_FILE}"
+ EXTRA_INSTALL_BINARIES='@echo "Installing $(TK_RSRC_FILE) to $(LIB_INSTALL_DIR)" && $(INSTALL_DATA) $(TK_RSRC_FILE) "$(LIB_INSTALL_DIR)"'
+ TK_BUILD_LIB_SPEC="$TK_BUILD_LIB_SPEC -sectcreate __TEXT __tk_rsrc `pwd | sed -e 's/ /\\\\ /g'`/\${TK_RSRC_FILE}"
+ TK_LIB_SPEC="$TK_LIB_SPEC -sectcreate __TEXT __tk_rsrc ${libdir}/\${TK_RSRC_FILE}"
else
TK_SHLIB_LD_EXTRAS="$TK_SHLIB_LD_EXTRAS -sectcreate __TEXT __tk_rsrc \${TK_RSRC_FILE}"
fi
@@ -6158,12 +11122,12 @@ eval "TK_STUB_LIB_FILE=libtkstub${TK_UNSHARED_LIB_SUFFIX}"
eval "TK_STUB_LIB_DIR=${libdir}"
if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
- eval TK_STUB_LIB_FLAG="-ltkstub${TK_VERSION}\${TK_DBGX}"
+ TK_STUB_LIB_FLAG="-ltkstub${TK_VERSION}"
else
- eval TK_STUB_LIB_FLAG="-ltkstub`echo ${TK_VERSION} | tr -d .`\${TK_DBGX}"
+ TK_STUB_LIB_FLAG="-ltkstub`echo ${TK_VERSION} | tr -d .`"
fi
-TK_BUILD_STUB_LIB_SPEC="-L`pwd` ${TK_STUB_LIB_FLAG}"
+TK_BUILD_STUB_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}"
TK_STUB_LIB_SPEC="-L${TK_STUB_LIB_DIR} ${TK_STUB_LIB_FLAG}"
TK_BUILD_STUB_LIB_PATH="`pwd`/${TK_STUB_LIB_FILE}"
TK_STUB_LIB_PATH="${TK_STUB_LIB_DIR}/${TK_STUB_LIB_FILE}"
@@ -6231,355 +11195,1149 @@ TK_SHARED_BUILD=${SHARED_BUILD}
-CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""
+ ac_config_files="$ac_config_files Makefile:../unix/Makefile.in tkConfig.sh:../unix/tkConfig.sh.in tk.pc:../unix/tk.pc.in"
-
-tk_config_files="${tk_config_files} Makefile tkConfig.sh"
-trap '' 1 2 15
-cat > confcache <<\EOF
+cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
-# scripts and configure runs. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
#
-EOF
+# `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.
# 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.
-(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 \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
+{
+ (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 \).
+ 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"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ 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
- echo "updating cache $cache_file"
- cat confcache > $cache_file
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ cat confcache >$cache_file
else
echo "not updating unwritable cache $cache_file"
fi
fi
rm -f confcache
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
+# 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[ ]*=[^:]*$/d'
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ ]*$//;
+}'
fi
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
# Transform confdefs.h into DEFS.
# Protect against shell expansion while executing Makefile rules.
# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then we branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+cat >confdef2opt.sed <<\_ACEOF
+t clear
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
+t quote
+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
+
+
+ac_libobjs=
+ac_ltlibobjs=
+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'
+done
+LIBOBJS=$ac_libobjs
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
+LTLIBOBJS=$ac_ltlibobjs
+
+
+CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""
+
+: ${CONFIG_STATUS=./config.status}
+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
+#! $SHELL
+# Generated by $as_me.
# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
+# configure, is in config.log if it exists.
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
+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
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs 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
+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
+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
do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
+ 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
+ fi
done
-ac_given_srcdir=$srcdir
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
-trap 'rm -fr `echo "${tk_config_files}" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@TCL_VERSION@%$TCL_VERSION%g
-s%@TCL_PATCH_LEVEL@%$TCL_PATCH_LEVEL%g
-s%@TCL_BIN_DIR@%$TCL_BIN_DIR%g
-s%@TCL_SRC_DIR@%$TCL_SRC_DIR%g
-s%@TCL_LIB_FILE@%$TCL_LIB_FILE%g
-s%@TCL_LIB_FLAG@%$TCL_LIB_FLAG%g
-s%@TCL_LIB_SPEC@%$TCL_LIB_SPEC%g
-s%@TCL_STUB_LIB_FILE@%$TCL_STUB_LIB_FILE%g
-s%@TCL_STUB_LIB_FLAG@%$TCL_STUB_LIB_FLAG%g
-s%@TCL_STUB_LIB_SPEC@%$TCL_STUB_LIB_SPEC%g
-s%@TCLSH_PROG@%$TCLSH_PROG%g
-s%@BUILD_TCLSH@%$BUILD_TCLSH%g
-s%@MAN_FLAGS@%$MAN_FLAGS%g
-s%@CC@%$CC%g
-s%@CPP@%$CPP%g
-s%@TCL_THREADS@%$TCL_THREADS%g
-s%@RANLIB@%$RANLIB%g
-s%@AR@%$AR%g
-s%@DL_LIBS@%$DL_LIBS%g
-s%@DL_OBJS@%$DL_OBJS%g
-s%@PLAT_OBJS@%$PLAT_OBJS%g
-s%@PLAT_SRCS@%$PLAT_SRCS%g
-s%@CFLAGS_DEBUG@%$CFLAGS_DEBUG%g
-s%@CFLAGS_OPTIMIZE@%$CFLAGS_OPTIMIZE%g
-s%@CFLAGS_WARNING@%$CFLAGS_WARNING%g
-s%@LDFLAGS_DEBUG@%$LDFLAGS_DEBUG%g
-s%@LDFLAGS_OPTIMIZE@%$LDFLAGS_OPTIMIZE%g
-s%@CC_SEARCH_FLAGS@%$CC_SEARCH_FLAGS%g
-s%@LD_SEARCH_FLAGS@%$LD_SEARCH_FLAGS%g
-s%@STLIB_LD@%$STLIB_LD%g
-s%@SHLIB_LD@%$SHLIB_LD%g
-s%@TCL_SHLIB_LD_EXTRAS@%$TCL_SHLIB_LD_EXTRAS%g
-s%@TK_SHLIB_LD_EXTRAS@%$TK_SHLIB_LD_EXTRAS%g
-s%@SHLIB_LD_LIBS@%$SHLIB_LD_LIBS%g
-s%@SHLIB_CFLAGS@%$SHLIB_CFLAGS%g
-s%@SHLIB_SUFFIX@%$SHLIB_SUFFIX%g
-s%@MAKE_LIB@%$MAKE_LIB%g
-s%@MAKE_STUB_LIB@%$MAKE_STUB_LIB%g
-s%@INSTALL_LIB@%$INSTALL_LIB%g
-s%@INSTALL_STUB_LIB@%$INSTALL_STUB_LIB%g
-s%@CFLAGS_DEFAULT@%$CFLAGS_DEFAULT%g
-s%@LDFLAGS_DEFAULT@%$LDFLAGS_DEFAULT%g
-s%@TK_VERSION@%$TK_VERSION%g
-s%@TK_MAJOR_VERSION@%$TK_MAJOR_VERSION%g
-s%@TK_MINOR_VERSION@%$TK_MINOR_VERSION%g
-s%@TK_PATCH_LEVEL@%$TK_PATCH_LEVEL%g
-s%@TK_YEAR@%$TK_YEAR%g
-s%@TK_LIB_FILE@%$TK_LIB_FILE%g
-s%@TK_LIB_FLAG@%$TK_LIB_FLAG%g
-s%@TK_LIB_SPEC@%$TK_LIB_SPEC%g
-s%@TK_STUB_LIB_FILE@%$TK_STUB_LIB_FILE%g
-s%@TK_STUB_LIB_FLAG@%$TK_STUB_LIB_FLAG%g
-s%@TK_STUB_LIB_SPEC@%$TK_STUB_LIB_SPEC%g
-s%@TK_STUB_LIB_PATH@%$TK_STUB_LIB_PATH%g
-s%@TK_INCLUDE_SPEC@%$TK_INCLUDE_SPEC%g
-s%@TK_BUILD_STUB_LIB_SPEC@%$TK_BUILD_STUB_LIB_SPEC%g
-s%@TK_BUILD_STUB_LIB_PATH@%$TK_BUILD_STUB_LIB_PATH%g
-s%@TK_SRC_DIR@%$TK_SRC_DIR%g
-s%@TK_DBGX@%$TK_DBGX%g
-s%@TK_SHARED_BUILD@%$TK_SHARED_BUILD%g
-s%@LD_LIBRARY_PATH_VAR@%$LD_LIBRARY_PATH_VAR%g
-s%@TK_BUILD_LIB_SPEC@%$TK_BUILD_LIB_SPEC%g
-s%@TK_BUILD_EXP_FILE@%$TK_BUILD_EXP_FILE%g
-s%@TK_EXP_FILE@%$TK_EXP_FILE%g
-s%@TCL_STUB_FLAGS@%$TCL_STUB_FLAGS%g
-s%@MATH_LIBS@%$MATH_LIBS%g
-s%@XINCLUDES@%$XINCLUDES%g
-s%@XLIBSW@%$XLIBSW%g
-s%@LOCALES@%$LOCALES%g
-s%@TK_WINDOWINGSYSTEM@%$TK_WINDOWINGSYSTEM%g
-s%@TK_PKG_DIR@%$TK_PKG_DIR%g
-s%@TK_LIBRARY@%$TK_LIBRARY%g
-s%@PRIVATE_INCLUDE_DIR@%$PRIVATE_INCLUDE_DIR%g
-s%@HTML_DIR@%$HTML_DIR%g
-s%@EXTRA_CC_SWITCHES@%$EXTRA_CC_SWITCHES%g
-s%@EXTRA_APP_CC_SWITCHES@%$EXTRA_APP_CC_SWITCHES%g
-s%@EXTRA_INSTALL@%$EXTRA_INSTALL%g
-s%@EXTRA_INSTALL_BINARIES@%$EXTRA_INSTALL_BINARIES%g
-s%@EXTRA_BUILD_HTML@%$EXTRA_BUILD_HTML%g
-s%@EXTRA_WISH_LIBS@%$EXTRA_WISH_LIBS%g
-s%@CFBUNDLELOCALIZATIONS@%$CFBUNDLELOCALIZATIONS%g
-s%@TK_RSRC_FILE@%$TK_RSRC_FILE%g
-s%@WISH_RSRC_FILE@%$WISH_RSRC_FILE%g
-s%@LIB_RSRC_FILE@%$LIB_RSRC_FILE%g
-s%@APP_RSRC_FILE@%$APP_RSRC_FILE%g
-s%@REZ@%$REZ%g
-s%@REZ_FLAGS@%$REZ_FLAGS%g
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# 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_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # 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" conftest.subs > conftest.s$ac_file
+# Name of the executable.
+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'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+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
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ PATH_SEPARATOR=:
fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
+ 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= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+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 -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ as_ln_s='ln -s'
fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# 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'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# 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
+# 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
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+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_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet 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
+
+Configuration files:
+$config_files
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+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'`\\"
+
+Copyright (C) 2003 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
+_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.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "x$1" : 'x\([^=]*\)='`
+ ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ 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 )
+ 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"
+ ac_need_defaults=false;;
+ -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; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1" ;;
+
+ esac
+ shift
done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
fi
-EOF
-cat >> $CONFIG_STATUS <<EOF
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+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
+fi
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS section.
+#
+
+VERSION=${TK_VERSION} && tk_aqua=${tk_aqua}
+
+_ACEOF
-CONFIG_FILES=\${CONFIG_FILES-"${tk_config_files}"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Tk-Info.plist" ) CONFIG_FILES="$CONFIG_FILES Tk-Info.plist:../${MACOSX_SRC_DIR}/Tk-Info.plist.in" ;;
+ "Wish-Info.plist" ) CONFIG_FILES="$CONFIG_FILES Wish-Info.plist:../${MACOSX_SRC_DIR}/Wish-Info.plist.in" ;;
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile:../unix/Makefile.in" ;;
+ "tkConfig.sh" ) CONFIG_FILES="$CONFIG_FILES tkConfig.sh:../unix/tkConfig.sh.in" ;;
+ "tk.pc" ) CONFIG_FILES="$CONFIG_FILES tk.pc:../unix/tk.pc.in" ;;
+ "Tk.framework" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Tk.framework" ;;
+ *) { { 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; }; };;
+ 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_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+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,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); 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=./confstat$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# 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,@TCL_VERSION@,$TCL_VERSION,;t t
+s,@TCL_PATCH_LEVEL@,$TCL_PATCH_LEVEL,;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,@TCLSH_PROG@,$TCLSH_PROG,;t t
+s,@BUILD_TCLSH@,$BUILD_TCLSH,;t t
+s,@MAN_FLAGS@,$MAN_FLAGS,;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,@TCL_THREADS@,$TCL_THREADS,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@AR@,$AR,;t t
+s,@ac_ct_AR@,$ac_ct_AR,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@TCL_LIBS@,$TCL_LIBS,;t t
+s,@DL_LIBS@,$DL_LIBS,;t t
+s,@DL_OBJS@,$DL_OBJS,;t t
+s,@PLAT_OBJS@,$PLAT_OBJS,;t t
+s,@PLAT_SRCS@,$PLAT_SRCS,;t t
+s,@LDAIX_SRC@,$LDAIX_SRC,;t t
+s,@CFLAGS_DEBUG@,$CFLAGS_DEBUG,;t t
+s,@CFLAGS_OPTIMIZE@,$CFLAGS_OPTIMIZE,;t t
+s,@CFLAGS_WARNING@,$CFLAGS_WARNING,;t t
+s,@LDFLAGS_DEBUG@,$LDFLAGS_DEBUG,;t t
+s,@LDFLAGS_OPTIMIZE@,$LDFLAGS_OPTIMIZE,;t t
+s,@CC_SEARCH_FLAGS@,$CC_SEARCH_FLAGS,;t t
+s,@LD_SEARCH_FLAGS@,$LD_SEARCH_FLAGS,;t t
+s,@STLIB_LD@,$STLIB_LD,;t t
+s,@SHLIB_LD@,$SHLIB_LD,;t t
+s,@TCL_SHLIB_LD_EXTRAS@,$TCL_SHLIB_LD_EXTRAS,;t t
+s,@TK_SHLIB_LD_EXTRAS@,$TK_SHLIB_LD_EXTRAS,;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,@MAKE_LIB@,$MAKE_LIB,;t t
+s,@MAKE_STUB_LIB@,$MAKE_STUB_LIB,;t t
+s,@INSTALL_LIB@,$INSTALL_LIB,;t t
+s,@DLL_INSTALL_DIR@,$DLL_INSTALL_DIR,;t t
+s,@INSTALL_STUB_LIB@,$INSTALL_STUB_LIB,;t t
+s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t
+s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t
+s,@XFT_CFLAGS@,$XFT_CFLAGS,;t t
+s,@XFT_LIBS@,$XFT_LIBS,;t t
+s,@UNIX_FONT_OBJS@,$UNIX_FONT_OBJS,;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_YEAR@,$TK_YEAR,;t t
+s,@TK_LIB_FILE@,$TK_LIB_FILE,;t t
+s,@TK_LIB_FLAG@,$TK_LIB_FLAG,;t t
+s,@TK_LIB_SPEC@,$TK_LIB_SPEC,;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_STUB_LIB_SPEC@,$TK_STUB_LIB_SPEC,;t t
+s,@TK_STUB_LIB_PATH@,$TK_STUB_LIB_PATH,;t t
+s,@TK_INCLUDE_SPEC@,$TK_INCLUDE_SPEC,;t t
+s,@TK_BUILD_STUB_LIB_SPEC@,$TK_BUILD_STUB_LIB_SPEC,;t t
+s,@TK_BUILD_STUB_LIB_PATH@,$TK_BUILD_STUB_LIB_PATH,;t t
+s,@TK_SRC_DIR@,$TK_SRC_DIR,;t t
+s,@TK_SHARED_BUILD@,$TK_SHARED_BUILD,;t t
+s,@LD_LIBRARY_PATH_VAR@,$LD_LIBRARY_PATH_VAR,;t t
+s,@TK_BUILD_LIB_SPEC@,$TK_BUILD_LIB_SPEC,;t t
+s,@TCL_STUB_FLAGS@,$TCL_STUB_FLAGS,;t t
+s,@XINCLUDES@,$XINCLUDES,;t t
+s,@XLIBSW@,$XLIBSW,;t t
+s,@LOCALES@,$LOCALES,;t t
+s,@TK_WINDOWINGSYSTEM@,$TK_WINDOWINGSYSTEM,;t t
+s,@TK_PKG_DIR@,$TK_PKG_DIR,;t t
+s,@TK_LIBRARY@,$TK_LIBRARY,;t t
+s,@LIB_RUNTIME_DIR@,$LIB_RUNTIME_DIR,;t t
+s,@PRIVATE_INCLUDE_DIR@,$PRIVATE_INCLUDE_DIR,;t t
+s,@HTML_DIR@,$HTML_DIR,;t t
+s,@EXTRA_CC_SWITCHES@,$EXTRA_CC_SWITCHES,;t t
+s,@EXTRA_APP_CC_SWITCHES@,$EXTRA_APP_CC_SWITCHES,;t t
+s,@EXTRA_INSTALL@,$EXTRA_INSTALL,;t t
+s,@EXTRA_INSTALL_BINARIES@,$EXTRA_INSTALL_BINARIES,;t t
+s,@EXTRA_BUILD_HTML@,$EXTRA_BUILD_HTML,;t t
+s,@EXTRA_WISH_LIBS@,$EXTRA_WISH_LIBS,;t t
+s,@EXTRA_AQUA_OBJS@,$EXTRA_AQUA_OBJS,;t t
+s,@EXTRA_AQUA_SRCS@,$EXTRA_AQUA_SRCS,;t t
+s,@CFBUNDLELOCALIZATIONS@,$CFBUNDLELOCALIZATIONS,;t t
+s,@MACOSX_SRC_DIR@,$MACOSX_SRC_DIR,;t t
+s,@TK_RSRC_FILE@,$TK_RSRC_FILE,;t t
+s,@WISH_RSRC_FILE@,$WISH_RSRC_FILE,;t t
+s,@LIB_RSRC_FILE@,$LIB_RSRC_FILE,;t t
+s,@APP_RSRC_FILE@,$APP_RSRC_FILE,;t t
+s,@REZ@,$REZ,;t t
+s,@REZ_FLAGS@,$REZ_FLAGS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+ 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`
+ fi
+ done
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+ fi
+fi # test -n "$CONFIG_FILES"
+
+_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
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.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 ;;
esac
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$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; }; }; }
+
+ ac_builddir=.
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+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 $srcdir in
+ .) # No --srcdir option. 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_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;;
+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
+
+
+
+ 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; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+: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
- ac_dir_suffix= ac_dots=
+ cat $tmp/out
+ rm -f $tmp/out
fi
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+ ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+ ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_dest" : 'X\(//\)[^/]' \| \
+ X"$ac_dest" : 'X\(//\)$' \| \
+ X"$ac_dest" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+ 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; }; }; }
+ ac_builddir=.
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
+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 $srcdir in
+ .) # No --srcdir option. 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_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;;
+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
+
+
+ { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+ case $ac_dest in
+ Tk.framework ) n=Tk &&
+ f=$n.framework && v=Versions/$VERSION &&
+ rm -rf $f && mkdir -p $f/$v/Resources &&
+ ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
+ ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist &&
+ if test $tk_aqua != no; then ln -s ../../../../$n.rsrc $f/$v/Resources; fi &&
+ unset n f v
+ ;;
esac
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-VERSION=${TK_VERSION} FRAMEWORK_BUILD=${FRAMEWORK_BUILD}
- tk_aqua=${tk_aqua}
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-test "$FRAMEWORK_BUILD" = "1" && n=Tk &&
- f=$n.framework && v=Versions/$VERSION &&
- echo "creating $f" && rm -rf $f && mkdir -p $f/$v/Resources &&
- ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
- ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist &&
- if test $tk_aqua = yes; then ln -s ../../../../$n.rsrc $f/$v/Resources; fi &&
- unset n f v
-
-
-exit 0
-EOF
+{ (exit 0); exit 0; }
+_ACEOF
chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ 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; }
+fi
+
diff --git a/unix/configure.in b/unix/configure.in
index b5f2770..3458dd0 100644
--- a/unix/configure.in
+++ b/unix/configure.in
@@ -3,15 +3,31 @@ dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run during Tk installation
dnl to configure the system for the local environment.
-AC_INIT(../generic/tk.h)
-AC_PREREQ(2.13)
-
-TK_VERSION=8.4
+AC_INIT([tk],[8.6])
+AC_PREREQ(2.59)
+
+dnl This is only used when included from macosx/configure.ac
+m4_ifdef([SC_USE_CONFIG_HEADERS], [
+ AC_CONFIG_HEADERS([tkConfig.h:../unix/tkConfig.h.in])
+ AC_CONFIG_COMMANDS_PRE([DEFS="-DHAVE_TK_CONFIG_H -imacros tkConfig.h"])
+ AH_TOP([
+ #ifndef _TKCONFIG
+ #define _TKCONFIG])
+ AH_BOTTOM([
+ /* Undef unused package specific autoheader defines so that we can
+ * include both tclConfig.h and tkConfig.h at the same time: */
+ /* override */ #undef PACKAGE_NAME
+ /* override */ #undef PACKAGE_STRING
+ /* override */ #undef PACKAGE_TARNAME
+ #endif /* _TKCONFIG */])
+])
+
+TK_VERSION=8.6
TK_MAJOR_VERSION=8
-TK_MINOR_VERSION=4
-TK_PATCH_LEVEL=".19"
+TK_MINOR_VERSION=6
+TK_PATCH_LEVEL="b2"
VERSION=${TK_VERSION}
-LOCALES="cs de el en en_gb eo es fr hu it nl pl pt ru"
+LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"
#--------------------------------------------------------------------
# Find and load the tclConfig.sh file
@@ -23,12 +39,6 @@ SC_LOAD_TCLCONFIG
SC_PROG_TCLSH
SC_BUILD_TCLSH
-if test "${TCL_VERSION}" != "${TK_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}.])
-fi
-
#------------------------------------------------------------------------
# Handle the --prefix=... option
#------------------------------------------------------------------------
@@ -40,14 +50,14 @@ if test "${exec_prefix}" = "NONE"; then
exec_prefix=$prefix
fi
# Make sure srcdir is fully qualified!
-srcdir=`cd $srcdir ; pwd`
-TK_SRC_DIR=`cd $srcdir/..; pwd`
+srcdir="`cd "$srcdir" ; pwd`"
+TK_SRC_DIR="`cd "$srcdir"/..; pwd`"
#------------------------------------------------------------------------
# Compress and/or soft link the manpages?
#------------------------------------------------------------------------
-SC_CONFIG_MANPAGES([tk])
+SC_CONFIG_MANPAGES
#------------------------------------------------------------------------
# Standard compiler checks
@@ -60,26 +70,26 @@ if test "${CFLAGS+set}" != "set" ; then
fi
AC_PROG_CC
+AC_C_INLINE
# limits header checks must come early to prevent
# an autoconf bug that throws errors on configure
AC_CHECK_HEADER(limits.h,
- [AC_DEFINE(HAVE_LIMITS_H)], [AC_DEFINE(NO_LIMITS_H)])
-AC_HAVE_HEADERS(unistd.h)
+ [AC_DEFINE(HAVE_LIMITS_H, 1, [Do we have <limits.h>?])],
+ [AC_DEFINE(NO_LIMITS_H, 1, [Do we have <limits.h>?])])
#--------------------------------------------------------------------
# Supply a substitute for stdlib.h if it doesn't define strtol,
# strtoul, or strtod (which it doesn't in some versions of SunOS).
#--------------------------------------------------------------------
-AC_MSG_CHECKING(stdlib.h)
-AC_EGREP_HEADER(strtol, stdlib.h, tk_ok=yes, tk_ok=no)
-AC_EGREP_HEADER(strtoul, stdlib.h, , tk_ok=no)
-AC_EGREP_HEADER(strtod, stdlib.h, , tk_ok=no)
-if test $tk_ok = no; then
- AC_DEFINE(NO_STDLIB_H)
+AC_CHECK_HEADER(stdlib.h, tk_ok=1, tk_ok=0)
+AC_EGREP_HEADER(strtol, stdlib.h, , tk_ok=0)
+AC_EGREP_HEADER(strtoul, stdlib.h, , tk_ok=0)
+AC_EGREP_HEADER(strtod, stdlib.h, , tk_ok=0)
+if test $tk_ok = 0; then
+ AC_DEFINE(NO_STDLIB_H, 1, [Do we have <stdlib.h>?])
fi
-AC_MSG_RESULT([$tk_ok])
#------------------------------------------------------------------------
# If we're using GCC, see if the compiler understands -pipe. If so, use it.
@@ -103,17 +113,6 @@ fi
SC_ENABLE_THREADS
-#--------------------------------------------------------------------
-# On a few very rare systems, all of the libm.a stuff is
-# already in libc.a. Set compiler flags accordingly.
-# Also, Linux requires the "ieee" library for math to work
-# right (and it must appear before "-lm").
-#--------------------------------------------------------------------
-
-MATH_LIBS=""
-AC_CHECK_FUNC(sin, , MATH_LIBS="-lm")
-AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
-
# Add the threads support libraries
LIBS="$LIBS$THREADS_LIBS"
@@ -129,8 +128,6 @@ SC_CONFIG_CFLAGS
SC_ENABLE_SYMBOLS
-TK_DBGX=${DBGX}
-
#--------------------------------------------------------------------
# Detect what compiler flags to set for 64-bit support.
#--------------------------------------------------------------------
@@ -150,7 +147,7 @@ AC_C_BIGENDIAN
# search path to reflect this.
#------------------------------------------------------------------------
-LIB_RUNTIME_DIR='${LIB_RUNTIME_DIR}'
+LIB_RUNTIME_DIR='$(libdir)'
if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then
LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}/lib"
@@ -181,12 +178,12 @@ if test $tk_ok = no; then
AC_EGREP_HEADER(fd_mask, sys/select.h,
tcl_cv_grep_fd_mask=present, tcl_cv_grep_fd_mask=missing)])
if test $tcl_cv_grep_fd_mask = present; then
- AC_DEFINE(HAVE_SYS_SELECT_H)
+ AC_DEFINE(HAVE_SYS_SELECT_H, 1, [Should we include <sys/select.h>?])
tk_ok=yes
fi
fi
if test $tk_ok = no; then
- AC_DEFINE(NO_FD_SET)
+ AC_DEFINE(NO_FD_SET, 1, [Do we have fd_set?])
fi
#------------------------------------------------------------------------------
@@ -215,6 +212,38 @@ AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
+AC_CHECK_TYPE([intptr_t], [
+ AC_DEFINE([HAVE_INTPTR_T], 1, [Do we have the intptr_t type?])], [
+ AC_CACHE_CHECK([for pointer-size signed integer type], tcl_cv_intptr_t, [
+ for tcl_cv_intptr_t in "int" "long" "long long" none; do
+ if test "$tcl_cv_intptr_t" != none; then
+ AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT],
+ [[sizeof (void *) <= sizeof ($tcl_cv_intptr_t)]])],
+ [tcl_ok=yes], [tcl_ok=no])
+ test "$tcl_ok" = yes && break; fi
+ done])
+ if test "$tcl_cv_intptr_t" != none; then
+ AC_DEFINE_UNQUOTED([intptr_t], [$tcl_cv_intptr_t], [Signed integer
+ type wide enough to hold a pointer.])
+ fi
+])
+AC_CHECK_TYPE([uintptr_t], [
+ AC_DEFINE([HAVE_UINTPTR_T], 1, [Do we have the uintptr_t type?])], [
+ AC_CACHE_CHECK([for pointer-size unsigned integer type], tcl_cv_uintptr_t, [
+ for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned long long" \
+ none; do
+ if test "$tcl_cv_uintptr_t" != none; then
+ AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT],
+ [[sizeof (void *) <= sizeof ($tcl_cv_uintptr_t)]])],
+ [tcl_ok=yes], [tcl_ok=no])
+ test "$tcl_ok" = yes && break; fi
+ done])
+ if test "$tcl_cv_uintptr_t" != none; then
+ AC_DEFINE_UNQUOTED([uintptr_t], [$tcl_cv_uintptr_t], [Unsigned integer
+ type wide enough to hold a pointer.])
+ fi
+])
+
#-------------------------------------------
# In OS/390 struct pwd has no pw_gecos field
#-------------------------------------------
@@ -224,22 +253,31 @@ AC_CACHE_CHECK([pw_gecos in struct pwd], tcl_cv_pwd_pw_gecos, [
[struct passwd pwd; pwd.pw_gecos;],
tcl_cv_pwd_pw_gecos=yes, tcl_cv_pwd_pw_gecos=no)])
if test $tcl_cv_pwd_pw_gecos = yes; then
- AC_DEFINE(HAVE_PW_GECOS)
+ AC_DEFINE(HAVE_PW_GECOS, 1, [Does struct password have a pw_gecos field?])
fi
#--------------------------------------------------------------------
# On Mac OS X, we can build either with X11 or with Aqua
#--------------------------------------------------------------------
+MACOSX_SRC_DIR=macosx
if test "`uname -s`" = "Darwin" ; then
AC_MSG_CHECKING([whether to use Aqua])
- AC_ARG_ENABLE(aqua, [ --enable-aqua enable Aqua windowingsystem on Mac OS X [--disable-aqua]],
+ AC_ARG_ENABLE(aqua,
+ AC_HELP_STRING([--enable-aqua=yes|carbon|no],
+ [use Aqua windowingsystem on Mac OS X (default: no)]),
[tk_aqua=$enableval], [tk_aqua=no])
- if test $tk_aqua = yes; then
- if test $tcl_corefoundation = no; then
- AC_MSG_WARN([Aqua can only be used when CoreFoundation is available])
+ if test $tk_aqua = yes -o $tk_aqua = cocoa; then
+ tk_aqua=yes
+ if test ! -d /System/Library/Frameworks/Cocoa.framework; then
+ AC_MSG_WARN([Aqua can only be used when Cocoa is available])
tk_aqua=no
fi
+ if test "`uname -r | awk -F. '{print [$]1}'`" -lt 9; then
+ AC_MSG_WARN([Aqua requires Mac OS X 10.5 or later])
+ tk_aqua=no
+ fi
+ elif test $tk_aqua = carbon; then
if test ! -d /System/Library/Frameworks/Carbon.framework; then
AC_MSG_WARN([Aqua can only be used when Carbon is available])
tk_aqua=no
@@ -248,8 +286,19 @@ if test "`uname -s`" = "Darwin" ; then
AC_MSG_WARN([Aqua requires Mac OS X 10.2 or later])
tk_aqua=no
fi
+ else
+ tk_aqua=no
+ fi
+ if test $tk_aqua != no -a $tcl_corefoundation = no; then
+ AC_MSG_WARN([Aqua can only be used when CoreFoundation is available])
+ tk_aqua=no
+ fi
+ if test $tk_aqua = carbon; then
+ MACOSX_SRC_DIR=carbon
+ AC_MSG_RESULT([yes (deprecated legacy Carbon implementation)])
+ else
+ AC_MSG_RESULT([$tk_aqua])
fi
- AC_MSG_RESULT([$tk_aqua])
if test "$fat_32_64" = yes; then
if test $tk_aqua = no; then
AC_CACHE_CHECK([for 64-bit X11], tcl_cv_lib_x11_64, [
@@ -266,24 +315,77 @@ if test "`uname -s`" = "Darwin" ; then
fi
# remove 64-bit arch flags from CFLAGS et al. for combined 32 & 64 bit
# fat builds if configuration does not support 64-bit.
- if test $tk_aqua = yes -o "$tcl_cv_lib_x11_64" = no; then
- AC_MSG_WARN([Removing 64-bit architectures from compiler & linker flags])
+ if test $tk_aqua = carbon -o "$tcl_cv_lib_x11_64" = no; then
+ AC_MSG_NOTICE([Removing 64-bit architectures from compiler & linker flags])
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
done
fi
fi
+ if test $tk_aqua = no; then
+ # check if weak linking whole libraries is possible.
+ AC_CACHE_CHECK([if ld accepts -weak-l flag], tcl_cv_ld_weak_l, [
+ hold_ldflags=$LDFLAGS
+ LDFLAGS="$LDFLAGS -Wl,-weak-lm"
+ AC_TRY_LINK([#include <math.h>], [double f = sin(1.0);],
+ tcl_cv_ld_weak_l=yes, tcl_cv_ld_weak_l=no)
+ LDFLAGS=$hold_ldflags])
+ fi
+ AC_CHECK_HEADERS(AvailabilityMacros.h)
+ if test "$ac_cv_header_AvailabilityMacros_h" = yes; then
+ AC_CACHE_CHECK([if weak import is available], tcl_cv_cc_weak_import, [
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
+ AC_TRY_LINK([
+ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+ #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
+ #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
+ #endif
+ #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1020
+ #error MAC_OS_X_VERSION_MIN_REQUIRED < 1020
+ #endif
+ int rand(void) __attribute__((weak_import));
+ ], [rand();],
+ tcl_cv_cc_weak_import=yes, tcl_cv_cc_weak_import=no)
+ CFLAGS=$hold_cflags])
+ if test $tcl_cv_cc_weak_import = yes; then
+ AC_DEFINE(HAVE_WEAK_IMPORT, 1, [Is weak import available?])
+ fi
+ AC_CACHE_CHECK([if Darwin SUSv3 extensions are available],
+ tcl_cv_cc_darwin_c_source, [
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
+ AC_TRY_COMPILE([
+ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+ #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
+ #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
+ #endif
+ #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+ #error MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+ #endif
+ #define _DARWIN_C_SOURCE 1
+ #include <sys/cdefs.h>
+ ],,tcl_cv_cc_darwin_c_source=yes, tcl_cv_cc_darwin_c_source=no)
+ CFLAGS=$hold_cflags])
+ if test $tcl_cv_cc_darwin_c_source = yes; then
+ AC_DEFINE(_DARWIN_C_SOURCE, 1,
+ [Are Darwin SUSv3 extensions available?])
+ fi
+ fi
else
tk_aqua=no
fi
-if test $tk_aqua = yes; then
- AC_DEFINE(MAC_OSX_TK)
- LIBS="$LIBS -framework Carbon"
- CFLAGS="$CFLAGS -fpascal-strings"
+if test $tk_aqua != no; then
+ if test $tk_aqua = yes; then
+ LIBS="$LIBS -framework Cocoa -framework Carbon -framework IOKit"
+ EXTRA_CC_SWITCHES='-std=gnu99 -x objective-c -fobjc-gc'
+ else
+ LIBS="$LIBS -framework Carbon -framework IOKit"
+ CFLAGS="$CFLAGS -fpascal-strings"
+ fi
+ AC_DEFINE(MAC_OSX_TK, 1, [Are we building TkAqua?])
TK_WINDOWINGSYSTEM=AQUA
if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then
- AC_DEFINE(TK_MAC_DEBUG)
+ AC_DEFINE(TK_MAC_DEBUG, 1, [Are TkAqua debug messages enabled?])
fi
else
#--------------------------------------------------------------------
@@ -314,19 +416,14 @@ fi
#--------------------------------------------------------------------
if test "x${x_libraries}" != "x"; then
+ if test "x${x_libraries}" != "xNONE"; then
LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${x_libraries}"
+ fi
fi
if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then
LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'`
fi
-# The statement below is very tricky! It actually *evaluates* the
-# string in TCL_CC_SEARCH_FLAGS and TCL_LD_SEARCH_FLAGS which
-# causes a substitution of the variable LIB_RUNTIME_DIR.
-
-eval "CC_SEARCH_FLAGS=\"$TCL_CC_SEARCH_FLAGS\""
-eval "LD_SEARCH_FLAGS=\"$TCL_LD_SEARCH_FLAGS\""
-
#--------------------------------------------------------------------
# Check for the existence of various libraries. The order here
# is important, so that then end up in the right order in the
@@ -349,18 +446,6 @@ if test $tk_aqua = no; then
AC_CHECK_LIB(Xbsd, main, [LIBS="$LIBS -lXbsd"])
fi
-tk_checkBoth=0
-AC_CHECK_FUNC(connect, tk_checkSocket=0, tk_checkSocket=1)
-if test "$tk_checkSocket" = 1; then
- AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", tk_checkBoth=1)
-fi
-if test "$tk_checkBoth" = 1; then
- tk_oldLibs=$LIBS
- LIBS="$LIBS -lsocket -lnsl"
- AC_CHECK_FUNC(accept, tk_checkNsl=0, [LIBS=$tk_oldLibs])
-fi
-AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"])])
-
#--------------------------------------------------------------------
# One more check related to the X libraries. The standard releases
# of Ultrix don't support the "xauth" mechanism, so send won't work
@@ -392,6 +477,129 @@ if test -d /usr/include/mit -a $tk_aqua = no; then
fi
#--------------------------------------------------------------------
+# Check whether the header and library for the XScreenSaver
+# extension are available, and set HAVE_XSS if so.
+# XScreenSaver is needed for Tk_GetUserInactiveTime().
+#--------------------------------------------------------------------
+
+if test $tk_aqua = no; then
+ tk_oldCFlags=$CFLAGS
+ CFLAGS="$CFLAGS $XINCLUDES"
+ tk_oldLibs=$LIBS
+ LIBS="$tk_oldLibs $XLIBSW"
+ xss_header_found=no
+ xss_lib_found=no
+ AC_MSG_CHECKING([whether to try to use XScreenSaver])
+ AC_ARG_ENABLE(xss,
+ AC_HELP_STRING([--enable-xss],
+ [use XScreenSaver for activity timer (default: on)]),
+ [enable_xss=$enableval], [enable_xss=yes])
+ if test "$enable_xss" = "no" ; then
+ AC_MSG_RESULT([$enable_xss])
+ else
+ AC_MSG_RESULT([$enable_xss])
+ AC_CHECK_HEADER(X11/extensions/scrnsaver.h, [
+ xss_header_found=yes
+ ],,[#include <X11/Xlib.h>])
+ AC_CHECK_FUNC(XScreenSaverQueryInfo,,[
+ AC_CHECK_LIB(Xext, XScreenSaverQueryInfo, [
+ XLIBSW="$XLIBSW -lXext"
+ xss_lib_found=yes
+ ], [
+ AC_CHECK_LIB(Xss, XScreenSaverQueryInfo, [
+ if test "$tcl_cv_ld_weak_l" = yes; then
+ # On Darwin, weak link libXss if possible,
+ # as it is only available on Tiger or later.
+ XLIBSW="$XLIBSW -Wl,-weak-lXss -lXext"
+ else
+ XLIBSW="$XLIBSW -lXss -lXext"
+ fi
+ xss_lib_found=yes
+ ],, -lXext)
+ ])
+ ])
+ fi
+ if test $enable_xss = yes -a $xss_lib_found = yes -a $xss_header_found = yes; then
+ AC_DEFINE(HAVE_XSS, 1, [Is XScreenSaver available?])
+ fi
+ CFLAGS=$tk_oldCFlags
+ LIBS=$tk_oldLibs
+fi
+
+#--------------------------------------------------------------------
+# Check for freetype / fontconfig / Xft support.
+#--------------------------------------------------------------------
+
+if test $tk_aqua = no; then
+ AC_MSG_CHECKING([whether to use xft])
+ AC_ARG_ENABLE(xft,
+ AC_HELP_STRING([--enable-xft],
+ [use freetype/fontconfig/xft (default: on)]),
+ [enable_xft=$enableval], [enable_xft="default"])
+ XFT_CFLAGS=""
+ XFT_LIBS=""
+ if test "$enable_xft" = "no" ; then
+ AC_MSG_RESULT([$enable_xft])
+ else
+ found_xft="yes"
+ dnl make sure package configurator (xft-config or pkg-config
+ dnl says that xft is present.
+ XFT_CFLAGS=`xft-config --cflags 2>/dev/null` || found_xft="no"
+ XFT_LIBS=`xft-config --libs 2>/dev/null` || found_xft="no"
+ if test "$found_xft" = "no" ; then
+ found_xft=yes
+ XFT_CFLAGS=`pkg-config --cflags xft 2>/dev/null` || found_xft="no"
+ XFT_LIBS=`pkg-config --libs xft 2>/dev/null` || found_xft="no"
+ fi
+ AC_MSG_RESULT([$found_xft])
+ dnl make sure that compiling against Xft header file doesn't bomb
+ if test "$found_xft" = "yes" ; then
+ tk_oldCFlags=$CFLAGS
+ CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS"
+ tk_oldLibs=$LIBS
+ LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW"
+ AC_CHECK_HEADER(X11/Xft/Xft.h, [], [
+ found_xft=no
+ ],[#include <X11/Xlib.h>])
+ CFLAGS=$tk_oldCFlags
+ LIBS=$tk_oldLibs
+ fi
+ dnl make sure that linking against Xft libraries finds freetype
+ if test "$found_xft" = "yes" ; then
+ tk_oldCFlags=$CFLAGS
+ CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS"
+ tk_oldLibs=$LIBS
+ LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW"
+ AC_CHECK_LIB(Xft, XftFontOpen, [], [
+ found_xft=no
+ ])
+ CFLAGS=$tk_oldCFlags
+ LIBS=$tk_oldLibs
+ fi
+ dnl print a warning if xft is unusable and was specifically requested
+ if test "$found_xft" = "no" ; then
+ if test "$enable_xft" = "yes" ; then
+ AC_MSG_WARN([Can't find xft configuration, or xft is unusable])
+ fi
+ enable_xft=no
+ XFT_CFLAGS=""
+ XFT_LIBS=""
+ else
+ enable_xft=yes
+ fi
+ fi
+ if test $enable_xft = "yes" ; then
+ UNIX_FONT_OBJS=tkUnixRFont.o
+ AC_DEFINE(HAVE_XFT, 1, [Have we turned on XFT (antialiased fonts)?])
+ else
+ UNIX_FONT_OBJS=tkUnixFont.o
+ fi
+ AC_SUBST(XFT_CFLAGS)
+ AC_SUBST(XFT_LIBS)
+ AC_SUBST(UNIX_FONT_OBJS)
+fi
+
+#--------------------------------------------------------------------
# Figure out whether "char" is unsigned. If so, set a
# #define for __CHAR_UNSIGNED__.
#--------------------------------------------------------------------
@@ -408,10 +616,8 @@ eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}"
eval "TK_LIB_FILE=libtk${LIB_SUFFIX}"
# tkConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed
-# so that the backslashes quoting the DBX braces are dropped.
+# since on some platforms TK_LIB_FILE contains shell escapes.
-# Trick to replace DBGX with TK_DBGX
-DBGX='${TK_DBGX}'
eval "TK_LIB_FILE=${TK_LIB_FILE}"
if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then
@@ -422,7 +628,7 @@ fi
TK_LIBRARY='$(prefix)/lib/tk$(VERSION)'
PRIVATE_INCLUDE_DIR='$(includedir)'
HTML_DIR='$(DISTDIR)/html'
-TK_PKG_DIR='tk$(VERSION)$(TK_DBGX)'
+TK_PKG_DIR='tk$(VERSION)'
TK_RSRC_FILE='tk$(VERSION).rsrc'
WISH_RSRC_FILE='wish$(VERSION).rsrc'
@@ -434,29 +640,31 @@ WISH_RSRC_FILE='wish$(VERSION).rsrc'
if test "`uname -s`" = "Darwin" ; then
SC_ENABLE_FRAMEWORK
TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version ${TK_VERSION}`echo ${TK_PATCH_LEVEL} | awk ['{match($0, "\\\.[0-9]+"); print substr($0,RSTART,RLENGTH)}']`"
- TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name ${DYLIB_INSTALL_DIR}/${TK_LIB_FILE} -unexported_symbols_list $$(f=$(TCL_STUB_LIB_FILE).E && nm -gjp $(TCL_BIN_DIR)/$(TCL_STUB_LIB_FILE) | grep ^_[[^_]] > $$f && echo $$f)'
+ TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name "${DYLIB_INSTALL_DIR}"/${TK_LIB_FILE}'
+ if test $tk_aqua = yes; then
+ TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -unexported_symbols_list $$(f=$(TK_LIB_FILE).E && nm -gp tkMacOSX*.o 2>/dev/null | awk "/^[[0-9a-f]]+ . \.objc/ {print \$$3}" > $$f && echo $$f)'
+ fi
echo "$LDFLAGS " | grep -q -- '-prebind ' && TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -seg1addr 0xb000000'
TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -sectcreate __TEXT __info_plist Tk-Info.plist'
EXTRA_WISH_LIBS='-sectcreate __TEXT __info_plist Wish-Info.plist'
- EXTRA_APP_CC_SWITCHES='-mdynamic-no-pic'
- tk_config_files="${tk_config_files} [Tk-Info.plist:../macosx/Tk-Info.plist.in Wish-Info.plist:../macosx/Wish-Info.plist.in]"
+ EXTRA_APP_CC_SWITCHES="${EXTRA_APP_CC_SWITCHES}"' -mdynamic-no-pic'
+ AC_CONFIG_FILES([Tk-Info.plist:../${MACOSX_SRC_DIR}/Tk-Info.plist.in Wish-Info.plist:../${MACOSX_SRC_DIR}/Wish-Info.plist.in])
for l in ${LOCALES}; do CFBUNDLELOCALIZATIONS="${CFBUNDLELOCALIZATIONS}<string>$l</string>"; done
TK_YEAR="`date +%Y`"
fi
if test "$FRAMEWORK_BUILD" = "1" ; then
- AC_DEFINE(TK_FRAMEWORK)
+ AC_DEFINE(TK_FRAMEWORK, 1, [Is Tk built as a framework?])
# Construct a fake local framework structure to make linking with
# '-framework Tk' and running of tktest work
- AC_OUTPUT_COMMANDS([test "$FRAMEWORK_BUILD" = "1" && n=Tk &&
- f=$n.framework && v=Versions/$VERSION &&
- echo "creating $f" && rm -rf $f && mkdir -p $f/$v/Resources &&
- ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
- ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist &&
- if test $tk_aqua = yes; then ln -s ../../../../$n.rsrc $f/$v/Resources; fi &&
- unset n f v
- ], [VERSION=${TK_VERSION} FRAMEWORK_BUILD=${FRAMEWORK_BUILD}
- tk_aqua=${tk_aqua}])
+ AC_CONFIG_COMMANDS([Tk.framework], [n=Tk &&
+ f=$n.framework && v=Versions/$VERSION &&
+ rm -rf $f && mkdir -p $f/$v/Resources &&
+ ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
+ ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist &&
+ if test $tk_aqua != no; then ln -s ../../../../$n.rsrc $f/$v/Resources; fi &&
+ unset n f v
+ ], VERSION=${TK_VERSION} && tk_aqua=${tk_aqua})
LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH"
if test "${libdir}" = '${exec_prefix}/lib'; then
# override libdir default
@@ -464,7 +672,7 @@ if test "$FRAMEWORK_BUILD" = "1" ; then
fi
TK_LIB_FILE="Tk"
TK_LIB_FLAG="-framework Tk"
- TK_BUILD_LIB_SPEC="-F`pwd` -framework Tk"
+ TK_BUILD_LIB_SPEC="-F`pwd | sed -e 's/ /\\\\ /g'` -framework Tk"
TK_LIB_SPEC="-F${libdir} -framework Tk"
libdir="${libdir}/Tk.framework/Versions/\${VERSION}"
TK_LIBRARY="${libdir}/Resources/Scripts"
@@ -475,58 +683,59 @@ if test "$FRAMEWORK_BUILD" = "1" ; then
PRIVATE_INCLUDE_DIR="${libdir}/PrivateHeaders"
HTML_DIR="${libdir}/Resources/Documentation/Reference/Tk"
EXTRA_INSTALL="install-private-headers html-tk"
- EXTRA_BUILD_HTML='@ln -fs contents.htm $(HTML_INSTALL_DIR)/TkTOC.html'
+ EXTRA_BUILD_HTML='@ln -fs contents.htm "$(HTML_INSTALL_DIR)"/TkTOC.html'
EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tk-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"'
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing license.terms to $(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "$(TOP_DIR)/license.terms" "$(LIB_INSTALL_DIR)/Resources"'
- if test $tk_aqua = yes; then
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing ${TK_RSRC_FILE} to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "${TK_RSRC_FILE}" "$(LIB_INSTALL_DIR)/Resources"'
+ if test $tk_aqua != no; then
+ if test $tk_aqua = yes; then
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Images to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)/Resources"; done'
+ else
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing ${TK_RSRC_FILE} to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "${TK_RSRC_FILE}" "$(LIB_INSTALL_DIR)/Resources"'
+ fi
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing wish$(VERSION) script to $(INSTALL_ROOT)/'"${bindir}"'" && mkdir -p "$(INSTALL_ROOT)/'"${bindir}"'" && printf > "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)" "#!/bin/sh\n\"\$$(dirname \$$0)'"`eval d="${bindir}"; echo "$d" | sed -e 's#/[^/][^/]*#/..#g'`"'$(bindir)/Wish\" \"\$$@\"" && chmod +x "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)"'
bindir="${libdir}/Resources/Wish.app/Contents/MacOS"
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Info.plist to $(BIN_INSTALL_DIR)/.." && $(INSTALL_DATA) Wish-Info.plist "$(BIN_INSTALL_DIR)/../Info.plist" && mv -f "$(BIN_INSTALL_DIR)/wish$(VERSION)" "$(BIN_INSTALL_DIR)/Wish"'
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && mkdir -p "$(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "'\$\(MAC\_OSX_DIR\)'/Wish.icns" "$(BIN_INSTALL_DIR)/../Resources"'
- EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing ${WISH_RSRC_FILE} to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "${WISH_RSRC_FILE}" "$(BIN_INSTALL_DIR)/../Resources"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && mkdir -p "$(BIN_INSTALL_DIR)/../Resources"'
+ if test $tk_aqua = yes; then
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Tk.icns" "$(BIN_INSTALL_DIR)/../Resources/Wish.icns"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.sdef to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.sdef" "$(BIN_INSTALL_DIR)/../Resources"'
+ else
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.icns" "$(BIN_INSTALL_DIR)/../Resources" && echo "Installing ${WISH_RSRC_FILE} to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "${WISH_RSRC_FILE}" "$(BIN_INSTALL_DIR)/../Resources"'
+ fi
fi
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."'
# Don't use AC_DEFINE for the following as the framework version define
# needs to go into the Makefile even when using autoheader, so that we
# can pick up a potential make override of VERSION. Also, don't put this
# into CFLAGS as it should not go into tkConfig.sh
- EXTRA_CC_SWITCHES='-DTK_FRAMEWORK_VERSION=\"$(VERSION)\"'
+ EXTRA_CC_SWITCHES="$EXTRA_CC_SWITCHES"' -DTK_FRAMEWORK_VERSION=\"$(VERSION)\"'
else
+ if test $tk_aqua = yes; then
+ EXTRA_INSTALL_BINARIES='@echo "Installing Images to $(LIB_INSTALL_DIR)" && mkdir -p "$(LIB_INSTALL_DIR)" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)"; done'
+ fi
# libdir must be a fully qualified path and not ${exec_prefix}/lib
eval libdir="$libdir"
- if test "$SHARED_BUILD" = "0" || test "$TCL_NEEDS_EXP_FILE" = "0"; then
- if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
- eval TK_LIB_FLAG="-ltk${VERSION}\${TK_DBGX}"
- else
- eval TK_LIB_FLAG="-ltk`echo ${VERSION} | tr -d .`\${TK_DBGX}"
- fi
- TK_BUILD_LIB_SPEC="-L`pwd` ${TK_LIB_FLAG}"
- TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}"
+ if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
+ TK_LIB_FLAG="-ltk${TK_VERSION}"
else
- TK_BUILD_EXP_FILE="lib.exp"
- eval "TK_EXP_FILE=libtk${TCL_EXPORT_FILE_SUFFIX}"
-
- if test "$GCC" = "yes" ; then
- TK_BUILD_LIB_SPEC="-Wl,-bI:`pwd`/${TK_BUILD_EXP_FILE} -L`pwd`"
- TK_LIB_SPEC="-Wl,-bI:${libdir}/${TK_EXP_FILE} -L`pwd`"
- else
- TK_BUILD_LIB_SPEC="-bI:`pwd`/${TK_BUILD_EXP_FILE}"
- TK_LIB_SPEC="-bI:${libdir}/${TK_EXP_FILE}"
- fi
+ TK_LIB_FLAG="-ltk`echo ${TK_VERSION} | tr -d .`"
fi
+ TK_BUILD_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_LIB_FLAG}"
+ TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}"
fi
-# Support for building the Aqua resource files
-if test $tk_aqua = yes; then
+# Extra bits for legacy Aqua Carbon build (carbon sources and resource files)
+if test $tk_aqua = carbon; then
+ EXTRA_AQUA_OBJS='tkMacOSXCarbonEvents.o'
+ EXTRA_AQUA_SRCS='$(TOP_DIR)/carbon/tkMacOSXCarbonEvents.c'
LIB_RSRC_FILE='${TK_RSRC_FILE}'
APP_RSRC_FILE='${WISH_RSRC_FILE}'
REZ=/Developer/Tools/Rez
REZ_FLAGS='-d "SystemSevenOrLater=1" -useDF -ro'
if test "$SHARED_BUILD" = 0; then
- EXTRA_INSTALL_BINARIES='@echo "Installing $(TK_RSRC_FILE) to $(LIB_INSTALL_DIR)" && $(INSTALL_DATA) $(TK_RSRC_FILE) $(LIB_INSTALL_DIR)'
- TK_BUILD_LIB_SPEC="$TK_BUILD_LIB_SPEC -sectcreate __TEXT __tk_rsrc `pwd`/\${TK_RSRC_FILE}"
- TK_LIB_SPEC="$TK_LIB_SPEC -sectcreate __TEXT __tk_rsrc ${libdir}/\${TK_RSRC_FILE}"
+ EXTRA_INSTALL_BINARIES='@echo "Installing $(TK_RSRC_FILE) to $(LIB_INSTALL_DIR)" && $(INSTALL_DATA) $(TK_RSRC_FILE) "$(LIB_INSTALL_DIR)"'
+ TK_BUILD_LIB_SPEC="$TK_BUILD_LIB_SPEC -sectcreate __TEXT __tk_rsrc `pwd | sed -e 's/ /\\\\ /g'`/\${TK_RSRC_FILE}"
+ TK_LIB_SPEC="$TK_LIB_SPEC -sectcreate __TEXT __tk_rsrc ${libdir}/\${TK_RSRC_FILE}"
else
TK_SHLIB_LD_EXTRAS="$TK_SHLIB_LD_EXTRAS -sectcreate __TEXT __tk_rsrc \${TK_RSRC_FILE}"
fi
@@ -542,12 +751,12 @@ eval "TK_STUB_LIB_FILE=libtkstub${TK_UNSHARED_LIB_SUFFIX}"
eval "TK_STUB_LIB_DIR=${libdir}"
if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
- eval TK_STUB_LIB_FLAG="-ltkstub${TK_VERSION}\${TK_DBGX}"
+ TK_STUB_LIB_FLAG="-ltkstub${TK_VERSION}"
else
- eval TK_STUB_LIB_FLAG="-ltkstub`echo ${TK_VERSION} | tr -d .`\${TK_DBGX}"
+ TK_STUB_LIB_FLAG="-ltkstub`echo ${TK_VERSION} | tr -d .`"
fi
-TK_BUILD_STUB_LIB_SPEC="-L`pwd` ${TK_STUB_LIB_FLAG}"
+TK_BUILD_STUB_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}"
TK_STUB_LIB_SPEC="-L${TK_STUB_LIB_DIR} ${TK_STUB_LIB_FLAG}"
TK_BUILD_STUB_LIB_PATH="`pwd`/${TK_STUB_LIB_FILE}"
TK_STUB_LIB_PATH="${TK_STUB_LIB_DIR}/${TK_STUB_LIB_FILE}"
@@ -579,17 +788,13 @@ AC_SUBST(TK_BUILD_STUB_LIB_SPEC)
AC_SUBST(TK_BUILD_STUB_LIB_PATH)
AC_SUBST(TK_SRC_DIR)
-AC_SUBST(TK_DBGX)
AC_SUBST(TK_SHARED_BUILD)
AC_SUBST(LD_LIBRARY_PATH_VAR)
AC_SUBST(TK_BUILD_LIB_SPEC)
-AC_SUBST(TK_BUILD_EXP_FILE)
-AC_SUBST(TK_EXP_FILE)
AC_SUBST(TCL_STUB_FLAGS)
-AC_SUBST(MATH_LIBS)
AC_SUBST(XINCLUDES)
AC_SUBST(XLIBSW)
AC_SUBST(LOCALES)
@@ -597,6 +802,7 @@ AC_SUBST(LOCALES)
AC_SUBST(TK_WINDOWINGSYSTEM)
AC_SUBST(TK_PKG_DIR)
AC_SUBST(TK_LIBRARY)
+AC_SUBST(LIB_RUNTIME_DIR)
AC_SUBST(PRIVATE_INCLUDE_DIR)
AC_SUBST(HTML_DIR)
@@ -606,8 +812,11 @@ AC_SUBST(EXTRA_INSTALL)
AC_SUBST(EXTRA_INSTALL_BINARIES)
AC_SUBST(EXTRA_BUILD_HTML)
AC_SUBST(EXTRA_WISH_LIBS)
+AC_SUBST(EXTRA_AQUA_OBJS)
+AC_SUBST(EXTRA_AQUA_SRCS)
AC_SUBST(CFBUNDLELOCALIZATIONS)
+AC_SUBST(MACOSX_SRC_DIR)
AC_SUBST(TK_RSRC_FILE)
AC_SUBST(WISH_RSRC_FILE)
AC_SUBST(LIB_RSRC_FILE)
@@ -615,7 +824,13 @@ AC_SUBST(APP_RSRC_FILE)
AC_SUBST(REZ)
AC_SUBST(REZ_FLAGS)
-SC_OUTPUT_COMMANDS_PRE
+AC_CONFIG_FILES([
+ Makefile:../unix/Makefile.in
+ tkConfig.sh:../unix/tkConfig.sh.in
+ tk.pc:../unix/tk.pc.in
+])
+AC_OUTPUT
-tk_config_files="${tk_config_files} [Makefile tkConfig.sh]"
-AC_OUTPUT([${tk_config_files}])
+dnl Local Variables:
+dnl mode: autoconf
+dnl End:
diff --git a/unix/install-sh b/unix/install-sh
index a9a1f27..5975819 100644
--- a/unix/install-sh
+++ b/unix/install-sh
@@ -1,124 +1,528 @@
#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2011-04-20.01; # UTC
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
#
-# install - install a program, script, or datafile
-# This comes from X11R5; it is not part of GNU.
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
#
-# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
-#
+nl='
+'
+IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
+doit=${DOITPROG-}
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
-# put in absolute paths if you don't have them in your path; or use env. vars.
+posix_glob='?'
+initialize_posix_glob='
+ test "$posix_glob" != "?" || {
+ if (set -f) 2>/dev/null; then
+ posix_glob=
+ else
+ posix_glob=:
+ fi
+ }
+'
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
+posix_mkdir=
-instcmd="$mvprog"
-chmodcmd=""
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -S) stripcmd="$stripprog $2"
- shift
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- dst=$1
- fi
- shift
- continue;;
- esac
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+ --help display this help and exit.
+ --version display version info and exit.
+
+ -c (ignored)
+ -C install only if different (preserve the last data modification time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -s $stripprog installed files.
+ -S $stripprog installed files.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+ case $1 in
+ -c) ;;
+
+ -C) copy_on_change=true;;
+
+ -d) dir_arg=true;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) mode=$2
+ case $mode in
+ *' '* | *' '* | *'
+'* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
+
+ -o) chowncmd="$chownprog $2"
+ shift;;
+
+ -s) stripcmd=$stripprog;;
+
+-S) stripcmd="$stripprog $2"
+ shift;;
+
+ -t) dst_arg=$2
+ shift;;
+
+ -T) no_target_directory=true;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --) shift
+ break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
+ esac
+ shift
done
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ done
fi
-if [ x"$dst" = x ]
-then
- echo "install: no destination specified"
- exit 1
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
fi
+if test -z "$dir_arg"; then
+ do_exit='(exit $ret); exit $ret'
+ trap "ret=129; $do_exit" 1
+ trap "ret=130; $do_exit" 2
+ trap "ret=141; $do_exit" 13
+ trap "ret=143; $do_exit" 15
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
-if [ -d $dst ]
-then
- dst="$dst"/`basename $src`
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
fi
-# Make a temp file name in the proper directory.
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dst_arg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+
+ dst=$dst_arg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst;;
+ esac
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dst=$dstdir/`basename "$src"`
+ dstdir_status=0
+ else
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+ (dirname "$dst") 2>/dev/null ||
+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$dst" : 'X\(//\)[^/]' \| \
+ X"$dst" : 'X\(//\)$' \| \
+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+ echo X"$dst" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'
+ `
+
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-dstdir=`dirname $dst`
-dsttmp=$dstdir/#inst.$$#
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writeable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
+ esac
+
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+ /*) prefix='/';;
+ -*) prefix='./';;
+ *) prefix='';;
+ esac
+
+ eval "$initialize_posix_glob"
+
+ oIFS=$IFS
+ IFS=/
+ $posix_glob set -f
+ set fnord $dstdir
+ shift
+ $posix_glob set +f
+ IFS=$oIFS
-# Move or copy the file name to the temp name
+ prefixes=
-$doit $instcmd $src $dsttmp
+ for d
+ do
+ test -z "$d" && continue
-# and set any options; do chmod last to preserve setuid bits
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
-if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi
-if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi
-if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi
-if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
+ fi
+ fi
+ fi
-# Now rename the file to the real destination.
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
-$doit $rmcmd $dst
-$doit $mvcmd $dsttmp $dst
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+ eval "$initialize_posix_glob" &&
+ $posix_glob set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ $posix_glob set +f &&
+
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
+done
-exit 0
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/unix/installManPage b/unix/installManPage
index 93fd925..4d615bf 100755
--- a/unix/installManPage
+++ b/unix/installManPage
@@ -1,12 +1,29 @@
#!/bin/sh
-ZIP=:
+########################################################################
+### Parse Options
+###
+
+Gzip=:
+SymOrLoc=""
+Gz=""
+Suffix=""
+
while true; do
case $1 in
- -s | --symlinks ) S="-s ";;
- -z | --compress ) ZIP=$2; shift ;;
- -e | --extension ) Z=$2; shift ;;
- -s | --suffix ) SUFFIX=$2; shift ;;
+ -s | --symlinks ) SymOrLoc="-s " ;;
+ -z | --compress ) Gzip=$2; shift ;;
+ -e | --extension ) Gz=$2; shift ;;
+ -x | --suffix ) Suffix=$2; shift ;;
+ -*) cat <<EOF
+Unknown option "$1". Supported options:
+ -s Use symbolic links for manpages with multiple names.
+ -z PROG Use PROG to compress manual pages.
+ -e EXT Defines the extension added by -z PROG when compressing.
+ -x SUFF Defines an extra extension suffix to use.
+Option names may not be combined getopt-style.
+EOF
+ exit 1 ;;
*) break ;;
esac
shift
@@ -16,52 +33,85 @@ if test "$#" != 2; then
exit 1
fi
-MANPAGE=$1
-DIR=$2
-test -z "$S" && S="$DIR/"
+########################################################################
+### Parse Required Arguments
+###
+
+ManPage=$1
+Dir=$2
+if test -f $ManPage ; then : ; else
+ echo "source manual page file must exist"
+ exit 1
+fi
+if test -d $Dir ; then : ; else
+ echo "target directory must exist"
+ exit 1
+fi
+test -z "$SymOrLoc" && SymOrLoc="$Dir/"
+
+########################################################################
+### Extract Target Names from Manual Page
+###
# A sed script to parse the alternative names out of a man page.
#
-# /^\\.SH NAME/{ ;# Look for a line, that starts with .SH NAME
-# s/^.*$// ;# Delete the content of this line from the buffer
-# n ;# Read next line
-# s/,//g ;# Remove all commas ...
-# s/\\\ //g ;# .. and backslash-escaped spaces.
-# s/ \\\-.*// ;# Delete from \- to the end of line
-# p ;# print the result
-# q ;# exit
-# }
-#
# Backslashes are trippled in the sed script, because it is in
-# backticks which don't pass backslashes literally.
+# backticks which doesn't pass backslashes literally.
#
-# Please keep the commented version above updated if you
-# change anything to the script below.
-NAMES=`sed -n '
- /^\\.SH NAME/{
- s/^.*$//
+Names=`sed -n '
+# Look for a line that starts with .SH NAME
+ /^\.SH NAME/{
+# Read next line
n
+# Remove all commas ...
s/,//g
+# ... and backslash-escaped spaces.
s/\\\ //g
+# Delete from \- to the end of line
s/ \\\-.*//
- p
- q
- }' $MANPAGE`
+# Convert all non-space non-alphanum sequences
+# to single underscores.
+ s/[^ A-Za-z0-9][^ A-Za-z0-9]*/_/g
+# print the result and exit
+ p;q
+ }' $ManPage`
+
+if test -z "$Names" ; then
+ echo "warning: no target names found in $ManPage"
+fi
+
+########################################################################
+### Remaining Set Up
+###
-SECTION=`echo $MANPAGE | sed 's/.*\(.\)$/\1/'`
-SRCDIR=`dirname $MANPAGE`
-FIRST=""
-for f in $NAMES; do
- f=$f.$SECTION$SUFFIX
- if test -z "$FIRST" ; then
- FIRST=$f
- rm -f $DIR/$FIRST $DIR/$FIRST.*
- sed -e "/man\.macros/r $SRCDIR/man.macros" -e "/man\.macros/d" \
- $MANPAGE > $DIR/$FIRST
- chmod 444 $DIR/$FIRST
- $ZIP $DIR/$FIRST
+case $ManPage in
+ *.1) Section=1 ;;
+ *.3) Section=3 ;;
+ *.n) Section=n ;;
+ *) echo "unknown section for $ManPage"
+ exit 2 ;;
+esac
+
+SrcDir=`dirname $ManPage`
+
+########################################################################
+### Process Page to Create Target Pages
+###
+
+First=""
+for Target in $Names; do
+ Target=$Target.$Section$Suffix
+ rm -f $Dir/$Target $Dir/$Target.*
+ if test -z "$First" ; then
+ First=$Target
+ sed -e "/man\.macros/r $SrcDir/man.macros" -e "/man\.macros/d" \
+ $ManPage > $Dir/$First
+ chmod 444 $Dir/$First
+ $Gzip $Dir/$First
else
- rm -f $DIR/$f $DIR/$f.*
- ln $S$FIRST$Z $DIR/$f$Z
+ ln $SymOrLoc$First$Gz $Dir/$Target$Gz
fi
done
+
+########################################################################
+exit 0
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 0d5d698..cb6c842 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -27,7 +27,10 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [
if test x"${no_tcl}" = x ; then
# we reset no_tcl in case something fails here
no_tcl=true
- AC_ARG_WITH(tcl, [ --with-tcl directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval})
+ AC_ARG_WITH(tcl,
+ AC_HELP_STRING([--with-tcl],
+ [directory containing tcl configuration (tclConfig.sh)]),
+ with_tclconfig="${withval}")
AC_MSG_CHECKING([for Tcl configuration])
AC_CACHE_VAL(ac_cv_c_tclconfig,[
@@ -154,7 +157,10 @@ AC_DEFUN([SC_PATH_TKCONFIG], [
if test x"${no_tk}" = x ; then
# we reset no_tk in case something fails here
no_tk=true
- AC_ARG_WITH(tk, [ --with-tk directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
+ AC_ARG_WITH(tk,
+ AC_HELP_STRING([--with-tk],
+ [directory containing tk configuration (tkConfig.sh)]),
+ with_tkconfig="${withval}")
AC_MSG_CHECKING([for Tk configuration])
AC_CACHE_VAL(ac_cv_c_tkconfig,[
@@ -517,7 +523,8 @@ AC_DEFUN([SC_BUILD_TCLSH], [
AC_DEFUN([SC_ENABLE_SHARED], [
AC_MSG_CHECKING([how to build libraries])
AC_ARG_ENABLE(shared,
- [ --enable-shared build and link with shared libraries [--enable-shared]],
+ AC_HELP_STRING([--enable-shared],
+ [build and link with shared libraries (default: on)]),
[tcl_ok=$enableval], [tcl_ok=yes])
if test "${enable_shared+set}" = set; then
@@ -558,7 +565,8 @@ AC_DEFUN([SC_ENABLE_FRAMEWORK], [
if test "`uname -s`" = "Darwin" ; then
AC_MSG_CHECKING([how to package libraries])
AC_ARG_ENABLE(framework,
- [ --enable-framework package shared libraries in MacOSX frameworks [--disable-framework]],
+ AC_HELP_STRING([--enable-framework],
+ [package shared libraries in MacOSX frameworks (default: off)]),
[enable_framework=$enableval], [enable_framework=no])
if test $enable_framework = yes; then
if test $SHARED_BUILD = 0; then
@@ -587,9 +595,7 @@ AC_DEFUN([SC_ENABLE_FRAMEWORK], [
#------------------------------------------------------------------------
# SC_ENABLE_THREADS --
#
-# Specify if thread support should be enabled. TCL_THREADS is
-# checked so that if you are compiling an extension against a
-# threaded core, your extension must be compiled threaded as well.
+# Specify if thread support should be enabled
#
# Arguments:
# none
@@ -610,8 +616,10 @@ AC_DEFUN([SC_ENABLE_FRAMEWORK], [
#------------------------------------------------------------------------
AC_DEFUN([SC_ENABLE_THREADS], [
- AC_ARG_ENABLE(threads, [ --enable-threads build with threads],
- [tcl_ok=$enableval], [tcl_ok=no])
+ AC_ARG_ENABLE(threads,
+ AC_HELP_STRING([--enable-threads],
+ [build with threads (default: on)]),
+ [tcl_ok=$enableval], [tcl_ok=yes])
if test "${TCL_THREADS}" = 1; then
tcl_threaded_core=1;
@@ -668,12 +676,7 @@ AC_DEFUN([SC_ENABLE_THREADS], [
# Does the pthread-implementation provide
# 'pthread_attr_setstacksize' ?
-
- ac_saved_libs=$LIBS
- LIBS="$LIBS $THREADS_LIBS"
AC_CHECK_FUNCS(pthread_attr_setstacksize)
- AC_CHECK_FUNCS(pthread_atfork)
- LIBS=$ac_saved_libs
else
TCL_THREADS=0
fi
@@ -719,42 +722,49 @@ 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
+# DBGX Formerly used as debug library extension;
+# always blank now.
#
#------------------------------------------------------------------------
AC_DEFUN([SC_ENABLE_SYMBOLS], [
AC_MSG_CHECKING([for build with symbols])
- AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no])
+ AC_ARG_ENABLE(symbols,
+ AC_HELP_STRING([--enable-symbols],
+ [build with debugging symbols (default: off)]),
+ [tcl_ok=$enableval], [tcl_ok=no])
# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
+ DBGX=""
if test "$tcl_ok" = "no"; then
CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
- DBGX=""
AC_MSG_RESULT([no])
+ AC_DEFINE(TCL_CFG_OPTIMIZED, 1, [Is this an optimized build?])
else
CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
- DBGX=g
if test "$tcl_ok" = "yes"; then
AC_MSG_RESULT([yes (standard debugging)])
fi
fi
AC_SUBST(CFLAGS_DEFAULT)
AC_SUBST(LDFLAGS_DEFAULT)
+ ### FIXME: Surely TCL_CFG_DEBUG should be set to whether we're debugging?
+ AC_DEFINE(TCL_CFG_DEBUG, 1, [Is debugging enabled?])
if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?])
fi
- if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
- AC_DEFINE(TCL_COMPILE_DEBUG, 1, [Is bytecode debugging enabled?])
- AC_DEFINE(TCL_COMPILE_STATS, 1, [Are bytecode statistics enabled?])
- fi
+ ifelse($1,bccdebug,dnl Only enable 'compile' for the Tcl core itself
+ if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
+ AC_DEFINE(TCL_COMPILE_DEBUG, 1, [Is bytecode debugging enabled?])
+ AC_DEFINE(TCL_COMPILE_STATS, 1, [Are bytecode statistics enabled?])
+ fi)
if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
if test "$tcl_ok" = "all"; then
- AC_MSG_RESULT([enabled symbols mem compile debugging])
+ AC_MSG_RESULT([enabled symbols mem ]ifelse($1,bccdebug,[compile ])[debugging])
else
AC_MSG_RESULT([enabled $tcl_ok debugging])
fi
@@ -782,8 +792,8 @@ AC_DEFUN([SC_ENABLE_SYMBOLS], [
AC_DEFUN([SC_ENABLE_LANGINFO], [
AC_ARG_ENABLE(langinfo,
- [ --enable-langinfo use nl_langinfo if possible to determine
- encoding at startup, otherwise use old heuristic],
+ AC_HELP_STRING([--enable-langinfo],
+ [use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
[langinfo_ok=$enableval], [langinfo_ok=yes])
HAVE_LANGINFO=0
@@ -834,15 +844,16 @@ AC_DEFUN([SC_ENABLE_LANGINFO], [
AC_DEFUN([SC_CONFIG_MANPAGES], [
AC_MSG_CHECKING([whether to use symlinks for manpages])
AC_ARG_ENABLE(man-symlinks,
- [ --enable-man-symlinks use symlinks for the manpages],
+ AC_HELP_STRING([--enable-man-symlinks],
+ [use symlinks for the manpages (default: off)]),
test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks",
enableval="no")
AC_MSG_RESULT([$enableval])
AC_MSG_CHECKING([whether to compress the manpages])
AC_ARG_ENABLE(man-compression,
- [ --enable-man-compression=PROG
- compress the manpages with PROG],
+ AC_HELP_STRING([--enable-man-compression=PROG],
+ [compress the manpages with PROG (default: off)]),
[case $enableval in
yes) AC_MSG_ERROR([missing argument to --enable-man-compression]);;
no) ;;
@@ -862,11 +873,10 @@ AC_DEFUN([SC_CONFIG_MANPAGES], [
AC_MSG_CHECKING([whether to add a package name suffix for the manpages])
AC_ARG_ENABLE(man-suffix,
- [ --enable-man-suffix=STRING
- use STRING as a suffix to manpage file names
- (default: $1)],
+ AC_HELP_STRING([--enable-man-suffix=STRING],
+ [use STRING as a suffix to manpage file names (default: no, AC_PACKAGE_NAME if enabled without specifying STRING)]),
[case $enableval in
- yes) enableval="$1" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
+ yes) enableval="AC_PACKAGE_NAME" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
no) ;;
*) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
esac],
@@ -994,16 +1004,9 @@ AC_DEFUN([SC_CONFIG_SYSTEM], [
# a .a extension whereas shared objects for loadable
# extensions have a .so extension. Defaults to
# ${VERSION}${SHLIB_SUFFIX}.
-# TCL_NEEDS_EXP_FILE -
-# 1 means that an export file is needed to link to a
-# shared library.
-# TCL_EXP_FILE - The name of the installed export / import file which
-# should be used to link to the Tcl shared library.
-# Empty if Tcl is unshared.
-# TCL_BUILD_EXP_FILE -
-# The name of the built export / import file which
-# should be used to link to the Tcl shared library.
-# Empty if Tcl is unshared.
+# TCL_LIBS -
+# Libs to use when linking Tcl shell or some other
+# shell that includes Tcl libs.
# CFLAGS_DEBUG -
# Flags used when running the compiler in debug mode
# CFLAGS_OPTIMIZE -
@@ -1017,26 +1020,63 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
# Step 0.a: Enable 64 bit support?
AC_MSG_CHECKING([if 64bit support is requested])
- AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)],
+ AC_ARG_ENABLE(64bit,
+ AC_HELP_STRING([--enable-64bit],
+ [enable 64bit support (default: off)]),
[do64bit=$enableval], [do64bit=no])
AC_MSG_RESULT([$do64bit])
# Step 0.b: Enable Solaris 64 bit VIS support?
AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
- AC_ARG_ENABLE(64bit-vis,[ --enable-64bit-vis enable 64bit Sparc VIS support],
+ AC_ARG_ENABLE(64bit-vis,
+ AC_HELP_STRING([--enable-64bit-vis],
+ [enable 64bit Sparc VIS support (default: off)]),
[do64bitVIS=$enableval], [do64bitVIS=no])
AC_MSG_RESULT([$do64bitVIS])
-
- if test "$do64bitVIS" = "yes"; then
- # Force 64bit on with VIS
- do64bit=yes
- fi
+ # Force 64bit on with VIS
+ AS_IF([test "$do64bitVIS" = "yes"], [do64bit=yes])
+
+ # Step 0.c: Check if visibility support is available. Do this here so
+ # that platform specific alternatives can be used below if this fails.
+
+ AC_CACHE_CHECK([if compiler supports visibility "hidden"],
+ tcl_cv_cc_visibility_hidden, [
+ AS_IF([test "$SHARED_BUILD" = 1], [
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fvisibility=hidden -Werror"
+ AC_TRY_COMPILE(,[#if !defined(__GNUC__) || __GNUC__ < 4
+#error visibility hidden is not supported for this compiler
+#endif
+ ], tcl_cv_cc_visibility_hidden=yes,
+ tcl_cv_cc_visibility_hidden=no)
+ CFLAGS=$hold_cflags
+ ], [
+ tcl_cv_cc_visibility_hidden=no
+ ])
+ ])
+ AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [
+ CFLAGS="$CFLAGS -fvisibility=hidden"
+ AC_DEFINE(MODULE_SCOPE, [extern], [No need to mark inidividual symbols as hidden])
+ ], [
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
+ AC_TRY_LINK([
+ extern __attribute__((__visibility__("hidden"))) void f(void);
+ void f(void) {}], [f();], tcl_cv_cc_visibility_hidden=yes,
+ tcl_cv_cc_visibility_hidden=no)
+ CFLAGS=$hold_cflags
+ AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [
+ AC_DEFINE(MODULE_SCOPE,
+ [extern __attribute__((__visibility__("hidden")))],
+ [Compiler support for module scope symbols])
+ ])
+ ])
# Step 0.d: Disable -rpath support?
AC_MSG_CHECKING([if rpath support is requested])
- AC_ARG_ENABLE(rpath,[ --disable-rpath disable rpath support (default: on)],
+ AC_ARG_ENABLE(rpath,
+ AC_HELP_STRING([--disable-rpath],
+ [disable rpath support (default: on)]),
[doRpath=$enableval], [doRpath=yes])
AC_MSG_RESULT([$doRpath])
@@ -1060,34 +1100,32 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
# default to '{$LIBS}' and set to "" on per-platform necessary basis
SHLIB_LD_LIBS='${LIBS}'
LDFLAGS_ORIG="$LDFLAGS"
- TCL_EXPORT_FILE_SUFFIX=""
+ # When ld needs options to work in 64-bit mode, put them in
+ # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
+ # is disabled by the user. [Bug 1016796]
+ LDFLAGS_ARCH=""
UNSHARED_LIB_SUFFIX=""
TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
ECHO_VERSION='`echo ${VERSION}`'
TCL_LIB_VERSIONS_OK=ok
CFLAGS_DEBUG=-g
- CFLAGS_OPTIMIZE=-O
- if test "$GCC" = "yes" ; then
- CFLAGS_WARNING="-Wall -fno-strict-aliasing"
- else
+ AS_IF([test "$GCC" = yes], [
+ CFLAGS_OPTIMIZE=-O2
+ CFLAGS_WARNING="-Wall"
+ ], [
+ CFLAGS_OPTIMIZE=-O
CFLAGS_WARNING=""
- fi
- TCL_NEEDS_EXP_FILE=0
- TCL_BUILD_EXP_FILE=""
- TCL_EXP_FILE=""
-dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
-dnl AC_CHECK_TOOL(AR, ar)
- AC_CHECK_PROG(AR, ar, ar)
- if test "${AR}" = "" ; then
- AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
- fi
+ ])
+ AC_CHECK_TOOL(AR, ar)
STLIB_LD='${AR} cr'
LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
PLAT_OBJS=""
PLAT_SRCS=""
+ LDAIX_SRC=""
+ AS_IF([test x"${SHLIB_VERSION}" = x], [SHLIB_VERSION="1.0"])
case $system in
AIX-*)
- if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
+ AS_IF([test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"], [
# AIX requires the _r compiler when gcc isn't being used
case "${CC}" in
*_r|*_r\ *)
@@ -1099,7 +1137,7 @@ dnl AC_CHECK_TOOL(AR, ar)
;;
esac
AC_MSG_RESULT([Using $CC for compiling with threads])
- fi
+ ])
LIBS="$LIBS -lc"
SHLIB_CFLAGS=""
SHLIB_SUFFIX=".so"
@@ -1107,68 +1145,47 @@ dnl AC_CHECK_TOOL(AR, ar)
DL_OBJS="tclLoadDl.o"
LD_LIBRARY_PATH_VAR="LIBPATH"
- # Check to enable 64-bit flags for compiler/linker on AIX 4+
- if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then
- if test "$GCC" = "yes" ; then
+ # ldAix No longer needed with use of -bexpall/-brtl
+ # but some extensions may still reference it
+ LDAIX_SRC='$(UNIX_DIR)/ldAix'
+
+ # Check to enable 64-bit flags for compiler/linker
+ AS_IF([test "$do64bit" = yes], [
+ AS_IF([test "$GCC" = yes], [
AC_MSG_WARN([64bit mode not supported with GCC on $system])
- else
+ ], [
do64bit_ok=yes
CFLAGS="$CFLAGS -q64"
- LDFLAGS="$LDFLAGS -q64"
+ LDFLAGS_ARCH="-q64"
RANLIB="${RANLIB} -X64"
AR="${AR} -X64"
SHLIB_LD_FLAGS="-b64"
- fi
- fi
+ ])
+ ])
- if test "`uname -m`" = "ia64" ; then
+ AS_IF([test "`uname -m`" = ia64], [
# AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
# AIX-5 has dl* in libc.so
DL_LIBS=""
- if test "$GCC" = "yes" ; then
+ AS_IF([test "$GCC" = yes], [
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
- else
+ ], [
CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
- fi
+ ])
LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
- else
- if test "$GCC" = "yes" ; then
- SHLIB_LD="gcc -shared"
- else
- SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
- fi
- SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}"
+ ], [
+ AS_IF([test "$GCC" = yes], [
+ SHLIB_LD='${CC} -shared -Wl,-bexpall'
+ ], [
+ SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry"
+ LDFLAGS="$LDFLAGS -brtl"
+ ])
+ SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}"
DL_LIBS="-ldl"
CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- TCL_NEEDS_EXP_FILE=1
- TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
- fi
-
- # AIX v<=4.1 has some different flags than 4.2+
- if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
- LIBOBJS="$LIBOBJS tclLoadAix.o"
- DL_LIBS="-lld"
- fi
-
- # On AIX <=v4 systems, libbsd.a has to be linked in to support
- # non-blocking file IO. This library has to be linked in after
- # the MATH_LIBS or it breaks the pow() function. The way to
- # insure proper sequencing, is to add it to the tail of MATH_LIBS.
- # This library also supplies gettimeofday.
- #
- # AIX does not have a timezone field in struct tm. When the AIX
- # bsd library is used, the timezone global and the gettimeofday
- # methods are to be avoided for timezone deduction instead, we
- # deduce the timezone by comparing the localtime result on a
- # known GMT value.
-
- AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no)
- if test $libbsd = yes; then
- MATH_LIBS="$MATH_LIBS -lbsd"
- AC_DEFINE(USE_DELTA_FOR_TZ)
- fi
+ ])
;;
BeOS*)
SHLIB_CFLAGS="-fPIC"
@@ -1240,13 +1257,13 @@ dnl AC_CHECK_TOOL(AR, ar)
AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
LIBS="$LIBS -lxnet" # Use the XOPEN network library
- if test "`uname -m`" = "ia64" ; then
+ AS_IF([test "`uname -m`" = ia64], [
SHLIB_SUFFIX=".so"
- else
+ ], [
SHLIB_SUFFIX=".sl"
- fi
+ ])
AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
- if test "$tcl_ok" = yes; then
+ AS_IF([test "$tcl_ok" = yes], [
SHLIB_CFLAGS="+z"
SHLIB_LD="ld -b"
DL_OBJS="tclLoadShl.o"
@@ -1255,43 +1272,43 @@ dnl AC_CHECK_TOOL(AR, ar)
CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
LD_LIBRARY_PATH_VAR="SHLIB_PATH"
- fi
- if test "$GCC" = "yes" ; then
+ ])
+ AS_IF([test "$GCC" = yes], [
SHLIB_LD='${CC} -shared'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- fi
+ ], [
+ CFLAGS="$CFLAGS -z"
+ ])
# Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
#CFLAGS="$CFLAGS +DAportable"
# Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
- if test "$GCC" = "yes" ; then
+ AS_IF([test "$do64bit" = "yes"], [
+ AS_IF([test "$GCC" = yes], [
case `${CC} -dumpmachine` in
hppa64*)
# 64-bit gcc in use. Fix flags for GNU ld.
do64bit_ok=yes
SHLIB_LD='${CC} -shared'
- if test $doRpath = yes ; then
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
+ AS_IF([test $doRpath = yes], [
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
;;
*)
AC_MSG_WARN([64bit mode not supported with GCC on $system])
;;
esac
- else
+ ], [
do64bit_ok=yes
CFLAGS="$CFLAGS +DD64"
- LDFLAGS="$LDFLAGS +DD64"
- fi
- fi
- ;;
+ LDFLAGS_ARCH="+DD64"
+ ])
+ ]) ;;
HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
SHLIB_SUFFIX=".sl"
AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
- if test "$tcl_ok" = yes; then
+ AS_IF([test "$tcl_ok" = yes], [
SHLIB_CFLAGS="+z"
SHLIB_LD="ld -b"
SHLIB_LD_LIBS=""
@@ -1301,29 +1318,17 @@ dnl AC_CHECK_TOOL(AR, ar)
CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
LD_LIBRARY_PATH_VAR="SHLIB_PATH"
- fi
- ;;
- IRIX-4.*)
- SHLIB_CFLAGS="-G 0"
- SHLIB_SUFFIX=".a"
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS="$LDFLAGS -Wl,-D,08000000"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
- ;;
+ ]) ;;
IRIX-5.*)
SHLIB_CFLAGS=""
SHLIB_LD="ld -shared -rdata_shared"
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
+ AC_LIBOBJ(mkstemp)
+ AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
;;
IRIX-6.*)
SHLIB_CFLAGS=""
@@ -1331,14 +1336,14 @@ dnl AC_CHECK_TOOL(AR, ar)
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
+ AC_LIBOBJ(mkstemp)
+ AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
- if test "$GCC" = "yes" ; then
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
+ AS_IF([test "$GCC" = yes], [
CFLAGS="$CFLAGS -mabi=n32"
LDFLAGS="$LDFLAGS -mabi=n32"
- else
+ ], [
case $system in
IRIX-6.3)
# Use to build 6.2 compatible binaries on 6.3.
@@ -1349,7 +1354,7 @@ dnl AC_CHECK_TOOL(AR, ar)
;;
esac
LDFLAGS="$LDFLAGS -n32"
- fi
+ ])
;;
IRIX64-6.*)
SHLIB_CFLAGS=""
@@ -1357,23 +1362,23 @@ dnl AC_CHECK_TOOL(AR, ar)
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
+ AC_LIBOBJ(mkstemp)
+ AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
# Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
- if test "$GCC" = "yes" ; then
+ AS_IF([test "$do64bit" = yes], [
+ AS_IF([test "$GCC" = yes], [
AC_MSG_WARN([64bit mode not supported by gcc])
- else
+ ], [
do64bit_ok=yes
SHLIB_LD="ld -64 -shared -rdata_shared"
CFLAGS="$CFLAGS -64"
- LDFLAGS="$LDFLAGS -64"
- fi
- fi
+ LDFLAGS_ARCH="-64"
+ ])
+ ])
;;
Linux*)
SHLIB_CFLAGS="-fPIC"
@@ -1385,75 +1390,45 @@ dnl AC_CHECK_TOOL(AR, ar)
# get rid of the warnings.
#CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
- if test "$have_dl" = yes; then
- SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
- if test $doRpath = yes ; then
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- else
- AC_CHECK_HEADER(dld.h, [
- SHLIB_LD="ld -shared"
- DL_OBJS="tclLoadDld.o"
- DL_LIBS="-ldld"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""])
- fi
- if test "`uname -m`" = "alpha" ; then
- CFLAGS="$CFLAGS -mieee"
- fi
- if test $do64bit = yes; then
+ SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ AS_IF([test $doRpath = yes], [
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
+ AS_IF([test $do64bit = yes], [
AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
hold_cflags=$CFLAGS
CFLAGS="$CFLAGS -m64"
AC_TRY_LINK(,, tcl_cv_cc_m64=yes, tcl_cv_cc_m64=no)
CFLAGS=$hold_cflags])
- if test $tcl_cv_cc_m64 = yes; then
+ AS_IF([test $tcl_cv_cc_m64 = yes], [
CFLAGS="$CFLAGS -m64"
do64bit_ok=yes
- fi
- fi
+ ])
+ ])
- # The combo of gcc + glibc has a bug related
- # to inlining of functions like strtod(). The
- # -fno-builtin flag should address this problem
- # but it does not work. The -fno-inline flag
- # is kind of overkill but it works.
- # Disable inlining only when one of the
+ # The combo of gcc + glibc has a bug related to inlining of
+ # functions like strtod(). The -fno-builtin flag should address
+ # this problem but it does not work. The -fno-inline flag is kind
+ # of overkill but it works. Disable inlining only when one of the
# files in compat/*.c is being linked in.
- if test x"${LIBOBJS}" != x ; then
- CFLAGS="$CFLAGS -fno-inline"
- fi
-
- # XIM peeking works under XFree86.
- AC_DEFINE(PEEK_XCLOSEIM)
+ AS_IF([test x"${USE_COMPAT}" != x],[CFLAGS="$CFLAGS -fno-inline"])
;;
GNU*)
SHLIB_CFLAGS="-fPIC"
SHLIB_SUFFIX=".so"
- if test "$have_dl" = yes; then
- SHLIB_LD='${CC} -shared'
- DL_OBJS=""
- DL_LIBS="-ldl"
- LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- else
- AC_CHECK_HEADER(dld.h, [
- SHLIB_LD="ld -shared"
- DL_OBJS=""
- DL_LIBS="-ldld"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""])
- fi
- if test "`uname -m`" = "alpha" ; then
- CFLAGS="$CFLAGS -mieee"
- fi
+ SHLIB_LD='${CC} -shared'
+ DL_OBJS=""
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ CC_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS=""
+ AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
;;
Lynx*)
SHLIB_CFLAGS="-fPIC"
@@ -1463,10 +1438,9 @@ dnl AC_CHECK_TOOL(AR, ar)
DL_OBJS="tclLoadDl.o"
DL_LIBS="-mshared -ldl"
LD_FLAGS="-Wl,--export-dynamic"
- if test $doRpath = yes ; then
+ AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
+ LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
;;
MP-RAS-02*)
SHLIB_CFLAGS="-K PIC"
@@ -1490,92 +1464,80 @@ dnl AC_CHECK_TOOL(AR, ar)
LD_SEARCH_FLAGS=""
;;
NetBSD-1.*|FreeBSD-[[1-2]].*)
- # Not available on all versions: check for include file.
- AC_CHECK_HEADER(dlfcn.h, [
- # NetBSD/SPARC needs -fPIC, -fpic will not do.
- SHLIB_CFLAGS="-fPIC"
- SHLIB_LD="ld -Bshareable -x"
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- if test $doRpath = yes ; then
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
- AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
- AC_EGREP_CPP(yes, [
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ AS_IF([test $doRpath = yes], [
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
+ AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
+ AC_EGREP_CPP(yes, [
#ifdef __ELF__
yes
#endif
- ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
- if test $tcl_cv_ld_elf = yes; then
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
- else
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
- fi
+ ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
+ AS_IF([test $tcl_cv_ld_elf = yes], [
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
], [
- SHLIB_CFLAGS=""
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
- SHLIB_SUFFIX=".a"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
])
- # FreeBSD doesn't handle version numbers with dots.
+ # Ancient FreeBSD doesn't handle version numbers with dots.
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
OpenBSD-*)
arch=`arch -s`
case "$arch" in
m88k|vax)
- SHLIB_CFLAGS=""
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
- SHLIB_SUFFIX=".a"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ # Equivalent using configure option --disable-load
+ # Step 4 will set the necessary variables
+ DL_OBJS=""
+ SHLIB_LD_LIBS=""
;;
*)
- # OpenBSD/SPARC[64] needs -fPIC, -fpic will not do.
- case `machine` in
- sparc|sparc64)
- SHLIB_CFLAGS="-fPIC";;
- *)
- SHLIB_CFLAGS="-fpic";;
- esac
- SHLIB_LD="${CC} -shared ${SHLIB_CFLAGS}"
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
+ AS_IF([test $doRpath = yes], [
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
- AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
- AC_EGREP_CPP(yes, [
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
+ ;;
+ esac
+ case "$arch" in
+ m88k|vax)
+ CFLAGS_OPTIMIZE="-O1"
+ ;;
+ sh)
+ CFLAGS_OPTIMIZE="-O0"
+ ;;
+ *)
+ CFLAGS_OPTIMIZE="-O2"
+ ;;
+ esac
+ AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
+ AC_EGREP_CPP(yes, [
#ifdef __ELF__
yes
#endif
- ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
- if test $tcl_cv_ld_elf = yes; then
- LDFLAGS=-Wl,-export-dynamic
- else
- LDFLAGS=""
- fi
- ;;
- esac
-
+ ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
+ AS_IF([test $tcl_cv_ld_elf = yes], [
+ LDFLAGS=-Wl,-export-dynamic
+ ], [LDFLAGS=""])
+ AS_IF([test "${TCL_THREADS}" = "1"], [
+ # On OpenBSD: Compile with -pthread
+ # Don't link with -lpthread
+ LIBS=`echo $LIBS | sed s/-lpthread//`
+ CFLAGS="$CFLAGS -pthread"
+ ])
# OpenBSD doesn't do version numbers with dots.
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
NetBSD-*|FreeBSD-[[3-4]].*)
@@ -1587,16 +1549,15 @@ dnl AC_CHECK_TOOL(AR, ar)
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
LDFLAGS="$LDFLAGS -export-dynamic"
- if test $doRpath = yes ; then
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- fi
+ AS_IF([test $doRpath = yes], [
+ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- if test "${TCL_THREADS}" = "1" ; then
+ AS_IF([test "${TCL_THREADS}" = "1"], [
# The -pthread needs to go in the CFLAGS, not LIBS
LIBS=`echo $LIBS | sed s/-pthread//`
CFLAGS="$CFLAGS -pthread"
LDFLAGS="$LDFLAGS -pthread"
- fi
+ ])
case $system in
FreeBSD-3.*)
# FreeBSD-3 doesn't handle version numbers with dots.
@@ -1615,16 +1576,14 @@ dnl AC_CHECK_TOOL(AR, ar)
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
LDFLAGS=""
- if test $doRpath = yes ; then
+ AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
- if test "${TCL_THREADS}" = "1" ; then
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
+ AS_IF([test "${TCL_THREADS}" = "1"], [
# The -pthread needs to go in the LDFLAGS, not LIBS
LIBS=`echo $LIBS | sed s/-pthread//`
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
- fi
+ LDFLAGS="$LDFLAGS $PTHREAD_LIBS"])
# Version numbers are dot-stripped by system policy.
TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .`
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
@@ -1643,7 +1602,7 @@ dnl AC_CHECK_TOOL(AR, ar)
CFLAGS="`echo " ${CFLAGS}" | \
awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
- if test $do64bit = yes; then
+ AS_IF([test $do64bit = yes], [
case `arch` in
ppc)
AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
@@ -1653,10 +1612,10 @@ dnl AC_CHECK_TOOL(AR, ar)
AC_TRY_LINK(,, tcl_cv_cc_arch_ppc64=yes,
tcl_cv_cc_arch_ppc64=no)
CFLAGS=$hold_cflags])
- if test $tcl_cv_cc_arch_ppc64 = yes; then
+ AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [
CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
do64bit_ok=yes
- fi;;
+ ]);;
i386)
AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
tcl_cv_cc_arch_x86_64, [
@@ -1665,92 +1624,110 @@ dnl AC_CHECK_TOOL(AR, ar)
AC_TRY_LINK(,, tcl_cv_cc_arch_x86_64=yes,
tcl_cv_cc_arch_x86_64=no)
CFLAGS=$hold_cflags])
- if test $tcl_cv_cc_arch_x86_64 = yes; then
+ AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [
CFLAGS="$CFLAGS -arch x86_64"
do64bit_ok=yes
- fi;;
+ ]);;
*)
AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
esac
- else
+ ], [
# Check for combined 32-bit and 64-bit fat build
- echo "$CFLAGS " | grep -E -q -- '-arch (ppc64|x86_64) ' && \
- echo "$CFLAGS " | grep -E -q -- '-arch (ppc|i386) ' && \
- fat_32_64=yes
- fi
+ AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \
+ && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [
+ fat_32_64=yes])
+ ])
SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}'
AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no)
LDFLAGS=$hold_ldflags])
- if test $tcl_cv_ld_single_module = yes; then
+ AS_IF([test $tcl_cv_ld_single_module = yes], [
SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
- fi
+ ])
SHLIB_SUFFIX=".dylib"
DL_OBJS="tclLoadDyld.o"
DL_LIBS=""
# Don't use -prebind when building for Mac OS X 10.4 or later only:
- test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
- "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4 && \
- LDFLAGS="$LDFLAGS -prebind"
+ AS_IF([test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
+ "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4], [
+ LDFLAGS="$LDFLAGS -prebind"])
LDFLAGS="$LDFLAGS -headerpad_max_install_names"
- AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [
+ AC_CACHE_CHECK([if ld accepts -search_paths_first flag],
+ tcl_cv_ld_search_paths_first, [
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
- AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes, tcl_cv_ld_search_paths_first=no)
+ AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes,
+ tcl_cv_ld_search_paths_first=no)
LDFLAGS=$hold_ldflags])
- if test $tcl_cv_ld_search_paths_first = yes; then
+ AS_IF([test $tcl_cv_ld_search_paths_first = yes], [
LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
- fi
+ ])
+ AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
+ AC_DEFINE(MODULE_SCOPE, [__private_extern__],
+ [Compiler support for module scope symbols])
+ tcl_cv_cc_visibility_hidden=yes
+ ])
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
- PLAT_OBJS=\$\(MAC\_OSX_OBJS\)
- PLAT_SRCS=\$\(MAC\_OSX_SRCS\)
+ AC_DEFINE(MAC_OSX_TCL, 1, [Is this a Mac I see before me?])
+ PLAT_OBJS='${MAC_OSX_OBJS}'
+ PLAT_SRCS='${MAC_OSX_SRCS}'
AC_MSG_CHECKING([whether to use CoreFoundation])
- AC_ARG_ENABLE(corefoundation, [ --enable-corefoundation use CoreFoundation API [--enable-corefoundation]],
+ AC_ARG_ENABLE(corefoundation,
+ AC_HELP_STRING([--enable-corefoundation],
+ [use CoreFoundation API on MacOSX (default: on)]),
[tcl_corefoundation=$enableval], [tcl_corefoundation=yes])
AC_MSG_RESULT([$tcl_corefoundation])
- if test $tcl_corefoundation = yes; then
- AC_CACHE_CHECK([for CoreFoundation.framework], tcl_cv_lib_corefoundation, [
+ AS_IF([test $tcl_corefoundation = yes], [
+ AC_CACHE_CHECK([for CoreFoundation.framework],
+ tcl_cv_lib_corefoundation, [
hold_libs=$LIBS
- if test "$fat_32_64" = yes; then for v in CFLAGS CPPFLAGS LDFLAGS; do
- # On Tiger there is no 64-bit CF, so remove 64-bit archs
- # from CFLAGS et al. while testing for presence of CF.
- # 64-bit CF is disabled in tclUnixPort.h if necessary.
- eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
- done; fi
+ AS_IF([test "$fat_32_64" = yes], [
+ for v in CFLAGS CPPFLAGS LDFLAGS; do
+ # On Tiger there is no 64-bit CF, so remove 64-bit
+ # archs from CFLAGS et al. while testing for
+ # presence of CF. 64-bit CF is disabled in
+ # tclUnixPort.h if necessary.
+ eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
+ done])
LIBS="$LIBS -framework CoreFoundation"
AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>],
[CFBundleRef b = CFBundleGetMainBundle();],
- tcl_cv_lib_corefoundation=yes, tcl_cv_lib_corefoundation=no)
- if test "$fat_32_64" = yes; then for v in CFLAGS CPPFLAGS LDFLAGS; do
- eval $v'="$hold_'$v'"'
- done; fi; LIBS=$hold_libs])
- if test $tcl_cv_lib_corefoundation = yes; then
+ tcl_cv_lib_corefoundation=yes,
+ tcl_cv_lib_corefoundation=no)
+ AS_IF([test "$fat_32_64" = yes], [
+ for v in CFLAGS CPPFLAGS LDFLAGS; do
+ eval $v'="$hold_'$v'"'
+ done])
+ LIBS=$hold_libs])
+ AS_IF([test $tcl_cv_lib_corefoundation = yes], [
LIBS="$LIBS -framework CoreFoundation"
- AC_DEFINE(HAVE_COREFOUNDATION)
- else
- tcl_corefoundation=no
- fi
- if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then
- AC_CACHE_CHECK([for 64-bit CoreFoundation], tcl_cv_lib_corefoundation_64, [
+ AC_DEFINE(HAVE_COREFOUNDATION, 1,
+ [Do we have access to Darwin CoreFoundation.framework?])
+ ], [tcl_corefoundation=no])
+ AS_IF([test "$fat_32_64" = yes -a $tcl_corefoundation = yes],[
+ AC_CACHE_CHECK([for 64-bit CoreFoundation],
+ tcl_cv_lib_corefoundation_64, [
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
done
AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>],
[CFBundleRef b = CFBundleGetMainBundle();],
- tcl_cv_lib_corefoundation_64=yes, tcl_cv_lib_corefoundation_64=no)
+ tcl_cv_lib_corefoundation_64=yes,
+ tcl_cv_lib_corefoundation_64=no)
for v in CFLAGS CPPFLAGS LDFLAGS; do
eval $v'="$hold_'$v'"'
done])
- if test $tcl_cv_lib_corefoundation_64 = no; then
- AC_DEFINE(NO_COREFOUNDATION_64)
- fi
- fi
- fi
- AC_DEFINE(MAC_OSX_TCL)
+ AS_IF([test $tcl_cv_lib_corefoundation_64 = no], [
+ AC_DEFINE(NO_COREFOUNDATION_64, 1,
+ [Is Darwin CoreFoundation unavailable for 64-bit?])
+ LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings"
+ ])
+ ])
+ ])
;;
NEXTSTEP-*)
SHLIB_CFLAGS=""
@@ -1783,11 +1760,9 @@ dnl AC_CHECK_TOOL(AR, ar)
OSF1-1.*)
# OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
SHLIB_CFLAGS="-fPIC"
- if test "$SHARED_BUILD" = "1" ; then
- SHLIB_LD="ld -shared"
- else
+ AS_IF([test "$SHARED_BUILD" = 1], [SHLIB_LD="ld -shared"], [
SHLIB_LD="ld -non_shared"
- fi
+ ])
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
@@ -1798,36 +1773,31 @@ dnl AC_CHECK_TOOL(AR, ar)
OSF1-V*)
# Digital OSF/1
SHLIB_CFLAGS=""
- if test "$SHARED_BUILD" = "1" ; then
+ AS_IF([test "$SHARED_BUILD" = 1], [
SHLIB_LD='ld -shared -expect_unresolved "*"'
- else
+ ], [
SHLIB_LD='ld -non_shared -expect_unresolved "*"'
- fi
+ ])
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- if test $doRpath = yes ; then
+ AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- fi
- if test "$GCC" = "yes" ; then
- CFLAGS="$CFLAGS -mieee"
- else
- CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"
- fi
+ LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
+ AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [
+ CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"])
# see pthread_intro(3) for pthread support on osf1, k.furukawa
- if test "${TCL_THREADS}" = "1" ; then
+ AS_IF([test "${TCL_THREADS}" = 1], [
CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
LIBS=`echo $LIBS | sed s/-lpthreads//`
- if test "$GCC" = "yes" ; then
+ AS_IF([test "$GCC" = yes], [
LIBS="$LIBS -lpthread -lmach -lexc"
- else
+ ], [
CFLAGS="$CFLAGS -pthread"
LDFLAGS="$LDFLAGS -pthread"
- fi
- fi
-
+ ])
+ ])
;;
QNX-6*)
# QNX RTP
@@ -1842,27 +1812,17 @@ dnl AC_CHECK_TOOL(AR, ar)
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
;;
- RISCos-*)
- SHLIB_CFLAGS="-G 0"
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
- SHLIB_SUFFIX=".a"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS="$LDFLAGS -Wl,-D,08000000"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- ;;
SCO_SV-3.2*)
# Note, dlopen is available only on SCO 3.2.5 and greater. However,
# this test works, since "uname -s" was non-standard in 3.2.4 and
# below.
- if test "$GCC" = "yes" ; then
+ AS_IF([test "$GCC" = yes], [
SHLIB_CFLAGS="-fPIC -melf"
LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
- else
+ ], [
SHLIB_CFLAGS="-Kpic -belf"
LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
- fi
+ ])
SHLIB_LD="ld -G"
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
@@ -1896,8 +1856,8 @@ dnl AC_CHECK_TOOL(AR, ar)
# requires an extra version number at the end of .so file names.
# So, the library has to have a name like libtcl75.so.1.0
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
SunOS-5.[[0-6]])
@@ -1911,19 +1871,18 @@ dnl AC_CHECK_TOOL(AR, ar)
[Do we really want to follow the standard? Yes we do!])
SHLIB_CFLAGS="-KPIC"
-
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
- if test "$GCC" = "yes" ; then
+ AS_IF([test "$GCC" = yes], [
SHLIB_LD='${CC} -shared'
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- else
+ ], [
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- fi
+ ])
;;
SunOS-5*)
# Note: If _REENTRANT isn't defined, then Solaris
@@ -1936,32 +1895,32 @@ dnl AC_CHECK_TOOL(AR, ar)
SHLIB_CFLAGS="-KPIC"
# Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
+ AS_IF([test "$do64bit" = yes], [
arch=`isainfo`
- if test "$arch" = "sparcv9 sparc" ; then
- if test "$GCC" = "yes" ; then
- if test "`gcc -dumpversion | awk -F. '{print [$]1}'`" -lt "3" ; then
- AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
- else
- do64bit_ok=yes
- CFLAGS="$CFLAGS -m64 -mcpu=v9"
- LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
- SHLIB_CFLAGS="-fPIC"
- fi
- else
+ AS_IF([test "$arch" = "sparcv9 sparc"], [
+ AS_IF([test "$GCC" = yes], [
+ AS_IF([test "`${CC} -dumpversion | awk -F. '{print [$]1}'`" -lt 3], [
+ AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
+ ], [
do64bit_ok=yes
- if test "$do64bitVIS" = "yes" ; then
- CFLAGS="$CFLAGS -xarch=v9a"
- LDFLAGS="$LDFLAGS -xarch=v9a"
- else
- CFLAGS="$CFLAGS -xarch=v9"
- LDFLAGS="$LDFLAGS -xarch=v9"
- fi
- # Solaris 64 uses this as well
- #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
- fi
- elif test "$arch" = "amd64 i386" ; then
- if test "$GCC" = "yes" ; then
+ CFLAGS="$CFLAGS -m64 -mcpu=v9"
+ LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
+ SHLIB_CFLAGS="-fPIC"
+ ])
+ ], [
+ do64bit_ok=yes
+ AS_IF([test "$do64bitVIS" = yes], [
+ CFLAGS="$CFLAGS -xarch=v9a"
+ LDFLAGS_ARCH="-xarch=v9a"
+ ], [
+ CFLAGS="$CFLAGS -xarch=v9"
+ LDFLAGS_ARCH="-xarch=v9"
+ ])
+ # Solaris 64 uses this as well
+ #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
+ ])
+ ], [AS_IF([test "$arch" = "amd64 i386"], [
+ AS_IF([test "$GCC" = yes], [
case $system in
SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
do64bit_ok=yes
@@ -1970,7 +1929,7 @@ dnl AC_CHECK_TOOL(AR, ar)
*)
AC_MSG_WARN([64bit mode not supported with GCC on $system]);;
esac
- else
+ ], [
do64bit_ok=yes
case $system in
SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
@@ -1980,21 +1939,36 @@ dnl AC_CHECK_TOOL(AR, ar)
CFLAGS="$CFLAGS -xarch=amd64"
LDFLAGS="$LDFLAGS -xarch=amd64";;
esac
- fi
- else
- AC_MSG_WARN([64bit mode not supported for $arch])
- fi
- fi
+ ])
+ ], [AC_MSG_WARN([64bit mode not supported for $arch])])])
+ ])
+ #--------------------------------------------------------------------
+ # On Solaris 5.x i386 with the sunpro compiler we need to link
+ # with sunmath to get floating point rounding control
+ #--------------------------------------------------------------------
+ AS_IF([test "$GCC" = yes],[use_sunmath=no],[
+ arch=`isainfo`
+ AC_MSG_CHECKING([whether to use -lsunmath for fp rounding control])
+ AS_IF([test "$arch" = "amd64 i386"], [
+ AC_MSG_RESULT([yes])
+ MATH_LIBS="-lsunmath $MATH_LIBS"
+ AC_CHECK_HEADER(sunmath.h)
+ use_sunmath=yes
+ ], [
+ AC_MSG_RESULT([no])
+ use_sunmath=no
+ ])
+ ])
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
- if test "$GCC" = "yes" ; then
- SHLIB_LD="$CC -shared"
+ AS_IF([test "$GCC" = yes], [
+ SHLIB_LD='${CC} -shared'
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- if test "$do64bit_ok" = "yes" ; then
- if test "$arch" = "sparcv9 sparc" ; then
+ AS_IF([test "$do64bit_ok" = yes], [
+ AS_IF([test "$arch" = "sparcv9 sparc"], [
# We need to specify -static-libgcc or we need to
# add the path to the sparv9 libgcc.
SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
@@ -2002,33 +1976,21 @@ dnl AC_CHECK_TOOL(AR, ar)
# path, remove so name and append 'sparcv9'
#v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
#CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
- elif test "$arch" = "amd64 i386" ; then
+ ], [AS_IF([test "$arch" = "amd64 i386"], [
SHLIB_LD="$SHLIB_LD -m64 -static-libgcc"
- fi
- fi
- else
+ ])])
+ ])
+ ], [
+ AS_IF([test "$use_sunmath" = yes], [textmode=textoff],[textmode=text])
case $system in
SunOS-5.[[1-9]][[0-9]]*)
- SHLIB_LD='${CC} -G -z text ${LDFLAGS}';;
+ SHLIB_LD="\${CC} -G -z $textmode \${LDFLAGS}";;
*)
- SHLIB_LD="/usr/ccs/bin/ld -G -z text";;
+ SHLIB_LD="/usr/ccs/bin/ld -G -z $textmode";;
esac
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
- fi
- ;;
- ULTRIX-4.*)
- SHLIB_CFLAGS="-G 0"
- SHLIB_SUFFIX=".a"
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS="$LDFLAGS -Wl,-D,08000000"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- if test "$GCC" != "yes" ; then
- CFLAGS="$CFLAGS -DHAVE_TZSET -std1"
- fi
+ ])
;;
UNIX_SV* | UnixWare-5*)
SHLIB_CFLAGS="-KPIC"
@@ -2044,111 +2006,38 @@ dnl AC_CHECK_TOOL(AR, ar)
LDFLAGS="$LDFLAGS -Wl,-Bexport"
AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no)
LDFLAGS=$hold_ldflags])
- if test $tcl_cv_ld_Bexport = yes; then
+ AS_IF([test $tcl_cv_ld_Bexport = yes], [
LDFLAGS="$LDFLAGS -Wl,-Bexport"
- fi
+ ])
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
;;
esac
- if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
+ AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = no], [
AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
- fi
+ ])
+
+ AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = yes], [
+ AC_DEFINE(TCL_CFG_DO64BIT, 1, [Is this a 64-bit build?])
+ ])
dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
dnl # until the end of configure, as configure's compile and link tests use
dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
dnl # preprocessing tests use only CPPFLAGS.
- SC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
-
- # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
- # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop,
- # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
- # to determine which of several header files defines the a.out file
- # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we
- # support only a file format that is more or less version-7-compatible.
- # In particular,
- # - a.out files must begin with `struct exec'.
- # - the N_TXTOFF on the `struct exec' must compute the seek address
- # of the text segment
- # - The `struct exec' must contain a_magic, a_text, a_data, a_bss
- # and a_entry fields.
- # The following compilation should succeed if and only if either sys/exec.h
- # or a.out.h is usable for the purpose.
- #
- # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
- # `struct exec' includes a second header that contains information that
- # duplicates the v7 fields that are needed.
-
- if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
- AC_CACHE_CHECK([sys/exec.h], tcl_cv_sysexec_h, [
- AC_TRY_COMPILE([#include <sys/exec.h>],[
- struct exec foo;
- unsigned long seek;
- int flag;
-#if defined(__mips) || defined(mips)
- seek = N_TXTOFF (foo.ex_f, foo.ex_o);
-#else
- seek = N_TXTOFF (foo);
-#endif
- flag = (foo.a_magic == OMAGIC);
- return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
- ], tcl_cv_sysexec_h=usable, tcl_cv_sysexec_h=unusable)])
- if test $tcl_cv_sysexec_h = usable; then
- AC_DEFINE(USE_SYS_EXEC_H)
- else
- AC_CACHE_CHECK([a.out.h], tcl_cv_aout_h, [
- AC_TRY_COMPILE([#include <a.out.h>],[
- struct exec foo;
- unsigned long seek;
- int flag;
-#if defined(__mips) || defined(mips)
- seek = N_TXTOFF (foo.ex_f, foo.ex_o);
-#else
- seek = N_TXTOFF (foo);
-#endif
- flag = (foo.a_magic == OMAGIC);
- return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
- ], tcl_cv_aout_h=usable, tcl_cv_aout_h=unusable)])
- if test $tcl_cv_aout_h = usable; then
- AC_DEFINE(USE_A_OUT_H)
- else
- AC_CACHE_CHECK([sys/exec_aout.h], tcl_cv_sysexecaout_h, [
- AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
- struct exec foo;
- unsigned long seek;
- int flag;
-#if defined(__mips) || defined(mips)
- seek = N_TXTOFF (foo.ex_f, foo.ex_o);
-#else
- seek = N_TXTOFF (foo);
-#endif
- flag = (foo.a_midmag == OMAGIC);
- return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
- ], tcl_cv_sysexecaout_h=usable, tcl_cv_sysexecaout_h=unusable)])
- if test $tcl_cv_sysexecaout_h = usable; then
- AC_DEFINE(USE_SYS_EXEC_AOUT_H)
- else
- DL_OBJS=""
- fi
- fi
- fi
- fi
+ AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
- # Step 5: disable dynamic loading if requested via a command-line switch.
+ # Step 4: disable dynamic loading if requested via a command-line switch.
- AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command],
+ AC_ARG_ENABLE(load,
+ AC_HELP_STRING([--enable-load],
+ [allow dynamic loading and "load" command (default: on)]),
[tcl_ok=$enableval], [tcl_ok=yes])
- if test "$tcl_ok" = "no"; then
- DL_OBJS=""
- fi
+ AS_IF([test "$tcl_ok" = no], [DL_OBJS=""])
- if test "x$DL_OBJS" != "x" ; then
- BUILD_DLTEST="\$(DLTEST_TARGETS)"
- else
- echo "Can't figure out how to do dynamic loading or shared libraries"
- echo "on this system."
+ AS_IF([test "x$DL_OBJS" != x], [BUILD_DLTEST="\$(DLTEST_TARGETS)"], [
+ AC_MSG_WARN([Can't figure out how to do dynamic loading or shared libraries on this system.])
SHLIB_CFLAGS=""
SHLIB_LD=""
SHLIB_SUFFIX=""
@@ -2158,13 +2047,14 @@ dnl # preprocessing tests use only CPPFLAGS.
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
BUILD_DLTEST=""
- fi
+ ])
+ LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
# If we're running gcc, then change the C flags for compiling shared
# libraries to the right flags for gcc, instead of those for the
# standard manufacturer compiler.
- if test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes ; then
+ AS_IF([test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes], [
case $system in
AIX-*) ;;
BSD/OS*) ;;
@@ -2172,52 +2062,68 @@ dnl # preprocessing tests use only CPPFLAGS.
IRIX*) ;;
NetBSD-*|FreeBSD-*|OpenBSD-*) ;;
Darwin-*) ;;
- RISCos-*) ;;
SCO_SV-3.2*) ;;
- ULTRIX-4.*) ;;
*) SHLIB_CFLAGS="-fPIC" ;;
- esac
- fi
+ esac])
- if test "$SHARED_LIB_SUFFIX" = "" ; then
- SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
- fi
- if test "$UNSHARED_LIB_SUFFIX" = "" ; then
- UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
- fi
+ AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
+ AC_DEFINE(MODULE_SCOPE, [extern],
+ [No Compiler support for module scope symbols])
+ AC_DEFINE(NO_VIZ, [], [No visibility attribute])
+ ])
- if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then
+ AS_IF([test "$SHARED_LIB_SUFFIX" = ""], [
+ SHARED_LIB_SUFFIX='${VERSION}${SHLIB_SUFFIX}'])
+ AS_IF([test "$UNSHARED_LIB_SUFFIX" = ""], [
+ UNSHARED_LIB_SUFFIX='${VERSION}.a'])
+ DLL_INSTALL_DIR="\$(LIB_INSTALL_DIR)"
+
+ AS_IF([test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""], [
LIB_SUFFIX=${SHARED_LIB_SUFFIX}
MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
- else
+ AS_IF([test "${SHLIB_SUFFIX}" = ".dll"], [
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)"/$(LIB_FILE)'
+ DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)"
+ ], [
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)"/$(LIB_FILE)'
+ ])
+ ], [
LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
- if test "$RANLIB" = "" ; then
+ AS_IF([test "$RANLIB" = ""], [
MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}'
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
- else
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)"/$(LIB_FILE)'
+ ], [
MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@'
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(LIB_FILE))'
- fi
- fi
-
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)"/$(LIB_FILE) ; (cd "$(LIB_INSTALL_DIR)" ; $(RANLIB) $(LIB_FILE))'
+ ])
+ ])
# Stub lib does not depend on shared/static configuration
- if test "$RANLIB" = "" ; then
+ AS_IF([test "$RANLIB" = ""], [
MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}'
- INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)'
- else
+ INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)"'
+ ], [
MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@'
- INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(STUB_LIB_FILE))'
- fi
+ INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)"/$(STUB_LIB_FILE) ; (cd "$(LIB_INSTALL_DIR)" ; $(RANLIB) $(STUB_LIB_FILE))'
+ ])
+ # Define TCL_LIBS now that we know what DL_LIBS is.
+ # The trick here is that we don't want to change the value of TCL_LIBS if
+ # it is already set when tclConfig.sh had been loaded by Tk.
+ AS_IF([test "x${TCL_LIBS}" = x], [
+ TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}"])
+ AC_SUBST(TCL_LIBS)
+ # FIXME: This subst was left in only because the TCL_DL_LIBS
+ # entry in tclConfig.sh uses it. It is not clear why someone
+ # would use TCL_DL_LIBS instead of TCL_LIBS.
AC_SUBST(DL_LIBS)
AC_SUBST(DL_OBJS)
AC_SUBST(PLAT_OBJS)
AC_SUBST(PLAT_SRCS)
+ AC_SUBST(LDAIX_SRC)
AC_SUBST(CFLAGS)
AC_SUBST(CFLAGS_DEBUG)
AC_SUBST(CFLAGS_OPTIMIZE)
@@ -2236,10 +2142,13 @@ dnl # preprocessing tests use only CPPFLAGS.
AC_SUBST(SHLIB_LD_LIBS)
AC_SUBST(SHLIB_CFLAGS)
AC_SUBST(SHLIB_SUFFIX)
+ AC_DEFINE_UNQUOTED(TCL_SHLIB_EXT,"${SHLIB_SUFFIX}",
+ [What is the default extension for shared libraries?])
AC_SUBST(MAKE_LIB)
AC_SUBST(MAKE_STUB_LIB)
AC_SUBST(INSTALL_LIB)
+ AC_SUBST(DLL_INSTALL_DIR)
AC_SUBST(INSTALL_STUB_LIB)
AC_SUBST(RANLIB)
])
@@ -2379,14 +2288,12 @@ int main() {
#
# Defines some of the following vars:
# NO_DIRENT_H
-# NO_ERRNO_H
# NO_VALUES_H
# HAVE_LIMITS_H or NO_LIMITS_H
# NO_STDLIB_H
# NO_STRING_H
# NO_SYS_WAIT_H
# NO_DLFCN_H
-# HAVE_UNISTD_H
# HAVE_SYS_PARAM_H
#
# HAVE_STRING_H ?
@@ -2420,7 +2327,6 @@ closedir(d);
AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?])
fi
- AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H, 1, [Do we have <errno.h>?])])
AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have <float.h>?])])
AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have <values.h>?])])
AC_CHECK_HEADER(limits.h,
@@ -2448,7 +2354,7 @@ closedir(d);
AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have <dlfcn.h>?])])
# OS/390 lacks sys/param.h (and doesn't need it, by chance).
- AC_HAVE_HEADERS(unistd.h sys/param.h)
+ AC_HAVE_HEADERS(sys/param.h)
])
#--------------------------------------------------------------------
@@ -2572,10 +2478,6 @@ AC_DEFUN([SC_BLOCKING_STYLE], [
AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
AC_MSG_RESULT([FIONBIO])
;;
- ULTRIX-4.*)
- AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
- AC_MSG_RESULT([FIONBIO])
- ;;
*)
AC_MSG_RESULT([O_NONBLOCK])
;;
@@ -2604,9 +2506,8 @@ AC_DEFUN([SC_BLOCKING_STYLE], [
AC_DEFUN([SC_TIME_HANDLER], [
AC_CHECK_HEADERS(sys/time.h)
AC_HEADER_TIME
- AC_STRUCT_TIMEZONE
- AC_CHECK_FUNCS(gmtime_r localtime_r)
+ AC_CHECK_FUNCS(gmtime_r localtime_r mktime)
AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
@@ -2696,7 +2597,8 @@ AC_DEFUN([SC_BUGGY_STRTOD], [
}], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
tcl_cv_strtod_buggy=buggy)])
if test "$tcl_cv_strtod_buggy" = buggy; then
- LIBOBJS="$LIBOBJS fixstrtod.o"
+ AC_LIBOBJ([fixstrtod])
+ USE_COMPAT=1
AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?])
fi
fi
@@ -2710,19 +2612,13 @@ AC_DEFUN([SC_BUGGY_STRTOD], [
# -lnsl) are dealt with here.
#
# Arguments:
-# Requires the following vars to be set in the Makefile:
-# DL_LIBS
-# LIBS
-# MATH_LIBS
+# None.
#
# Results:
#
-# Subst's the following var:
-# TCL_LIBS
-# MATH_LIBS
-#
# Might append to the following vars:
# LIBS
+# MATH_LIBS
#
# Might define the following vars:
# HAVE_NET_ERRNO_H
@@ -2780,13 +2676,6 @@ AC_DEFUN([SC_TCL_LINK_LIBS], [
fi
AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
[LIBS="$LIBS -lnsl"])])
-
- # Don't perform the eval of the libraries here because DL_LIBS
- # won't be set until we call SC_CONFIG_CFLAGS
-
- TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
- AC_SUBST(TCL_LIBS)
- AC_SUBST(MATH_LIBS)
])
#--------------------------------------------------------------------
@@ -2913,6 +2802,72 @@ AC_DEFUN([SC_TCL_64BIT_FLAGS], [
])
#--------------------------------------------------------------------
+# SC_TCL_CFG_ENCODING TIP #59
+#
+# Declare the encoding to use for embedded configuration information.
+#
+# Arguments:
+# None.
+#
+# Results:
+# Might append to the following vars:
+# DEFS (implicit)
+#
+# Will define the following vars:
+# TCL_CFGVAL_ENCODING
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_TCL_CFG_ENCODING], [
+ AC_ARG_WITH(encoding,
+ AC_HELP_STRING([--with-encoding],
+ [encoding for configuration values (default: iso8859-1)]),
+ with_tcencoding=${withval})
+
+ if test x"${with_tcencoding}" != x ; then
+ AC_DEFINE_UNQUOTED(TCL_CFGVAL_ENCODING,"${with_tcencoding}",
+ [What encoding should be used for embedded configuration info?])
+ else
+ AC_DEFINE(TCL_CFGVAL_ENCODING,"iso8859-1",
+ [What encoding should be used for embedded configuration info?])
+ fi
+])
+
+#--------------------------------------------------------------------
+# SC_TCL_CHECK_BROKEN_FUNC
+#
+# Check for broken function.
+#
+# Arguments:
+# funcName - function to test for
+# advancedTest - the advanced test to run if the function is present
+#
+# Results:
+# Might cause compatability versions of the function to be used.
+# Might affect the following vars:
+# USE_COMPAT (implicit)
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_TCL_CHECK_BROKEN_FUNC],[
+ AC_CHECK_FUNC($1, tcl_ok=1, tcl_ok=0)
+ if test ["$tcl_ok"] = 1; then
+ AC_CACHE_CHECK([proper ]$1[ implementation], [tcl_cv_]$1[_unbroken],
+ AC_TRY_RUN([[int main() {]$2[}]],[tcl_cv_]$1[_unbroken]=ok,
+ [tcl_cv_]$1[_unbroken]=broken,[tcl_cv_]$1[_unbroken]=unknown))
+ if test ["$tcl_cv_]$1[_unbroken"] = "ok"; then
+ tcl_ok=1
+ else
+ tcl_ok=0
+ fi
+ fi
+ if test ["$tcl_ok"] = 0; then
+ AC_LIBOBJ($1)
+ USE_COMPAT=1
+ fi
+])
+
+#--------------------------------------------------------------------
# SC_TCL_GETHOSTBYADDR_R
#
# Check if we have MT-safe variant of gethostbyaddr().
@@ -3295,22 +3250,25 @@ AC_DEFUN([SC_TCL_GETGRNAM_R], [AC_CHECK_FUNC(getgrnam_r, [
fi
])])
-#--------------------------------------------------------------------
-# SC_CONFIG_COMMANDS_PRE(CMDS)
-#
-# Replacement for autoconf 2.5x AC_COMMANDS_PRE:
-# Commands to run right before config.status is
-# created. Accumulates.
-#
-# Requires presence of SC_OUTPUT_COMMANDS_PRE at the end
-# of configure.in (right before AC_OUTPUT).
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN([SC_CONFIG_COMMANDS_PRE], [
- define([SC_OUTPUT_COMMANDS_PRE], defn([SC_OUTPUT_COMMANDS_PRE])[$1
-])])
-AC_DEFUN([SC_OUTPUT_COMMANDS_PRE])
+AC_DEFUN([SC_TCL_IPV6],[
+ NEED_FAKE_RFC2553=0
+ AC_CHECK_FUNCS(getnameinfo getaddrinfo freeaddrinfo gai_strerror,,[NEED_FAKE_RFC2553=1])
+ AC_CHECK_TYPES([
+ struct addrinfo,
+ struct in6_addr,
+ struct sockaddr_in6,
+ struct sockaddr_storage],,[NEED_FAKE_RFC2553=1],[[
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+]])
+if test "x$NEED_FAKE_RFC2553" = "x1"; then
+ AC_DEFINE(NEED_FAKE_RFC2553)
+ AC_LIBOBJ([fake-rfc2553])
+ AC_CHECK_FUNC(strlcpy)
+fi
+])
# Local Variables:
# mode: autoconf
# End:
diff --git a/unix/tk.pc.in b/unix/tk.pc.in
new file mode 100644
index 0000000..d84a1cf
--- /dev/null
+++ b/unix/tk.pc.in
@@ -0,0 +1,15 @@
+# tk pkg-config source file
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: The Tk Toolkit
+Description: Tk is a cross-platform graphical user interface toolkit, the standard GUI not only for Tcl, but for many other dynamic languages as well.
+URL: http://www.tcl.tk/
+Version: @TK_VERSION@
+Requires:
+Conflicts:
+Libs: -L${libdir} @TK_LIBS@
+Cflags: -I${includedir}
diff --git a/unix/tk.spec b/unix/tk.spec
index 94bbfe7..88a3007 100644
--- a/unix/tk.spec
+++ b/unix/tk.spec
@@ -1,51 +1,54 @@
# This file is the basis for a binary Tk Linux RPM.
-%define version 8.4.19
-%define directory /usr/local
-
-Summary: Tk graphical toolkit for the Tcl scripting language.
-Name: tk
-Version: %{version}
-Release: 1
-Copyright: BSD
-Group: Development/Languages
-Source: http://prdownloads.sourceforge.net/tcl/tk%{version}-src.tar.gz
-URL: http://www.tcl.tk/
-Packager: Carina
-Buildroot: /var/tmp/%{name}%{version}
-Requires: XFree86-libs >= 3.3.3, XFree86-devel >= 3.3.3, tcl = 8.4.19
+%{!?directory:%define directory /usr/local}
+
+Name: tk
+Summary: Tk graphical toolkit for the Tcl scripting language.
+Version: 8.6b2
+Release: 2
+License: BSD
+Group: Development/Languages
+Source: http://prdownloads.sourceforge.net/tcl/tk%{version}-src.tar.gz
+URL: http://www.tcl.tk/
+Buildroot: /var/tmp/%{name}%{version}
+Buildrequires: XFree86-devel tcl >= %version
+Requires: tcl >= %version
%description
The Tcl (Tool Command Language) provides a powerful platform for
creating integration applications that tie together diverse
applications, protocols, devices, and frameworks. When paired with
the Tk toolkit, Tcl provides the fastest and most powerful way to
-create GUI applications that run on PCs, Unix, and the Macintosh. Tcl
+create GUI applications that run on PCs, Unix, and Mac OS X. Tcl
can also be used for a variety of web-related tasks and for creating
powerful command languages for applications.
%prep
+%setup -q -n %{name}%{version}
%build
-./configure --prefix %{directory} --exec-prefix %{directory}
-make CFLAGS=$RPM_OPT_FLAGS
+cd unix
+CFLAGS="%optflags" ./configure \
+ --prefix=%{directory} \
+ --exec-prefix=%{directory} \
+ --libdir=%{directory}/%{_lib}
+make
%install
-rm -rf $RPM_BUILD_ROOT
-make INSTALL_ROOT=$RPM_BUILD_ROOT install
+cd unix
+make INSTALL_ROOT=%buildroot install
%clean
-rm -rf $RPM_BUILD_ROOT
-
-# to create the tcl files list, comment out tk in the install section above,
-# then run "rpm -bi" then do a find from the build root directory,
-# and remove the files in specific directories which suffice by themselves,
-# then to create the files list for tk, uncomment tk, comment out tcl,
-# then rm -rf $RPM_BUILD_ROOT then rpm --short-circuit -bi then redo a find,
-# and remove the files in specific directories which suffice by themselves.
+rm -rf %buildroot
+
%files -n tk
%defattr(-,root,root)
+%if %{_lib} != lib
+%{directory}/%{_lib}
+%endif
%{directory}/lib
%{directory}/bin
%{directory}/include
-%{directory}/man
+%{directory}/man/man1
+%{directory}/man/man3
+%{directory}/man/mann
diff --git a/unix/tkAppInit.c b/unix/tkAppInit.c
index 006d816..5fce66e 100644
--- a/unix/tkAppInit.c
+++ b/unix/tkAppInit.c
@@ -1,22 +1,49 @@
-/*
+/*
* tkAppInit.c --
*
- * Provides a default version of the Tcl_AppInit procedure for
- * use in wish and similar Tk-based applications.
+ * 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.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+#undef BUILD_tk
+#undef STATIC_BUILD
#include "tk.h"
-#include "locale.h"
#ifdef TK_TEST
-extern int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+extern Tcl_PackageInitProc Tktest_Init;
#endif /* TK_TEST */
+
+/*
+ * The following #if block allows you to change the AppInit function by using
+ * a #define of TCL_LOCAL_APPINIT instead of rewriting this entire file. The
+ * #if checks for that #define and uses Tcl_AppInit if it doesn't exist.
+ */
+
+#ifndef TK_LOCAL_APPINIT
+#define TK_LOCAL_APPINIT Tcl_AppInit
+#endif
+#ifndef MODULE_SCOPE
+# define MODULE_SCOPE extern
+#endif
+MODULE_SCOPE int TK_LOCAL_APPINIT(Tcl_Interp *);
+MODULE_SCOPE int main(int, char **);
+
+/*
+ * The following #if block allows you to change how Tcl finds the startup
+ * script, prime the library or encoding paths, fiddle with the argv, etc.,
+ * without needing to rewrite Tk_Main()
+ */
+
+#ifdef TK_LOCAL_MAIN_HOOK
+extern int TK_LOCAL_MAIN_HOOK(int *argc, char ***argv);
+#endif
/*
*----------------------------------------------------------------------
@@ -26,40 +53,21 @@ extern int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
* This is the main program for the application.
*
* Results:
- * None: Tk_Main never returns here, so this procedure never
- * returns either.
+ * None: Tk_Main never returns here, so this procedure never returns
+ * either.
*
* Side effects:
- * Whatever the application does.
+ * Just about anything, since from here we call arbitrary Tcl code.
*
*----------------------------------------------------------------------
*/
int
-main(argc, argv)
- int argc; /* Number of command-line arguments. */
- char **argv; /* Values of command-line arguments. */
+main(
+ int argc, /* Number of command-line arguments. */
+ char **argv) /* Values of command-line arguments. */
{
- /*
- * The following #if block allows you to change the AppInit
- * function by using a #define of TCL_LOCAL_APPINIT instead
- * of rewriting this entire file. The #if checks for that
- * #define and uses Tcl_AppInit if it doesn't exist.
- */
-
-#ifndef TK_LOCAL_APPINIT
-#define TK_LOCAL_APPINIT Tcl_AppInit
-#endif
- extern int TK_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp));
-
- /*
- * The following #if block allows you to change how Tcl finds the startup
- * script, prime the library or encoding paths, fiddle with the argv,
- * etc., without needing to rewrite Tk_Main()
- */
-
#ifdef TK_LOCAL_MAIN_HOOK
- extern int TK_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv));
TK_LOCAL_MAIN_HOOK(&argc, &argv);
#endif
@@ -72,13 +80,13 @@ main(argc, argv)
*
* Tcl_AppInit --
*
- * This procedure performs application-specific initialization.
- * Most applications, especially those that incorporate additional
- * packages, will have their own version of this procedure.
+ * This procedure performs application-specific initialization. Most
+ * applications, especially those that incorporate additional packages,
+ * will have their own version of this procedure.
*
* Results:
- * Returns a standard Tcl completion code, and leaves an error
- * message in the interp's result if an error occurs.
+ * Returns a standard Tcl completion code, and leaves an error message in
+ * the interp's result if an error occurs.
*
* Side effects:
* Depends on the startup script.
@@ -87,48 +95,57 @@ main(argc, argv)
*/
int
-Tcl_AppInit(interp)
- Tcl_Interp *interp; /* Interpreter for application. */
+Tcl_AppInit(
+ Tcl_Interp *interp) /* Interpreter for application. */
{
- if (Tcl_Init(interp) == TCL_ERROR) {
+ if ((Tcl_Init)(interp) == TCL_ERROR) {
return TCL_ERROR;
}
+
if (Tk_Init(interp) == TCL_ERROR) {
return TCL_ERROR;
}
Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);
+
#ifdef TK_TEST
if (Tktest_Init(interp) == TCL_ERROR) {
return TCL_ERROR;
}
- Tcl_StaticPackage(interp, "Tktest", Tktest_Init,
- (Tcl_PackageInitProc *) NULL);
+ Tcl_StaticPackage(interp, "Tktest", Tktest_Init, 0);
#endif /* TK_TEST */
-
/*
- * Call the init procedures for included packages. Each call should
- * look like this:
+ * Call the init procedures for included packages. Each call should look
+ * like this:
*
* if (Mod_Init(interp) == TCL_ERROR) {
* return TCL_ERROR;
* }
*
- * where "Mod" is the name of the module.
+ * where "Mod" is the name of the module. (Dynamically-loadable packages
+ * should have the same entry-point name.)
*/
/*
- * Call Tcl_CreateCommand for application-specific commands, if
- * they weren't already created by the init procedures called above.
+ * Call Tcl_CreateCommand for application-specific commands, if they
+ * weren't already created by the init procedures called above.
*/
/*
- * Specify a user-specific startup file to invoke if the application
- * is run interactively. Typically the startup file is "~/.apprc"
- * where "app" is the name of the application. If this line is deleted
- * then no user-specific startup file will be run under any conditions.
+ * Specify a user-specific startup file to invoke if the application is
+ * run interactively. Typically the startup file is "~/.apprc" where "app"
+ * is the name of the application. If this line is deleted then no user-
+ * specific startup file will be run under any conditions.
*/
- Tcl_SetVar(interp, "tcl_rcFileName", "~/.wishrc", TCL_GLOBAL_ONLY);
+ (Tcl_SetVar)(interp, "tcl_rcFileName", "~/.wishrc", TCL_GLOBAL_ONLY);
return TCL_OK;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkConfig.h.in b/unix/tkConfig.h.in
new file mode 100644
index 0000000..3318552
--- /dev/null
+++ b/unix/tkConfig.h.in
@@ -0,0 +1,250 @@
+/* ../unix/tkConfig.h.in. Generated from configure.ac by autoheader. */
+
+
+ #ifndef _TKCONFIG
+ #define _TKCONFIG
+
+/* Define to 1 if you have the <AvailabilityMacros.h> header file. */
+#undef HAVE_AVAILABILITYMACROS_H
+
+/* Do we have access to Darwin CoreFoundation.framework? */
+#undef HAVE_COREFOUNDATION
+
+/* Do we have the intptr_t type? */
+#undef HAVE_INTPTR_T
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `Xft' library (-lXft). */
+#undef HAVE_LIBXFT
+
+/* Do we have <limits.h>? */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if you have the `lseek64' function. */
+#undef HAVE_LSEEK64
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `open64' function. */
+#undef HAVE_OPEN64
+
+/* Define to 1 if you have the `pthread_attr_setstacksize' function. */
+#undef HAVE_PTHREAD_ATTR_SETSTACKSIZE
+
+/* Does struct password have a pw_gecos field? */
+#undef HAVE_PW_GECOS
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Is 'struct dirent64' in <sys/types.h>? */
+#undef HAVE_STRUCT_DIRENT64
+
+/* Is 'struct stat64' in <sys/stat.h>? */
+#undef HAVE_STRUCT_STAT64
+
+/* Should we include <sys/select.h>? */
+#undef HAVE_SYS_SELECT_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Is off64_t in <sys/types.h>? */
+#undef HAVE_TYPE_OFF64_T
+
+/* Do we have the uintptr_t type? */
+#undef HAVE_UINTPTR_T
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Is weak import available? */
+#undef HAVE_WEAK_IMPORT
+
+/* Have we turned on XFT (antialiased fonts)? */
+#undef HAVE_XFT
+
+/* Is XScreenSaver available? */
+#undef HAVE_XSS
+
+/* Is this a Mac I see before me? */
+#undef MAC_OSX_TCL
+
+/* Are we building TkAqua? */
+#undef MAC_OSX_TK
+
+/* No Compiler support for module scope symbols */
+#undef MODULE_SCOPE
+
+/* Is Darwin CoreFoundation unavailable for 64-bit? */
+#undef NO_COREFOUNDATION_64
+
+/* Do we have fd_set? */
+#undef NO_FD_SET
+
+/* Do we have <limits.h>? */
+#undef NO_LIMITS_H
+
+/* Do we have <stdlib.h>? */
+#undef NO_STDLIB_H
+
+/* No visibility attribute */
+#undef NO_VIZ
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Is this a static build? */
+#undef STATIC_BUILD
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Is debugging enabled? */
+#undef TCL_CFG_DEBUG
+
+/* Is this a 64-bit build? */
+#undef TCL_CFG_DO64BIT
+
+/* Is this an optimized build? */
+#undef TCL_CFG_OPTIMIZED
+
+/* Is bytecode debugging enabled? */
+#undef TCL_COMPILE_DEBUG
+
+/* Are bytecode statistics enabled? */
+#undef TCL_COMPILE_STATS
+
+/* Is memory debugging enabled? */
+#undef TCL_MEM_DEBUG
+
+/* What is the default extension for shared libraries? */
+#undef TCL_SHLIB_EXT
+
+/* Are we building with threads enabled? */
+#undef TCL_THREADS
+
+/* Are wide integers to be implemented with C 'long's? */
+#undef TCL_WIDE_INT_IS_LONG
+
+/* What type should be used to define wide integers? */
+#undef TCL_WIDE_INT_TYPE
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Is Tk built as a framework? */
+#undef TK_FRAMEWORK
+
+/* Are TkAqua debug messages enabled? */
+#undef TK_MAC_DEBUG
+
+/* Do we want to use the threaded memory allocator? */
+#undef USE_THREAD_ALLOC
+
+/* Define to 1 if your processor stores words with the most significant byte
+ first (like Motorola and SPARC, unlike Intel and VAX). */
+#undef WORDS_BIGENDIAN
+
+/* Are Darwin SUSv3 extensions available? */
+#undef _DARWIN_C_SOURCE
+
+/* Add the _ISOC99_SOURCE flag when building */
+#undef _ISOC99_SOURCE
+
+/* Add the _LARGEFILE64_SOURCE flag when building */
+#undef _LARGEFILE64_SOURCE
+
+/* Add the _LARGEFILE_SOURCE64 flag when building */
+#undef _LARGEFILE_SOURCE64
+
+/* # needed in sys/socket.h Should OS/390 do the right thing with sockets? */
+#undef _OE_SOCKETS
+
+/* Do we really want to follow the standard? Yes we do! */
+#undef _POSIX_PTHREAD_SEMANTICS
+
+/* Do we want the reentrant OS API? */
+#undef _REENTRANT
+
+/* Do we want the thread-safe OS API? */
+#undef _THREAD_SAFE
+
+/* Do we want to use the XOPEN network library? */
+#undef _XOPEN_SOURCE
+
+/* Do we want to use the XOPEN network library? */
+#undef _XOPEN_SOURCE_EXTENDED
+
+/* Define to 1 if type `char' is unsigned and you are not using gcc. */
+#ifndef __CHAR_UNSIGNED__
+# undef __CHAR_UNSIGNED__
+#endif
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef gid_t
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Signed integer type wide enough to hold a pointer. */
+#undef intptr_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef mode_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Do we want to use the strtod() in compat? */
+#undef strtod
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef uid_t
+
+/* Unsigned integer type wide enough to hold a pointer. */
+#undef uintptr_t
+
+
+ /* Undef unused package specific autoheader defines so that we can
+ * include both tclConfig.h and tkConfig.h at the same time: */
+ /* override */ #undef PACKAGE_NAME
+ /* override */ #undef PACKAGE_STRING
+ /* override */ #undef PACKAGE_TARNAME
+ #endif /* _TKCONFIG */
diff --git a/unix/tkConfig.sh.in b/unix/tkConfig.sh.in
index 86cc7f6..1b96f37 100644
--- a/unix/tkConfig.sh.in
+++ b/unix/tkConfig.sh.in
@@ -23,14 +23,16 @@ 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@'
# Additional libraries to use when linking Tk.
-TK_LIBS='@XLIBSW@ @DL_LIBS@ @LIBS@ @MATH_LIBS@'
+TK_LIBS='@XLIBSW@ @XFT_LIBS@ @LIBS@ @TCL_LIBS@'
# Top-level directory in which Tk's platform-independent files are
# installed.
diff --git a/unix/tkUnix.c b/unix/tkUnix.c
index 497d06c..841a1b7 100644
--- a/unix/tkUnix.c
+++ b/unix/tkUnix.c
@@ -1,26 +1,29 @@
-/*
+/*
* tkUnix.c --
*
- * This file contains procedures that are UNIX/X-specific, and
- * will probably have to be written differently for Windows or
- * Macintosh platforms.
+ * This file contains procedures that are UNIX/X-specific, and will
+ * probably have to be written differently for Windows or Macintosh
+ * platforms.
*
* Copyright (c) 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.
+ * 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 "tkInt.h"
+#ifdef HAVE_XSS
+#include <X11/extensions/scrnsaver.h>
+#endif
/*
*----------------------------------------------------------------------
*
* TkGetServerInfo --
*
- * Given a window, this procedure returns information about
- * the window server for that window. This procedure provides
- * the guts of the "winfo server" command.
+ * Given a window, this procedure returns information about the window
+ * server for that window. This procedure provides the guts of the "winfo
+ * server" command.
*
* Results:
* None.
@@ -32,11 +35,11 @@
*/
void
-TkGetServerInfo(interp, tkwin)
- Tcl_Interp *interp; /* The server information is returned in
- * this interpreter's result. */
- Tk_Window tkwin; /* Token for window; this selects a
- * particular display and server. */
+TkGetServerInfo(
+ Tcl_Interp *interp, /* The server information is returned in this
+ * interpreter's result. */
+ Tk_Window tkwin) /* Token for window; this selects a particular
+ * display and server. */
{
char buffer[8 + TCL_INTEGER_SPACE * 2];
char buffer2[TCL_INTEGER_SPACE];
@@ -57,8 +60,8 @@ TkGetServerInfo(interp, tkwin)
* initialization.
*
* Results:
- * Returns the argument or a string that should not be freed by
- * the caller.
+ * Returns the argument or a string that should not be freed by the
+ * caller.
*
* Side effects:
* None.
@@ -66,10 +69,11 @@ TkGetServerInfo(interp, tkwin)
*----------------------------------------------------------------------
*/
-CONST char *
-TkGetDefaultScreenName(interp, screenName)
- Tcl_Interp *interp; /* Interp used to find environment variables. */
- CONST char *screenName; /* Screen name from command line, or NULL. */
+const char *
+TkGetDefaultScreenName(
+ Tcl_Interp *interp, /* Interp used to find environment
+ * variables. */
+ const char *screenName) /* Screen name from command line, or NULL. */
{
if ((screenName == NULL) || (screenName[0] == '\0')) {
screenName = Tcl_GetVar2(interp, "env", "DISPLAY", TCL_GLOBAL_ONLY);
@@ -94,13 +98,168 @@ TkGetDefaultScreenName(interp, screenName)
*/
void
-Tk_UpdatePointer(tkwin, x, y, state)
- Tk_Window tkwin; /* Window to which pointer event
- * is reported. May be NULL. */
- int x, y; /* Pointer location in root coords. */
- int state; /* Modifier state mask. */
+Tk_UpdatePointer(
+ Tk_Window tkwin, /* Window to which pointer event is reported.
+ * May be NULL. */
+ int x, int y, /* Pointer location in root coords. */
+ int state) /* Modifier state mask. */
{
/*
* This function intentionally left blank
*/
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpBuildRegionFromAlphaData --
+ *
+ * Set up a rectangle of the given region based on the supplied alpha
+ * data.
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * The region is updated, with extra pixels added to it.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpBuildRegionFromAlphaData(
+ TkRegion region, /* Region to be updated. */
+ unsigned x, unsigned y, /* Where in region to update. */
+ unsigned width, unsigned height,
+ /* Size of rectangle to update. */
+ unsigned char *dataPtr, /* Data to read from. */
+ unsigned pixelStride, /* Num bytes from one piece of alpha data to
+ * the next in the line. */
+ unsigned lineStride) /* Num bytes from one line of alpha data to
+ * the next line. */
+{
+ unsigned char *lineDataPtr;
+ unsigned int x1, y1, end;
+ XRectangle rect;
+
+ for (y1 = 0; y1 < height; y1++) {
+ lineDataPtr = dataPtr;
+ for (x1 = 0; x1 < width; x1 = end) {
+ /*
+ * Search for first non-transparent pixel.
+ */
+
+ while ((x1 < width) && !*lineDataPtr) {
+ x1++;
+ lineDataPtr += pixelStride;
+ }
+ end = x1;
+
+ /*
+ * Search for first transparent pixel.
+ */
+
+ while ((end < width) && *lineDataPtr) {
+ end++;
+ lineDataPtr += pixelStride;
+ }
+ if (end > x1) {
+ rect.x = x + x1;
+ rect.y = y + y1;
+ rect.width = end - x1;
+ rect.height = 1;
+ TkUnionRectWithRegion(&rect, region, region);
+ }
+ }
+ dataPtr += lineStride;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_GetUserInactiveTime --
+ *
+ * Return the number of milliseconds the user was inactive.
+ *
+ * Results:
+ * The number of milliseconds since the user's latest interaction with
+ * the system on the given display, or -1 if the XScreenSaver extension
+ * is not supported by the client libraries or the X server
+ * implementation.
+ *
+ * Side effects:
+ * None.
+ *----------------------------------------------------------------------
+ */
+
+long
+Tk_GetUserInactiveTime(
+ Display *dpy) /* The display for which to query the inactive
+ * time. */
+{
+ long inactiveTime = -1;
+#ifdef HAVE_XSS
+ int eventBase, errorBase, major, minor;
+
+ /*
+ * Calling XScreenSaverQueryVersion seems to be needed to prevent a crash
+ * on some buggy versions of XFree86.
+ */
+
+ if (
+#ifdef __APPLE__
+ XScreenSaverQueryInfo != NULL && /* Support for weak-linked libXss. */
+#endif
+ XScreenSaverQueryExtension(dpy, &eventBase, &errorBase) &&
+ XScreenSaverQueryVersion(dpy, &major, &minor)) {
+
+ XScreenSaverInfo *info = XScreenSaverAllocInfo();
+
+ if (info == NULL) {
+ /*
+ * We are out of memory.
+ */
+
+ Tcl_Panic("Out of memory: XScreenSaverAllocInfo failed in Tk_GetUserInactiveTime");
+ }
+ if (XScreenSaverQueryInfo(dpy, DefaultRootWindow(dpy), info)) {
+ inactiveTime = info->idle;
+ }
+ XFree(info);
+ }
+#endif /* HAVE_XSS */
+ return inactiveTime;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_ResetUserInactiveTime --
+ *
+ * Reset the user inactivity timer
+ *
+ * Results:
+ * none
+ *
+ * Side effects:
+ * The user inactivity timer of the underlaying windowing system is reset
+ * to zero.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tk_ResetUserInactiveTime(
+ Display *dpy)
+{
+ XResetScreenSaver(dpy);
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnix3d.c b/unix/tkUnix3d.c
index 0c460dc..38ce683 100644
--- a/unix/tkUnix3d.c
+++ b/unix/tkUnix3d.c
@@ -1,24 +1,25 @@
-/*
+/*
* tkUnix3d.c --
*
- * This file contains the platform specific routines for
- * drawing 3d borders in the Motif style.
+ * This file contains the platform specific routines for drawing 3d
+ * borders in the Motif style.
*
* Copyright (c) 1996 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include <tk3d.h>
+#include "tkInt.h"
+#include "tk3d.h"
-#if !(defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK))
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
#include "tkUnixInt.h"
#endif
/*
- * This structure is used to keep track of the extra colors used
- * by Unix 3d borders.
+ * This structure is used to keep track of the extra colors used by Unix 3D
+ * borders.
*/
typedef struct {
@@ -43,21 +44,21 @@ typedef struct {
*/
TkBorder *
-TkpGetBorder()
+TkpGetBorder(void)
{
- UnixBorder *borderPtr = (UnixBorder *) ckalloc(sizeof(UnixBorder));
+ UnixBorder *borderPtr = ckalloc(sizeof(UnixBorder));
+
borderPtr->solidGC = None;
return (TkBorder *) borderPtr;
}
-
/*
*----------------------------------------------------------------------
*
* TkpFreeBorder --
*
- * This function frees any colors allocated by the platform
- * specific part of this module.
+ * This function frees any colors allocated by the platform specific part
+ * of this module.
*
* Results:
* None.
@@ -69,8 +70,8 @@ TkpGetBorder()
*/
void
-TkpFreeBorder(borderPtr)
- TkBorder *borderPtr;
+TkpFreeBorder(
+ TkBorder *borderPtr)
{
UnixBorder *unixBorderPtr = (UnixBorder *) borderPtr;
Display *display = DisplayOfScreen(borderPtr->screen);
@@ -84,18 +85,17 @@ TkpFreeBorder(borderPtr)
*
* Tk_3DVerticalBevel --
*
- * This procedure draws a vertical bevel along one side of
- * an object. The bevel is always rectangular in shape:
+ * This procedure draws a vertical bevel along one side of an object. The
+ * bevel is always rectangular in shape:
* |||
* |||
* |||
* |||
* |||
* |||
- * An appropriate shadow color is chosen for the bevel based
- * on the leftBevel and relief arguments. Normally this
- * procedure is called first, then Tk_3DHorizontalBevel is
- * called next to draw neat corners.
+ * An appropriate shadow color is chosen for the bevel based on the
+ * leftBevel and relief arguments. Normally this procedure is called
+ * first, then Tk_3DHorizontalBevel is called next to draw neat corners.
*
* Results:
* None.
@@ -107,19 +107,18 @@ TkpFreeBorder(borderPtr)
*/
void
-Tk_3DVerticalBevel(tkwin, drawable, border, x, y, width, height,
- leftBevel, relief)
- Tk_Window tkwin; /* Window for which border was allocated. */
- Drawable drawable; /* X window or pixmap in which to draw. */
- Tk_3DBorder border; /* Token for border to draw. */
- int x, y, width, height; /* Area of vertical bevel. */
- int leftBevel; /* Non-zero means this bevel forms the
- * left side of the object; 0 means it
- * forms the right side. */
- int relief; /* Kind of bevel to draw. For example,
- * TK_RELIEF_RAISED means interior of
- * object should appear higher than
- * exterior. */
+Tk_3DVerticalBevel(
+ Tk_Window tkwin, /* Window for which border was allocated. */
+ Drawable drawable, /* X window or pixmap in which to draw. */
+ Tk_3DBorder border, /* Token for border to draw. */
+ int x, int y, int width, int height,
+ /* Area of vertical bevel. */
+ int leftBevel, /* Non-zero means this bevel forms the left
+ * side of the object; 0 means it forms the
+ * right side. */
+ int relief) /* Kind of bevel to draw. For example,
+ * TK_RELIEF_RAISED means interior of object
+ * should appear higher than exterior. */
{
TkBorder *borderPtr = (TkBorder *) border;
GC left, right;
@@ -130,11 +129,11 @@ Tk_3DVerticalBevel(tkwin, drawable, border, x, y, width, height,
}
if (relief == TK_RELIEF_RAISED) {
- XFillRectangle(display, drawable,
+ XFillRectangle(display, drawable,
(leftBevel) ? borderPtr->lightGC : borderPtr->darkGC,
x, y, (unsigned) width, (unsigned) height);
} else if (relief == TK_RELIEF_SUNKEN) {
- XFillRectangle(display, drawable,
+ XFillRectangle(display, drawable,
(leftBevel) ? borderPtr->darkGC : borderPtr->lightGC,
x, y, (unsigned) width, (unsigned) height);
} else if (relief == TK_RELIEF_RIDGE) {
@@ -142,7 +141,7 @@ Tk_3DVerticalBevel(tkwin, drawable, border, x, y, width, height,
left = borderPtr->lightGC;
right = borderPtr->darkGC;
- ridgeGroove:
+ ridgeGroove:
half = width/2;
if (!leftBevel && (width & 1)) {
half++;
@@ -176,9 +175,9 @@ Tk_3DVerticalBevel(tkwin, drawable, border, x, y, width, height,
*
* Tk_3DHorizontalBevel --
*
- * This procedure draws a horizontal bevel along one side of
- * an object. The bevel has mitered corners (depending on
- * leftIn and rightIn arguments).
+ * This procedure draws a horizontal bevel along one side of an object.
+ * The bevel has mitered corners (depending on leftIn and rightIn
+ * arguments).
*
* Results:
* None.
@@ -190,30 +189,28 @@ Tk_3DVerticalBevel(tkwin, drawable, border, x, y, width, height,
*/
void
-Tk_3DHorizontalBevel(tkwin, drawable, border, x, y, width, height,
- leftIn, rightIn, topBevel, relief)
- Tk_Window tkwin; /* Window for which border was allocated. */
- Drawable drawable; /* X window or pixmap in which to draw. */
- Tk_3DBorder border; /* Token for border to draw. */
- int x, y, width, height; /* Bounding box of area of bevel. Height
- * gives width of border. */
- int leftIn, rightIn; /* Describes whether the left and right
- * edges of the bevel angle in or out as
- * they go down. For example, if "leftIn"
- * is true, the left side of the bevel
- * looks like this:
+Tk_3DHorizontalBevel(
+ Tk_Window tkwin, /* Window for which border was allocated. */
+ Drawable drawable, /* X window or pixmap in which to draw. */
+ Tk_3DBorder border, /* Token for border to draw. */
+ int x, int y, int width, int height,
+ /* Bounding box of area of bevel. Height gives
+ * width of border. */
+ int leftIn, int rightIn, /* Describes whether the left and right edges
+ * of the bevel angle in or out as they go
+ * down. For example, if "leftIn" is true, the
+ * left side of the bevel looks like this:
* ___________
* __________
* _________
* ________
*/
- int topBevel; /* Non-zero means this bevel forms the
- * top side of the object; 0 means it
- * forms the bottom side. */
- int relief; /* Kind of bevel to draw. For example,
- * TK_RELIEF_RAISED means interior of
- * object should appear higher than
- * exterior. */
+ int topBevel, /* Non-zero means this bevel forms the top
+ * side of the object; 0 means it forms the
+ * bottom side. */
+ int relief) /* Kind of bevel to draw. For example,
+ * TK_RELIEF_RAISED means interior of object
+ * should appear higher than exterior. */
{
TkBorder *borderPtr = (TkBorder *) border;
Display *display = Tk_Display(tkwin);
@@ -229,41 +226,38 @@ Tk_3DHorizontalBevel(tkwin, drawable, border, x, y, width, height,
}
/*
- * Compute a GC for the top half of the bevel and a GC for the
- * bottom half (they're the same in many cases).
+ * Compute a GC for the top half of the bevel and a GC for the bottom half
+ * (they're the same in many cases).
*/
switch (relief) {
- case TK_RELIEF_FLAT:
- topGC = bottomGC = borderPtr->bgGC;
- break;
- case TK_RELIEF_GROOVE:
- topGC = borderPtr->darkGC;
- bottomGC = borderPtr->lightGC;
- break;
- case TK_RELIEF_RAISED:
- topGC = bottomGC =
- (topBevel) ? borderPtr->lightGC : borderPtr->darkGC;
- break;
- case TK_RELIEF_RIDGE:
- topGC = borderPtr->lightGC;
- bottomGC = borderPtr->darkGC;
- break;
- case TK_RELIEF_SOLID:
- if (unixBorderPtr->solidGC == None) {
- XGCValues gcValues;
-
- gcValues.foreground = BlackPixelOfScreen(borderPtr->screen);
- unixBorderPtr->solidGC = Tk_GetGC(tkwin, GCForeground,
- &gcValues);
- }
- XFillRectangle(display, drawable, unixBorderPtr->solidGC, x, y,
+ case TK_RELIEF_FLAT:
+ topGC = bottomGC = borderPtr->bgGC;
+ break;
+ case TK_RELIEF_GROOVE:
+ topGC = borderPtr->darkGC;
+ bottomGC = borderPtr->lightGC;
+ break;
+ case TK_RELIEF_RAISED:
+ topGC = bottomGC = (topBevel? borderPtr->lightGC : borderPtr->darkGC);
+ break;
+ case TK_RELIEF_RIDGE:
+ topGC = borderPtr->lightGC;
+ bottomGC = borderPtr->darkGC;
+ break;
+ case TK_RELIEF_SOLID:
+ if (unixBorderPtr->solidGC == None) {
+ XGCValues gcValues;
+
+ gcValues.foreground = BlackPixelOfScreen(borderPtr->screen);
+ unixBorderPtr->solidGC = Tk_GetGC(tkwin, GCForeground, &gcValues);
+ }
+ XFillRectangle(display, drawable, unixBorderPtr->solidGC, x, y,
(unsigned) width, (unsigned) height);
- return;
- case TK_RELIEF_SUNKEN:
- topGC = bottomGC =
- (topBevel) ? borderPtr->darkGC : borderPtr->lightGC;
- break;
+ return;
+ case TK_RELIEF_SUNKEN:
+ topGC = bottomGC = (topBevel? borderPtr->darkGC : borderPtr->lightGC);
+ break;
}
/*
@@ -292,24 +286,26 @@ Tk_3DHorizontalBevel(tkwin, drawable, border, x, y, width, height,
for ( ; y < bottom; y++) {
/*
- * X Dimensions are 16-bit, so avoid wraparound or display errors
- * by limiting these here.
+ * X Dimensions are 16-bit, so avoid wraparound or display errors by
+ * limiting these here.
*/
- if (x1 < -32767)
+
+ if (x1 < -32767) {
x1 = -32767;
- if (x2 > 32767)
+ }
+ if (x2 > 32767) {
x2 = 32767;
+ }
/*
* In some weird cases (such as large border widths for skinny
- * rectangles) x1 can be >= x2. Don't draw the lines
- * in these cases.
+ * rectangles) x1 can be >= x2. Don't draw the lines in these cases.
*/
if (x1 < x2) {
XFillRectangle(display, drawable,
- (y < halfway) ? topGC : bottomGC, x1, y,
- (unsigned) (x2-x1), (unsigned) 1);
+ (y < halfway) ? topGC : bottomGC, x1, y,
+ (unsigned) (x2-x1), (unsigned) 1);
}
x1 += x1Delta;
x2 += x2Delta;
@@ -321,27 +317,26 @@ Tk_3DHorizontalBevel(tkwin, drawable, border, x, y, width, height,
*
* TkpGetShadows --
*
- * This procedure computes the shadow colors for a 3-D border
- * and fills in the corresponding fields of the Border structure.
- * It's called lazily, so that the colors aren't allocated until
- * something is actually drawn with them. That way, if a border
- * is only used for flat backgrounds the shadow colors will
- * never be allocated.
+ * This procedure computes the shadow colors for a 3-D border and fills
+ * in the corresponding fields of the Border structure. It's called
+ * lazily, so that the colors aren't allocated until something is
+ * actually drawn with them. That way, if a border is only used for flat
+ * backgrounds the shadow colors will never be allocated.
*
* Results:
* None.
*
* Side effects:
- * The lightGC and darkGC fields in borderPtr get filled in,
- * if they weren't already.
+ * The lightGC and darkGC fields in borderPtr get filled in, if they
+ * weren't already.
*
*----------------------------------------------------------------------
*/
void
-TkpGetShadows(borderPtr, tkwin)
- TkBorder *borderPtr; /* Information about border. */
- Tk_Window tkwin; /* Window where border will be used for
+TkpGetShadows(
+ TkBorder *borderPtr, /* Information about border. */
+ Tk_Window tkwin) /* Window where border will be used for
* drawing. */
{
XColor lightColor, darkColor;
@@ -355,37 +350,35 @@ TkpGetShadows(borderPtr, tkwin)
stressed = TkpCmapStressed(tkwin, borderPtr->colormap);
/*
- * First, handle the case of a color display with lots of colors.
- * The shadow colors get computed using whichever formula results
- * in the greatest change in color:
- * 1. Lighter shadow is half-way to white, darker shadow is half
- * way to dark.
- * 2. Lighter shadow is 40% brighter than background, darker shadow
- * is 40% darker than background.
+ * First, handle the case of a color display with lots of colors. The
+ * shadow colors get computed using whichever formula results in the
+ * greatest change in color:
+ * 1. Lighter shadow is half-way to white, darker shadow is half way to
+ * dark.
+ * 2. Lighter shadow is 40% brighter than background, darker shadow is 40%
+ * darker than background.
*/
if (!stressed && (Tk_Depth(tkwin) >= 6)) {
/*
- * This is a color display with lots of colors. For the dark
- * shadow, cut 40% from each of the background color components.
- * But if the background is already very dark, make the
- * dark color a little lighter than the background by increasing
- * each color component 1/4th of the way to MAX_INTENSITY.
+ * This is a color display with lots of colors. For the dark shadow,
+ * cut 40% from each of the background color components. But if the
+ * background is already very dark, make the dark color a little
+ * lighter than the background by increasing each color component
+ * 1/4th of the way to MAX_INTENSITY.
*
- * For the light shadow, boost each component by 40% or half-way
- * to white, whichever is greater (the first approach works
- * better for unsaturated colors, the second for saturated ones).
- * But if the background is already very bright, instead choose a
- * slightly darker color for the light shadow by reducing each
- * color component by 10%.
+ * For the light shadow, boost each component by 40% or half-way to
+ * white, whichever is greater (the first approach works better for
+ * unsaturated colors, the second for saturated ones). But if the
+ * background is already very bright, instead choose a slightly darker
+ * color for the light shadow by reducing each color component by 10%.
*
- * Compute the colors using integers, not using lightColor.red
- * etc.: these are shorts and may have problems with integer
- * overflow.
+ * Compute the colors using integers, not using lightColor.red etc.:
+ * these are shorts and may have problems with integer overflow.
*/
/*
- * Compute the dark shadow color
+ * Compute the dark shadow color.
*/
r = (int) borderPtr->bgColorPtr->red;
@@ -403,7 +396,7 @@ TkpGetShadows(borderPtr, tkwin)
}
/*
- * Allocate the dark shadow color and its GC
+ * Allocate the dark shadow color and its GC.
*/
borderPtr->darkColorPtr = Tk_GetColorByValue(tkwin, &darkColor);
@@ -411,7 +404,7 @@ TkpGetShadows(borderPtr, tkwin)
borderPtr->darkGC = Tk_GetGC(tkwin, GCForeground, &gcValues);
/*
- * Compute the light shadow color
+ * Compute the light shadow color.
*/
if (g > MAX_INTENSITY*0.95) {
@@ -438,10 +431,10 @@ TkpGetShadows(borderPtr, tkwin)
tmp2 = (MAX_INTENSITY + b)/2;
lightColor.blue = (tmp1 > tmp2) ? tmp1 : tmp2;
}
-
- /*
- * Allocate the light shadow color and its GC
- */
+
+ /*
+ * Allocate the light shadow color and its GC.
+ */
borderPtr->lightColorPtr = Tk_GetColorByValue(tkwin, &lightColor);
gcValues.foreground = borderPtr->lightColorPtr->pixel;
@@ -453,15 +446,15 @@ TkpGetShadows(borderPtr, tkwin)
borderPtr->shadow = Tk_GetBitmap((Tcl_Interp *) NULL, tkwin,
Tk_GetUid("gray50"));
if (borderPtr->shadow == None) {
- panic("TkpGetShadows couldn't allocate bitmap for border");
+ Tcl_Panic("TkpGetShadows couldn't allocate bitmap for border");
}
}
if (borderPtr->visual->map_entries > 2) {
/*
- * This isn't a monochrome display, but the colormap either
- * ran out of entries or didn't have very many to begin with.
- * Generate the light shadows with a white stipple and the
- * dark shadows with a black stipple.
+ * This isn't a monochrome display, but the colormap either ran out of
+ * entries or didn't have very many to begin with. Generate the light
+ * shadows with a white stipple and the dark shadows with a black
+ * stipple.
*/
gcValues.foreground = borderPtr->bgColorPtr->pixel;
@@ -478,8 +471,8 @@ TkpGetShadows(borderPtr, tkwin)
/*
* This is just a measly monochrome display, hardly even worth its
- * existence on this earth. Make one shadow a 50% stipple and the
- * other the opposite of the background.
+ * existence on this earth. Make one shadow a 50% stipple and the other
+ * the opposite of the background.
*/
gcValues.foreground = WhitePixelOfScreen(borderPtr->screen);
@@ -497,3 +490,11 @@ TkpGetShadows(borderPtr, tkwin)
borderPtr->lightGC = Tk_GetGC(tkwin, GCForeground, &gcValues);
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c
index d14f30d..e45812e 100644
--- a/unix/tkUnixButton.c
+++ b/unix/tkUnixButton.c
@@ -1,16 +1,27 @@
-/*
+/*
* tkUnixButton.c --
*
- * This file implements the Unix specific portion of the button
- * widgets.
+ * This file implements the Unix specific portion of the button widgets.
*
* Copyright (c) 1996-1997 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * 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 "tkButton.h"
+#include "tk3d.h"
+
+/*
+ * Shared with menu widget.
+ */
+
+MODULE_SCOPE void TkpDrawCheckIndicator(Tk_Window tkwin,
+ Display *display, Drawable d, int x, int y,
+ Tk_3DBorder bgBorder, XColor *indicatorColor,
+ XColor *selectColor, XColor *disColor, int on,
+ int disabled, int mode);
/*
* Declaration of Unix specific button structure.
@@ -21,13 +32,281 @@ typedef struct UnixButton {
} UnixButton;
/*
- * The class procedure table for the button widgets.
+ * The class function table for the button widgets.
*/
-Tk_ClassProcs tkpButtonProcs = {
+const Tk_ClassProcs tkpButtonProcs = {
sizeof(Tk_ClassProcs), /* size */
TkButtonWorldChanged, /* worldChangedProc */
+ NULL, /* createProc */
+ NULL /* modalProc */
+};
+
+/*
+ * The button image.
+ * The header info here is ignored, it's the image that's important. The
+ * colors will be applied as follows:
+ * A = Background
+ * B = Background
+ * C = 3D light
+ * D = selectColor
+ * E = 3D dark
+ * F = Background
+ * G = Indicator Color
+ * H = disabled Indicator Color
+ */
+
+/* XPM */
+static const char *const button_images[] = {
+ /* width height ncolors chars_per_pixel */
+ "52 26 7 1",
+ /* colors */
+ "A c #808000000000",
+ "B c #000080800000",
+ "C c #808080800000",
+ "D c #000000008080",
+ "E c #808000008080",
+ "F c #000080808080",
+ "G c #000000000000",
+ "H c #000080800000",
+ /* pixels */
+ "AAAAAAAAAAAABAAAAAAAAAAAABAAAAAAAAAAAABAAAAAAAAAAAAB",
+ "AEEEEEEEEEECBAEEEEEEEEEECBAEEEEEEEEEECBAEEEEEEEEEECB",
+ "AEDDDDDDDDDCBAEDDDDDDDDDCBAEFFFFFFFFFCBAEFFFFFFFFFCB",
+ "AEDDDDDDDDDCBAEDDDDDDDGDCBAEFFFFFFFFFCBAEFFFFFFFHFCB",
+ "AEDDDDDDDDDCBAEDDDDDDGGDCBAEFFFFFFFFFCBAEFFFFFFHHFCB",
+ "AEDDDDDDDDDCBAEDGDDDGGGDCBAEFFFFFFFFFCBAEFHFFFHHHFCB",
+ "AEDDDDDDDDDCBAEDGGDGGGDDCBAEFFFFFFFFFCBAEFHHFHHHFFCB",
+ "AEDDDDDDDDDCBAEDGGGGGDDDCBAEFFFFFFFFFCBAEFHHHHHFFFCB",
+ "AEDDDDDDDDDCBAEDDGGGDDDDCBAEFFFFFFFFFCBAEFFHHHFFFFCB",
+ "AEDDDDDDDDDCBAEDDDGDDDDDCBAEFFFFFFFFFCBAEFFFHFFFFFCB",
+ "AEDDDDDDDDDCBAEDDDDDDDDDCBAEFFFFFFFFFCBAEFFFFFFFFFCB",
+ "ACCCCCCCCCCCBACCCCCCCCCCCBACCCCCCCCCCCBACCCCCCCCCCCB",
+ "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
+ "FFFFAAAAFFFFFFFFFAAAAFFFFFFFFFAAAAFFFFFFFFFAAAAFFFFF",
+ "FFAAEEEEAAFFFFFAAEEEEAAFFFFFAAEEEEAAFFFFFAAEEEEAAFFF",
+ "FAEEDDDDEEBFFFAEEDDDDEEBFFFAEEFFFFEEBFFFAEEFFFFEEBFF",
+ "FAEDDDDDDCBFFFAEDDDDDDCBFFFAEFFFFFFCBFFFAEFFFFFFCBFF",
+ "AEDDDDDDDDCBFAEDDDGGDDDCBFAEFFFFFFFFCBFAEFFFHHFFFCBF",
+ "AEDDDDDDDDCBFAEDDGGGGDDCBFAEFFFFFFFFCBFAEFFHHHHFFCBF",
+ "AEDDDDDDDDCBFAEDDGGGGDDCBFAEFFFFFFFFCBFAEFFHHHHFFCBF",
+ "AEDDDDDDDDCBFAEDDDGGDDDCBFAEFFFFFFFFCBFAEFFFHHFFFCBF",
+ "FAEDDDDDDCBFFFAEDDDDDDCBFFFAEFFFFFFCBFFFAEFFFFFFCBFF",
+ "FACCDDDDCCBFFFACCDDDDCCBFFFACCFFFFCCBFFFACCFFFFCCBFF",
+ "FFBBCCCCBBFFFFFBBCCCCBBFFFFFBBCCCCBBFFFFFBBCCCCBBFFF",
+ "FFFFBBBBFFFFFFFFFBBBBFFFFFFFFFBBBBFFFFFFFFFBBBBFFFFF",
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
};
+
+/*
+ * Sizes and offsets into above XPM file.
+ */
+
+#define CHECK_BUTTON_DIM 13
+#define CHECK_MENU_DIM 9
+#define CHECK_START 9
+#define CHECK_ON_OFFSET 13
+#define CHECK_OFF_OFFSET 0
+#define CHECK_DISON_OFFSET 39
+#define CHECK_DISOFF_OFFSET 26
+#define RADIO_BUTTON_DIM 12
+#define RADIO_MENU_DIM 6
+#define RADIO_WIDTH 13
+#define RADIO_START 22
+#define RADIO_ON_OFFSET 13
+#define RADIO_OFF_OFFSET 0
+#define RADIO_DISON_OFFSET 39
+#define RADIO_DISOFF_OFFSET 26
+
+/*
+ * Indicator Draw Modes
+ */
+
+#define CHECK_BUTTON 0
+#define CHECK_MENU 1
+#define RADIO_BUTTON 2
+#define RADIO_MENU 3
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDrawCheckIndicator -
+ *
+ * Draws the checkbox image in the drawable at the (x,y) location, value,
+ * and state given. This routine is use by the button and menu widgets
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * An image is drawn in the drawable at the location given.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDrawCheckIndicator(
+ Tk_Window tkwin, /* handle for resource alloc */
+ Display *display,
+ Drawable d, /* what to draw on */
+ int x, int y, /* where to draw */
+ Tk_3DBorder bgBorder, /* colors of the border */
+ XColor *indicatorColor, /* color of the indicator */
+ XColor *selectColor, /* color when selected */
+ XColor *disableColor, /* color when disabled */
+ int on, /* are we on? */
+ int disabled, /* are we disabled? */
+ int mode) /* kind of indicator to draw */
+{
+ int ix, iy;
+ int dim;
+ int imgsel, imgstart;
+ TkBorder *bg_brdr = (TkBorder*)bgBorder;
+ XGCValues gcValues;
+ GC copyGC;
+ unsigned long imgColors[8];
+ XImage *img;
+ Pixmap pixmap;
+ int depth;
+
+ /*
+ * Sanity check.
+ */
+
+ if (tkwin == NULL || display == None || d == None || bgBorder == NULL
+ || indicatorColor == NULL) {
+ return;
+ }
+
+ if (disableColor == NULL) {
+ disableColor = bg_brdr->bgColorPtr;
+ }
+
+ if (selectColor == NULL) {
+ selectColor = bg_brdr->bgColorPtr;
+ }
+
+ depth = Tk_Depth(tkwin);
+
+ /*
+ * Compute starting point and dimensions of image inside button_images to
+ * be used.
+ */
+
+ switch (mode) {
+ default:
+ case CHECK_BUTTON:
+ imgsel = on == 2 ? CHECK_DISON_OFFSET :
+ on == 1 ? CHECK_ON_OFFSET : CHECK_OFF_OFFSET;
+ imgsel += disabled && on != 2 ? CHECK_DISOFF_OFFSET : 0;
+ imgstart = CHECK_START;
+ dim = CHECK_BUTTON_DIM;
+ break;
+
+ case CHECK_MENU:
+ imgsel = on == 2 ? CHECK_DISOFF_OFFSET :
+ on == 1 ? CHECK_ON_OFFSET : CHECK_OFF_OFFSET;
+ imgsel += disabled && on != 2 ? CHECK_DISOFF_OFFSET : 0;
+ imgstart = CHECK_START + 2;
+ imgsel += 2;
+ dim = CHECK_MENU_DIM;
+ break;
+
+ case RADIO_BUTTON:
+ imgsel = on == 2 ? RADIO_DISON_OFFSET :
+ on==1 ? RADIO_ON_OFFSET : RADIO_OFF_OFFSET;
+ imgsel += disabled && on != 2 ? RADIO_DISOFF_OFFSET : 0;
+ imgstart = RADIO_START;
+ dim = RADIO_BUTTON_DIM;
+ break;
+
+ case RADIO_MENU:
+ imgsel = on == 2 ? RADIO_DISOFF_OFFSET :
+ on==1 ? RADIO_ON_OFFSET : RADIO_OFF_OFFSET;
+ imgsel += disabled && on != 2 ? RADIO_DISOFF_OFFSET : 0;
+ imgstart = RADIO_START + 3;
+ imgsel += 3;
+ dim = RADIO_MENU_DIM;
+ break;
+ }
+
+ /*
+ * Allocate the drawing areas to use. Note that we use double-buffering
+ * here because not all code paths leading to this function do so.
+ */
+
+ pixmap = Tk_GetPixmap(display, d, dim, dim, depth);
+ if (pixmap == None) {
+ return;
+ }
+
+ x -= dim/2;
+ y -= dim/2;
+
+ img = XGetImage(display, pixmap, 0, 0,
+ (unsigned int)dim, (unsigned int)dim, AllPlanes, ZPixmap);
+ if (img == NULL) {
+ return;
+ }
+
+ /*
+ * Set up the color mapping table.
+ */
+
+ TkpGetShadows(bg_brdr, tkwin);
+
+ imgColors[0 /*A*/] =
+ Tk_GetColorByValue(tkwin, bg_brdr->bgColorPtr)->pixel;
+ imgColors[1 /*B*/] =
+ Tk_GetColorByValue(tkwin, bg_brdr->bgColorPtr)->pixel;
+ imgColors[2 /*C*/] = (bg_brdr->lightColorPtr != NULL) ?
+ Tk_GetColorByValue(tkwin, bg_brdr->lightColorPtr)->pixel :
+ WhitePixelOfScreen(bg_brdr->screen);
+ imgColors[3 /*D*/] =
+ Tk_GetColorByValue(tkwin, selectColor)->pixel;
+ imgColors[4 /*E*/] = (bg_brdr->darkColorPtr != NULL) ?
+ Tk_GetColorByValue(tkwin, bg_brdr->darkColorPtr)->pixel :
+ BlackPixelOfScreen(bg_brdr->screen);
+ imgColors[5 /*F*/] =
+ Tk_GetColorByValue(tkwin, bg_brdr->bgColorPtr)->pixel;
+ imgColors[6 /*G*/] =
+ Tk_GetColorByValue(tkwin, indicatorColor)->pixel;
+ imgColors[7 /*H*/] =
+ Tk_GetColorByValue(tkwin, disableColor)->pixel;
+
+ /*
+ * Create the image, painting it into an XImage one pixel at a time.
+ */
+
+ for (iy=0 ; iy<dim ; iy++) {
+ for (ix=0 ; ix<dim ; ix++) {
+ XPutPixel(img, ix, iy,
+ imgColors[button_images[imgstart+iy][imgsel+ix] - 'A']);
+ }
+ }
+
+ /*
+ * Copy onto our target drawable surface.
+ */
+
+ memset(&gcValues, 0, sizeof(gcValues));
+ gcValues.background = bg_brdr->bgColorPtr->pixel;
+ gcValues.graphics_exposures = False;
+ copyGC = Tk_GetGC(tkwin, 0, &gcValues);
+
+ XPutImage(display, pixmap, copyGC, img, 0, 0, 0, 0,
+ (unsigned)dim, (unsigned)dim);
+ XCopyArea(display, pixmap, d, copyGC, 0, 0,
+ (unsigned)dim, (unsigned)dim, x, y);
+
+ /*
+ * Tidy up.
+ */
+
+ Tk_FreeGC(display, copyGC);
+ XDestroyImage(img);
+ Tk_FreePixmap(display, pixmap);
+}
/*
*----------------------------------------------------------------------
@@ -46,10 +325,11 @@ Tk_ClassProcs tkpButtonProcs = {
*/
TkButton *
-TkpCreateButton(tkwin)
- Tk_Window tkwin;
+TkpCreateButton(
+ Tk_Window tkwin)
{
- UnixButton *butPtr = (UnixButton *)ckalloc(sizeof(UnixButton));
+ UnixButton *butPtr = ckalloc(sizeof(UnixButton));
+
return (TkButton *) butPtr;
}
@@ -58,29 +338,29 @@ TkpCreateButton(tkwin)
*
* TkpDisplayButton --
*
- * This procedure is invoked to display a button widget. It is
- * normally invoked as an idle handler.
+ * This function is invoked to display a button widget. It is normally
+ * invoked as an idle handler.
*
* Results:
* None.
*
* Side effects:
- * Commands are output to X to display the button in its
- * current mode. The REDRAW_PENDING flag is cleared.
+ * Commands are output to X to display the button in its current mode.
+ * The REDRAW_PENDING flag is cleared.
*
*----------------------------------------------------------------------
*/
void
-TkpDisplayButton(clientData)
- ClientData clientData; /* Information about widget. */
+TkpDisplayButton(
+ ClientData clientData) /* Information about widget. */
{
register TkButton *butPtr = (TkButton *) clientData;
GC gc;
Tk_3DBorder border;
Pixmap pixmap;
- int x = 0; /* Initialization only needed to stop
- * compiler warning. */
+ int x = 0; /* Initialization only needed to stop compiler
+ * warning. */
int y, relief;
Tk_Window tkwin = butPtr->tkwin;
int width, height, fullWidth, fullHeight;
@@ -88,12 +368,12 @@ TkpDisplayButton(clientData)
int haveImage = 0, haveText = 0;
int offset; /* 1 means this is a button widget, so we
* offset the text to make the button appear
- * to move up and down as the relief changes.
- */
+ * to move up and down as the relief
+ * changes. */
int imageWidth, imageHeight;
- int imageXOffset = 0, imageYOffset = 0; /* image information that will
- * be used to restrict disabled
- * pixmap as well */
+ int imageXOffset = 0, imageYOffset = 0;
+ /* image information that will be used to
+ * restrict disabled pixmap as well */
butPtr->flags &= ~REDRAW_PENDING;
if ((butPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
@@ -110,15 +390,14 @@ TkpDisplayButton(clientData)
} else {
gc = butPtr->normalTextGC;
}
- if ((butPtr->flags & SELECTED) && (butPtr->state != STATE_ACTIVE)
- && (butPtr->selectBorder != NULL) && !butPtr->indicatorOn) {
+ if ((butPtr->flags & SELECTED) && (butPtr->selectBorder != NULL)
+ && !butPtr->indicatorOn) {
border = butPtr->selectBorder;
}
/*
- * Override the relief specified for the button if this is a
- * checkbutton or radiobutton and there's no indicator. The new
- * relief is as follows:
+ * Override the relief specified for the button if this is a checkbutton
+ * or radiobutton and there's no indicator. The new relief is as follows:
* If the button is select --> "sunken"
* If relief==overrelief --> relief
* Otherwise --> overrelief
@@ -132,15 +411,15 @@ TkpDisplayButton(clientData)
* on no sunken
* on yes sunken
*
- * This is accomplished by configuring the checkbutton or radiobutton
- * like this:
+ * This is accomplished by configuring the checkbutton or radiobutton like
+ * this:
*
* -indicatoron 0 -overrelief raised -offrelief flat
*
* Bindings (see library/button.tcl) will copy the -overrelief into
- * -relief on mouseover. Hence, we can tell if we are in mouse-over by
- * comparing relief against overRelief. This is an aweful kludge, but
- * it gives use the desired behavior while keeping the code backwards
+ * -relief on mouseover. Hence, we can tell if we are in mouse-over by
+ * comparing relief against overRelief. This is an aweful kludge, but it
+ * gives use the desired behavior while keeping the code backwards
* compatible.
*/
@@ -156,10 +435,10 @@ TkpDisplayButton(clientData)
offset = (butPtr->type == TYPE_BUTTON) && !Tk_StrictMotif(butPtr->tkwin);
/*
- * In order to avoid screen flashes, this procedure redraws
- * the button in a pixmap, then copies the pixmap to the
- * screen in a single operation. This means that there's no
- * point in time where the on-sreen image has been cleared.
+ * In order to avoid screen flashes, this function redraws the button in a
+ * pixmap, then copies the pixmap to the screen in a single operation.
+ * This means that there's no point in time where the on-screen image has
+ * been cleared.
*/
pixmap = Tk_GetPixmap(butPtr->display, Tk_WindowId(tkwin),
@@ -178,11 +457,11 @@ TkpDisplayButton(clientData)
Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height);
haveImage = 1;
}
- imageWidth = width;
+ imageWidth = width;
imageHeight = height;
haveText = (butPtr->textWidth != 0 && butPtr->textHeight != 0);
-
+
if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) {
textXOffset = 0;
textYOffset = 0;
@@ -190,49 +469,56 @@ TkpDisplayButton(clientData)
fullHeight = 0;
switch ((enum compound) butPtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- /* Image is above or below text */
- if (butPtr->compound == COMPOUND_TOP) {
- textYOffset = height + butPtr->padY;
- } else {
- imageYOffset = butPtr->textHeight + butPtr->padY;
- }
- fullHeight = height + butPtr->textHeight + butPtr->padY;
- fullWidth = (width > butPtr->textWidth ? width :
- butPtr->textWidth);
- textXOffset = (fullWidth - butPtr->textWidth)/2;
- imageXOffset = (fullWidth - width)/2;
- break;
- }
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- /* Image is left or right of text */
- if (butPtr->compound == COMPOUND_LEFT) {
- textXOffset = width + butPtr->padX;
- } else {
- imageXOffset = butPtr->textWidth + butPtr->padX;
- }
- fullWidth = butPtr->textWidth + butPtr->padX + width;
- fullHeight = (height > butPtr->textHeight ? height :
- butPtr->textHeight);
- textYOffset = (fullHeight - butPtr->textHeight)/2;
- imageYOffset = (fullHeight - height)/2;
- break;
+ case COMPOUND_TOP:
+ case COMPOUND_BOTTOM:
+ /*
+ * Image is above or below text.
+ */
+
+ if (butPtr->compound == COMPOUND_TOP) {
+ textYOffset = height + butPtr->padY;
+ } else {
+ imageYOffset = butPtr->textHeight + butPtr->padY;
}
- case COMPOUND_CENTER: {
- /* Image and text are superimposed */
- fullWidth = (width > butPtr->textWidth ? width :
- butPtr->textWidth);
- fullHeight = (height > butPtr->textHeight ? height :
- butPtr->textHeight);
- textXOffset = (fullWidth - butPtr->textWidth)/2;
- imageXOffset = (fullWidth - width)/2;
- textYOffset = (fullHeight - butPtr->textHeight)/2;
- imageYOffset = (fullHeight - height)/2;
- break;
+ fullHeight = height + butPtr->textHeight + butPtr->padY;
+ fullWidth = (width > butPtr->textWidth ? width :
+ butPtr->textWidth);
+ textXOffset = (fullWidth - butPtr->textWidth)/2;
+ imageXOffset = (fullWidth - width)/2;
+ break;
+ case COMPOUND_LEFT:
+ case COMPOUND_RIGHT:
+ /*
+ * Image is left or right of text.
+ */
+
+ if (butPtr->compound == COMPOUND_LEFT) {
+ textXOffset = width + butPtr->padX;
+ } else {
+ imageXOffset = butPtr->textWidth + butPtr->padX;
}
- case COMPOUND_NONE: {break;}
+ fullWidth = butPtr->textWidth + butPtr->padX + width;
+ fullHeight = (height > butPtr->textHeight ? height :
+ butPtr->textHeight);
+ textYOffset = (fullHeight - butPtr->textHeight)/2;
+ imageYOffset = (fullHeight - height)/2;
+ break;
+ case COMPOUND_CENTER:
+ /*
+ * Image and text are superimposed.
+ */
+
+ fullWidth = (width > butPtr->textWidth ? width :
+ butPtr->textWidth);
+ fullHeight = (height > butPtr->textHeight ? height :
+ butPtr->textHeight);
+ textXOffset = (fullWidth - butPtr->textWidth)/2;
+ imageXOffset = (fullWidth - width)/2;
+ textYOffset = (fullHeight - butPtr->textHeight)/2;
+ imageYOffset = (fullHeight - height)/2;
+ break;
+ case COMPOUND_NONE:
+ break;
}
TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY,
@@ -255,8 +541,8 @@ TkpDisplayButton(clientData)
if (butPtr->image != NULL) {
/*
- * Do boundary clipping, so that Tk_RedrawImage is passed
- * valid coordinates. [Bug 979239]
+ * Do boundary clipping, so that Tk_RedrawImage is passed valid
+ * coordinates. [Bug 979239]
*/
if (imageXOffset < 0) {
@@ -281,6 +567,9 @@ TkpDisplayButton(clientData)
if ((butPtr->selectImage != NULL) && (butPtr->flags & SELECTED)) {
Tk_RedrawImage(butPtr->selectImage, 0, 0,
width, height, pixmap, imageXOffset, imageYOffset);
+ } else if ((butPtr->tristateImage != NULL) && (butPtr->flags & TRISTATED)) {
+ Tk_RedrawImage(butPtr->tristateImage, 0, 0,
+ width, height, pixmap, imageXOffset, imageYOffset);
} else {
Tk_RedrawImage(butPtr->image, 0, 0, width,
height, pixmap, imageXOffset, imageYOffset);
@@ -304,7 +593,7 @@ TkpDisplayButton(clientData)
TkComputeAnchor(butPtr->anchor, tkwin, 0, 0,
butPtr->indicatorSpace + width, height, &x, &y);
x += butPtr->indicatorSpace;
-
+
x += offset;
y += offset;
if (relief == TK_RELIEF_RAISED) {
@@ -345,6 +634,10 @@ TkpDisplayButton(clientData)
(butPtr->flags & SELECTED)) {
Tk_RedrawImage(butPtr->selectImage, 0, 0, width,
height, pixmap, imageXOffset, imageYOffset);
+ } else if ((butPtr->tristateImage != NULL) &&
+ (butPtr->flags & TRISTATED)) {
+ Tk_RedrawImage(butPtr->tristateImage, 0, 0, width,
+ height, pixmap, imageXOffset, imageYOffset);
} else {
Tk_RedrawImage(butPtr->image, 0, 0, width, height, pixmap,
imageXOffset, imageYOffset);
@@ -360,9 +653,9 @@ TkpDisplayButton(clientData)
TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY,
butPtr->indicatorSpace + butPtr->textWidth,
butPtr->textHeight, &x, &y);
-
+
x += butPtr->indicatorSpace;
-
+
x += offset;
y += offset;
if (relief == TK_RELIEF_RAISED) {
@@ -379,104 +672,51 @@ TkpDisplayButton(clientData)
y += butPtr->textHeight/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) {
- int dim;
-
- dim = butPtr->indicatorDiameter;
- x -= butPtr->indicatorSpace;
- y -= dim/2;
- if (dim > 2*butPtr->borderWidth) {
- Tk_Draw3DRectangle(tkwin, pixmap, border, x, y, dim, dim,
- butPtr->borderWidth,
- (butPtr->flags & SELECTED) ? TK_RELIEF_SUNKEN :
- TK_RELIEF_RAISED);
- x += butPtr->borderWidth;
- y += butPtr->borderWidth;
- dim -= 2*butPtr->borderWidth;
- if (butPtr->flags & SELECTED) {
- GC gc;
- if (butPtr->state != STATE_DISABLED) {
- if (butPtr->selectBorder != NULL) {
- gc = Tk_3DBorderGC(tkwin, butPtr->selectBorder,
- TK_3D_FLAT_GC);
- } else {
- gc = Tk_3DBorderGC(tkwin, butPtr->normalBorder,
- TK_3D_FLAT_GC);
- }
- } else {
- if (butPtr->disabledFg != NULL) {
- gc = butPtr->disabledGC;
- } else {
- gc = butPtr->normalTextGC;
- XSetForeground(butPtr->display, butPtr->disabledGC,
- Tk_3DBorderColor(butPtr->normalBorder)->pixel);
- }
- }
+ if (butPtr->indicatorDiameter > 2*butPtr->borderWidth) {
+ TkBorder *selBorder = (TkBorder *) butPtr->selectBorder;
+ XColor *selColor = NULL;
- XFillRectangle(butPtr->display, pixmap, gc, x, y,
- (unsigned int) dim, (unsigned int) dim);
- } else {
- Tk_Fill3DRectangle(tkwin, pixmap, butPtr->normalBorder, x, y,
- dim, dim, butPtr->borderWidth, TK_RELIEF_FLAT);
+ if (selBorder != NULL) {
+ selColor = selBorder->bgColorPtr;
}
+ x -= butPtr->indicatorSpace/2;
+ y = Tk_Height(tkwin)/2;
+ TkpDrawCheckIndicator(tkwin, butPtr->display, pixmap, x, y,
+ border, butPtr->normalFg, selColor, butPtr->disabledFg,
+ ((butPtr->flags & SELECTED) ? 1 :
+ (butPtr->flags & TRISTATED) ? 2 : 0),
+ (butPtr->state == STATE_DISABLED), CHECK_BUTTON);
}
} else if ((butPtr->type == TYPE_RADIO_BUTTON) && butPtr->indicatorOn) {
- XPoint points[4];
- int radius;
-
- radius = butPtr->indicatorDiameter/2;
- points[0].x = x - butPtr->indicatorSpace;
- points[0].y = y;
- points[1].x = points[0].x + radius;
- points[1].y = points[0].y + radius;
- points[2].x = points[1].x + radius;
- points[2].y = points[0].y;
- points[3].x = points[1].x;
- points[3].y = points[0].y - radius;
- if (butPtr->flags & SELECTED) {
- GC gc;
+ if (butPtr->indicatorDiameter > 2*butPtr->borderWidth) {
+ TkBorder *selBorder = (TkBorder *) butPtr->selectBorder;
+ XColor *selColor = NULL;
- if (butPtr->state != STATE_DISABLED) {
- if (butPtr->selectBorder != NULL) {
- gc = Tk_3DBorderGC(tkwin, butPtr->selectBorder,
- TK_3D_FLAT_GC);
- } else {
- gc = Tk_3DBorderGC(tkwin, butPtr->normalBorder,
- TK_3D_FLAT_GC);
- }
- } else {
- if (butPtr->disabledFg != NULL) {
- gc = butPtr->disabledGC;
- } else {
- gc = butPtr->normalTextGC;
- XSetForeground(butPtr->display, butPtr->disabledGC,
- Tk_3DBorderColor(butPtr->normalBorder)->pixel);
- }
+ if (selBorder != NULL) {
+ selColor = selBorder->bgColorPtr;
}
-
- XFillPolygon(butPtr->display, pixmap, gc, points, 4, Convex,
- CoordModeOrigin);
- } else {
- Tk_Fill3DPolygon(tkwin, pixmap, butPtr->normalBorder, points,
- 4, butPtr->borderWidth, TK_RELIEF_FLAT);
+ x -= butPtr->indicatorSpace/2;
+ y = Tk_Height(tkwin)/2;
+ TkpDrawCheckIndicator(tkwin, butPtr->display, pixmap, x, y,
+ border, butPtr->normalFg, selColor, butPtr->disabledFg,
+ ((butPtr->flags & SELECTED) ? 1 :
+ (butPtr->flags & TRISTATED) ? 2 : 0),
+ (butPtr->state == STATE_DISABLED), RADIO_BUTTON);
}
- Tk_Draw3DPolygon(tkwin, pixmap, border, points, 4, butPtr->borderWidth,
- (butPtr->flags & SELECTED) ? TK_RELIEF_SUNKEN :
- TK_RELIEF_RAISED);
}
/*
* If the button is disabled with a stipple rather than a special
- * foreground color, generate the stippled effect. If the widget
- * is selected and we use a different background color when selected,
- * must temporarily modify the GC so the stippling is the right color.
+ * foreground color, generate the stippled effect. If the widget is
+ * selected and we use a different background color when selected, must
+ * temporarily modify the GC so the stippling is the right color.
*/
if ((butPtr->state == STATE_DISABLED)
@@ -486,10 +726,12 @@ TkpDisplayButton(clientData)
XSetForeground(butPtr->display, butPtr->stippleGC,
Tk_3DBorderColor(butPtr->selectBorder)->pixel);
}
+
/*
- * Stipple the whole button if no disabledFg was specified,
- * otherwise restrict stippling only to displayed image
+ * Stipple the whole button if no disabledFg was specified, otherwise
+ * restrict stippling only to displayed image
*/
+
if (butPtr->disabledFg == NULL) {
XFillRectangle(butPtr->display, pixmap, butPtr->stippleGC, 0, 0,
(unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin));
@@ -506,11 +748,11 @@ TkpDisplayButton(clientData)
}
/*
- * Draw the border and traversal highlight last. This way, if the
- * button's contents overflow they'll be covered up by the border.
- * This code is complicated by the possible combinations of focus
- * highlight and default rings. We draw the focus and highlight rings
- * using the highlight border and highlight foreground color.
+ * Draw the border and traversal highlight last. This way, if the button's
+ * contents overflow they'll be covered up by the border. This code is
+ * complicated by the possible combinations of focus highlight and default
+ * rings. We draw the focus and highlight rings using the highlight border
+ * and highlight foreground color.
*/
if (relief != TK_RELIEF_FLAT) {
@@ -519,10 +761,10 @@ TkpDisplayButton(clientData)
if (butPtr->defaultState == DEFAULT_ACTIVE) {
/*
* Draw the default ring with 2 pixels of space between the
- * default ring and the button and the default ring and the
- * focus ring. Note that we need to explicitly draw the space
- * in the highlightBorder color to ensure that we overwrite any
- * overflow text and/or a different button background color.
+ * default ring and the button and the default ring and the focus
+ * ring. Note that we need to explicitly draw the space in the
+ * highlightBorder color to ensure that we overwrite any overflow
+ * text and/or a different button background color.
*/
Tk_Draw3DRectangle(tkwin, pixmap, butPtr->highlightBorder, inset,
@@ -581,8 +823,8 @@ TkpDisplayButton(clientData)
}
/*
- * Copy the information from the off-screen pixmap onto the screen,
- * then delete the pixmap.
+ * Copy the information from the off-screen pixmap onto the screen, then
+ * delete the pixmap.
*/
XCopyArea(butPtr->display, pixmap, Tk_WindowId(tkwin),
@@ -596,9 +838,9 @@ TkpDisplayButton(clientData)
*
* TkpComputeButtonGeometry --
*
- * After changes in a button's text or bitmap, this procedure
- * recomputes the button's geometry and passes this information
- * along to the geometry manager for the window.
+ * After changes in a button's text or bitmap, this function recomputes
+ * the button's geometry and passes this information along to the
+ * geometry manager for the window.
*
* Results:
* None.
@@ -610,8 +852,8 @@ TkpDisplayButton(clientData)
*/
void
-TkpComputeButtonGeometry(butPtr)
- register TkButton *butPtr; /* Button whose geometry may have changed. */
+TkpComputeButtonGeometry(
+ register TkButton *butPtr) /* Button whose geometry may have changed. */
{
int width, height, avgWidth, txtWidth, txtHeight;
int haveImage = 0, haveText = 0;
@@ -633,7 +875,7 @@ TkpComputeButtonGeometry(butPtr)
txtWidth = 0;
txtHeight = 0;
avgWidth = 0;
-
+
if (butPtr->image != NULL) {
Tk_SizeOfImage(butPtr->image, &width, &height);
haveImage = 1;
@@ -641,51 +883,58 @@ TkpComputeButtonGeometry(butPtr)
Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height);
haveImage = 1;
}
-
+
if (haveImage == 0 || butPtr->compound != COMPOUND_NONE) {
Tk_FreeTextLayout(butPtr->textLayout);
-
+
butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont,
Tcl_GetString(butPtr->textPtr), -1, butPtr->wrapLength,
butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight);
-
+
txtWidth = butPtr->textWidth;
txtHeight = butPtr->textHeight;
avgWidth = Tk_TextWidth(butPtr->tkfont, "0", 1);
Tk_GetFontMetrics(butPtr->tkfont, &fm);
haveText = (txtWidth != 0 && txtHeight != 0);
}
-
+
/*
- * If the button is compound (ie, it shows both an image and text),
- * the new geometry is a combination of the image and text geometry.
- * We only honor the compound bit if the button has both text and an
- * image, because otherwise it is not really a compound button.
+ * If the button is compound (i.e., it shows both an image and text), the
+ * new geometry is a combination of the image and text geometry. We only
+ * honor the compound bit if the button has both text and an image,
+ * because otherwise it is not really a compound button.
*/
if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) {
switch ((enum compound) butPtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- /* Image is above or below text */
- height += txtHeight + butPtr->padY;
- width = (width > txtWidth ? width : txtWidth);
- break;
- }
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- /* Image is left or right of text */
- width += txtWidth + butPtr->padX;
- height = (height > txtHeight ? height : txtHeight);
- break;
- }
- case COMPOUND_CENTER: {
- /* Image and text are superimposed */
- width = (width > txtWidth ? width : txtWidth);
- height = (height > txtHeight ? height : txtHeight);
- break;
- }
- case COMPOUND_NONE: {break;}
+ case COMPOUND_TOP:
+ case COMPOUND_BOTTOM:
+ /*
+ * Image is above or below text.
+ */
+
+ height += txtHeight + butPtr->padY;
+ width = (width > txtWidth ? width : txtWidth);
+ break;
+ case COMPOUND_LEFT:
+ case COMPOUND_RIGHT:
+ /*
+ * Image is left or right of text.
+ */
+
+ width += txtWidth + butPtr->padX;
+ height = (height > txtHeight ? height : txtHeight);
+ break;
+ case COMPOUND_CENTER:
+ /*
+ * Image and text are superimposed.
+ */
+
+ width = (width > txtWidth ? width : txtWidth);
+ height = (height > txtHeight ? height : txtHeight);
+ break;
+ case COMPOUND_NONE:
+ break;
}
if (butPtr->width > 0) {
width = butPtr->width;
@@ -705,7 +954,6 @@ TkpComputeButtonGeometry(butPtr)
width += 2*butPtr->padX;
height += 2*butPtr->padY;
-
} else {
if (haveImage) {
if (butPtr->width > 0) {
@@ -714,7 +962,7 @@ TkpComputeButtonGeometry(butPtr)
if (butPtr->height > 0) {
height = butPtr->height;
}
-
+
if ((butPtr->type >= TYPE_CHECK_BUTTON) && butPtr->indicatorOn) {
butPtr->indicatorSpace = height;
if (butPtr->type == TYPE_CHECK_BUTTON) {
@@ -726,7 +974,7 @@ TkpComputeButtonGeometry(butPtr)
} else {
width = txtWidth;
height = txtHeight;
-
+
if (butPtr->width > 0) {
width = butPtr->width * avgWidth;
}
@@ -747,8 +995,8 @@ TkpComputeButtonGeometry(butPtr)
/*
* When issuing the geometry request, add extra space for the indicator,
* if any, and for the border and padding, plus two extra pixels so the
- * display can be offset by 1 pixel in either direction for the raised
- * or lowered effect.
+ * display can be offset by 1 pixel in either direction for the raised or
+ * lowered effect.
*/
if ((butPtr->image == NULL) && (butPtr->bitmap == None)) {
@@ -763,3 +1011,11 @@ TkpComputeButtonGeometry(butPtr)
+ 2*butPtr->inset), (int) (height + 2*butPtr->inset));
Tk_SetInternalBorder(butPtr->tkwin, butPtr->inset);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixColor.c b/unix/tkUnixColor.c
index aebbbca..aa01f24 100644
--- a/unix/tkUnixColor.c
+++ b/unix/tkUnixColor.c
@@ -1,52 +1,52 @@
-/*
+/*
* tkUnixColor.c --
*
- * This file contains the platform specific color routines
- * needed for X support.
+ * This file contains the platform specific color routines needed for X
+ * support.
*
* Copyright (c) 1996 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include <tkColor.h>
+#include "tkUnixInt.h"
+#include "tkColor.h"
/*
- * If a colormap fills up, attempts to allocate new colors from that
- * colormap will fail. When that happens, we'll just choose the
- * closest color from those that are available in the colormap.
- * One of the following structures will be created for each "stressed"
- * colormap to keep track of the colors that are available in the
- * colormap (otherwise we would have to re-query from the server on
- * each allocation, which would be very slow). These entries are
- * flushed after a few seconds, since other clients may release or
+ * If a colormap fills up, attempts to allocate new colors from that colormap
+ * will fail. When that happens, we'll just choose the closest color from
+ * those that are available in the colormap. One of the following structures
+ * will be created for each "stressed" colormap to keep track of the colors
+ * that are available in the colormap (otherwise we would have to re-query
+ * from the server on each allocation, which would be very slow). These
+ * entries are flushed after a few seconds, since other clients may release or
* reallocate colors over time.
*/
struct TkStressedCmap {
- Colormap colormap; /* X's token for the colormap. */
- int numColors; /* Number of entries currently active
- * at *colorPtr. */
- XColor *colorPtr; /* Pointer to malloc'ed array of all
- * colors that seem to be available in
- * the colormap. Some may not actually
- * be available, e.g. because they are
- * read-write for another client; when
- * we find this out, we remove them
- * from the array. */
- struct TkStressedCmap *nextPtr; /* Next in list of all stressed
- * colormaps for the display. */
+ Colormap colormap; /* X's token for the colormap. */
+ int numColors; /* Number of entries currently active at
+ * *colorPtr. */
+ XColor *colorPtr; /* Pointer to malloc'ed array of all colors
+ * that seem to be available in the colormap.
+ * Some may not actually be available, e.g.
+ * because they are read-write for another
+ * client; when we find this out, we remove
+ * them from the array. */
+ struct TkStressedCmap *nextPtr;
+ /* Next in list of all stressed colormaps for
+ * the display. */
};
/*
- * Forward declarations for procedures defined in this file:
+ * Forward declarations for functions defined in this file:
*/
-static void DeleteStressedCmap _ANSI_ARGS_((Display *display,
- Colormap colormap));
-static void FindClosestColor _ANSI_ARGS_((Tk_Window tkwin,
- XColor *desiredColorPtr, XColor *actualColorPtr));
+static void DeleteStressedCmap(Display *display,
+ Colormap colormap);
+static void FindClosestColor(Tk_Window tkwin,
+ XColor *desiredColorPtr, XColor *actualColorPtr);
/*
*----------------------------------------------------------------------
@@ -59,15 +59,15 @@ static void FindClosestColor _ANSI_ARGS_((Tk_Window tkwin,
* None
*
* Side effects:
- * Invalidates the colormap cache for the colormap associated with
- * the given color.
+ * Invalidates the colormap cache for the colormap associated with the
+ * given color.
*
*----------------------------------------------------------------------
*/
void
-TkpFreeColor(tkColPtr)
- TkColor *tkColPtr; /* Color to be released. Must have been
+TkpFreeColor(
+ TkColor *tkColPtr) /* Color to be released. Must have been
* allocated by TkpGetColor or
* TkpGetColorByValue. */
{
@@ -75,14 +75,13 @@ TkpFreeColor(tkColPtr)
Screen *screen = tkColPtr->screen;
/*
- * Careful! Don't free black or white, since this will
- * make some servers very unhappy. Also, there is a bug in
- * some servers (such Sun's X11/NeWS server) where reference
- * counting is performed incorrectly, so that if a color is
- * allocated twice in different places and then freed twice,
- * the second free generates an error (this bug existed as of
- * 10/1/92). To get around this problem, ignore errors that
- * occur during the free operation.
+ * Careful! Don't free black or white, since this will make some servers
+ * very unhappy. Also, there is a bug in some servers (such Sun's X11/NeWS
+ * server) where reference counting is performed incorrectly, so that if a
+ * color is allocated twice in different places and then freed twice, the
+ * second free generates an error (this bug existed as of 10/1/92). To get
+ * around this problem, ignore errors that occur during the free
+ * operation.
*/
visual = tkColPtr->visual;
@@ -92,7 +91,7 @@ TkpFreeColor(tkColPtr)
Tk_ErrorHandler handler;
handler = Tk_CreateErrorHandler(DisplayOfScreen(screen),
- -1, -1, -1, (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ -1, -1, -1, NULL, NULL);
XFreeColors(DisplayOfScreen(screen), tkColPtr->colormap,
&tkColPtr->color.pixel, 1, 0L);
Tk_DeleteErrorHandler(handler);
@@ -112,64 +111,53 @@ TkpFreeColor(tkColPtr)
*
* Side effects:
* May invalidate the colormap cache associated with tkwin upon
- * allocating a new colormap entry. Allocates a new TkColor
- * structure.
+ * allocating a new colormap entry. Allocates a new TkColor structure.
*
*----------------------------------------------------------------------
*/
TkColor *
-TkpGetColor(tkwin, name)
- Tk_Window tkwin; /* Window in which color will be used. */
- Tk_Uid name; /* Name of color to allocated (in form
+TkpGetColor(
+ Tk_Window tkwin, /* Window in which color will be used. */
+ Tk_Uid name) /* Name of color to allocated (in form
* suitable for passing to XParseColor). */
{
Display *display = Tk_Display(tkwin);
Colormap colormap = Tk_Colormap(tkwin);
XColor color;
TkColor *tkColPtr;
- char buf[100];
- unsigned len = strlen(name);
-
- /*
- * Make sure that we never exceed a reasonable length of color name. A
- * good maximum length is 99, arbitrary, but larger than any known color
- * name. [Bug 2809525]
- */
-
- if (len > 99) {
- len = 99;
- }
- memcpy(buf, name, len);
- buf[len] = '\0';
/*
- * Map from the name to a pixel value. Call XAllocNamedColor rather than
+ * Map from the name to a pixel value. Call XAllocNamedColor rather than
* XParseColor for non-# names: this saves a server round-trip for those
* names.
*/
- if (*name != '#') {
+ /* TODO: better wrapper for XAllocNamedColor, for now always use TkParseColor */
+ if (0 && *name != '#') {
XColor screen;
- if (XAllocNamedColor(display, colormap, buf, &screen, &color) != 0) {
+ if (strlen(name) > 99) {
+ /* Don't bother to parse this. [Bug 2809525]*/
+ return (TkColor *) NULL;
+ } else if (XAllocNamedColor(display, colormap, name, &screen, &color) != 0) {
DeleteStressedCmap(display, colormap);
} else {
/*
- * Couldn't allocate the color. Try translating the name to
- * a color value, to see whether the problem is a bad color
- * name or a full colormap. If the colormap is full, then
- * pick an approximation to the desired color.
+ * Couldn't allocate the color. Try translating the name to a
+ * color value, to see whether the problem is a bad color name or
+ * a full colormap. If the colormap is full, then pick an
+ * approximation to the desired color.
*/
- if (XLookupColor(display, colormap, buf, &color, &screen) == 0) {
- return (TkColor *) NULL;
+ if (XLookupColor(display, colormap, name, &color, &screen) == 0) {
+ return NULL;
}
FindClosestColor(tkwin, &screen, &color);
}
} else {
- if (TkParseColor(display, colormap, buf, &color) == 0) {
- return (TkColor *) NULL;
+ if (TkParseColor(display, colormap, name, &color) == 0) {
+ return NULL;
}
if (XAllocColor(display, colormap, &color) != 0) {
DeleteStressedCmap(display, colormap);
@@ -178,7 +166,7 @@ TkpGetColor(tkwin, name)
}
}
- tkColPtr = (TkColor *) ckalloc(sizeof(TkColor));
+ tkColPtr = ckalloc(sizeof(TkColor));
tkColPtr->color = color;
return tkColPtr;
@@ -189,32 +177,31 @@ TkpGetColor(tkwin, name)
*
* TkpGetColorByValue --
*
- * Given a desired set of red-green-blue intensities for a color,
- * locate a pixel value to use to draw that color in a given
- * window.
+ * Given a desired set of red-green-blue intensities for a color, locate
+ * a pixel value to use to draw that color in a given window.
*
* Results:
- * The return value is a pointer to an TkColor structure that
- * indicates the closest red, blue, and green intensities available
- * to those specified in colorPtr, and also specifies a pixel
- * value to use to draw in that color.
+ * The return value is a pointer to an TkColor structure that indicates
+ * the closest red, blue, and green intensities available to those
+ * specified in colorPtr, and also specifies a pixel value to use to draw
+ * in that color.
*
* Side effects:
- * May invalidate the colormap cache for the specified window.
- * Allocates a new TkColor structure.
+ * May invalidate the colormap cache for the specified window. Allocates
+ * a new TkColor structure.
*
*----------------------------------------------------------------------
*/
TkColor *
-TkpGetColorByValue(tkwin, colorPtr)
- Tk_Window tkwin; /* Window in which color will be used. */
- XColor *colorPtr; /* Red, green, and blue fields indicate
+TkpGetColorByValue(
+ Tk_Window tkwin, /* Window in which color will be used. */
+ XColor *colorPtr) /* Red, green, and blue fields indicate
* desired color. */
{
Display *display = Tk_Display(tkwin);
Colormap colormap = Tk_Colormap(tkwin);
- TkColor *tkColPtr = (TkColor *) ckalloc(sizeof(TkColor));
+ TkColor *tkColPtr = ckalloc(sizeof(TkColor));
tkColPtr->color.red = colorPtr->red;
tkColPtr->color.green = colorPtr->green;
@@ -233,15 +220,15 @@ TkpGetColorByValue(tkwin, colorPtr)
*
* FindClosestColor --
*
- * When Tk can't allocate a color because a colormap has filled
- * up, this procedure is called to find and allocate the closest
- * available color in the colormap.
+ * When Tk can't allocate a color because a colormap has filled up, this
+ * function is called to find and allocate the closest available color in
+ * the colormap.
*
* Results:
- * There is no return value, but *actualColorPtr is filled in
- * with information about the closest available color in tkwin's
- * colormap. This color has been allocated via X, so it must
- * be released by the caller when the caller is done with it.
+ * There is no return value, but *actualColorPtr is filled in with
+ * information about the closest available color in tkwin's colormap.
+ * This color has been allocated via X, so it must be released by the
+ * caller when the caller is done with it.
*
* Side effects:
* A color is allocated.
@@ -250,13 +237,12 @@ TkpGetColorByValue(tkwin, colorPtr)
*/
static void
-FindClosestColor(tkwin, desiredColorPtr, actualColorPtr)
- Tk_Window tkwin; /* Window where color will be used. */
- XColor *desiredColorPtr; /* RGB values of color that was
- * wanted (but unavailable). */
- XColor *actualColorPtr; /* Structure to fill in with RGB and
- * pixel for closest available
- * color. */
+FindClosestColor(
+ Tk_Window tkwin, /* Window where color will be used. */
+ XColor *desiredColorPtr, /* RGB values of color that was wanted (but
+ * unavailable). */
+ XColor *actualColorPtr) /* Structure to fill in with RGB and pixel for
+ * closest available color. */
{
TkStressedCmap *stressPtr;
double tmp, distance, closestDistance;
@@ -267,29 +253,33 @@ FindClosestColor(tkwin, desiredColorPtr, actualColorPtr)
XVisualInfo template, *visInfoPtr;
/*
- * Find the TkStressedCmap structure for this colormap, or create
- * a new one if needed.
+ * Find the TkStressedCmap structure for this colormap, or create a new
+ * one if needed.
*/
for (stressPtr = dispPtr->stressPtr; ; stressPtr = stressPtr->nextPtr) {
if (stressPtr == NULL) {
- stressPtr = (TkStressedCmap *) ckalloc(sizeof(TkStressedCmap));
+ stressPtr = ckalloc(sizeof(TkStressedCmap));
stressPtr->colormap = colormap;
template.visualid = XVisualIDFromVisual(Tk_Visual(tkwin));
+
visInfoPtr = XGetVisualInfo(Tk_Display(tkwin),
VisualIDMask, &template, &numFound);
if (numFound < 1) {
- panic("FindClosestColor couldn't lookup visual");
+ Tcl_Panic("FindClosestColor couldn't lookup visual");
}
+
stressPtr->numColors = visInfoPtr->colormap_size;
XFree((char *) visInfoPtr);
- stressPtr->colorPtr = (XColor *) ckalloc((unsigned)
- (stressPtr->numColors * sizeof(XColor)));
- for (i = 0; i < stressPtr->numColors; i++) {
+ stressPtr->colorPtr =
+ ckalloc(stressPtr->numColors * sizeof(XColor));
+ for (i = 0; i < stressPtr->numColors; i++) {
stressPtr->colorPtr[i].pixel = (unsigned long) i;
}
+
XQueryColors(dispPtr->display, colormap, stressPtr->colorPtr,
stressPtr->numColors);
+
stressPtr->nextPtr = dispPtr->stressPtr;
dispPtr->stressPtr = stressPtr;
break;
@@ -300,27 +290,27 @@ FindClosestColor(tkwin, desiredColorPtr, actualColorPtr)
}
/*
- * Find the color that best approximates the desired one, then
- * try to allocate that color. If that fails, it must mean that
- * the color was read-write (so we can't use it, since it's owner
- * might change it) or else it was already freed. Try again,
- * over and over again, until something succeeds.
+ * Find the color that best approximates the desired one, then try to
+ * allocate that color. If that fails, it must mean that the color was
+ * read-write (so we can't use it, since it's owner might change it) or
+ * else it was already freed. Try again, over and over again, until
+ * something succeeds.
*/
- while (1) {
+ while (1) {
if (stressPtr->numColors == 0) {
- panic("FindClosestColor ran out of colors");
+ Tcl_Panic("FindClosestColor ran out of colors");
}
closestDistance = 1e30;
closest = 0;
for (colorPtr = stressPtr->colorPtr, i = 0; i < stressPtr->numColors;
colorPtr++, i++) {
/*
- * Use Euclidean distance in RGB space, weighted by Y (of YIQ)
- * as the objective function; this accounts for differences
- * in the color sensitivity of the eye.
+ * Use Euclidean distance in RGB space, weighted by Y (of YIQ) as
+ * the objective function; this accounts for differences in the
+ * color sensitivity of the eye.
*/
-
+
tmp = .30*(((int) desiredColorPtr->red) - (int) colorPtr->red);
distance = tmp*tmp;
tmp = .61*(((int) desiredColorPtr->green) - (int) colorPtr->green);
@@ -339,8 +329,8 @@ FindClosestColor(tkwin, desiredColorPtr, actualColorPtr)
}
/*
- * Couldn't allocate the color. Remove it from the table and
- * go back to look for the next best color.
+ * Couldn't allocate the color. Remove it from the table and go back
+ * to look for the next best color.
*/
stressPtr->colorPtr[closest] =
@@ -354,31 +344,30 @@ FindClosestColor(tkwin, desiredColorPtr, actualColorPtr)
*
* DeleteStressedCmap --
*
- * This procedure releases the information cached for "colormap"
- * so that it will be refetched from the X server the next time
- * it is needed.
+ * This function releases the information cached for "colormap" so that
+ * it will be refetched from the X server the next time it is needed.
*
* Results:
* None.
*
* Side effects:
- * The TkStressedCmap structure for colormap is deleted; the
- * colormap is no longer considered to be "stressed".
+ * The TkStressedCmap structure for colormap is deleted; the colormap is
+ * no longer considered to be "stressed".
*
* Note:
- * This procedure is invoked whenever a color in a colormap is
- * freed, and whenever a color allocation in a colormap succeeds.
- * This guarantees that TkStressedCmap structures are always
- * deleted before the corresponding Colormap is freed.
+ * This function is invoked whenever a color in a colormap is freed, and
+ * whenever a color allocation in a colormap succeeds. This guarantees
+ * that TkStressedCmap structures are always deleted before the
+ * corresponding Colormap is freed.
*
*----------------------------------------------------------------------
*/
static void
-DeleteStressedCmap(display, colormap)
- Display *display; /* Xlib's handle for the display
- * containing the colormap. */
- Colormap colormap; /* Colormap to flush. */
+DeleteStressedCmap(
+ Display *display, /* Xlib's handle for the display containing
+ * the colormap. */
+ Colormap colormap) /* Colormap to flush. */
{
TkStressedCmap *prevPtr, *stressPtr;
TkDisplay *dispPtr = TkGetDisplay(display);
@@ -391,8 +380,8 @@ DeleteStressedCmap(display, colormap)
} else {
prevPtr->nextPtr = stressPtr->nextPtr;
}
- ckfree((char *) stressPtr->colorPtr);
- ckfree((char *) stressPtr);
+ ckfree(stressPtr->colorPtr);
+ ckfree(stressPtr);
return;
}
}
@@ -403,12 +392,11 @@ DeleteStressedCmap(display, colormap)
*
* TkpCmapStressed --
*
- * Check to see whether a given colormap is known to be out
- * of entries.
+ * Check to see whether a given colormap is known to be out of entries.
*
* Results:
- * 1 is returned if "colormap" is stressed (i.e. it has run out
- * of entries recently), 0 otherwise.
+ * 1 is returned if "colormap" is stressed (i.e. it has run out of
+ * entries recently), 0 otherwise.
*
* Side effects:
* None.
@@ -417,10 +405,10 @@ DeleteStressedCmap(display, colormap)
*/
int
-TkpCmapStressed(tkwin, colormap)
- Tk_Window tkwin; /* Window that identifies the display
+TkpCmapStressed(
+ Tk_Window tkwin, /* Window that identifies the display
* containing the colormap. */
- Colormap colormap; /* Colormap to check for stress. */
+ Colormap colormap) /* Colormap to check for stress. */
{
TkStressedCmap *stressPtr;
@@ -432,3 +420,12 @@ TkpCmapStressed(tkwin, colormap)
}
return 0;
}
+
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixConfig.c b/unix/tkUnixConfig.c
index 7a753b1..bb39127 100644
--- a/unix/tkUnixConfig.c
+++ b/unix/tkUnixConfig.c
@@ -1,16 +1,15 @@
/*
* tkUnixConfig.c --
*
- * This module implements the Unix system defaults for
- * the configuration package.
+ * This module implements the Unix system defaults for the configuration
+ * package.
*
* Copyright (c) 1997 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tk.h"
#include "tkInt.h"
@@ -19,13 +18,13 @@
*
* TkpGetSystemDefault --
*
- * Given a dbName and className for a configuration option,
- * return a string representation of the option.
+ * Given a dbName and className for a configuration option, return a
+ * string representation of the option.
*
* Results:
- * Returns a Tk_Uid that is the string identifier that identifies
- * this option. Returns NULL if there are no system defaults
- * that match this pair.
+ * Returns a Tk_Uid that is the string identifier that identifies this
+ * option. Returns NULL if there are no system defaults that match this
+ * pair.
*
* Side effects:
* None, once the package is initialized.
@@ -34,10 +33,18 @@
*/
Tcl_Obj *
-TkpGetSystemDefault(tkwin, dbName, className)
- Tk_Window tkwin; /* A window to use. */
- CONST char *dbName; /* The option database name. */
- CONST char *className; /* The name of the option class. */
+TkpGetSystemDefault(
+ Tk_Window tkwin, /* A window to use. */
+ const char *dbName, /* The option database name. */
+ const char *className) /* The name of the option class. */
{
return NULL;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixCursor.c b/unix/tkUnixCursor.c
index a4ee0cb..bbf5206 100644
--- a/unix/tkUnixCursor.c
+++ b/unix/tkUnixCursor.c
@@ -1,39 +1,36 @@
-/*
+/*
* tkUnixCursor.c --
*
* This file contains X specific cursor manipulation routines.
*
* Copyright (c) 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.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
/*
* The following data structure is a superset of the TkCursor structure
- * defined in tkCursor.c. Each system specific cursor module will define
- * a different cursor structure. All of these structures must have the
- * same header consisting of the fields in TkCursor.
+ * defined in tkCursor.c. Each system specific cursor module will define a
+ * different cursor structure. All of these structures must have the same
+ * header consisting of the fields in TkCursor.
*/
-
-
typedef struct {
TkCursor info; /* Generic cursor info used by tkCursor.c */
Display *display; /* Display for which cursor is valid. */
} TkUnixCursor;
/*
- * The table below is used to map from the name of a cursor to its
- * index in the official cursor font:
+ * The table below is used to map from the name of a cursor to its index in
+ * the official cursor font:
*/
-static struct CursorName {
- char *name;
- unsigned int shape;
+static const struct CursorName {
+ const char *name;
+ unsigned int shape;
} cursorNames[] = {
{"X_cursor", XC_X_cursor},
{"arrow", XC_arrow},
@@ -116,6 +113,65 @@ static struct CursorName {
};
/*
+ * The table below is used to map from a cursor name to the data that defines
+ * the cursor. This table is used for cursors defined by Tk that don't exist
+ * in the X cursor table.
+ */
+
+#define CURSOR_NONE_DATA \
+"#define none_width 1\n" \
+"#define none_height 1\n" \
+"#define none_x_hot 0\n" \
+"#define none_y_hot 0\n" \
+"static unsigned char none_bits[] = {\n" \
+" 0x00};"
+
+/*
+ * Define test cursor to check that mask fg and bg color settings are working.
+ *
+ * . configure -cursor {center_ptr green red}
+ * . configure -cursor {@myarrow.xbm myarrow-mask.xbm green red}
+ * . configure -cursor {myarrow green red}
+ */
+
+/*#define DEFINE_MYARROW_CURSOR*/
+
+#ifdef DEFINE_MYARROW_CURSOR
+#define CURSOR_MYARROW_DATA \
+"#define myarrow_width 16\n" \
+"#define myarrow_height 16\n" \
+"#define myarrow_x_hot 7\n" \
+"#define myarrow_y_hot 0\n" \
+"static unsigned char myarrow_bits[] = {\n" \
+" 0x7f, 0xff, 0xbf, 0xfe, 0xdf, 0xfd, 0xef, 0xfb, 0xf7, 0xf7, 0xfb, 0xef,\n" \
+" 0xfd, 0xdf, 0xfe, 0xbf, 0x80, 0x00, 0xbf, 0xfe, 0xbf, 0xfe, 0xbf, 0xfe,\n" \
+" 0xbf, 0xfe, 0xbf, 0xfe, 0xbf, 0xfe, 0x3f, 0xfe};"
+
+#define CURSOR_MYARROW_MASK \
+"#define myarrow-mask_width 16\n" \
+"#define myarrow-mask_height 16\n" \
+"#define myarrow-mask_x_hot 7\n" \
+"#define myarrow-mask_y_hot 0\n" \
+"static unsigned char myarrow-mask_bits[] = {\n" \
+" 0x80, 0x00, 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f, 0xfc, 0x1f,\n" \
+" 0xfe, 0x3f, 0xff, 0x7f, 0xff, 0xff, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,\n" \
+" 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01};"
+
+#endif /* DEFINE_MYARROW_CURSOR */
+
+static const struct TkCursorName {
+ const char *name;
+ const char *data;
+ char *mask;
+} tkCursorNames[] = {
+ {"none", CURSOR_NONE_DATA, NULL},
+#ifdef DEFINE_MYARROW_CURSOR
+ {"myarrow", CURSOR_MYARROW_DATA, CURSOR_MYARROW_MASK},
+#endif /* DEFINE_MYARROW_CURSOR */
+ {NULL, NULL, NULL}
+};
+
+/*
* Font to use for cursors:
*/
@@ -123,18 +179,21 @@ static struct CursorName {
#define CURSORFONT "cursor"
#endif
-
+static Cursor CreateCursorFromTableOrFile(Tcl_Interp *interp,
+ Tk_Window tkwin, int argc, const char **argv,
+ const struct TkCursorName *tkCursorPtr);
+
/*
*----------------------------------------------------------------------
*
* TkGetCursorByName --
*
- * Retrieve a cursor by name. Parse the cursor name into fields
- * and create a cursor, either from the standard cursor font or
- * from bitmap files.
+ * Retrieve a cursor by name. Parse the cursor name into fields and
+ * create a cursor, either from the standard cursor font or from bitmap
+ * files.
*
* Results:
- * Returns a new cursor, or NULL on errors.
+ * Returns a new cursor, or NULL on errors.
*
* Side effects:
* Allocates a new cursor.
@@ -143,19 +202,19 @@ static struct CursorName {
*/
TkCursor *
-TkGetCursorByName(interp, tkwin, string)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- Tk_Window tkwin; /* Window in which cursor will be used. */
- Tk_Uid string; /* Description of cursor. See manual entry
- * for details on legal syntax. */
+TkGetCursorByName(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ Tk_Window tkwin, /* Window in which cursor will be used. */
+ Tk_Uid string) /* Description of cursor. See manual entry for
+ * details on legal syntax. */
{
TkUnixCursor *cursorPtr = NULL;
Cursor cursor = None;
int argc;
- CONST char **argv = NULL;
- Pixmap source = None;
- Pixmap mask = None;
+ const char **argv = NULL;
Display *display = Tk_Display(tkwin);
+ int inTkTable = 0;
+ const struct TkCursorName *tkCursorPtr = NULL;
if (Tcl_SplitList(interp, string, &argc, &argv) != TCL_OK) {
return NULL;
@@ -163,18 +222,38 @@ TkGetCursorByName(interp, tkwin, string)
if (argc == 0) {
goto badString;
}
+
+ /*
+ * Check Tk specific table of cursor names. The cursor names don't overlap
+ * with cursors defined in the X table so search order does not matter.
+ */
+
if (argv[0][0] != '@') {
+ for (tkCursorPtr = tkCursorNames; ; tkCursorPtr++) {
+ if (tkCursorPtr->name == NULL) {
+ tkCursorPtr = NULL;
+ break;
+ }
+ if ((tkCursorPtr->name[0] == argv[0][0]) &&
+ (strcmp(tkCursorPtr->name, argv[0]) == 0)) {
+ inTkTable = 1;
+ break;
+ }
+ }
+ }
+
+ if ((argv[0][0] != '@') && !inTkTable) {
XColor fg, bg;
unsigned int maskIndex;
- register struct CursorName *namePtr;
+ register const struct CursorName *namePtr;
TkDisplay *dispPtr;
/*
- * The cursor is to come from the standard cursor font. If one
- * arg, it is cursor name (use black and white for fg and bg).
- * If two args, they are name and fg color (ignore mask). If
- * three args, they are name, fg, bg. Some of the code below
- * is stolen from the XCreateFontCursor Xlib procedure.
+ * The cursor is to come from the standard cursor font. If one arg, it
+ * is cursor name (use black and white for fg and bg). If two args,
+ * they are name and fg color (ignore mask). If three args, they are
+ * name, fg, bg. Some of the code below is stolen from the
+ * XCreateFontCursor Xlib function.
*/
if (argc > 3) {
@@ -189,27 +268,25 @@ TkGetCursorByName(interp, tkwin, string)
break;
}
}
+
maskIndex = namePtr->shape + 1;
if (argc == 1) {
fg.red = fg.green = fg.blue = 0;
bg.red = bg.green = bg.blue = 65535;
} else {
- if (TkParseColor(display, Tk_Colormap(tkwin), argv[1],
- &fg) == 0) {
+ if (TkParseColor(display, Tk_Colormap(tkwin), argv[1], &fg) == 0) {
Tcl_AppendResult(interp, "invalid color name \"", argv[1],
- "\"", (char *) NULL);
+ "\"", NULL);
goto cleanup;
}
if (argc == 2) {
bg.red = bg.green = bg.blue = 0;
maskIndex = namePtr->shape;
- } else {
- if (TkParseColor(display, Tk_Colormap(tkwin), argv[2],
- &bg) == 0) {
- Tcl_AppendResult(interp, "invalid color name \"", argv[2],
- "\"", (char *) NULL);
- goto cleanup;
- }
+ } else if (TkParseColor(display, Tk_Colormap(tkwin), argv[2],
+ &bg) == 0) {
+ Tcl_AppendResult(interp, "invalid color name \"", argv[2],
+ "\"", NULL);
+ goto cleanup;
}
}
dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -224,112 +301,254 @@ TkGetCursorByName(interp, tkwin, string)
dispPtr->cursorFont, namePtr->shape, maskIndex,
&fg, &bg);
} else {
- int width, height, maskWidth, maskHeight;
- int xHot, yHot, dummy1, dummy2;
- XColor fg, bg;
+ /*
+ * Prevent file system access in safe interpreters.
+ */
+
+ if (!inTkTable && Tcl_IsSafe(interp)) {
+ Tcl_AppendResult(interp, "can't get cursor from a file in",
+ " a safe interpreter", NULL);
+ cursorPtr = NULL;
+ goto cleanup;
+ }
- /*
- * Prevent file system access in safe interpreters.
- */
-
- if (Tcl_IsSafe(interp)) {
- Tcl_AppendResult(interp, "can't get cursor from a file in",
- " a safe interpreter", (char *) NULL);
- cursorPtr = NULL;
- goto cleanup;
- }
-
/*
- * The cursor is to be created by reading bitmap files. There
- * should be either two elements in the list (source, color) or
- * four (source mask fg bg).
+ * If the cursor is to be created from bitmap files, then there should
+ * be either two elements in the list (source, color) or four (source
+ * mask fg bg). A cursor defined in the Tk table accepts the same
+ * arguments as an X cursor.
*/
- if ((argc != 2) && (argc != 4)) {
+ if (inTkTable && (argc != 1) && (argc != 2) && (argc != 3)) {
+ goto badString;
+ }
+
+ if (!inTkTable && (argc != 2) && (argc != 4)) {
goto badString;
}
- if (TkReadBitmapFile(display,
- RootWindowOfScreen(Tk_Screen(tkwin)), &argv[0][1],
- (unsigned int *) &width, (unsigned int *) &height,
+
+ cursor = CreateCursorFromTableOrFile(interp, tkwin, argc, argv,
+ tkCursorPtr);
+ }
+
+ if (cursor != None) {
+ cursorPtr = ckalloc(sizeof(TkUnixCursor));
+ cursorPtr->info.cursor = (Tk_Cursor) cursor;
+ cursorPtr->display = display;
+ }
+
+ cleanup:
+ if (argv != NULL) {
+ ckfree(argv);
+ }
+ return (TkCursor *) cursorPtr;
+
+ badString:
+ if (argv) {
+ ckfree(argv);
+ }
+ Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"", NULL);
+ return NULL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CreateCursorFromTableOrFile --
+ *
+ * Create a cursor defined in a file or the Tk static cursor table. A
+ * cursor defined in a file starts with the '@' character. This method
+ * assumes that the number of arguments in argv has been validated
+ * already.
+ *
+ * Results:
+ * Returns a new cursor, or None on error.
+ *
+ * Side effects:
+ * Allocates a new X cursor.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static Cursor
+CreateCursorFromTableOrFile(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ Tk_Window tkwin, /* Window in which cursor will be used. */
+ int argc,
+ const char **argv, /* Cursor spec parsed into elements. */
+ const struct TkCursorName *tkCursorPtr)
+ /* Non-NULL when cursor is defined in Tk
+ * table. */
+{
+ Cursor cursor = None;
+
+ int width, height, maskWidth, maskHeight;
+ int xHot = -1, yHot = -1;
+ int dummy1, dummy2;
+ XColor fg, bg;
+ const char *fgColor;
+ const char *bgColor;
+ int inTkTable = (tkCursorPtr != NULL);
+
+ Display *display = Tk_Display(tkwin);
+ Drawable drawable = RootWindowOfScreen(Tk_Screen(tkwin));
+
+ Pixmap source = None;
+ Pixmap mask = None;
+
+ /*
+ * A cursor defined in a file accepts either 2 or 4 arguments.
+ *
+ * {srcfile fg}
+ * {srcfile maskfile fg bg}
+ *
+ * A cursor defined in the Tk table accepts 1, 2, or 3 arguments.
+ *
+ * {tkcursorname}
+ * {tkcursorname fg}
+ * {tkcursorname fg bg}
+ */
+
+ if (inTkTable) {
+ /*
+ * This logic is like TkReadBitmapFile().
+ */
+
+ char *data;
+
+ data = TkGetBitmapData(NULL, tkCursorPtr->data, NULL,
+ &width, &height, &xHot, &yHot);
+ if (data == NULL) {
+ Tcl_AppendResult(interp, "error reading bitmap data for \"",
+ argv[0], "\"", NULL);
+ goto cleanup;
+ }
+
+ source = XCreateBitmapFromData(display, drawable, data, width,height);
+ ckfree(data);
+ } else {
+ if (TkReadBitmapFile(display, drawable, &argv[0][1],
+ (unsigned *) &width, (unsigned *) &height,
&source, &xHot, &yHot) != BitmapSuccess) {
Tcl_AppendResult(interp, "cleanup reading bitmap file \"",
- &argv[0][1], "\"", (char *) NULL);
+ &argv[0][1], "\"", NULL);
goto cleanup;
}
- if ((xHot < 0) || (yHot < 0) || (xHot >= width) || (yHot >= height)) {
+ }
+
+ if ((xHot < 0) || (yHot < 0) || (xHot >= width) || (yHot >= height)) {
+ if (inTkTable) {
+ Tcl_AppendResult(interp, "bad hot spot in bitmap data for \"",
+ argv[0], "\"", NULL);
+ } else {
Tcl_AppendResult(interp, "bad hot spot in bitmap file \"",
- &argv[0][1], "\"", (char *) NULL);
+ &argv[0][1], "\"", NULL);
+ }
+ goto cleanup;
+ }
+
+ /*
+ * Parse color names from optional fg and bg arguments
+ */
+
+ if (argc == 1) {
+ fg.red = fg.green = fg.blue = 0;
+ bg.red = bg.green = bg.blue = 65535;
+ } else if (argc == 2) {
+ fgColor = argv[1];
+ if (TkParseColor(display, Tk_Colormap(tkwin), fgColor, &fg) == 0) {
+ Tcl_AppendResult(interp, "invalid color name \"",
+ fgColor, "\"", NULL);
goto cleanup;
}
- if (argc == 2) {
- if (TkParseColor(display, Tk_Colormap(tkwin), argv[1],
- &fg) == 0) {
- Tcl_AppendResult(interp, "invalid color name \"",
- argv[1], "\"", (char *) NULL);
- goto cleanup;
- }
- cursor = XCreatePixmapCursor(display, source, source,
- &fg, &fg, (unsigned) xHot, (unsigned) yHot);
+ if (inTkTable) {
+ bg.red = bg.green = bg.blue = 0;
} else {
- if (TkReadBitmapFile(display,
- RootWindowOfScreen(Tk_Screen(tkwin)), argv[1],
- (unsigned int *) &maskWidth, (unsigned int *) &maskHeight,
- &mask, &dummy1, &dummy2) != BitmapSuccess) {
- Tcl_AppendResult(interp, "cleanup reading bitmap file \"",
- argv[1], "\"", (char *) NULL);
- goto cleanup;
- }
- if ((maskWidth != width) && (maskHeight != height)) {
- Tcl_SetResult(interp,
- "source and mask bitmaps have different sizes",
- TCL_STATIC);
- goto cleanup;
- }
- if (TkParseColor(display, Tk_Colormap(tkwin), argv[2],
- &fg) == 0) {
- Tcl_AppendResult(interp, "invalid color name \"", argv[2],
- "\"", (char *) NULL);
- goto cleanup;
- }
- if (TkParseColor(display, Tk_Colormap(tkwin), argv[3],
- &bg) == 0) {
- Tcl_AppendResult(interp, "invalid color name \"", argv[3],
- "\"", (char *) NULL);
- goto cleanup;
- }
- cursor = XCreatePixmapCursor(display, source, mask,
- &fg, &bg, (unsigned) xHot, (unsigned) yHot);
+ bg = fg;
+ }
+ } else {
+ /* 3 or 4 arguments */
+ if (inTkTable) {
+ fgColor = argv[1];
+ bgColor = argv[2];
+ } else {
+ fgColor = argv[2];
+ bgColor = argv[3];
+ }
+ if (TkParseColor(display, Tk_Colormap(tkwin), fgColor, &fg) == 0) {
+ Tcl_AppendResult(interp, "invalid color name \"",
+ fgColor, "\"", NULL);
+ goto cleanup;
+ }
+ if (TkParseColor(display, Tk_Colormap(tkwin), bgColor, &bg) == 0) {
+ Tcl_AppendResult(interp, "invalid color name \"",
+ bgColor, "\"", NULL);
+ goto cleanup;
}
}
- if (cursor != None) {
- cursorPtr = (TkUnixCursor *) ckalloc(sizeof(TkUnixCursor));
- cursorPtr->info.cursor = (Tk_Cursor) cursor;
- cursorPtr->display = display;
+ /*
+ * If there is no mask data, then create the cursor now.
+ */
+
+ if ((!inTkTable && (argc == 2)) || (inTkTable && tkCursorPtr->mask == NULL)) {
+ cursor = XCreatePixmapCursor(display, source, source,
+ &fg, &fg, (unsigned) xHot, (unsigned) yHot);
+ goto cleanup;
}
- cleanup:
- if (argv != NULL) {
- ckfree((char *) argv);
+ /*
+ * Parse bitmap mask data and create cursor with fg and bg colors.
+ */
+
+ if (inTkTable) {
+ /*
+ * This logic is like TkReadBitmapFile().
+ */
+
+ char *data;
+
+ data = TkGetBitmapData(NULL, tkCursorPtr->mask, NULL,
+ &maskWidth, &maskHeight, &dummy1, &dummy2);
+ if (data == NULL) {
+ Tcl_AppendResult(interp, "error reading bitmap mask data for \"",
+ argv[0], "\"", NULL);
+ goto cleanup;
+ }
+
+ mask = XCreateBitmapFromData(display, drawable, data, maskWidth,
+ maskHeight);
+
+ ckfree(data);
+ } else {
+ if (TkReadBitmapFile(display, drawable, argv[1],
+ (unsigned int *) &maskWidth, (unsigned int *) &maskHeight,
+ &mask, &dummy1, &dummy2) != BitmapSuccess) {
+ Tcl_AppendResult(interp, "cleanup reading bitmap file \"",
+ argv[1], "\"", NULL);
+ goto cleanup;
+ }
}
+
+ if ((maskWidth != width) || (maskHeight != height)) {
+ Tcl_SetResult(interp, "source and mask bitmaps have different sizes",
+ TCL_STATIC);
+ goto cleanup;
+ }
+
+ cursor = XCreatePixmapCursor(display, source, mask,
+ &fg, &bg, (unsigned) xHot, (unsigned) yHot);
+
+ cleanup:
if (source != None) {
Tk_FreePixmap(display, source);
}
if (mask != None) {
Tk_FreePixmap(display, mask);
}
- return (TkCursor *) cursorPtr;
-
-
- badString:
- if (argv) {
- ckfree((char *) argv);
- }
- Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"",
- (char *) NULL);
- return NULL;
+ return cursor;
}
-
+
/*
*----------------------------------------------------------------------
*
@@ -347,15 +566,14 @@ TkGetCursorByName(interp, tkwin, string)
*/
TkCursor *
-TkCreateCursorFromData(tkwin, source, mask, width, height, xHot, yHot,
- fgColor, bgColor)
- Tk_Window tkwin; /* Window in which cursor will be used. */
- CONST char *source; /* Bitmap data for cursor shape. */
- CONST char *mask; /* Bitmap data for cursor mask. */
- int width, height; /* Dimensions of cursor. */
- int xHot, yHot; /* Location of hot-spot in cursor. */
- XColor fgColor; /* Foreground color for cursor. */
- XColor bgColor; /* Background color for cursor. */
+TkCreateCursorFromData(
+ Tk_Window tkwin, /* Window in which cursor will be used. */
+ const char *source, /* Bitmap data for cursor shape. */
+ const char *mask, /* Bitmap data for cursor mask. */
+ int width, int height, /* Dimensions of cursor. */
+ int xHot, int yHot, /* Location of hot-spot in cursor. */
+ XColor fgColor, /* Foreground color for cursor. */
+ XColor bgColor) /* Background color for cursor. */
{
Cursor cursor;
Pixmap sourcePixmap, maskPixmap;
@@ -365,7 +583,7 @@ TkCreateCursorFromData(tkwin, source, mask, width, height, xHot, yHot,
sourcePixmap = XCreateBitmapFromData(display,
RootWindowOfScreen(Tk_Screen(tkwin)), source, (unsigned) width,
(unsigned) height);
- maskPixmap = XCreateBitmapFromData(display,
+ maskPixmap = XCreateBitmapFromData(display,
RootWindowOfScreen(Tk_Screen(tkwin)), mask, (unsigned) width,
(unsigned) height);
cursor = XCreatePixmapCursor(display, sourcePixmap,
@@ -374,19 +592,19 @@ TkCreateCursorFromData(tkwin, source, mask, width, height, xHot, yHot,
Tk_FreePixmap(display, maskPixmap);
if (cursor != None) {
- cursorPtr = (TkUnixCursor *) ckalloc(sizeof(TkUnixCursor));
+ cursorPtr = ckalloc(sizeof(TkUnixCursor));
cursorPtr->info.cursor = (Tk_Cursor) cursor;
cursorPtr->display = display;
}
return (TkCursor *) cursorPtr;
}
-
+
/*
*----------------------------------------------------------------------
*
* TkpFreeCursor --
*
- * This procedure is called to release a cursor allocated by
+ * This function is called to release a cursor allocated by
* TkGetCursorByName.
*
* Results:
@@ -399,10 +617,19 @@ TkCreateCursorFromData(tkwin, source, mask, width, height, xHot, yHot,
*/
void
-TkpFreeCursor(cursorPtr)
- TkCursor *cursorPtr;
+TkpFreeCursor(
+ TkCursor *cursorPtr)
{
TkUnixCursor *unixCursorPtr = (TkUnixCursor *) cursorPtr;
+
XFreeCursor(unixCursorPtr->display, (Cursor) unixCursorPtr->info.cursor);
Tk_FreeXId(unixCursorPtr->display, (XID) unixCursorPtr->info.cursor);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixDefault.h b/unix/tkUnixDefault.h
index 96a68b7..b922278 100644
--- a/unix/tkUnixDefault.h
+++ b/unix/tkUnixDefault.h
@@ -30,8 +30,9 @@
#define NORMAL_BG "#d9d9d9"
#define ACTIVE_BG "#ececec"
#define SELECT_BG "#c3c3c3"
-#define TROUGH "#c3c3c3"
-#define INDICATOR "#b03060"
+#define TROUGH "#b3b3b3"
+#define CHECK_INDICATOR WHITE
+#define MENU_INDICATOR BLACK
#define DISABLED "#a3a3a3"
/*
@@ -47,7 +48,7 @@
#define DEF_BUTTON_BG_COLOR NORMAL_BG
#define DEF_BUTTON_BG_MONO WHITE
#define DEF_BUTTON_BITMAP ""
-#define DEF_BUTTON_BORDER_WIDTH "2"
+#define DEF_BUTTON_BORDER_WIDTH "1"
#define DEF_BUTTON_CURSOR ""
#define DEF_BUTTON_COMPOUND "none"
#define DEF_BUTTON_COMMAND ""
@@ -56,18 +57,19 @@
#define DEF_BUTTON_DISABLED_FG_MONO ""
#define DEF_BUTTON_FG BLACK
#define DEF_CHKRAD_FG DEF_BUTTON_FG
-#define DEF_BUTTON_FONT "Helvetica -12 bold"
+#define DEF_BUTTON_FONT "TkDefaultFont"
#define DEF_BUTTON_HEIGHT "0"
#define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR
#define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO
#define DEF_BUTTON_HIGHLIGHT BLACK
#define DEF_LABEL_HIGHLIGHT_WIDTH "0"
#define DEF_BUTTON_HIGHLIGHT_WIDTH "1"
-#define DEF_BUTTON_IMAGE (char *) NULL
+#define DEF_BUTTON_IMAGE ((char *) NULL)
#define DEF_BUTTON_INDICATOR "1"
#define DEF_BUTTON_JUSTIFY "center"
#define DEF_BUTTON_OFF_VALUE "0"
#define DEF_BUTTON_ON_VALUE "1"
+#define DEF_BUTTON_TRISTATE_VALUE ""
#define DEF_BUTTON_OVER_RELIEF ""
#define DEF_BUTTON_PADX "3m"
#define DEF_LABCHKRAD_PADX "1"
@@ -77,12 +79,12 @@
#define DEF_LABCHKRAD_RELIEF "flat"
#define DEF_BUTTON_REPEAT_DELAY "0"
#define DEF_BUTTON_REPEAT_INTERVAL "0"
-#define DEF_BUTTON_SELECT_COLOR INDICATOR
+#define DEF_BUTTON_SELECT_COLOR CHECK_INDICATOR
#define DEF_BUTTON_SELECT_MONO BLACK
-#define DEF_BUTTON_SELECT_IMAGE (char *) NULL
+#define DEF_BUTTON_SELECT_IMAGE ((char *) NULL)
#define DEF_BUTTON_STATE "normal"
#define DEF_LABEL_TAKE_FOCUS "0"
-#define DEF_BUTTON_TAKE_FOCUS (char *) NULL
+#define DEF_BUTTON_TAKE_FOCUS ((char *) NULL)
#define DEF_BUTTON_TEXT ""
#define DEF_BUTTON_TEXT_VARIABLE ""
#define DEF_BUTTON_UNDERLINE "-1"
@@ -120,7 +122,7 @@
#define DEF_CANVAS_SELECT_BD_MONO "0"
#define DEF_CANVAS_SELECT_FG_COLOR BLACK
#define DEF_CANVAS_SELECT_FG_MONO WHITE
-#define DEF_CANVAS_TAKE_FOCUS (char *) NULL
+#define DEF_CANVAS_TAKE_FOCUS ((char *) NULL)
#define DEF_CANVAS_WIDTH "10c"
#define DEF_CANVAS_X_SCROLL_CMD ""
#define DEF_CANVAS_X_SCROLL_INCREMENT "0"
@@ -131,15 +133,15 @@
* Defaults for entries:
*/
-#define DEF_ENTRY_BG_COLOR NORMAL_BG
+#define DEF_ENTRY_BG_COLOR WHITE
#define DEF_ENTRY_BG_MONO WHITE
-#define DEF_ENTRY_BORDER_WIDTH "2"
+#define DEF_ENTRY_BORDER_WIDTH "1"
#define DEF_ENTRY_CURSOR "xterm"
#define DEF_ENTRY_DISABLED_BG_COLOR NORMAL_BG
#define DEF_ENTRY_DISABLED_BG_MONO WHITE
#define DEF_ENTRY_DISABLED_FG DISABLED
#define DEF_ENTRY_EXPORT_SELECTION "1"
-#define DEF_ENTRY_FONT "Helvetica -12"
+#define DEF_ENTRY_FONT "TkTextFont"
#define DEF_ENTRY_FG BLACK
#define DEF_ENTRY_HIGHLIGHT_BG NORMAL_BG
#define DEF_ENTRY_HIGHLIGHT BLACK
@@ -157,13 +159,13 @@
#define DEF_ENTRY_SCROLL_COMMAND ""
#define DEF_ENTRY_SELECT_COLOR SELECT_BG
#define DEF_ENTRY_SELECT_MONO BLACK
-#define DEF_ENTRY_SELECT_BD_COLOR "1"
+#define DEF_ENTRY_SELECT_BD_COLOR "0"
#define DEF_ENTRY_SELECT_BD_MONO "0"
#define DEF_ENTRY_SELECT_FG_COLOR BLACK
#define DEF_ENTRY_SELECT_FG_MONO WHITE
-#define DEF_ENTRY_SHOW (char *) NULL
+#define DEF_ENTRY_SHOW ((char *) NULL)
#define DEF_ENTRY_STATE "normal"
-#define DEF_ENTRY_TAKE_FOCUS (char *) NULL
+#define DEF_ENTRY_TAKE_FOCUS ((char *) NULL)
#define DEF_ENTRY_TEXT_VARIABLE ""
#define DEF_ENTRY_WIDTH "20"
@@ -198,7 +200,7 @@
#define DEF_LABELFRAME_CLASS "Labelframe"
#define DEF_LABELFRAME_RELIEF "groove"
#define DEF_LABELFRAME_FG BLACK
-#define DEF_LABELFRAME_FONT "Helvetica -12 bold"
+#define DEF_LABELFRAME_FONT "TkDefaultFont"
#define DEF_LABELFRAME_TEXT ""
#define DEF_LABELFRAME_LABELANCHOR "nw"
@@ -206,14 +208,14 @@
* Defaults for listboxes:
*/
-#define DEF_LISTBOX_ACTIVE_STYLE "underline"
-#define DEF_LISTBOX_BG_COLOR NORMAL_BG
+#define DEF_LISTBOX_ACTIVE_STYLE "dotbox"
+#define DEF_LISTBOX_BG_COLOR WHITE
#define DEF_LISTBOX_BG_MONO WHITE
-#define DEF_LISTBOX_BORDER_WIDTH "2"
+#define DEF_LISTBOX_BORDER_WIDTH "1"
#define DEF_LISTBOX_CURSOR ""
#define DEF_LISTBOX_DISABLED_FG DISABLED
#define DEF_LISTBOX_EXPORT_SELECTION "1"
-#define DEF_LISTBOX_FONT "Helvetica -12 bold"
+#define DEF_LISTBOX_FONT "TkDefaultFont"
#define DEF_LISTBOX_FG BLACK
#define DEF_LISTBOX_HEIGHT "10"
#define DEF_LISTBOX_HIGHLIGHT_BG NORMAL_BG
@@ -224,42 +226,42 @@
#define DEF_LISTBOX_LIST_VARIABLE ""
#define DEF_LISTBOX_SELECT_COLOR SELECT_BG
#define DEF_LISTBOX_SELECT_MONO BLACK
-#define DEF_LISTBOX_SELECT_BD "1"
+#define DEF_LISTBOX_SELECT_BD "0"
#define DEF_LISTBOX_SELECT_FG_COLOR BLACK
#define DEF_LISTBOX_SELECT_FG_MONO WHITE
#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 ((char *) 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 ((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_BITMAP None
#define DEF_MENU_ENTRY_COLUMN_BREAK "0"
-#define DEF_MENU_ENTRY_COMMAND (char *) NULL
+#define DEF_MENU_ENTRY_COMMAND ((char *) 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 ((char *) NULL)
+#define DEF_MENU_ENTRY_FONT ((char *) NULL)
#define DEF_MENU_ENTRY_HIDE_MARGIN "0"
-#define DEF_MENU_ENTRY_IMAGE (char *) NULL
+#define DEF_MENU_ENTRY_IMAGE ((char *) 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 ((char *) NULL)
+#define DEF_MENU_ENTRY_MENU ((char *) 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 ((char *) 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 ((char *) NULL)
+#define DEF_MENU_ENTRY_CHECK_VARIABLE ((char *) NULL)
#define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton"
-#define DEF_MENU_ENTRY_SELECT (char *) NULL
+#define DEF_MENU_ENTRY_SELECT ((char *) NULL)
#define DEF_MENU_ENTRY_UNDERLINE "-1"
/*
@@ -268,24 +270,24 @@
#define DEF_MENU_ACTIVE_BG_COLOR ACTIVE_BG
#define DEF_MENU_ACTIVE_BG_MONO BLACK
-#define DEF_MENU_ACTIVE_BORDER_WIDTH "2"
+#define DEF_MENU_ACTIVE_BORDER_WIDTH "1"
#define DEF_MENU_ACTIVE_FG_COLOR BLACK
#define DEF_MENU_ACTIVE_FG_MONO WHITE
#define DEF_MENU_BG_COLOR NORMAL_BG
#define DEF_MENU_BG_MONO WHITE
-#define DEF_MENU_BORDER_WIDTH "2"
+#define DEF_MENU_BORDER_WIDTH "1"
#define DEF_MENU_CURSOR "arrow"
#define DEF_MENU_DISABLED_FG_COLOR DISABLED
#define DEF_MENU_DISABLED_FG_MONO ""
-#define DEF_MENU_FONT "Helvetica -12 bold"
+#define DEF_MENU_FONT "TkMenuFont"
#define DEF_MENU_FG BLACK
#define DEF_MENU_POST_COMMAND ""
#define DEF_MENU_RELIEF "raised"
-#define DEF_MENU_SELECT_COLOR INDICATOR
+#define DEF_MENU_SELECT_COLOR MENU_INDICATOR
#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_CMD ((char *) NULL)
#define DEF_MENU_TITLE ""
#define DEF_MENU_TYPE "normal"
@@ -301,19 +303,19 @@
#define DEF_MENUBUTTON_BG_COLOR NORMAL_BG
#define DEF_MENUBUTTON_BG_MONO WHITE
#define DEF_MENUBUTTON_BITMAP ""
-#define DEF_MENUBUTTON_BORDER_WIDTH "2"
+#define DEF_MENUBUTTON_BORDER_WIDTH "1"
#define DEF_MENUBUTTON_CURSOR ""
#define DEF_MENUBUTTON_DIRECTION "below"
#define DEF_MENUBUTTON_DISABLED_FG_COLOR DISABLED
#define DEF_MENUBUTTON_DISABLED_FG_MONO ""
-#define DEF_MENUBUTTON_FONT "Helvetica -12 bold"
+#define DEF_MENUBUTTON_FONT "TkDefaultFont"
#define DEF_MENUBUTTON_FG BLACK
#define DEF_MENUBUTTON_HEIGHT "0"
#define DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR DEF_MENUBUTTON_BG_COLOR
#define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO
#define DEF_MENUBUTTON_HIGHLIGHT BLACK
#define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0"
-#define DEF_MENUBUTTON_IMAGE (char *) NULL
+#define DEF_MENUBUTTON_IMAGE ((char *) NULL)
#define DEF_MENUBUTTON_INDICATOR "0"
#define DEF_MENUBUTTON_JUSTIFY "center"
#define DEF_MENUBUTTON_MENU ""
@@ -336,10 +338,10 @@
#define DEF_MESSAGE_ASPECT "150"
#define DEF_MESSAGE_BG_COLOR NORMAL_BG
#define DEF_MESSAGE_BG_MONO WHITE
-#define DEF_MESSAGE_BORDER_WIDTH "2"
+#define DEF_MESSAGE_BORDER_WIDTH "1"
#define DEF_MESSAGE_CURSOR ""
#define DEF_MESSAGE_FG BLACK
-#define DEF_MESSAGE_FONT "Helvetica -12 bold"
+#define DEF_MESSAGE_FONT "TkDefaultFont"
#define DEF_MESSAGE_HIGHLIGHT_BG NORMAL_BG
#define DEF_MESSAGE_HIGHLIGHT BLACK
#define DEF_MESSAGE_HIGHLIGHT_WIDTH "0"
@@ -358,19 +360,19 @@
#define DEF_PANEDWINDOW_BG_COLOR NORMAL_BG
#define DEF_PANEDWINDOW_BG_MONO WHITE
-#define DEF_PANEDWINDOW_BORDERWIDTH "2"
+#define DEF_PANEDWINDOW_BORDERWIDTH "1"
#define DEF_PANEDWINDOW_CURSOR ""
#define DEF_PANEDWINDOW_HANDLEPAD "8"
#define DEF_PANEDWINDOW_HANDLESIZE "8"
#define DEF_PANEDWINDOW_HEIGHT ""
-#define DEF_PANEDWINDOW_OPAQUERESIZE "0"
+#define DEF_PANEDWINDOW_OPAQUERESIZE "1"
#define DEF_PANEDWINDOW_ORIENT "horizontal"
#define DEF_PANEDWINDOW_RELIEF "flat"
#define DEF_PANEDWINDOW_SASHCURSOR ""
-#define DEF_PANEDWINDOW_SASHPAD "2"
-#define DEF_PANEDWINDOW_SASHRELIEF "raised"
-#define DEF_PANEDWINDOW_SASHWIDTH "2"
-#define DEF_PANEDWINDOW_SHOWHANDLE "1"
+#define DEF_PANEDWINDOW_SASHPAD "0"
+#define DEF_PANEDWINDOW_SASHRELIEF "flat"
+#define DEF_PANEDWINDOW_SASHWIDTH "3"
+#define DEF_PANEDWINDOW_SHOWHANDLE "0"
#define DEF_PANEDWINDOW_WIDTH ""
/*
@@ -385,6 +387,8 @@
#define DEF_PANEDWINDOW_PANE_PADY "0"
#define DEF_PANEDWINDOW_PANE_STICKY "nsew"
#define DEF_PANEDWINDOW_PANE_WIDTH ""
+#define DEF_PANEDWINDOW_PANE_HIDE "0"
+#define DEF_PANEDWINDOW_PANE_STRETCH "last"
/*
* Defaults for scales:
@@ -395,11 +399,11 @@
#define DEF_SCALE_BG_COLOR NORMAL_BG
#define DEF_SCALE_BG_MONO WHITE
#define DEF_SCALE_BIG_INCREMENT "0"
-#define DEF_SCALE_BORDER_WIDTH "2"
+#define DEF_SCALE_BORDER_WIDTH "1"
#define DEF_SCALE_COMMAND ""
#define DEF_SCALE_CURSOR ""
#define DEF_SCALE_DIGITS "0"
-#define DEF_SCALE_FONT "Helvetica -12 bold"
+#define DEF_SCALE_FONT "TkDefaultFont"
#define DEF_SCALE_FG_COLOR BLACK
#define DEF_SCALE_FG_MONO BLACK
#define DEF_SCALE_FROM "0"
@@ -411,7 +415,7 @@
#define DEF_SCALE_LENGTH "100"
#define DEF_SCALE_ORIENT "vertical"
#define DEF_SCALE_RELIEF "flat"
-#define DEF_SCALE_REPEAT_DELAY "300"
+#define DEF_SCALE_REPEAT_DELAY "300"
#define DEF_SCALE_REPEAT_INTERVAL "100"
#define DEF_SCALE_RESOLUTION "1"
#define DEF_SCALE_TROUGH_COLOR TROUGH
@@ -420,7 +424,7 @@
#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_TAKE_FOCUS ((char *) NULL)
#define DEF_SCALE_TICK_INTERVAL "0"
#define DEF_SCALE_TO "100"
#define DEF_SCALE_VARIABLE ""
@@ -435,35 +439,36 @@
#define DEF_SCROLLBAR_ACTIVE_RELIEF "raised"
#define DEF_SCROLLBAR_BG_COLOR NORMAL_BG
#define DEF_SCROLLBAR_BG_MONO WHITE
-#define DEF_SCROLLBAR_BORDER_WIDTH "2"
+#define DEF_SCROLLBAR_BORDER_WIDTH "1"
#define DEF_SCROLLBAR_COMMAND ""
#define DEF_SCROLLBAR_CURSOR ""
#define DEF_SCROLLBAR_EL_BORDER_WIDTH "-1"
#define DEF_SCROLLBAR_HIGHLIGHT_BG NORMAL_BG
#define DEF_SCROLLBAR_HIGHLIGHT BLACK
-#define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "1"
+#define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "0"
#define DEF_SCROLLBAR_JUMP "0"
#define DEF_SCROLLBAR_ORIENT "vertical"
#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 ((char *) NULL)
#define DEF_SCROLLBAR_TROUGH_COLOR TROUGH
#define DEF_SCROLLBAR_TROUGH_MONO WHITE
-#define DEF_SCROLLBAR_WIDTH "15"
+#define DEF_SCROLLBAR_WIDTH "11"
/*
* Defaults for texts:
*/
#define DEF_TEXT_AUTO_SEPARATORS "1"
-#define DEF_TEXT_BG_COLOR NORMAL_BG
+#define DEF_TEXT_BG_COLOR WHITE
#define DEF_TEXT_BG_MONO WHITE
-#define DEF_TEXT_BORDER_WIDTH "2"
+#define DEF_TEXT_BLOCK_CURSOR "0"
+#define DEF_TEXT_BORDER_WIDTH "1"
#define DEF_TEXT_CURSOR "xterm"
#define DEF_TEXT_FG BLACK
#define DEF_TEXT_EXPORT_SELECTION "1"
-#define DEF_TEXT_FONT "Courier -12"
+#define DEF_TEXT_FONT "TkFixedFont"
#define DEF_TEXT_HEIGHT "24"
#define DEF_TEXT_HIGHLIGHT_BG NORMAL_BG
#define DEF_TEXT_HIGHLIGHT BLACK
@@ -473,14 +478,16 @@
#define DEF_TEXT_INSERT_BD_MONO "0"
#define DEF_TEXT_INSERT_OFF_TIME "300"
#define DEF_TEXT_INSERT_ON_TIME "600"
+#define DEF_TEXT_INSERT_UNFOCUSSED "none"
#define DEF_TEXT_INSERT_WIDTH "2"
-#define DEF_TEXT_MAX_UNDO "0"
+#define DEF_TEXT_MAX_UNDO "0"
#define DEF_TEXT_PADX "1"
#define DEF_TEXT_PADY "1"
#define DEF_TEXT_RELIEF "sunken"
+#define DEF_TEXT_INACTIVE_SELECT_COLOR SELECT_BG
#define DEF_TEXT_SELECT_COLOR SELECT_BG
#define DEF_TEXT_SELECT_MONO BLACK
-#define DEF_TEXT_SELECT_BD_COLOR "1"
+#define DEF_TEXT_SELECT_BD_COLOR "0"
#define DEF_TEXT_SELECT_BD_MONO "0"
#define DEF_TEXT_SELECT_FG_COLOR BLACK
#define DEF_TEXT_SELECT_FG_MONO WHITE
@@ -491,8 +498,9 @@
#define DEF_TEXT_SPACING3 "0"
#define DEF_TEXT_STATE "normal"
#define DEF_TEXT_TABS ""
-#define DEF_TEXT_TAKE_FOCUS (char *) NULL
-#define DEF_TEXT_UNDO "0"
+#define DEF_TEXT_TABSTYLE "tabular"
+#define DEF_TEXT_TAKE_FOCUS ((char *) NULL)
+#define DEF_TEXT_UNDO "0"
#define DEF_TEXT_WIDTH "80"
#define DEF_TEXT_WRAP "char"
#define DEF_TEXT_XSCROLL_COMMAND ""
@@ -502,7 +510,7 @@
* Defaults for canvas text:
*/
-#define DEF_CANVTEXT_FONT "Helvetica -12"
+#define DEF_CANVTEXT_FONT "TkDefaultFont"
/*
* Defaults for toplevels (most of the defaults for frames also apply
@@ -514,4 +522,10 @@
#define DEF_TOPLEVEL_SCREEN ""
#define DEF_TOPLEVEL_USE ""
+/*
+ * Defaults for busy windows:
+ */
+
+#define DEF_BUSY_CURSOR "watch"
+
#endif /* _TKUNIXDEFAULT */
diff --git a/unix/tkUnixDialog.c b/unix/tkUnixDialog.c
index 9c5028a..afe443f 100644
--- a/unix/tkUnixDialog.c
+++ b/unix/tkUnixDialog.c
@@ -8,24 +8,25 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-
-#include "tkPort.h"
-#include "tkInt.h"
+
#include "tkUnixInt.h"
/*
+ * The wrapper code for Unix is actually set up in library/tk.tcl these days;
+ * the procedure names used here are probably wrong too...
+ */
+
+#ifdef TK_OBSOLETE_UNIX_DIALOG_WRAPPERS
+
+/*
*----------------------------------------------------------------------
*
- * EvalArgv --
+ * EvalObjv --
*
- * Invokes the Tcl procedure with the arguments. argv[0] is set by
- * the caller of this function. It may be different than cmdName.
- * The TCL command will see argv[0], not cmdName, as its name if it
- * invokes [lindex [info level 0] 0]
+ * Invokes the Tcl procedure with the arguments.
*
* Results:
- * TCL_ERROR if the command does not exist and cannot be autoloaded.
- * Otherwise, return the result of the evaluation of the command.
+ * Returns the result of the evaluation of the command.
*
* Side effects:
* The command may be autoloaded.
@@ -33,54 +34,37 @@
*----------------------------------------------------------------------
*/
-static int EvalArgv(interp, cmdName, argc, argv)
- Tcl_Interp *interp; /* Current interpreter. */
- char * cmdName; /* Name of the TCL command to call */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+static int
+EvalObjv(
+ Tcl_Interp *interp, /* Current interpreter. */
+ char *cmdName, /* Name of the TCL command to call */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const *objv) /* Arguments. */
{
- Tcl_CmdInfo cmdInfo;
-
- if (!Tcl_GetCommandInfo(interp, cmdName, &cmdInfo)) {
- char * cmdArgv[2];
+ Tcl_Obj *cmdObj, **objs;
+ int result;
- /*
- * This comand is not in the interpreter yet -- looks like we
- * have to auto-load it
- */
- if (!Tcl_GetCommandInfo(interp, "auto_load", &cmdInfo)) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "cannot execute command \"auto_load\"",
- NULL);
- return TCL_ERROR;
- }
+ cmdObj = Tcl_NewStringObj(cmdName, -1);
+ Tcl_IncrRefCount(cmdObj);
+ objs = ckalloc(sizeof(Tcl_Obj *) * (objc+1));
+ objs[0] = cmdObj;
+ memcpy(objs+1, objv, sizeof(Tcl_Obj *) * (unsigned)objc);
- cmdArgv[0] = "auto_load";
- cmdArgv[1] = cmdName;
+ result = Tcl_EvalObjv(interp, objc+1, objs, 0);
- if ((*cmdInfo.proc)(cmdInfo.clientData, interp, 2, cmdArgv)!= TCL_OK){
- return TCL_ERROR;
- }
+ Tcl_DecrRefCount(cmdObj);
+ ckfree(objs);
- if (!Tcl_GetCommandInfo(interp, cmdName, &cmdInfo)) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "cannot auto-load command \"",
- cmdName, "\"",NULL);
- return TCL_ERROR;
- }
- }
-
- return (*cmdInfo.proc)(cmdInfo.clientData, interp, argc, argv);
+ return result;
}
/*
*----------------------------------------------------------------------
*
- * Tk_ChooseColorCmd --
+ * Tk_ChooseColorObjCmd --
*
- * This procedure implements the color dialog box for the Unix
- * platform. See the user documentation for details on what it
- * does.
+ * This procedure implements the color dialog box for the Unix platform.
+ * See the user documentation for details on what it does.
*
* Results:
* See user documentation.
@@ -94,13 +78,13 @@ static int EvalArgv(interp, cmdName, argc, argv)
*/
int
-Tk_ChooseColorCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+Tk_ChooseColorObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const *objv) /* Arguments. */
{
- return EvalArgv(interp, "tk::ColorDialog", argc, argv);
+ return EvalObjv(interp, "tk::ColorDialog", objc-1, objv+1);
}
/*
@@ -108,35 +92,33 @@ Tk_ChooseColorCmd(clientData, interp, argc, argv)
*
* Tk_GetOpenFileCmd --
*
- * This procedure implements the "open file" dialog box for the
- * Unix platform. See the user documentation for details on what
- * it does.
+ * This procedure implements the "open file" dialog box for the Unix
+ * platform. See the user documentation for details on what it does.
*
* Results:
* See user documentation.
*
* Side effects:
- * A dialog window is created the first this procedure is called.
- * This window is not destroyed and will be reused the next time
- * the application invokes the "tk_getOpenFile" or
- * "tk_getSaveFile" command.
+ * A dialog window is created the first this procedure is called. This
+ * window is not destroyed and will be reused the next time the
+ * application invokes the "tk_getOpenFile" or "tk_getSaveFile" command.
*
*----------------------------------------------------------------------
*/
int
-Tk_GetOpenFileCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+Tk_GetOpenFileObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const *objv) /* Arguments. */
{
- Tk_Window tkwin = (Tk_Window)clientData;
+ Tk_Window tkwin = clientData;
if (Tk_StrictMotif(tkwin)) {
- return EvalArgv(interp, "tk::MotifFDialog", argc, argv);
+ return EvalObjv(interp, "tk::MotifOpenFDialog", objc-1, objv+1);
} else {
- return EvalArgv(interp, "tk::FDialog", argc, argv);
+ return EvalObjv(interp, "tk::OpenFDialog", objc-1, objv+1);
}
}
@@ -145,8 +127,7 @@ Tk_GetOpenFileCmd(clientData, interp, argc, argv)
*
* Tk_GetSaveFileCmd --
*
- * Same as Tk_GetOpenFileCmd but opens a "save file" dialog box
- * instead
+ * Same as Tk_GetOpenFileCmd but opens a "save file" dialog box instead.
*
* Results:
* Same as Tk_GetOpenFileCmd.
@@ -158,18 +139,18 @@ Tk_GetOpenFileCmd(clientData, interp, argc, argv)
*/
int
-Tk_GetSaveFileCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+Tk_GetSaveFileObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const *objv) /* Arguments. */
{
- Tk_Window tkwin = (Tk_Window)clientData;
+ Tk_Window tkwin = clientData;
if (Tk_StrictMotif(tkwin)) {
- return EvalArgv(interp, "tk::MotifFDialog", argc, argv);
+ return EvalObjv(interp, "tk::MotifSaveFDialog", objc-1, objv+1);
} else {
- return EvalArgv(interp, "tk::FDialog", argc, argv);
+ return EvalObjv(interp, "tk::SaveFDialog", objc-1, objv+1);
}
}
@@ -178,9 +159,8 @@ Tk_GetSaveFileCmd(clientData, interp, argc, argv)
*
* Tk_MessageBoxCmd --
*
- * This procedure implements the MessageBox window for the
- * Unix platform. See the user documentation for details on what
- * it does.
+ * This procedure implements the MessageBox window for the Unix
+ * platform. See the user documentation for details on what it does.
*
* Results:
* See user documentation.
@@ -193,12 +173,21 @@ Tk_GetSaveFileCmd(clientData, interp, argc, argv)
*/
int
-Tk_MessageBoxCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+Tk_MessageBoxCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const *objv) /* Arguments. */
{
- return EvalArgv(interp, "tk::MessageBox", argc, argv);
+ return EvalObjv(interp, "tk::MessageBox", objc-1, objv+1);
}
+#endif /* TK_OBSOLETE_UNIX_DIALOG_WRAPPERS */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixDraw.c b/unix/tkUnixDraw.c
index 9b84ab1..55f7464 100644
--- a/unix/tkUnixDraw.c
+++ b/unix/tkUnixDraw.c
@@ -1,24 +1,23 @@
-/*
+/*
* tkUnixDraw.c --
*
* This file contains X specific drawing routines.
*
* Copyright (c) 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.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "tkInt.h"
-#if !defined(__WIN32__) && !defined(MAC_TCL)
+#if !defined(__WIN32__)
#include "tkUnixInt.h"
#endif
/*
- * The following structure is used to pass information to
- * ScrollRestrictProc from TkScrollWindow.
+ * The following structure is used to pass information to ScrollRestrictProc
+ * from TkScrollWindow.
*/
typedef struct ScrollInfo {
@@ -30,46 +29,46 @@ typedef struct ScrollInfo {
} ScrollInfo;
/*
- * Forward declarations for procedures declared later in this file:
+ * Forward declarations for functions declared later in this file:
*/
-static Tk_RestrictAction ScrollRestrictProc _ANSI_ARGS_((
- ClientData arg, XEvent *eventPtr));
+static Tk_RestrictProc ScrollRestrictProc;
/*
*----------------------------------------------------------------------
*
* TkScrollWindow --
*
- * Scroll a rectangle of the specified window and accumulate
- * damage information in the specified Region.
+ * Scroll a rectangle of the specified window and accumulate damage
+ * information in the specified Region.
*
* Results:
- * Returns 0 if no damage additional damage was generated. Sets
- * damageRgn to contain the damaged areas and returns 1 if
- * GraphicsExpose events were detected.
+ * Returns 0 if no damage additional damage was generated. Sets damageRgn
+ * to contain the damaged areas and returns 1 if GraphicsExpose events
+ * were detected.
*
* Side effects:
- * Scrolls the bits in the window and enters the event loop
- * looking for damage events.
+ * Scrolls the bits in the window and enters the event loop looking for
+ * damage events.
*
*----------------------------------------------------------------------
*/
int
-TkScrollWindow(tkwin, gc, x, y, width, height, dx, dy, damageRgn)
- Tk_Window tkwin; /* The window to be scrolled. */
- GC gc; /* GC for window to be scrolled. */
- int x, y, width, height; /* Position rectangle to be scrolled. */
- int dx, dy; /* Distance rectangle should be moved. */
- TkRegion damageRgn; /* Region to accumulate damage in. */
+TkScrollWindow(
+ Tk_Window tkwin, /* The window to be scrolled. */
+ GC 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. */
{
- Tk_RestrictProc *oldProc;
- ClientData oldArg, dummy;
+ Tk_RestrictProc *prevProc;
+ ClientData prevArg;
ScrollInfo info;
-
+
XCopyArea(Tk_Display(tkwin), Tk_WindowId(tkwin), Tk_WindowId(tkwin), gc,
- x, y, (unsigned int) width, (unsigned int) height, x + dx, y + dy);
+ x, y, (unsigned) width, (unsigned) height, x+dx, y+dy);
info.done = 0;
info.window = Tk_WindowId(tkwin);
@@ -79,18 +78,17 @@ TkScrollWindow(tkwin, gc, x, y, width, height, dx, dy, damageRgn)
info.dy = dy;
/*
- * Sync the event stream so all of the expose events will be on the
- * Tk event queue before we start filtering. This avoids busy waiting
- * while we filter events.
+ * Sync the event stream so all of the expose events will be on the Tk
+ * event queue before we start filtering. This avoids busy waiting while
+ * we filter events.
*/
TkpSync(info.display);
- oldProc = Tk_RestrictEvents(ScrollRestrictProc, (ClientData) &info,
- &oldArg);
+ prevProc = Tk_RestrictEvents(ScrollRestrictProc, &info, &prevArg);
while (!info.done) {
Tcl_ServiceEvent(TCL_WINDOW_EVENTS);
}
- Tk_RestrictEvents(oldProc, oldArg, &dummy);
+ Tk_RestrictEvents(prevProc, prevArg, &prevArg);
if (XEmptyRegion((Region) damageRgn)) {
return 0;
@@ -105,9 +103,9 @@ TkScrollWindow(tkwin, gc, x, y, width, height, dx, dy, damageRgn)
* ScrollRestrictProc --
*
* A Tk_RestrictProc used by TkScrollWindow to gather up Expose
- * information into a single damage region. It accumulates damage
- * events on the specified window until a NoExpose or the last
- * GraphicsExpose event is detected.
+ * information into a single damage region. It accumulates damage events
+ * on the specified window until a NoExpose or the last GraphicsExpose
+ * event is detected.
*
* Results:
* None.
@@ -120,9 +118,9 @@ TkScrollWindow(tkwin, gc, x, y, width, height, dx, dy, damageRgn)
*/
static Tk_RestrictAction
-ScrollRestrictProc(arg, eventPtr)
- ClientData arg;
- XEvent *eventPtr;
+ScrollRestrictProc(
+ ClientData arg,
+ XEvent *eventPtr)
{
ScrollInfo *info = (ScrollInfo *) arg;
XRectangle rect;
@@ -150,13 +148,12 @@ ScrollRestrictProc(arg, eventPtr)
info->done = 1;
}
} else if (eventPtr->type == Expose) {
-
/*
- * This case is tricky. This event was already queued before
- * the XCopyArea was issued. If this area overlaps the area
- * being copied, then some of the copied area may be invalid.
- * The easiest way to handle this case is to mark both the
- * original area and the shifted area as damaged.
+ * This case is tricky. This event was already queued before the
+ * XCopyArea was issued. If this area overlaps the area being copied,
+ * then some of the copied area may be invalid. The easiest way to
+ * handle this case is to mark both the original area and the shifted
+ * area as damaged.
*/
rect.x = eventPtr->xexpose.x;
@@ -180,30 +177,30 @@ ScrollRestrictProc(arg, eventPtr)
*
* TkpDrawHighlightBorder --
*
- * This procedure draws a rectangular ring around the outside of
- * a widget to indicate that it has received the input focus.
+ * This function draws a rectangular ring around the outside of a widget
+ * to indicate that it has received the input focus.
*
- * On Unix, we just draw the simple inset ring. On other sytems,
- * e.g. the Mac, the focus ring is a little more complicated, so we
- * need this abstraction.
+ * On Unix, we just draw the simple inset ring. On other sytems, e.g. the
+ * Mac, the focus ring is a little more complicated, so we need this
+ * abstraction.
*
* Results:
* None.
*
* Side effects:
- * A rectangle "width" pixels wide is drawn in "drawable",
- * corresponding to the outer area of "tkwin".
+ * A rectangle "width" pixels wide is drawn in "drawable", corresponding
+ * to the outer area of "tkwin".
*
*----------------------------------------------------------------------
*/
-void
-TkpDrawHighlightBorder(tkwin, fgGC, bgGC, highlightWidth, drawable)
- Tk_Window tkwin;
- GC fgGC;
- GC bgGC;
- int highlightWidth;
- Drawable drawable;
+void
+TkpDrawHighlightBorder(
+ Tk_Window tkwin,
+ GC fgGC,
+ GC bgGC,
+ int highlightWidth,
+ Drawable drawable)
{
TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0);
}
@@ -213,7 +210,7 @@ TkpDrawHighlightBorder(tkwin, fgGC, bgGC, highlightWidth, drawable)
*
* TkpDrawFrame --
*
- * This procedure draws the rectangular frame area.
+ * This function draws the rectangular frame area.
*
* Results:
* None.
@@ -225,12 +222,22 @@ TkpDrawHighlightBorder(tkwin, fgGC, bgGC, highlightWidth, drawable)
*/
void
-TkpDrawFrame (Tk_Window tkwin, Tk_3DBorder border,
- int highlightWidth, int borderWidth, int relief)
+TkpDrawFrame(
+ Tk_Window tkwin,
+ Tk_3DBorder border,
+ int highlightWidth,
+ int borderWidth,
+ int relief)
{
- Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin),
- border, highlightWidth, highlightWidth,
- Tk_Width(tkwin) - 2 * highlightWidth,
- Tk_Height(tkwin) - 2 * highlightWidth,
- borderWidth, relief);
+ Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, highlightWidth,
+ highlightWidth, Tk_Width(tkwin) - 2*highlightWidth,
+ Tk_Height(tkwin) - 2*highlightWidth, borderWidth, relief);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c
index f91187e..bd5c512 100644
--- a/unix/tkUnixEmbed.c
+++ b/unix/tkUnixEmbed.c
@@ -1,106 +1,103 @@
-/*
+/*
* tkUnixEmbed.c --
*
- * This file contains platform-specific procedures for UNIX to provide
+ * This file contains platform-specific functions for UNIX to provide
* basic operations needed for application embedding (where one
- * application can use as its main window an internal window from
- * some other application).
+ * application can use as its main window an internal window from some
+ * other application). Also includes code to support busy windows.
*
* Copyright (c) 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.
+ * 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 "tkUnixInt.h"
+#include "tkBusy.h"
/*
* One of the following structures exists for each container in this
- * application. It keeps track of the container window and its
- * associated embedded window.
+ * application. It keeps track of the container window and its associated
+ * embedded window.
*/
typedef struct Container {
- Window parent; /* X's window id for the parent of
- * the pair (the container). */
- Window parentRoot; /* Id for the root window of parent's
- * screen. */
- TkWindow *parentPtr; /* Tk's information about the container,
- * or NULL if the container isn't
- * in this process. */
- Window wrapper; /* X's window id for the wrapper
- * window for the embedded window.
- * Starts off as None, but gets
- * filled in when the window is
- * eventually created. */
- TkWindow *embeddedPtr; /* Tk's information about the embedded
- * window, or NULL if the embedded
- * application isn't in this process.
- * Note that this is *not* the
- * same window as wrapper: wrapper is
- * the parent of embeddedPtr. */
- struct Container *nextPtr; /* Next in list of all containers in
- * this process. */
+ Window parent; /* X's window id for the parent of the pair
+ * (the container). */
+ Window parentRoot; /* Id for the root window of parent's
+ * screen. */
+ TkWindow *parentPtr; /* Tk's information about the container, or
+ * NULL if the container isn't in this
+ * process. */
+ Window wrapper; /* X's window id for the wrapper window for
+ * the embedded window. Starts off as None,
+ * but gets filled in when the window is
+ * eventually created. */
+ TkWindow *embeddedPtr; /* Tk's information about the embedded window,
+ * or NULL if the embedded application isn't
+ * in this process. Note that this is *not*
+ * the same window as wrapper: wrapper is the
+ * parent of embeddedPtr. */
+ struct Container *nextPtr; /* Next in list of all containers in this
+ * process. */
} Container;
typedef struct ThreadSpecificData {
- Container *firstContainerPtr; /* First in list of all containers
- * managed by this process. */
+ Container *firstContainerPtr;
+ /* First in list of all containers managed by
+ * this process. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * Prototypes for static procedures defined in this file:
+ * Prototypes for static functions defined in this file:
*/
-static void ContainerEventProc _ANSI_ARGS_((
- ClientData clientData, XEvent *eventPtr));
-static void EmbeddedEventProc _ANSI_ARGS_((
- ClientData clientData, XEvent *eventPtr));
-static int EmbedErrorProc _ANSI_ARGS_((ClientData clientData,
- XErrorEvent *errEventPtr));
-static void EmbedFocusProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void EmbedGeometryRequest _ANSI_ARGS_((
- Container * containerPtr, int width, int height));
-static void EmbedSendConfigure _ANSI_ARGS_((
- Container *containerPtr));
-static void EmbedStructureProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void EmbedWindowDeleted _ANSI_ARGS_((TkWindow *winPtr));
+static void ContainerEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static void EmbeddedEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static int EmbedErrorProc(ClientData clientData,
+ XErrorEvent *errEventPtr);
+static void EmbedFocusProc(ClientData clientData,
+ XEvent *eventPtr);
+static void EmbedGeometryRequest(Container *containerPtr,
+ int width, int height);
+static void EmbedSendConfigure(Container *containerPtr);
+static void EmbedStructureProc(ClientData clientData,
+ XEvent *eventPtr);
+static void EmbedWindowDeleted(TkWindow *winPtr);
/*
*----------------------------------------------------------------------
*
* TkpUseWindow --
*
- * This procedure causes a Tk window to use a given X window as
- * its parent window, rather than the root window for the screen.
- * It is invoked by an embedded application to specify the window
- * in which it is embedded.
+ * This function causes a Tk window to use a given X window as its parent
+ * window, rather than the root window for the screen. It is invoked by
+ * an embedded application to specify the window in which it is embedded.
*
* Results:
- * The return value is normally TCL_OK. If an error occurs (such
- * as string not being a valid window spec), then the return value
- * is TCL_ERROR and an error message is left in the interp's result if
+ * The return value is normally TCL_OK. If an error occurs (such as
+ * string not being a valid window spec), then the return value is
+ * TCL_ERROR and an error message is left in the interp's result if
* interp is non-NULL.
*
* Side effects:
- * Changes the colormap and other visual information to match that
- * of the parent window given by "string".
+ * Changes the colormap and other visual information to match that of the
+ * parent window given by "string".
*
*----------------------------------------------------------------------
*/
int
-TkpUseWindow(interp, tkwin, string)
- 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
+TkpUseWindow(
+ 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
* associated X window. */
- CONST char *string; /* String identifying an X window to use
- * for tkwin; must be an integer value. */
+ const char *string) /* String identifying an X window to use for
+ * tkwin; must be an integer value. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
TkWindow *usePtr;
@@ -109,11 +106,13 @@ TkpUseWindow(interp, tkwin, string)
Tk_ErrorHandler handler;
Container *containerPtr;
XWindowAttributes parentAtts;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->window != None) {
- panic("TkUseWindow: X window already assigned");
+ Tcl_AppendResult(interp,
+ "can't modify container after widget is created", NULL);
+ return TCL_ERROR;
}
if (Tcl_GetInt(interp, string, &id) != TCL_OK) {
return TCL_ERROR;
@@ -124,30 +123,30 @@ TkpUseWindow(interp, tkwin, string)
if (usePtr != NULL) {
if (!(usePtr->flags & TK_CONTAINER)) {
Tcl_AppendResult(interp, "window \"", usePtr->pathName,
- "\" doesn't have -container option set", (char *) NULL);
+ "\" doesn't have -container option set", NULL);
return TCL_ERROR;
}
}
/*
* Tk sets the window colormap to the screen default colormap in
- * tkWindow.c:AllocWindow. This doesn't work well for embedded
- * windows. So we override the colormap and visual settings to be
- * the same as the parent window (which is in the container app).
+ * tkWindow.c:AllocWindow. This doesn't work well for embedded windows. So
+ * we override the colormap and visual settings to be the same as the
+ * parent window (which is in the container app).
*/
anyError = 0;
handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1,
- EmbedErrorProc, (ClientData) &anyError);
+ EmbedErrorProc, &anyError);
if (!XGetWindowAttributes(winPtr->display, parent, &parentAtts)) {
- anyError = 1;
+ anyError = 1;
}
XSync(winPtr->display, False);
Tk_DeleteErrorHandler(handler);
if (anyError) {
if (interp != NULL) {
Tcl_AppendResult(interp, "couldn't create child of window \"",
- string, "\"", (char *) NULL);
+ string, "\"", NULL);
}
return TCL_ERROR;
}
@@ -155,18 +154,18 @@ TkpUseWindow(interp, tkwin, string)
parentAtts.colormap);
/*
- * Create an event handler to clean up the Container structure when
- * tkwin is eventually deleted.
+ * Create an event handler to clean up the Container structure when tkwin
+ * is eventually deleted.
*/
Tk_CreateEventHandler(tkwin, StructureNotifyMask, EmbeddedEventProc,
- (ClientData) winPtr);
+ winPtr);
/*
- * Save information about the container and the embedded window
- * in a Container structure. If there is already an existing
- * Container structure, it means that both container and embedded
- * app. are in the same process.
+ * Save information about the container and the embedded window in a
+ * Container structure. If there is already an existing Container
+ * structure, it means that both container and embedded app. are in the
+ * same process.
*/
for (containerPtr = tsdPtr->firstContainerPtr; containerPtr != NULL;
@@ -178,7 +177,7 @@ TkpUseWindow(interp, tkwin, string)
}
}
if (containerPtr == NULL) {
- containerPtr = (Container *) ckalloc(sizeof(Container));
+ containerPtr = ckalloc(sizeof(Container));
containerPtr->parent = parent;
containerPtr->parentRoot = parentAtts.root;
containerPtr->parentPtr = NULL;
@@ -196,8 +195,8 @@ TkpUseWindow(interp, tkwin, string)
*
* TkpMakeWindow --
*
- * Create an actual window system window object based on the
- * current attributes of the specified TkWindow.
+ * Create an actual window system window object based on the current
+ * attributes of the specified TkWindow.
*
* Results:
* Returns the handle to the new window, or None on failure.
@@ -209,28 +208,28 @@ TkpUseWindow(interp, tkwin, string)
*/
Window
-TkpMakeWindow(winPtr, parent)
- TkWindow *winPtr; /* Tk's information about the window that
- * is to be instantiated. */
- Window parent; /* Window system token for the parent in
- * which the window is to be created. */
+TkpMakeWindow(
+ TkWindow *winPtr, /* Tk's information about the window that is
+ * to be instantiated. */
+ Window parent) /* Window system token for the parent in which
+ * the window is to be created. */
{
Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->flags & TK_EMBEDDED) {
/*
- * This window is embedded. Don't create the new window in the
- * given parent; instead, create it as a child of the root window
- * of the container's screen. The window will get reparented
- * into a wrapper window later.
+ * This window is embedded. Don't create the new window in the given
+ * parent; instead, create it as a child of the root window of the
+ * container's screen. The window will get reparented into a wrapper
+ * window later.
*/
for (containerPtr = tsdPtr->firstContainerPtr; ;
containerPtr = containerPtr->nextPtr) {
if (containerPtr == NULL) {
- panic("TkMakeWindow couldn't find container for window");
+ Tcl_Panic("TkMakeWindow couldn't find container for window");
}
if (containerPtr->embeddedPtr == winPtr) {
break;
@@ -252,10 +251,9 @@ TkpMakeWindow(winPtr, parent)
*
* TkpMakeContainer --
*
- * This procedure is called to indicate that a particular window
- * will be a container for an embedded application. This changes
- * certain aspects of the window's behavior, such as whether it
- * will receive events anymore.
+ * This function is called to indicate that a particular window will be a
+ * container for an embedded application. This changes certain aspects of
+ * the window's behavior, such as whether it will receive events anymore.
*
* Results:
* None.
@@ -267,22 +265,22 @@ TkpMakeWindow(winPtr, parent)
*/
void
-TkpMakeContainer(tkwin)
- Tk_Window tkwin; /* Token for a window that is about to
- * become a container. */
+TkpMakeContainer(
+ Tk_Window tkwin) /* Token for a window that is about to become
+ * a container. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * Register the window as a container so that, for example, we can
- * find out later if the embedded app. is in the same process.
+ * Register the window as a container so that, for example, we can find
+ * out later if the embedded app. is in the same process.
*/
Tk_MakeWindowExist(tkwin);
- containerPtr = (Container *) ckalloc(sizeof(Container));
+ containerPtr = ckalloc(sizeof(Container));
containerPtr->parent = Tk_WindowId(tkwin);
containerPtr->parentRoot = RootWindowOfScreen(Tk_Screen(tkwin));
containerPtr->parentPtr = winPtr;
@@ -293,21 +291,21 @@ TkpMakeContainer(tkwin)
winPtr->flags |= TK_CONTAINER;
/*
- * Request SubstructureNotify events so that we can find out when
- * the embedded application creates its window or attempts to
- * resize it. Also watch Configure events on the container so that
- * we can resize the child to match.
+ * Request SubstructureNotify events so that we can find out when the
+ * embedded application creates its window or attempts to resize it. Also
+ * watch Configure events on the container so that we can resize the child
+ * to match.
*/
winPtr->atts.event_mask |= SubstructureRedirectMask|SubstructureNotifyMask;
XSelectInput(winPtr->display, winPtr->window, winPtr->atts.event_mask);
Tk_CreateEventHandler(tkwin,
SubstructureNotifyMask|SubstructureRedirectMask,
- ContainerEventProc, (ClientData) winPtr);
+ ContainerEventProc, winPtr);
Tk_CreateEventHandler(tkwin, StructureNotifyMask, EmbedStructureProc,
- (ClientData) containerPtr);
+ containerPtr);
Tk_CreateEventHandler(tkwin, FocusChangeMask, EmbedFocusProc,
- (ClientData) containerPtr);
+ containerPtr);
}
/*
@@ -315,12 +313,11 @@ TkpMakeContainer(tkwin)
*
* EmbedErrorProc --
*
- * This procedure is invoked if an error occurs while creating
- * an embedded window.
+ * This function is invoked if an error occurs while creating an embedded
+ * window.
*
* Results:
- * Always returns 0 to indicate that the error has been properly
- * handled.
+ * Always returns 0 to indicate that the error has been properly handled.
*
* Side effects:
* The integer pointed to by the clientData argument is set to 1.
@@ -329,10 +326,10 @@ TkpMakeContainer(tkwin)
*/
static int
-EmbedErrorProc(clientData, errEventPtr)
- ClientData clientData; /* Points to integer to set. */
- XErrorEvent *errEventPtr; /* Points to information about error
- * (not used). */
+EmbedErrorProc(
+ ClientData clientData, /* Points to integer to set. */
+ XErrorEvent *errEventPtr) /* Points to information about error (not
+ * used). */
{
int *iPtr = (int *) clientData;
@@ -345,9 +342,9 @@ EmbedErrorProc(clientData, errEventPtr)
*
* EmbeddedEventProc --
*
- * This procedure is invoked by the Tk event dispatcher when various
- * useful events are received for a window that is embedded in
- * another application.
+ * This function is invoked by the Tk event dispatcher when various
+ * useful events are received for a window that is embedded in another
+ * application.
*
* Results:
* None.
@@ -360,9 +357,9 @@ EmbedErrorProc(clientData, errEventPtr)
*/
static void
-EmbeddedEventProc(clientData, eventPtr)
- ClientData clientData; /* Token for container window. */
- XEvent *eventPtr; /* ResizeRequest event. */
+EmbeddedEventProc(
+ ClientData clientData, /* Token for container window. */
+ XEvent *eventPtr) /* ResizeRequest event. */
{
TkWindow *winPtr = (TkWindow *) clientData;
@@ -376,40 +373,40 @@ EmbeddedEventProc(clientData, eventPtr)
*
* ContainerEventProc --
*
- * This procedure is invoked by the Tk event dispatcher when various
- * useful events are received for the children of a container
- * window. It forwards relevant information, such as geometry
- * requests, from the events into the container's application.
+ * This function is invoked by the Tk event dispatcher when various
+ * useful events are received for the children of a container window. It
+ * forwards relevant information, such as geometry requests, from the
+ * events into the container's application.
*
* Results:
* None.
*
* Side effects:
- * Depends on the event. For example, when ConfigureRequest events
- * occur, geometry information gets set for the container window.
+ * Depends on the event. For example, when ConfigureRequest events occur,
+ * geometry information gets set for the container window.
*
*----------------------------------------------------------------------
*/
static void
-ContainerEventProc(clientData, eventPtr)
- ClientData clientData; /* Token for container window. */
- XEvent *eventPtr; /* ResizeRequest event. */
+ContainerEventProc(
+ ClientData clientData, /* Token for container window. */
+ XEvent *eventPtr) /* ResizeRequest event. */
{
TkWindow *winPtr = (TkWindow *) clientData;
Container *containerPtr;
Tk_ErrorHandler errHandler;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * Ignore any X protocol errors that happen in this procedure
- * (almost any operation could fail, for example, if the embedded
- * application has deleted its window).
+ * Ignore any X protocol errors that happen in this function (almost any
+ * operation could fail, for example, if the embedded application has
+ * deleted its window).
*/
errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1,
- -1, -1, (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ -1, -1, NULL, NULL);
/*
* Find the Container structure associated with the parent window.
@@ -419,37 +416,34 @@ ContainerEventProc(clientData, eventPtr)
containerPtr->parent != eventPtr->xmaprequest.parent;
containerPtr = containerPtr->nextPtr) {
if (containerPtr == NULL) {
- panic("ContainerEventProc couldn't find Container record");
+ Tcl_Panic("ContainerEventProc couldn't find Container record");
}
}
if (eventPtr->type == CreateNotify) {
/*
- * A new child window has been created in the container. Record
- * its id in the Container structure (if more than one child is
- * created, just remember the last one and ignore the earlier
- * ones). Also set the child's size to match the container.
+ * A new child window has been created in the container. Record its id
+ * in the Container structure (if more than one child is created, just
+ * remember the last one and ignore the earlier ones). Also set the
+ * child's size to match the container.
*/
containerPtr->wrapper = eventPtr->xcreatewindow.window;
XMoveResizeWindow(eventPtr->xcreatewindow.display,
containerPtr->wrapper, 0, 0,
- (unsigned int) Tk_Width(
- (Tk_Window) containerPtr->parentPtr),
- (unsigned int) Tk_Height(
- (Tk_Window) containerPtr->parentPtr));
+ (unsigned) Tk_Width((Tk_Window) containerPtr->parentPtr),
+ (unsigned) Tk_Height((Tk_Window) containerPtr->parentPtr));
} else if (eventPtr->type == ConfigureRequest) {
if ((eventPtr->xconfigurerequest.x != 0)
|| (eventPtr->xconfigurerequest.y != 0)) {
/*
- * The embedded application is trying to move itself, which
- * isn't legal. At this point, the window hasn't actually
- * moved, but we need to send it a ConfigureNotify event to
- * let it know that its request has been denied. If the
- * embedded application was also trying to resize itself, a
- * ConfigureNotify will be sent by the geometry management
- * code below, so we don't need to do anything. Otherwise,
- * generate a synthetic event.
+ * The embedded application is trying to move itself, which isn't
+ * legal. At this point, the window hasn't actually moved, but we
+ * need to send it a ConfigureNotify event to let it know that its
+ * request has been denied. If the embedded application was also
+ * trying to resize itself, a ConfigureNotify will be sent by the
+ * geometry management code below, so we don't need to do
+ * anything. Otherwise, generate a synthetic event.
*/
if ((eventPtr->xconfigurerequest.width == winPtr->changes.width)
@@ -464,15 +458,15 @@ ContainerEventProc(clientData, eventPtr)
} else if (eventPtr->type == MapRequest) {
/*
* The embedded application's map request was ignored and simply
- * passed on to us, so we have to map the window for it to appear
- * on the screen.
+ * passed on to us, so we have to map the window for it to appear on
+ * the screen.
*/
XMapWindow(eventPtr->xmaprequest.display,
eventPtr->xmaprequest.window);
} else if (eventPtr->type == DestroyNotify) {
/*
- * The embedded application is gone. Destroy the container window.
+ * The embedded application is gone. Destroy the container window.
*/
Tk_DestroyWindow((Tk_Window) winPtr);
@@ -485,11 +479,10 @@ ContainerEventProc(clientData, eventPtr)
*
* EmbedStructureProc --
*
- * This procedure is invoked by the Tk event dispatcher when
- * a container window owned by this application gets resized
- * (and also at several other times that we don't care about).
- * This procedure reflects the size change in the embedded
- * window that corresponds to the container.
+ * This function is invoked by the Tk event dispatcher when a container
+ * window owned by this application gets resized (and also at several
+ * other times that we don't care about). This function reflects the size
+ * change in the embedded window that corresponds to the container.
*
* Results:
* None.
@@ -501,9 +494,9 @@ ContainerEventProc(clientData, eventPtr)
*/
static void
-EmbedStructureProc(clientData, eventPtr)
- ClientData clientData; /* Token for container window. */
- XEvent *eventPtr; /* ResizeRequest event. */
+EmbedStructureProc(
+ ClientData clientData, /* Token for container window. */
+ XEvent *eventPtr) /* ResizeRequest event. */
{
Container *containerPtr = (Container *) clientData;
Tk_ErrorHandler errHandler;
@@ -516,13 +509,11 @@ EmbedStructureProc(clientData, eventPtr)
*/
errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1,
- -1, -1, (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ -1, -1, NULL, NULL);
XMoveResizeWindow(eventPtr->xconfigure.display,
containerPtr->wrapper, 0, 0,
- (unsigned int) Tk_Width(
- (Tk_Window) containerPtr->parentPtr),
- (unsigned int) Tk_Height(
- (Tk_Window) containerPtr->parentPtr));
+ (unsigned) Tk_Width((Tk_Window) containerPtr->parentPtr),
+ (unsigned) Tk_Height((Tk_Window) containerPtr->parentPtr));
Tk_DeleteErrorHandler(errHandler);
}
} else if (eventPtr->type == DestroyNotify) {
@@ -535,11 +526,10 @@ EmbedStructureProc(clientData, eventPtr)
*
* EmbedFocusProc --
*
- * This procedure is invoked by the Tk event dispatcher when
- * FocusIn and FocusOut events occur for a container window owned
- * by this application. It is responsible for moving the focus
- * back and forth between a container application and an embedded
- * application.
+ * This function is invoked by the Tk event dispatcher when FocusIn and
+ * FocusOut events occur for a container window owned by this
+ * application. It is responsible for moving the focus back and forth
+ * between a container application and an embedded application.
*
* Results:
* None.
@@ -551,9 +541,9 @@ EmbedStructureProc(clientData, eventPtr)
*/
static void
-EmbedFocusProc(clientData, eventPtr)
- ClientData clientData; /* Token for container window. */
- XEvent *eventPtr; /* ResizeRequest event. */
+EmbedFocusProc(
+ ClientData clientData, /* Token for container window. */
+ XEvent *eventPtr) /* ResizeRequest event. */
{
Container *containerPtr = (Container *) clientData;
Tk_ErrorHandler errHandler;
@@ -562,15 +552,15 @@ EmbedFocusProc(clientData, eventPtr)
display = Tk_Display(containerPtr->parentPtr);
if (eventPtr->type == FocusIn) {
/*
- * The focus just arrived at the container. Change the X focus
- * to move it to the embedded application, if there is one.
- * Ignore X errors that occur during this operation (it's
- * possible that the new focus window isn't mapped).
+ * The focus just arrived at the container. Change the X focus to move
+ * it to the embedded application, if there is one. Ignore X errors
+ * that occur during this operation (it's possible that the new focus
+ * window isn't mapped).
*/
-
+
if (containerPtr->wrapper != None) {
errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1,
- -1, -1, (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ -1, -1, NULL, NULL);
XSetInputFocus(display, containerPtr->wrapper, RevertToParent,
CurrentTime);
Tk_DeleteErrorHandler(errHandler);
@@ -583,38 +573,38 @@ EmbedFocusProc(clientData, eventPtr)
*
* EmbedGeometryRequest --
*
- * This procedure is invoked when an embedded application requests
- * a particular size. It processes the request (which may or may
- * not actually honor the request) and reflects the results back
- * to the embedded application.
+ * This function is invoked when an embedded application requests a
+ * particular size. It processes the request (which may or may not
+ * actually honor the request) and reflects the results back to the
+ * embedded application.
*
* Results:
* None.
*
* Side effects:
- * If we deny the child's size change request, a Configure event
- * is synthesized to let the child know how big it ought to be.
- * Events get processed while we're waiting for the geometry
- * managers to do their thing.
+ * If we deny the child's size change request, a Configure event is
+ * synthesized to let the child know how big it ought to be. Events get
+ * processed while we're waiting for the geometry managers to do their
+ * thing.
*
*----------------------------------------------------------------------
*/
static void
-EmbedGeometryRequest(containerPtr, width, height)
- Container *containerPtr; /* Information about the embedding. */
- int width, height; /* Size that the child has requested. */
+EmbedGeometryRequest(
+ Container *containerPtr, /* Information about the embedding. */
+ int width, int height) /* Size that the child has requested. */
{
TkWindow *winPtr = containerPtr->parentPtr;
/*
- * Forward the requested size into our geometry management hierarchy
- * via the container window. We need to send a Configure event back
- * to the embedded application if we decide not to honor its
- * request; to make this happen, process all idle event handlers
- * synchronously here (so that the geometry managers have had a
- * chance to do whatever they want to do), and if the window's size
- * didn't change then generate a configure event.
+ * Forward the requested size into our geometry management hierarchy via
+ * the container window. We need to send a Configure event back to the
+ * embedded application if we decide not to honor its request; to make
+ * this happen, process all idle event handlers synchronously here (so
+ * that the geometry managers have had a chance to do whatever they want
+ * to do), and if the window's size didn't change then generate a
+ * configure event.
*/
Tk_GeometryRequest((Tk_Window) winPtr, width, height);
@@ -632,11 +622,11 @@ EmbedGeometryRequest(containerPtr, width, height)
*
* EmbedSendConfigure --
*
- * This procedure synthesizes a ConfigureNotify event to notify an
- * embedded application of its current size and location. This
- * procedure is called when the embedded application made a
- * geometry request that we did not grant, so that the embedded
- * application knows that its geometry didn't change after all.
+ * This function synthesizes a ConfigureNotify event to notify an
+ * embedded application of its current size and location. This function
+ * is called when the embedded application made a geometry request that
+ * we did not grant, so that the embedded application knows that its
+ * geometry didn't change after all.
*
* Results:
* None.
@@ -648,15 +638,14 @@ EmbedGeometryRequest(containerPtr, width, height)
*/
static void
-EmbedSendConfigure(containerPtr)
- Container *containerPtr; /* Information about the embedding. */
+EmbedSendConfigure(
+ Container *containerPtr) /* Information about the embedding. */
{
TkWindow *winPtr = containerPtr->parentPtr;
XEvent event;
event.xconfigure.type = ConfigureNotify;
- event.xconfigure.serial =
- LastKnownRequestProcessed(winPtr->display);
+ event.xconfigure.serial = LastKnownRequestProcessed(winPtr->display);
event.xconfigure.send_event = True;
event.xconfigure.display = winPtr->display;
event.xconfigure.event = containerPtr->wrapper;
@@ -669,24 +658,23 @@ EmbedSendConfigure(containerPtr)
event.xconfigure.override_redirect = False;
/*
- * Note: when sending the event below, the ButtonPressMask
- * causes the event to be sent only to applications that have
- * selected for ButtonPress events, which should be just the
- * embedded application.
+ * Note: when sending the event below, the ButtonPressMask causes the
+ * event to be sent only to applications that have selected for
+ * ButtonPress events, which should be just the embedded application.
*/
XSendEvent(winPtr->display, containerPtr->wrapper, False,
0, &event);
/*
- * The following needs to be done if the embedded window is
- * not in the same application as the container window.
+ * The following needs to be done if the embedded window is not in the
+ * same application as the container window.
*/
if (containerPtr->embeddedPtr == NULL) {
XMoveResizeWindow(winPtr->display, containerPtr->wrapper, 0, 0,
- (unsigned int) winPtr->changes.width,
- (unsigned int) winPtr->changes.height);
+ (unsigned) winPtr->changes.width,
+ (unsigned) winPtr->changes.height);
}
}
@@ -695,13 +683,13 @@ EmbedSendConfigure(containerPtr)
*
* TkpGetOtherWindow --
*
- * If both the container and embedded window are in the same
- * process, this procedure will return either one, given the other.
+ * If both the container and embedded window are in the same process,
+ * this function will return either one, given the other.
*
* Results:
* If winPtr 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.
+ * embedded window, and vice versa. If the "other" window isn't in this
+ * process, NULL is returned.
*
* Side effects:
* None.
@@ -710,15 +698,15 @@ EmbedSendConfigure(containerPtr)
*/
TkWindow *
-TkpGetOtherWindow(winPtr)
- TkWindow *winPtr; /* Tk's structure for a container or
- * embedded window. */
+TkpGetOtherWindow(
+ TkWindow *winPtr) /* Tk's structure for a container or embedded
+ * window. */
{
Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- for (containerPtr = tsdPtr->firstContainerPtr;
+ for (containerPtr = tsdPtr->firstContainerPtr;
containerPtr != NULL;
containerPtr = containerPtr->nextPtr) {
if (containerPtr->embeddedPtr == winPtr) {
@@ -735,13 +723,13 @@ TkpGetOtherWindow(winPtr)
*
* TkpRedirectKeyEvent --
*
- * This procedure is invoked when a key press or release event
- * arrives for an application that does not believe it owns the
- * input focus. This can happen because of embedding; for example,
- * X can send an event to an embedded application when the real
- * focus window is in the container application and is an ancestor
- * of the container. This procedure's job is to forward the event
- * back to the application where it really belongs.
+ * This function is invoked when a key press or release event arrives for
+ * an application that does not believe it owns the input focus. This can
+ * happen because of embedding; for example, X can send an event to an
+ * embedded application when the real focus window is in the container
+ * application and is an ancestor of the container. This function's job
+ * is to forward the event back to the application where it really
+ * belongs.
*
* Results:
* None.
@@ -753,15 +741,15 @@ TkpGetOtherWindow(winPtr)
*/
void
-TkpRedirectKeyEvent(winPtr, eventPtr)
- TkWindow *winPtr; /* Window to which the event was originally
+TkpRedirectKeyEvent(
+ TkWindow *winPtr, /* Window to which the event was originally
* reported. */
- XEvent *eventPtr; /* X event to redirect (should be KeyPress
- * or KeyRelease). */
+ XEvent *eventPtr) /* X event to redirect (should be KeyPress or
+ * KeyRelease). */
{
Container *containerPtr;
Window saved;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -771,8 +759,8 @@ TkpRedirectKeyEvent(winPtr, eventPtr)
while (1) {
if (winPtr == NULL) {
/*
- * This window is being deleted. This is too confusing a
- * case to handle so discard the event.
+ * This window is being deleted. This is too confusing a case to
+ * handle so discard the event.
*/
return;
@@ -785,10 +773,10 @@ TkpRedirectKeyEvent(winPtr, eventPtr)
if (winPtr->flags & TK_EMBEDDED) {
/*
- * This application is embedded. If we got a key event without
- * officially having the focus, it means that the focus is
- * really in the container, but the mouse was over the embedded
- * application. Send the event back to the container.
+ * This application is embedded. If we got a key event without
+ * officially having the focus, it means that the focus is really in
+ * the container, but the mouse was over the embedded application.
+ * Send the event back to the container.
*/
for (containerPtr = tsdPtr->firstContainerPtr;
@@ -799,7 +787,7 @@ TkpRedirectKeyEvent(winPtr, eventPtr)
saved = eventPtr->xkey.window;
eventPtr->xkey.window = containerPtr->parent;
XSendEvent(eventPtr->xkey.display, eventPtr->xkey.window, False,
- KeyPressMask|KeyReleaseMask, eventPtr);
+ KeyPressMask|KeyReleaseMask, eventPtr);
eventPtr->xkey.window = saved;
}
}
@@ -809,10 +797,10 @@ TkpRedirectKeyEvent(winPtr, eventPtr)
*
* TkpClaimFocus --
*
- * This procedure is invoked when someone asks or the input focus
- * to be put on a window in an embedded application, but the
- * application doesn't currently have the focus. It requests the
- * input focus from the container application.
+ * This function is invoked when someone asks or the input focus to be
+ * put on a window in an embedded application, but the application
+ * doesn't currently have the focus. It requests the input focus from the
+ * container application.
*
* Results:
* None.
@@ -824,16 +812,16 @@ TkpRedirectKeyEvent(winPtr, eventPtr)
*/
void
-TkpClaimFocus(topLevelPtr, force)
- TkWindow *topLevelPtr; /* Top-level window containing desired
- * focus window; should be embedded. */
- int force; /* One means that the container should
- * claim the focus if it doesn't
- * currently have it. */
+TkpClaimFocus(
+ TkWindow *topLevelPtr, /* Top-level window containing desired focus
+ * window; should be embedded. */
+ int force) /* One means that the container should claim
+ * the focus if it doesn't currently have
+ * it. */
{
XEvent event;
Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!(topLevelPtr->flags & TK_EMBEDDED)) {
@@ -861,9 +849,8 @@ TkpClaimFocus(topLevelPtr, force)
*
* TkpTestembedCmd --
*
- * This procedure implements the "testembed" command. It returns
- * some or all of the information in the list pointed to by
- * firstContainerPtr.
+ * This function implements the "testembed" command. It returns some or
+ * all of the information in the list pointed to by firstContainerPtr.
*
* Results:
* A standard Tcl result.
@@ -875,17 +862,17 @@ TkpClaimFocus(topLevelPtr, force)
*/
int
-TkpTestembedCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Main window for application. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TkpTestembedCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ const char **argv) /* Argument strings. */
{
int all;
Container *containerPtr;
Tcl_DString dString;
char buffer[50];
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if ((argc > 1) && (strcmp(argv[1], "all") == 0)) {
@@ -899,13 +886,11 @@ TkpTestembedCmd(clientData, interp, argc, argv)
Tcl_DStringStartSublist(&dString);
if (containerPtr->parent == None) {
Tcl_DStringAppendElement(&dString, "");
+ } else if (all) {
+ sprintf(buffer, "0x%x", (int) containerPtr->parent);
+ Tcl_DStringAppendElement(&dString, buffer);
} else {
- if (all) {
- sprintf(buffer, "0x%x", (int) containerPtr->parent);
- Tcl_DStringAppendElement(&dString, buffer);
- } else {
- Tcl_DStringAppendElement(&dString, "XXX");
- }
+ Tcl_DStringAppendElement(&dString, "XXX");
}
if (containerPtr->parentPtr == NULL) {
Tcl_DStringAppendElement(&dString, "");
@@ -915,13 +900,11 @@ TkpTestembedCmd(clientData, interp, argc, argv)
}
if (containerPtr->wrapper == None) {
Tcl_DStringAppendElement(&dString, "");
+ } else if (all) {
+ sprintf(buffer, "0x%x", (int) containerPtr->wrapper);
+ Tcl_DStringAppendElement(&dString, buffer);
} else {
- if (all) {
- sprintf(buffer, "0x%x", (int) containerPtr->wrapper);
- Tcl_DStringAppendElement(&dString, buffer);
- } else {
- Tcl_DStringAppendElement(&dString, "XXX");
- }
+ Tcl_DStringAppendElement(&dString, "XXX");
}
if (containerPtr->embeddedPtr == NULL) {
Tcl_DStringAppendElement(&dString, "");
@@ -940,9 +923,9 @@ TkpTestembedCmd(clientData, interp, argc, argv)
*
* EmbedWindowDeleted --
*
- * This procedure is invoked when a window involved in embedding
- * (as either the container or the embedded application) is
- * destroyed. It cleans up the Container structure for the window.
+ * This function is invoked when a window involved in embedding (as
+ * either the container or the embedded application) is destroyed. It
+ * cleans up the Container structure for the window.
*
* Results:
* None.
@@ -954,16 +937,16 @@ TkpTestembedCmd(clientData, interp, argc, argv)
*/
static void
-EmbedWindowDeleted(winPtr)
- TkWindow *winPtr; /* Tk's information about window that
- * was deleted. */
+EmbedWindowDeleted(
+ TkWindow *winPtr) /* Tk's information about window that was
+ * deleted. */
{
Container *containerPtr, *prevPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * Find the Container structure for this window work. Delete the
+ * Find the Container structure for this window work. Delete the
* information about the embedded application and free the container's
* record.
*/
@@ -990,7 +973,7 @@ EmbedWindowDeleted(winPtr)
} else {
prevPtr->nextPtr = containerPtr->nextPtr;
}
- ckfree((char *) containerPtr);
+ ckfree(containerPtr);
}
}
@@ -999,12 +982,12 @@ EmbedWindowDeleted(winPtr)
*
* TkUnixContainerId --
*
- * Given an embedded window, this procedure returns the X window
+ * Given an embedded window, this function returns the X window
* identifier for the associated container window.
*
* Results:
- * The return value is the X window identifier for winPtr's
- * container window.
+ * The return value is the X window identifier for winPtr's container
+ * window.
*
* Side effects:
* None.
@@ -1013,19 +996,197 @@ EmbedWindowDeleted(winPtr)
*/
Window
-TkUnixContainerId(winPtr)
- TkWindow *winPtr; /* Tk's structure for an embedded window. */
+TkUnixContainerId(
+ TkWindow *winPtr) /* Tk's structure for an embedded window. */
{
Container *containerPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- for (containerPtr = tsdPtr->firstContainerPtr;
+ for (containerPtr = tsdPtr->firstContainerPtr;
containerPtr != NULL; containerPtr = containerPtr->nextPtr) {
if (containerPtr->embeddedPtr == winPtr) {
return containerPtr->parent;
}
}
- panic("TkUnixContainerId couldn't find window");
+ Tcl_Panic("TkUnixContainerId couldn't find window");
+ return None;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpShowBusyWindow --
+ *
+ * Makes a busy window "appear".
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Arranges for the busy window to start intercepting events and the
+ * cursor to change to the configured "hey, I'm busy!" setting.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpShowBusyWindow(
+ TkBusy busy)
+{
+ Busy *busyPtr = (Busy *) busy;
+
+ if (busyPtr->tkBusy != NULL) {
+ Tk_MapWindow(busyPtr->tkBusy);
+
+ /*
+ * Always raise the busy window just in case new sibling windows have
+ * been created in the meantime. Can't use Tk_RestackWindow because it
+ * doesn't work under Win32.
+ */
+
+ XRaiseWindow(Tk_Display(busyPtr->tkBusy),
+ Tk_WindowId(busyPtr->tkBusy));
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpHideBusyWindow --
+ *
+ * Makes a busy window "disappear".
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Arranges for the busy window to stop intercepting events, and the
+ * cursor to change back to its normal setting.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpHideBusyWindow(
+ TkBusy busy)
+{
+ Busy *busyPtr = (Busy *) busy;
+
+ if (busyPtr->tkBusy != NULL) {
+ Tk_UnmapWindow(busyPtr->tkBusy);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpMakeTransparentWindowExist --
+ *
+ * Construct the platform-specific resources for a transparent window.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Moves the specified window in the stacking order.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpMakeTransparentWindowExist(
+ Tk_Window tkwin, /* Token for window. */
+ Window parent) /* Parent window. */
+{
+ TkWindow *winPtr = (TkWindow *) tkwin;
+ long int mask = CWDontPropagate | CWEventMask;
+
+ /*
+ * Ignore the important events while the window is mapped.
+ */
+
+#define USER_EVENTS \
+ (EnterWindowMask | LeaveWindowMask | KeyPressMask | KeyReleaseMask | \
+ ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
+#define PROP_EVENTS \
+ (KeyPressMask | KeyReleaseMask | ButtonPressMask | \
+ ButtonReleaseMask | PointerMotionMask)
+
+ winPtr->atts.do_not_propagate_mask = PROP_EVENTS;
+ winPtr->atts.event_mask = USER_EVENTS;
+ winPtr->changes.border_width = 0;
+ winPtr->depth = 0;
+
+ winPtr->window = XCreateWindow(winPtr->display, parent,
+ winPtr->changes.x, winPtr->changes.y,
+ (unsigned) winPtr->changes.width, /* width */
+ (unsigned) winPtr->changes.height, /* height */
+ (unsigned) winPtr->changes.border_width, /* border_width */
+ winPtr->depth, InputOnly, winPtr->visual, mask, &winPtr->atts);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpCreateBusy --
+ *
+ * Construct the platform-specific parts of a busy window. Note that this
+ * postpones the actual creation of the window resource until later. The
+ * GetParent() function is a helper for this.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Sets up part of the busy window structure.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static inline Window
+GetParent(
+ Display *display,
+ Window window)
+{
+ Window root, parent;
+ Window *dummy;
+ unsigned int count;
+
+ if (XQueryTree(display, window, &root, &parent, &dummy, &count) > 0) {
+ XFree(dummy);
+ return parent;
+ }
return None;
}
+
+void
+TkpCreateBusy(
+ Tk_FakeWin *winPtr,
+ Tk_Window tkRef,
+ Window *parentPtr,
+ Tk_Window tkParent,
+ TkBusy busy)
+{
+ if (winPtr->flags & TK_REPARENTED) {
+ /*
+ * This works around a bug in the implementation of menubars for
+ * non-MacIntosh window systems (Win32 and X11). Tk doesn't reset the
+ * pointers to the parent window when the menu is reparented (since
+ * winPtr->parentPtr points to the wrong window). We get around this
+ * by determining the parent via the native API calls.
+ */
+
+ *parentPtr = GetParent(Tk_Display(tkRef), Tk_WindowId(tkRef));
+ } else {
+ *parentPtr = Tk_WindowId(tkParent);
+ }
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c
index 60800d2..0987129 100644
--- a/unix/tkUnixEvent.c
+++ b/unix/tkUnixEvent.c
@@ -1,22 +1,21 @@
-/*
+/*
* tkUnixEvent.c --
*
- * This file implements an event source for X displays for the
- * UNIX version of Tk.
+ * This file implements an event source for X displays for the UNIX
+ * version of Tk.
*
* Copyright (c) 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.
+ * 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 "tkUnixInt.h"
#include <signal.h>
/*
- * The following static indicates whether this module has been initialized
- * in the current thread.
+ * The following static indicates whether this module has been initialized in
+ * the current thread.
*/
typedef struct ThreadSpecificData {
@@ -24,42 +23,26 @@ typedef struct ThreadSpecificData {
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
-#if defined(TK_USE_INPUT_METHODS) && defined(PEEK_XCLOSEIM)
-/*
- * Structure used to peek into internal XIM data structure.
- * This is only known to work with XFree86.
- */
-struct XIMPeek {
- void *junk1, *junk2;
- XIC ic_chain;
-};
-#endif
-
/*
- * Prototypes for procedures that are referenced only in this file:
+ * Prototypes for functions that are referenced only in this file:
*/
-static void DisplayCheckProc _ANSI_ARGS_((ClientData clientData,
- int flags));
-static void DisplayExitHandler _ANSI_ARGS_((
- ClientData clientData));
-static void DisplayFileProc _ANSI_ARGS_((ClientData clientData,
- int flags));
-static void DisplaySetupProc _ANSI_ARGS_((ClientData clientData,
- int flags));
-static void TransferXEventsToTcl _ANSI_ARGS_((Display *display));
+static void DisplayCheckProc(ClientData clientData, int flags);
+static void DisplayExitHandler(ClientData clientData);
+static void DisplayFileProc(ClientData clientData, int flags);
+static void DisplaySetupProc(ClientData clientData, int flags);
+static void TransferXEventsToTcl(Display *display);
#ifdef TK_USE_INPUT_METHODS
-static void OpenIM _ANSI_ARGS_((TkDisplay *dispPtr));
+static void OpenIM(TkDisplay *dispPtr);
#endif
-
/*
*----------------------------------------------------------------------
*
* TkCreateXEventSource --
*
- * This procedure is called during Tk initialization to create
- * the event source for X Window events.
+ * This function is called during Tk initialization to create the event
+ * source for X Window events.
*
* Results:
* None.
@@ -71,10 +54,10 @@ static void OpenIM _ANSI_ARGS_((TkDisplay *dispPtr));
*/
void
-TkCreateXEventSource()
+TkCreateXEventSource(void)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!tsdPtr->initialized) {
tsdPtr->initialized = 1;
@@ -88,8 +71,8 @@ TkCreateXEventSource()
*
* DisplayExitHandler --
*
- * This function is called during finalization to clean up the
- * display module.
+ * This function is called during finalization to clean up the display
+ * module.
*
* Results:
* None.
@@ -101,11 +84,11 @@ TkCreateXEventSource()
*/
static void
-DisplayExitHandler(clientData)
- ClientData clientData; /* Not used. */
+DisplayExitHandler(
+ ClientData clientData) /* Not used. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_DeleteEventSource(DisplaySetupProc, DisplayCheckProc, NULL);
tsdPtr->initialized = 0;
@@ -116,8 +99,8 @@ DisplayExitHandler(clientData)
*
* TkpOpenDisplay --
*
- * Allocates a new TkDisplay, opens the X display, and establishes
- * the file handler for the connection.
+ * Allocates a new TkDisplay, opens the X display, and establishes the
+ * file handler for the connection.
*
* Results:
* A pointer to a Tk display structure.
@@ -129,23 +112,23 @@ DisplayExitHandler(clientData)
*/
TkDisplay *
-TkpOpenDisplay(display_name)
- CONST char *display_name;
+TkpOpenDisplay(
+ const char *displayNameStr)
{
TkDisplay *dispPtr;
- Display *display = XOpenDisplay(display_name);
+ Display *display = XOpenDisplay(displayNameStr);
if (display == NULL) {
return NULL;
}
- dispPtr = (TkDisplay *) ckalloc(sizeof(TkDisplay));
+ dispPtr = ckalloc(sizeof(TkDisplay));
memset(dispPtr, 0, sizeof(TkDisplay));
dispPtr->display = display;
#ifdef TK_USE_INPUT_METHODS
OpenIM(dispPtr);
#endif
Tcl_CreateFileHandler(ConnectionNumber(display), TCL_READABLE,
- DisplayFileProc, (ClientData) dispPtr);
+ DisplayFileProc, dispPtr);
return dispPtr;
}
@@ -154,7 +137,7 @@ TkpOpenDisplay(display_name)
*
* TkpCloseDisplay --
*
- * Cancels notifier callbacks and closes a display.
+ * Cancels notifier callbacks and closes a display.
*
* Results:
* None.
@@ -166,65 +149,18 @@ TkpOpenDisplay(display_name)
*/
void
-TkpCloseDisplay(dispPtr)
- TkDisplay *dispPtr;
+TkpCloseDisplay(
+ TkDisplay *dispPtr)
{
TkSendCleanup(dispPtr);
- TkFreeXId(dispPtr);
-
TkWmCleanup(dispPtr);
#ifdef TK_USE_INPUT_METHODS
-#if TK_XIM_SPOT
if (dispPtr->inputXfs) {
XFreeFontSet(dispPtr->display, dispPtr->inputXfs);
}
-#endif
if (dispPtr->inputMethod) {
- /*
- * Calling XCloseIM with an input context that has not
- * been freed can cause a crash. This crash has been
- * reproduced under Linux systems with XFree86 3.3
- * and may have also been seen under Solaris 2.3.
- * The crash is caused by a double free of memory
- * inside the X library. Memory that was already
- * deallocated may be accessed again inside XCloseIM.
- * This bug can be avoided by making sure that a
- * call to XDestroyIC is made for each XCreateIC call.
- * This bug has been fixed in XFree86 4.2.99.2.
- * The internal layout of the XIM structure changed
- * in the XFree86 4.2 release so the test should
- * not be run for with these new releases.
- */
-
-#if defined(TK_USE_INPUT_METHODS) && defined(PEEK_XCLOSEIM)
- int do_peek = 0;
- struct XIMPeek *peek;
-
- if (strstr(ServerVendor(dispPtr->display), "XFree86")) {
- int vendrel = VendorRelease(dispPtr->display);
- if (vendrel < 336) {
- /* 3.3.4 and 3.3.5 */
- do_peek = 1;
- } else if (vendrel < 3900) {
- /* Other 3.3.x versions */
- do_peek = 1;
- } else if (vendrel < 40000000) {
- /* 4.0.x versions */
- do_peek = 1;
- } else {
- /* Newer than 4.0 */
- do_peek = 0;
- }
- }
-
- if (do_peek) {
- peek = (struct XIMPeek *) dispPtr->inputMethod;
- if (peek->ic_chain != NULL)
- panic("input contexts not freed before XCloseIM");
- }
-#endif
XCloseIM(dispPtr->inputMethod);
}
#endif
@@ -241,11 +177,10 @@ TkpCloseDisplay(dispPtr)
*
* TkClipCleanup --
*
- * This procedure is called to cleanup resources associated with
- * claiming clipboard ownership and for receiving selection get
- * results. This function is called in tkWindow.c. This has to be
- * called by the display cleanup function because we still need the
- * access display elements.
+ * This function is called to cleanup resources associated with claiming
+ * clipboard ownership and for receiving selection get results. This
+ * function is called in tkWindow.c. This has to be called by the display
+ * cleanup function because we still need the access display elements.
*
* Results:
* None.
@@ -257,8 +192,8 @@ TkpCloseDisplay(dispPtr)
*/
void
-TkClipCleanup(dispPtr)
- TkDisplay *dispPtr; /* display associated with clipboard */
+TkClipCleanup(
+ TkDisplay *dispPtr) /* Display associated with clipboard */
{
if (dispPtr->clipWindow != NULL) {
Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
@@ -267,7 +202,7 @@ TkClipCleanup(dispPtr)
dispPtr->windowAtom);
Tk_DestroyWindow(dispPtr->clipWindow);
- Tcl_Release((ClientData) dispPtr->clipWindow);
+ Tcl_Release(dispPtr->clipWindow);
dispPtr->clipWindow = NULL;
}
}
@@ -277,25 +212,25 @@ TkClipCleanup(dispPtr)
*
* DisplaySetupProc --
*
- * This procedure implements the setup part of the UNIX X display
- * event source. It is invoked by Tcl_DoOneEvent before entering
- * the notifier to check for events on all displays.
+ * This function implements the setup part of the UNIX X display event
+ * source. It is invoked by Tcl_DoOneEvent before entering the notifier
+ * to check for events on all displays.
*
* Results:
* None.
*
* Side effects:
- * If data is queued on a display inside Xlib, then the maximum
- * block time will be set to 0 to ensure that the notifier returns
- * control to Tcl even if there is no more data on the X connection.
+ * If data is queued on a display inside Xlib, then the maximum block
+ * time will be set to 0 to ensure that the notifier returns control to
+ * Tcl even if there is no more data on the X connection.
*
*----------------------------------------------------------------------
*/
static void
-DisplaySetupProc(clientData, flags)
- ClientData clientData; /* Not used. */
- int flags;
+DisplaySetupProc(
+ ClientData clientData, /* Not used. */
+ int flags)
{
TkDisplay *dispPtr;
static Tcl_Time blockTime = { 0, 0 };
@@ -305,13 +240,11 @@ DisplaySetupProc(clientData, flags)
}
for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
- dispPtr = dispPtr->nextPtr) {
-
+ dispPtr = dispPtr->nextPtr) {
/*
- * Flush the display. If data is pending on the X queue, set
- * the block time to zero. This ensures that we won't block
- * in the notifier if there is data in the X queue, but not on
- * the server socket.
+ * Flush the display. If data is pending on the X queue, set the block
+ * time to zero. This ensures that we won't block in the notifier if
+ * there is data in the X queue, but not on the server socket.
*/
XFlush(dispPtr->display);
@@ -324,9 +257,9 @@ DisplaySetupProc(clientData, flags)
/*
*----------------------------------------------------------------------
*
- * TransferXEventsToTcl
+ * TransferXEventsToTcl --
*
- * Transfer events from the X event queue to the Tk event queue.
+ * Transfer events from the X event queue to the Tk event queue.
*
* Results:
* None.
@@ -338,25 +271,81 @@ DisplaySetupProc(clientData, flags)
*/
static void
-TransferXEventsToTcl(display)
- Display *display;
+TransferXEventsToTcl(
+ Display *display)
{
- XEvent event;
+ union {
+ int type;
+ XEvent x;
+ TkKeyEvent k;
+#ifdef GenericEvent
+ xGenericEvent xge;
+#endif
+ } event;
+ Window w;
+ TkDisplay *dispPtr = NULL;
/*
- * Transfer events from the X event queue to the Tk event queue
- * after XIM event filtering. KeyPress and KeyRelease events
- * are filtered in Tk_HandleEvent instead of here, so that Tk's
- * focus management code can redirect them.
+ * Transfer events from the X event queue to the Tk event queue after XIM
+ * event filtering. KeyPress and KeyRelease events need special treatment
+ * so that they get directed according to Tk's focus rules during XIM
+ * handling. Theoretically they can go to the wrong place still (if
+ * there's a focus change in the queue) but if we push the handling off
+ * until Tk_HandleEvent then many input methods actually cease to work
+ * correctly. Most of the time, Tk processes its event queue fast enough
+ * for this to not be an issue anyway. [Bug 1924761]
*/
+
while (QLength(display) > 0) {
- XNextEvent(display, &event);
- if (event.type != KeyPress && event.type != KeyRelease) {
- if (XFilterEvent(&event, None)) {
- continue;
+ XNextEvent(display, &event.x);
+#ifdef GenericEvent
+ if (event.type == GenericEvent) {
+ Tcl_Panic("Wild GenericEvent; panic! (extension=%d,evtype=%d)",
+ event.xge.extension, event.xge.evtype);
+ }
+#endif
+ w = None;
+ if (event.type == KeyPress || event.type == KeyRelease) {
+ for (dispPtr = TkGetDisplayList(); ; dispPtr = dispPtr->nextPtr) {
+ if (dispPtr == NULL) {
+ break;
+ } else if (dispPtr->display == event.x.xany.display) {
+ if (dispPtr->focusPtr != NULL) {
+ w = dispPtr->focusPtr->window;
+ }
+ break;
+ }
+ }
+ }
+ if (XFilterEvent(&event.x, w)) {
+ continue;
+ }
+ if (event.type == KeyPress || event.type == KeyRelease) {
+ event.k.charValuePtr = NULL;
+ event.k.charValueLen = 0;
+ event.k.keysym = NoSymbol;
+
+ /*
+ * Force the calling of the input method engine now. The results
+ * from it will be cached in the event so that they don't get lost
+ * (to a race condition with other XIM-handled key events) between
+ * entering the event queue and getting serviced. [Bug 1924761]
+ */
+
+#ifdef TK_USE_INPUT_METHODS
+ if (event.type == KeyPress && dispPtr &&
+ (dispPtr->flags & TK_DISPLAY_USE_IM)) {
+ if (dispPtr->focusPtr && dispPtr->focusPtr->inputContext) {
+ Tcl_DString ds;
+
+ Tcl_DStringInit(&ds);
+ (void) TkpGetString(dispPtr->focusPtr, &event.x, &ds);
+ Tcl_DStringFree(&ds);
+ }
}
+#endif
}
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+ Tk_QueueWindowEvent(&event.x, TCL_QUEUE_TAIL);
}
}
@@ -365,8 +354,7 @@ TransferXEventsToTcl(display)
*
* DisplayCheckProc --
*
- * This procedure checks for events sitting in the X event
- * queue.
+ * This function checks for events sitting in the X event queue.
*
* Results:
* None.
@@ -378,9 +366,9 @@ TransferXEventsToTcl(display)
*/
static void
-DisplayCheckProc(clientData, flags)
- ClientData clientData; /* Not used. */
- int flags;
+DisplayCheckProc(
+ ClientData clientData, /* Not used. */
+ int flags)
{
TkDisplay *dispPtr;
@@ -389,7 +377,7 @@ DisplayCheckProc(clientData, flags)
}
for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
- dispPtr = dispPtr->nextPtr) {
+ dispPtr = dispPtr->nextPtr) {
XFlush(dispPtr->display);
TransferXEventsToTcl(dispPtr->display);
}
@@ -400,22 +388,22 @@ DisplayCheckProc(clientData, flags)
*
* DisplayFileProc --
*
- * This procedure implements the file handler for the X connection.
+ * This function implements the file handler for the X connection.
*
* Results:
* None.
*
* Side effects:
- * Makes entries on the Tcl event queue for all the events available
- * from all the displays.
+ * Makes entries on the Tcl event queue for all the events available from
+ * all the displays.
*
*----------------------------------------------------------------------
*/
static void
-DisplayFileProc(clientData, flags)
- ClientData clientData; /* The display pointer. */
- int flags; /* Should be TCL_READABLE. */
+DisplayFileProc(
+ ClientData clientData, /* The display pointer. */
+ int flags) /* Should be TCL_READABLE. */
{
TkDisplay *dispPtr = (TkDisplay *) clientData;
Display *display = dispPtr->display;
@@ -424,38 +412,34 @@ DisplayFileProc(clientData, flags)
XFlush(display);
numFound = XEventsQueued(display, QueuedAfterReading);
if (numFound == 0) {
-
/*
- * Things are very tricky if there aren't any events readable
- * at this point (after all, there was supposedly data
- * available on the connection). A couple of things could
- * have occurred:
- *
- * One possibility is that there were only error events in the
- * input from the server. If this happens, we should return
- * (we don't want to go to sleep in XNextEvent below, since
- * this would block out other sources of input to the
- * process).
+ * Things are very tricky if there aren't any events readable at this
+ * point (after all, there was supposedly data available on the
+ * connection). A couple of things could have occurred:
+ *
+ * One possibility is that there were only error events in the input
+ * from the server. If this happens, we should return (we don't want
+ * to go to sleep in XNextEvent below, since this would block out
+ * other sources of input to the process).
*
- * Another possibility is that our connection to the server
- * has been closed. This will not necessarily be detected in
- * XEventsQueued (!!), so if we just return then there will be
- * an infinite loop. To detect such an error, generate a NoOp
- * protocol request to exercise the connection to the server,
- * then return. However, must disable SIGPIPE while sending
- * the request, or else the process will die from the signal
- * and won't invoke the X error function to print a nice (?!)
- * message.
+ * Another possibility is that our connection to the server has been
+ * closed. This will not necessarily be detected in XEventsQueued (!!)
+ * so if we just return then there will be an infinite loop. To detect
+ * such an error, generate a NoOp protocol request to exercise the
+ * connection to the server, then return. However, must disable
+ * SIGPIPE while sending the request, or else the process will die
+ * from the signal and won't invoke the X error function to print a
+ * nice (?!) message.
*/
-
+
void (*oldHandler)();
-
+
oldHandler = (void (*)()) signal(SIGPIPE, SIG_IGN);
XNoOp(display);
XFlush(display);
(void) signal(SIGPIPE, oldHandler);
}
-
+
TransferXEventsToTcl(display);
}
@@ -481,8 +465,8 @@ DisplayFileProc(clientData, flags)
*/
int
-TkUnixDoOneXEvent(timePtr)
- Tcl_Time *timePtr; /* Specifies the absolute time when the call
+TkUnixDoOneXEvent(
+ Tcl_Time *timePtr) /* Specifies the absolute time when the call
* should time out. */
{
TkDisplay *dispPtr;
@@ -490,10 +474,10 @@ TkUnixDoOneXEvent(timePtr)
struct timeval blockTime, *timeoutPtr;
Tcl_Time now;
int fd, index, numFound, numFdBits = 0;
- fd_mask bit;
+ fd_mask bit, *readMaskPtr = readMask;
/*
- * Look for queued events first.
+ * Look for queued events first.
*/
if (Tcl_ServiceEvent(TCL_WINDOW_EVENTS)) {
@@ -507,7 +491,7 @@ TkUnixDoOneXEvent(timePtr)
*/
if (timePtr) {
- TclpGetTime(&now);
+ Tcl_GetTime(&now);
blockTime.tv_sec = timePtr->sec;
blockTime.tv_usec = timePtr->usec - now.usec;
if (blockTime.tv_usec < 0) {
@@ -530,7 +514,7 @@ TkUnixDoOneXEvent(timePtr)
* pending, then we want to poll instead of blocking.
*/
- memset((VOID *) readMask, 0, MASK_SIZE*sizeof(fd_mask));
+ memset(readMask, 0, MASK_SIZE*sizeof(fd_mask));
for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
dispPtr = dispPtr->nextPtr) {
XFlush(dispPtr->display);
@@ -539,11 +523,6 @@ TkUnixDoOneXEvent(timePtr)
blockTime.tv_usec = 0;
}
fd = ConnectionNumber(dispPtr->display);
-
- /*
- * Assume there are always at least 'fd' bits in the 'readMask' array.
- */
-
index = fd/(NBBY*sizeof(fd_mask));
bit = ((fd_mask)1) << (fd%(NBBY*sizeof(fd_mask)));
readMask[index] |= bit;
@@ -552,7 +531,7 @@ TkUnixDoOneXEvent(timePtr)
}
}
- numFound = select(numFdBits, (SELECT_MASK *) &readMask[0], NULL, NULL,
+ numFound = select(numFdBits, (SELECT_MASK *) readMaskPtr, NULL, NULL,
timeoutPtr);
if (numFound <= 0) {
/*
@@ -560,7 +539,7 @@ TkUnixDoOneXEvent(timePtr)
* it here.
*/
- memset((VOID *) readMask, 0, MASK_SIZE*sizeof(fd_mask));
+ memset(readMask, 0, MASK_SIZE*sizeof(fd_mask));
}
/*
@@ -573,7 +552,7 @@ TkUnixDoOneXEvent(timePtr)
index = fd/(NBBY*sizeof(fd_mask));
bit = ((fd_mask)1) << (fd%(NBBY*sizeof(fd_mask)));
if ((readMask[index] & bit) || (QLength(dispPtr->display) > 0)) {
- DisplayFileProc((ClientData)dispPtr, TCL_READABLE);
+ DisplayFileProc(dispPtr, TCL_READABLE);
}
}
if (Tcl_ServiceEvent(TCL_WINDOW_EVENTS)) {
@@ -585,7 +564,7 @@ TkUnixDoOneXEvent(timePtr)
*/
if (timePtr) {
- TclpGetTime(&now);
+ Tcl_GetTime(&now);
if ((now.sec > timePtr->sec) || ((now.sec == timePtr->sec)
&& (now.usec > timePtr->usec))) {
return 0;
@@ -605,9 +584,9 @@ TkUnixDoOneXEvent(timePtr)
*
* TkpSync --
*
- * This routine ensures that all pending X requests have been
- * seen by the server, and that any pending X events have been
- * moved onto the Tk event queue.
+ * This routine ensures that all pending X requests have been seen by the
+ * server, and that any pending X events have been moved onto the Tk
+ * event queue.
*
* Results:
* None.
@@ -619,30 +598,29 @@ TkUnixDoOneXEvent(timePtr)
*/
void
-TkpSync(display)
- Display *display; /* Display to sync. */
+TkpSync(
+ Display *display) /* Display to sync. */
{
XSync(display, False);
/*
* Transfer events from the X event queue to the Tk event queue.
*/
+
TransferXEventsToTcl(display);
}
#ifdef TK_USE_INPUT_METHODS
-/*
+/*
*--------------------------------------------------------------
*
* OpenIM --
*
- * Tries to open an X input method, associated with the
- * given display. Right now we can only deal with a bare-bones
- * input style: no preedit, and no status.
+ * Tries to open an X input method associated with the given display.
*
* Results:
- * Stores the input method in dispPtr->inputMethod; if there isn't
- * a suitable input method, then NULL is stored in dispPtr->inputMethod.
+ * Stores the input method in dispPtr->inputMethod; if there isn't a
+ * suitable input method, then NULL is stored in dispPtr->inputMethod.
*
* Side effects:
* An input method gets opened.
@@ -651,14 +629,15 @@ TkpSync(display)
*/
static void
-OpenIM(dispPtr)
- TkDisplay *dispPtr; /* Tk's structure for the display. */
+OpenIM(
+ TkDisplay *dispPtr) /* Tk's structure for the display. */
{
- unsigned short i;
+ int i;
XIMStyles *stylePtr;
+ XIMStyle bestStyle = 0;
if (XSetLocaleModifiers("") == NULL) {
- goto error;
+ return;
}
dispPtr->inputMethod = XOpenIM(dispPtr->display, NULL, NULL, NULL);
@@ -667,41 +646,75 @@ OpenIM(dispPtr)
}
if ((XGetIMValues(dispPtr->inputMethod, XNQueryInputStyle, &stylePtr,
- NULL) != NULL) || (stylePtr == NULL)) {
+ (void *) NULL) != NULL) || (stylePtr == NULL)) {
goto error;
}
-#if TK_XIM_SPOT
+
/*
- * If we want to do over-the-spot XIM, we have to check that this
- * mode is supported. If not we will fall-through to the check below.
+ * Select the best input style supported by both the IM and Tk.
*/
for (i = 0; i < stylePtr->count_styles; i++) {
- if (stylePtr->supported_styles[i]
- == (XIMPreeditPosition | XIMStatusNothing)) {
- dispPtr->flags |= TK_DISPLAY_XIM_SPOT;
- XFree(stylePtr);
- return;
+ XIMStyle thisStyle = stylePtr->supported_styles[i];
+ if (thisStyle == (XIMPreeditPosition | XIMStatusNothing)) {
+ bestStyle = thisStyle;
+ break;
+ } else if (thisStyle == (XIMPreeditNothing | XIMStatusNothing)) {
+ bestStyle = thisStyle;
}
}
-#endif
- for (i = 0; i < stylePtr->count_styles; i++) {
- if (stylePtr->supported_styles[i]
- == (XIMPreeditNothing | XIMStatusNothing)) {
- XFree(stylePtr);
- return;
+ XFree(stylePtr);
+ if (bestStyle == 0) {
+ goto error;
+ }
+
+ dispPtr->inputStyle = bestStyle;
+
+ /*
+ * Create an XFontSet for preedit area.
+ */
+ if (dispPtr->inputStyle & XIMPreeditPosition) {
+ char **missing_list;
+ int missing_count;
+ char *def_string;
+
+ dispPtr->inputXfs = XCreateFontSet(dispPtr->display,
+ "-*-*-*-R-Normal--14-130-75-75-*-*",
+ &missing_list, &missing_count, &def_string);
+ if (missing_count > 0) {
+ XFreeStringList(missing_list);
}
}
- XFree(stylePtr);
- error:
+ return;
+error:
if (dispPtr->inputMethod) {
- /*
- * This call should not suffer from any core dumping problems
- * since we have not allocated any input contexts.
- */
XCloseIM(dispPtr->inputMethod);
dispPtr->inputMethod = NULL;
}
}
#endif /* TK_USE_INPUT_METHODS */
+
+void
+TkpWarpPointer(
+ TkDisplay *dispPtr)
+{
+ Window w; /* Which window to warp relative to. */
+
+ if (dispPtr->warpWindow != NULL) {
+ w = Tk_WindowId(dispPtr->warpWindow);
+ } else {
+ w = RootWindow(dispPtr->display,
+ Tk_ScreenNumber(dispPtr->warpMainwin));
+ }
+ XWarpPointer(dispPtr->display, None, w, 0, 0, 0, 0,
+ (int) dispPtr->warpX, (int) dispPtr->warpY);
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixFocus.c b/unix/tkUnixFocus.c
index 78807a0..0767618 100644
--- a/unix/tkUnixFocus.c
+++ b/unix/tkUnixFocus.c
@@ -1,8 +1,8 @@
-/*
+/*
* tkUnixFocus.c --
*
- * This file contains platform specific procedures that manage
- * focus for Tk.
+ * This file contains platform specific functions that manage focus for
+ * Tk.
*
* Copyright (c) 1997 Sun Microsystems, Inc.
*
@@ -10,8 +10,6 @@
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkInt.h"
-#include "tkPort.h"
#include "tkUnixInt.h"
@@ -20,46 +18,44 @@
*
* TkpChangeFocus --
*
- * This procedure is invoked to move the official X focus from
- * one window to another.
+ * This function is invoked to move the official X focus from one window
+ * to another.
*
* Results:
- * The return value is the serial number of the command that
- * changed the focus. It may be needed by the caller to filter
- * out focus change events that were queued before the command.
- * If the procedure doesn't actually change the focus then
- * it returns 0.
+ * The return value is the serial number of the command that changed the
+ * focus. It may be needed by the caller to filter out focus change
+ * events that were queued before the command. If the function doesn't
+ * actually change the focus then it returns 0.
*
* Side effects:
- * The official X focus window changes; the application's focus
- * window isn't changed by this procedure.
+ * The official X focus window changes; the application's focus window
+ * isn't changed by this function.
*
*----------------------------------------------------------------------
*/
int
-TkpChangeFocus(winPtr, force)
- TkWindow *winPtr; /* Window that is to receive the X focus. */
- int force; /* Non-zero means claim the focus even
- * if it didn't originally belong to
- * topLevelPtr's application. */
+TkpChangeFocus(
+ TkWindow *winPtr, /* Window that is to receive the X focus. */
+ int force) /* Non-zero means claim the focus even if it
+ * didn't originally belong to topLevelPtr's
+ * application. */
{
TkDisplay *dispPtr = winPtr->dispPtr;
Tk_ErrorHandler errHandler;
- Window window, root, parent, *children;
- unsigned int numChildren, serial;
+ Window window, root, parent, *children;
+ unsigned int numChildren, serial;
TkWindow *winPtr2;
int dummy;
/*
- * Don't set the X focus to a window that's marked
- * override-redirect. This is a hack to avoid problems with menus
- * under olvwm: if we move the focus then the focus can get lost
- * during keyboard traversal. Fortunately, we don't really need to
- * move the focus for menus: events will still find their way to the
- * focus window, and menus aren't decorated anyway so the window
- * manager doesn't need to hear about the focus change in order to
- * redecorate the menu.
+ * Don't set the X focus to a window that's marked override-redirect.
+ * This is a hack to avoid problems with menus under olvwm: if we move
+ * the focus then the focus can get lost during keyboard traversal.
+ * Fortunately, we don't really need to move the focus for menus: events
+ * will still find their way to the focus window, and menus aren't
+ * decorated anyway so the window manager doesn't need to hear about the
+ * focus change in order to redecorate the menu.
*/
serial = 0;
@@ -68,19 +64,19 @@ TkpChangeFocus(winPtr, force)
}
/*
- * Check to make sure that the focus is still in one of the windows
- * of this application or one of their descendants. Furthermore,
- * grab the server to make sure that the focus doesn't change in the
- * middle of this operation.
+ * Check to make sure that the focus is still in one of the windows of
+ * this application or one of their descendants. Furthermore, grab the
+ * server to make sure that the focus doesn't change in the middle of this
+ * operation.
*/
XGrabServer(dispPtr->display);
if (!force) {
/*
- * Find the focus window, then see if it or one of its ancestors
- * is a window in our application (it's possible that the focus
- * window is in an embedded application, which may or may not be
- * in the same process.
+ * Find the focus window, then see if it or one of its ancestors is a
+ * window in our application (it's possible that the focus window is
+ * in an embedded application, which may or may not be in the same
+ * process.
*/
XGetInputFocus(dispPtr->display, &window, &dummy);
@@ -105,42 +101,49 @@ TkpChangeFocus(winPtr, force)
}
/*
- * Tell X to change the focus. Ignore errors that occur when changing
- * the focus: it is still possible that the window we're focussing
- * to could have gotten unmapped, which will generate an error.
+ * Tell X to change the focus. Ignore errors that occur when changing the
+ * focus: it is still possible that the window we're focussing to could
+ * have gotten unmapped, which will generate an error.
*/
- errHandler = Tk_CreateErrorHandler(dispPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ errHandler = Tk_CreateErrorHandler(dispPtr->display, -1,-1,-1, NULL,NULL);
if (winPtr->window == None) {
- panic("ChangeXFocus got null X window");
+ Tcl_Panic("ChangeXFocus got null X window");
}
XSetInputFocus(dispPtr->display, winPtr->window, RevertToParent,
CurrentTime);
Tk_DeleteErrorHandler(errHandler);
/*
- * Remember the current serial number for the X server and issue
- * a dummy server request. This marks the position at which we
- * changed the focus, so we can distinguish FocusIn and FocusOut
- * events on either side of the mark.
+ * Remember the current serial number for the X server and issue a dummy
+ * server request. This marks the position at which we changed the focus,
+ * so we can distinguish FocusIn and FocusOut events on either side of the
+ * mark.
*/
serial = NextRequest(winPtr->display);
XNoOp(winPtr->display);
- done:
+ done:
XUngrabServer(dispPtr->display);
/*
* After ungrabbing the server, it's important to flush the output
- * immediately so that the server sees the ungrab command. Otherwise
- * we might do something else that needs to communicate with the
- * server (such as invoking a subprocess that needs to do I/O to
- * the screen); if the ungrab command is still sitting in our
- * output buffer, we could deadlock.
+ * immediately so that the server sees the ungrab command. Otherwise we
+ * might do something else that needs to communicate with the server (such
+ * as invoking a subprocess that needs to do I/O to the screen); if the
+ * ungrab command is still sitting in our output buffer, we could
+ * deadlock.
*/
XFlush(dispPtr->display);
return serial;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index 2b8d99d..136d69f 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -1,15 +1,15 @@
/*
* tkUnixFont.c --
*
- * Contains the Unix implementation of the platform-independant
- * font package interface.
+ * Contains the Unix implementation of the platform-independent font
+ * package interface.
*
* Copyright (c) 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.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-
+
#include "tkUnixInt.h"
#include "tkFont.h"
#include <netinet/in.h> /* for htons() prototype */
@@ -19,31 +19,31 @@
* The preferred font encodings.
*/
-static CONST char *encodingList[] = {
+static const char *const encodingList[] = {
"iso8859-1", "jis0208", "jis0212", NULL
};
/*
- * The following structure represents a font family. It is assumed that
- * all screen fonts constructed from the same "font family" share certain
- * properties; all screen fonts with the same "font family" point to a
- * shared instance of this structure. The most important shared property
- * is the character existence metrics, used to determine if a screen font
- * can display a given Unicode character.
+ * The following structure represents a font family. It is assumed that all
+ * screen fonts constructed from the same "font family" share certain
+ * properties; all screen fonts with the same "font family" point to a shared
+ * instance of this structure. The most important shared property is the
+ * character existence metrics, used to determine if a screen font can display
+ * a given Unicode character.
*
* Under Unix, there are three attributes that uniquely identify a "font
- * family": the foundry, face name, and charset.
+ * family": the foundry, face name, and charset.
*/
#define FONTMAP_SHIFT 10
-#define FONTMAP_PAGES (1 << (sizeof(Tcl_UniChar)*8 - FONTMAP_SHIFT))
+#define FONTMAP_PAGES (1 << (sizeof(Tcl_UniChar)*8 - FONTMAP_SHIFT))
#define FONTMAP_BITSPERPAGE (1 << FONTMAP_SHIFT)
typedef struct FontFamily {
struct FontFamily *nextPtr; /* Next in list of all known font families. */
int refCount; /* How many SubFonts are referring to this
- * FontFamily. When the refCount drops to
+ * FontFamily. When the refCount drops to
* zero, this FontFamily may be freed. */
/*
* Key.
@@ -57,58 +57,57 @@ typedef struct FontFamily {
* Derived properties.
*/
- int isTwoByteFont; /* 1 if this is a double-byte font, 0
+ int isTwoByteFont; /* 1 if this is a double-byte font, 0
* otherwise. */
char *fontMap[FONTMAP_PAGES];
/* Two-level sparse table used to determine
* quickly if the specified character exists.
* As characters are encountered, more pages
- * in this table are dynamically alloced. The
+ * in this table are dynamically alloced. The
* contents of each page is a bitmask
* consisting of FONTMAP_BITSPERPAGE bits,
* representing whether this font can be used
* to display the given character at the
- * corresponding bit position. The high bits
+ * corresponding bit position. The high bits
* of the character are used to pick which
* page of the table is used. */
} FontFamily;
/*
- * The following structure encapsulates an individual screen font. A font
+ * The following structure encapsulates an individual screen font. A font
* object is made up of however many SubFonts are necessary to display a
* stream of multilingual characters.
*/
typedef struct SubFont {
- char **fontMap; /* Pointer to font map from the FontFamily,
+ char **fontMap; /* Pointer to font map from the FontFamily,
* cached here to save a dereference. */
- XFontStruct *fontStructPtr; /* The specific screen font that will be
- * used when displaying/measuring chars
- * belonging to the FontFamily. */
+ XFontStruct *fontStructPtr; /* The specific screen font that will be used
+ * when displaying/measuring chars belonging
+ * to the FontFamily. */
FontFamily *familyPtr; /* The FontFamily for this SubFont. */
} SubFont;
/*
- * The following structure represents Unix's implementation of a font
- * object.
+ * The following structure represents Unix's implementation of a font object.
*/
-
+
#define SUBFONT_SPACE 3
#define BASE_CHARS 256
typedef struct UnixFont {
- TkFont font; /* Stuff used by generic font package. Must
- * be first in structure. */
+ TkFont font; /* Stuff used by generic font package. Must be
+ * first in structure. */
SubFont staticSubFonts[SUBFONT_SPACE];
/* Builtin space for a limited number of
* SubFonts. */
int numSubFonts; /* Length of following array. */
- SubFont *subFontArray; /* Array of SubFonts that have been loaded
- * in order to draw/measure all the characters
- * encountered by this font so far. All fonts
+ SubFont *subFontArray; /* Array of SubFonts that have been loaded in
+ * order to draw/measure all the characters
+ * encountered by this font so far. All fonts
* start off with one SubFont initialized by
* AllocFont() from the original set of font
- * attributes. Usually points to
+ * attributes. Usually points to
* staticSubFonts, but may point to malloced
* space if there are lots of SubFonts. */
SubFont controlSubFont; /* Font to use to display control-character
@@ -120,51 +119,50 @@ typedef struct UnixFont {
TkXLFDAttributes xa; /* Additional attributes that specify the
* preferred foundry and encoding to use when
* constructing additional SubFonts. */
- int widths[BASE_CHARS]; /* Widths of first 256 chars in the base
- * font, for handling common case. */
- int underlinePos; /* Offset from baseline to origin of
- * underline bar (used when drawing underlined
- * font) (pixels). */
- int barHeight; /* Height of underline or overstrike bar
- * (used when drawing underlined or strikeout
- * font) (pixels). */
+ int widths[BASE_CHARS]; /* Widths of first 256 chars in the base font,
+ * for handling common case. */
+ int underlinePos; /* Offset from baseline to origin of underline
+ * bar (used when drawing underlined font)
+ * (pixels). */
+ int barHeight; /* Height of underline or overstrike bar (used
+ * when drawing underlined or strikeout font)
+ * (pixels). */
} UnixFont;
/*
* The following structure and definition is used to keep track of the
- * alternative names for various encodings. Asking for an encoding that
+ * alternative names for various encodings. Asking for an encoding that
* matches one of the alias patterns will result in actually getting the
* encoding by its real name.
*/
-
+
typedef struct EncodingAlias {
- char *realName; /* The real name of the encoding to load if
+ const char *realName; /* The real name of the encoding to load if
* the provided name matched the pattern. */
- char *aliasPattern; /* Pattern for encoding name, of the form
- * that is acceptable to Tcl_StringMatch. */
+ const char *aliasPattern; /* Pattern for encoding name, of the form that
+ * is acceptable to Tcl_StringMatch. */
} EncodingAlias;
/*
* Just some utility structures used for passing around values in helper
- * procedures.
+ * functions.
*/
-
+
typedef struct FontAttributes {
TkFontAttributes fa;
TkXLFDAttributes xa;
} FontAttributes;
-
typedef struct ThreadSpecificData {
- FontFamily *fontFamilyList; /* The list of font families that are
- * currently loaded. As screen fonts
- * are loaded, this list grows to hold
- * information about what characters
- * exist in each font family. */
- FontFamily controlFamily; /* FontFamily used to handle control
- * character expansions. The encoding
- * of this FontFamily converts UTF-8 to
- * backslashed escape sequences. */
+ FontFamily *fontFamilyList; /* The list of font families that are
+ * currently loaded. As screen fonts are
+ * loaded, this list grows to hold information
+ * about what characters exist in each font
+ * family. */
+ FontFamily controlFamily; /* FontFamily used to handle control character
+ * expansions. The encoding of this FontFamily
+ * converts UTF-8 to backslashed escape
+ * sequences. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -172,7 +170,7 @@ static Tcl_ThreadDataKey dataKey;
* The set of builtin encoding alises to convert the XLFD names for the
* encodings into the names expected by the Tcl encoding package.
*/
-
+
static EncodingAlias encodingAliases[] = {
{"gb2312-raw", "gb2312*"},
{"big5", "big5*"},
@@ -200,83 +198,73 @@ static EncodingAlias encodingAliases[] = {
};
/*
- * Procedures used only in this file.
+ * Functions used only in this file.
*/
-static void FontPkgCleanup _ANSI_ARGS_((ClientData clientData));
-static FontFamily * AllocFontFamily _ANSI_ARGS_((Display *display,
- XFontStruct *fontStructPtr, int base));
-static SubFont * CanUseFallback _ANSI_ARGS_((UnixFont *fontPtr,
- CONST char *fallbackName, int ch,
- SubFont **fixSubFontPtrPtr));
-static SubFont * CanUseFallbackWithAliases _ANSI_ARGS_((
- UnixFont *fontPtr, char *fallbackName,
- int ch, Tcl_DString *nameTriedPtr,
- SubFont **fixSubFontPtrPtr));
-static int ControlUtfProc _ANSI_ARGS_((ClientData clientData,
- CONST char *src, int srcLen, int flags,
- Tcl_EncodingState *statePtr, char *dst,
- int dstLen, int *srcReadPtr, int *dstWrotePtr,
- int *dstCharsPtr));
-static XFontStruct * CreateClosestFont _ANSI_ARGS_((Tk_Window tkwin,
- CONST TkFontAttributes *faPtr,
- CONST TkXLFDAttributes *xaPtr));
-static SubFont * FindSubFontForChar _ANSI_ARGS_((UnixFont *fontPtr,
- int ch, SubFont **fixSubFontPtrPtr));
-static void FontMapInsert _ANSI_ARGS_((SubFont *subFontPtr,
- int ch));
-static void FontMapLoadPage _ANSI_ARGS_((SubFont *subFontPtr,
- int row));
-static int FontMapLookup _ANSI_ARGS_((SubFont *subFontPtr,
- int ch));
-static void FreeFontFamily _ANSI_ARGS_((FontFamily *afPtr));
-static CONST char * GetEncodingAlias _ANSI_ARGS_((CONST char *name));
-static int GetFontAttributes _ANSI_ARGS_((Display *display,
- XFontStruct *fontStructPtr, FontAttributes *faPtr));
-static XFontStruct * GetScreenFont _ANSI_ARGS_((Display *display,
+static void FontPkgCleanup(ClientData clientData);
+static FontFamily * AllocFontFamily(Display *display,
+ XFontStruct *fontStructPtr, int base);
+static SubFont * CanUseFallback(UnixFont *fontPtr,
+ const char *fallbackName, int ch,
+ SubFont **fixSubFontPtrPtr);
+static SubFont * CanUseFallbackWithAliases(UnixFont *fontPtr,
+ const char *fallbackName, int ch,
+ Tcl_DString *nameTriedPtr,
+ SubFont **fixSubFontPtrPtr);
+static int ControlUtfProc(ClientData clientData, const char *src,
+ int srcLen, int flags, Tcl_EncodingState*statePtr,
+ char *dst, int dstLen, int *srcReadPtr,
+ int *dstWrotePtr, int *dstCharsPtr);
+static XFontStruct * CreateClosestFont(Tk_Window tkwin,
+ const TkFontAttributes *faPtr,
+ const TkXLFDAttributes *xaPtr);
+static SubFont * FindSubFontForChar(UnixFont *fontPtr, int ch,
+ SubFont **fixSubFontPtrPtr);
+static void FontMapInsert(SubFont *subFontPtr, int ch);
+static void FontMapLoadPage(SubFont *subFontPtr, int row);
+static int FontMapLookup(SubFont *subFontPtr, int ch);
+static void FreeFontFamily(FontFamily *afPtr);
+static const char * GetEncodingAlias(const char *name);
+static int GetFontAttributes(Display *display,
+ XFontStruct *fontStructPtr, FontAttributes *faPtr);
+static XFontStruct * GetScreenFont(Display *display,
FontAttributes *wantPtr, char **nameList,
- int bestIdx[], unsigned int bestScore[]));
-static XFontStruct * GetSystemFont _ANSI_ARGS_((Display *display));
-static int IdentifySymbolEncodings _ANSI_ARGS_((
- FontAttributes *faPtr));
-static void InitFont _ANSI_ARGS_((Tk_Window tkwin,
- XFontStruct *fontStructPtr, UnixFont *fontPtr));
-static void InitSubFont _ANSI_ARGS_((Display *display,
+ int bestIdx[], unsigned bestScore[]);
+static XFontStruct * GetSystemFont(Display *display);
+static int IdentifySymbolEncodings(FontAttributes *faPtr);
+static void InitFont(Tk_Window tkwin, XFontStruct *fontStructPtr,
+ UnixFont *fontPtr);
+static void InitSubFont(Display *display,
XFontStruct *fontStructPtr, int base,
- SubFont *subFontPtr));
-static char ** ListFonts _ANSI_ARGS_((Display *display,
- CONST char *faceName, int *numNamesPtr));
-static char ** ListFontOrAlias _ANSI_ARGS_((Display *display,
- CONST char *faceName, int *numNamesPtr));
-static unsigned int RankAttributes _ANSI_ARGS_((FontAttributes *wantPtr,
- FontAttributes *gotPtr));
-static void ReleaseFont _ANSI_ARGS_((UnixFont *fontPtr));
-static void ReleaseSubFont _ANSI_ARGS_((Display *display,
- SubFont *subFontPtr));
-static int SeenName _ANSI_ARGS_((CONST char *name,
- Tcl_DString *dsPtr));
+ SubFont *subFontPtr);
+static char ** ListFonts(Display *display, const char *faceName,
+ int *numNamesPtr);
+static char ** ListFontOrAlias(Display *display, const char*faceName,
+ int *numNamesPtr);
+static unsigned RankAttributes(FontAttributes *wantPtr,
+ FontAttributes *gotPtr);
+static void ReleaseFont(UnixFont *fontPtr);
+static void ReleaseSubFont(Display *display, SubFont *subFontPtr);
+static int SeenName(const char *name, Tcl_DString *dsPtr);
#ifndef WORDS_BIGENDIAN
-static int Ucs2beToUtfProc _ANSI_ARGS_((ClientData clientData,
- CONST char *src, int srcLen, int flags,
- Tcl_EncodingState *statePtr, char *dst, int dstLen,
- int *srcReadPtr, int *dstWrotePtr,
- int *dstCharsPtr));
-static int UtfToUcs2beProc _ANSI_ARGS_((ClientData clientData,
- CONST char *src, int srcLen, int flags,
- Tcl_EncodingState *statePtr, char *dst, int dstLen,
- int *srcReadPtr, int *dstWrotePtr,
- int *dstCharsPtr));
+static int Ucs2beToUtfProc(ClientData clientData, const char*src,
+ int srcLen, int flags, Tcl_EncodingState*statePtr,
+ char *dst, int dstLen, int *srcReadPtr,
+ int *dstWrotePtr, int *dstCharsPtr);
+static int UtfToUcs2beProc(ClientData clientData, const char*src,
+ int srcLen, int flags, Tcl_EncodingState*statePtr,
+ char *dst, int dstLen, int *srcReadPtr,
+ int *dstWrotePtr, int *dstCharsPtr);
#endif
-
/*
*-------------------------------------------------------------------------
*
* FontPkgCleanup --
*
- * This procedure is called when an application is created. It
- * initializes all the structures that are used by the
- * platform-dependent code on a per application basis.
+ * This function is called when an application is created. It initializes
+ * all the structures that are used by the platform-dependent code on a
+ * per application basis.
*
* Results:
* None.
@@ -288,11 +276,12 @@ static int UtfToUcs2beProc _ANSI_ARGS_((ClientData clientData,
*/
static void
-FontPkgCleanup(ClientData clientData)
+FontPkgCleanup(
+ ClientData clientData)
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
+ ThreadSpecificData *tsdPtr =
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
if (tsdPtr->controlFamily.encoding != NULL) {
FontFamily *familyPtr = &tsdPtr->controlFamily;
int i;
@@ -312,9 +301,9 @@ FontPkgCleanup(ClientData clientData)
*
* TkpFontPkgInit --
*
- * This procedure is called when an application is created. It
- * initializes all the structures that are used by the
- * platform-dependent code on a per application basis.
+ * This function is called when an application is created. It initializes
+ * all the structures that are used by the platform-dependent code on a
+ * per application basis.
*
* Results:
* None.
@@ -326,22 +315,22 @@ FontPkgCleanup(ClientData clientData)
*/
void
-TkpFontPkgInit(mainPtr)
- TkMainInfo *mainPtr; /* The application being created. */
+TkpFontPkgInit(
+ TkMainInfo *mainPtr) /* The application being created. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr =
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_EncodingType type;
SubFont dummy;
int i;
if (tsdPtr->controlFamily.encoding == NULL) {
- type.encodingName = "X11ControlChars";
- type.toUtfProc = ControlUtfProc;
- type.fromUtfProc = ControlUtfProc;
- type.freeProc = NULL;
- type.clientData = NULL;
- type.nullSize = 0;
+ type.encodingName = "X11ControlChars";
+ type.toUtfProc = ControlUtfProc;
+ type.fromUtfProc = ControlUtfProc;
+ type.freeProc = NULL;
+ type.clientData = NULL;
+ type.nullSize = 0;
tsdPtr->controlFamily.refCount = 2;
tsdPtr->controlFamily.encoding = Tcl_CreateEncoding(&type);
@@ -356,16 +345,16 @@ TkpFontPkgInit(mainPtr)
#ifndef WORDS_BIGENDIAN
/*
- * UCS-2BE is unicode (UCS-2) in big-endian format. Define this
- * if native order isn't BE. It is used in iso10646 fonts.
+ * UCS-2BE is unicode (UCS-2) in big-endian format. Define this if
+ * native order isn't BE. It is used in iso10646 fonts.
*/
- type.encodingName = "ucs-2be";
- type.toUtfProc = Ucs2beToUtfProc;
- type.fromUtfProc = UtfToUcs2beProc;
- type.freeProc = NULL;
- type.clientData = NULL;
- type.nullSize = 2;
+ type.encodingName = "ucs-2be";
+ type.toUtfProc = Ucs2beToUtfProc;
+ type.fromUtfProc = UtfToUcs2beProc;
+ type.freeProc = NULL;
+ type.clientData = NULL;
+ type.nullSize = 2;
Tcl_CreateEncoding(&type);
#endif
Tcl_CreateThreadExitHandler(FontPkgCleanup, NULL);
@@ -377,8 +366,7 @@ TkpFontPkgInit(mainPtr)
*
* ControlUtfProc --
*
- * Convert from UTF-8 into the ASCII expansion of a control
- * character.
+ * Convert from UTF-8 into the ASCII expansion of a control character.
*
* Results:
* Returns TCL_OK if conversion was successful.
@@ -389,35 +377,34 @@ TkpFontPkgInit(mainPtr)
*-------------------------------------------------------------------------
*/
-static int
-ControlUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
- srcReadPtr, dstWrotePtr, dstCharsPtr)
- ClientData clientData; /* Not used. */
- CONST char *src; /* Source string in UTF-8. */
- int srcLen; /* Source string length in bytes. */
- int flags; /* Conversion control flags. */
- Tcl_EncodingState *statePtr;/* Place for conversion routine to store
- * state information used during a piecewise
- * conversion. Contents of statePtr are
+static int
+ControlUtfProc(
+ ClientData clientData, /* Not used. */
+ const char *src, /* Source string in UTF-8. */
+ int srcLen, /* Source string length in bytes. */
+ int flags, /* Conversion control flags. */
+ Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
+ * information used during a piecewise
+ * conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
- char *dst; /* Output buffer in which converted string
- * is stored. */
- int dstLen; /* The maximum length of output buffer in
+ char *dst, /* Output buffer in which converted string is
+ * stored. */
+ int dstLen, /* The maximum length of output buffer in
* bytes. */
- int *srcReadPtr; /* Filled with the number of bytes from the
- * source string that were converted. This
- * may be less than the original source length
- * if there was a problem converting some
- * source characters. */
- int *dstWrotePtr; /* Filled with the number of bytes that were
+ int *srcReadPtr, /* Filled with the number of bytes from the
+ * source string that were converted. This may
+ * be less than the original source length if
+ * there was a problem converting some source
+ * characters. */
+ int *dstWrotePtr, /* Filled with the number of bytes that were
* stored in the output buffer as a result of
* the conversion. */
- int *dstCharsPtr; /* Filled with the number of characters that
+ int *dstCharsPtr) /* Filled with the number of characters that
* correspond to the bytes stored in the
* output buffer. */
{
- CONST char *srcStart, *srcEnd;
+ const char *srcStart, *srcEnd;
char *dstStart, *dstEnd;
Tcl_UniChar ch;
int result;
@@ -483,35 +470,34 @@ ControlUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
*-------------------------------------------------------------------------
*/
-static int
-Ucs2beToUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
- srcReadPtr, dstWrotePtr, dstCharsPtr)
- ClientData clientData; /* Not used. */
- CONST char *src; /* Source string in Unicode. */
- int srcLen; /* Source string length in bytes. */
- int flags; /* Conversion control flags. */
- Tcl_EncodingState *statePtr;/* Place for conversion routine to store
- * state information used during a piecewise
- * conversion. Contents of statePtr are
+static int
+Ucs2beToUtfProc(
+ ClientData clientData, /* Not used. */
+ const char *src, /* Source string in Unicode. */
+ int srcLen, /* Source string length in bytes. */
+ int flags, /* Conversion control flags. */
+ Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
+ * information used during a piecewise
+ * conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
- char *dst; /* Output buffer in which converted string
- * is stored. */
- int dstLen; /* The maximum length of output buffer in
+ char *dst, /* Output buffer in which converted string is
+ * stored. */
+ int dstLen, /* The maximum length of output buffer in
* bytes. */
- int *srcReadPtr; /* Filled with the number of bytes from the
- * source string that were converted. This
- * may be less than the original source length
- * if there was a problem converting some
- * source characters. */
- int *dstWrotePtr; /* Filled with the number of bytes that were
+ int *srcReadPtr, /* Filled with the number of bytes from the
+ * source string that were converted. This may
+ * be less than the original source length if
+ * there was a problem converting some source
+ * characters. */
+ int *dstWrotePtr, /* Filled with the number of bytes that were
* stored in the output buffer as a result of
* the conversion. */
- int *dstCharsPtr; /* Filled with the number of characters that
+ int *dstCharsPtr) /* Filled with the number of characters that
* correspond to the bytes stored in the
* output buffer. */
{
- CONST char *srcStart, *srcEnd;
+ const char *srcStart, *srcEnd;
char *dstEnd, *dstStart;
int result, numChars;
@@ -534,10 +520,12 @@ Ucs2beToUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
result = TCL_CONVERT_NOSPACE;
break;
}
+
/*
* Need to swap byte-order on little-endian machines (x86) for
- * UCS-2BE. We know this is an LE->BE swap.
+ * UCS-2BE. We know this is an LE->BE swap.
*/
+
dst += Tcl_UniCharToUtf(htons(*((short *)src)), dst);
src += 2 /* sizeof(UCS-2) */;
}
@@ -564,35 +552,35 @@ Ucs2beToUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
*-------------------------------------------------------------------------
*/
-static int
-UtfToUcs2beProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
- srcReadPtr, dstWrotePtr, dstCharsPtr)
- ClientData clientData; /* TableEncodingData that specifies encoding. */
- CONST char *src; /* Source string in UTF-8. */
- int srcLen; /* Source string length in bytes. */
- int flags; /* Conversion control flags. */
- Tcl_EncodingState *statePtr;/* Place for conversion routine to store
- * state information used during a piecewise
- * conversion. Contents of statePtr are
+static int
+UtfToUcs2beProc(
+ ClientData clientData, /* TableEncodingData that specifies
+ * encoding. */
+ const char *src, /* Source string in UTF-8. */
+ int srcLen, /* Source string length in bytes. */
+ int flags, /* Conversion control flags. */
+ Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
+ * information used during a piecewise
+ * conversion. Contents of statePtr are
* initialized and/or reset by conversion
* routine under control of flags argument. */
- char *dst; /* Output buffer in which converted string
- * is stored. */
- int dstLen; /* The maximum length of output buffer in
+ char *dst, /* Output buffer in which converted string is
+ * stored. */
+ int dstLen, /* The maximum length of output buffer in
* bytes. */
- int *srcReadPtr; /* Filled with the number of bytes from the
- * source string that were converted. This
- * may be less than the original source length
- * if there was a problem converting some
- * source characters. */
- int *dstWrotePtr; /* Filled with the number of bytes that were
+ int *srcReadPtr, /* Filled with the number of bytes from the
+ * source string that were converted. This may
+ * be less than the original source length if
+ * there was a problem converting some source
+ * characters. */
+ int *dstWrotePtr, /* Filled with the number of bytes that were
* stored in the output buffer as a result of
* the conversion. */
- int *dstCharsPtr; /* Filled with the number of characters that
+ int *dstCharsPtr) /* Filled with the number of characters that
* correspond to the bytes stored in the
* output buffer. */
{
- CONST char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd;
+ const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd;
int result, numChars;
Tcl_UniChar ch;
@@ -604,7 +592,7 @@ UtfToUcs2beProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
}
dstStart = dst;
- dstEnd = dst + dstLen - 2 /* sizeof(UCS-2) */;
+ dstEnd = dst + dstLen - 2 /* sizeof(UCS-2) */;
result = TCL_OK;
for (numChars = 0; src < srcEnd; numChars++) {
@@ -622,12 +610,13 @@ UtfToUcs2beProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
break;
}
src += Tcl_UtfToUniChar(src, &ch);
+
/*
* Ensure big-endianness (store big bits first).
- * XXX: This hard-codes the assumed size of Tcl_UniChar as 2.
- * Make sure to work in char* for Tcl_UtfToUniChar alignment.
- * [Bug 1122671]
+ * XXX: This hard-codes the assumed size of Tcl_UniChar as 2. Make
+ * sure to work in char* for Tcl_UtfToUniChar alignment. [Bug 1122671]
*/
+
*dst++ = (ch >> 8);
*dst++ = (ch & 0xFF);
}
@@ -646,41 +635,41 @@ UtfToUcs2beProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
* Map a platform-specific native font name to a TkFont.
*
* Results:
- * The return value is a pointer to a TkFont that represents the
- * native font. If a native font by the given name could not be
- * found, the return value is NULL.
+ * The return value is a pointer to a TkFont that represents the native
+ * font. If a native font by the given name could not be found, the
+ * return value is NULL.
*
- * Every call to this procedure returns a new TkFont structure,
- * even if the name has already been seen before. The caller should
- * call TkpDeleteFont() when the font is no longer needed.
+ * Every call to this function returns a new TkFont structure, even if
+ * the name has already been seen before. The caller should call
+ * TkpDeleteFont() when the font is no longer needed.
*
- * The caller is responsible for initializing the memory associated
- * with the generic TkFont when this function returns and releasing
- * the contents of the generic TkFont before calling TkpDeleteFont().
+ * The caller is responsible for initializing the memory associated with
+ * the generic TkFont when this function returns and releasing the
+ * contents of the generic TkFont before calling TkpDeleteFont().
*
* Side effects:
* Memory allocated.
*
*---------------------------------------------------------------------------
*/
-
+
TkFont *
-TkpGetNativeFont(tkwin, name)
- Tk_Window tkwin; /* For display where font will be used. */
- CONST char *name; /* Platform-specific font name. */
+TkpGetNativeFont(
+ Tk_Window tkwin, /* For display where font will be used. */
+ const char *name) /* Platform-specific font name. */
{
UnixFont *fontPtr;
XFontStruct *fontStructPtr;
FontAttributes fa;
- CONST char *p;
+ const char *p;
int hasSpace, dashes, hasWild;
/*
* The behavior of X when given a name that isn't an XLFD is unspecified.
* For example, Exceed 6 returns a valid font for any random string. This
* is awkward since system names have higher priority than the other Tk
- * font syntaxes. So, we need to perform a quick sanity check on the
- * name and fail if it looks suspicious. We fail if the name:
+ * font syntaxes. So, we need to perform a quick sanity check on the name
+ * and fail if it looks suspicious. We fail if the name:
* - contains a space immediately before a dash
* - contains a space, but no '*' characters and fewer than 14 dashes
*/
@@ -705,18 +694,18 @@ TkpGetNativeFont(tkwin, name)
fontStructPtr = XLoadQueryFont(Tk_Display(tkwin), name);
if (fontStructPtr == NULL) {
/*
- * Handle all names that look like XLFDs here. Otherwise, when
- * TkpGetFontFromAttributes is called from generic code, any
- * foundry or encoding information specified in the XLFD will have
- * been parsed out and lost. But make sure we don't have an
- * "-option value" string since TkFontParseXLFD would return a
- * false success when attempting to parse it.
+ * Handle all names that look like XLFDs here. Otherwise, when
+ * TkpGetFontFromAttributes is called from generic code, any foundry
+ * or encoding information specified in the XLFD will have been parsed
+ * out and lost. But make sure we don't have an "-option value" string
+ * since TkFontParseXLFD would return a false success when attempting
+ * to parse it.
*/
if (name[0] == '-') {
if (name[1] != '*') {
char *dash;
-
+
dash = strchr(name + 1, '-');
if ((dash == NULL) || (isspace(UCHAR(dash[-1])))) {
return NULL;
@@ -730,7 +719,7 @@ TkpGetNativeFont(tkwin, name)
}
fontStructPtr = CreateClosestFont(tkwin, &fa.fa, &fa.xa);
}
- fontPtr = (UnixFont *) ckalloc(sizeof(UnixFont));
+ fontPtr = ckalloc(sizeof(UnixFont));
InitFont(tkwin, fontStructPtr, fontPtr);
return (TkFont *) fontPtr;
@@ -739,41 +728,42 @@ TkpGetNativeFont(tkwin, name)
/*
*---------------------------------------------------------------------------
*
- * TkpGetFontFromAttributes --
+ * TkpGetFontFromAttributes --
*
- * Given a desired set of attributes for a font, find a font with
- * the closest matching attributes.
+ * Given a desired set of attributes for a font, find a font with the
+ * closest matching attributes.
*
* Results:
- * The return value is a pointer to a TkFont that represents the
- * font with the desired attributes. If a font with the desired
- * attributes could not be constructed, some other font will be
- * substituted automatically.
+ * The return value is a pointer to a TkFont that represents the font
+ * with the desired attributes. If a font with the desired attributes
+ * could not be constructed, some other font will be substituted
+ * automatically.
*
- * Every call to this procedure returns a new TkFont structure,
- * even if the specified attributes have already been seen before.
- * The caller should call TkpDeleteFont() to free the platform-
- * specific data when the font is no longer needed.
+ * Every call to this function returns a new TkFont structure, even if
+ * the specified attributes have already been seen before. The caller
+ * should call TkpDeleteFont() to free the platform- specific data when
+ * the font is no longer needed.
*
- * The caller is responsible for initializing the memory associated
- * with the generic TkFont when this function returns and releasing
- * the contents of the generic TkFont before calling TkpDeleteFont().
+ * The caller is responsible for initializing the memory associated with
+ * the generic TkFont when this function returns and releasing the
+ * contents of the generic TkFont before calling TkpDeleteFont().
*
* Side effects:
* Memory allocated.
*
*---------------------------------------------------------------------------
*/
+
TkFont *
-TkpGetFontFromAttributes(tkFontPtr, tkwin, faPtr)
- TkFont *tkFontPtr; /* If non-NULL, store the information in
- * this existing TkFont structure, rather than
+TkpGetFontFromAttributes(
+ TkFont *tkFontPtr, /* If non-NULL, store the information in this
+ * existing TkFont structure, rather than
* allocating a new structure to hold the
* font; the existing contents of the font
- * will be released. If NULL, a new TkFont
+ * will be released. If NULL, a new TkFont
* structure is allocated. */
- Tk_Window tkwin; /* For display where font will be used. */
- CONST TkFontAttributes *faPtr;
+ Tk_Window tkwin, /* For display where font will be used. */
+ const TkFontAttributes *faPtr)
/* Set of attributes to match. */
{
UnixFont *fontPtr;
@@ -785,7 +775,7 @@ TkpGetFontFromAttributes(tkFontPtr, tkwin, faPtr)
fontPtr = (UnixFont *) tkFontPtr;
if (fontPtr == NULL) {
- fontPtr = (UnixFont *) ckalloc(sizeof(UnixFont));
+ fontPtr = ckalloc(sizeof(UnixFont));
} else {
ReleaseFont(fontPtr);
}
@@ -803,9 +793,9 @@ TkpGetFontFromAttributes(tkFontPtr, tkwin, faPtr)
* TkpDeleteFont --
*
* Called to release a font allocated by TkpGetNativeFont() or
- * TkpGetFontFromAttributes(). The caller should have already
- * released the fields of the TkFont that are used exclusively by
- * the generic TkFont code.
+ * TkpGetFontFromAttributes(). The caller should have already released
+ * the fields of the TkFont that are used exclusively by the generic
+ * TkFont code.
*
* Results:
* None.
@@ -817,12 +807,11 @@ TkpGetFontFromAttributes(tkFontPtr, tkwin, faPtr)
*/
void
-TkpDeleteFont(tkFontPtr)
- TkFont *tkFontPtr; /* Token of font to be deleted. */
+TkpDeleteFont(
+ TkFont *tkFontPtr) /* Token of font to be deleted. */
{
- UnixFont *fontPtr;
+ UnixFont *fontPtr = (UnixFont *) tkFontPtr;
- fontPtr = (UnixFont *) tkFontPtr;
ReleaseFont(fontPtr);
}
@@ -831,8 +820,8 @@ TkpDeleteFont(tkFontPtr)
*
* TkpGetFontFamilies --
*
- * Return information about the font families that are available
- * on the display of the given window.
+ * Return information about the font families that are available on the
+ * display of the given window.
*
* Results:
* Modifies interp's result object to hold a list of all the available
@@ -845,20 +834,17 @@ TkpDeleteFont(tkFontPtr)
*/
void
-TkpGetFontFamilies(interp, tkwin)
- Tcl_Interp *interp; /* Interp to hold result. */
- Tk_Window tkwin; /* For display to query. */
+TkpGetFontFamilies(
+ Tcl_Interp *interp, /* Interp to hold result. */
+ Tk_Window tkwin) /* For display to query. */
{
int i, new, numNames;
- char *family;
+ char *family, **nameList;
Tcl_HashTable familyTable;
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
- char **nameList;
Tcl_Obj *resultPtr, *strPtr;
- resultPtr = Tcl_GetObjResult(interp);
-
Tcl_InitHashTable(&familyTable, TCL_STRING_KEYS);
nameList = ListFonts(Tk_Display(tkwin), "*", &numNames);
for (i = 0; i < numNames; i++) {
@@ -881,17 +867,18 @@ TkpGetFontFamilies(interp, tkwin)
continue; /* See comment above. */
}
*familyEnd = '\0';
- family = strchr(nameList[i] + 1, '-') + 1;
Tcl_CreateHashEntry(&familyTable, family, &new);
}
XFreeFontNames(nameList);
hPtr = Tcl_FirstHashEntry(&familyTable, &search);
+ resultPtr = Tcl_NewObj();
while (hPtr != NULL) {
- strPtr = Tcl_NewStringObj(Tcl_GetHashKey(&familyTable, hPtr), -1);
+ strPtr = Tcl_NewStringObj(Tcl_GetHashKey(&familyTable, hPtr), -1);
Tcl_ListObjAppendElement(NULL, resultPtr, strPtr);
hPtr = Tcl_NextHashEntry(&search);
}
+ Tcl_SetObjResult(interp, resultPtr);
Tcl_DeleteHashTable(&familyTable);
}
@@ -901,12 +888,12 @@ TkpGetFontFamilies(interp, tkwin)
*
* TkpGetSubFonts --
*
- * A function used by the testing package for querying the actual
- * screen fonts that make up a font object.
+ * A function used by the testing package for querying the actual screen
+ * fonts that make up a font object.
*
* Results:
- * Modifies interp's result object to hold a list containing the
- * names of the screen fonts that make up the given font object.
+ * Modifies interp's result object to hold a list containing the names of
+ * the screen fonts that make up the given font object.
*
* Side effects:
* None.
@@ -915,43 +902,82 @@ TkpGetFontFamilies(interp, tkwin)
*/
void
-TkpGetSubFonts(interp, tkfont)
- Tcl_Interp *interp;
- Tk_Font tkfont;
+TkpGetSubFonts(
+ Tcl_Interp *interp,
+ Tk_Font tkfont)
{
int i;
- Tcl_Obj *objv[3];
- Tcl_Obj *resultPtr, *listPtr;
+ Tcl_Obj *objv[3], *resultPtr, *listPtr;
UnixFont *fontPtr;
FontFamily *familyPtr;
- resultPtr = Tcl_GetObjResult(interp);
+ resultPtr = Tcl_NewObj();
fontPtr = (UnixFont *) tkfont;
for (i = 0; i < fontPtr->numSubFonts; i++) {
familyPtr = fontPtr->subFontArray[i].familyPtr;
objv[0] = Tcl_NewStringObj(familyPtr->faceName, -1);
objv[1] = Tcl_NewStringObj(familyPtr->foundry, -1);
- objv[2] = Tcl_NewStringObj(Tcl_GetEncodingName(familyPtr->encoding), -1);
+ objv[2] = Tcl_NewStringObj(
+ Tcl_GetEncodingName(familyPtr->encoding), -1);
listPtr = Tcl_NewListObj(3, objv);
Tcl_ListObjAppendElement(NULL, resultPtr, listPtr);
}
+ Tcl_SetObjResult(interp, resultPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetFontAttrsForChar --
+ *
+ * Retrieve the font attributes of the actual font used to render a given
+ * character.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The font attributes are stored in *faPtr.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpGetFontAttrsForChar(
+ Tk_Window tkwin, /* Window on the font's display */
+ Tk_Font tkfont, /* Font to query */
+ Tcl_UniChar c, /* Character of interest */
+ TkFontAttributes *faPtr) /* Output: Font attributes */
+{
+ FontAttributes atts;
+ UnixFont *fontPtr = (UnixFont *) tkfont;
+ /* Structure describing the logical font */
+ SubFont *lastSubFontPtr = &fontPtr->subFontArray[0];
+ /* Pointer to subfont array in case
+ * FindSubFontForChar needs to fix up the
+ * memory allocation */
+ SubFont *thisSubFontPtr = FindSubFontForChar(fontPtr, c, &lastSubFontPtr);
+ /* Pointer to the subfont to use for the given
+ * character */
+
+ GetFontAttributes(Tk_Display(tkwin), thisSubFontPtr->fontStructPtr, &atts);
+ *faPtr = atts.fa;
}
/*
*---------------------------------------------------------------------------
*
- * Tk_MeasureChars --
+ * Tk_MeasureChars --
*
- * Determine the number of characters from the string that will fit
- * in the given horizontal span. The measurement is done under the
- * assumption that Tk_DrawChars() will be used to actually display
- * the characters.
+ * Determine the number of characters from the string that will fit in
+ * the given horizontal span. The measurement is done under the
+ * assumption that Tk_DrawChars() will be used to actually display the
+ * characters.
*
* Results:
- * The return value is the number of bytes from source that
- * fit into the span that extends from 0 to maxLength. *lengthPtr is
- * filled with the x-coordinate of the right edge of the last
- * character that did fit.
+ * The return value is the number of bytes from source that fit into the
+ * span that extends from 0 to maxLength. *lengthPtr is filled with the
+ * x-coordinate of the right edge of the last character that did fit.
*
* Side effects:
* None.
@@ -960,26 +986,26 @@ TkpGetSubFonts(interp, tkfont)
*/
int
-Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
- Tk_Font tkfont; /* Font in which characters will be drawn. */
- CONST char *source; /* UTF-8 string to be displayed. Need not be
+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 source string. */
- int maxLength; /* If >= 0, maxLength specifies the longest
+ int numBytes, /* Maximum number of bytes to consider from
+ * source string. */
+ 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
+ * this x-position. If < 0, then line length
* is unbounded and the flags argument is
* ignored. */
- int flags; /* Various flag bits OR-ed together:
+ int flags, /* Various flag bits OR-ed together:
* TK_PARTIAL_OK means include the last char
* which only partially fit on this line.
* TK_WHOLE_WORDS means stop on a word
- * boundary, if possible.
- * TK_AT_LEAST_ONE means return at least one
- * character even if no characters fit. */
- int *lengthPtr; /* Filled with x-location just after the
+ * boundary, if possible. TK_AT_LEAST_ONE
+ * means return at least one character even if
+ * no characters fit. */
+ int *lengthPtr) /* Filled with x-location just after the
* terminating character. */
{
UnixFont *fontPtr;
@@ -988,9 +1014,9 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
/*
* Unix does not use kerning or fractional character widths when
- * displaying text on the screen. So that means we can safely measure
- * individual characters or spans of characters and add up the widths
- * w/o any "off-by-one-pixel" errors.
+ * displaying text on the screen. So that means we can safely measure
+ * individual characters or spans of characters and add up the widths w/o
+ * any "off-by-one-pixel" errors.
*/
fontPtr = (UnixFont *) tkfont;
@@ -1001,7 +1027,7 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
curX = 0;
curByte = 0;
} else if (maxLength < 0) {
- CONST char *p, *end, *next;
+ const char *p, *end, *next;
Tcl_UniChar ch;
SubFont *thisSubFontPtr;
FontFamily *familyPtr;
@@ -1009,7 +1035,7 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
/*
* A three step process:
- * 1. Find a contiguous range of characters that can all be
+ * 1. Find a contiguous range of characters that can all be
* represented by a single screen font.
* 2. Convert those chars to the encoding of that font.
* 3. Measure converted chars.
@@ -1040,7 +1066,7 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
p = next;
}
familyPtr = lastSubFontPtr->familyPtr;
- Tcl_UtfToExternalDString(familyPtr->encoding, source, p - source,
+ Tcl_UtfToExternalDString(familyPtr->encoding, source, p - source,
&runString);
if (familyPtr->isTwoByteFont) {
curX += XTextWidth16(lastSubFontPtr->fontStructPtr,
@@ -1054,21 +1080,21 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
Tcl_DStringFree(&runString);
curByte = numBytes;
} else {
- CONST char *p, *end, *next, *term;
+ const char *p, *end, *next, *term;
int newX, termX, sawNonSpace, dstWrote;
Tcl_UniChar ch;
FontFamily *familyPtr;
- char buf[16];
+ XChar2b buf[8];
/*
- * How many chars will fit in the space allotted?
- * This first version may be inefficient because it measures
- * every character individually.
+ * How many chars will fit in the space allotted? This first version
+ * may be inefficient because it measures every character
+ * individually.
*/
next = source + Tcl_UtfToUniChar(source, &ch);
newX = curX = termX = 0;
-
+
term = source;
end = source + numBytes;
@@ -1080,14 +1106,14 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
} else {
lastSubFontPtr = FindSubFontForChar(fontPtr, ch, NULL);
familyPtr = lastSubFontPtr->familyPtr;
- Tcl_UtfToExternal(NULL, familyPtr->encoding, p, next - p,
- 0, NULL, buf, sizeof(buf), NULL, &dstWrote, NULL);
+ Tcl_UtfToExternal(NULL, familyPtr->encoding, p, next - p, 0, NULL,
+ (char *)&buf[0].byte1, sizeof(buf), NULL, &dstWrote, NULL);
if (familyPtr->isTwoByteFont) {
newX += XTextWidth16(lastSubFontPtr->fontStructPtr,
- (XChar2b *) buf, dstWrote >> 1);
+ buf, dstWrote >> 1);
} else {
- newX += XTextWidth(lastSubFontPtr->fontStructPtr, buf,
- dstWrote);
+ newX += XTextWidth(lastSubFontPtr->fontStructPtr,
+ (char *)&buf[0].byte1, dstWrote);
}
}
if (newX > maxLength) {
@@ -1115,14 +1141,14 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
/*
* P points to the first character that doesn't fit in the desired
- * span. Use the flags to figure out what to return.
+ * span. Use the flags to figure out what to return.
*/
if ((flags & TK_PARTIAL_OK) && (p < end) && (curX < maxLength)) {
/*
- * Include the first character that didn't quite fit in the desired
- * span. The width returned will include the width of that extra
- * character.
+ * Include the first character that didn't quite fit in the
+ * desired span. The width returned will include the width of that
+ * extra character.
*/
curX = newX;
@@ -1141,7 +1167,7 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
}
curX = termX;
- curByte = term - source;
+ curByte = term - source;
}
*lengthPtr = curX;
@@ -1151,11 +1177,67 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
/*
*---------------------------------------------------------------------------
*
+ * TkpMeasureCharsInContext --
+ *
+ * Determine the number of bytes from the string that will fit in the
+ * given horizontal span. The measurement is done under the assumption
+ * that TkpDrawCharsInContext() will be used to actually display the
+ * characters.
+ *
+ * This one is almost the same as Tk_MeasureChars(), but with access to
+ * all the characters on the line for context. On X11 this context isn't
+ * consulted, so we just call Tk_MeasureChars().
+ *
+ * Results:
+ * The return value is the number of bytes from source that fit into the
+ * span that extends from 0 to maxLength. *lengthPtr is filled with the
+ * x-coordinate of the right edge of the last character that did fit.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+int
+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. */
+ int numBytes, /* 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. */
+ int maxLength, /* If >= 0, maxLength specifies the longest
+ * permissible line length; don't consider any
+ * character that would cross this x-position.
+ * If < 0, then line length is unbounded and
+ * the flags argument is ignored. */
+ int flags, /* Various flag bits OR-ed together:
+ * TK_PARTIAL_OK means include the last char
+ * which only partially fit on this line.
+ * TK_WHOLE_WORDS means stop on a word
+ * boundary, if possible. TK_AT_LEAST_ONE
+ * means return at least one character even if
+ * no characters fit. TK_ISOLATE_END means
+ * that the last character should not be
+ * considered in context with the rest of the
+ * string (used for breaking lines). */
+ int *lengthPtr) /* Filled with x-location just after the
+ * terminating character. */
+{
+ (void) numBytes; /*unused*/
+ return Tk_MeasureChars(tkfont, source + rangeStart, rangeLength,
+ maxLength, flags, lengthPtr);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
* Tk_DrawChars --
*
- * Draw a string of characters on the screen. Tk_DrawChars()
- * expands control characters that occur in the string to
- * \xNN sequences.
+ * Draw a string of characters on the screen. Tk_DrawChars() expands
+ * control characters that occur in the string to \xNN sequences.
*
* Results:
* None.
@@ -1167,45 +1249,44 @@ Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
*/
void
-Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y)
- Display *display; /* Display on which to draw. */
- Drawable drawable; /* Window or pixmap in which to draw. */
- GC gc; /* Graphics context for drawing characters. */
- Tk_Font tkfont; /* Font in which characters will be drawn;
+Tk_DrawChars(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ GC gc, /* Graphics context for drawing characters. */
+ Tk_Font tkfont, /* Font in which characters will be drawn;
* must be the same as font used in GC. */
- CONST char *source; /* UTF-8 string to be displayed. Need not be
- * '\0' terminated. All Tk meta-characters
+ const char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. All Tk meta-characters
* (tabs, control characters, and newlines)
* should be stripped out of the string that
- * is passed to this function. If they are
- * not stripped out, they will be displayed as
+ * 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. */
- int x, y; /* Coordinates at which to place origin of
+ int numBytes, /* Number of bytes in string. */
+ int x, int y) /* Coordinates at which to place origin of
* string when drawing. */
{
- UnixFont *fontPtr;
+ UnixFont *fontPtr = (UnixFont *) tkfont;
SubFont *thisSubFontPtr, *lastSubFontPtr;
Tcl_DString runString;
- CONST char *p, *end, *next;
+ const char *p, *end, *next;
int xStart, needWidth, window_width, do_width;
Tcl_UniChar ch;
FontFamily *familyPtr;
#ifdef TK_DRAW_CHAR_XWINDOW_CHECK
int rx, ry;
- unsigned int width, height, border_width, depth;
+ unsigned width, height, border_width, depth;
Drawable root;
#endif
- fontPtr = (UnixFont *) tkfont;
lastSubFontPtr = &fontPtr->subFontArray[0];
-
xStart = x;
#ifdef TK_DRAW_CHAR_XWINDOW_CHECK
/*
* Get the window width so we can abort drawing outside of the window
*/
+
if (XGetGeometry(display, drawable, &root, &rx, &ry, &width, &height,
&border_width, &depth) == False) {
window_width = INT_MAX;
@@ -1214,9 +1295,10 @@ Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y)
}
#else
/*
- * This is used by default until we find a solution that doesn't
- * round-trip to the X server (need to get Tk cached window width).
+ * This is used by default until we find a solution that doesn't do a
+ * round-trip to the X server (needed to get Tk cached window width).
*/
+
window_width = 32768;
#endif
@@ -1233,13 +1315,13 @@ Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y)
if ((thisSubFontPtr != lastSubFontPtr)
|| (p == end) || (p-source > 200)) {
if (p > source) {
- do_width = (needWidth || (p != end)) ? 1 : 0;
+ do_width = (needWidth || (p != end)) ? 1 : 0;
familyPtr = lastSubFontPtr->familyPtr;
Tcl_UtfToExternalDString(familyPtr->encoding, source,
p - source, &runString);
if (familyPtr->isTwoByteFont) {
- XDrawString16(display, drawable, gc, x, y,
+ XDrawString16(display, drawable, gc, x, y,
(XChar2b *) Tcl_DStringValue(&runString),
Tcl_DStringLength(&runString) / 2);
if (do_width) {
@@ -1263,7 +1345,7 @@ Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y)
source = p;
XSetFont(display, gc, lastSubFontPtr->fontStructPtr->fid);
if (x > window_width) {
- break;
+ break;
}
}
p = next;
@@ -1284,30 +1366,71 @@ Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y)
(unsigned) (x - xStart), (unsigned) fontPtr->barHeight);
}
}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkpDrawCharsInContext --
+ *
+ * Draw a string of characters on the screen like Tk_DrawChars(), but
+ * with access to all the characters on the line for context. On X11 this
+ * context isn't consulted, so we just call Tk_DrawChars().
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Information gets drawn on the screen.
+ *
+ *---------------------------------------------------------------------------
+ */
+void
+TkpDrawCharsInContext(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ GC gc, /* Graphics context for drawing characters. */
+ Tk_Font tkfont, /* Font in which characters will be drawn;
+ * must be the same as font used in GC. */
+ const char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. All Tk meta-characters
+ * (tabs, control characters, and newlines)
+ * should be stripped out of the string that
+ * 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. */
+ int rangeStart, /* Index of first byte to draw. */
+ int 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. */
+{
+ (void) numBytes; /*unused*/
-
+ Tk_DrawChars(display, drawable, gc, tkfont, source + rangeStart,
+ rangeLength, x, y);
+}
/*
*-------------------------------------------------------------------------
*
* CreateClosestFont --
*
- * Helper for TkpGetNativeFont() and TkpGetFontFromAttributes().
- * Given a set of font attributes, construct a close XFontStruct.
- * If requested face name is not available, automatically
- * substitutes an alias for requested face name. If encoding is
- * not specified (or the requested one is not available),
- * automatically chooses another encoding from the list of
- * preferred encodings. If the foundry is not specified (or
- * is not available) automatically prefers "adobe" foundry.
- * For all other attributes, if the requested value was not
- * available, the appropriate "close" value will be used.
+ * Helper for TkpGetNativeFont() and TkpGetFontFromAttributes(). Given a
+ * set of font attributes, construct a close XFontStruct. If requested
+ * face name is not available, automatically substitutes an alias for
+ * requested face name. If encoding is not specified (or the requested
+ * one is not available), automatically chooses another encoding from the
+ * list of preferred encodings. If the foundry is not specified (or is
+ * not available) automatically prefers "adobe" foundry. For all other
+ * attributes, if the requested value was not available, the appropriate
+ * "close" value will be used.
*
* Results:
- * Return value is the XFontStruct that best matched the
- * requested attributes. The return value is never NULL; some
- * font will always be returned.
+ * Return value is the XFontStruct that best matched the requested
+ * attributes. The return value is never NULL; some font will always be
+ * returned.
*
* Side effects:
* None.
@@ -1316,20 +1439,19 @@ Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y)
*/
static XFontStruct *
-CreateClosestFont(tkwin, faPtr, xaPtr)
- Tk_Window tkwin; /* For display where font will be used. */
- CONST TkFontAttributes *faPtr;
+CreateClosestFont(
+ Tk_Window tkwin, /* For display where font will be used. */
+ const TkFontAttributes *faPtr,
/* Set of generic attributes to match. */
- CONST TkXLFDAttributes *xaPtr;
+ const TkXLFDAttributes *xaPtr)
/* Set of X-specific attributes to match. */
{
FontAttributes want;
char **nameList;
- int numNames, nameIdx;
+ int numNames, nameIdx, bestIdx[2];
Display *display;
XFontStruct *fontStructPtr;
- int bestIdx[2];
- unsigned int bestScore[2];
+ unsigned bestScore[2];
want.fa = *faPtr;
want.xa = *xaPtr;
@@ -1359,10 +1481,10 @@ CreateClosestFont(tkwin, faPtr, xaPtr)
nameList = ListFontOrAlias(display, want.fa.family, &numNames);
if (numNames == 0) {
- char ***fontFallbacks;
+ const char *const *const *fontFallbacks;
int i, j;
- char *fallback;
-
+ const char *fallback;
+
fontFallbacks = TkFontGetFallbacks();
for (i = 0; fontFallbacks[i] != NULL; i++) {
for (j = 0; (fallback = fontFallbacks[i][j]) != NULL; j++) {
@@ -1387,15 +1509,16 @@ CreateClosestFont(tkwin, faPtr, xaPtr)
return GetSystemFont(display);
}
}
- found:
+
+ found:
bestIdx[0] = -1;
bestIdx[1] = -1;
- bestScore[0] = (unsigned int) -1;
- bestScore[1] = (unsigned int) -1;
+ bestScore[0] = (unsigned) -1;
+ bestScore[1] = (unsigned) -1;
for (nameIdx = 0; nameIdx < numNames; nameIdx++) {
FontAttributes got;
int scalable;
- unsigned int score;
+ unsigned score;
if (TkFontParseXLFD(nameList[nameIdx], &got.fa, &got.xa) != TCL_OK) {
continue;
@@ -1412,9 +1535,10 @@ CreateClosestFont(tkwin, faPtr, xaPtr)
}
}
- fontStructPtr = GetScreenFont(display, &want, nameList, bestIdx, bestScore);
+ fontStructPtr = GetScreenFont(display, &want, nameList, bestIdx,
+ bestScore);
XFreeFontNames(nameList);
-
+
if (fontStructPtr == NULL) {
return GetSystemFont(display);
}
@@ -1427,12 +1551,12 @@ CreateClosestFont(tkwin, faPtr, xaPtr)
* InitFont --
*
* Helper for TkpGetNativeFont() and TkpGetFontFromAttributes().
- * Initializes the memory for a new UnixFont that wraps the
+ * Initializes the memory for a new UnixFont that wraps the
* platform-specific data.
*
- * The caller is responsible for initializing the fields of the
- * TkFont that are used exclusively by the generic TkFont code, and
- * for releasing those fields before calling TkpDeleteFont().
+ * The caller is responsible for initializing the fields of the TkFont
+ * that are used exclusively by the generic TkFont code, and for
+ * releasing those fields before calling TkpDeleteFont().
*
* Results:
* Fills the WinFont structure.
@@ -1441,17 +1565,17 @@ CreateClosestFont(tkwin, faPtr, xaPtr)
* Memory allocated.
*
*---------------------------------------------------------------------------
- */
+ */
static void
-InitFont(tkwin, fontStructPtr, fontPtr)
- Tk_Window tkwin; /* For screen where font will be used. */
- XFontStruct *fontStructPtr; /* X information about font. */
- UnixFont *fontPtr; /* Filled with information constructed from
+InitFont(
+ Tk_Window tkwin, /* For screen where font will be used. */
+ XFontStruct *fontStructPtr, /* X information about font. */
+ UnixFont *fontPtr) /* Filled with information constructed from
* the above arguments. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr =
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
unsigned long value;
int minHi, maxHi, minLo, maxLo, fixed, width, limit, i, n;
FontAttributes fa;
@@ -1464,7 +1588,7 @@ InitFont(tkwin, fontStructPtr, fontPtr)
/*
* Get all font attributes and metrics.
*/
-
+
display = Tk_Display(tkwin);
GetFontAttributes(display, fontStructPtr, &fa);
@@ -1472,7 +1596,7 @@ InitFont(tkwin, fontStructPtr, fontPtr)
maxHi = fontStructPtr->max_byte1;
minLo = fontStructPtr->min_char_or_byte2;
maxLo = fontStructPtr->max_char_or_byte2;
-
+
fixed = 1;
if (fontStructPtr->per_char != NULL) {
width = 0;
@@ -1490,41 +1614,41 @@ InitFont(tkwin, fontStructPtr, fontPtr)
}
}
- fontPtr->font.fid = fontStructPtr->fid;
+ fontPtr->font.fid = fontStructPtr->fid;
- faPtr = &fontPtr->font.fa;
- faPtr->family = fa.fa.family;
- faPtr->size = TkFontGetPoints(tkwin, fa.fa.size);
- faPtr->weight = fa.fa.weight;
- faPtr->slant = fa.fa.slant;
- faPtr->underline = 0;
- faPtr->overstrike = 0;
+ faPtr = &fontPtr->font.fa;
+ faPtr->family = fa.fa.family;
+ faPtr->size = TkFontGetPoints(tkwin, fa.fa.size);
+ faPtr->weight = fa.fa.weight;
+ faPtr->slant = fa.fa.slant;
+ faPtr->underline = 0;
+ faPtr->overstrike = 0;
- fmPtr = &fontPtr->font.fm;
- fmPtr->ascent = fontStructPtr->ascent;
- fmPtr->descent = fontStructPtr->descent;
- fmPtr->maxWidth = fontStructPtr->max_bounds.width;
- fmPtr->fixed = fixed;
+ fmPtr = &fontPtr->font.fm;
+ fmPtr->ascent = fontStructPtr->ascent;
+ fmPtr->descent = fontStructPtr->descent;
+ fmPtr->maxWidth = fontStructPtr->max_bounds.width;
+ fmPtr->fixed = fixed;
- fontPtr->display = display;
- fontPtr->pixelSize = TkFontGetPixels(tkwin, fa.fa.size);
- fontPtr->xa = fa.xa;
+ fontPtr->display = display;
+ fontPtr->pixelSize = TkFontGetPixels(tkwin, fa.fa.size);
+ fontPtr->xa = fa.xa;
- fontPtr->numSubFonts = 1;
- fontPtr->subFontArray = fontPtr->staticSubFonts;
+ fontPtr->numSubFonts = 1;
+ fontPtr->subFontArray = fontPtr->staticSubFonts;
InitSubFont(display, fontStructPtr, 1, &fontPtr->subFontArray[0]);
- fontPtr->controlSubFont = fontPtr->subFontArray[0];
- subFontPtr = FindSubFontForChar(fontPtr, '0', NULL);
- controlPtr = &fontPtr->controlSubFont;
- controlPtr->fontStructPtr = subFontPtr->fontStructPtr;
- controlPtr->familyPtr = &tsdPtr->controlFamily;
- controlPtr->fontMap = tsdPtr->controlFamily.fontMap;
-
+ fontPtr->controlSubFont = fontPtr->subFontArray[0];
+ subFontPtr = FindSubFontForChar(fontPtr, '0', NULL);
+ controlPtr = &fontPtr->controlSubFont;
+ controlPtr->fontStructPtr = subFontPtr->fontStructPtr;
+ controlPtr->familyPtr = &tsdPtr->controlFamily;
+ controlPtr->fontMap = tsdPtr->controlFamily.fontMap;
+
pageMap = fontPtr->subFontArray[0].fontMap[0];
for (i = 0; i < 256; i++) {
- if ((minHi > 0) || (i < minLo) || (i > maxLo) ||
- (((pageMap[i >> 3] >> (i & 7)) & 1) == 0)) {
+ if ((minHi > 0) || (i < minLo) || (i > maxLo)
+ || (((pageMap[i>>3] >> (i&7)) & 1) == 0)) {
n = 0;
} else if (fontStructPtr->per_char == NULL) {
n = fontStructPtr->max_bounds.width;
@@ -1533,14 +1657,13 @@ InitFont(tkwin, fontStructPtr, fontPtr)
}
fontPtr->widths[i] = n;
}
-
if (XGetFontProperty(fontStructPtr, XA_UNDERLINE_POSITION, &value)) {
fontPtr->underlinePos = value;
} else {
/*
- * If the XA_UNDERLINE_POSITION property does not exist, the X
- * manual recommends using the following value:
+ * If the XA_UNDERLINE_POSITION property does not exist, the X manual
+ * recommends using the following value:
*/
fontPtr->underlinePos = fontStructPtr->descent / 2;
@@ -1551,10 +1674,10 @@ InitFont(tkwin, fontStructPtr, fontPtr)
}
if (fontPtr->barHeight == 0) {
/*
- * If the XA_UNDERLINE_THICKNESS property does not exist, the X
- * manual recommends using the width of the stem on a capital
- * letter. I don't know of a way to get the stem width of a letter,
- * so guess and use 1/3 the width of a capital I.
+ * If the XA_UNDERLINE_THICKNESS property does not exist, the X manual
+ * recommends using the width of the stem on a capital letter. I don't
+ * know of a way to get the stem width of a letter, so guess and use
+ * 1/3 the width of a capital I.
*/
fontPtr->barHeight = fontPtr->widths['I'] / 3;
@@ -1565,8 +1688,8 @@ InitFont(tkwin, fontStructPtr, fontPtr)
if (fontPtr->underlinePos + fontPtr->barHeight > fontStructPtr->descent) {
/*
* If this set of cobbled together values would cause the bottom of
- * the underline bar to stick below the descent of the font, jack
- * the underline up a bit higher.
+ * the underline bar to stick below the descent of the font, jack the
+ * underline up a bit higher.
*/
fontPtr->barHeight = fontStructPtr->descent - fontPtr->underlinePos;
@@ -1581,10 +1704,9 @@ InitFont(tkwin, fontStructPtr, fontPtr)
*-------------------------------------------------------------------------
*
* ReleaseFont --
- *
- * Called to release the unix-specific contents of a TkFont.
- * The caller is responsible for freeing the memory used by the
- * font itself.
+ *
+ * Called to release the unix-specific contents of a TkFont. The caller
+ * is responsible for freeing the memory used by the font itself.
*
* Results:
* None.
@@ -1594,10 +1716,10 @@ InitFont(tkwin, fontStructPtr, fontPtr)
*
*---------------------------------------------------------------------------
*/
-
+
static void
-ReleaseFont(fontPtr)
- UnixFont *fontPtr; /* The font to delete. */
+ReleaseFont(
+ UnixFont *fontPtr) /* The font to delete. */
{
int i;
@@ -1605,7 +1727,7 @@ ReleaseFont(fontPtr)
ReleaseSubFont(fontPtr->display, &fontPtr->subFontArray[i]);
}
if (fontPtr->subFontArray != fontPtr->staticSubFonts) {
- ckfree((char *) fontPtr->subFontArray);
+ ckfree(fontPtr->subFontArray);
}
}
@@ -1614,9 +1736,9 @@ ReleaseFont(fontPtr)
*
* InitSubFont --
*
- * Wrap a screen font and load the FontFamily that represents
- * it. Used to prepare a SubFont so that characters can be mapped
- * from UTF-8 to the charset of the font.
+ * Wrap a screen font and load the FontFamily that represents it. Used to
+ * prepare a SubFont so that characters can be mapped from UTF-8 to the
+ * charset of the font.
*
* Results:
* The subFontPtr is filled with information about the font.
@@ -1628,17 +1750,17 @@ ReleaseFont(fontPtr)
*/
static void
-InitSubFont(display, fontStructPtr, base, subFontPtr)
- Display *display; /* Display in which font will be used. */
- XFontStruct *fontStructPtr; /* The screen font. */
- int base; /* Non-zero if this SubFont is being used
- * as the base font for a font object. */
- SubFont *subFontPtr; /* Filled with SubFont constructed from
- * above attributes. */
+InitSubFont(
+ Display *display, /* Display in which font will be used. */
+ XFontStruct *fontStructPtr, /* The screen font. */
+ int base, /* Non-zero if this SubFont is being used as
+ * the base font for a font object. */
+ SubFont *subFontPtr) /* Filled with SubFont constructed from above
+ * attributes. */
{
subFontPtr->fontStructPtr = fontStructPtr;
- subFontPtr->familyPtr = AllocFontFamily(display, fontStructPtr, base);
- subFontPtr->fontMap = subFontPtr->familyPtr->fontMap;
+ subFontPtr->familyPtr = AllocFontFamily(display, fontStructPtr, base);
+ subFontPtr->fontMap = subFontPtr->familyPtr->fontMap;
}
/*
@@ -1646,8 +1768,8 @@ InitSubFont(display, fontStructPtr, base, subFontPtr)
*
* ReleaseSubFont --
*
- * Called to release the contents of a SubFont. The caller is
- * responsible for freeing the memory used by the SubFont itself.
+ * Called to release the contents of a SubFont. The caller is responsible
+ * for freeing the memory used by the SubFont itself.
*
* Results:
* None.
@@ -1659,9 +1781,9 @@ InitSubFont(display, fontStructPtr, base, subFontPtr)
*/
static void
-ReleaseSubFont(display, subFontPtr)
- Display *display; /* Display which owns screen font. */
- SubFont *subFontPtr; /* The SubFont to delete. */
+ReleaseSubFont(
+ Display *display, /* Display which owns screen font. */
+ SubFont *subFontPtr) /* The SubFont to delete. */
{
XFreeFont(display, subFontPtr->fontStructPtr);
FreeFontFamily(subFontPtr->familyPtr);
@@ -1672,43 +1794,41 @@ ReleaseSubFont(display, subFontPtr)
*
* AllocFontFamily --
*
- * Find the FontFamily structure associated with the given font
- * name. The information should be stored by the caller in a
- * SubFont and used when determining if that SubFont supports a
- * character.
+ * Find the FontFamily structure associated with the given font name.
+ * The information should be stored by the caller in a SubFont and used
+ * when determining if that SubFont supports a character.
*
- * Cannot use the string name used to construct the font as the
- * key, because the capitalization may not be canonical. Therefore
- * use the face name actually retrieved from the font metrics as
- * the key.
+ * Cannot use the string name used to construct the font as the key,
+ * because the capitalization may not be canonical. Therefore use the
+ * face name actually retrieved from the font metrics as the key.
*
* Results:
- * A pointer to a FontFamily. The reference count in the FontFamily
- * is automatically incremented. When the SubFont is released, the
- * reference count is decremented. When no SubFont is using this
- * FontFamily, it may be deleted.
+ * A pointer to a FontFamily. The reference count in the FontFamily is
+ * automatically incremented. When the SubFont is released, the reference
+ * count is decremented. When no SubFont is using this FontFamily, it may
+ * be deleted.
*
* Side effects:
- * A new FontFamily structure will be allocated if this font family
- * has not been seen. TrueType character existence metrics are
- * loaded into the FontFamily structure.
+ * A new FontFamily structure will be allocated if this font family has
+ * not been seen. TrueType character existence metrics are loaded into
+ * the FontFamily structure.
*
*-------------------------------------------------------------------------
*/
static FontFamily *
-AllocFontFamily(display, fontStructPtr, base)
- Display *display; /* Display in which font will be used. */
- XFontStruct *fontStructPtr; /* Screen font whose FontFamily is to be
+AllocFontFamily(
+ Display *display, /* Display in which font will be used. */
+ XFontStruct *fontStructPtr, /* Screen font whose FontFamily is to be
* returned. */
- int base; /* Non-zero if this font family is to be
- * used in the base font of a font object. */
+ int base) /* Non-zero if this font family is to be used
+ * in the base font of a font object. */
{
FontFamily *familyPtr;
FontAttributes fa;
Tcl_Encoding encoding;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr =
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
GetFontAttributes(display, fontStructPtr, &fa);
encoding = Tcl_GetEncoding(NULL, GetEncodingAlias(fa.xa.charset));
@@ -1724,31 +1844,31 @@ AllocFontFamily(display, fontStructPtr, base)
}
}
- familyPtr = (FontFamily *) ckalloc(sizeof(FontFamily));
+ familyPtr = ckalloc(sizeof(FontFamily));
memset(familyPtr, 0, sizeof(FontFamily));
familyPtr->nextPtr = tsdPtr->fontFamilyList;
tsdPtr->fontFamilyList = familyPtr;
- /*
- * Set key for this FontFamily.
+ /*
+ * Set key for this FontFamily.
*/
-
+
familyPtr->foundry = fa.xa.foundry;
familyPtr->faceName = fa.fa.family;
familyPtr->encoding = encoding;
- /*
- * An initial refCount of 2 means that FontFamily information will
- * persist even when the SubFont that loaded the FontFamily is released.
- * Change it to 1 to cause FontFamilies to be unloaded when not in use.
+ /*
+ * An initial refCount of 2 means that FontFamily information will persist
+ * even when the SubFont that loaded the FontFamily is released. Change it
+ * to 1 to cause FontFamilies to be unloaded when not in use.
*/
familyPtr->refCount = 2;
/*
- * One byte/character fonts have both min_byte1 and max_byte1 0,
- * and max_char_or_byte2 <= 255.
- * Anything else specifies a two byte/character font.
+ * One byte/character fonts have both min_byte1 and max_byte1 0, and
+ * max_char_or_byte2 <= 255. Anything else specifies a two byte/character
+ * font.
*/
familyPtr->isTwoByteFont = !(
@@ -1763,9 +1883,9 @@ AllocFontFamily(display, fontStructPtr, base)
*
* FreeFontFamily --
*
- * Called to free an FontFamily when the SubFont is finished using
- * it. Frees the contents of the FontFamily and the memory used by
- * the FontFamily itself.
+ * Called to free an FontFamily when the SubFont is finished using it.
+ * Frees the contents of the FontFamily and the memory used by the
+ * FontFamily itself.
*
* Results:
* None.
@@ -1775,43 +1895,43 @@ AllocFontFamily(display, fontStructPtr, base)
*
*-------------------------------------------------------------------------
*/
-
+
static void
-FreeFontFamily(familyPtr)
- FontFamily *familyPtr; /* The FontFamily to delete. */
+FreeFontFamily(
+ FontFamily *familyPtr) /* The FontFamily to delete. */
{
FontFamily **familyPtrPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr =
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
int i;
if (familyPtr == NULL) {
- return;
+ return;
}
familyPtr->refCount--;
if (familyPtr->refCount > 0) {
- return;
+ return;
}
Tcl_FreeEncoding(familyPtr->encoding);
for (i = 0; i < FONTMAP_PAGES; i++) {
- if (familyPtr->fontMap[i] != NULL) {
- ckfree(familyPtr->fontMap[i]);
- }
+ if (familyPtr->fontMap[i] != NULL) {
+ ckfree(familyPtr->fontMap[i]);
+ }
}
-
- /*
- * Delete from list.
+
+ /*
+ * Delete from list.
*/
-
+
for (familyPtrPtr = &tsdPtr->fontFamilyList; ; ) {
- if (*familyPtrPtr == familyPtr) {
- *familyPtrPtr = familyPtr->nextPtr;
+ if (*familyPtrPtr == familyPtr) {
+ *familyPtrPtr = familyPtr->nextPtr;
break;
}
familyPtrPtr = &(*familyPtrPtr)->nextPtr;
}
-
- ckfree((char *) familyPtr);
+
+ ckfree(familyPtr);
}
/*
@@ -1819,39 +1939,39 @@ FreeFontFamily(familyPtr)
*
* FindSubFontForChar --
*
- * Determine which screen font is necessary to use to
- * display the given character. If the font object does not have
- * a screen font that can display the character, another screen font
- * may be loaded into the font object, following a set of preferred
- * fallback rules.
+ * Determine which screen font is necessary to use to display the given
+ * character. If the font object does not have a screen font that can
+ * display the character, another screen font may be loaded into the font
+ * object, following a set of preferred fallback rules.
*
* Results:
- * The return value is the SubFont to use to display the given
- * character.
+ * The return value is the SubFont to use to display the given character.
*
* Side effects:
- * The contents of fontPtr are modified to cache the results
- * of the lookup and remember any SubFonts that were dynamically
- * loaded. The table of SubFonts might be extended, and if a non-NULL
- * reference to a subfont pointer is available, it is updated if it
- * previously pointed into the old subfont table.
+ * The contents of fontPtr are modified to cache the results of the
+ * lookup and remember any SubFonts that were dynamically loaded. The
+ * table of SubFonts might be extended, and if a non-NULL reference to a
+ * subfont pointer is available, it is updated if it previously pointed
+ * into the old subfont table.
*
*-------------------------------------------------------------------------
*/
static SubFont *
-FindSubFontForChar(fontPtr, ch, fixSubFontPtrPtr)
- UnixFont *fontPtr; /* The font object with which the character
+FindSubFontForChar(
+ UnixFont *fontPtr, /* The font object with which the character
* will be displayed. */
- int ch; /* The Unicode character to be displayed. */
- SubFont **fixSubFontPtrPtr; /* Subfont reference to fix up if we
+ int ch, /* The Unicode character to be displayed. */
+ SubFont **fixSubFontPtrPtr) /* Subfont reference to fix up if we
* reallocate our subfont table. */
{
int i, j, k, numNames;
- Tk_Uid faceName;
- char *fallback;
- char **aliases, **nameList, **anyFallbacks;
- char ***fontFallbacks;
+ Tk_Uid faceName;
+ const char *fallback;
+ const char *const *aliases;
+ char **nameList;
+ const char *const *anyFallbacks;
+ const char *const *const *fontFallbacks;
SubFont *subFontPtr;
Tcl_DString ds;
@@ -1870,19 +1990,19 @@ FindSubFontForChar(fontPtr, ch, fixSubFontPtrPtr)
}
/*
- * Keep track of all face names that we check, so we don't check some
- * name multiple times if it can be reached by multiple paths.
+ * Keep track of all face names that we check, so we don't check some name
+ * multiple times if it can be reached by multiple paths.
*/
-
+
Tcl_DStringInit(&ds);
/*
- * Are there any other fonts with the same face name as the base
- * font that could display this character, e.g., if the base font
- * is adobe:fixed:iso8859-1, we could might be able to use
+ * Are there any other fonts with the same face name as the base font that
+ * could display this character, e.g., if the base font is
+ * adobe:fixed:iso8859-1, we could might be able to use
* misc:fixed:iso8859-8 or sony:fixed:jisx0208.1983-0
*/
-
+
faceName = fontPtr->font.fa.family;
if (SeenName(faceName, &ds) == 0) {
subFontPtr = CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr);
@@ -1904,7 +2024,7 @@ FindSubFontForChar(fontPtr, ch, fixSubFontPtrPtr)
goto tryfallbacks;
} else if (aliases != NULL) {
- /*
+ /*
* Or if an alias for the base font has a fallback...
*/
@@ -1917,11 +2037,11 @@ FindSubFontForChar(fontPtr, ch, fixSubFontPtrPtr)
}
continue;
- tryfallbacks:
+ tryfallbacks:
- /*
- * ...then see if we can use one of the fallbacks, or an
- * alias for one of the fallbacks.
+ /*
+ * ...then see if we can use one of the fallbacks, or an alias for one
+ * of the fallbacks.
*/
for (j = 0; (fallback = fontFallbacks[i][j]) != NULL; j++) {
@@ -1934,7 +2054,7 @@ FindSubFontForChar(fontPtr, ch, fixSubFontPtrPtr)
}
/*
- * See if we can use something from the global fallback list.
+ * See if we can use something from the global fallback list.
*/
anyFallbacks = TkFontGetGlobalClass();
@@ -1947,8 +2067,8 @@ FindSubFontForChar(fontPtr, ch, fixSubFontPtrPtr)
}
/*
- * Try all face names available in the whole system until we
- * find one that can be used.
+ * Try all face names available in the whole system until we find one that
+ * can be used.
*/
nameList = ListFonts(fontPtr->display, "*", &numNames);
@@ -1966,7 +2086,7 @@ FindSubFontForChar(fontPtr, ch, fixSubFontPtrPtr)
}
XFreeFontNames(nameList);
- end:
+ end:
Tcl_DStringFree(&ds);
if (subFontPtr == NULL) {
@@ -1989,24 +2109,23 @@ FindSubFontForChar(fontPtr, ch, fixSubFontPtrPtr)
* See if the screen font can display the given character.
*
* Results:
- * The return value is 0 if the screen font cannot display the
- * character, non-zero otherwise.
+ * The return value is 0 if the screen font cannot display the character,
+ * non-zero otherwise.
*
* Side effects:
- * New pages are added to the font mapping cache whenever the
- * character belongs to a page that hasn't been seen before.
- * When a page is loaded, information about all the characters on
- * that page is stored, not just for the single character in
- * question.
+ * New pages are added to the font mapping cache whenever the character
+ * belongs to a page that hasn't been seen before. When a page is loaded,
+ * information about all the characters on that page is stored, not just
+ * for the single character in question.
*
*-------------------------------------------------------------------------
*/
static int
-FontMapLookup(subFontPtr, ch)
- SubFont *subFontPtr; /* Contains font mapping cache to be queried
+FontMapLookup(
+ SubFont *subFontPtr, /* Contains font mapping cache to be queried
* and possibly updated. */
- int ch; /* Character to be tested. */
+ int ch) /* Character to be tested. */
{
int row, bitOffset;
@@ -2023,31 +2142,30 @@ FontMapLookup(subFontPtr, ch)
*
* FontMapInsert --
*
- * Tell the font mapping cache that the given screen font should be
- * used to display the specified character. This is called when no
- * font on the system can be be found that can display that
- * character; we lie to the font and tell it that it can display
- * the character, otherwise we would end up re-searching the entire
- * fallback hierarchy every time that character was seen.
+ * Tell the font mapping cache that the given screen font should be used
+ * to display the specified character. This is called when no font on the
+ * system can be be found that can display that character; we lie to the
+ * font and tell it that it can display the character, otherwise we would
+ * end up re-searching the entire fallback hierarchy every time that
+ * character was seen.
*
* Results:
* None.
*
* Side effects:
- * New pages are added to the font mapping cache whenever the
- * character belongs to a page that hasn't been seen before.
- * When a page is loaded, information about all the characters on
- * that page is stored, not just for the single character in
- * question.
+ * New pages are added to the font mapping cache whenever the character
+ * belongs to a page that hasn't been seen before. When a page is loaded,
+ * information about all the characters on that page is stored, not just
+ * for the single character in question.
*
*-------------------------------------------------------------------------
*/
static void
-FontMapInsert(subFontPtr, ch)
- SubFont *subFontPtr; /* Contains font mapping cache to be
+FontMapInsert(
+ SubFont *subFontPtr, /* Contains font mapping cache to be
* updated. */
- int ch; /* Character to be added to cache. */
+ int ch) /* Character to be added to cache. */
{
int row, bitOffset;
@@ -2064,25 +2182,25 @@ FontMapInsert(subFontPtr, ch)
*
* FontMapLoadPage --
*
- * Load information about all the characters on a given page.
- * This information consists of one bit per character that indicates
- * whether the associated screen font can (1) or cannot (0) display
- * the characters on the page.
+ * Load information about all the characters on a given page. This
+ * information consists of one bit per character that indicates whether
+ * the associated screen font can (1) or cannot (0) display the
+ * characters on the page.
*
* Results:
* None.
*
* Side effects:
- * Mempry allocated.
+ * Memory allocated.
*
*-------------------------------------------------------------------------
*/
-static void
-FontMapLoadPage(subFontPtr, row)
- SubFont *subFontPtr; /* Contains font mapping cache to be
+static void
+FontMapLoadPage(
+ SubFont *subFontPtr, /* Contains font mapping cache to be
* updated. */
- int row; /* Index of the page to be loaded into
- * the cache. */
+ int row) /* Index of the page to be loaded into the
+ * cache. */
{
char buf[16], src[TCL_UTF_MAX];
int minHi, maxHi, minLo, maxLo, scale, checkLo;
@@ -2090,27 +2208,27 @@ FontMapLoadPage(subFontPtr, row)
Tcl_Encoding encoding;
XFontStruct *fontStructPtr;
XCharStruct *widths;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr =
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- subFontPtr->fontMap[row] = (char *) ckalloc(FONTMAP_BITSPERPAGE / 8);
+ subFontPtr->fontMap[row] = ckalloc(FONTMAP_BITSPERPAGE / 8);
memset(subFontPtr->fontMap[row], 0, FONTMAP_BITSPERPAGE / 8);
if (subFontPtr->familyPtr == &tsdPtr->controlFamily) {
return;
}
- fontStructPtr = subFontPtr->fontStructPtr;
- encoding = subFontPtr->familyPtr->encoding;
- isTwoByteFont = subFontPtr->familyPtr->isTwoByteFont;
+ fontStructPtr = subFontPtr->fontStructPtr;
+ encoding = subFontPtr->familyPtr->encoding;
+ isTwoByteFont = subFontPtr->familyPtr->isTwoByteFont;
- widths = fontStructPtr->per_char;
- minHi = fontStructPtr->min_byte1;
- maxHi = fontStructPtr->max_byte1;
- minLo = fontStructPtr->min_char_or_byte2;
- maxLo = fontStructPtr->max_char_or_byte2;
- scale = maxLo - minLo + 1;
- checkLo = minLo;
+ widths = fontStructPtr->per_char;
+ minHi = fontStructPtr->min_byte1;
+ maxHi = fontStructPtr->max_byte1;
+ minLo = fontStructPtr->min_char_or_byte2;
+ maxLo = fontStructPtr->max_char_or_byte2;
+ scale = maxLo - minLo + 1;
+ checkLo = minLo;
if (! isTwoByteFont) {
if (minLo < 32) {
@@ -2123,7 +2241,7 @@ FontMapLoadPage(subFontPtr, row)
int hi, lo;
if (Tcl_UtfToExternal(NULL, encoding, src, Tcl_UniCharToUtf(i, src),
- TCL_ENCODING_STOPONERROR, NULL, buf, sizeof(buf), NULL,
+ TCL_ENCODING_STOPONERROR, NULL, buf, sizeof(buf), NULL,
NULL, NULL) != TCL_OK) {
continue;
}
@@ -2138,7 +2256,7 @@ FontMapLoadPage(subFontPtr, row)
continue;
}
n = (hi - minHi) * scale + lo - minLo;
- if ((widths == NULL) || ((widths[n].width + widths[n].rbearing) != 0)) {
+ if ((widths == NULL) || (widths[n].width + widths[n].rbearing != 0)) {
bitOffset = i & (FONTMAP_BITSPERPAGE - 1);
subFontPtr->fontMap[row][bitOffset >> 3] |= 1 << (bitOffset & 7);
}
@@ -2150,43 +2268,41 @@ FontMapLoadPage(subFontPtr, row)
*
* CanUseFallbackWithAliases --
*
- * Helper function for FindSubFontForChar. Determine if the
- * specified face name (or an alias of the specified face name)
- * can be used to construct a screen font that can display the
- * given character.
+ * Helper function for FindSubFontForChar. Determine if the specified
+ * face name (or an alias of the specified face name) can be used to
+ * construct a screen font that can display the given character.
*
* Results:
* See CanUseFallback().
*
* Side effects:
- * If the name and/or one of its aliases was rejected, the
- * rejected string is recorded in nameTriedPtr so that it won't
- * be tried again. The table of SubFonts might be extended, and if
- * a non-NULL reference to a subfont pointer is available, it is
- * updated if it previously pointed into the old subfont table.
+ * If the name and/or one of its aliases was rejected, the rejected
+ * string is recorded in nameTriedPtr so that it won't be tried again.
+ * The table of SubFonts might be extended, and if a non-NULL reference
+ * to a subfont pointer is available, it is updated if it previously
+ * pointed into the old subfont table.
*
*---------------------------------------------------------------------------
*/
static SubFont *
-CanUseFallbackWithAliases(fontPtr, faceName, ch, nameTriedPtr,
- fixSubFontPtrPtr)
- UnixFont *fontPtr; /* The font object that will own the new
+CanUseFallbackWithAliases(
+ UnixFont *fontPtr, /* The font object that will own the new
* screen font. */
- char *faceName; /* Desired face name for new screen font. */
- int ch; /* The Unicode character that the new
- * screen font must be able to display. */
- Tcl_DString *nameTriedPtr; /* Records face names that have already
- * been tried. It is possible for the same
- * face name to be queried multiple times when
+ const char *faceName, /* Desired face name for new screen font. */
+ int ch, /* The Unicode character that the new screen
+ * font must be able to display. */
+ Tcl_DString *nameTriedPtr, /* Records face names that have already been
+ * tried. It is possible for the same face
+ * name to be queried multiple times when
* trying to find a suitable screen font. */
- SubFont **fixSubFontPtrPtr; /* Subfont reference to fix up if we
+ SubFont **fixSubFontPtrPtr) /* Subfont reference to fix up if we
* reallocate our subfont table. */
{
SubFont *subFontPtr;
- char **aliases;
+ const char *const *aliases;
int i;
-
+
if (SeenName(faceName, nameTriedPtr) == 0) {
subFontPtr = CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr);
if (subFontPtr != NULL) {
@@ -2213,9 +2329,9 @@ CanUseFallbackWithAliases(fontPtr, faceName, ch, nameTriedPtr,
*
* SeenName --
*
- * Used to determine we have already tried and rejected the given
- * face name when looking for a screen font that can support some
- * Unicode character.
+ * Used to determine we have already tried and rejected the given face
+ * name when looking for a screen font that can support some Unicode
+ * character.
*
* Results:
* The return value is 0 if this face name has not already been seen,
@@ -2228,12 +2344,12 @@ CanUseFallbackWithAliases(fontPtr, faceName, ch, nameTriedPtr,
*/
static int
-SeenName(name, dsPtr)
- CONST char *name; /* The name to check. */
- Tcl_DString *dsPtr; /* Contains names that have already been
+SeenName(
+ const char *name, /* The name to check. */
+ Tcl_DString *dsPtr) /* Contains names that have already been
* seen. */
{
- CONST char *seen, *end;
+ const char *seen, *end;
seen = Tcl_DStringValue(dsPtr);
end = seen + Tcl_DStringLength(dsPtr);
@@ -2243,7 +2359,7 @@ SeenName(name, dsPtr)
}
seen += strlen(seen) + 1;
}
- Tcl_DStringAppend(dsPtr, (char *) name, (int) (strlen(name) + 1));
+ Tcl_DStringAppend(dsPtr, name, (int) (strlen(name) + 1));
return 0;
}
@@ -2252,69 +2368,65 @@ SeenName(name, dsPtr)
*
* CanUseFallback --
*
- * If the specified screen font has not already been loaded
- * into the font object, determine if the specified screen
- * font can display the given character.
+ * If the specified screen font has not already been loaded into the font
+ * object, determine if the specified screen font can display the given
+ * character.
*
* Results:
- * The return value is a pointer to a newly allocated SubFont,
- * owned by the font object. This SubFont can be used to display
- * the given character. The SubFont represents the screen font
- * with the base set of font attributes from the font object, but
- * using the specified face name. NULL is returned if the font
- * object already holds a reference to the specified font or if
- * the specified font doesn't exist or cannot display the given
- * character.
+ * The return value is a pointer to a newly allocated SubFont, owned by
+ * the font object. This SubFont can be used to display the given
+ * character. The SubFont represents the screen font with the base set of
+ * font attributes from the font object, but using the specified face
+ * name. NULL is returned if the font object already holds a reference to
+ * the specified font or if the specified font doesn't exist or cannot
+ * display the given character.
*
- * Side effects:
- * The font object's subFontArray is updated to contain a reference
- * to the newly allocated SubFont. The table of SubFonts might be
- * extended, and if a non-NULL reference to a subfont pointer is
- * available, it is updated if it previously pointed into the old
- * subfont table.
+ * Side effects:
+ * The font object's subFontArray is updated to contain a reference to
+ * the newly allocated SubFont. The table of SubFonts might be extended,
+ * and if a non-NULL reference to a subfont pointer is available, it is
+ * updated if it previously pointed into the old subfont table.
*
*-------------------------------------------------------------------------
*/
static SubFont *
-CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
- UnixFont *fontPtr; /* The font object that will own the new
+CanUseFallback(
+ UnixFont *fontPtr, /* The font object that will own the new
* screen font. */
- CONST char *faceName; /* Desired face name for new screen font. */
- int ch; /* The Unicode character that the new
- * screen font must be able to display. */
- SubFont **fixSubFontPtrPtr; /* Subfont reference to fix up if we
+ const char *faceName, /* Desired face name for new screen font. */
+ int ch, /* The Unicode character that the new screen
+ * font must be able to display. */
+ SubFont **fixSubFontPtrPtr) /* Subfont reference to fix up if we
* reallocate our subfont table. */
{
- int i, nameIdx, numNames, srcLen;
+ int i, nameIdx, numNames, srcLen, numEncodings, bestIdx[2];
Tk_Uid hateFoundry;
- int bestIdx[2];
- CONST char *charset, *hateCharset;
- unsigned int bestScore[2];
- char **nameList, **nameListOrig;
- FontAttributes want, got;
+ const char *charset, *hateCharset;
+ unsigned bestScore[2];
+ char **nameList;
+ char **nameListOrig;
char src[TCL_UTF_MAX];
+ FontAttributes want, got;
Display *display;
SubFont subFont;
XFontStruct *fontStructPtr;
Tcl_DString dsEncodings;
- int numEncodings;
Tcl_Encoding *encodingCachePtr;
/*
* Assume: the face name is times.
* Assume: adobe:times:iso8859-1 has already been used.
*
- * Are there any versions of times that can display this
- * character (e.g., perhaps linotype:times:iso8859-2)?
+ * Are there any versions of times that can display this character (e.g.,
+ * perhaps linotype:times:iso8859-2)?
* a. Get list of all times fonts.
* b1. Cross out all names whose encodings we've already used.
* b2. Cross out all names whose foundry & encoding we've already seen.
* c. Cross out all names whose encoding cannot handle the character.
* d. Rank each name and pick the best match.
- * e. If that font cannot actually display the character, cross
- * out all names with the same foundry and encoding and go
- * back to (c).
+ * e. If that font cannot actually display the character, cross out all
+ * names with the same foundry and encoding and go back to (c).
*/
display = fontPtr->display;
@@ -2339,17 +2451,17 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
charset = NULL; /* lint, since numNames must be > 0 to get here. */
- retry:
+ retry:
bestIdx[0] = -1;
bestIdx[1] = -1;
- bestScore[0] = (unsigned int) -1;
- bestScore[1] = (unsigned int) -1;
+ bestScore[0] = (unsigned) -1;
+ bestScore[1] = (unsigned) -1;
for (nameIdx = 0; nameIdx < numNames; nameIdx++) {
Tcl_Encoding encoding;
char dst[16];
int scalable, srcRead, dstWrote;
- unsigned int score;
-
+ unsigned score;
+
if (nameList[nameIdx] == NULL) {
continue;
}
@@ -2360,9 +2472,8 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
charset = GetEncodingAlias(got.xa.charset);
if (hateFoundry != NULL) {
/*
- * E. If the font we picked cannot actually display the
- * character, cross out all names with the same foundry and
- * encoding.
+ * E. If the font we picked cannot actually display the character,
+ * cross out all names with the same foundry and encoding.
*/
if ((hateFoundry == got.xa.foundry)
@@ -2373,7 +2484,7 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
/*
* B. Cross out all names whose encodings we've already used.
*/
-
+
for (i = 0; i < fontPtr->numSubFonts; i++) {
encoding = fontPtr->subFontArray[i].familyPtr->encoding;
if (strcmp(charset, Tcl_GetEncodingName(encoding)) == 0) {
@@ -2381,11 +2492,11 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
}
}
}
-
+
/*
* C. Cross out all names whose encoding cannot handle the character.
*/
-
+
encodingCachePtr = (Tcl_Encoding *) Tcl_DStringValue(&dsEncodings);
for (i = numEncodings; --i >= 0; encodingCachePtr++) {
encoding = *encodingCachePtr;
@@ -2403,8 +2514,8 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
sizeof(encoding));
numEncodings++;
}
- Tcl_UtfToExternal(NULL, encoding, src, srcLen,
- TCL_ENCODING_STOPONERROR, NULL, dst, sizeof(dst), &srcRead,
+ Tcl_UtfToExternal(NULL, encoding, src, srcLen,
+ TCL_ENCODING_STOPONERROR, NULL, dst, sizeof(dst), &srcRead,
&dstWrote, NULL);
if (dstWrote == 0) {
goto crossout;
@@ -2425,20 +2536,21 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
}
continue;
- crossout:
+ crossout:
if (nameList == nameListOrig) {
/*
- * Not allowed to change pointers to memory that X gives you,
- * so make a copy.
+ * Not allowed to change pointers to memory that X gives you, so
+ * make a copy.
*/
- nameList = (char **) ckalloc(numNames * sizeof(char *));
+ nameList = ckalloc(numNames * sizeof(char *));
memcpy(nameList, nameListOrig, numNames * sizeof(char *));
}
nameList[nameIdx] = NULL;
}
- fontStructPtr = GetScreenFont(display, &want, nameList, bestIdx, bestScore);
+ fontStructPtr = GetScreenFont(display, &want, nameList, bestIdx,
+ bestScore);
encodingCachePtr = (Tcl_Encoding *) Tcl_DStringValue(&dsEncodings);
for (i = numEncodings; --i >= 0; encodingCachePtr++) {
@@ -2449,7 +2561,7 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
if (fontStructPtr == NULL) {
if (nameList != nameListOrig) {
- ckfree((char *) nameList);
+ ckfree(nameList);
}
XFreeFontNames(nameListOrig);
return NULL;
@@ -2469,15 +2581,15 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
goto retry;
}
if (nameList != nameListOrig) {
- ckfree((char *) nameList);
+ ckfree(nameList);
}
XFreeFontNames(nameListOrig);
if (fontPtr->numSubFonts >= SUBFONT_SPACE) {
SubFont *newPtr;
-
- newPtr = (SubFont *) ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1));
- memcpy((char *) newPtr, fontPtr->subFontArray,
+
+ newPtr = ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1));
+ memcpy(newPtr, fontPtr->subFontArray,
fontPtr->numSubFonts * sizeof(SubFont));
if (fixSubFontPtrPtr != NULL) {
register SubFont *fixSubFontPtr = *fixSubFontPtrPtr;
@@ -2488,7 +2600,7 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
}
}
if (fontPtr->subFontArray != fontPtr->staticSubFonts) {
- ckfree((char *) fontPtr->subFontArray);
+ ckfree(fontPtr->subFontArray);
}
fontPtr->subFontArray = newPtr;
}
@@ -2502,12 +2614,12 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
*
* RankAttributes --
*
- * Determine how close the attributes of the font in question match
- * the attributes that we want.
+ * Determine how close the attributes of the font in question match the
+ * attributes that we want.
*
* Results:
- * The return value is the score; lower numbers are better.
- * *scalablePtr is set to 0 if the font was not scalable, 1 otherwise.
+ * The return value is the score; lower numbers are better. *scalablePtr
+ * is set to 0 if the font was not scalable, 1 otherwise.
*
* Side effects:
* None.
@@ -2515,12 +2627,12 @@ CanUseFallback(fontPtr, faceName, ch, fixSubFontPtrPtr)
*---------------------------------------------------------------------------
*/
-static unsigned int
-RankAttributes(wantPtr, gotPtr)
- FontAttributes *wantPtr; /* The desired attributes. */
- FontAttributes *gotPtr; /* The attributes we have to live with. */
+static unsigned
+RankAttributes(
+ FontAttributes *wantPtr, /* The desired attributes. */
+ FontAttributes *gotPtr) /* The attributes we have to live with. */
{
- unsigned int penalty;
+ unsigned penalty;
penalty = 0;
if (gotPtr->xa.foundry != wantPtr->xa.foundry) {
@@ -2544,8 +2656,8 @@ RankAttributes(wantPtr, gotPtr)
if (gotPtr->fa.size == 0) {
/*
- * A scalable font is almost always acceptable, but the
- * corresponding bitmapped font would be better.
+ * A scalable font is almost always acceptable, but the corresponding
+ * bitmapped font would be better.
*/
penalty += 10;
@@ -2555,7 +2667,7 @@ RankAttributes(wantPtr, gotPtr)
/*
* It's worse to be too large than to be too small.
*/
-
+
diff = (-gotPtr->fa.size - -wantPtr->fa.size);
if (diff > 0) {
penalty += 600;
@@ -2567,11 +2679,11 @@ RankAttributes(wantPtr, gotPtr)
}
if (gotPtr->xa.charset != wantPtr->xa.charset) {
int i;
- CONST char *gotAlias, *wantAlias;
+ const char *gotAlias, *wantAlias;
penalty += 65000;
gotAlias = GetEncodingAlias(gotPtr->xa.charset);
- wantAlias = GetEncodingAlias(wantPtr->xa.charset);
+ wantAlias = GetEncodingAlias(wantPtr->xa.charset);
if (strcmp(gotAlias, wantAlias) != 0) {
penalty += 30000;
for (i = 0; encodingList[i] != NULL; i++) {
@@ -2592,9 +2704,8 @@ RankAttributes(wantPtr, gotPtr)
* GetScreenFont --
*
* Given the names for the best scalable and best bitmapped font,
- * actually construct an XFontStruct based on the best XLFD.
- * This is where all the alias and fallback substitution bottoms
- * out.
+ * actually construct an XFontStruct based on the best XLFD. This is
+ * where all the alias and fallback substitution bottoms out.
*
* Results:
* The screen font that best corresponds to the set of attributes.
@@ -2606,16 +2717,16 @@ RankAttributes(wantPtr, gotPtr)
*/
static XFontStruct *
-GetScreenFont(display, wantPtr, nameList, bestIdx, bestScore)
- Display *display; /* Display for new XFontStruct. */
- FontAttributes *wantPtr; /* Contains desired actual pixel-size if the
+GetScreenFont(
+ Display *display, /* Display for new XFontStruct. */
+ FontAttributes *wantPtr, /* Contains desired actual pixel-size if the
* best font was scalable. */
- char **nameList; /* Array of XLFDs. */
- int bestIdx[2]; /* Indices into above array for XLFD of
- * best bitmapped and best scalable font. */
- unsigned int bestScore[2]; /* Scores of best bitmapped and best
- * scalable font. XLFD corresponding to
- * lowest score will be constructed. */
+ char **nameList, /* Array of XLFDs. */
+ int bestIdx[2], /* Indices into above array for XLFD of best
+ * bitmapped and best scalable font. */
+ unsigned bestScore[2]) /* Scores of best bitmapped and best scalable
+ * font. XLFD corresponding to lowest score
+ * will be constructed. */
{
XFontStruct *fontStructPtr;
@@ -2624,24 +2735,23 @@ GetScreenFont(display, wantPtr, nameList, bestIdx, bestScore)
}
/*
- * Now we know which is the closest matching scalable font and the
- * closest matching bitmapped font. If the scalable font was a
- * better match, try getting the scalable font; however, if the
- * scalable font was not actually available in the desired
- * pointsize, fall back to the closest bitmapped font.
+ * Now we know which is the closest matching scalable font and the closest
+ * matching bitmapped font. If the scalable font was a better match, try
+ * getting the scalable font; however, if the scalable font was not
+ * actually available in the desired pointsize, fall back to the closest
+ * bitmapped font.
*/
fontStructPtr = NULL;
if (bestScore[1] < bestScore[0]) {
- char *str, *rest;
- char buf[256];
+ char *str, *rest, buf[256];
int i;
-
+
/*
* Fill in the desired pixel size for this font.
*/
- tryscale:
+ tryscale:
str = nameList[bestIdx[1]];
for (i = 0; i < XLFD_PIXEL_SIZE; i++) {
str = strchr(str + 1, '-');
@@ -2661,8 +2771,8 @@ GetScreenFont(display, wantPtr, nameList, bestIdx, bestScore)
fontStructPtr = XLoadQueryFont(display, nameList[bestIdx[0]]);
if (fontStructPtr == NULL) {
/*
- * This shouldn't happen because the font name is one of the
- * names that X gave us to use, but it does anyhow.
+ * This shouldn't happen because the font name is one of the names
+ * that X gave us to use, but it does anyhow.
*/
if (bestScore[1] < INT_MAX) {
@@ -2679,22 +2789,22 @@ GetScreenFont(display, wantPtr, nameList, bestIdx, bestScore)
*
* GetSystemFont --
*
- * Absolute fallback mechanism, called when we need a font and no
- * other font can be found and/or instantiated.
+ * Absolute fallback mechanism, called when we need a font and no other
+ * font can be found and/or instantiated.
*
* Results:
- * A pointer to a font. Never NULL.
+ * A pointer to a font. Never NULL.
*
* Side effects:
- * If there are NO fonts installed on the system, this call will
- * panic, but how did you get X running in that case?
+ * If there are NO fonts installed on the system, this call will panic,
+ * but how did you get X running in that case?
*
*---------------------------------------------------------------------------
*/
static XFontStruct *
-GetSystemFont(display)
- Display *display; /* Display for new XFontStruct. */
+GetSystemFont(
+ Display *display) /* Display for new XFontStruct. */
{
XFontStruct *fontStructPtr;
@@ -2702,7 +2812,7 @@ GetSystemFont(display)
if (fontStructPtr == NULL) {
fontStructPtr = XLoadQueryFont(display, "*");
if (fontStructPtr == NULL) {
- panic("TkpGetFontFromAttributes: cannot get any font");
+ Tcl_Panic("TkpGetFontFromAttributes: cannot get any font");
}
}
return fontStructPtr;
@@ -2713,8 +2823,8 @@ GetSystemFont(display)
*
* GetFontAttributes --
*
- * Given a screen font, determine its actual attributes, which are
- * not necessarily the attributes that were used to construct it.
+ * Given a screen font, determine its actual attributes, which are not
+ * necessarily the attributes that were used to construct it.
*
* Results:
* *faPtr is filled with the screen font's attributes.
@@ -2726,14 +2836,14 @@ GetSystemFont(display)
*/
static int
-GetFontAttributes(display, fontStructPtr, faPtr)
- Display *display; /* Display that owns the screen font. */
- XFontStruct *fontStructPtr; /* Screen font to query. */
- FontAttributes *faPtr; /* For storing attributes of screen font. */
+GetFontAttributes(
+ Display *display, /* Display that owns the screen font. */
+ XFontStruct *fontStructPtr, /* Screen font to query. */
+ FontAttributes *faPtr) /* For storing attributes of screen font. */
{
unsigned long value;
char *name;
-
+
if ((XGetFontProperty(fontStructPtr, XA_FONT, &value) != False) &&
(value != 0)) {
name = XGetAtomName(display, (Atom) value);
@@ -2747,11 +2857,13 @@ GetFontAttributes(display, fontStructPtr, faPtr)
TkInitFontAttributes(&faPtr->fa);
TkInitXLFDAttributes(&faPtr->xa);
}
+
/*
- * Do last ditch check for family. It seems that some X servers can
- * fail on the X font calls above, slipping through earlier checks.
- * X-Win32 5.4 is one of these.
+ * Do last ditch check for family. It seems that some X servers can fail
+ * on the X font calls above, slipping through earlier checks. X-Win32 5.4
+ * is one of these.
*/
+
if (faPtr->fa.family == NULL) {
faPtr->fa.family = Tk_GetUid("");
faPtr->xa.foundry = Tk_GetUid("");
@@ -2765,8 +2877,8 @@ GetFontAttributes(display, fontStructPtr, faPtr)
*
* ListFonts --
*
- * Utility function to return the array of all XLFDs on the system
- * with the specified face name.
+ * Utility function to return the array of all XLFDs on the system with
+ * the specified face name.
*
* Results:
* The return value is an array of XLFDs, which should be freed with
@@ -2777,13 +2889,13 @@ GetFontAttributes(display, fontStructPtr, faPtr)
*
*---------------------------------------------------------------------------
*/
-
+
static char **
-ListFonts(display, faceName, numNamesPtr)
- Display *display; /* Display to query. */
- CONST char *faceName; /* Desired face name, or "*" for all. */
- int *numNamesPtr; /* Filled with length of returned array, or
- * 0 if no names were found. */
+ListFonts(
+ Display *display, /* Display to query. */
+ const char *faceName, /* Desired face name, or "*" for all. */
+ int *numNamesPtr) /* Filled with length of returned array, or 0
+ * if no names were found. */
{
char buf[256];
@@ -2792,15 +2904,16 @@ ListFonts(display, faceName, numNamesPtr)
}
static char **
-ListFontOrAlias(display, faceName, numNamesPtr)
- Display *display; /* Display to query. */
- CONST char *faceName; /* Desired face name, or "*" for all. */
- int *numNamesPtr; /* Filled with length of returned array, or
- * 0 if no names were found. */
+ListFontOrAlias(
+ Display *display, /* Display to query. */
+ const char *faceName, /* Desired face name, or "*" for all. */
+ int *numNamesPtr) /* Filled with length of returned array, or 0
+ * if no names were found. */
{
- char **nameList, **aliases;
+ char **nameList;
+ const char *const *aliases;
int i;
-
+
nameList = ListFonts(display, faceName, numNamesPtr);
if (nameList != NULL) {
return nameList;
@@ -2823,19 +2936,18 @@ ListFontOrAlias(display, faceName, numNamesPtr)
*
* IdentifySymbolEncodings --
*
- * If the font attributes refer to a symbol font, update the
- * charset field of the font attributes so that it reflects the
- * encoding of that symbol font. In general, the raw value for
- * the charset field parsed from an XLFD is meaningless for symbol
- * fonts.
+ * If the font attributes refer to a symbol font, update the charset
+ * field of the font attributes so that it reflects the encoding of that
+ * symbol font. In general, the raw value for the charset field parsed
+ * from an XLFD is meaningless for symbol fonts.
*
* Symbol fonts are all fonts whose name appears in the symbolClass.
*
* Results:
- * The return value is non-zero if the font attributes specify a
- * symbol font, or 0 otherwise. If a non-zero value is returned
- * the charset field of the font attributes will be changed to
- * the string that represents the actual encoding for the symbol font.
+ * The return value is non-zero if the font attributes specify a symbol
+ * font, or 0 otherwise. If a non-zero value is returned the charset
+ * field of the font attributes will be changed to the string that
+ * represents the actual encoding for the symbol font.
*
* Side effects:
* None.
@@ -2844,11 +2956,12 @@ ListFontOrAlias(display, faceName, numNamesPtr)
*/
static int
-IdentifySymbolEncodings(faPtr)
- FontAttributes *faPtr;
+IdentifySymbolEncodings(
+ FontAttributes *faPtr)
{
int i, j;
- char **aliases, **symbolClass;
+ const char *const *aliases;
+ const char *const *symbolClass;
symbolClass = TkFontGetSymbolClass();
for (i = 0; symbolClass[i] != NULL; i++) {
@@ -2872,14 +2985,14 @@ IdentifySymbolEncodings(faPtr)
*
* GetEncodingAlias --
*
- * Map the name of an encoding to another name that should be used
- * when actually loading the encoding. For instance, the encodings
- * "jisc6226.1978", "jisx0208.1983", "jisx0208.1990", and
- * "jisx0208.1996" are well-known names for the same encoding and
- * are represented by one encoding table: "jis0208".
+ * Map the name of an encoding to another name that should be used when
+ * actually loading the encoding. For instance, the encodings
+ * "jisc6226.1978", "jisx0208.1983", "jisx0208.1990", and "jisx0208.1996"
+ * are well-known names for the same encoding and are represented by one
+ * encoding table: "jis0208".
*
* Results:
- * As above. If the name has no alias, the original name is returned.
+ * As above. If the name has no alias, the original name is returned.
*
* Side effects:
* None.
@@ -2887,17 +3000,324 @@ IdentifySymbolEncodings(faPtr)
*---------------------------------------------------------------------------
*/
-static CONST char *
-GetEncodingAlias(name)
- CONST char *name; /* The name to look up. */
+static const char *
+GetEncodingAlias(
+ const char *name) /* The name to look up. */
{
EncodingAlias *aliasPtr;
-
+
for (aliasPtr = encodingAliases; aliasPtr->aliasPattern != NULL; ) {
- if (Tcl_StringMatch((char *) name, aliasPtr->aliasPattern)) {
+ if (Tcl_StringMatch(name, aliasPtr->aliasPattern)) {
return aliasPtr->realName;
}
aliasPtr++;
}
return name;
}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkDrawAngledChars --
+ *
+ * Draw some characters at an angle. This is awkward here because we have
+ * no reliable way of drawing any characters at an angle in classic X11;
+ * we have to draw on a Pixmap which is converted to an XImage (from
+ * helper function GetImageOfText), rotate the image (hokey code!) onto
+ * another XImage (from helper function InitDestImage), and then use the
+ * rotated image as a mask when drawing. This is pretty awful; improved
+ * versions are welcomed!
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Target drawable is updated.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static inline XImage *
+GetImageOfText(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ Tk_Font tkfont, /* Font in which characters will be drawn. */
+ const char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. All Tk meta-characters
+ * (tabs, control characters, and newlines)
+ * should be stripped out of the string that
+ * 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. */
+ int *realWidthPtr, int *realHeightPtr)
+{
+ int width, height;
+ TkFont *fontPtr = (TkFont *) tkfont;
+ Pixmap bitmap;
+ GC bitmapGC;
+ XGCValues values;
+ XImage *image;
+
+ (void) Tk_MeasureChars(tkfont, source, numBytes, -1, 0, &width);
+ height = fontPtr->fm.ascent + fontPtr->fm.descent;
+
+ bitmap = Tk_GetPixmap(display, drawable, width, height, 1);
+ values.graphics_exposures = False;
+ values.foreground = BlackPixel(display, DefaultScreen(display));
+ bitmapGC = XCreateGC(display, bitmap, GCGraphicsExposures|GCForeground,
+ &values);
+ XFillRectangle(display, bitmap, bitmapGC, 0, 0, width, height);
+
+ values.font = Tk_FontId(tkfont);
+ values.foreground = WhitePixel(display, DefaultScreen(display));
+ values.background = BlackPixel(display, DefaultScreen(display));
+ XChangeGC(display, bitmapGC, GCFont|GCForeground|GCBackground, &values);
+ Tk_DrawChars(display, bitmap, bitmapGC, tkfont, source, numBytes, 0,
+ fontPtr->fm.ascent);
+ XFreeGC(display, bitmapGC);
+
+ image = XGetImage(display, bitmap, 0, 0, width, height, AllPlanes,
+ ZPixmap);
+ Tk_FreePixmap(display, bitmap);
+
+ *realWidthPtr = width;
+ *realHeightPtr = height;
+ return image;
+}
+
+static inline XImage *
+InitDestImage(
+ Display *display,
+ Drawable drawable,
+ int width,
+ int height,
+ Pixmap *bitmapPtr)
+{
+ Pixmap bitmap;
+ XImage *image;
+ GC bitmapGC;
+ XGCValues values;
+
+ bitmap = Tk_GetPixmap(display, drawable, width, height, 1);
+ values.graphics_exposures = False;
+ values.foreground = BlackPixel(display, DefaultScreen(display));
+ bitmapGC = XCreateGC(display, bitmap, GCGraphicsExposures|GCForeground,
+ &values);
+ XFillRectangle(display, bitmap, bitmapGC, 0, 0, width, height);
+ XFreeGC(display, bitmapGC);
+
+ image = XGetImage(display, bitmap, 0, 0, width, height, AllPlanes,
+ ZPixmap);
+ *bitmapPtr = bitmap;
+ return image;
+}
+
+void
+TkDrawAngledChars(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ GC gc, /* Graphics context for drawing characters. */
+ Tk_Font tkfont, /* Font in which characters will be drawn;
+ * must be the same as font used in GC. */
+ const char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. All Tk meta-characters
+ * (tabs, control characters, and newlines)
+ * should be stripped out of the string that
+ * 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. */
+ double x, double y,
+ double angle)
+{
+ if (angle == 0.0) {
+ Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y);
+ } else {
+ double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0);
+ int bufHeight, bufWidth, srcWidth, srcHeight, i, j, dx, dy;
+ Pixmap buf;
+ XImage *srcImage = GetImageOfText(display, drawable, tkfont, source,
+ numBytes, &srcWidth, &srcHeight);
+ XImage *dstImage;
+ enum {Q0=1,R1,Q1,R2,Q2,R3,Q3} quadrant;
+ GC bwgc, cpgc;
+ XGCValues values;
+ int ascent = ((TkFont *) tkfont)->fm.ascent;
+
+ /*
+ * First, work out what quadrant we are operating in. We also handle
+ * the rectilinear rotations as special cases. Conceptually, there's
+ * also R0 (angle == 0.0) but that has been already handled as a
+ * special case above.
+ *
+ * R1
+ * Q1 | Q0
+ * |
+ * R2 ----+---- R0
+ * |
+ * Q2 | Q3
+ * R3
+ */
+
+ if (angle < 90.0) {
+ quadrant = Q0;
+ } else if (angle == 90.0) {
+ quadrant = R1;
+ } else if (angle < 180.0) {
+ quadrant = Q1;
+ } else if (angle == 180.0) {
+ quadrant = R2;
+ } else if (angle < 270.0) {
+ quadrant = Q2;
+ } else if (angle == 270.0) {
+ quadrant = R3;
+ } else {
+ quadrant = Q3;
+ }
+
+ if (srcImage == NULL) {
+ return;
+ }
+ bufWidth = srcWidth*fabs(cosA) + srcHeight*fabs(sinA);
+ bufHeight = srcHeight*fabs(cosA) + srcWidth*fabs(sinA);
+ dstImage = InitDestImage(display, drawable, bufWidth,bufHeight, &buf);
+ if (dstImage == NULL) {
+ Tk_FreePixmap(display, buf);
+ XDestroyImage(srcImage);
+ return;
+ }
+
+ /*
+ * Do the rotation, setting or resetting pixels in the destination
+ * image dependent on whether the corresponding pixel (after rotation
+ * to source image space) is set.
+ */
+
+ for (i=0 ; i<srcWidth ; i++) {
+ for (j=0 ; j<srcHeight ; j++) {
+ switch (quadrant) {
+ case Q0:
+ dx = ROUND16(i*cosA + j*sinA);
+ dy = ROUND16(j*cosA + (srcWidth - i)*sinA);
+ break;
+ case R1:
+ dx = j;
+ dy = srcWidth - i;
+ break;
+ case Q1:
+ dx = ROUND16((i - srcWidth)*cosA + j*sinA);
+ dy = ROUND16((srcWidth-i)*sinA + (j-srcHeight)*cosA);
+ break;
+ case R2:
+ dx = srcWidth - i;
+ dy = srcHeight - j;
+ break;
+ case Q2:
+ dx = ROUND16((i-srcWidth)*cosA + (j-srcHeight)*sinA);
+ dy = ROUND16((j - srcHeight)*cosA - i*sinA);
+ break;
+ case R3:
+ dx = srcHeight - j;
+ dy = i;
+ break;
+ default:
+ dx = ROUND16(i*cosA + (j - srcHeight)*sinA);
+ dy = ROUND16(j*cosA - i*sinA);
+ }
+
+ if (dx < 0 || dy < 0 || dx >= bufWidth || dy >= bufHeight) {
+ continue;
+ }
+ XPutPixel(dstImage, dx, dy,
+ XGetPixel(dstImage,dx,dy) | XGetPixel(srcImage,i,j));
+ }
+ }
+ XDestroyImage(srcImage);
+
+ /*
+ * Schlep the data back to the Xserver.
+ */
+
+ values.function = GXcopy;
+ values.foreground = WhitePixel(display, DefaultScreen(display));
+ values.background = BlackPixel(display, DefaultScreen(display));
+ bwgc = XCreateGC(display, buf, GCFunction|GCForeground|GCBackground,
+ &values);
+ XPutImage(display, buf, bwgc, dstImage, 0,0, 0,0, bufWidth,bufHeight);
+ XFreeGC(display, bwgc);
+ XDestroyImage(dstImage);
+
+ /*
+ * Calculate where we want to draw the text.
+ */
+
+ switch (quadrant) {
+ case Q0:
+ dx = x;
+ dy = y - srcWidth*sinA;
+ break;
+ case R1:
+ dx = x;
+ dy = y - srcWidth;
+ break;
+ case Q1:
+ dx = x + srcWidth*cosA;
+ dy = y + srcHeight*cosA - srcWidth*sinA;
+ break;
+ case R2:
+ dx = x - srcWidth;
+ dy = y - srcHeight;
+ break;
+ case Q2:
+ dx = x + srcWidth*cosA + srcHeight*sinA;
+ dy = y + srcHeight*cosA;
+ break;
+ case R3:
+ dx = x - srcHeight;
+ dy = y;
+ break;
+ default:
+ dx = x + srcHeight*sinA;
+ dy = y;
+ }
+
+ /*
+ * Apply a correction to deal with the fact that we aren't told to
+ * draw from our top-left corner but rather from the left-end of our
+ * baseline.
+ */
+
+ dx -= ascent*sinA;
+ dy -= ascent*cosA;
+
+ /*
+ * Transfer the text to the screen. This is done by using it as a mask
+ * and then drawing through that mask with the original drawing color.
+ */
+
+ values.function = GXcopy;
+ values.fill_style = FillSolid;
+ values.clip_mask = buf;
+ values.clip_x_origin = dx;
+ values.clip_y_origin = dy;
+ cpgc = XCreateGC(display, drawable,
+ GCFunction|GCFillStyle|GCClipMask|GCClipXOrigin|GCClipYOrigin,
+ &values);
+ XCopyGC(display, gc, GCForeground, cpgc);
+ XFillRectangle(display, drawable, cpgc, dx, dy, bufWidth,
+ bufHeight);
+ XFreeGC(display, cpgc);
+
+ Tk_FreePixmap(display, buf);
+ return;
+ }
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixInit.c b/unix/tkUnixInit.c
index 1b1b4ab..494c227 100644
--- a/unix/tkUnixInit.c
+++ b/unix/tkUnixInit.c
@@ -1,29 +1,21 @@
-/*
+/*
* tkUnixInit.c --
*
- * This file contains Unix-specific interpreter initialization
- * functions.
+ * This file contains Unix-specific interpreter initialization functions.
*
* Copyright (c) 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.
+ * 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 "tkUnixInt.h"
-/*
- * The Init script (common to Windows and Unix platforms) is
- * defined in tkInitScript.h
- */
-#include "tkInitScript.h"
-
#ifdef HAVE_COREFOUNDATION
-static int MacOSXGetLibraryPath _ANSI_ARGS_((
- Tcl_Interp *interp));
+static int GetLibraryPath(Tcl_Interp *interp);
+#else
+#define GetLibraryPath(dummy) (void)0
#endif /* HAVE_COREFOUNDATION */
-
/*
*----------------------------------------------------------------------
@@ -34,8 +26,8 @@ static int MacOSXGetLibraryPath _ANSI_ARGS_((
* tk_library variable.
*
* Results:
- * Returns a standard Tcl result. Leaves an error message or result
- * in the interp's result.
+ * Returns a standard Tcl result. Leaves an error message or result in
+ * the interp's result.
*
* Side effects:
* Sets "tk_library" Tcl variable, runs "tk.tcl" script.
@@ -44,14 +36,12 @@ static int MacOSXGetLibraryPath _ANSI_ARGS_((
*/
int
-TkpInit(interp)
- Tcl_Interp *interp;
+TkpInit(
+ Tcl_Interp *interp)
{
TkCreateXEventSource();
-#ifdef HAVE_COREFOUNDATION
- MacOSXGetLibraryPath(interp);
-#endif /* HAVE_COREFOUNDATION */
- return Tcl_Eval(interp, initScript);
+ GetLibraryPath(interp);
+ return TCL_OK;
}
/*
@@ -59,9 +49,9 @@ TkpInit(interp)
*
* TkpGetAppName --
*
- * Retrieves the name of the current application from a platform
- * specific location. For Unix, the application name is the tail
- * of the path contained in the tcl variable argv0.
+ * Retrieves the name of the current application from a platform specific
+ * location. For Unix, the application name is the tail of the path
+ * contained in the tcl variable argv0.
*
* Results:
* Returns the application name in the given Tcl_DString.
@@ -73,11 +63,11 @@ TkpInit(interp)
*/
void
-TkpGetAppName(interp, namePtr)
- Tcl_Interp *interp;
- Tcl_DString *namePtr; /* A previously initialized Tcl_DString. */
+TkpGetAppName(
+ Tcl_Interp *interp,
+ Tcl_DString *namePtr) /* A previously initialized Tcl_DString. */
{
- CONST char *p, *name;
+ const char *p, *name;
name = Tcl_GetVar(interp, "argv0", TCL_GLOBAL_ONLY);
if ((name == NULL) || (*name == 0)) {
@@ -96,8 +86,8 @@ TkpGetAppName(interp, namePtr)
*
* TkpDisplayWarning --
*
- * This routines is called from Tk_Main to display warning
- * messages that occur during startup.
+ * This routines is called from Tk_Main to display warning messages that
+ * occur during startup.
*
* Results:
* None.
@@ -109,11 +99,12 @@ TkpGetAppName(interp, namePtr)
*/
void
-TkpDisplayWarning(msg, title)
- CONST char *msg; /* Message to be displayed. */
- CONST char *title; /* Title of warning. */
+TkpDisplayWarning(
+ const char *msg, /* Message to be displayed. */
+ const char *title) /* Title of warning. */
{
Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
+
if (errChannel) {
Tcl_WriteChars(errChannel, title, -1);
Tcl_WriteChars(errChannel, ": ", 2);
@@ -122,14 +113,15 @@ TkpDisplayWarning(msg, title)
}
}
+#ifdef HAVE_COREFOUNDATION
+
/*
*----------------------------------------------------------------------
*
- * MacOSXGetLibraryPath --
+ * GetLibraryPath --
*
- * If we have a bundle structure for the Tk installation,
- * then check there first to see if we can find the libraries
- * there.
+ * If we have a bundle structure for the Tk installation, then check
+ * there first to see if we can find the libraries there.
*
* Results:
* TCL_OK if we have found the tk library; TCL_ERROR otherwise.
@@ -140,19 +132,31 @@ TkpDisplayWarning(msg, title)
*----------------------------------------------------------------------
*/
-#ifdef HAVE_COREFOUNDATION
static int
-MacOSXGetLibraryPath(Tcl_Interp *interp)
+GetLibraryPath(
+ Tcl_Interp *interp)
{
- int foundInFramework = TCL_ERROR;
#ifdef TK_FRAMEWORK
+ int foundInFramework = TCL_ERROR;
char tkLibPath[PATH_MAX + 1];
- foundInFramework = Tcl_MacOSXOpenVersionedBundleResources(interp,
- "com.tcltk.tklibrary", TK_FRAMEWORK_VERSION, 0, PATH_MAX, tkLibPath);
+
+ foundInFramework = Tcl_MacOSXOpenVersionedBundleResources(interp,
+ "com.tcltk.tklibrary", TK_FRAMEWORK_VERSION, 0, PATH_MAX,
+ tkLibPath);
if (tkLibPath[0] != '\0') {
Tcl_SetVar(interp, "tk_library", tkLibPath, TCL_GLOBAL_ONLY);
}
-#endif
return foundInFramework;
+#else
+ return TCL_ERROR;
+#endif
}
#endif /* HAVE_COREFOUNDATION */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixInt.h b/unix/tkUnixInt.h
index f5bd910..805f314 100644
--- a/unix/tkUnixInt.h
+++ b/unix/tkUnixInt.h
@@ -2,13 +2,12 @@
* tkUnixInt.h --
*
* This file contains declarations that are shared among the
- * UNIX-specific parts of Tk but aren't used by the rest of
- * Tk.
+ * UNIX-specific parts of Tk but aren't used by the rest of Tk.
*
* Copyright (c) 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.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _TKUNIXINT
@@ -19,9 +18,18 @@
#endif
/*
- * Prototypes for procedures that are referenced in files other
- * than the ones they're defined in.
+ * Prototypes for procedures that are referenced in files other than the ones
+ * they're defined in.
*/
+
#include "tkIntPlatDecls.h"
#endif /* _TKUNIXINT */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c
index 8753fdb..7461d75 100644
--- a/unix/tkUnixKey.c
+++ b/unix/tkUnixKey.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkUnixKey.c --
*
* This file contains routines for dealing with international keyboard
@@ -6,53 +6,69 @@
*
* Copyright (c) 1997 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
/*
- * Prototypes for local procedures defined in this file:
+ * Prototypes for local functions defined in this file:
*/
-
/*
*----------------------------------------------------------------------
*
* Tk_SetCaretPos --
*
- * This enables correct placement of the XIM caret. This is called
- * by widgets to indicate their cursor placement, and the caret
- * location is used by TkpGetString to place the XIM caret.
- * This is currently only used for over-the-spot XIM.
- *
- * Results:
- * None
- *
- * Side effects:
- * None
+ * This enables correct placement of the XIM caret. This is called by
+ * widgets to indicate their cursor placement. This is currently only
+ * used for over-the-spot XIM.
*
*----------------------------------------------------------------------
*/
void
-Tk_SetCaretPos(tkwin, x, y, height)
- Tk_Window tkwin;
- int x;
- int y;
- int height;
+Tk_SetCaretPos(
+ Tk_Window tkwin,
+ int x,
+ int y,
+ int height)
{
- TkCaret *caretPtr = &(((TkWindow *) tkwin)->dispPtr->caret);
+ TkWindow *winPtr = (TkWindow *) tkwin;
+ TkDisplay *dispPtr = winPtr->dispPtr;
+
+ if ((dispPtr->caret.winPtr == winPtr)
+ && (dispPtr->caret.x == x)
+ && (dispPtr->caret.y == y)
+ && (dispPtr->caret.height == height)) {
+ return;
+ }
+
+ dispPtr->caret.winPtr = winPtr;
+ dispPtr->caret.x = x;
+ dispPtr->caret.y = y;
+ dispPtr->caret.height = height;
/*
- * Use height for best placement of the XIM over-the-spot box.
+ * Adjust the XIM caret position.
*/
- caretPtr->winPtr = ((TkWindow *) tkwin);
- caretPtr->x = x;
- caretPtr->y = y;
- caretPtr->height = height;
+#ifdef TK_USE_INPUT_METHODS
+ if ((dispPtr->flags & TK_DISPLAY_USE_IM)
+ && (dispPtr->inputStyle & XIMPreeditPosition)
+ && (winPtr->inputContext != NULL)) {
+ XVaNestedList preedit_attr;
+ XPoint spot;
+
+ spot.x = dispPtr->caret.x;
+ spot.y = dispPtr->caret.y + dispPtr->caret.height;
+ preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, (void *) NULL);
+ XSetICValues(winPtr->inputContext, XNPreeditAttributes, preedit_attr,
+ (void *) NULL);
+ XFree(preedit_attr);
+ }
+#endif
}
/*
@@ -66,47 +82,71 @@ Tk_SetCaretPos(tkwin, x, y, height)
* Returns the UTF string.
*
* Side effects:
- * Stores the input string in the specified Tcl_DString. Modifies
- * the internal input state. This routine can only be called
- * once for a given event.
+ * Stores the input string in the specified Tcl_DString. Modifies the
+ * internal input state. This routine can only be called once for a given
+ * event.
*
*----------------------------------------------------------------------
*/
-char *
-TkpGetString(winPtr, eventPtr, dsPtr)
- TkWindow *winPtr; /* Window where event occurred: needed to
- * get input context. */
- XEvent *eventPtr; /* X keyboard event. */
- Tcl_DString *dsPtr; /* Uninitialized or empty string to hold
- * result. */
+const char *
+TkpGetString(
+ TkWindow *winPtr, /* Window where event occurred */
+ XEvent *eventPtr, /* X keyboard event. */
+ Tcl_DString *dsPtr) /* Initialized, empty string to hold result. */
{
int len;
Tcl_DString buf;
- Status status;
-#ifdef TK_USE_INPUT_METHODS
- TkDisplay *dispPtr = winPtr->dispPtr;
-#endif
+ TkKeyEvent *kePtr = (TkKeyEvent *) eventPtr;
/*
- * Overallocate the dstring to the maximum stack amount.
+ * If we have the value cached already, use it now. [Bug 1373712]
*/
- Tcl_DStringInit(&buf);
- Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1);
+ if (kePtr->charValuePtr != NULL) {
+ Tcl_DStringSetLength(dsPtr, kePtr->charValueLen);
+ memcpy(Tcl_DStringValue(dsPtr), kePtr->charValuePtr,
+ (unsigned) kePtr->charValueLen+1);
+ return Tcl_DStringValue(dsPtr);
+ }
#ifdef TK_USE_INPUT_METHODS
- if ((dispPtr->flags & TK_DISPLAY_USE_IM)
+ if ((winPtr->dispPtr->flags & TK_DISPLAY_USE_IM)
&& (winPtr->inputContext != NULL)
&& (eventPtr->type == KeyPress)) {
-#if TK_XIM_SPOT
- XVaNestedList preedit_attr;
- XPoint spot;
-#endif
+ Status status;
+
+#if X_HAVE_UTF8_STRING
+ Tcl_DStringSetLength(dsPtr, TCL_DSTRING_STATIC_SIZE-1);
+ len = Xutf8LookupString(winPtr->inputContext, &eventPtr->xkey,
+ Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr),
+ &kePtr->keysym, &status);
+ if (status == XBufferOverflow) {
+ /*
+ * Expand buffer and try again.
+ */
+
+ Tcl_DStringSetLength(dsPtr, len);
+ len = Xutf8LookupString(winPtr->inputContext, &eventPtr->xkey,
+ Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr),
+ &kePtr->keysym, &status);
+ }
+ if ((status != XLookupChars) && (status != XLookupBoth)) {
+ len = 0;
+ }
+ Tcl_DStringSetLength(dsPtr, len);
+#else /* !X_HAVE_UTF8_STRING */
+ /*
+ * Overallocate the dstring to the maximum stack amount.
+ */
+
+ Tcl_DStringInit(&buf);
+ Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1);
len = XmbLookupString(winPtr->inputContext, &eventPtr->xkey,
- Tcl_DStringValue(&buf), Tcl_DStringLength(&buf),
- (KeySym *) NULL, &status);
+ Tcl_DStringValue(&buf), Tcl_DStringLength(&buf),
+ &kePtr->keysym, &status);
+
/*
* If the buffer wasn't big enough, grow the buffer and try again.
*/
@@ -114,82 +154,93 @@ TkpGetString(winPtr, eventPtr, dsPtr)
if (status == XBufferOverflow) {
Tcl_DStringSetLength(&buf, len);
len = XmbLookupString(winPtr->inputContext, &eventPtr->xkey,
- Tcl_DStringValue(&buf), len, (KeySym *) NULL, &status);
+ Tcl_DStringValue(&buf), len, &kePtr->keysym, &status);
}
if ((status != XLookupChars) && (status != XLookupBoth)) {
len = 0;
}
-
-#if TK_XIM_SPOT
+ Tcl_DStringSetLength(&buf, len);
+ Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&buf), len, dsPtr);
+ Tcl_DStringFree(&buf);
+#endif /* X_HAVE_UTF8_STRING */
+ } else
+#endif /* TK_USE_INPUT_METHODS */
+ {
/*
- * Adjust the XIM caret position. We might want to check that
- * this is the right caret.winPtr as well.
+ * Fall back to convert a keyboard event to a UTF-8 string using
+ * XLookupString. This is used when input methods are turned off and
+ * for KeyRelease events.
+ *
+ * Note: XLookupString() normally returns a single ISO Latin 1 or
+ * ASCII control character.
*/
- if (dispPtr->flags & TK_DISPLAY_XIM_SPOT) {
- spot.x = dispPtr->caret.x;
- spot.y = dispPtr->caret.y + dispPtr->caret.height;
- preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);
- XSetICValues(winPtr->inputContext,
- XNPreeditAttributes, preedit_attr, NULL);
- XFree(preedit_attr);
- }
-#endif
- } else {
+
+ Tcl_DStringInit(&buf);
+ Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1);
len = XLookupString(&eventPtr->xkey, Tcl_DStringValue(&buf),
- Tcl_DStringLength(&buf), (KeySym *) NULL,
- (XComposeStatus *) NULL);
+ TCL_DSTRING_STATIC_SIZE, &kePtr->keysym, 0);
+ Tcl_DStringValue(&buf)[len] = '\0';
+
+ if (len == 1) {
+ len = Tcl_UniCharToUtf((unsigned char) Tcl_DStringValue(&buf)[0],
+ Tcl_DStringValue(dsPtr));
+ Tcl_DStringSetLength(dsPtr, len);
+ } else {
+ /*
+ * len > 1 should only happen if someone has called XRebindKeysym.
+ * Assume UTF-8.
+ */
+
+ Tcl_DStringSetLength(dsPtr, len);
+ strncpy(Tcl_DStringValue(dsPtr), Tcl_DStringValue(&buf), len);
+ }
}
-#else /* TK_USE_INPUT_METHODS */
- len = XLookupString(&eventPtr->xkey, Tcl_DStringValue(&buf),
- Tcl_DStringLength(&buf), (KeySym *) NULL,
- (XComposeStatus *) NULL);
-#endif /* TK_USE_INPUT_METHODS */
- Tcl_DStringSetLength(&buf, len);
- Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&buf), len, dsPtr);
- Tcl_DStringFree(&buf);
+ /*
+ * Cache the string in the event so that if/when we return to this
+ * function, we will be able to produce it without asking X. This stops us
+ * from having to reenter the XIM engine. [Bug 1373712]
+ */
+ kePtr->charValuePtr = ckalloc(len + 1);
+ kePtr->charValueLen = len;
+ memcpy(kePtr->charValuePtr, Tcl_DStringValue(dsPtr), (unsigned) len + 1);
return Tcl_DStringValue(dsPtr);
}
/*
- * When mapping from a keysym to a keycode, need
- * information about the modifier state that should be used
- * so that when they call XKeycodeToKeysym taking into
- * account the xkey.state, they will get back the original
- * keysym.
+ * When mapping from a keysym to a keycode, need information about the
+ * modifier state that should be used so that when they call XKeycodeToKeysym
+ * taking into account the xkey.state, they will get back the original keysym.
*/
void
-TkpSetKeycodeAndState(tkwin, keySym, eventPtr)
- Tk_Window tkwin;
- KeySym keySym;
- XEvent *eventPtr;
+TkpSetKeycodeAndState(
+ Tk_Window tkwin,
+ KeySym keySym,
+ XEvent *eventPtr)
{
- Display *display;
+ Display *display = Tk_Display(tkwin);
int state;
KeyCode keycode;
-
- display = Tk_Display(tkwin);
-
+
if (keySym == NoSymbol) {
keycode = 0;
} else {
keycode = XKeysymToKeycode(display, keySym);
- }
- if (keycode != 0) {
- for (state = 0; state < 4; state++) {
- if (XKeycodeToKeysym(display, keycode, state) == keySym) {
- if (state & 1) {
- eventPtr->xkey.state |= ShiftMask;
- }
- if (state & 2) {
- TkDisplay *dispPtr;
-
- dispPtr = ((TkWindow *) tkwin)->dispPtr;
- eventPtr->xkey.state |= dispPtr->modeModMask;
+ if (keycode != 0) {
+ for (state = 0; state < 4; state++) {
+ if (XKeycodeToKeysym(display, keycode, state) == keySym) {
+ if (state & 1) {
+ eventPtr->xkey.state |= ShiftMask;
+ }
+ if (state & 2) {
+ TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
+
+ eventPtr->xkey.state |= dispPtr->modeModMask;
+ }
+ break;
}
- break;
}
}
}
@@ -201,29 +252,50 @@ TkpSetKeycodeAndState(tkwin, keySym, eventPtr)
*
* TkpGetKeySym --
*
- * Given an X KeyPress or KeyRelease event, map the
- * keycode in the event into a KeySym.
+ * Given an X KeyPress or KeyRelease event, map the keycode in the event
+ * into a KeySym.
*
* Results:
- * The return value is the KeySym corresponding to
- * eventPtr, or NoSymbol if no matching Keysym could be
- * found.
+ * The return value is the KeySym corresponding to eventPtr, or NoSymbol
+ * if no matching Keysym could be found.
*
* Side effects:
- * In the first call for a given display, keycode-to-
- * KeySym maps get loaded.
+ * In the first call for a given display, keycode-to-KeySym maps get
+ * loaded.
*
*----------------------------------------------------------------------
*/
KeySym
-TkpGetKeySym(dispPtr, eventPtr)
- TkDisplay *dispPtr; /* Display in which to
- * map keycode. */
- XEvent *eventPtr; /* Description of X event. */
+TkpGetKeySym(
+ TkDisplay *dispPtr, /* Display in which to map keycode. */
+ XEvent *eventPtr) /* Description of X event. */
{
KeySym sym;
int index;
+ TkKeyEvent* kePtr = (TkKeyEvent*) eventPtr;
+
+#ifdef TK_USE_INPUT_METHODS
+ /*
+ * If input methods are active, we may already have determined a keysym.
+ * Return it.
+ */
+
+ if (eventPtr->type == KeyPress && dispPtr
+ && (dispPtr->flags & TK_DISPLAY_USE_IM)) {
+ if (kePtr->charValuePtr == NULL) {
+ Tcl_DString ds;
+ TkWindow *winPtr = (TkWindow *)
+ Tk_IdToWindow(eventPtr->xany.display, eventPtr->xany.window);
+ Tcl_DStringInit(&ds);
+ (void) TkpGetString(winPtr, eventPtr, &ds);
+ Tcl_DStringFree(&ds);
+ }
+ if (kePtr->charValuePtr != NULL) {
+ return kePtr->keysym;
+ }
+ }
+#endif
/*
* Refresh the mapping information if it's stale
@@ -234,9 +306,9 @@ TkpGetKeySym(dispPtr, eventPtr)
}
/*
- * Figure out which of the four slots in the keymap vector to
- * use for this key. Refer to Xlib documentation for more info
- * on how this computation works.
+ * Figure out which of the four slots in the keymap vector to use for this
+ * key. Refer to Xlib documentation for more info on how this computation
+ * works.
*/
index = 0;
@@ -251,10 +323,9 @@ TkpGetKeySym(dispPtr, eventPtr)
sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, index);
/*
- * Special handling: if the key was shifted because of Lock, but
- * lock is only caps lock, not shift lock, and the shifted keysym
- * isn't upper-case alphabetic, then switch back to the unshifted
- * keysym.
+ * Special handling: if the key was shifted because of Lock, but lock is
+ * only caps lock, not shift lock, and the shifted keysym isn't upper-case
+ * alphabetic, then switch back to the unshifted keysym.
*/
if ((index & 1) && !(eventPtr->xkey.state & ShiftMask)
@@ -269,8 +340,8 @@ TkpGetKeySym(dispPtr, eventPtr)
}
/*
- * Another bit of special handling: if this is a shifted key and there
- * is no keysym defined, then use the keysym for the unshifted key.
+ * Another bit of special handling: if this is a shifted key and there is
+ * no keysym defined, then use the keysym for the unshifted key.
*/
if ((index & 1) && (sym == NoSymbol)) {
@@ -285,10 +356,9 @@ TkpGetKeySym(dispPtr, eventPtr)
*
* TkpInitKeymapInfo --
*
- * This procedure is invoked to scan keymap information
- * to recompute stuff that's important for binding, such
- * as the modifier key (if any) that corresponds to "mode
- * switch".
+ * This function is invoked to scan keymap information to recompute stuff
+ * that's important for binding, such as the modifier key (if any) that
+ * corresponds to "mode switch".
*
* Results:
* None.
@@ -300,8 +370,8 @@ TkpGetKeySym(dispPtr, eventPtr)
*/
void
-TkpInitKeymapInfo(dispPtr)
- TkDisplay *dispPtr; /* Display for which to recompute keymap
+TkpInitKeymapInfo(
+ TkDisplay *dispPtr) /* Display for which to recompute keymap
* information. */
{
XModifierKeymap *modMapPtr;
@@ -314,9 +384,9 @@ TkpInitKeymapInfo(dispPtr)
modMapPtr = XGetModifierMapping(dispPtr->display);
/*
- * Check the keycodes associated with the Lock modifier. If
- * any of them is associated with the XK_Shift_Lock modifier,
- * then Lock has to be interpreted as Shift Lock, not Caps Lock.
+ * Check the keycodes associated with the Lock modifier. If any of them is
+ * associated with the XK_Shift_Lock modifier, then Lock has to be
+ * interpreted as Shift Lock, not Caps Lock.
*/
dispPtr->lockUsage = LU_IGNORE;
@@ -337,16 +407,16 @@ TkpInitKeymapInfo(dispPtr)
}
/*
- * Look through the keycodes associated with modifiers to see if
- * the the "mode switch", "meta", or "alt" keysyms are associated
- * with any modifiers. If so, remember their modifier mask bits.
+ * Look through the keycodes associated with modifiers to see if the the
+ * "mode switch", "meta", or "alt" keysyms are associated with any
+ * modifiers. If so, remember their modifier mask bits.
*/
dispPtr->modeModMask = 0;
dispPtr->metaModMask = 0;
dispPtr->altModMask = 0;
codePtr = modMapPtr->modifiermap;
- max = 8*modMapPtr->max_keypermod;
+ max = 8 * modMapPtr->max_keypermod;
for (i = 0; i < max; i++, codePtr++) {
if (*codePtr == 0) {
continue;
@@ -368,12 +438,11 @@ TkpInitKeymapInfo(dispPtr)
*/
if (dispPtr->modKeyCodes != NULL) {
- ckfree((char *) dispPtr->modKeyCodes);
+ ckfree(dispPtr->modKeyCodes);
}
dispPtr->numModKeyCodes = 0;
arraySize = KEYCODE_ARRAY_SIZE;
- dispPtr->modKeyCodes = (KeyCode *) ckalloc((unsigned)
- (KEYCODE_ARRAY_SIZE * sizeof(KeyCode)));
+ dispPtr->modKeyCodes = ckalloc(KEYCODE_ARRAY_SIZE * sizeof(KeyCode));
for (i = 0, codePtr = modMapPtr->modifiermap; i < max; i++, codePtr++) {
if (*codePtr == 0) {
continue;
@@ -385,27 +454,39 @@ TkpInitKeymapInfo(dispPtr)
for (j = 0; j < dispPtr->numModKeyCodes; j++) {
if (dispPtr->modKeyCodes[j] == *codePtr) {
+ /*
+ * 'continue' the outer loop.
+ */
+
goto nextModCode;
}
}
if (dispPtr->numModKeyCodes >= arraySize) {
- KeyCode *new;
+ KeyCode *newCodes;
/*
- * Ran out of space in the array; grow it.
+ * Ran out of space in the array; grow it.
*/
arraySize *= 2;
- new = (KeyCode *) ckalloc((unsigned)
- (arraySize * sizeof(KeyCode)));
- memcpy((VOID *) new, (VOID *) dispPtr->modKeyCodes,
- (dispPtr->numModKeyCodes * sizeof(KeyCode)));
- ckfree((char *) dispPtr->modKeyCodes);
- dispPtr->modKeyCodes = new;
+ newCodes = ckalloc(arraySize * sizeof(KeyCode));
+ memcpy(newCodes, dispPtr->modKeyCodes,
+ dispPtr->numModKeyCodes * sizeof(KeyCode));
+ ckfree(dispPtr->modKeyCodes);
+ dispPtr->modKeyCodes = newCodes;
}
dispPtr->modKeyCodes[dispPtr->numModKeyCodes] = *codePtr;
dispPtr->numModKeyCodes++;
- nextModCode: continue;
+ nextModCode:
+ continue;
}
XFreeModifiermap(modMapPtr);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c
index 9189183..bc1bd2e 100644
--- a/unix/tkUnixMenu.c
+++ b/unix/tkUnixMenu.c
@@ -1,17 +1,15 @@
-/*
+/*
* tkUnixMenu.c --
*
* This module implements the UNIX platform-specific features of menus.
*
* Copyright (c) 1996-1998 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
#include "default.h"
-#include "tkInt.h"
#include "tkUnixInt.h"
#include "tkMenu.h"
@@ -29,64 +27,78 @@
#define ENTRY_HELP_MENU ENTRY_PLATFORM_FLAG1
/*
+ * Shared with button widget.
+ */
+
+MODULE_SCOPE void TkpDrawCheckIndicator(Tk_Window tkwin,
+ Display *display, Drawable d, int x, int y,
+ Tk_3DBorder bgBorder, XColor *indicatorColor,
+ XColor *selectColor, XColor *disColor, int on,
+ int disabled, int mode);
+/*
+ * Indicator Draw Modes
+ */
+
+#define CHECK_BUTTON 0
+#define CHECK_MENU 1
+#define RADIO_BUTTON 2
+#define RADIO_MENU 3
+
+/*
* Procedures used internally.
*/
-static void SetHelpMenu _ANSI_ARGS_((TkMenu *menuPtr));
-static void DrawMenuEntryAccelerator _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Drawable d, GC gc, Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr,
+static void SetHelpMenu(TkMenu *menuPtr);
+static void DrawMenuEntryAccelerator(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Drawable d, GC gc,
+ Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
Tk_3DBorder activeBorder, int x, int y,
- int width, int height, int drawArrow));
-static void DrawMenuEntryBackground _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Drawable d, Tk_3DBorder activeBorder,
- Tk_3DBorder bgBorder, int x, int y,
- int width, int heigth));
-static void DrawMenuEntryIndicator _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Drawable d, GC gc, GC indicatorGC,
- Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr, int x, int y,
- int width, int height));
-static void DrawMenuEntryLabel _ANSI_ARGS_((
- TkMenu * menuPtr, TkMenuEntry *mePtr, Drawable d,
- GC gc, Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr, int x, int y,
- int width, int height));
-static void DrawMenuSeparator _ANSI_ARGS_((TkMenu *menuPtr,
- TkMenuEntry *mePtr, Drawable d, GC gc,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int x, int y, int width, int height));
-static void DrawTearoffEntry _ANSI_ARGS_((TkMenu *menuPtr,
- TkMenuEntry *mePtr, Drawable d, GC gc,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int x, int y, int width, int height));
-static void DrawMenuUnderline _ANSI_ARGS_((TkMenu *menuPtr,
+ int width, int height, int drawArrow);
+static void DrawMenuEntryBackground(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Drawable d,
+ Tk_3DBorder activeBorder, Tk_3DBorder bgBorder,
+ int x, int y, int width, int heigth);
+static void DrawMenuEntryIndicator(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Drawable d,
+ Tk_3DBorder border, XColor *indicatorColor,
+ XColor *disableColor, Tk_Font tkfont,
+ const Tk_FontMetrics *fmPtr, int x, int y,
+ int width, int height);
+static void DrawMenuEntryLabel(TkMenu * menuPtr,
+ TkMenuEntry *mePtr, Drawable d, GC gc,
+ Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
+ int x, int y, int width, int height);
+static void DrawMenuSeparator(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Drawable d, GC gc,
+ Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
+ int x, int y, int width, int height);
+static void DrawTearoffEntry(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Drawable d, GC gc,
+ Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
+ int x, int y, int width, int height);
+static void DrawMenuUnderline(TkMenu *menuPtr,
TkMenuEntry *mePtr, Drawable d, GC gc,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr, int x,
- int y, int width, int height));
-static void GetMenuAccelGeometry _ANSI_ARGS_((TkMenu *menuPtr,
+ Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
+ int x, int y, int width, int height);
+static void GetMenuAccelGeometry(TkMenu *menuPtr,
TkMenuEntry *mePtr, Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr, int *widthPtr,
- int *heightPtr));
-static void GetMenuLabelGeometry _ANSI_ARGS_((TkMenuEntry *mePtr,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int *widthPtr, int *heightPtr));
-static void GetMenuIndicatorGeometry _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int *widthPtr, int *heightPtr));
-static void GetMenuSeparatorGeometry _ANSI_ARGS_((
- TkMenu *menuPtr, TkMenuEntry *mePtr,
- Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr,
- int *widthPtr, int *heightPtr));
-static void GetTearoffEntryGeometry _ANSI_ARGS_((TkMenu *menuPtr,
+ const Tk_FontMetrics *fmPtr, int *widthPtr,
+ int *heightPtr);
+static void GetMenuLabelGeometry(TkMenuEntry *mePtr,
+ Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
+ int *widthPtr, int *heightPtr);
+static void GetMenuIndicatorGeometry(TkMenu *menuPtr,
TkMenuEntry *mePtr, Tk_Font tkfont,
- CONST Tk_FontMetrics *fmPtr, int *widthPtr,
- int *heightPtr));
-
+ const Tk_FontMetrics *fmPtr,
+ int *widthPtr, int *heightPtr);
+static void GetMenuSeparatorGeometry(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Tk_Font tkfont,
+ const Tk_FontMetrics *fmPtr,
+ int *widthPtr, int *heightPtr);
+static void GetTearoffEntryGeometry(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Tk_Font tkfont,
+ const Tk_FontMetrics *fmPtr, int *widthPtr,
+ int *heightPtr);
/*
*----------------------------------------------------------------------
@@ -100,15 +112,15 @@ static void GetTearoffEntryGeometry _ANSI_ARGS_((TkMenu *menuPtr,
* Standard TCL error.
*
* Side effects:
- * Allocates any platform specific allocations and places them
- * in the platformData field of the menuPtr.
+ * Allocates any platform specific allocations and places them in the
+ * platformData field of the menuPtr.
*
*----------------------------------------------------------------------
*/
int
-TkpNewMenu(menuPtr)
- TkMenu *menuPtr;
+TkpNewMenu(
+ TkMenu *menuPtr)
{
SetHelpMenu(menuPtr);
return TCL_OK;
@@ -119,8 +131,8 @@ TkpNewMenu(menuPtr)
*
* TkpDestroyMenu --
*
- * Destroys platform-specific menu structures. Called when the
- * generic menu structure is destroyed for the menu.
+ * Destroys platform-specific menu structures. Called when the generic
+ * menu structure is destroyed for the menu.
*
* Results:
* None.
@@ -132,8 +144,8 @@ TkpNewMenu(menuPtr)
*/
void
-TkpDestroyMenu(menuPtr)
- TkMenu *menuPtr;
+TkpDestroyMenu(
+ TkMenu *menuPtr)
{
/*
* Nothing to do.
@@ -145,8 +157,8 @@ TkpDestroyMenu(menuPtr)
*
* TkpDestroyMenuEntry --
*
- * Cleans up platform-specific menu entry items. Called when entry
- * is destroyed in the generic code.
+ * Cleans up platform-specific menu entry items. Called when entry is
+ * destroyed in the generic code.
*
* Results:
* None.
@@ -158,8 +170,8 @@ TkpDestroyMenu(menuPtr)
*/
void
-TkpDestroyMenuEntry(mEntryPtr)
- TkMenuEntry *mEntryPtr;
+TkpDestroyMenuEntry(
+ TkMenuEntry *mEntryPtr)
{
/*
* Nothing to do.
@@ -171,29 +183,28 @@ TkpDestroyMenuEntry(mEntryPtr)
*
* TkpConfigureMenuEntry --
*
- * Processes configuration options for menu entries. Called when
- * the generic options are processed for the menu.
+ * Processes configuration options for menu entries. Called when the
+ * generic options are processed for the menu.
*
* Results:
- * Returns standard TCL result. If TCL_ERROR is returned, then
- * the interp's result contains an error message.
+ * Returns standard TCL result. If TCL_ERROR is returned, then the
+ * interp's result contains an error message.
*
* Side effects:
- * Configuration information get set for mePtr; old resources
- * get freed, if any need it.
+ * Configuration information get set for mePtr; old resources get freed,
+ * if any need it.
*
*----------------------------------------------------------------------
*/
int
-TkpConfigureMenuEntry(mePtr)
- register TkMenuEntry *mePtr; /* Information about menu entry; may
- * or may not already have values for
- * some fields. */
+TkpConfigureMenuEntry(
+ register TkMenuEntry *mePtr)/* Information about menu entry; may or may
+ * not already have values for some fields. */
{
/*
- * If this is a cascade menu, and the child menu exists, check to
- * see if the child menu is a help menu.
+ * If this is a cascade menu, and the child menu exists, check to see if
+ * the child menu is a help menu.
*/
if ((mePtr->type == CASCADE_ENTRY) && (mePtr->namePtr != NULL)) {
@@ -214,9 +225,8 @@ TkpConfigureMenuEntry(mePtr)
* TkpMenuNewEntry --
*
* Called when a new entry is created in a menu. Fills in platform
- * specific data for the entry. The platformEntryData field
- * is used to store the indicator diameter for radio button
- * and check box entries.
+ * specific data for the entry. The platformEntryData field is used to
+ * store the indicator diameter for radio button and check box entries.
*
* Results:
* Standard TCL error.
@@ -228,8 +238,8 @@ TkpConfigureMenuEntry(mePtr)
*/
int
-TkpMenuNewEntry(mePtr)
- TkMenuEntry *mePtr;
+TkpMenuNewEntry(
+ TkMenuEntry *mePtr)
{
return TCL_OK;
}
@@ -251,9 +261,9 @@ TkpMenuNewEntry(mePtr)
*/
void
-TkpSetWindowMenuBar(tkwin, menuPtr)
- Tk_Window tkwin; /* The window we are setting */
- TkMenu *menuPtr; /* The menu we are setting */
+TkpSetWindowMenuBar(
+ Tk_Window tkwin, /* The window we are setting */
+ TkMenu *menuPtr) /* The menu we are setting */
{
if (menuPtr == NULL) {
TkUnixSetMenubar(tkwin, NULL);
@@ -267,9 +277,9 @@ TkpSetWindowMenuBar(tkwin, menuPtr)
*
* TkpSetMainMenuBar --
*
- * Called when a toplevel widget is brought to front. On the
- * Macintosh, sets up the menubar that goes accross the top
- * of the main monitor. On other platforms, nothing is necessary.
+ * Called when a toplevel widget is brought to front. On the Macintosh,
+ * sets up the menubar that goes accross the top of the main monitor. On
+ * other platforms, nothing is necessary.
*
* Results:
* None.
@@ -281,10 +291,10 @@ TkpSetWindowMenuBar(tkwin, menuPtr)
*/
void
-TkpSetMainMenubar(interp, tkwin, menuName)
- Tcl_Interp *interp;
- Tk_Window tkwin;
- char *menuName;
+TkpSetMainMenubar(
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ const char *menuName)
{
/*
* Nothing to do.
@@ -296,10 +306,9 @@ TkpSetMainMenubar(interp, tkwin, menuName)
*
* GetMenuIndicatorGeometry --
*
- * Fills out the geometry of the indicator in a menu item. Note
- * that the mePtr->height field must have already been filled in
- * by GetMenuLabelGeometry since this height depends on the label
- * height.
+ * Fills out the geometry of the indicator in a menu item. Note that the
+ * mePtr->height field must have already been filled in by
+ * GetMenuLabelGeometry since this height depends on the label height.
*
* Results:
* widthPtr and heightPtr point to the new geometry values.
@@ -311,14 +320,16 @@ TkpSetMainMenubar(interp, tkwin, menuName)
*/
static void
-GetMenuIndicatorGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
- TkMenu *menuPtr; /* The menu we are drawing. */
- TkMenuEntry *mePtr; /* The entry we are interested in. */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr; /* The precalculated metrics */
- int *widthPtr; /* The resulting width */
- int *heightPtr; /* The resulting height */
+GetMenuIndicatorGeometry(
+ TkMenu *menuPtr, /* The menu we are drawing. */
+ TkMenuEntry *mePtr, /* The entry we are interested in. */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated metrics */
+ int *widthPtr, /* The resulting width */
+ int *heightPtr) /* The resulting height */
{
+ int borderWidth;
+
if ((mePtr->type == CHECK_BUTTON_ENTRY)
|| (mePtr->type == RADIO_BUTTON_ENTRY)) {
if (!mePtr->hideMargin && mePtr->indicatorOn) {
@@ -326,42 +337,35 @@ GetMenuIndicatorGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
*widthPtr = (14 * mePtr->height) / 10;
*heightPtr = mePtr->height;
if (mePtr->type == CHECK_BUTTON_ENTRY) {
- mePtr->platformEntryData =
- (TkMenuPlatformEntryData) ((65 * mePtr->height)
- / 100);
+ mePtr->platformEntryData = (TkMenuPlatformEntryData)
+ INT2PTR((65 * mePtr->height) / 100);
} else {
- mePtr->platformEntryData =
- (TkMenuPlatformEntryData) ((75 * mePtr->height)
- / 100);
- }
+ mePtr->platformEntryData = (TkMenuPlatformEntryData)
+ INT2PTR((75 * mePtr->height) / 100);
+ }
} else {
*widthPtr = *heightPtr = mePtr->height;
if (mePtr->type == CHECK_BUTTON_ENTRY) {
mePtr->platformEntryData = (TkMenuPlatformEntryData)
- ((80 * mePtr->height) / 100);
+ INT2PTR((80 * mePtr->height) / 100);
} else {
mePtr->platformEntryData = (TkMenuPlatformEntryData)
- mePtr->height;
+ INT2PTR(mePtr->height);
}
}
} else {
- int borderWidth;
-
- Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
- menuPtr->borderWidthPtr, &borderWidth);
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
+ &borderWidth);
*heightPtr = 0;
*widthPtr = borderWidth;
}
} else {
- int borderWidth;
-
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
&borderWidth);
- *heightPtr = 0;
- *widthPtr = borderWidth;
+ *heightPtr = 0;
+ *widthPtr = borderWidth;
}
}
-
/*
*----------------------------------------------------------------------
@@ -380,22 +384,21 @@ GetMenuIndicatorGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
*/
static void
-GetMenuAccelGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
- TkMenu *menuPtr; /* The menu was are drawing */
- TkMenuEntry *mePtr; /* The entry we are getting the geometry for */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr;/* The precalculated font metrics */
- int *widthPtr; /* The width of the acclerator area */
- int *heightPtr; /* The height of the accelerator area */
+GetMenuAccelGeometry(
+ TkMenu *menuPtr, /* The menu was are drawing */
+ TkMenuEntry *mePtr, /* The entry we are getting the geometry for */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ int *widthPtr, /* The width of the acclerator area */
+ int *heightPtr) /* The height of the accelerator area */
{
*heightPtr = fmPtr->linespace;
if (mePtr->type == CASCADE_ENTRY) {
*widthPtr = 2 * CASCADE_ARROW_WIDTH;
- } else if ((menuPtr->menuType != MENUBAR)
- && (mePtr->accelPtr != NULL)) {
- char *accel = Tcl_GetStringFromObj(mePtr->accelPtr, NULL);
-
- *widthPtr = Tk_TextWidth(tkfont, accel, mePtr->accelLength);
+ } else if ((menuPtr->menuType != MENUBAR) && (mePtr->accelPtr != NULL)) {
+ const char *accel = Tcl_GetString(mePtr->accelPtr);
+
+ *widthPtr = Tk_TextWidth(tkfont, accel, mePtr->accelLength);
} else {
*widthPtr = 0;
}
@@ -412,24 +415,22 @@ GetMenuAccelGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
static void
-DrawMenuEntryBackground(menuPtr, mePtr, d, activeBorder, bgBorder, x, y,
- width, height)
- TkMenu *menuPtr; /* The menu we are drawing */
- TkMenuEntry *mePtr; /* The entry we are drawing. */
- Drawable d; /* The drawable we are drawing into */
- Tk_3DBorder activeBorder; /* The border for an active item */
- Tk_3DBorder bgBorder; /* The background border */
- int x; /* Left coordinate of entry rect */
- int y; /* Right coordinate of entry rect */
- int width; /* Width of entry rect */
- int height; /* Height of entry rect */
+DrawMenuEntryBackground(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing. */
+ Drawable d, /* The drawable we are drawing into */
+ Tk_3DBorder activeBorder, /* The border for an active item */
+ Tk_3DBorder bgBorder, /* The background border */
+ int x, /* Left coordinate of entry rect */
+ int y, /* Right coordinate of entry rect */
+ int width, /* Width of entry rect */
+ int height) /* Height of entry rect */
{
if (mePtr->state == ENTRY_ACTIVE) {
int relief;
@@ -466,31 +467,29 @@ DrawMenuEntryBackground(menuPtr, mePtr, d, activeBorder, bgBorder, x, y,
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
static void
-DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr, activeBorder,
- x, y, width, height, drawArrow)
- TkMenu *menuPtr; /* The menu we are drawing */
- TkMenuEntry *mePtr; /* The entry we are drawing */
- Drawable d; /* The drawable we are drawing into */
- GC gc; /* The precalculated gc to draw with */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr; /* The precalculated metrics */
- Tk_3DBorder activeBorder; /* The border for an active item */
- int x; /* Left coordinate of entry rect */
- int y; /* Top coordinate of entry rect */
- int width; /* Width of entry */
- int height; /* Height of entry */
- int drawArrow; /* Whether or not to draw arrow. */
+DrawMenuEntryAccelerator(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* The drawable we are drawing into */
+ GC gc, /* The precalculated gc to draw with */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated metrics */
+ Tk_3DBorder activeBorder, /* The border for an active item */
+ int x, /* Left coordinate of entry rect */
+ int y, /* Top coordinate of entry rect */
+ int width, /* Width of entry */
+ int height, /* Height of entry */
+ int drawArrow) /* Whether or not to draw arrow. */
{
XPoint points[3];
int borderWidth, activeBorderWidth;
-
+
/*
* Draw accelerator or cascade arrow.
*/
@@ -505,7 +504,7 @@ DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr, activeBorder,
&activeBorderWidth);
if ((mePtr->type == CASCADE_ENTRY) && drawArrow) {
points[0].x = x + width - borderWidth - activeBorderWidth
- - CASCADE_ARROW_WIDTH;
+ - CASCADE_ARROW_WIDTH;
points[0].y = y + (height - CASCADE_ARROW_HEIGHT)/2;
points[1].x = points[0].x;
points[1].y = points[0].y + CASCADE_ARROW_HEIGHT;
@@ -516,10 +515,10 @@ DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr, activeBorder,
(menuPtr->postedCascade == mePtr)
? TK_RELIEF_SUNKEN : TK_RELIEF_RAISED);
} else if (mePtr->accelPtr != NULL) {
- char *accel = Tcl_GetStringFromObj(mePtr->accelPtr, NULL);
+ const char *accel = Tcl_GetString(mePtr->accelPtr);
int left = x + mePtr->labelWidth + activeBorderWidth
- + mePtr->indicatorSpace;
-
+ + mePtr->indicatorSpace;
+
if (menuPtr->menuType == MENUBAR) {
left += 5;
}
@@ -540,56 +539,45 @@ DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr, activeBorder,
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
static void
-DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont, fmPtr,
- x, y, width, height)
- TkMenu *menuPtr; /* The menu we are drawing */
- TkMenuEntry *mePtr; /* The entry we are drawing */
- Drawable d; /* The drawable to draw into */
- GC gc; /* The gc to draw with */
- GC indicatorGC; /* The gc that indicators draw with */
- Tk_Font tkfont; /* The font to draw with */
- CONST Tk_FontMetrics *fmPtr; /* The font metrics of the font */
- int x; /* The left of the entry rect */
- int y; /* The top of the entry rect */
- int width; /* Width of menu entry */
- int height; /* Height of menu entry */
+DrawMenuEntryIndicator(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* The drawable to draw into */
+ Tk_3DBorder border, /* The background color */
+ XColor *indicatorColor, /* The color to draw indicators with */
+ XColor *disableColor, /* The color use use when disabled */
+ Tk_Font tkfont, /* The font to draw with */
+ const Tk_FontMetrics *fmPtr,/* The font metrics of the font */
+ int x, /* The left of the entry rect */
+ int y, /* The top of the entry rect */
+ int width, /* Width of menu entry */
+ int height) /* Height of menu entry */
{
/*
* Draw check-button indicator.
*/
if ((mePtr->type == CHECK_BUTTON_ENTRY) && mePtr->indicatorOn) {
- int dim, top, left;
- int activeBorderWidth;
- Tk_3DBorder border;
-
- dim = (int) mePtr->platformEntryData;
+ int top, left, activeBorderWidth;
+ int disabled = (mePtr->state == ENTRY_DISABLED);
+ XColor *bg;
+
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
menuPtr->activeBorderWidthPtr, &activeBorderWidth);
- left = x + activeBorderWidth + (mePtr->indicatorSpace - dim)/2;
- if (menuPtr->menuType == MENUBAR) {
- left += 5;
- }
- top = y + (height - dim)/2;
- border = Tk_Get3DBorderFromObj(menuPtr->tkwin,
- menuPtr->borderPtr);
- Tk_Fill3DRectangle(menuPtr->tkwin, d, border, left, top, dim,
- dim, DECORATION_BORDER_WIDTH, TK_RELIEF_SUNKEN);
- left += DECORATION_BORDER_WIDTH;
- top += DECORATION_BORDER_WIDTH;
- dim -= 2*DECORATION_BORDER_WIDTH;
- if ((dim > 0) && (mePtr->entryFlags
- & ENTRY_SELECTED)) {
- XFillRectangle(menuPtr->display, d, indicatorGC, left, top,
- (unsigned int) dim, (unsigned int) dim);
- }
+ bg = Tk_3DBorderColor(border);
+ top = y + height/2;
+ left = x + activeBorderWidth + DECORATION_BORDER_WIDTH
+ + mePtr->indicatorSpace/2;
+
+ TkpDrawCheckIndicator(menuPtr->tkwin, menuPtr->display, d, left, top,
+ border, indicatorColor, bg, disableColor,
+ (mePtr->entryFlags & ENTRY_SELECTED), disabled, CHECK_MENU);
}
/*
@@ -597,31 +585,20 @@ DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont, fmPtr,
*/
if ((mePtr->type == RADIO_BUTTON_ENTRY) && mePtr->indicatorOn) {
- XPoint points[4];
- int radius;
- Tk_3DBorder border;
-
- border = Tk_Get3DBorderFromObj(menuPtr->tkwin,
- menuPtr->borderPtr);
- radius = ((int) mePtr->platformEntryData)/2;
- points[0].x = x + (mePtr->indicatorSpace
- - (int) mePtr->platformEntryData)/2;
- points[0].y = y + (height)/2;
- points[1].x = points[0].x + radius;
- points[1].y = points[0].y + radius;
- points[2].x = points[1].x + radius;
- points[2].y = points[0].y;
- points[3].x = points[1].x;
- points[3].y = points[0].y - radius;
- if (mePtr->entryFlags & ENTRY_SELECTED) {
- XFillPolygon(menuPtr->display, d, indicatorGC, points, 4,
- Convex, CoordModeOrigin);
- } else {
- Tk_Fill3DPolygon(menuPtr->tkwin, d, border, points, 4,
- DECORATION_BORDER_WIDTH, TK_RELIEF_FLAT);
- }
- Tk_Draw3DPolygon(menuPtr->tkwin, d, border, points, 4,
- DECORATION_BORDER_WIDTH, TK_RELIEF_SUNKEN);
+ int top, left, activeBorderWidth;
+ int disabled = (mePtr->state == ENTRY_DISABLED);
+ XColor *bg;
+
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
+ menuPtr->activeBorderWidthPtr, &activeBorderWidth);
+ bg = Tk_3DBorderColor(border);
+ top = y + height/2;
+ left = x + activeBorderWidth + DECORATION_BORDER_WIDTH
+ + mePtr->indicatorSpace/2;
+
+ TkpDrawCheckIndicator(menuPtr->tkwin, menuPtr->display, d, left, top,
+ border, indicatorColor, bg, disableColor,
+ (mePtr->entryFlags & ENTRY_SELECTED), disabled, RADIO_MENU);
}
}
@@ -636,24 +613,21 @@ DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont, fmPtr,
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
static void
-DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
- TkMenu *menuPtr; /* The menu we are drawing */
- TkMenuEntry *mePtr; /* The entry we are drawing */
- Drawable d; /* The drawable we are using */
- GC gc; /* The gc to draw into */
- Tk_Font tkfont; /* The font to draw with */
- CONST Tk_FontMetrics *fmPtr; /* The font metrics from the font */
- int x;
- int y;
- int width;
- int height;
+DrawMenuSeparator(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* The drawable we are using */
+ GC gc, /* The gc to draw into */
+ Tk_Font tkfont, /* The font to draw with */
+ const Tk_FontMetrics *fmPtr,/* The font metrics from the font */
+ int x, int y,
+ int width, int height)
{
XPoint points[2];
Tk_3DBorder border;
@@ -661,7 +635,7 @@ DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
if (menuPtr->menuType == MENUBAR) {
return;
}
-
+
points[0].x = x;
points[0].y = y + height/2;
points[1].x = width - 1;
@@ -682,29 +656,26 @@ DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
static void
-DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
- TkMenu *menuPtr; /* The menu we are drawing. */
- TkMenuEntry *mePtr; /* The entry we are drawing. */
- Drawable d; /* What we are drawing into. */
- GC gc; /* The gc we are drawing into.*/
- Tk_Font tkfont; /* The precalculated font. */
- CONST Tk_FontMetrics *fmPtr;/* The precalculated font metrics. */
- int x; /* Left edge. */
- int y; /* Top edge. */
- int width; /* width of entry. */
- int height; /* height of entry. */
+DrawMenuEntryLabel(
+ TkMenu *menuPtr, /* The menu we are drawing. */
+ TkMenuEntry *mePtr, /* The entry we are drawing. */
+ Drawable d, /* What we are drawing into. */
+ GC gc, /* The gc we are drawing into.*/
+ Tk_Font tkfont, /* The precalculated font. */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics. */
+ int x, /* Left edge. */
+ int y, /* Top edge. */
+ int width, /* width of entry. */
+ int height) /* height of entry. */
{
- int indicatorSpace = mePtr->indicatorSpace;
- int activeBorderWidth;
- int leftEdge;
- int imageHeight, imageWidth;
+ int indicatorSpace = mePtr->indicatorSpace;
+ int activeBorderWidth, leftEdge, imageHeight, imageWidth;
int textHeight = 0, textWidth = 0; /* stop GCC warning */
int haveImage = 0, haveText = 0;
int imageXOffset = 0, imageYOffset = 0;
@@ -716,7 +687,7 @@ DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
if (menuPtr->menuType == MENUBAR) {
leftEdge += 5;
}
-
+
/*
* Work out what we will need to draw first.
*/
@@ -726,74 +697,74 @@ DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
haveImage = 1;
} else if (mePtr->bitmapPtr != NULL) {
Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr);
+
Tk_SizeOfBitmap(menuPtr->display, bitmap, &imageWidth, &imageHeight);
haveImage = 1;
}
if (!haveImage || (mePtr->compound != COMPOUND_NONE)) {
if (mePtr->labelLength > 0) {
- char *label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
+ const char *label = Tcl_GetString(mePtr->labelPtr);
+
textWidth = Tk_TextWidth(tkfont, label, mePtr->labelLength);
textHeight = fmPtr->linespace;
haveText = 1;
}
}
-
+
/*
* Now work out what the relative positions are.
*/
if (haveImage && haveText) {
int fullWidth = (imageWidth > textWidth ? imageWidth : textWidth);
+
switch ((enum compound) mePtr->compound) {
- case COMPOUND_TOP: {
- textXOffset = (fullWidth - textWidth)/2;
- textYOffset = imageHeight/2 + 2;
- imageXOffset = (fullWidth - imageWidth)/2;
- imageYOffset = -textHeight/2;
- break;
- }
- case COMPOUND_BOTTOM: {
- textXOffset = (fullWidth - textWidth)/2;
- textYOffset = -imageHeight/2;
- imageXOffset = (fullWidth - imageWidth)/2;
- imageYOffset = textHeight/2 + 2;
- break;
- }
- case COMPOUND_LEFT: {
- /*
- * Position image in the indicator space to the left of the
- * entries, unless this entry is a radio|check button because
- * then the indicator space will be used.
- */
- textXOffset = imageWidth + 2;
- textYOffset = 0;
- imageXOffset = 0;
- imageYOffset = 0;
- if ((mePtr->type != CHECK_BUTTON_ENTRY)
- && (mePtr->type != RADIO_BUTTON_ENTRY)) {
- textXOffset -= indicatorSpace;
- if (textXOffset < 0) {
- textXOffset = 0;
- }
- imageXOffset = -indicatorSpace;
+ case COMPOUND_TOP:
+ textXOffset = (fullWidth - textWidth)/2;
+ textYOffset = imageHeight/2 + 2;
+ imageXOffset = (fullWidth - imageWidth)/2;
+ imageYOffset = -textHeight/2;
+ break;
+ case COMPOUND_BOTTOM:
+ textXOffset = (fullWidth - textWidth)/2;
+ textYOffset = -imageHeight/2;
+ imageXOffset = (fullWidth - imageWidth)/2;
+ imageYOffset = textHeight/2 + 2;
+ break;
+ case COMPOUND_LEFT:
+ /*
+ * Position image in the indicator space to the left of the
+ * entries, unless this entry is a radio|check button because then
+ * the indicator space will be used.
+ */
+
+ textXOffset = imageWidth + 2;
+ textYOffset = 0;
+ imageXOffset = 0;
+ imageYOffset = 0;
+ if ((mePtr->type != CHECK_BUTTON_ENTRY)
+ && (mePtr->type != RADIO_BUTTON_ENTRY)) {
+ textXOffset -= indicatorSpace;
+ if (textXOffset < 0) {
+ textXOffset = 0;
}
- break;
+ imageXOffset = -indicatorSpace;
}
- case COMPOUND_RIGHT: {
- textXOffset = 0;
- textYOffset = 0;
- imageXOffset = textWidth + 2;
- imageYOffset = 0;
- break;
- }
- case COMPOUND_CENTER: {
- textXOffset = (fullWidth - textWidth)/2;
- textYOffset = 0;
- imageXOffset = (fullWidth - imageWidth)/2;
- imageYOffset = 0;
- break;
- }
- case COMPOUND_NONE: {break;}
+ break;
+ case COMPOUND_RIGHT:
+ textXOffset = 0;
+ textYOffset = 0;
+ imageXOffset = textWidth + 2;
+ imageYOffset = 0;
+ break;
+ case COMPOUND_CENTER:
+ textXOffset = (fullWidth - textWidth)/2;
+ textYOffset = 0;
+ imageXOffset = (fullWidth - imageWidth)/2;
+ imageYOffset = 0;
+ break;
+ case COMPOUND_NONE:
+ break;
}
} else {
textXOffset = 0;
@@ -801,7 +772,7 @@ DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
imageXOffset = 0;
imageYOffset = 0;
}
-
+
/*
* Draw label and/or bitmap or image for entry.
*/
@@ -811,27 +782,30 @@ DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
&& (mePtr->entryFlags & ENTRY_SELECTED)) {
Tk_RedrawImage(mePtr->selectImage, 0, 0,
imageWidth, imageHeight, d, leftEdge + imageXOffset,
- (int) (y + (mePtr->height - imageHeight)/2 + imageYOffset));
+ (int) (y + (mePtr->height-imageHeight)/2 + imageYOffset));
} else {
Tk_RedrawImage(mePtr->image, 0, 0, imageWidth,
imageHeight, d, leftEdge + imageXOffset,
- (int) (y + (mePtr->height - imageHeight)/2 + imageYOffset));
+ (int) (y + (mePtr->height-imageHeight)/2 + imageYOffset));
}
} else if (mePtr->bitmapPtr != None) {
Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr);
- XCopyPlane(menuPtr->display, bitmap, d, gc, 0, 0,
- (unsigned) imageWidth, (unsigned) imageHeight,
+
+ XCopyPlane(menuPtr->display, bitmap, d, gc, 0, 0,
+ (unsigned) imageWidth, (unsigned) imageHeight,
leftEdge + imageXOffset,
(int) (y + (mePtr->height - imageHeight)/2 + imageYOffset), 1);
}
if ((mePtr->compound != COMPOUND_NONE) || !haveImage) {
int baseline = y + (height + fmPtr->ascent - fmPtr->descent) / 2;
+
if (mePtr->labelLength > 0) {
- char *label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
+ const char *label = Tcl_GetString(mePtr->labelPtr);
+
Tk_DrawChars(menuPtr->display, d, gc, tkfont, label,
- mePtr->labelLength, leftEdge + textXOffset,
+ mePtr->labelLength, leftEdge + textXOffset,
baseline + textYOffset);
- DrawMenuUnderline(menuPtr, mePtr, d, gc, tkfont, fmPtr,
+ DrawMenuUnderline(menuPtr, mePtr, d, gc, tkfont, fmPtr,
x + textXOffset, y + textYOffset,
width, height);
}
@@ -841,7 +815,7 @@ DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
if (menuPtr->disabledFgPtr == NULL) {
XFillRectangle(menuPtr->display, d, menuPtr->disabledGC, x, y,
(unsigned) width, (unsigned) height);
- } else if ((mePtr->image != NULL)
+ } else if ((mePtr->image != NULL)
&& (menuPtr->disabledImageGC != None)) {
XFillRectangle(menuPtr->display, d, menuPtr->disabledImageGC,
leftEdge + imageXOffset,
@@ -856,43 +830,41 @@ DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
*
* DrawMenuUnderline --
*
- * On appropriate platforms, draw the underline character for the
- * menu.
+ * On appropriate platforms, draw the underline character for the menu.
*
* Results:
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
static void
-DrawMenuUnderline(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
- TkMenu *menuPtr; /* The menu to draw into */
- TkMenuEntry *mePtr; /* The entry we are drawing */
- Drawable d; /* What we are drawing into */
- GC gc; /* The gc to draw into */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr; /* The precalculated font metrics */
- int x;
- int y;
- int width;
- int height;
+DrawMenuUnderline(
+ TkMenu *menuPtr, /* The menu to draw into */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* What we are drawing into */
+ GC gc, /* The gc to draw into */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ int x, int y,
+ int width, int height)
{
if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) {
int len;
- /* do the unicode call just to prevent overruns */
+ /*
+ * Do the unicode call just to prevent overruns.
+ */
+
Tcl_GetUnicodeFromObj(mePtr->labelPtr, &len);
if (mePtr->underline < len) {
- int activeBorderWidth;
- int leftEdge;
- CONST char *label, *start, *end;
+ int activeBorderWidth, leftEdge;
+ const char *label, *start, *end;
- label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
+ label = Tcl_GetString(mePtr->labelPtr);
start = Tcl_UtfAtIndex(label, mePtr->underline);
end = Tcl_UtfNext(start);
@@ -927,11 +899,10 @@ DrawMenuUnderline(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
*/
int
-TkpPostMenu(interp, menuPtr, x, y)
- Tcl_Interp *interp;
- TkMenu *menuPtr;
- int x;
- int y;
+TkpPostMenu(
+ Tcl_Interp *interp,
+ TkMenu *menuPtr,
+ int x, int y)
{
return TkPostTearoffMenu(interp, menuPtr, x, y);
}
@@ -953,14 +924,13 @@ TkpPostMenu(interp, menuPtr, x, y)
*/
static void
-GetMenuSeparatorGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr,
- heightPtr)
- TkMenu *menuPtr; /* The menu we are measuring */
- TkMenuEntry *mePtr; /* The entry we are measuring */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr; /* The precalcualted font metrics */
- int *widthPtr; /* The resulting width */
- int *heightPtr; /* The resulting height */
+GetMenuSeparatorGeometry(
+ TkMenu *menuPtr, /* The menu we are measuring */
+ TkMenuEntry *mePtr, /* The entry we are measuring */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalcualted font metrics */
+ int *widthPtr, /* The resulting width */
+ int *heightPtr) /* The resulting height */
{
*widthPtr = 0;
*heightPtr = fmPtr->linespace;
@@ -983,13 +953,13 @@ GetMenuSeparatorGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr,
*/
static void
-GetTearoffEntryGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
- TkMenu *menuPtr; /* The menu we are drawing */
- TkMenuEntry *mePtr; /* The entry we are measuring */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr; /* The precalculated font metrics */
- int *widthPtr; /* The resulting width */
- int *heightPtr; /* The resulting height */
+GetTearoffEntryGeometry(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are measuring */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ int *widthPtr, /* The resulting width */
+ int *heightPtr) /* The resulting height */
{
if (menuPtr->menuType != MASTER_MENU) {
*heightPtr = 0;
@@ -1005,38 +975,30 @@ GetTearoffEntryGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
*
* TkpComputeMenubarGeometry --
*
- * This procedure is invoked to recompute the size and
- * layout of a menu that is a menubar clone.
+ * This procedure is invoked to recompute the size and layout of a menu
+ * that is a menubar clone.
*
* Results:
* None.
*
* Side effects:
- * Fields of menu entries are changed to reflect their
- * current positions, and the size of the menu window
- * itself may be changed.
+ * Fields of menu entries are changed to reflect their current positions,
+ * and the size of the menu window itself may be changed.
*
*--------------------------------------------------------------
*/
void
-TkpComputeMenubarGeometry(menuPtr)
- TkMenu *menuPtr; /* Structure describing menu. */
+TkpComputeMenubarGeometry(
+ TkMenu *menuPtr) /* Structure describing menu. */
{
- Tk_Font tkfont;
+ Tk_Font tkfont, menuFont;
Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr;
- int width, height;
- int i, j;
- int x, y, currentRowHeight, maxWidth;
- int maxWindowWidth;
- int lastRowBreak;
- int helpMenuIndex = -1;
+ int width, height, i, j, x, y, currentRowHeight, maxWidth;
+ int maxWindowWidth, lastRowBreak, lastEntry;
+ int borderWidth, activeBorderWidth, helpMenuIndex = -1;
TkMenuEntry *mePtr;
- int lastEntry;
- Tk_Font menuFont;
- int borderWidth;
- int activeBorderWidth;
-
+
if (menuPtr->tkwin == NULL) {
return;
}
@@ -1050,7 +1012,7 @@ TkpComputeMenubarGeometry(menuPtr)
height = 0;
} else {
int borderWidth;
-
+
maxWindowWidth = Tk_Width(menuPtr->tkwin);
if (maxWindowWidth == 1) {
maxWindowWidth = 0x7ffffff;
@@ -1060,19 +1022,19 @@ TkpComputeMenubarGeometry(menuPtr)
&borderWidth);
x = y = borderWidth;
lastRowBreak = 0;
-
+
/*
- * On the Mac especially, getting font metrics can be quite slow,
- * so we want to do it intelligently. We are going to precalculate
- * them and pass them down to all of the measureing and drawing
- * routines. We will measure the font metrics of the menu once,
- * and if an entry has a font set, we will measure it as we come
- * to it, and then we decide which set to give the geometry routines.
+ * On the Mac especially, getting font metrics can be quite slow, so
+ * we want to do it intelligently. We are going to precalculate them
+ * and pass them down to all of the measureing and drawing routines.
+ * We will measure the font metrics of the menu once, and if an entry
+ * has a font set, we will measure it as we come to it, and then we
+ * decide which set to give the geometry routines.
*/
menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
Tk_GetFontMetrics(menuFont, &menuMetrics);
-
+
for (i = 0; i < menuPtr->numEntries; i++) {
mePtr = menuPtr->entries[i];
mePtr->entryFlags &= ~ENTRY_LAST_COLUMN;
@@ -1088,11 +1050,10 @@ TkpComputeMenubarGeometry(menuPtr)
/*
* For every entry, we need to check to see whether or not we
* wrap. If we do wrap, then we have to adjust all of the previous
- * entries' height and y position, because when we see them
- * the first time, we don't know how big its neighbor might
- * be.
+ * entries' height and y position, because when we see them the
+ * first time, we don't know how big its neighbor might be.
*/
-
+
if ((mePtr->type == SEPARATOR_ENTRY)
|| (mePtr->type == TEAROFF_ENTRY)) {
mePtr->height = mePtr->width = 0;
@@ -1112,7 +1073,6 @@ TkpComputeMenubarGeometry(menuPtr)
if (mePtr->entryFlags & ENTRY_HELP_MENU) {
helpMenuIndex = i;
} else if (x + mePtr->width + borderWidth > maxWindowWidth) {
-
if (i == lastRowBreak) {
mePtr->y = y;
mePtr->x = x;
@@ -1123,7 +1083,7 @@ TkpComputeMenubarGeometry(menuPtr)
x = borderWidth;
for (j = lastRowBreak; j < i; j++) {
menuPtr->entries[j]->y = y + currentRowHeight
- - menuPtr->entries[j]->height;
+ - menuPtr->entries[j]->height;
menuPtr->entries[j]->x = x;
x += menuPtr->entries[j]->width;
}
@@ -1140,7 +1100,7 @@ TkpComputeMenubarGeometry(menuPtr)
if (mePtr->height > currentRowHeight) {
currentRowHeight = mePtr->height;
}
- }
+ }
}
lastEntry = menuPtr->numEntries - 1;
@@ -1161,7 +1121,7 @@ TkpComputeMenubarGeometry(menuPtr)
menuPtr->entries[j]->x = x;
x += menuPtr->entries[j]->width;
}
-
+
if (helpMenuIndex != -1) {
mePtr = menuPtr->entries[helpMenuIndex];
@@ -1177,11 +1137,11 @@ TkpComputeMenubarGeometry(menuPtr)
}
height = y + currentRowHeight + borderWidth;
}
- width = Tk_Width(menuPtr->tkwin);
+ width = Tk_Width(menuPtr->tkwin);
/*
- * The X server doesn't like zero dimensions, so round up to at least
- * 1 (a zero-sized menu should never really occur, anyway).
+ * The X server doesn't like zero dimensions, so round up to at least 1 (a
+ * zero-sized menu should never really occur, anyway).
*/
if (width <= 0) {
@@ -1205,24 +1165,21 @@ TkpComputeMenubarGeometry(menuPtr)
* None.
*
* Side effects:
- * Commands are output to X to display the menu in its
- * current mode.
+ * Commands are output to X to display the menu in its current mode.
*
*----------------------------------------------------------------------
*/
static void
-DrawTearoffEntry(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
- TkMenu *menuPtr; /* The menu we are drawing */
- TkMenuEntry *mePtr; /* The entry we are drawing */
- Drawable d; /* The drawable we are drawing into */
- GC gc; /* The gc we are drawing with */
- Tk_Font tkfont; /* The font we are drawing with */
- CONST Tk_FontMetrics *fmPtr; /* The metrics we are drawing with */
- int x;
- int y;
- int width;
- int height;
+DrawTearoffEntry(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* The drawable we are drawing into */
+ GC gc, /* The gc we are drawing with */
+ Tk_Font tkfont, /* The font we are drawing with */
+ const Tk_FontMetrics *fmPtr,/* The metrics we are drawing with */
+ int x, int y,
+ int width, int height)
{
XPoint points[2];
int segmentWidth, maxX;
@@ -1231,12 +1188,12 @@ DrawTearoffEntry(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
if (menuPtr->menuType != MASTER_MENU) {
return;
}
-
+
points[0].x = x;
points[0].y = y + height/2;
points[1].y = points[0].y;
segmentWidth = 6;
- maxX = width - 1;
+ maxX = width - 1;
border = Tk_Get3DBorderFromObj(menuPtr->tkwin, menuPtr->borderPtr);
while (points[0].x < maxX) {
@@ -1255,24 +1212,25 @@ DrawTearoffEntry(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
*
* TkpInitializeMenuBindings --
*
- * For every interp, initializes the bindings for Windows
- * menus. Does nothing on Mac or XWindows.
+ * For every interp, initializes the bindings for Windows menus. Does
+ * nothing on Mac or XWindows.
*
* Results:
* None.
*
* Side effects:
- * C-level bindings are setup for the interp which will
- * handle Alt-key sequences for menus without beeping
- * or interfering with user-defined Alt-key bindings.
+ * C-level bindings are setup for the interp which will handle Alt-key
+ * sequences for menus without beeping or interfering with user-defined
+ * Alt-key bindings.
*
*--------------------------------------------------------------
*/
void
-TkpInitializeMenuBindings(interp, bindingTable)
- Tcl_Interp *interp; /* The interpreter to set. */
- Tk_BindingTable bindingTable; /* The table to add to. */
+TkpInitializeMenuBindings(
+ Tcl_Interp *interp, /* The interpreter to set. */
+ Tk_BindingTable bindingTable)
+ /* The table to add to. */
{
/*
* Nothing to do.
@@ -1284,9 +1242,9 @@ TkpInitializeMenuBindings(interp, bindingTable)
*
* SetHelpMenu --
*
- * Given a menu, check to see whether or not it is a help menu
- * cascade in a menubar. If it is, the entry that points to
- * this menu will be marked.
+ * Given a menu, check to see whether or not it is a help menu cascade in
+ * a menubar. If it is, the entry that points to this menu will be
+ * marked.
*
* RESULTS:
* None.
@@ -1298,10 +1256,22 @@ TkpInitializeMenuBindings(interp, bindingTable)
*/
static void
-SetHelpMenu(menuPtr)
- TkMenu *menuPtr; /* The menu we are checking */
+SetHelpMenu(
+ TkMenu *menuPtr) /* The menu we are checking */
{
TkMenuEntry *cascadeEntryPtr;
+ int useMotifHelp = 0;
+ const char *option = NULL;
+ if (menuPtr->tkwin) {
+ option = Tk_GetOption(menuPtr->tkwin, "useMotifHelp", "UseMotifHelp");
+ if (option != NULL) {
+ Tcl_GetBoolean(NULL, option, &useMotifHelp);
+ }
+ }
+
+ if (!useMotifHelp) {
+ return;
+ }
for (cascadeEntryPtr = menuPtr->menuRefPtr->parentEntryPtr;
cascadeEntryPtr != NULL;
@@ -1331,8 +1301,8 @@ SetHelpMenu(menuPtr)
*
* TkpDrawMenuEntry --
*
- * Draws the given menu entry at the given coordinates with the
- * given attributes.
+ * Draws the given menu entry at the given coordinates with the given
+ * attributes.
*
* Results:
* None.
@@ -1344,26 +1314,26 @@ SetHelpMenu(menuPtr)
*/
void
-TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
- strictMotif, drawArrow)
- TkMenuEntry *mePtr; /* The entry to draw */
- Drawable d; /* What to draw into */
- Tk_Font tkfont; /* Precalculated font for menu */
- CONST Tk_FontMetrics *menuMetricsPtr;
- /* Precalculated metrics for menu */
- int x; /* X-coordinate of topleft of entry */
- int y; /* Y-coordinate of topleft of entry */
- int width; /* Width of the entry rectangle */
- int height; /* Height of the current rectangle */
- int strictMotif; /* Boolean flag */
- int drawArrow; /* Whether or not to draw the cascade
- * arrow for cascade items. Only applies
- * to Windows. */
+TkpDrawMenuEntry(
+ TkMenuEntry *mePtr, /* The entry to draw */
+ Drawable d, /* What to draw into */
+ Tk_Font tkfont, /* Precalculated font for menu */
+ const Tk_FontMetrics *menuMetricsPtr,
+ /* Precalculated metrics for menu */
+ int x, /* X-coordinate of topleft of entry */
+ int y, /* Y-coordinate of topleft of entry */
+ int width, /* Width of the entry rectangle */
+ int height, /* Height of the current rectangle */
+ int strictMotif, /* Boolean flag */
+ int drawArrow) /* Whether or not to draw the cascade arrow
+ * for cascade items. Only applies to
+ * Windows. */
{
GC gc, indicatorGC;
+ XColor *indicatorColor, *disableColor = NULL;
TkMenu *menuPtr = mePtr->menuPtr;
Tk_3DBorder bgBorder, activeBorder;
- CONST Tk_FontMetrics *fmPtr;
+ const Tk_FontMetrics *fmPtr;
Tk_FontMetrics entryMetrics;
int padY = (menuPtr->menuType == MENUBAR) ? 3 : 0;
int adjustedY = y + padY;
@@ -1381,13 +1351,12 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
} else {
TkMenuEntry *cascadeEntryPtr;
int parentDisabled = 0;
-
+
for (cascadeEntryPtr = menuPtr->menuRefPtr->parentEntryPtr;
cascadeEntryPtr != NULL;
cascadeEntryPtr = cascadeEntryPtr->nextCascadePtr) {
if (cascadeEntryPtr->namePtr != NULL) {
- char *name = Tcl_GetStringFromObj(cascadeEntryPtr->namePtr,
- NULL);
+ const char *name = Tcl_GetString(cascadeEntryPtr->namePtr);
if (strcmp(name, Tk_PathName(menuPtr->tkwin)) == 0) {
if (cascadeEntryPtr->state == ENTRY_DISABLED) {
@@ -1415,6 +1384,18 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
if (indicatorGC == NULL) {
indicatorGC = menuPtr->indicatorGC;
}
+ if (mePtr->indicatorFgPtr) {
+ indicatorColor = Tk_GetColorFromObj(menuPtr->tkwin,
+ mePtr->indicatorFgPtr);
+ } else {
+ indicatorColor = Tk_GetColorFromObj(menuPtr->tkwin,
+ menuPtr->indicatorFgPtr);
+ }
+
+ if (menuPtr->disabledFgPtr != NULL) {
+ disableColor = Tk_GetColorFromObj(menuPtr->tkwin,
+ menuPtr->disabledFgPtr);
+ }
bgBorder = Tk_Get3DBorderFromObj(menuPtr->tkwin,
(mePtr->borderPtr == NULL)
@@ -1436,16 +1417,16 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
}
/*
- * Need to draw the entire background, including padding. On Unix,
- * for menubars, we have to draw the rest of the entry taking
- * into account the padding.
+ * Need to draw the entire background, including padding. On Unix, for
+ * menubars, we have to draw the rest of the entry taking into account the
+ * padding.
*/
-
- DrawMenuEntryBackground(menuPtr, mePtr, d, activeBorder,
+
+ DrawMenuEntryBackground(menuPtr, mePtr, d, activeBorder,
bgBorder, x, y, width, height);
-
+
if (mePtr->type == SEPARATOR_ENTRY) {
- DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont,
+ DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont,
fmPtr, x, adjustedY, width, adjustedHeight);
} else if (mePtr->type == TEAROFF_ENTRY) {
DrawTearoffEntry(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, adjustedY,
@@ -1456,8 +1437,12 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr,
activeBorder, x, adjustedY, width, adjustedHeight, drawArrow);
if (!mePtr->hideMargin) {
- DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont,
- fmPtr, x, adjustedY, width, adjustedHeight);
+ if (mePtr->state == ENTRY_ACTIVE) {
+ bgBorder = activeBorder;
+ }
+ DrawMenuEntryIndicator(menuPtr, mePtr, d, bgBorder, indicatorColor,
+ disableColor, tkfont, fmPtr, x, adjustedY, width,
+ adjustedHeight);
}
}
}
@@ -1480,77 +1465,94 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
*/
static void
-GetMenuLabelGeometry(mePtr, tkfont, fmPtr, widthPtr, heightPtr)
- TkMenuEntry *mePtr; /* The entry we are computing */
- Tk_Font tkfont; /* The precalculated font */
- CONST Tk_FontMetrics *fmPtr; /* The precalculated metrics */
- int *widthPtr; /* The resulting width of the label
- * portion */
- int *heightPtr; /* The resulting height of the label
- * portion */
+GetMenuLabelGeometry(
+ TkMenuEntry *mePtr, /* The entry we are computing */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated metrics */
+ int *widthPtr, /* The resulting width of the label portion */
+ int *heightPtr) /* The resulting height of the label
+ * portion */
{
TkMenu *menuPtr = mePtr->menuPtr;
int haveImage = 0;
-
+
if (mePtr->image != NULL) {
Tk_SizeOfImage(mePtr->image, widthPtr, heightPtr);
haveImage = 1;
- } else if (mePtr->bitmapPtr != NULL) {
+ } else if (mePtr->bitmapPtr != NULL) {
Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr);
+
Tk_SizeOfBitmap(menuPtr->display, bitmap, widthPtr, heightPtr);
haveImage = 1;
} else {
*heightPtr = 0;
*widthPtr = 0;
}
-
+
if (haveImage && (mePtr->compound == COMPOUND_NONE)) {
- /* We don't care about the text in this case */
+ /*
+ * We don't care about the text in this case.
+ */
} else {
- /* Either it is compound or we don't have an image */
+ /*
+ * Either it is compound or we don't have an image.
+ */
+
if (mePtr->labelPtr != NULL) {
int textWidth;
- char *label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
+ const char *label = Tcl_GetString(mePtr->labelPtr);
+
textWidth = Tk_TextWidth(tkfont, label, mePtr->labelLength);
-
if ((mePtr->compound != COMPOUND_NONE) && haveImage) {
switch ((enum compound) mePtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- if (textWidth > *widthPtr) {
- *widthPtr = textWidth;
- }
- /* Add text and padding */
- *heightPtr += fmPtr->linespace + 2;
- break;
+ case COMPOUND_TOP:
+ case COMPOUND_BOTTOM:
+ if (textWidth > *widthPtr) {
+ *widthPtr = textWidth;
+ }
+
+ /*
+ * Add text and padding.
+ */
+
+ *heightPtr += fmPtr->linespace + 2;
+ break;
+ case COMPOUND_LEFT:
+ case COMPOUND_RIGHT:
+ if (fmPtr->linespace > *heightPtr) {
+ *heightPtr = fmPtr->linespace;
}
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- if (fmPtr->linespace > *heightPtr) {
- *heightPtr = fmPtr->linespace;
- }
- /* Add text and padding */
- *widthPtr += textWidth + 2;
- break;
+
+ /*
+ * Add text and padding.
+ */
+
+ *widthPtr += textWidth + 2;
+ break;
+ case COMPOUND_CENTER:
+ if (fmPtr->linespace > *heightPtr) {
+ *heightPtr = fmPtr->linespace;
}
- case COMPOUND_CENTER: {
- if (fmPtr->linespace > *heightPtr) {
- *heightPtr = fmPtr->linespace;
- }
- if (textWidth > *widthPtr) {
- *widthPtr = textWidth;
- }
- break;
+ if (textWidth > *widthPtr) {
+ *widthPtr = textWidth;
}
- case COMPOUND_NONE: {break;}
+ break;
+ case COMPOUND_NONE:
+ break;
}
- } else {
- /* We don't have an image or we're not compound */
+ } else {
+ /*
+ * We don't have an image or we're not compound.
+ */
+
*heightPtr = fmPtr->linespace;
*widthPtr = textWidth;
}
} else {
- /* An empty entry still has this height */
+ /*
+ * An empty entry still has this height.
+ */
+
*heightPtr = fmPtr->linespace;
}
}
@@ -1562,33 +1564,30 @@ GetMenuLabelGeometry(mePtr, tkfont, fmPtr, widthPtr, heightPtr)
*
* TkpComputeStandardMenuGeometry --
*
- * This procedure is invoked to recompute the size and
- * layout of a menu that is not a menubar clone.
+ * This procedure is invoked to recompute the size and layout of a menu
+ * that is not a menubar clone.
*
* Results:
* None.
*
* Side effects:
- * Fields of menu entries are changed to reflect their
- * current positions, and the size of the menu window
- * itself may be changed.
+ * Fields of menu entries are changed to reflect their current positions,
+ * and the size of the menu window itself may be changed.
*
*--------------------------------------------------------------
*/
void
TkpComputeStandardMenuGeometry(
- menuPtr) /* Structure describing menu. */
- TkMenu *menuPtr;
+ TkMenu *menuPtr) /* Structure describing menu. */
{
Tk_Font tkfont, menuFont;
Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr;
int x, y, height, width, indicatorSpace, labelWidth, accelWidth;
- int windowWidth, windowHeight, accelSpace;
- int i, j, lastColumnBreak = 0;
+ int windowWidth, windowHeight, accelSpace, i, j, lastColumnBreak = 0;
TkMenuEntry *mePtr;
int borderWidth, activeBorderWidth;
-
+
if (menuPtr->tkwin == NULL) {
return;
}
@@ -1602,14 +1601,13 @@ TkpComputeStandardMenuGeometry(
windowHeight = windowWidth = 0;
/*
- * On the Mac especially, getting font metrics can be quite slow,
- * so we want to do it intelligently. We are going to precalculate
- * them and pass them down to all of the measuring and drawing
- * routines. We will measure the font metrics of the menu once.
- * If an entry does not have its own font set, then we give
- * the geometry/drawing routines the menu's font and metrics.
- * If an entry has its own font, we will measure that font and
- * give all of the geometry/drawing the entry's font and metrics.
+ * On the Mac especially, getting font metrics can be quite slow, so we
+ * want to do it intelligently. We are going to precalculate them and pass
+ * them down to all of the measuring and drawing routines. We will measure
+ * the font metrics of the menu once. If an entry does not have its own
+ * font set, then we give the geometry/drawing routines the menu's font
+ * and metrics. If an entry has its own font, we will measure that font
+ * and give all of the geometry/drawing the entry's font and metrics.
*/
menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
@@ -1648,28 +1646,25 @@ TkpComputeStandardMenuGeometry(
}
if (mePtr->type == SEPARATOR_ENTRY) {
- GetMenuSeparatorGeometry(menuPtr, mePtr, tkfont,
- fmPtr, &width, &height);
+ GetMenuSeparatorGeometry(menuPtr, mePtr, tkfont, fmPtr,
+ &width, &height);
mePtr->height = height;
} else if (mePtr->type == TEAROFF_ENTRY) {
- GetTearoffEntryGeometry(menuPtr, mePtr, tkfont,
- fmPtr, &width, &height);
+ GetTearoffEntryGeometry(menuPtr, mePtr, tkfont, fmPtr,
+ &width, &height);
mePtr->height = height;
labelWidth = width;
} else {
-
/*
- * For each entry, compute the height required by that
- * particular entry, plus three widths: the width of the
- * label, the width to allow for an indicator to be displayed
- * to the left of the label (if any), and the width of the
- * accelerator to be displayed to the right of the label
- * (if any). These sizes depend, of course, on the type
- * of the entry.
+ * For each entry, compute the height required by that particular
+ * entry, plus three widths: the width of the label, the width to
+ * allow for an indicator to be displayed to the left of the label
+ * (if any), and the width of the accelerator to be displayed to
+ * the right of the label (if any). These sizes depend, of course,
+ * on the type of the entry.
*/
-
- GetMenuLabelGeometry(mePtr, tkfont, fmPtr, &width,
- &height);
+
+ GetMenuLabelGeometry(mePtr, tkfont, fmPtr, &width, &height);
mePtr->height = height;
if (!mePtr->hideMargin) {
width += MENU_MARGIN_WIDTH;
@@ -1677,7 +1672,7 @@ TkpComputeStandardMenuGeometry(
if (width > labelWidth) {
labelWidth = width;
}
-
+
GetMenuAccelGeometry(menuPtr, mePtr, tkfont,
fmPtr, &width, &height);
if (height > mePtr->height) {
@@ -1690,8 +1685,8 @@ TkpComputeStandardMenuGeometry(
accelWidth = width;
}
- GetMenuIndicatorGeometry(menuPtr, mePtr, tkfont,
- fmPtr, &width, &height);
+ GetMenuIndicatorGeometry(menuPtr, mePtr, tkfont, fmPtr,
+ &width, &height);
if (height > mePtr->height) {
mePtr->height = height;
}
@@ -1704,7 +1699,7 @@ TkpComputeStandardMenuGeometry(
mePtr->height += 2 * activeBorderWidth + MENU_DIVIDER_HEIGHT;
}
- mePtr->y = y;
+ mePtr->y = y;
y += mePtr->height;
if (y > windowHeight) {
windowHeight = y;
@@ -1725,12 +1720,11 @@ TkpComputeStandardMenuGeometry(
windowWidth = x + indicatorSpace + labelWidth + accelWidth
+ 2 * activeBorderWidth + 2 * borderWidth;
-
windowHeight += borderWidth;
-
+
/*
- * The X server doesn't like zero dimensions, so round up to at least
- * 1 (a zero-sized menu should never really occur, anyway).
+ * The X server doesn't like zero dimensions, so round up to at least 1 (a
+ * zero-sized menu should never really occur, anyway).
*/
if (windowWidth <= 0) {
@@ -1749,8 +1743,8 @@ TkpComputeStandardMenuGeometry(
* TkpMenuNotifyToplevelCreate --
*
* This routine reconfigures the menu and the clones indicated by
- * menuName becuase a toplevel has been created and any system
- * menus need to be created. Not applicable to UNIX.
+ * menuName becuase a toplevel has been created and any system menus need
+ * to be created. Not applicable to UNIX.
*
* Results:
* None.
@@ -1762,10 +1756,9 @@ TkpComputeStandardMenuGeometry(
*/
void
-TkpMenuNotifyToplevelCreate(interp, menuName)
- Tcl_Interp *interp; /* The interp the menu lives in. */
- char *menuName; /* The name of the menu to
- * reconfigure. */
+TkpMenuNotifyToplevelCreate(
+ Tcl_Interp *interp, /* The interp the menu lives in. */
+ const char *menuName) /* The name of the menu to reconfigure. */
{
/*
* Nothing to do.
@@ -1789,7 +1782,7 @@ TkpMenuNotifyToplevelCreate(interp, menuName)
*/
void
-TkpMenuInit()
+TkpMenuInit(void)
{
/*
* Nothing to do.
@@ -1802,8 +1795,7 @@ TkpMenuInit()
*
* TkpMenuThreadInit --
*
- * Does platform-specific initialization of thread-specific
- * menu state.
+ * Does platform-specific initialization of thread-specific menu state.
*
* Results:
* None.
@@ -1815,10 +1807,17 @@ TkpMenuInit()
*/
void
-TkpMenuThreadInit()
+TkpMenuThreadInit(void)
{
/*
* Nothing to do.
*/
}
-
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c
index 35c7da8..ad71b7b 100644
--- a/unix/tkUnixMenubu.c
+++ b/unix/tkUnixMenubu.c
@@ -1,26 +1,18 @@
-/*
+/*
* tkUnixMenubu.c --
*
- * This file implements the Unix specific portion of the
- * menubutton widget.
+ * This file implements the Unix specific portion of the menubutton
+ * widget.
*
* Copyright (c) 1996-1997 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * 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 "tkMenubutton.h"
-/*
- * The structure below defines menubutton class behavior by means of
- * procedures that can be invoked from generic window code.
- */
-
-Tk_ClassProcs tkpMenubuttonClass = {
- sizeof(Tk_ClassProcs), /* size */
- TkMenuButtonWorldChanged, /* worldChangedProc */
-};
/*
*----------------------------------------------------------------------
@@ -39,10 +31,10 @@ Tk_ClassProcs tkpMenubuttonClass = {
*/
TkMenuButton *
-TkpCreateMenuButton(tkwin)
- Tk_Window tkwin;
+TkpCreateMenuButton(
+ Tk_Window tkwin)
{
- return (TkMenuButton *)ckalloc(sizeof(TkMenuButton));
+ return ckalloc(sizeof(TkMenuButton));
}
/*
@@ -50,35 +42,37 @@ TkpCreateMenuButton(tkwin)
*
* TkpDisplayMenuButton --
*
- * This procedure is invoked to display a menubutton widget.
+ * This function is invoked to display a menubutton widget.
*
* Results:
* None.
*
* Side effects:
- * Commands are output to X to display the menubutton in its
- * current mode.
+ * Commands are output to X to display the menubutton in its current
+ * mode.
*
*----------------------------------------------------------------------
*/
void
-TkpDisplayMenuButton(clientData)
- ClientData clientData; /* Information about widget. */
+TkpDisplayMenuButton(
+ ClientData clientData) /* Information about widget. */
{
register TkMenuButton *mbPtr = (TkMenuButton *) clientData;
GC gc;
Tk_3DBorder border;
Pixmap pixmap;
- int x = 0; /* Initialization needed only to stop
- * compiler warning. */
+ int x = 0; /* Initialization needed only to stop compiler
+ * warning. */
int y = 0;
register Tk_Window tkwin = mbPtr->tkwin;
- int width, height, fullWidth, fullHeight;
+ int fullWidth, fullHeight;
int textXOffset, textYOffset;
int imageWidth, imageHeight;
- int imageXOffset, imageYOffset; /* image information that will be used to
- * restrict disabled pixmap as well */
+ int imageXOffset, imageYOffset;
+ int width = 0, height = 0;
+ /* Image information that will be used to
+ * restrict disabled pixmap as well */
int haveImage = 0, haveText = 0;
mbPtr->flags &= ~REDRAW_PENDING;
@@ -105,16 +99,16 @@ TkpDisplayMenuButton(clientData)
Tk_SizeOfBitmap(mbPtr->display, mbPtr->bitmap, &width, &height);
haveImage = 1;
}
- imageWidth = width;
+ imageWidth = width;
imageHeight = height;
haveText = (mbPtr->textWidth != 0 && mbPtr->textHeight != 0);
/*
- * In order to avoid screen flashes, this procedure redraws
- * the menu button in a pixmap, then copies the pixmap to the
- * screen in a single operation. This means that there's no
- * point in time where the on-sreen image has been cleared.
+ * In order to avoid screen flashes, this function redraws the menu button
+ * in a pixmap, then copies the pixmap to the screen in a single
+ * operation. This means that there's no point in time where the on-sreen
+ * image has been cleared.
*/
pixmap = Tk_GetPixmap(mbPtr->display, Tk_WindowId(tkwin),
@@ -130,53 +124,58 @@ TkpDisplayMenuButton(clientData)
fullHeight = 0;
if (mbPtr->compound != COMPOUND_NONE && haveImage && haveText) {
- switch ((enum compound) mbPtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- /* Image is above or below text */
- if (mbPtr->compound == COMPOUND_TOP) {
- textYOffset = height + mbPtr->padY;
- } else {
- imageYOffset = mbPtr->textHeight + mbPtr->padY;
- }
- fullHeight = height + mbPtr->textHeight + mbPtr->padY;
- fullWidth = (width > mbPtr->textWidth ? width :
- mbPtr->textWidth);
- textXOffset = (fullWidth - mbPtr->textWidth)/2;
- imageXOffset = (fullWidth - width)/2;
- break;
- }
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- /* Image is left or right of text */
- if (mbPtr->compound == COMPOUND_LEFT) {
- textXOffset = width + mbPtr->padX;
- } else {
- imageXOffset = mbPtr->textWidth + mbPtr->padX;
- }
- fullWidth = mbPtr->textWidth + mbPtr->padX + width;
- fullHeight = (height > mbPtr->textHeight ? height :
- mbPtr->textHeight);
- textYOffset = (fullHeight - mbPtr->textHeight)/2;
- imageYOffset = (fullHeight - height)/2;
- break;
- }
- case COMPOUND_CENTER: {
- /* Image and text are superimposed */
- fullWidth = (width > mbPtr->textWidth ? width :
- mbPtr->textWidth);
- fullHeight = (height > mbPtr->textHeight ? height :
- mbPtr->textHeight);
- textXOffset = (fullWidth - mbPtr->textWidth)/2;
- imageXOffset = (fullWidth - width)/2;
- textYOffset = (fullHeight - mbPtr->textHeight)/2;
- imageYOffset = (fullHeight - height)/2;
- break;
- }
- case COMPOUND_NONE: {break;}
- }
-
- TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0,
+ switch ((enum compound) mbPtr->compound) {
+ case COMPOUND_TOP:
+ case COMPOUND_BOTTOM:
+ /*
+ * Image is above or below text.
+ */
+
+ if (mbPtr->compound == COMPOUND_TOP) {
+ textYOffset = height + mbPtr->padY;
+ } else {
+ imageYOffset = mbPtr->textHeight + mbPtr->padY;
+ }
+ fullHeight = height + mbPtr->textHeight + mbPtr->padY;
+ fullWidth = (width > mbPtr->textWidth ? width : mbPtr->textWidth);
+ textXOffset = (fullWidth - mbPtr->textWidth)/2;
+ imageXOffset = (fullWidth - width)/2;
+ break;
+ case COMPOUND_LEFT:
+ case COMPOUND_RIGHT:
+ /*
+ * Image is left or right of text.
+ */
+
+ if (mbPtr->compound == COMPOUND_LEFT) {
+ textXOffset = width + mbPtr->padX;
+ } else {
+ imageXOffset = mbPtr->textWidth + mbPtr->padX;
+ }
+ fullWidth = mbPtr->textWidth + mbPtr->padX + width;
+ fullHeight = (height > mbPtr->textHeight ? height :
+ mbPtr->textHeight);
+ textYOffset = (fullHeight - mbPtr->textHeight)/2;
+ imageYOffset = (fullHeight - height)/2;
+ break;
+ case COMPOUND_CENTER:
+ /*
+ * Image and text are superimposed.
+ */
+
+ fullWidth = (width > mbPtr->textWidth ? width : mbPtr->textWidth);
+ fullHeight = (height > mbPtr->textHeight ? height :
+ mbPtr->textHeight);
+ textXOffset = (fullWidth - mbPtr->textWidth)/2;
+ imageXOffset = (fullWidth - width)/2;
+ textYOffset = (fullHeight - mbPtr->textHeight)/2;
+ imageYOffset = (fullHeight - height)/2;
+ break;
+ case COMPOUND_NONE:
+ break;
+ }
+
+ TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0,
mbPtr->indicatorWidth + fullWidth, fullHeight, &x, &y);
imageXOffset += x;
@@ -187,7 +186,7 @@ TkpDisplayMenuButton(clientData)
} else if (mbPtr->bitmap != None) {
XSetClipOrigin(mbPtr->display, gc, imageXOffset, imageYOffset);
XCopyPlane(mbPtr->display, mbPtr->bitmap, pixmap,
- gc, 0, 0, (unsigned) width, (unsigned) height,
+ gc, 0, 0, (unsigned) width, (unsigned) height,
imageXOffset, imageYOffset, 1);
XSetClipOrigin(mbPtr->display, gc, 0, 0);
}
@@ -207,7 +206,7 @@ TkpDisplayMenuButton(clientData)
} else if (mbPtr->bitmap != None) {
XSetClipOrigin(mbPtr->display, gc, x, y);
XCopyPlane(mbPtr->display, mbPtr->bitmap, pixmap,
- gc, 0, 0, (unsigned) width, (unsigned) height,
+ gc, 0, 0, (unsigned) width, (unsigned) height,
x, y, 1);
XSetClipOrigin(mbPtr->display, gc, 0, 0);
}
@@ -215,7 +214,7 @@ TkpDisplayMenuButton(clientData)
TkComputeAnchor(mbPtr->anchor, tkwin, mbPtr->padX, mbPtr->padY,
mbPtr->textWidth + mbPtr->indicatorWidth,
mbPtr->textHeight, &x, &y);
- Tk_DrawTextLayout(mbPtr->display, pixmap, gc, mbPtr->textLayout,
+ Tk_DrawTextLayout(mbPtr->display, pixmap, gc, mbPtr->textLayout,
x + textXOffset, y + textYOffset, 0, -1);
Tk_UnderlineTextLayout(mbPtr->display, pixmap, gc,
mbPtr->textLayout, x + textXOffset, y + textYOffset,
@@ -227,12 +226,13 @@ TkpDisplayMenuButton(clientData)
* foreground color, generate the stippled effect.
*/
- if ((mbPtr->state == STATE_DISABLED)
- && ((mbPtr->disabledFg == NULL) || (mbPtr->image != NULL))) {
+ if ((mbPtr->state == STATE_DISABLED)
+ && ((mbPtr->disabledFg == NULL) || (mbPtr->image != NULL))) {
/*
- * Stipple the whole button if no disabledFg was specified,
- * otherwise restrict stippling only to displayed image
+ * Stipple the whole button if no disabledFg was specified, otherwise
+ * restrict stippling only to displayed image
*/
+
if (mbPtr->disabledFg == NULL) {
XFillRectangle(mbPtr->display, pixmap, mbPtr->stippleGC,
mbPtr->inset, mbPtr->inset,
@@ -246,8 +246,8 @@ TkpDisplayMenuButton(clientData)
}
/*
- * Draw the cascade indicator for the menu button on the
- * right side of the window, if desired.
+ * Draw the cascade indicator for the menu button on the right side of the
+ * window, if desired.
*/
if (mbPtr->indicatorOn) {
@@ -267,9 +267,9 @@ TkpDisplayMenuButton(clientData)
}
/*
- * Draw the border and traversal highlight last. This way, if the
- * menu button's contents overflow onto the border they'll be covered
- * up by the border.
+ * Draw the border and traversal highlight last. This way, if the menu
+ * button's contents overflow onto the border they'll be covered up by the
+ * border.
*/
if (mbPtr->relief != TK_RELIEF_FLAT) {
@@ -291,8 +291,8 @@ TkpDisplayMenuButton(clientData)
}
/*
- * Copy the information from the off-screen pixmap onto the screen,
- * then delete the pixmap.
+ * Copy the information from the off-screen pixmap onto the screen, then
+ * delete the pixmap.
*/
XCopyArea(mbPtr->display, pixmap, Tk_WindowId(tkwin),
@@ -318,8 +318,8 @@ TkpDisplayMenuButton(clientData)
*/
void
-TkpDestroyMenuButton(mbPtr)
- TkMenuButton *mbPtr;
+TkpDestroyMenuButton(
+ TkMenuButton *mbPtr)
{
}
@@ -328,7 +328,7 @@ TkpDestroyMenuButton(mbPtr)
*
* TkpComputeMenuButtonGeometry --
*
- * After changes in a menu button's text or bitmap, this procedure
+ * After changes in a menu button's text or bitmap, this function
* recomputes the menu button's geometry and passes this information
* along to the geometry manager for the window.
*
@@ -342,11 +342,11 @@ TkpDestroyMenuButton(mbPtr)
*/
void
-TkpComputeMenuButtonGeometry(mbPtr)
- TkMenuButton *mbPtr; /* Widget record for menu button. */
+TkpComputeMenuButtonGeometry(
+ TkMenuButton *mbPtr) /* Widget record for menu button. */
{
int width, height, mm, pixels;
- int avgWidth, txtWidth, txtHeight;
+ int avgWidth, txtWidth, txtHeight;
int haveImage = 0, haveText = 0;
Tk_FontMetrics fm;
@@ -374,88 +374,103 @@ TkpComputeMenuButtonGeometry(mbPtr)
&mbPtr->textHeight);
txtWidth = mbPtr->textWidth;
txtHeight = mbPtr->textHeight;
- avgWidth = Tk_TextWidth(mbPtr->tkfont, "0", 1);
- Tk_GetFontMetrics(mbPtr->tkfont, &fm);
- haveText = (txtWidth != 0 && txtHeight != 0);
+ avgWidth = Tk_TextWidth(mbPtr->tkfont, "0", 1);
+ Tk_GetFontMetrics(mbPtr->tkfont, &fm);
+ haveText = (txtWidth != 0 && txtHeight != 0);
}
/*
* If the menubutton is compound (ie, it shows both an image and text),
- * the new geometry is a combination of the image and text geometry.
- * We only honor the compound bit if the menubutton has both text and
- * an image, because otherwise it is not really a compound menubutton.
+ * the new geometry is a combination of the image and text geometry. We
+ * only honor the compound bit if the menubutton has both text and an
+ * image, because otherwise it is not really a compound menubutton.
*/
if (mbPtr->compound != COMPOUND_NONE && haveImage && haveText) {
- switch ((enum compound) mbPtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- /* Image is above or below text */
- height += txtHeight + mbPtr->padY;
- width = (width > txtWidth ? width : txtWidth);
- break;
- }
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- /* Image is left or right of text */
- width += txtWidth + mbPtr->padX;
- height = (height > txtHeight ? height : txtHeight);
- break;
- }
- case COMPOUND_CENTER: {
- /* Image and text are superimposed */
- width = (width > txtWidth ? width : txtWidth);
- height = (height > txtHeight ? height : txtHeight);
- break;
- }
- case COMPOUND_NONE: {break;}
- }
- if (mbPtr->width > 0) {
- width = mbPtr->width;
- }
- if (mbPtr->height > 0) {
- height = mbPtr->height;
- }
- width += 2*mbPtr->padX;
- height += 2*mbPtr->padY;
+ switch ((enum compound) mbPtr->compound) {
+ case COMPOUND_TOP:
+ case COMPOUND_BOTTOM:
+ /*
+ * Image is above or below text.
+ */
+
+ height += txtHeight + mbPtr->padY;
+ width = (width > txtWidth ? width : txtWidth);
+ break;
+ case COMPOUND_LEFT:
+ case COMPOUND_RIGHT:
+ /*
+ * Image is left or right of text.
+ */
+
+ width += txtWidth + mbPtr->padX;
+ height = (height > txtHeight ? height : txtHeight);
+ break;
+ case COMPOUND_CENTER:
+ /*
+ * Image and text are superimposed.
+ */
+
+ width = (width > txtWidth ? width : txtWidth);
+ height = (height > txtHeight ? height : txtHeight);
+ break;
+ case COMPOUND_NONE:
+ break;
+ }
+ if (mbPtr->width > 0) {
+ width = mbPtr->width;
+ }
+ if (mbPtr->height > 0) {
+ height = mbPtr->height;
+ }
+ width += 2*mbPtr->padX;
+ height += 2*mbPtr->padY;
} else {
if (haveImage) {
- if (mbPtr->width > 0) {
- width = mbPtr->width;
- }
- if (mbPtr->height > 0) {
- height = mbPtr->height;
- }
+ if (mbPtr->width > 0) {
+ width = mbPtr->width;
+ }
+ if (mbPtr->height > 0) {
+ height = mbPtr->height;
+ }
} else {
width = txtWidth;
height = txtHeight;
- if (mbPtr->width > 0) {
- width = mbPtr->width * avgWidth;
- }
- if (mbPtr->height > 0) {
- height = mbPtr->height * fm.linespace;
- }
+ if (mbPtr->width > 0) {
+ width = mbPtr->width * avgWidth;
+ }
+ if (mbPtr->height > 0) {
+ height = mbPtr->height * fm.linespace;
+ }
}
}
if (! haveImage) {
- width += 2*mbPtr->padX;
- height += 2*mbPtr->padY;
+ width += 2*mbPtr->padX;
+ height += 2*mbPtr->padY;
}
if (mbPtr->indicatorOn) {
- mm = WidthMMOfScreen(Tk_Screen(mbPtr->tkwin));
- pixels = WidthOfScreen(Tk_Screen(mbPtr->tkwin));
- mbPtr->indicatorHeight= (INDICATOR_HEIGHT * pixels)/(10*mm);
- mbPtr->indicatorWidth = (INDICATOR_WIDTH * pixels)/(10*mm)
- + 2*mbPtr->indicatorHeight;
- width += mbPtr->indicatorWidth;
+ mm = WidthMMOfScreen(Tk_Screen(mbPtr->tkwin));
+ pixels = WidthOfScreen(Tk_Screen(mbPtr->tkwin));
+ mbPtr->indicatorHeight= (INDICATOR_HEIGHT * pixels)/(10*mm);
+ mbPtr->indicatorWidth = (INDICATOR_WIDTH * pixels)/(10*mm)
+ + 2*mbPtr->indicatorHeight;
+ width += mbPtr->indicatorWidth;
} else {
- mbPtr->indicatorHeight = 0;
- mbPtr->indicatorWidth = 0;
+ mbPtr->indicatorHeight = 0;
+ mbPtr->indicatorWidth = 0;
}
Tk_GeometryRequest(mbPtr->tkwin, (int) (width + 2*mbPtr->inset),
(int) (height + 2*mbPtr->inset));
Tk_SetInternalBorder(mbPtr->tkwin, mbPtr->inset);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h
index 8445c82..64589be 100644
--- a/unix/tkUnixPort.h
+++ b/unix/tkUnixPort.h
@@ -17,21 +17,6 @@
#define __UNIX__ 1
-/*
- * Macro to use instead of "void" for arguments that must have
- * type "void *" in ANSI C; maps them to type "char *" in
- * non-ANSI systems. This macro may be used in some of the include
- * files below, which is why it is defined here.
- */
-
-#ifndef VOID
-# ifdef __STDC__
-# define VOID void
-# else
-# define VOID char
-# endif
-#endif
-
#include <stdio.h>
#include <ctype.h>
#include <fcntl.h>
@@ -67,6 +52,9 @@
# include <time.h>
# endif
#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
#ifndef NO_UNISTD_H
# include <unistd.h>
#else
@@ -146,9 +134,9 @@
* needed for X.
*/
-#define TkPutImage(colors, ncolors, display, pixels, gc, image, destx, desty, srcx, srcy, width, height) \
- XPutImage(display, pixels, gc, image, destx, desty, srcx, \
- srcy, width, height);
+#define TkPutImage(colors, ncolors, display, pixels, gc, image, srcx, srcy, destx, desty, width, height) \
+ XPutImage(display, pixels, gc, image, srcx, srcy, destx, \
+ desty, width, height);
/*
* Supply macros for seek offsets, if they're not already provided by
@@ -177,7 +165,7 @@
* These functions do nothing under Unix, so we just eliminate calls to them.
*/
-#define TkpButtonSetDefaults(specPtr) {}
+#define TkpButtonSetDefaults() {}
#define TkpDestroyButton(butPtr) {}
#define TkSelUpdateClipboard(a,b) {}
#define TkSetPixmapColormap(p,c) {}
@@ -199,13 +187,4 @@
#define TkpPrintWindowId(buf,w) \
sprintf((buf), "%#08lx", (unsigned long) (w))
-/*
- * The following declaration is used to get access to a private Tcl interface
- * that is needed for portability reasons.
- */
-
-#ifndef _TCLINT
-#include <tclInt.h>
-#endif
-
#endif /* _UNIXPORT */
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c
new file mode 100644
index 0000000..bad52d9
--- /dev/null
+++ b/unix/tkUnixRFont.c
@@ -0,0 +1,1101 @@
+/*
+ * tkUnixRFont.c --
+ *
+ * Alternate implementation of tkUnixFont.c using Xft.
+ *
+ * Copyright (c) 2002-2003 Keith Packard
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkUnixInt.h"
+#include "tkFont.h"
+#include <X11/Xft/Xft.h>
+#include <ctype.h>
+
+typedef struct {
+ XftFont *ftFont;
+ XftFont *ft0Font;
+ FcPattern *source;
+ FcCharSet *charset;
+ double angle;
+} UnixFtFace;
+
+typedef struct {
+ TkFont font; /* Stuff used by generic font package. Must be
+ * first in structure. */
+ UnixFtFace *faces;
+ int nfaces;
+ FcFontSet *fontset;
+ FcPattern *pattern;
+
+ Display *display;
+ int screen;
+ XftDraw *ftDraw;
+ XftColor color;
+} UnixFtFont;
+
+/*
+ * Package initialization:
+ * Nothing to do here except register the fact that we're using Xft in
+ * the TIP 59 configuration database.
+ */
+
+#ifndef TCL_CFGVAL_ENCODING
+#define TCL_CFGVAL_ENCODING "ascii"
+#endif
+
+void
+TkpFontPkgInit(
+ TkMainInfo *mainPtr) /* The application being created. */
+{
+ static Tcl_Config cfg[] = {
+ { "fontsystem", "xft" },
+ { 0,0 }
+ };
+
+ Tcl_RegisterConfig(mainPtr->interp, "tk", cfg, TCL_CFGVAL_ENCODING);
+}
+
+static XftFont *
+GetFont(
+ UnixFtFont *fontPtr,
+ FcChar32 ucs4,
+ double angle)
+{
+ int i;
+
+ if (ucs4) {
+ for (i = 0; i < fontPtr->nfaces; i++) {
+ FcCharSet *charset = fontPtr->faces[i].charset;
+
+ if (charset && FcCharSetHasChar(charset, ucs4)) {
+ break;
+ }
+ }
+ if (i == fontPtr->nfaces) {
+ i = 0;
+ }
+ } else {
+ i = 0;
+ }
+ if ((angle == 0.0 && !fontPtr->faces[i].ft0Font) || (angle != 0.0 &&
+ (!fontPtr->faces[i].ftFont || fontPtr->faces[i].angle != angle))){
+ FcPattern *pat = FcFontRenderPrepare(0, fontPtr->pattern,
+ fontPtr->faces[i].source);
+ double s = sin(angle*PI/180.0), c = cos(angle*PI/180.0);
+ FcMatrix mat;
+ XftFont *ftFont;
+
+ /*
+ * Initialize the matrix manually so this can compile with HP-UX cc
+ * (which does not allow non-constant structure initializers). [Bug
+ * 2978410]
+ */
+
+ mat.xx = mat.yy = c;
+ mat.xy = -(mat.yx = s);
+
+ if (angle != 0.0) {
+ FcPatternAddMatrix(pat, FC_MATRIX, &mat);
+ }
+ ftFont = XftFontOpenPattern(fontPtr->display, pat);
+ if (!ftFont) {
+ /*
+ * The previous call to XftFontOpenPattern() should not fail, but
+ * sometimes does anyway. Usual cause appears to be a
+ * misconfigured fontconfig installation; see [Bug 1090382]. Try a
+ * fallback:
+ */
+
+ ftFont = XftFontOpen(fontPtr->display, fontPtr->screen,
+ FC_FAMILY, FcTypeString, "sans",
+ FC_SIZE, FcTypeDouble, 12.0,
+ FC_MATRIX, FcTypeMatrix, &mat,
+ (void *) NULL);
+ }
+ if (!ftFont) {
+ /*
+ * The previous call should definitely not fail. Impossible to
+ * proceed at this point.
+ */
+
+ Tcl_Panic("Cannot find a usable font");
+ }
+
+ if (angle == 0.0) {
+ fontPtr->faces[i].ft0Font = ftFont;
+ } else {
+ if (fontPtr->faces[i].ftFont) {
+ XftFontClose(fontPtr->display, fontPtr->faces[i].ftFont);
+ }
+ fontPtr->faces[i].ftFont = ftFont;
+ fontPtr->faces[i].angle = angle;
+ }
+ }
+ return (angle==0.0? fontPtr->faces[i].ft0Font : fontPtr->faces[i].ftFont);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * GetTkFontAttributes --
+ * Fill in TkFontAttributes from an XftFont.
+ */
+
+static void
+GetTkFontAttributes(
+ XftFont *ftFont,
+ TkFontAttributes *faPtr)
+{
+ const char *family = "Unknown";
+ const char *const *familyPtr = &family;
+ int weight, slant, size, pxsize;
+ double ptsize;
+
+ (void) XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, familyPtr);
+ if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0,
+ &ptsize) == XftResultMatch) {
+ size = (int) ptsize;
+ } else if (XftPatternGetInteger(ftFont->pattern, XFT_PIXEL_SIZE, 0,
+ &pxsize) == XftResultMatch) {
+ size = -pxsize;
+ } else {
+ size = 12;
+ }
+ if (XftPatternGetInteger(ftFont->pattern, XFT_WEIGHT, 0,
+ &weight) != XftResultMatch) {
+ weight = XFT_WEIGHT_MEDIUM;
+ }
+ if (XftPatternGetInteger(ftFont->pattern, XFT_SLANT, 0,
+ &slant) != XftResultMatch) {
+ slant = XFT_SLANT_ROMAN;
+ }
+
+#if DEBUG_FONTSEL
+ printf("family %s size %d weight %d slant %d\n",
+ family, size, weight, slant);
+#endif /* DEBUG_FONTSEL */
+
+ faPtr->family = Tk_GetUid(family);
+ faPtr->size = size;
+ faPtr->weight = (weight > XFT_WEIGHT_MEDIUM) ? TK_FW_BOLD : TK_FW_NORMAL;
+ faPtr->slant = (slant > XFT_SLANT_ROMAN) ? TK_FS_ITALIC : TK_FS_ROMAN;
+ faPtr->underline = 0;
+ faPtr->overstrike = 0;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * GetTkFontMetrics --
+ * Fill in TkFontMetrics from an XftFont.
+ */
+
+static void
+GetTkFontMetrics(
+ XftFont *ftFont,
+ TkFontMetrics *fmPtr)
+{
+ int spacing;
+
+ if (XftPatternGetInteger(ftFont->pattern, XFT_SPACING, 0,
+ &spacing) != XftResultMatch) {
+ spacing = XFT_PROPORTIONAL;
+ }
+
+ fmPtr->ascent = ftFont->ascent;
+ fmPtr->descent = ftFont->descent;
+ fmPtr->maxWidth = ftFont->max_advance_width;
+ fmPtr->fixed = spacing != XFT_PROPORTIONAL;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * InitFont --
+ *
+ * Initializes the fields of a UnixFtFont structure. If fontPtr is NULL,
+ * also allocates a new UnixFtFont.
+ *
+ * Results:
+ * On error, frees fontPtr and returns NULL, otherwise returns fontPtr.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static UnixFtFont *
+InitFont(
+ Tk_Window tkwin,
+ FcPattern *pattern,
+ UnixFtFont *fontPtr)
+{
+ FcFontSet *set;
+ FcCharSet *charset;
+ FcResult result;
+ XftFont *ftFont;
+ int i, iWidth;
+
+ if (!fontPtr) {
+ fontPtr = ckalloc(sizeof(UnixFtFont));
+ }
+
+ FcConfigSubstitute(0, pattern, FcMatchPattern);
+ XftDefaultSubstitute(Tk_Display(tkwin), Tk_ScreenNumber(tkwin), pattern);
+
+ /*
+ * Generate the list of fonts
+ */
+
+ set = FcFontSort(0, pattern, FcTrue, NULL, &result);
+ if (!set) {
+ ckfree(fontPtr);
+ return NULL;
+ }
+
+ fontPtr->fontset = set;
+ fontPtr->pattern = pattern;
+ fontPtr->faces = ckalloc(set->nfont * sizeof(UnixFtFace));
+ fontPtr->nfaces = set->nfont;
+
+ /*
+ * Fill in information about each returned font
+ */
+
+ for (i = 0; i < set->nfont; i++) {
+ fontPtr->faces[i].ftFont = 0;
+ fontPtr->faces[i].ft0Font = 0;
+ fontPtr->faces[i].source = set->fonts[i];
+ if (FcPatternGetCharSet(set->fonts[i], FC_CHARSET, 0,
+ &charset) == FcResultMatch) {
+ fontPtr->faces[i].charset = FcCharSetCopy(charset);
+ } else {
+ fontPtr->faces[i].charset = 0;
+ }
+ fontPtr->faces[i].angle = 0.0;
+ }
+
+ fontPtr->display = Tk_Display(tkwin);
+ fontPtr->screen = Tk_ScreenNumber(tkwin);
+ fontPtr->ftDraw = 0;
+ fontPtr->color.color.red = 0;
+ fontPtr->color.color.green = 0;
+ fontPtr->color.color.blue = 0;
+ fontPtr->color.color.alpha = 0xffff;
+ fontPtr->color.pixel = 0xffffffff;
+
+ /*
+ * Fill in platform-specific fields of TkFont.
+ */
+
+ ftFont = GetFont(fontPtr, 0, 0.0);
+ fontPtr->font.fid = XLoadFont(Tk_Display(tkwin), "fixed");
+ GetTkFontAttributes(ftFont, &fontPtr->font.fa);
+ GetTkFontMetrics(ftFont, &fontPtr->font.fm);
+
+ /*
+ * Fontconfig can't report any information about the position or thickness
+ * of underlines or overstrikes. Thus, we use some defaults that are
+ * hacked around from backup defaults in tkUnixFont.c, which are in turn
+ * based on recommendations in the X manual. The comments from that file
+ * leading to these computations were:
+ *
+ * If the XA_UNDERLINE_POSITION property does not exist, the X manual
+ * recommends using half the descent.
+ *
+ * If the XA_UNDERLINE_THICKNESS property does not exist, the X
+ * manual recommends using the width of the stem on a capital letter.
+ * I don't know of a way to get the stem width of a letter, so guess
+ * and use 1/3 the width of a capital I.
+ *
+ * Note that nothing corresponding to *either* property is reported by
+ * Fontconfig at all. [Bug 1961455]
+ */
+
+ {
+ TkFont *fPtr = &fontPtr->font;
+
+ fPtr->underlinePos = fPtr->fm.descent / 2;
+ Tk_MeasureChars((Tk_Font) fPtr, "I", 1, -1, 0, &iWidth);
+ fPtr->underlineHeight = iWidth / 3;
+ if (fPtr->underlineHeight == 0) {
+ fPtr->underlineHeight = 1;
+ }
+ if (fPtr->underlineHeight + fPtr->underlinePos > fPtr->fm.descent) {
+ fPtr->underlineHeight = fPtr->fm.descent - fPtr->underlinePos;
+ if (fPtr->underlineHeight == 0) {
+ fPtr->underlinePos--;
+ fPtr->underlineHeight = 1;
+ }
+ }
+ }
+
+ return fontPtr;
+}
+
+static void
+FinishedWithFont(
+ UnixFtFont *fontPtr)
+{
+ Display *display = fontPtr->display;
+ int i;
+ Tk_ErrorHandler handler =
+ Tk_CreateErrorHandler(display, -1, -1, -1, NULL, NULL);
+
+ for (i = 0; i < fontPtr->nfaces; i++) {
+ if (fontPtr->faces[i].ftFont) {
+ XftFontClose(fontPtr->display, fontPtr->faces[i].ftFont);
+ }
+ if (fontPtr->faces[i].ft0Font) {
+ XftFontClose(fontPtr->display, fontPtr->faces[i].ft0Font);
+ }
+ if (fontPtr->faces[i].charset) {
+ FcCharSetDestroy(fontPtr->faces[i].charset);
+ }
+ }
+ if (fontPtr->faces) {
+ ckfree(fontPtr->faces);
+ }
+ if (fontPtr->pattern) {
+ FcPatternDestroy(fontPtr->pattern);
+ }
+ if (fontPtr->ftDraw) {
+ XftDrawDestroy(fontPtr->ftDraw);
+ }
+ if (fontPtr->font.fid) {
+ XUnloadFont(fontPtr->display, fontPtr->font.fid);
+ }
+ if (fontPtr->fontset) {
+ FcFontSetDestroy(fontPtr->fontset);
+ }
+ Tk_DeleteErrorHandler(handler);
+}
+
+TkFont *
+TkpGetNativeFont(
+ Tk_Window tkwin, /* For display where font will be used. */
+ const char *name) /* Platform-specific font name. */
+{
+ UnixFtFont *fontPtr;
+ FcPattern *pattern;
+#if DEBUG_FONTSEL
+ printf("TkpGetNativeFont %s\n", name);
+#endif /* DEBUG_FONTSEL */
+
+ pattern = XftXlfdParse(name, FcFalse, FcFalse);
+ if (!pattern) {
+ return NULL;
+ }
+
+ /*
+ * Should also try: pattern = FcNameParse(name); but generic/tkFont.c
+ * expects TkpGetNativeFont() to only work on XLFD names under Unix.
+ */
+
+ fontPtr = InitFont(tkwin, pattern, NULL);
+ if (!fontPtr) {
+ FcPatternDestroy(pattern);
+ return NULL;
+ }
+ return &fontPtr->font;
+}
+
+TkFont *
+TkpGetFontFromAttributes(
+ TkFont *tkFontPtr, /* If non-NULL, store the information in this
+ * existing TkFont structure, rather than
+ * allocating a new structure to hold the
+ * font; the existing contents of the font
+ * will be released. If NULL, a new TkFont
+ * structure is allocated. */
+ Tk_Window tkwin, /* For display where font will be used. */
+ const TkFontAttributes *faPtr)
+ /* Set of attributes to match. */
+{
+ XftPattern *pattern;
+ int weight, slant;
+ UnixFtFont *fontPtr;
+
+#if DEBUG_FONTSEL
+ printf("TkpGetFontFromAttributes %s-%d %d %d\n", faPtr->family,
+ faPtr->size, faPtr->weight, faPtr->slant);
+#endif /* DEBUG_FONTSEL */
+ pattern = XftPatternCreate();
+ if (faPtr->family) {
+ XftPatternAddString(pattern, XFT_FAMILY, faPtr->family);
+ }
+ if (faPtr->size > 0) {
+ XftPatternAddDouble(pattern, XFT_SIZE, (double)faPtr->size);
+ } else if (faPtr->size < 0) {
+ XftPatternAddInteger(pattern, XFT_PIXEL_SIZE, -faPtr->size);
+ } else {
+ XftPatternAddDouble(pattern, XFT_SIZE, 12.0);
+ }
+ switch (faPtr->weight) {
+ case TK_FW_NORMAL:
+ default:
+ weight = XFT_WEIGHT_MEDIUM;
+ break;
+ case TK_FW_BOLD:
+ weight = XFT_WEIGHT_BOLD;
+ break;
+ }
+ XftPatternAddInteger(pattern, XFT_WEIGHT, weight);
+ switch (faPtr->slant) {
+ case TK_FS_ROMAN:
+ default:
+ slant = XFT_SLANT_ROMAN;
+ break;
+ case TK_FS_ITALIC:
+ slant = XFT_SLANT_ITALIC;
+ break;
+ case TK_FS_OBLIQUE:
+ slant = XFT_SLANT_OBLIQUE;
+ break;
+ }
+ XftPatternAddInteger(pattern, XFT_SLANT, slant);
+
+ fontPtr = (UnixFtFont *) tkFontPtr;
+ if (fontPtr != NULL) {
+ FinishedWithFont(fontPtr);
+ }
+ fontPtr = InitFont(tkwin, pattern, fontPtr);
+
+ /*
+ * Hack to work around issues with weird issues with Xft/Xrender
+ * connection. For details, see comp.lang.tcl thread starting from
+ * <adcc99ed-c73e-4efc-bb5d-e57a57a051e8@l35g2000pra.googlegroups.com>
+ */
+
+ if (!fontPtr) {
+ XftPatternAddBool(pattern, XFT_RENDER, FcFalse);
+ fontPtr = InitFont(tkwin, pattern, fontPtr);
+ }
+
+ if (!fontPtr) {
+ FcPatternDestroy(pattern);
+ return NULL;
+ }
+
+ fontPtr->font.fa.underline = faPtr->underline;
+ fontPtr->font.fa.overstrike = faPtr->overstrike;
+ return &fontPtr->font;
+}
+
+void
+TkpDeleteFont(
+ TkFont *tkFontPtr) /* Token of font to be deleted. */
+{
+ UnixFtFont *fontPtr = (UnixFtFont *) tkFontPtr;
+
+ FinishedWithFont(fontPtr);
+ /* XXX tkUnixFont.c doesn't free tkFontPtr... */
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkpGetFontFamilies --
+ *
+ * Return information about the font families that are available on the
+ * display of the given window.
+ *
+ * Results:
+ * Modifies interp's result object to hold a list of all the available
+ * font families.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+void
+TkpGetFontFamilies(
+ Tcl_Interp *interp, /* Interp to hold result. */
+ Tk_Window tkwin) /* For display to query. */
+{
+ Tcl_Obj *resultPtr;
+ XftFontSet *list;
+ int i;
+
+ resultPtr = Tcl_NewListObj(0, NULL);
+
+ list = XftListFonts(Tk_Display(tkwin), Tk_ScreenNumber(tkwin),
+ (char *) 0, /* pattern elements */
+ XFT_FAMILY, (char*) 0); /* fields */
+ for (i = 0; i < list->nfont; i++) {
+ char *family, **familyPtr = &family;
+
+ if (XftPatternGetString(list->fonts[i], XFT_FAMILY, 0, familyPtr)
+ == XftResultMatch) {
+ Tcl_Obj *strPtr = Tcl_NewStringObj(family, -1);
+
+ Tcl_ListObjAppendElement(NULL, resultPtr, strPtr);
+ }
+ }
+ XftFontSetDestroy(list);
+
+ Tcl_SetObjResult(interp, resultPtr);
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * TkpGetSubFonts --
+ *
+ * Called by [testfont subfonts] in the Tk testing package.
+ *
+ * Results:
+ * Sets interp's result to a list of the faces used by tkfont
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void
+TkpGetSubFonts(
+ Tcl_Interp *interp,
+ Tk_Font tkfont)
+{
+ Tcl_Obj *objv[3], *listPtr, *resultPtr;
+ UnixFtFont *fontPtr = (UnixFtFont *) tkfont;
+ FcPattern *pattern;
+ const char *family = "Unknown";
+ const char *const *familyPtr = &family;
+ const char *foundry = "Unknown";
+ const char *const *foundryPtr = &foundry;
+ const char *encoding = "Unknown";
+ const char *const *encodingPtr = &encoding;
+ int i;
+
+ resultPtr = Tcl_NewListObj(0, NULL);
+
+ for (i = 0; i < fontPtr->nfaces ; ++i) {
+ pattern = FcFontRenderPrepare(0, fontPtr->pattern,
+ fontPtr->faces[i].source);
+
+ XftPatternGetString(pattern, XFT_FAMILY, 0, familyPtr);
+ XftPatternGetString(pattern, XFT_FOUNDRY, 0, foundryPtr);
+ XftPatternGetString(pattern, XFT_ENCODING, 0, encodingPtr);
+ objv[0] = Tcl_NewStringObj(family, -1);
+ objv[1] = Tcl_NewStringObj(foundry, -1);
+ objv[2] = Tcl_NewStringObj(encoding, -1);
+ listPtr = Tcl_NewListObj(3, objv);
+ Tcl_ListObjAppendElement(NULL, resultPtr, listPtr);
+ }
+ Tcl_SetObjResult(interp, resultPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetFontAttrsForChar --
+ *
+ * Retrieve the font attributes of the actual font used to render a given
+ * character.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpGetFontAttrsForChar(
+ Tk_Window tkwin, /* Window on the font's display */
+ Tk_Font tkfont, /* Font to query */
+ Tcl_UniChar c, /* Character of interest */
+ TkFontAttributes *faPtr) /* Output: Font attributes */
+{
+ UnixFtFont *fontPtr = (UnixFtFont *) tkfont;
+ /* Structure describing the logical font */
+ FcChar32 ucs4 = (FcChar32) c;
+ /* UCS-4 character to map */
+ XftFont *ftFont = GetFont(fontPtr, ucs4, 0.0);
+ /* Actual font used to render the character */
+
+ GetTkFontAttributes(ftFont, faPtr);
+ faPtr->underline = fontPtr->font.fa.underline;
+ faPtr->overstrike = fontPtr->font.fa.overstrike;
+}
+
+int
+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
+ * source string. */
+ 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
+ * is unbounded and the flags argument is
+ * ignored. */
+ int flags, /* Various flag bits OR-ed together:
+ * TK_PARTIAL_OK means include the last char
+ * which only partially fit on this line.
+ * TK_WHOLE_WORDS means stop on a word
+ * boundary, if possible. TK_AT_LEAST_ONE
+ * means return at least one character even if
+ * no characters fit. */
+ int *lengthPtr) /* Filled with x-location just after the
+ * terminating character. */
+{
+ UnixFtFont *fontPtr = (UnixFtFont *) tkfont;
+ XftFont *ftFont;
+ FcChar32 c;
+ XGlyphInfo extents;
+ int clen, curX, newX, curByte, newByte, sawNonSpace;
+ int termByte = 0, termX = 0;
+#if DEBUG_FONTSEL
+ char string[256];
+ int len = 0;
+#endif /* DEBUG_FONTSEL */
+
+ curX = 0;
+ curByte = 0;
+ sawNonSpace = 0;
+ while (numBytes > 0) {
+ Tcl_UniChar unichar;
+
+ clen = Tcl_UtfToUniChar(source, &unichar);
+ c = (FcChar32) unichar;
+
+ if (clen <= 0) {
+ /*
+ * This can't happen (but see #1185640)
+ */
+
+ *lengthPtr = curX;
+ return curByte;
+ }
+
+ source += clen;
+ numBytes -= clen;
+ if (c < 256 && isspace(c)) { /* I18N: ??? */
+ if (sawNonSpace) {
+ termByte = curByte;
+ termX = curX;
+ sawNonSpace = 0;
+ }
+ } else {
+ sawNonSpace = 1;
+ }
+
+#if DEBUG_FONTSEL
+ string[len++] = (char) c;
+#endif /* DEBUG_FONTSEL */
+ ftFont = GetFont(fontPtr, c, 0.0);
+
+ XftTextExtents32(fontPtr->display, ftFont, &c, 1, &extents);
+
+ newX = curX + extents.xOff;
+ newByte = curByte + clen;
+ if (maxLength >= 0 && newX > maxLength) {
+ if (flags & TK_PARTIAL_OK ||
+ (flags & TK_AT_LEAST_ONE && curByte == 0)) {
+ curX = newX;
+ curByte = newByte;
+ } else if (flags & TK_WHOLE_WORDS && termX != 0) {
+ curX = termX;
+ curByte = termByte;
+ }
+ break;
+ }
+
+ curX = newX;
+ curByte = newByte;
+ }
+#if DEBUG_FONTSEL
+ string[len] = '\0';
+ printf("MeasureChars %s length %d bytes %d\n", string, curX, curByte);
+#endif /* DEBUG_FONTSEL */
+ *lengthPtr = curX;
+ return curByte;
+}
+
+int
+TkpMeasureCharsInContext(
+ Tk_Font tkfont,
+ const char *source,
+ int numBytes,
+ int rangeStart,
+ int rangeLength,
+ int maxLength,
+ int flags,
+ int *lengthPtr)
+{
+ (void) numBytes; /*unused*/
+
+ return Tk_MeasureChars(tkfont, source + rangeStart, rangeLength,
+ maxLength, flags, lengthPtr);
+}
+
+#define NUM_SPEC 1024
+
+void
+Tk_DrawChars(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ GC gc, /* Graphics context for drawing characters. */
+ Tk_Font tkfont, /* Font in which characters will be drawn;
+ * must be the same as font used in GC. */
+ const char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. All Tk meta-characters
+ * (tabs, control characters, and newlines)
+ * should be stripped out of the string that
+ * 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. */
+ int x, int y) /* Coordinates at which to place origin of
+ * string when drawing. */
+{
+ const int maxCoord = 0x7FFF;/* Xft coordinates are 16 bit values */
+ UnixFtFont *fontPtr = (UnixFtFont *) tkfont;
+ XGCValues values;
+ XColor xcolor;
+ int clen, nspec, xStart = x;
+ XftGlyphFontSpec specs[NUM_SPEC];
+ XGlyphInfo metrics;
+
+ if (fontPtr->ftDraw == 0) {
+#if DEBUG_FONTSEL
+ printf("Switch to drawable 0x%x\n", drawable);
+#endif /* DEBUG_FONTSEL */
+ fontPtr->ftDraw = XftDrawCreate(display, drawable,
+ DefaultVisual(display, fontPtr->screen),
+ DefaultColormap(display, fontPtr->screen));
+ } else {
+ Tk_ErrorHandler handler =
+ Tk_CreateErrorHandler(display, -1, -1, -1, NULL, NULL);
+
+ XftDrawChange(fontPtr->ftDraw, drawable);
+ Tk_DeleteErrorHandler(handler);
+ }
+ XGetGCValues(display, gc, GCForeground, &values);
+ if (values.foreground != fontPtr->color.pixel) {
+ xcolor.pixel = values.foreground;
+ XQueryColor(display, DefaultColormap(display, fontPtr->screen),
+ &xcolor);
+ fontPtr->color.color.red = xcolor.red;
+ fontPtr->color.color.green = xcolor.green;
+ fontPtr->color.color.blue = xcolor.blue;
+ fontPtr->color.color.alpha = 0xffff;
+ fontPtr->color.pixel = values.foreground;
+ }
+ nspec = 0;
+ while (numBytes > 0 && x <= maxCoord && y <= maxCoord) {
+ XftFont *ftFont;
+ FcChar32 c;
+
+ clen = FcUtf8ToUcs4((FcChar8 *) source, &c, numBytes);
+ if (clen <= 0) {
+ /*
+ * This should not happen, but it can.
+ */
+
+ goto doUnderlineStrikeout;
+ }
+ source += clen;
+ numBytes -= clen;
+
+ ftFont = GetFont(fontPtr, c, 0.0);
+ if (ftFont) {
+ specs[nspec].font = ftFont;
+ specs[nspec].glyph = XftCharIndex(fontPtr->display, ftFont, c);
+ specs[nspec].x = x;
+ specs[nspec].y = y;
+ XftGlyphExtents(fontPtr->display, ftFont, &specs[nspec].glyph, 1,
+ &metrics);
+ x += metrics.xOff;
+ y += metrics.yOff;
+ nspec++;
+ if (nspec == NUM_SPEC) {
+ XftDrawGlyphFontSpec(fontPtr->ftDraw, &fontPtr->color,
+ specs, nspec);
+ nspec = 0;
+ }
+ }
+ }
+ if (nspec) {
+ XftDrawGlyphFontSpec(fontPtr->ftDraw, &fontPtr->color, specs, nspec);
+ }
+
+ doUnderlineStrikeout:
+ if (fontPtr->font.fa.underline != 0) {
+ XFillRectangle(display, drawable, gc, xStart,
+ y + fontPtr->font.underlinePos, (unsigned) (x - xStart),
+ (unsigned) fontPtr->font.underlineHeight);
+ }
+ if (fontPtr->font.fa.overstrike != 0) {
+ y -= fontPtr->font.fm.descent + (fontPtr->font.fm.ascent) / 10;
+ XFillRectangle(display, drawable, gc, xStart, y,
+ (unsigned) (x - xStart),
+ (unsigned) fontPtr->font.underlineHeight);
+ }
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkDrawAngledChars --
+ *
+ * Draw some characters at an angle. This would be simple code, except
+ * Xft has bugs with cumulative errors in character positioning which are
+ * caused by trying to perform all calculations internally with integers.
+ * So we have to do the work ourselves with floating-point math.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Target drawable is updated.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+void
+TkDrawAngledChars(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ GC gc, /* Graphics context for drawing characters. */
+ Tk_Font tkfont, /* Font in which characters will be drawn;
+ * must be the same as font used in GC. */
+ const char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. All Tk meta-characters
+ * (tabs, control characters, and newlines)
+ * should be stripped out of the string that
+ * 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. */
+ double x, double y, /* Coordinates at which to place origin of
+ * string when drawing. */
+ double angle) /* What angle to put text at, in degrees. */
+{
+ const int maxCoord = 0x7FFF;/* Xft coordinates are 16 bit values */
+ const int minCoord = -1000; /* Should be good enough... */
+ UnixFtFont *fontPtr = (UnixFtFont *) tkfont;
+ XGCValues values;
+ XColor xcolor;
+ int xStart = x, yStart = y;
+#ifdef XFT_HAS_FIXED_ROTATED_PLACEMENT
+ int clen, nglyph;
+ FT_UInt glyphs[NUM_SPEC];
+ XGlyphInfo metrics;
+ XftFont *currentFtFont;
+ int originX, originY;
+
+ if (fontPtr->ftDraw == 0) {
+#if DEBUG_FONTSEL
+ printf("Switch to drawable 0x%x\n", drawable);
+#endif /* DEBUG_FONTSEL */
+ fontPtr->ftDraw = XftDrawCreate(display, drawable,
+ DefaultVisual(display, fontPtr->screen),
+ DefaultColormap(display, fontPtr->screen));
+ } else {
+ Tk_ErrorHandler handler =
+ Tk_CreateErrorHandler(display, -1, -1, -1, NULL, NULL);
+
+ XftDrawChange(fontPtr->ftDraw, drawable);
+ Tk_DeleteErrorHandler(handler);
+ }
+
+ XGetGCValues(display, gc, GCForeground, &values);
+ if (values.foreground != fontPtr->color.pixel) {
+ xcolor.pixel = values.foreground;
+ XQueryColor(display, DefaultColormap(display, fontPtr->screen),
+ &xcolor);
+ fontPtr->color.color.red = xcolor.red;
+ fontPtr->color.color.green = xcolor.green;
+ fontPtr->color.color.blue = xcolor.blue;
+ fontPtr->color.color.alpha = 0xffff;
+ fontPtr->color.pixel = values.foreground;
+ }
+
+ nglyph = 0;
+ currentFtFont = NULL;
+ originX = originY = 0; /* lint */
+
+ while (numBytes > 0 && x <= maxCoord && x >= minCoord && y <= maxCoord
+ && y >= minCoord) {
+ XftFont *ftFont;
+ FcChar32 c;
+
+ clen = FcUtf8ToUcs4((FcChar8 *) source, &c, numBytes);
+ if (clen <= 0) {
+ /*
+ * This should not happen, but it can.
+ */
+
+ goto doUnderlineStrikeout;
+ }
+ source += clen;
+ numBytes -= clen;
+
+ ftFont = GetFont(fontPtr, c, angle);
+ if (!ftFont) {
+ continue;
+ }
+
+ if (ftFont != currentFtFont || nglyph == NUM_SPEC) {
+ if (nglyph) {
+ /*
+ * We pass multiple glyphs at once to enable the code to
+ * perform better rendering of sub-pixel inter-glyph spacing.
+ * If only the current Xft implementation could make use of
+ * this information... but we'll be ready when it does!
+ */
+
+ XftDrawGlyphs(fontPtr->ftDraw, &fontPtr->color, currentFtFont,
+ originX, originY, glyphs, nglyph);
+ }
+ originX = ROUND16(x);
+ originY = ROUND16(y);
+ if (nglyph) {
+ XftGlyphExtents(fontPtr->display, currentFtFont, glyphs,
+ nglyph, &metrics);
+ nglyph = 0;
+ x += metrics.xOff;
+ y += metrics.yOff;
+ }
+ currentFtFont = ftFont;
+ }
+ glyphs[nglyph++] = XftCharIndex(fontPtr->display, ftFont, c);
+ }
+ if (nglyph) {
+ XftDrawGlyphs(fontPtr->ftDraw, &fontPtr->color, currentFtFont,
+ originX, originY, glyphs, nglyph);
+ }
+#else /* !XFT_HAS_FIXED_ROTATED_PLACEMENT */
+ int clen, nspec;
+ XftGlyphFontSpec specs[NUM_SPEC];
+ XGlyphInfo metrics;
+ double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0);
+
+ if (fontPtr->ftDraw == 0) {
+#if DEBUG_FONTSEL
+ printf("Switch to drawable 0x%x\n", drawable);
+#endif /* DEBUG_FONTSEL */
+ fontPtr->ftDraw = XftDrawCreate(display, drawable,
+ DefaultVisual(display, fontPtr->screen),
+ DefaultColormap(display, fontPtr->screen));
+ } else {
+ Tk_ErrorHandler handler =
+ Tk_CreateErrorHandler(display, -1, -1, -1, NULL, NULL);
+
+ XftDrawChange(fontPtr->ftDraw, drawable);
+ Tk_DeleteErrorHandler(handler);
+ }
+ XGetGCValues(display, gc, GCForeground, &values);
+ if (values.foreground != fontPtr->color.pixel) {
+ xcolor.pixel = values.foreground;
+ XQueryColor(display, DefaultColormap(display, fontPtr->screen),
+ &xcolor);
+ fontPtr->color.color.red = xcolor.red;
+ fontPtr->color.color.green = xcolor.green;
+ fontPtr->color.color.blue = xcolor.blue;
+ fontPtr->color.color.alpha = 0xffff;
+ fontPtr->color.pixel = values.foreground;
+ }
+ nspec = 0;
+ while (numBytes > 0 && x <= maxCoord && x >= minCoord
+ && y <= maxCoord && y >= minCoord) {
+ XftFont *ftFont, *ft0Font;
+ FcChar32 c;
+
+ clen = FcUtf8ToUcs4((FcChar8 *) source, &c, numBytes);
+ if (clen <= 0) {
+ /*
+ * This should not happen, but it can.
+ */
+
+ goto doUnderlineStrikeout;
+ }
+ source += clen;
+ numBytes -= clen;
+
+ ftFont = GetFont(fontPtr, c, angle);
+ ft0Font = GetFont(fontPtr, c, 0.0);
+ if (ftFont && ft0Font) {
+ specs[nspec].font = ftFont;
+ specs[nspec].glyph = XftCharIndex(fontPtr->display, ftFont, c);
+ specs[nspec].x = ROUND16(x);
+ specs[nspec].y = ROUND16(y);
+ XftGlyphExtents(fontPtr->display, ft0Font, &specs[nspec].glyph, 1,
+ &metrics);
+ x += metrics.xOff*cosA + metrics.yOff*sinA;
+ y += metrics.yOff*cosA - metrics.xOff*sinA;
+ nspec++;
+ if (nspec == NUM_SPEC) {
+ XftDrawGlyphFontSpec(fontPtr->ftDraw, &fontPtr->color,
+ specs, nspec);
+ nspec = 0;
+ }
+ }
+ }
+ if (nspec) {
+ XftDrawGlyphFontSpec(fontPtr->ftDraw, &fontPtr->color, specs, nspec);
+ }
+#endif /* XFT_HAS_FIXED_ROTATED_PLACEMENT */
+
+ doUnderlineStrikeout:
+ if (fontPtr->font.fa.underline || fontPtr->font.fa.overstrike) {
+ XPoint points[5];
+ double width = (x - xStart) * cosA + (yStart - y) * sinA;
+ double barHeight = fontPtr->font.underlineHeight;
+ double dy = fontPtr->font.underlinePos;
+
+ if (fontPtr->font.fa.underline != 0) {
+ if (fontPtr->font.underlineHeight == 1) {
+ dy++;
+ }
+ points[0].x = xStart + ROUND16(dy*sinA);
+ points[0].y = yStart + ROUND16(dy*cosA);
+ points[1].x = xStart + ROUND16(dy*sinA + width*cosA);
+ points[1].y = yStart + ROUND16(dy*cosA - width*sinA);
+ if (fontPtr->font.underlineHeight == 1) {
+ XDrawLines(display, drawable, gc, points, 2, CoordModeOrigin);
+ } else {
+ points[2].x = xStart + ROUND16(dy*sinA + width*cosA
+ + barHeight*sinA);
+ points[2].y = yStart + ROUND16(dy*cosA - width*sinA
+ + barHeight*cosA);
+ points[3].x = xStart + ROUND16(dy*sinA + barHeight*sinA);
+ points[3].y = yStart + ROUND16(dy*cosA + barHeight*cosA);
+ points[4].x = points[0].x;
+ points[4].y = points[0].y;
+ XFillPolygon(display, drawable, gc, points, 5, Complex,
+ CoordModeOrigin);
+ XDrawLines(display, drawable, gc, points, 5, CoordModeOrigin);
+ }
+ }
+ if (fontPtr->font.fa.overstrike != 0) {
+ dy = -fontPtr->font.fm.descent
+ - (fontPtr->font.fm.ascent) / 10;
+ points[0].x = xStart + ROUND16(dy*sinA);
+ points[0].y = yStart + ROUND16(dy*cosA);
+ points[1].x = xStart + ROUND16(dy*sinA + width*cosA);
+ points[1].y = yStart + ROUND16(dy*cosA - width*sinA);
+ if (fontPtr->font.underlineHeight == 1) {
+ XDrawLines(display, drawable, gc, points, 2, CoordModeOrigin);
+ } else {
+ points[2].x = xStart + ROUND16(dy*sinA + width*cosA
+ + barHeight*sinA);
+ points[2].y = yStart + ROUND16(dy*cosA - width*sinA
+ + barHeight*cosA);
+ points[3].x = xStart + ROUND16(dy*sinA + barHeight*sinA);
+ points[3].y = yStart + ROUND16(dy*cosA + barHeight*cosA);
+ points[4].x = points[0].x;
+ points[4].y = points[0].y;
+ XFillPolygon(display, drawable, gc, points, 5, Complex,
+ CoordModeOrigin);
+ XDrawLines(display, drawable, gc, points, 5, CoordModeOrigin);
+ }
+ }
+ }
+}
+
+/*
+ * Local Variables:
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c
index 637fd46..b156a74 100644
--- a/unix/tkUnixScale.c
+++ b/unix/tkUnixScale.c
@@ -1,31 +1,30 @@
-/*
+/*
* tkUnixScale.c --
*
- * This file implements the X specific portion of the scrollbar
- * widget.
+ * This file implements the X specific portion of the scrollbar widget.
*
* Copyright (c) 1996 by Sun Microsystems, Inc.
* Copyright (c) 1998-2000 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkScale.h"
#include "tkInt.h"
+#include "tkScale.h"
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static void DisplayHorizontalScale _ANSI_ARGS_((TkScale *scalePtr,
- Drawable drawable, XRectangle *drawnAreaPtr));
-static void DisplayHorizontalValue _ANSI_ARGS_((TkScale *scalePtr,
- Drawable drawable, double value, int top));
-static void DisplayVerticalScale _ANSI_ARGS_((TkScale *scalePtr,
- Drawable drawable, XRectangle *drawnAreaPtr));
-static void DisplayVerticalValue _ANSI_ARGS_((TkScale *scalePtr,
- Drawable drawable, double value, int rightEdge));
+static void DisplayHorizontalScale(TkScale *scalePtr,
+ Drawable drawable, XRectangle *drawnAreaPtr);
+static void DisplayHorizontalValue(TkScale *scalePtr,
+ Drawable drawable, double value, int top);
+static void DisplayVerticalScale(TkScale *scalePtr,
+ Drawable drawable, XRectangle *drawnAreaPtr);
+static void DisplayVerticalValue(TkScale *scalePtr,
+ Drawable drawable, double value, int rightEdge);
/*
*----------------------------------------------------------------------
@@ -44,10 +43,10 @@ static void DisplayVerticalValue _ANSI_ARGS_((TkScale *scalePtr,
*/
TkScale *
-TkpCreateScale(tkwin)
- Tk_Window tkwin;
+TkpCreateScale(
+ Tk_Window tkwin)
{
- return (TkScale *) ckalloc(sizeof(TkScale));
+ return ckalloc(sizeof(TkScale));
}
/*
@@ -55,9 +54,9 @@ TkpCreateScale(tkwin)
*
* TkpDestroyScale --
*
- * Destroy a TkScale structure. It's necessary to do this with
- * Tcl_EventuallyFree to allow the Tcl_Preserve(scalePtr) to work
- * as expected in TkpDisplayScale. (hobbs)
+ * Destroy a TkScale structure. It's necessary to do this with
+ * Tcl_EventuallyFree to allow the Tcl_Preserve(scalePtr) to work as
+ * expected in TkpDisplayScale. (hobbs)
*
* Results:
* None
@@ -69,10 +68,10 @@ TkpCreateScale(tkwin)
*/
void
-TkpDestroyScale(scalePtr)
- TkScale *scalePtr;
+TkpDestroyScale(
+ TkScale *scalePtr)
{
- Tcl_EventuallyFree((ClientData) scalePtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(scalePtr, TCL_DYNAMIC);
}
/*
@@ -80,14 +79,14 @@ TkpDestroyScale(scalePtr)
*
* DisplayVerticalScale --
*
- * This procedure redraws the contents of a vertical scale
- * window. It is invoked as a do-when-idle handler, so it only
- * runs when there's nothing else for the application to do.
+ * This function redraws the contents of a vertical scale window. It is
+ * invoked as a do-when-idle handler, so it only runs when there's
+ * nothing else for the application to do.
*
* Results:
- * There is no return value. If only a part of the scale needs
- * to be redrawn, then drawnAreaPtr is modified to reflect the
- * area that was actually modified.
+ * There is no return value. If only a part of the scale needs to be
+ * redrawn, then drawnAreaPtr is modified to reflect the area that was
+ * actually modified.
*
* Side effects:
* Information appears on the screen.
@@ -96,15 +95,14 @@ TkpDestroyScale(scalePtr)
*/
static void
-DisplayVerticalScale(scalePtr, drawable, drawnAreaPtr)
- TkScale *scalePtr; /* Widget record for scale. */
- Drawable drawable; /* Where to display scale (window
- * or pixmap). */
- XRectangle *drawnAreaPtr; /* Initally contains area of window;
- * if only a part of the scale is
- * redrawn, gets modified to reflect
- * the part of the window that was
- * redrawn. */
+DisplayVerticalScale(
+ TkScale *scalePtr, /* Widget record for scale. */
+ Drawable drawable, /* Where to display scale (window or
+ * pixmap). */
+ XRectangle *drawnAreaPtr) /* Initally contains area of window; if only a
+ * part of the scale is redrawn, gets modified
+ * to reflect the part of the window that was
+ * redrawn. */
{
Tk_Window tkwin = scalePtr->tkwin;
int x, y, width, height, shadowWidth;
@@ -134,18 +132,19 @@ DisplayVerticalScale(scalePtr, drawable, drawnAreaPtr)
double ticks, maxTicks;
/*
- * Ensure that we will only draw enough of the tick values
- * such that they don't overlap
+ * Ensure that we will only draw enough of the tick values such
+ * that they don't overlap
*/
+
ticks = fabs((scalePtr->toValue - scalePtr->fromValue)
/ tickInterval);
maxTicks = (double) Tk_Height(tkwin)
- / (double) scalePtr->fontHeight;
+ / (double) scalePtr->fontHeight;
if (ticks > maxTicks) {
tickInterval *= (ticks / maxTicks);
}
for (tickValue = scalePtr->fromValue; ;
- tickValue += tickInterval) {
+ tickValue += tickInterval) {
/*
* The TkRoundToResolution call gets rid of accumulated
* round-off errors, if any.
@@ -224,7 +223,7 @@ DisplayVerticalScale(scalePtr, drawable, drawnAreaPtr)
Tk_GetFontMetrics(scalePtr->tkfont, &fm);
Tk_DrawChars(scalePtr->display, drawable, scalePtr->textGC,
- scalePtr->tkfont, scalePtr->label,
+ scalePtr->tkfont, scalePtr->label,
scalePtr->labelLength, scalePtr->vertLabelX,
scalePtr->inset + (3*fm.ascent)/2);
}
@@ -235,30 +234,30 @@ DisplayVerticalScale(scalePtr, drawable, drawnAreaPtr)
*
* DisplayVerticalValue --
*
- * This procedure is called to display values (scale readings)
- * for vertically-oriented scales.
+ * This function is called to display values (scale readings) for
+ * vertically-oriented scales.
*
* Results:
* None.
*
* Side effects:
- * The numerical value corresponding to value is displayed with
- * its right edge at "rightEdge", and at a vertical position in
- * the scale that corresponds to "value".
+ * The numerical value corresponding to value is displayed with its right
+ * edge at "rightEdge", and at a vertical position in the scale that
+ * corresponds to "value".
*
*----------------------------------------------------------------------
*/
static void
-DisplayVerticalValue(scalePtr, drawable, value, rightEdge)
- register TkScale *scalePtr; /* Information about widget in which to
+DisplayVerticalValue(
+ register TkScale *scalePtr, /* Information about widget in which to
* display value. */
- Drawable drawable; /* Pixmap or window in which to draw
- * the value. */
- double value; /* Y-coordinate of number to display,
- * specified in application coords, not
- * in pixels (we'll compute pixels). */
- int rightEdge; /* X-coordinate of right edge of text,
+ Drawable drawable, /* Pixmap or window in which to draw the
+ * value. */
+ double value, /* Y-coordinate of number to display,
+ * specified in application coords, not in
+ * pixels (we'll compute pixels). */
+ int rightEdge) /* X-coordinate of right edge of text,
* specified in pixels. */
{
register Tk_Window tkwin = scalePtr->tkwin;
@@ -273,8 +272,8 @@ DisplayVerticalValue(scalePtr, drawable, value, rightEdge)
width = Tk_TextWidth(scalePtr->tkfont, valueString, length);
/*
- * Adjust the y-coordinate if necessary to keep the text entirely
- * inside the window.
+ * Adjust the y-coordinate if necessary to keep the text entirely inside
+ * the window.
*/
if ((y - fm.ascent) < (scalePtr->inset + SPACING)) {
@@ -292,14 +291,14 @@ DisplayVerticalValue(scalePtr, drawable, value, rightEdge)
*
* DisplayHorizontalScale --
*
- * This procedure redraws the contents of a horizontal scale
- * window. It is invoked as a do-when-idle handler, so it only
- * runs when there's nothing else for the application to do.
+ * This function redraws the contents of a horizontal scale window. It is
+ * invoked as a do-when-idle handler, so it only runs when there's
+ * nothing else for the application to do.
*
* Results:
- * There is no return value. If only a part of the scale needs
- * to be redrawn, then drawnAreaPtr is modified to reflect the
- * area that was actually modified.
+ * There is no return value. If only a part of the scale needs to be
+ * redrawn, then drawnAreaPtr is modified to reflect the area that was
+ * actually modified.
*
* Side effects:
* Information appears on the screen.
@@ -308,15 +307,14 @@ DisplayVerticalValue(scalePtr, drawable, value, rightEdge)
*/
static void
-DisplayHorizontalScale(scalePtr, drawable, drawnAreaPtr)
- TkScale *scalePtr; /* Widget record for scale. */
- Drawable drawable; /* Where to display scale (window
- * or pixmap). */
- XRectangle *drawnAreaPtr; /* Initally contains area of window;
- * if only a part of the scale is
- * redrawn, gets modified to reflect
- * the part of the window that was
- * redrawn. */
+DisplayHorizontalScale(
+ TkScale *scalePtr, /* Widget record for scale. */
+ Drawable drawable, /* Where to display scale (window or
+ * pixmap). */
+ XRectangle *drawnAreaPtr) /* Initally contains area of window; if only a
+ * part of the scale is redrawn, gets modified
+ * to reflect the part of the window that was
+ * redrawn. */
{
register Tk_Window tkwin = scalePtr->tkwin;
int x, y, width, height, shadowWidth;
@@ -347,15 +345,16 @@ DisplayHorizontalScale(scalePtr, drawable, drawnAreaPtr)
double ticks, maxTicks;
/*
- * Ensure that we will only draw enough of the tick values
- * such that they don't overlap. We base this off the width that
- * fromValue would take. Not exact, but better than no constraint.
+ * Ensure that we will only draw enough of the tick values such
+ * that they don't overlap. We base this off the width that
+ * fromValue would take. Not exact, but better than no constraint.
*/
+
ticks = fabs((scalePtr->toValue - scalePtr->fromValue)
/ tickInterval);
sprintf(valueString, scalePtr->format, scalePtr->fromValue);
maxTicks = (double) Tk_Width(tkwin)
- / (double) Tk_TextWidth(scalePtr->tkfont, valueString, -1);
+ / (double) Tk_TextWidth(scalePtr->tkfont, valueString, -1);
if (ticks > maxTicks) {
tickInterval *= (ticks / maxTicks);
}
@@ -440,8 +439,8 @@ DisplayHorizontalScale(scalePtr, drawable, drawnAreaPtr)
Tk_GetFontMetrics(scalePtr->tkfont, &fm);
Tk_DrawChars(scalePtr->display, drawable, scalePtr->textGC,
- scalePtr->tkfont, scalePtr->label,
- scalePtr->labelLength, scalePtr->inset + fm.ascent/2,
+ scalePtr->tkfont, scalePtr->label,
+ scalePtr->labelLength, scalePtr->inset + fm.ascent/2,
scalePtr->horizLabelY + fm.ascent);
}
}
@@ -451,31 +450,31 @@ DisplayHorizontalScale(scalePtr, drawable, drawnAreaPtr)
*
* DisplayHorizontalValue --
*
- * This procedure is called to display values (scale readings)
- * for horizontally-oriented scales.
+ * This function is called to display values (scale readings) for
+ * horizontally-oriented scales.
*
* Results:
* None.
*
* Side effects:
- * The numerical value corresponding to value is displayed with
- * its bottom edge at "bottom", and at a horizontal position in
- * the scale that corresponds to "value".
+ * The numerical value corresponding to value is displayed with its
+ * bottom edge at "bottom", and at a horizontal position in the scale
+ * that corresponds to "value".
*
*----------------------------------------------------------------------
*/
static void
-DisplayHorizontalValue(scalePtr, drawable, value, top)
- register TkScale *scalePtr; /* Information about widget in which to
+DisplayHorizontalValue(
+ register TkScale *scalePtr, /* Information about widget in which to
* display value. */
- Drawable drawable; /* Pixmap or window in which to draw
- * the value. */
- double value; /* X-coordinate of number to display,
- * specified in application coords, not
- * in pixels (we'll compute pixels). */
- int top; /* Y-coordinate of top edge of text,
- * specified in pixels. */
+ Drawable drawable, /* Pixmap or window in which to draw the
+ * value. */
+ double value, /* X-coordinate of number to display,
+ * specified in application coords, not in
+ * pixels (we'll compute pixels). */
+ int top) /* Y-coordinate of top edge of text, specified
+ * in pixels. */
{
register Tk_Window tkwin = scalePtr->tkwin;
int x, y, length, width;
@@ -490,18 +489,19 @@ DisplayHorizontalValue(scalePtr, drawable, value, top)
width = Tk_TextWidth(scalePtr->tkfont, valueString, length);
/*
- * Adjust the x-coordinate if necessary to keep the text entirely
- * inside the window.
+ * Adjust the x-coordinate if necessary to keep the text entirely inside
+ * the window.
*/
x -= (width)/2;
if (x < (scalePtr->inset + SPACING)) {
x = scalePtr->inset + SPACING;
}
+
/*
- * Check the right border so use starting point +text width
- * for the check.
+ * Check the right border so use starting point +text width for the check.
*/
+
if (x + width >= (Tk_Width(tkwin) - scalePtr->inset)) {
x = Tk_Width(tkwin) - scalePtr->inset - SPACING - width;
}
@@ -514,8 +514,8 @@ DisplayHorizontalValue(scalePtr, drawable, value, top)
*
* TkpDisplayScale --
*
- * This procedure is invoked as an idle handler to redisplay
- * the contents of a scale widget.
+ * This function is invoked as an idle handler to redisplay the contents
+ * of a scale widget.
*
* Results:
* None.
@@ -527,8 +527,8 @@ DisplayHorizontalValue(scalePtr, drawable, value, top)
*/
void
-TkpDisplayScale(clientData)
- ClientData clientData; /* Widget record for scale. */
+TkpDisplayScale(
+ ClientData clientData) /* Widget record for scale. */
{
TkScale *scalePtr = (TkScale *) clientData;
Tk_Window tkwin = scalePtr->tkwin;
@@ -546,31 +546,32 @@ TkpDisplayScale(clientData)
/*
* Invoke the scale's command if needed.
*/
- Tcl_Preserve((ClientData) scalePtr);
+
+ Tcl_Preserve(scalePtr);
if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) {
- Tcl_Preserve((ClientData) interp);
+ Tcl_Preserve(interp);
sprintf(string, scalePtr->format, scalePtr->value);
result = Tcl_VarEval(interp, scalePtr->command, " ", string,
(char *) NULL);
if (result != TCL_OK) {
Tcl_AddErrorInfo(interp, "\n (command executed by scale)");
- Tcl_BackgroundError(interp);
+ Tcl_BackgroundException(interp, result);
}
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
}
scalePtr->flags &= ~INVOKE_COMMAND;
if (scalePtr->flags & SCALE_DELETED) {
- Tcl_Release((ClientData) scalePtr);
+ Tcl_Release(scalePtr);
return;
}
- Tcl_Release((ClientData) scalePtr);
+ Tcl_Release(scalePtr);
#ifndef TK_NO_DOUBLE_BUFFERING
/*
- * In order to avoid screen flashes, this procedure redraws
- * the scale in a pixmap, then copies the pixmap to the
- * screen in a single operation. This means that there's no
- * point in time where the on-sreen image has been cleared.
+ * In order to avoid screen flashes, this function redraws the scale in a
+ * pixmap, then copies the pixmap to the screen in a single operation.
+ * This means that there's no point in time where the on-sreen image has
+ * been cleared.
*/
pixmap = Tk_GetPixmap(scalePtr->display, Tk_WindowId(tkwin),
@@ -584,9 +585,8 @@ TkpDisplayScale(clientData)
drawnArea.height = Tk_Height(tkwin);
/*
- * Much of the redisplay is done totally differently for
- * horizontal and vertical scales. Handle the part that's
- * different.
+ * Much of the redisplay is done totally differently for horizontal and
+ * vertical scales. Handle the part that's different.
*/
if (scalePtr->orient == ORIENT_VERTICAL) {
@@ -596,9 +596,8 @@ TkpDisplayScale(clientData)
}
/*
- * Now handle the part of redisplay that is the same for
- * horizontal and vertical scales: border and traversal
- * highlight.
+ * Now handle the part of redisplay that is the same for horizontal and
+ * vertical scales: border and traversal highlight.
*/
if (scalePtr->flags & REDRAW_OTHER) {
@@ -611,7 +610,7 @@ TkpDisplayScale(clientData)
}
if (scalePtr->highlightWidth != 0) {
GC gc;
-
+
if (scalePtr->flags & GOT_FOCUS) {
gc = Tk_GCForColor(scalePtr->highlightColorPtr, pixmap);
} else {
@@ -624,8 +623,8 @@ TkpDisplayScale(clientData)
#ifndef TK_NO_DOUBLE_BUFFERING
/*
- * Copy the information from the off-screen pixmap onto the screen,
- * then delete the pixmap.
+ * Copy the information from the off-screen pixmap onto the screen, then
+ * delete the pixmap.
*/
XCopyArea(scalePtr->display, pixmap, Tk_WindowId(tkwin),
@@ -634,7 +633,7 @@ TkpDisplayScale(clientData)
Tk_FreePixmap(scalePtr->display, pixmap);
#endif /* TK_NO_DOUBLE_BUFFERING */
- done:
+ done:
scalePtr->flags &= ~REDRAW_ALL;
}
@@ -643,13 +642,12 @@ TkpDisplayScale(clientData)
*
* TkpScaleElement --
*
- * Determine which part of a scale widget lies under a given
- * point.
+ * Determine which part of a scale widget lies under a given point.
*
* Results:
- * The return value is either TROUGH1, SLIDER, TROUGH2, or
- * OTHER, depending on which of the scale's active elements
- * (if any) is under the point at (x,y).
+ * The return value is either TROUGH1, SLIDER, TROUGH2, or OTHER,
+ * depending on which of the scale's active elements (if any) is under
+ * the point at (x,y).
*
* Side effects:
* None.
@@ -658,9 +656,9 @@ TkpDisplayScale(clientData)
*/
int
-TkpScaleElement(scalePtr, x, y)
- TkScale *scalePtr; /* Widget record for scale. */
- int x, y; /* Coordinates within scalePtr's window. */
+TkpScaleElement(
+ TkScale *scalePtr, /* Widget record for scale. */
+ int x, int y) /* Coordinates within scalePtr's window. */
{
int sliderFirst;
@@ -704,3 +702,11 @@ TkpScaleElement(scalePtr, x, y)
}
return TROUGH2;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixScrlbr.c b/unix/tkUnixScrlbr.c
index 4e1ed06..0507211 100644
--- a/unix/tkUnixScrlbr.c
+++ b/unix/tkUnixScrlbr.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkUnixScrollbar.c --
*
* This file implements the Unix specific portion of the scrollbar
@@ -6,15 +6,16 @@
*
* Copyright (c) 1996 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * 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 "tkScrollbar.h"
/*
- * Minimum slider length, in pixels (designed to make sure that the slider
- * is always easy to grab with the mouse).
+ * Minimum slider length, in pixels (designed to make sure that the slider is
+ * always easy to grab with the mouse).
*/
#define MIN_SLIDER_LENGTH 5
@@ -30,15 +31,17 @@ typedef struct UnixScrollbar {
} UnixScrollbar;
/*
- * The class procedure table for the scrollbar widget. All fields except
- * size are left initialized to NULL, which should happen automatically
- * since the variable is declared at this scope.
+ * The class procedure table for the scrollbar widget. All fields except size
+ * are left initialized to NULL, which should happen automatically since the
+ * variable is declared at this scope.
*/
-Tk_ClassProcs tkpScrollbarProcs = {
- sizeof(Tk_ClassProcs) /* size */
+const Tk_ClassProcs tkpScrollbarProcs = {
+ sizeof(Tk_ClassProcs), /* size */
+ NULL, /* worldChangedProc */
+ NULL, /* createProc */
+ NULL /* modalProc */
};
-
/*
*----------------------------------------------------------------------
@@ -57,16 +60,17 @@ Tk_ClassProcs tkpScrollbarProcs = {
*/
TkScrollbar *
-TkpCreateScrollbar(tkwin)
- Tk_Window tkwin;
+TkpCreateScrollbar(
+ Tk_Window tkwin)
{
- UnixScrollbar *scrollPtr = (UnixScrollbar *)ckalloc(sizeof(UnixScrollbar));
+ UnixScrollbar *scrollPtr = ckalloc(sizeof(UnixScrollbar));
+
scrollPtr->troughGC = None;
scrollPtr->copyGC = None;
Tk_CreateEventHandler(tkwin,
ExposureMask|StructureNotifyMask|FocusChangeMask,
- TkScrollbarEventProc, (ClientData) scrollPtr);
+ TkScrollbarEventProc, scrollPtr);
return (TkScrollbar *) scrollPtr;
}
@@ -76,9 +80,9 @@ TkpCreateScrollbar(tkwin)
*
* TkpDisplayScrollbar --
*
- * This procedure redraws the contents of a scrollbar window.
- * It is invoked as a do-when-idle handler, so it only runs
- * when there's nothing else for the application to do.
+ * This procedure redraws the contents of a scrollbar window. It is
+ * invoked as a do-when-idle handler, so it only runs when there's
+ * nothing else for the application to do.
*
* Results:
* None.
@@ -90,8 +94,8 @@ TkpCreateScrollbar(tkwin)
*/
void
-TkpDisplayScrollbar(clientData)
- ClientData clientData; /* Information about window. */
+TkpDisplayScrollbar(
+ ClientData clientData) /* Information about window. */
{
register TkScrollbar *scrollPtr = (TkScrollbar *) clientData;
register Tk_Window tkwin = scrollPtr->tkwin;
@@ -115,10 +119,10 @@ TkpDisplayScrollbar(clientData)
}
/*
- * In order to avoid screen flashes, this procedure redraws
- * the scrollbar in a pixmap, then copies the pixmap to the
- * screen in a single operation. This means that there's no
- * point in time where the on-sreen image has been cleared.
+ * In order to avoid screen flashes, this procedure redraws the scrollbar
+ * in a pixmap, then copies the pixmap to the screen in a single
+ * operation. This means that there's no point in time where the on-sreen
+ * image has been cleared.
*/
pixmap = Tk_GetPixmap(scrollPtr->display, Tk_WindowId(tkwin),
@@ -146,11 +150,11 @@ TkpDisplayScrollbar(clientData)
(unsigned) (Tk_Height(tkwin) - 2*scrollPtr->inset));
/*
- * Draw the top or left arrow. The coordinates of the polygon
- * points probably seem odd, but they were carefully chosen with
- * respect to X's rules for filling polygons. These point choices
- * cause the arrows to just fill the narrow dimension of the
- * scrollbar and be properly centered.
+ * Draw the top or left arrow. The coordinates of the polygon points
+ * probably seem odd, but they were carefully chosen with respect to X's
+ * rules for filling polygons. These point choices cause the arrows to
+ * just fill the narrow dimension of the scrollbar and be properly
+ * centered.
*/
if (scrollPtr->activeField == TOP_ARROW) {
@@ -240,8 +244,8 @@ TkpDisplayScrollbar(clientData)
}
/*
- * Copy the information from the off-screen pixmap onto the screen,
- * then delete the pixmap.
+ * Copy the information from the off-screen pixmap onto the screen, then
+ * delete the pixmap.
*/
XCopyArea(scrollPtr->display, pixmap, Tk_WindowId(tkwin),
@@ -249,7 +253,7 @@ TkpDisplayScrollbar(clientData)
(unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin), 0, 0);
Tk_FreePixmap(scrollPtr->display, pixmap);
- done:
+ done:
scrollPtr->flags &= ~REDRAW_PENDING;
}
@@ -258,9 +262,9 @@ TkpDisplayScrollbar(clientData)
*
* TkpComputeScrollbarGeometry --
*
- * After changes in a scrollbar's size or configuration, this
- * procedure recomputes various geometry information used in
- * displaying the scrollbar.
+ * After changes in a scrollbar's size or configuration, this procedure
+ * recomputes various geometry information used in displaying the
+ * scrollbar.
*
* Results:
* None.
@@ -272,9 +276,10 @@ TkpDisplayScrollbar(clientData)
*/
extern void
-TkpComputeScrollbarGeometry(scrollPtr)
- register TkScrollbar *scrollPtr; /* Scrollbar whose geometry may
- * have changed. */
+TkpComputeScrollbarGeometry(
+ register TkScrollbar *scrollPtr)
+ /* Scrollbar whose geometry may have
+ * changed. */
{
int width, fieldLength;
@@ -295,19 +300,18 @@ TkpComputeScrollbarGeometry(scrollPtr)
scrollPtr->sliderLast = fieldLength*scrollPtr->lastFraction;
/*
- * Adjust the slider so that some piece of it is always
- * displayed in the scrollbar and so that it has at least
- * a minimal width (so it can be grabbed with the mouse).
+ * Adjust the slider so that some piece of it is always displayed in the
+ * scrollbar and so that it has at least a minimal width (so it can be
+ * grabbed with the mouse).
*/
- if (scrollPtr->sliderFirst > (fieldLength - MIN_SLIDER_LENGTH)) {
+ if (scrollPtr->sliderFirst > fieldLength - MIN_SLIDER_LENGTH) {
scrollPtr->sliderFirst = fieldLength - MIN_SLIDER_LENGTH;
}
if (scrollPtr->sliderFirst < 0) {
scrollPtr->sliderFirst = 0;
}
- if (scrollPtr->sliderLast < (scrollPtr->sliderFirst
- + MIN_SLIDER_LENGTH)) {
+ if (scrollPtr->sliderLast < scrollPtr->sliderFirst + MIN_SLIDER_LENGTH) {
scrollPtr->sliderLast = scrollPtr->sliderFirst + MIN_SLIDER_LENGTH;
}
if (scrollPtr->sliderLast > fieldLength) {
@@ -317,10 +321,9 @@ TkpComputeScrollbarGeometry(scrollPtr)
scrollPtr->sliderLast += scrollPtr->arrowLength + scrollPtr->inset;
/*
- * Register the desired geometry for the window (leave enough space
- * for the two arrows plus a minimum-size slider, plus border around
- * the whole window, if any). Then arrange for the window to be
- * redisplayed.
+ * Register the desired geometry for the window (leave enough space for
+ * the two arrows plus a minimum-size slider, plus border around the whole
+ * window, if any). Then arrange for the window to be redisplayed.
*/
if (scrollPtr->vertical) {
@@ -353,8 +356,8 @@ TkpComputeScrollbarGeometry(scrollPtr)
*/
void
-TkpDestroyScrollbar(scrollPtr)
- TkScrollbar *scrollPtr;
+TkpDestroyScrollbar(
+ TkScrollbar *scrollPtr)
{
UnixScrollbar *unixScrollPtr = (UnixScrollbar *)scrollPtr;
@@ -372,8 +375,8 @@ TkpDestroyScrollbar(scrollPtr)
* TkpConfigureScrollbar --
*
* This procedure is called after the generic code has finished
- * processing configuration options, in order to configure
- * platform specific options.
+ * processing configuration options, in order to configure platform
+ * specific options.
*
* Results:
* None.
@@ -385,10 +388,10 @@ TkpDestroyScrollbar(scrollPtr)
*/
void
-TkpConfigureScrollbar(scrollPtr)
- register TkScrollbar *scrollPtr; /* Information about widget; may or
- * may not already have values for
- * some fields. */
+TkpConfigureScrollbar(
+ register TkScrollbar *scrollPtr)
+ /* Information about widget; may or may not
+ * already have values for some fields. */
{
XGCValues gcValues;
GC new;
@@ -404,8 +407,8 @@ TkpConfigureScrollbar(scrollPtr)
unixScrollPtr->troughGC = new;
if (unixScrollPtr->copyGC == None) {
gcValues.graphics_exposures = False;
- unixScrollPtr->copyGC = Tk_GetGC(scrollPtr->tkwin, GCGraphicsExposures,
- &gcValues);
+ unixScrollPtr->copyGC = Tk_GetGC(scrollPtr->tkwin,
+ GCGraphicsExposures, &gcValues);
}
}
@@ -414,14 +417,12 @@ TkpConfigureScrollbar(scrollPtr)
*
* TkpScrollbarPosition --
*
- * Determine the scrollbar element corresponding to a
- * given position.
+ * Determine the scrollbar element corresponding to a given position.
*
* Results:
- * One of TOP_ARROW, TOP_GAP, etc., indicating which element
- * of the scrollbar covers the position given by (x, y). If
- * (x,y) is outside the scrollbar entirely, then OUTSIDE is
- * returned.
+ * One of TOP_ARROW, TOP_GAP, etc., indicating which element of the
+ * scrollbar covers the position given by (x, y). If (x,y) is outside the
+ * scrollbar entirely, then OUTSIDE is returned.
*
* Side effects:
* None.
@@ -430,12 +431,13 @@ TkpConfigureScrollbar(scrollPtr)
*/
int
-TkpScrollbarPosition(scrollPtr, x, y)
- register TkScrollbar *scrollPtr; /* Scrollbar widget record. */
- int x, y; /* Coordinates within scrollPtr's
- * window. */
+TkpScrollbarPosition(
+ register TkScrollbar *scrollPtr,
+ /* Scrollbar widget record. */
+ int x, int y) /* Coordinates within scrollPtr's window. */
{
int length, width, tmp;
+ register const int inset = scrollPtr->inset;
if (scrollPtr->vertical) {
length = Tk_Height(scrollPtr->tkwin);
@@ -448,17 +450,16 @@ TkpScrollbarPosition(scrollPtr, x, y)
width = Tk_Height(scrollPtr->tkwin);
}
- if ((x < scrollPtr->inset) || (x >= (width - scrollPtr->inset))
- || (y < scrollPtr->inset) || (y >= (length - scrollPtr->inset))) {
+ if (x<inset || x>=width-inset || y<inset || y>=length-inset) {
return OUTSIDE;
}
/*
* All of the calculations in this procedure mirror those in
- * TkpDisplayScrollbar. Be sure to keep the two consistent.
+ * TkpDisplayScrollbar. Be sure to keep the two consistent.
*/
- if (y < (scrollPtr->inset + scrollPtr->arrowLength)) {
+ if (y < inset + scrollPtr->arrowLength) {
return TOP_ARROW;
}
if (y < scrollPtr->sliderFirst) {
@@ -467,8 +468,16 @@ TkpScrollbarPosition(scrollPtr, x, y)
if (y < scrollPtr->sliderLast) {
return SLIDER;
}
- if (y >= (length - (scrollPtr->arrowLength + scrollPtr->inset))) {
+ if (y >= length - (scrollPtr->arrowLength + inset)) {
return BOTTOM_ARROW;
}
return BOTTOM_GAP;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c
index 5eedd5d..172d5ca 100644
--- a/unix/tkUnixSelect.c
+++ b/unix/tkUnixSelect.c
@@ -1,13 +1,12 @@
-/*
+/*
* tkUnixSelect.c --
*
- * This file contains X specific routines for manipulating
- * selections.
+ * This file contains X specific routines for manipulating selections.
*
* Copyright (c) 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.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
@@ -18,7 +17,7 @@ typedef struct ConvertInfo {
* for the next chunk; -1 means all data has
* been transferred for this conversion. -2
* means only the final zero-length transfer
- * still has to be done. Otherwise it is the
+ * still has to be done. Otherwise it is the
* offset of the next chunk of data to
* transfer. */
Tcl_EncodingState state; /* The encoding state needed across chunks. */
@@ -27,84 +26,81 @@ typedef struct ConvertInfo {
} ConvertInfo;
/*
- * When handling INCR-style selection retrievals, the selection owner
- * uses the following data structure to communicate between the
- * ConvertSelection procedure and TkSelPropProc.
+ * When handling INCR-style selection retrievals, the selection owner uses the
+ * following data structure to communicate between the ConvertSelection
+ * function and TkSelPropProc.
*/
typedef struct IncrInfo {
TkWindow *winPtr; /* Window that owns selection. */
Atom selection; /* Selection that is being retrieved. */
- Atom *multAtoms; /* Information about conversions to
- * perform: one or more pairs of
- * (target, property). This either
- * points to a retrieved property (for
- * MULTIPLE retrievals) or to a static
+ Atom *multAtoms; /* Information about conversions to perform:
+ * one or more pairs of (target, property).
+ * This either points to a retrieved property
+ * (for MULTIPLE retrievals) or to a static
* array. */
unsigned long numConversions;
- /* Number of entries in converts (same as
- * # of pairs in multAtoms). */
- ConvertInfo *converts; /* One entry for each pair in multAtoms.
- * This array is malloc-ed. */
+ /* Number of entries in converts (same as # of
+ * pairs in multAtoms). */
+ ConvertInfo *converts; /* One entry for each pair in multAtoms. This
+ * array is malloc-ed. */
char **tempBufs; /* One pointer for each pair in multAtoms;
* each pointer is either NULL, or it points
* to a small bit of character data that was
* left over from the previous chunk. */
- Tcl_EncodingState *state; /* One state info per pair in multAtoms:
- * State info for encoding conversions
- * that span multiple buffers. */
+ Tcl_EncodingState *state; /* One state info per pair in multAtoms: State
+ * info for encoding conversions that span
+ * multiple buffers. */
int *flags; /* One state flag per pair in multAtoms:
* Encoding flags, set to TCL_ENCODING_START
* at the beginning of an INCR transfer. */
- int numIncrs; /* Number of entries in converts that
- * aren't -1 (i.e. # of INCR-mode transfers
- * not yet completed). */
- Tcl_TimerToken timeout; /* Token for timer procedure. */
- int idleTime; /* Number of seconds since we heard
- * anything from the selection
- * requestor. */
+ int numIncrs; /* Number of entries in converts that aren't
+ * -1 (i.e. # of INCR-mode transfers not yet
+ * completed). */
+ Tcl_TimerToken timeout; /* Token for timer function. */
+ int idleTime; /* Number of seconds since we heard anything
+ * from the selection requestor. */
Window reqWindow; /* Requestor's window id. */
- Time time; /* Timestamp corresponding to
- * selection at beginning of request;
- * used to abort transfer if selection
- * changes. */
- struct IncrInfo *nextPtr; /* Next in list of all INCR-style
- * retrievals currently pending. */
+ Time time; /* Timestamp corresponding to selection at
+ * beginning of request; used to abort
+ * transfer if selection changes. */
+ struct IncrInfo *nextPtr; /* Next in list of all INCR-style retrievals
+ * currently pending. */
} IncrInfo;
-
typedef struct ThreadSpecificData {
- IncrInfo *pendingIncrs; /* List of all incr structures
- * currently active. */
+ IncrInfo *pendingIncrs; /* List of all incr structures currently
+ * active. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * Largest property that we'll accept when sending or receiving the
- * selection:
+ * Largest property that we'll accept when sending or receiving the selection:
*/
#define MAX_PROP_WORDS 100000
static TkSelRetrievalInfo *pendingRetrievals = NULL;
- /* List of all retrievals currently
- * being waited for. */
+ /* List of all retrievals currently being
+ * waited for. */
/*
- * Forward declarations for procedures defined in this file:
+ * Forward declarations for functions defined in this file:
*/
-static void ConvertSelection _ANSI_ARGS_((TkWindow *winPtr,
- XSelectionRequestEvent *eventPtr));
-static void IncrTimeoutProc _ANSI_ARGS_((ClientData clientData));
-static void SelCvtFromX _ANSI_ARGS_((long *propPtr, int numValues,
- Atom type, Tk_Window tkwin, Tcl_DString *dsPtr));
-static long * SelCvtToX _ANSI_ARGS_((char *string, Atom type,
- Tk_Window tkwin, int *numLongsPtr));
-static int SelectionSize _ANSI_ARGS_((TkSelHandler *selPtr));
-static void SelRcvIncrProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void SelTimeoutProc _ANSI_ARGS_((ClientData clientData));
+static void ConvertSelection(TkWindow *winPtr,
+ XSelectionRequestEvent *eventPtr);
+static void IncrTimeoutProc(ClientData clientData);
+static void SelCvtFromX32(long *propPtr, int numValues, Atom type,
+ Tk_Window tkwin, Tcl_DString *dsPtr);
+static void SelCvtFromX8(char *propPtr, int numValues, Atom type,
+ Tk_Window tkwin, Tcl_DString *dsPtr);
+static long * SelCvtToX(char *string, Atom type, Tk_Window tkwin,
+ int *numLongsPtr);
+static int SelectionSize(TkSelHandler *selPtr);
+static void SelRcvIncrProc(ClientData clientData,
+ XEvent *eventPtr);
+static void SelTimeoutProc(ClientData clientData);
/*
*----------------------------------------------------------------------
@@ -114,9 +110,9 @@ static void SelTimeoutProc _ANSI_ARGS_((ClientData clientData));
* Retrieve the specified selection from another process.
*
* Results:
- * The return value is a standard Tcl return value.
- * If an error occurs (such as no selection exists)
- * then an error message is left in the interp's result.
+ * The return value is a standard Tcl return value. If an error occurs
+ * (such as no selection exists) then an error message is left in the
+ * interp's result.
*
* Side effects:
* None.
@@ -125,27 +121,26 @@ static void SelTimeoutProc _ANSI_ARGS_((ClientData clientData));
*/
int
-TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
- Tcl_Interp *interp; /* Interpreter to use for reporting
- * errors. */
- Tk_Window tkwin; /* Window on whose behalf to retrieve
- * the selection (determines display
- * from which to retrieve). */
- Atom selection; /* Selection to retrieve. */
- Atom target; /* Desired form in which selection
- * is to be returned. */
- Tk_GetSelProc *proc; /* Procedure to call to process the
- * selection, once it has been retrieved. */
- ClientData clientData; /* Arbitrary value to pass to proc. */
+TkSelGetSelection(
+ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
+ Tk_Window tkwin, /* Window on whose behalf to retrieve the
+ * selection (determines display from which to
+ * retrieve). */
+ Atom selection, /* Selection to retrieve. */
+ Atom target, /* Desired form in which selection is to be
+ * returned. */
+ Tk_GetSelProc *proc, /* Function to call to process the selection,
+ * once it has been retrieved. */
+ ClientData clientData) /* Arbitrary value to pass to proc. */
{
TkSelRetrievalInfo retr;
TkWindow *winPtr = (TkWindow *) tkwin;
TkDisplay *dispPtr = winPtr->dispPtr;
/*
- * The selection is owned by some other process. To
- * retrieve it, first record information about the retrieval
- * in progress. Use an internal window as the requestor.
+ * The selection is owned by some other process. To retrieve it, first
+ * record information about the retrieval in progress. Use an internal
+ * window as the requestor.
*/
retr.interp = interp;
@@ -171,32 +166,31 @@ TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
pendingRetrievals = &retr;
/*
- * Initiate the request for the selection. Note: can't use
- * TkCurrentTime for the time. If we do, and this application hasn't
- * received any X events in a long time, the current time will be way
- * in the past and could even predate the time when the selection was
- * made; if this happens, the request will be rejected.
+ * Initiate the request for the selection. Note: can't use TkCurrentTime
+ * for the time. If we do, and this application hasn't received any X
+ * events in a long time, the current time will be way in the past and
+ * could even predate the time when the selection was made; if this
+ * happens, the request will be rejected.
*/
XConvertSelection(winPtr->display, retr.selection, retr.target,
retr.property, retr.winPtr->window, CurrentTime);
/*
- * Enter a loop processing X events until the selection
- * has been retrieved and processed. If no response is
- * received within a few seconds, then timeout.
+ * Enter a loop processing X events until the selection has been retrieved
+ * and processed. If no response is received within a few seconds, then
+ * timeout.
*/
retr.timeout = Tcl_CreateTimerHandler(1000, SelTimeoutProc,
- (ClientData) &retr);
+ &retr);
while (retr.result == -1) {
Tcl_DoOneEvent(0);
}
Tcl_DeleteTimerHandler(retr.timeout);
/*
- * Unregister the information about the selection retrieval
- * in progress.
+ * Unregister the information about the selection retrieval in progress.
*/
if (pendingRetrievals == &retr) {
@@ -221,42 +215,41 @@ TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
*
* TkSelPropProc --
*
- * This procedure is invoked when property-change events
- * occur on windows not known to the toolkit. Its function
- * is to implement the sending side of the INCR selection
- * retrieval protocol when the selection requestor deletes
- * the property containing a part of the selection.
+ * This function is invoked when property-change events occur on windows
+ * not known to the toolkit. Its function is to implement the sending
+ * side of the INCR selection retrieval protocol when the selection
+ * requestor deletes the property containing a part of the selection.
*
* Results:
* None.
*
* Side effects:
- * If the property that is receiving the selection was just
- * deleted, then a new piece of the selection is fetched and
- * placed in the property, until eventually there's no more
- * selection to fetch.
+ * If the property that is receiving the selection was just deleted, then
+ * a new piece of the selection is fetched and placed in the property,
+ * until eventually there's no more selection to fetch.
*
*----------------------------------------------------------------------
*/
void
-TkSelPropProc(eventPtr)
- register XEvent *eventPtr; /* X PropertyChange event. */
+TkSelPropProc(
+ register XEvent *eventPtr) /* X PropertyChange event. */
{
register IncrInfo *incrPtr;
register TkSelHandler *selPtr;
- int i, length, numItems;
+ int length, numItems;
+ unsigned long i;
Atom target, formatType;
long buffer[TK_SEL_WORDS_AT_ONCE];
TkDisplay *dispPtr = TkGetDisplay(eventPtr->xany.display);
Tk_ErrorHandler errorHandler;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
- * See if this event announces the deletion of a property being
- * used for an INCR transfer. If so, then add the next chunk of
- * data to the property.
+ * See if this event announces the deletion of a property being used for
+ * an INCR transfer. If so, then add the next chunk of data to the
+ * property.
*/
if (eventPtr->xproperty.state != PropertyDelete) {
@@ -269,9 +262,9 @@ TkSelPropProc(eventPtr)
}
/*
- * For each conversion that has been requested, handle any
- * chunks that haven't been transmitted yet.
- */
+ * For each conversion that has been requested, handle any chunks that
+ * haven't been transmitted yet.
+ */
for (i = 0; i < incrPtr->numConversions; i++) {
if ((eventPtr->xproperty.atom != incrPtr->multAtoms[2*i + 1])
@@ -310,29 +303,30 @@ TkSelPropProc(eventPtr)
formatType = selPtr->format;
if (incrPtr->converts[i].offset == -2) {
/*
- * We already got the last chunk, so send a null chunk
- * to indicate that we are finished.
+ * We already got the last chunk, so send a null chunk to
+ * indicate that we are finished.
*/
numItems = 0;
length = 0;
} else {
TkSelInProgress ip;
+
ip.selPtr = selPtr;
ip.nextPtr = TkSelGetInProgress();
TkSelSetInProgress(&ip);
/*
- * Copy any bytes left over from a partial character at the end
- * of the previous chunk into the beginning of the buffer.
+ * Copy any bytes left over from a partial character at the
+ * end of the previous chunk into the beginning of the buffer.
* Pass the rest of the buffer space into the selection
* handler.
*/
length = strlen(incrPtr->converts[i].buffer);
strcpy((char *)buffer, incrPtr->converts[i].buffer);
-
- numItems = (*selPtr->proc)(selPtr->clientData,
+
+ numItems = selPtr->proc(selPtr->clientData,
incrPtr->converts[i].offset,
((char *) buffer) + length,
TK_SEL_BYTES_AT_ONCE - length);
@@ -349,13 +343,14 @@ TkSelPropProc(eventPtr)
}
numItems += length;
if (numItems > TK_SEL_BYTES_AT_ONCE) {
- panic("selection handler returned too many bytes");
+ Tcl_Panic("selection handler returned too many bytes");
}
}
((char *) buffer)[numItems] = 0;
errorHandler = Tk_CreateErrorHandler(eventPtr->xproperty.display,
- -1, -1, -1, (int (*)()) NULL, (ClientData) NULL);
+ -1, -1, -1, (int (*)()) NULL, NULL);
+
/*
* Encode the data using the proper format for each type.
*/
@@ -401,14 +396,13 @@ TkSelPropProc(eventPtr)
/*
- * Now convert the data, growing the destination buffer
- * as needed.
+ * Now convert the data, growing the destination buffer as
+ * needed.
*/
while (1) {
- result = Tcl_UtfToExternal(NULL, encoding,
- src, srcLen, encodingCvtFlags,
- &incrPtr->converts[i].state,
+ result = Tcl_UtfToExternal(NULL, encoding, src, srcLen,
+ encodingCvtFlags, &incrPtr->converts[i].state,
dst, dstLen, &srcRead, &dstWrote, NULL);
soFar = dst + dstWrote - Tcl_DStringValue(&ds);
encodingCvtFlags &= ~TCL_ENCODING_START;
@@ -446,7 +440,7 @@ TkSelPropProc(eventPtr)
*/
if (srcLen > TCL_UTF_MAX) {
- panic("selection conversion left too many bytes unconverted");
+ Tcl_Panic("selection conversion left too many bytes unconverted");
}
memcpy(incrPtr->converts[i].buffer, src, (size_t) srcLen+1);
Tcl_DStringFree(&ds);
@@ -456,8 +450,7 @@ TkSelPropProc(eventPtr)
*/
char *propPtr = (char *) SelCvtToX((char *) buffer,
- formatType, (Tk_Window) incrPtr->winPtr,
- &numItems);
+ formatType, (Tk_Window) incrPtr->winPtr, &numItems);
if (propPtr == NULL) {
numItems = 0;
@@ -473,9 +466,9 @@ TkSelPropProc(eventPtr)
Tk_DeleteErrorHandler(errorHandler);
/*
- * Compute the next offset value. If this was the last chunk,
- * then set the offset to -2. If this was an empty chunk,
- * then set the offset to -1 to indicate we are done.
+ * Compute the next offset value. If this was the last chunk, then
+ * set the offset to -2. If this was an empty chunk, then set the
+ * offset to -1 to indicate we are done.
*/
if (numItems < TK_SEL_BYTES_AT_ONCE) {
@@ -487,10 +480,10 @@ TkSelPropProc(eventPtr)
}
} else {
/*
- * Advance over the selection data that was consumed
- * this time.
+ * Advance over the selection data that was consumed this
+ * time.
*/
-
+
incrPtr->converts[i].offset += numItems - length;
}
return;
@@ -503,26 +496,24 @@ TkSelPropProc(eventPtr)
*
* TkSelEventProc --
*
- * This procedure is invoked whenever a selection-related
- * event occurs. It does the lion's share of the work
- * in implementing the selection protocol.
+ * This function is invoked whenever a selection-related event occurs.
+ * It does the lion's share of the work in implementing the selection
+ * protocol.
*
* Results:
* None.
*
* Side effects:
- * Lots: depends on the type of event.
+ * Lots: depends on the type of event.
*
*--------------------------------------------------------------
*/
void
-TkSelEventProc(tkwin, eventPtr)
- Tk_Window tkwin; /* Window for which event was
- * targeted. */
- register XEvent *eventPtr; /* X event: either SelectionClear,
- * SelectionRequest, or
- * SelectionNotify. */
+TkSelEventProc(
+ Tk_Window tkwin, /* Window for which event was targeted. */
+ register XEvent *eventPtr) /* X event: either SelectionClear,
+ * SelectionRequest, or SelectionNotify. */
{
register TkWindow *winPtr = (TkWindow *) tkwin;
TkDisplay *dispPtr = winPtr->dispPtr;
@@ -537,13 +528,13 @@ TkSelEventProc(tkwin, eventPtr)
}
/*
- * Case #2: SelectionNotify events. Call the relevant procedure
- * to handle the incoming selection.
+ * Case #2: SelectionNotify events. Call the relevant function to handle
+ * the incoming selection.
*/
if (eventPtr->type == SelectionNotify) {
register TkSelRetrievalInfo *retrPtr;
- char *propInfo;
+ char *propInfo, **propInfoPtr = &propInfo;
Atom type;
int format, result;
unsigned long numItems, bytesAfter;
@@ -561,12 +552,12 @@ TkSelEventProc(tkwin, eventPtr)
break;
}
if (eventPtr->xselection.property == None) {
- Tcl_SetResult(retrPtr->interp, (char *) NULL, TCL_STATIC);
+ Tcl_SetResult(retrPtr->interp, NULL, TCL_STATIC);
Tcl_AppendResult(retrPtr->interp,
Tk_GetAtomName(tkwin, retrPtr->selection),
" selection doesn't exist or form \"",
Tk_GetAtomName(tkwin, retrPtr->target),
- "\" not defined", (char *) NULL);
+ "\" not defined", NULL);
retrPtr->result = TCL_ERROR;
return;
}
@@ -578,13 +569,13 @@ TkSelEventProc(tkwin, eventPtr)
eventPtr->xselection.requestor, retrPtr->property,
0, MAX_PROP_WORDS, False, (Atom) AnyPropertyType,
&type, &format, &numItems, &bytesAfter,
- (unsigned char **) &propInfo);
+ (unsigned char **) propInfoPtr);
if ((result != Success) || (type == None)) {
return;
}
if (bytesAfter != 0) {
Tcl_SetResult(retrPtr->interp, "selection property too large",
- TCL_STATIC);
+ TCL_STATIC);
retrPtr->result = TCL_ERROR;
XFree(propInfo);
return;
@@ -595,25 +586,25 @@ TkSelEventProc(tkwin, eventPtr)
if (format != 8) {
char buf[64 + TCL_INTEGER_SPACE];
- sprintf(buf,
+ sprintf(buf,
"bad format for string selection: wanted \"8\", got \"%d\"",
format);
Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
retrPtr->result = TCL_ERROR;
return;
}
- interp = retrPtr->interp;
- Tcl_Preserve((ClientData) interp);
+ interp = retrPtr->interp;
+ Tcl_Preserve(interp);
/*
- * Convert the X selection data into UTF before passing it
- * to the selection callback. Note that the COMPOUND_TEXT
- * uses a modified iso2022 encoding, not the current system
- * encoding. For now we'll just blindly apply the iso2022
- * encoding. This is probably wrong, but it's a placeholder
- * until we figure out what we're really supposed to do. For
- * STRING, we need to use Latin-1 instead. Again, it's not
- * really the full iso8859-1 space, but this is close enough.
+ * Convert the X selection data into UTF before passing it to the
+ * selection callback. Note that the COMPOUND_TEXT uses a modified
+ * iso2022 encoding, not the current system encoding. For now
+ * we'll just blindly apply the iso2022 encoding. This is probably
+ * wrong, but it's a placeholder until we figure out what we're
+ * really supposed to do. For STRING, we need to use Latin-1
+ * instead. Again, it's not really the full iso8859-1 space, but
+ * this is close enough.
*/
if (type == dispPtr->compoundTextAtom) {
@@ -626,22 +617,23 @@ TkSelEventProc(tkwin, eventPtr)
Tcl_FreeEncoding(encoding);
}
- retrPtr->result = (*retrPtr->proc)(retrPtr->clientData,
- interp, Tcl_DStringValue(&ds));
+ retrPtr->result = retrPtr->proc(retrPtr->clientData, interp,
+ Tcl_DStringValue(&ds));
Tcl_DStringFree(&ds);
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
} else if (type == dispPtr->utf8Atom) {
/*
- * The X selection data is in UTF-8 format already.
- * We can't guarantee that propInfo is NULL-terminated,
- * so we might have to copy the string.
+ * The X selection data is in UTF-8 format already. We can't
+ * guarantee that propInfo is NULL-terminated, so we might have to
+ * copy the string.
*/
+
char *propData = propInfo;
if (format != 8) {
char buf[64 + TCL_INTEGER_SPACE];
- sprintf(buf,
+ sprintf(buf,
"bad format for string selection: wanted \"8\", got \"%d\"",
format);
Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
@@ -650,55 +642,58 @@ TkSelEventProc(tkwin, eventPtr)
}
if (propInfo[numItems] != '\0') {
- propData = ckalloc((size_t) numItems + 1);
+ propData = ckalloc(numItems + 1);
strcpy(propData, propInfo);
propData[numItems] = '\0';
}
- retrPtr->result = (*retrPtr->proc)(retrPtr->clientData,
+ retrPtr->result = retrPtr->proc(retrPtr->clientData,
retrPtr->interp, propData);
if (propData != propInfo) {
- ckfree((char *) propData);
+ ckfree(propData);
}
- } else if (type == dispPtr->incrAtom) {
+ } else if (type == dispPtr->incrAtom) {
/*
- * It's a !?#@!?!! INCR-style reception. Arrange to receive
- * the selection in pieces, using the ICCCM protocol, then
- * hang around until either the selection is all here or a
- * timeout occurs.
+ * It's a !?#@!?!! INCR-style reception. Arrange to receive the
+ * selection in pieces, using the ICCCM protocol, then hang around
+ * until either the selection is all here or a timeout occurs.
*/
retrPtr->idleTime = 0;
Tk_CreateEventHandler(tkwin, PropertyChangeMask, SelRcvIncrProc,
- (ClientData) retrPtr);
+ retrPtr);
XDeleteProperty(Tk_Display(tkwin), Tk_WindowId(tkwin),
retrPtr->property);
while (retrPtr->result == -1) {
Tcl_DoOneEvent(0);
}
Tk_DeleteEventHandler(tkwin, PropertyChangeMask, SelRcvIncrProc,
- (ClientData) retrPtr);
+ retrPtr);
} else {
Tcl_DString ds;
- if (format != 32) {
+ if (format != 32 && format != 8) {
char buf[64 + TCL_INTEGER_SPACE];
- sprintf(buf,
- "bad format for selection: wanted \"32\", got \"%d\"",
- format);
+ sprintf(buf, "bad format for selection: wanted \"32\" or "
+ "\"8\", got \"%d\"", format);
Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
retrPtr->result = TCL_ERROR;
return;
}
Tcl_DStringInit(&ds);
- SelCvtFromX((long *) propInfo, (int) numItems, type,
- (Tk_Window) winPtr, &ds);
- interp = retrPtr->interp;
- Tcl_Preserve((ClientData) interp);
- retrPtr->result = (*retrPtr->proc)(retrPtr->clientData,
+ if (format == 32) {
+ SelCvtFromX32((long *) propInfo, (int) numItems, type,
+ (Tk_Window) winPtr, &ds);
+ } else {
+ SelCvtFromX8((char *) propInfo, (int) numItems, type,
+ (Tk_Window) winPtr, &ds);
+ }
+ interp = retrPtr->interp;
+ Tcl_Preserve(interp);
+ retrPtr->result = retrPtr->proc(retrPtr->clientData,
interp, Tcl_DStringValue(&ds));
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
Tcl_DStringFree(&ds);
}
XFree(propInfo);
@@ -706,8 +701,8 @@ TkSelEventProc(tkwin, eventPtr)
}
/*
- * Case #3: SelectionRequest events. Call ConvertSelection to
- * do the dirty work.
+ * Case #3: SelectionRequest events. Call ConvertSelection to do the dirty
+ * work.
*/
if (eventPtr->type == SelectionRequest) {
@@ -721,32 +716,30 @@ TkSelEventProc(tkwin, eventPtr)
*
* SelTimeoutProc --
*
- * This procedure is invoked once every second while waiting for
- * the selection to be returned. After a while it gives up and
- * aborts the selection retrieval.
+ * This function is invoked once every second while waiting for the
+ * selection to be returned. After a while it gives up and aborts the
+ * selection retrieval.
*
* Results:
* None.
*
* Side effects:
- * A new timer callback is created to call us again in another
- * second, unless time has expired, in which case an error is
- * recorded for the retrieval.
+ * A new timer callback is created to call us again in another second,
+ * unless time has expired, in which case an error is recorded for the
+ * retrieval.
*
*----------------------------------------------------------------------
*/
static void
-SelTimeoutProc(clientData)
- ClientData clientData; /* Information about retrieval
- * in progress. */
+SelTimeoutProc(
+ ClientData clientData) /* Information about retrieval in progress. */
{
register TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *) clientData;
/*
- * Make sure that the retrieval is still in progress. Then
- * see how long it's been since any sort of response was received
- * from the other side.
+ * Make sure that the retrieval is still in progress. Then see how long
+ * it's been since any sort of response was received from the other side.
*/
if (retrPtr->result != -1) {
@@ -754,10 +747,9 @@ SelTimeoutProc(clientData)
}
retrPtr->idleTime++;
if (retrPtr->idleTime >= 5) {
-
/*
- * Use a careful procedure to store the error message, because
- * the result could already be partially filled in with a partial
+ * Use a careful function to store the error message, because the
+ * result could already be partially filled in with a partial
* selection return.
*/
@@ -766,7 +758,7 @@ SelTimeoutProc(clientData)
retrPtr->result = TCL_ERROR;
} else {
retrPtr->timeout = Tcl_CreateTimerHandler(1000, SelTimeoutProc,
- (ClientData) retrPtr);
+ (ClientData) retrPtr);
}
}
@@ -775,68 +767,72 @@ SelTimeoutProc(clientData)
*
* ConvertSelection --
*
- * This procedure is invoked to handle SelectionRequest events.
- * It responds to the requests, obeying the ICCCM protocols.
+ * This function is invoked to handle SelectionRequest events. It
+ * responds to the requests, obeying the ICCCM protocols.
*
* Results:
* None.
*
* Side effects:
* Properties are created for the selection requestor, and a
- * SelectionNotify event is generated for the selection
- * requestor. In the event of long selections, this procedure
- * implements INCR-mode transfers, using the ICCCM protocol.
+ * SelectionNotify event is generated for the selection requestor. In the
+ * event of long selections, this function implements INCR-mode
+ * transfers, using the ICCCM protocol.
*
*----------------------------------------------------------------------
*/
static void
-ConvertSelection(winPtr, eventPtr)
- TkWindow *winPtr; /* Window that received the
- * conversion request; may not be
- * selection's current owner, be we
- * set it to the current owner. */
- register XSelectionRequestEvent *eventPtr;
- /* Event describing request. */
+ConvertSelection(
+ TkWindow *winPtr, /* Window that received the conversion
+ * request; may not be selection's current
+ * owner, be we set it to the current
+ * owner. */
+ register XSelectionRequestEvent *eventPtr)
+ /* Event describing request. */
{
- XSelectionEvent reply; /* Used to notify requestor that
- * selection info is ready. */
- int multiple; /* Non-zero means a MULTIPLE request
- * is being handled. */
- IncrInfo incr; /* State of selection conversion. */
- Atom singleInfo[2]; /* incr.multAtoms points here except
- * for multiple conversions. */
- int i;
+ union {
+ XSelectionEvent xsel;
+ XEvent ev;
+ } reply; /* Used to notify requestor that selection
+ * info is ready. */
+ int multiple; /* Non-zero means a MULTIPLE request is being
+ * handled. */
+ IncrInfo incr; /* State of selection conversion. */
+ Atom singleInfo[2]; /* incr.multAtoms points here except for
+ * multiple conversions. */
+ unsigned long i;
Tk_ErrorHandler errorHandler;
TkSelectionInfo *infoPtr;
TkSelInProgress ip;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
errorHandler = Tk_CreateErrorHandler(eventPtr->display, -1, -1,-1,
- (int (*)()) NULL, (ClientData) NULL);
+ (int (*)()) NULL, NULL);
/*
* Initialize the reply event.
*/
- reply.type = SelectionNotify;
- reply.serial = 0;
- reply.send_event = True;
- reply.display = eventPtr->display;
- reply.requestor = eventPtr->requestor;
- reply.selection = eventPtr->selection;
- reply.target = eventPtr->target;
- reply.property = eventPtr->property;
- if (reply.property == None) {
- reply.property = reply.target;
+ reply.xsel.type = SelectionNotify;
+ reply.xsel.serial = 0;
+ reply.xsel.send_event = True;
+ reply.xsel.display = eventPtr->display;
+ reply.xsel.requestor = eventPtr->requestor;
+ reply.xsel.selection = eventPtr->selection;
+ reply.xsel.target = eventPtr->target;
+ reply.xsel.property = eventPtr->property;
+ if (reply.xsel.property == None) {
+ reply.xsel.property = reply.xsel.target;
}
- reply.time = eventPtr->time;
+ reply.xsel.time = eventPtr->time;
for (infoPtr = winPtr->dispPtr->selectionInfoPtr; infoPtr != NULL;
infoPtr = infoPtr->nextPtr) {
- if (infoPtr->selection == eventPtr->selection)
+ if (infoPtr->selection == eventPtr->selection) {
break;
+ }
}
if (infoPtr == NULL) {
goto refuse;
@@ -844,8 +840,8 @@ ConvertSelection(winPtr, eventPtr)
winPtr = (TkWindow *) infoPtr->owner;
/*
- * Figure out which kind(s) of conversion to perform. If handling
- * a MULTIPLE conversion, then read the property describing which
+ * Figure out which kind(s) of conversion to perform. If handling a
+ * MULTIPLE conversion, then read the property describing which
* conversions to perform.
*/
@@ -853,12 +849,12 @@ ConvertSelection(winPtr, eventPtr)
incr.selection = eventPtr->selection;
if (eventPtr->target != winPtr->dispPtr->multipleAtom) {
multiple = 0;
- singleInfo[0] = reply.target;
- singleInfo[1] = reply.property;
+ singleInfo[0] = reply.xsel.target;
+ singleInfo[1] = reply.xsel.property;
incr.multAtoms = singleInfo;
incr.numConversions = 1;
} else {
- Atom type;
+ Atom type, **multAtomsPtr = &incr.multAtoms;
int format, result;
unsigned long bytesAfter;
@@ -867,11 +863,10 @@ ConvertSelection(winPtr, eventPtr)
if (eventPtr->property == None) {
goto refuse;
}
- result = XGetWindowProperty(eventPtr->display,
- eventPtr->requestor, eventPtr->property,
- 0, MAX_PROP_WORDS, False, XA_ATOM,
+ result = XGetWindowProperty(eventPtr->display, eventPtr->requestor,
+ eventPtr->property, 0, MAX_PROP_WORDS, False, XA_ATOM,
&type, &format, &incr.numConversions, &bytesAfter,
- (unsigned char **) &incr.multAtoms);
+ (unsigned char **) multAtomsPtr);
if ((result != Success) || (bytesAfter != 0) || (format != 32)
|| (type == None)) {
if (incr.multAtoms != NULL) {
@@ -883,14 +878,13 @@ ConvertSelection(winPtr, eventPtr)
}
/*
- * Loop through all of the requested conversions, and either return
- * the entire converted selection, if it can be returned in a single
- * bunch, or return INCR information only (the actual selection will
- * be returned below).
+ * Loop through all of the requested conversions, and either return the
+ * entire converted selection, if it can be returned in a single bunch, or
+ * return INCR information only (the actual selection will be returned
+ * below).
*/
- incr.converts = (ConvertInfo *) ckalloc((unsigned)
- (incr.numConversions*sizeof(ConvertInfo)));
+ incr.converts = ckalloc(incr.numConversions * sizeof(ConvertInfo));
incr.numIncrs = 0;
for (i = 0; i < incr.numConversions; i++) {
Atom target, property, type;
@@ -914,9 +908,9 @@ ConvertSelection(winPtr, eventPtr)
if (selPtr == NULL) {
/*
- * Nobody seems to know about this kind of request. If
- * it's of a sort that we can handle without any help, do
- * it. Otherwise mark the request as an errror.
+ * Nobody seems to know about this kind of request. If it's of a
+ * sort that we can handle without any help, do it. Otherwise mark
+ * the request as an errror.
*/
numItems = TkSelDefaultSelection(infoPtr, target, (char *) buffer,
@@ -930,27 +924,27 @@ ConvertSelection(winPtr, eventPtr)
ip.nextPtr = TkSelGetInProgress();
TkSelSetInProgress(&ip);
type = selPtr->format;
- numItems = (*selPtr->proc)(selPtr->clientData, 0,
- (char *) buffer, TK_SEL_BYTES_AT_ONCE);
+ numItems = selPtr->proc(selPtr->clientData, 0, (char *) buffer,
+ TK_SEL_BYTES_AT_ONCE);
TkSelSetInProgress(ip.nextPtr);
if ((ip.selPtr == NULL) || (numItems < 0)) {
incr.multAtoms[2*i + 1] = None;
continue;
}
if (numItems > TK_SEL_BYTES_AT_ONCE) {
- panic("selection handler returned too many bytes");
+ Tcl_Panic("selection handler returned too many bytes");
}
((char *) buffer)[numItems] = '\0';
}
/*
- * Got the selection; store it back on the requestor's property.
+ * Got the selection; store it back on the requestor's property.
*/
if (numItems == TK_SEL_BYTES_AT_ONCE) {
/*
- * Selection is too big to send at once; start an
- * INCR-mode transfer.
+ * Selection is too big to send at once; start an INCR-mode
+ * transfer.
*/
incr.numIncrs++;
@@ -964,38 +958,36 @@ ConvertSelection(winPtr, eventPtr)
propPtr = (char *) buffer;
format = 32;
incr.converts[i].offset = 0;
- XChangeProperty(reply.display, reply.requestor,
+ XChangeProperty(reply.xsel.display, reply.xsel.requestor,
property, type, format, PropModeReplace,
(unsigned char *) propPtr, numItems);
} else if (type == winPtr->dispPtr->utf8Atom) {
/*
- * This matches selection requests of type UTF8_STRING,
- * which allows us to pass our utf-8 information untouched.
+ * This matches selection requests of type UTF8_STRING, which
+ * allows us to pass our utf-8 information untouched.
*/
- XChangeProperty(reply.display, reply.requestor,
- property, type, 8, PropModeReplace,
- (unsigned char *) buffer, numItems);
+ XChangeProperty(reply.xsel.display, reply.xsel.requestor, property, type, 8,
+ PropModeReplace, (unsigned char *) buffer, numItems);
} else if ((type == XA_STRING)
|| (type == winPtr->dispPtr->compoundTextAtom)) {
Tcl_DString ds;
Tcl_Encoding encoding;
/*
- * STRING is Latin-1, COMPOUND_TEXT is an iso2022 variant.
- * We need to convert the selection text into these external
- * forms before modifying the property.
+ * STRING is Latin-1, COMPOUND_TEXT is an iso2022 variant. We need
+ * to convert the selection text into these external forms before
+ * modifying the property.
*/
if (type == XA_STRING) {
encoding = Tcl_GetEncoding(NULL, "iso8859-1");
} else {
encoding = Tcl_GetEncoding(NULL, "iso2022");
- }
- Tcl_UtfToExternalDString(encoding, (char*)buffer, -1, &ds);
- XChangeProperty(reply.display, reply.requestor,
- property, type, 8, PropModeReplace,
- (unsigned char *) Tcl_DStringValue(&ds),
+ }
+ Tcl_UtfToExternalDString(encoding, (char *) buffer, -1, &ds);
+ XChangeProperty(reply.xsel.display, reply.xsel.requestor, property, type, 8,
+ PropModeReplace, (unsigned char *) Tcl_DStringValue(&ds),
Tcl_DStringLength(&ds));
if (encoding) {
Tcl_FreeEncoding(encoding);
@@ -1008,51 +1000,48 @@ ConvertSelection(winPtr, eventPtr)
goto refuse;
}
format = 32;
- XChangeProperty(reply.display, reply.requestor,
- property, type, format, PropModeReplace,
- (unsigned char *) propPtr, numItems);
+ XChangeProperty(reply.xsel.display, reply.xsel.requestor, property, type,
+ format, PropModeReplace, (unsigned char *) propPtr,
+ numItems);
ckfree(propPtr);
}
}
/*
- * Send an event back to the requestor to indicate that the
- * first stage of conversion is complete (everything is done
- * except for long conversions that have to be done in INCR
- * mode).
+ * Send an event back to the requestor to indicate that the first stage of
+ * conversion is complete (everything is done except for long conversions
+ * that have to be done in INCR mode).
*/
if (incr.numIncrs > 0) {
- XSelectInput(reply.display, reply.requestor, PropertyChangeMask);
- incr.timeout = Tcl_CreateTimerHandler(1000, IncrTimeoutProc,
- (ClientData) &incr);
+ XSelectInput(reply.xsel.display, reply.xsel.requestor, PropertyChangeMask);
+ incr.timeout = Tcl_CreateTimerHandler(1000, IncrTimeoutProc, &incr);
incr.idleTime = 0;
- incr.reqWindow = reply.requestor;
+ incr.reqWindow = reply.xsel.requestor;
incr.time = infoPtr->time;
incr.nextPtr = tsdPtr->pendingIncrs;
tsdPtr->pendingIncrs = &incr;
}
if (multiple) {
- XChangeProperty(reply.display, reply.requestor, reply.property,
+ XChangeProperty(reply.xsel.display, reply.xsel.requestor, reply.xsel.property,
XA_ATOM, 32, PropModeReplace,
(unsigned char *) incr.multAtoms,
(int) incr.numConversions*2);
} else {
-
/*
- * Not a MULTIPLE request. The first property in "multAtoms"
- * got set to None if there was an error in conversion.
+ * Not a MULTIPLE request. The first property in "multAtoms" got set
+ * to None if there was an error in conversion.
*/
- reply.property = incr.multAtoms[1];
+ reply.xsel.property = incr.multAtoms[1];
}
- XSendEvent(reply.display, reply.requestor, False, 0, (XEvent *) &reply);
+ XSendEvent(reply.xsel.display, reply.xsel.requestor, False, 0, &reply.ev);
Tk_DeleteErrorHandler(errorHandler);
/*
- * Handle any remaining INCR-mode transfers. This all happens
- * in callbacks to TkSelPropProc, so just wait until the number
- * of uncompleted INCR transfers drops to zero.
+ * Handle any remaining INCR-mode transfers. This all happens in callbacks
+ * to TkSelPropProc, so just wait until the number of uncompleted INCR
+ * transfers drops to zero.
*/
if (incr.numIncrs > 0) {
@@ -1063,8 +1052,8 @@ ConvertSelection(winPtr, eventPtr)
}
Tcl_DeleteTimerHandler(incr.timeout);
errorHandler = Tk_CreateErrorHandler(winPtr->display,
- -1, -1,-1, (int (*)()) NULL, (ClientData) NULL);
- XSelectInput(reply.display, reply.requestor, 0L);
+ -1, -1,-1, (int (*)()) NULL, NULL);
+ XSelectInput(reply.xsel.display, reply.xsel.requestor, 0L);
Tk_DeleteErrorHandler(errorHandler);
if (tsdPtr->pendingIncrs == &incr) {
tsdPtr->pendingIncrs = incr.nextPtr;
@@ -1080,22 +1069,22 @@ ConvertSelection(winPtr, eventPtr)
}
/*
- * All done. Cleanup and return.
+ * All done. Cleanup and return.
*/
- ckfree((char *) incr.converts);
+ ckfree(incr.converts);
if (multiple) {
XFree((char *) incr.multAtoms);
}
return;
/*
- * An error occurred. Send back a refusal message.
+ * An error occurred. Send back a refusal message.
*/
- refuse:
- reply.property = None;
- XSendEvent(reply.display, reply.requestor, False, 0, (XEvent *) &reply);
+ refuse:
+ reply.xsel.property = None;
+ XSendEvent(reply.xsel.display, reply.xsel.requestor, False, 0, &reply.ev);
Tk_DeleteErrorHandler(errorHandler);
return;
}
@@ -1105,30 +1094,28 @@ ConvertSelection(winPtr, eventPtr)
*
* SelRcvIncrProc --
*
- * This procedure handles the INCR protocol on the receiving
- * side. It is invoked in response to property changes on
- * the requestor's window (which hopefully are because a new
- * chunk of the selection arrived).
+ * This function handles the INCR protocol on the receiving side. It is
+ * invoked in response to property changes on the requestor's window
+ * (which hopefully are because a new chunk of the selection arrived).
*
* Results:
* None.
*
* Side effects:
- * If a new piece of selection has arrived, a procedure is
- * invoked to deal with that piece. When the whole selection
- * is here, a flag is left for the higher-level procedure that
- * initiated the selection retrieval.
+ * If a new piece of selection has arrived, a function is invoked to deal
+ * with that piece. When the whole selection is here, a flag is left for
+ * the higher-level function that initiated the selection retrieval.
*
*----------------------------------------------------------------------
*/
static void
-SelRcvIncrProc(clientData, eventPtr)
- ClientData clientData; /* Information about retrieval. */
- register XEvent *eventPtr; /* X PropertyChange event. */
+SelRcvIncrProc(
+ ClientData clientData, /* Information about retrieval. */
+ register XEvent *eventPtr) /* X PropertyChange event. */
{
register TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *) clientData;
- char *propInfo;
+ char *propInfo, **propInfoPtr = &propInfo;
Atom type;
int format, result;
unsigned long numItems, bytesAfter;
@@ -1143,7 +1130,7 @@ SelRcvIncrProc(clientData, eventPtr)
result = XGetWindowProperty(eventPtr->xproperty.display,
eventPtr->xproperty.window, retrPtr->property, 0, MAX_PROP_WORDS,
True, (Atom) AnyPropertyType, &type, &format, &numItems,
- &bytesAfter, (unsigned char **) &propInfo);
+ &bytesAfter, (unsigned char **) propInfoPtr);
if ((result != Success) || (type == None)) {
return;
}
@@ -1164,16 +1151,16 @@ SelRcvIncrProc(clientData, eventPtr)
if (format != 8) {
char buf[64 + TCL_INTEGER_SPACE];
-
- sprintf(buf,
+
+ sprintf(buf,
"bad format for string selection: wanted \"8\", got \"%d\"",
format);
Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
retrPtr->result = TCL_ERROR;
goto done;
}
- interp = retrPtr->interp;
- Tcl_Preserve((ClientData) interp);
+ interp = retrPtr->interp;
+ Tcl_Preserve(interp);
if (type == retrPtr->winPtr->dispPtr->compoundTextAtom) {
encoding = Tcl_GetEncoding(NULL, "iso2022");
@@ -1185,8 +1172,8 @@ SelRcvIncrProc(clientData, eventPtr)
/*
* Check to see if there is any data left over from the previous
- * chunk. If there is, copy the old data and the new data into
- * a new buffer.
+ * chunk. If there is, copy the old data and the new data into a new
+ * buffer.
*/
Tcl_DStringInit(&temp);
@@ -1204,16 +1191,16 @@ SelRcvIncrProc(clientData, eventPtr)
*/
retrPtr->result = TCL_OK;
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
goto done;
} else {
src = propInfo;
srcLen = numItems;
}
-
+
/*
- * Set up the destination buffer so we can use as much space as
- * is available.
+ * Set up the destination buffer so we can use as much space as is
+ * available.
*/
dstPtr = &retrPtr->buf;
@@ -1245,13 +1232,13 @@ SelRcvIncrProc(clientData, eventPtr)
}
Tcl_DStringSetLength(dstPtr, soFar);
- result = (*retrPtr->proc)(retrPtr->clientData, interp,
+ result = retrPtr->proc(retrPtr->clientData, interp,
Tcl_DStringValue(dstPtr));
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
/*
- * Copy any unused data into the destination buffer so we can
- * pick it up next time around.
+ * Copy any unused data into the destination buffer so we can pick it
+ * up next time around.
*/
Tcl_DStringSetLength(dstPtr, 0);
@@ -1269,24 +1256,28 @@ SelRcvIncrProc(clientData, eventPtr)
} else {
Tcl_DString ds;
- if (format != 32) {
+ if (format != 32 && format != 8) {
char buf[64 + TCL_INTEGER_SPACE];
- sprintf(buf,
- "bad format for selection: wanted \"32\", got \"%d\"",
- format);
+ sprintf(buf, "bad format for selection: wanted \"32\" or "
+ "\"8\", got \"%d\"", format);
Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
retrPtr->result = TCL_ERROR;
goto done;
}
Tcl_DStringInit(&ds);
- SelCvtFromX((long *) propInfo, (int) numItems, type,
- (Tk_Window) retrPtr->winPtr, &ds);
- interp = retrPtr->interp;
- Tcl_Preserve((ClientData) interp);
- result = (*retrPtr->proc)(retrPtr->clientData, interp,
+ if (format == 32) {
+ SelCvtFromX32((long *) propInfo, (int) numItems, type,
+ (Tk_Window) retrPtr->winPtr, &ds);
+ } else {
+ SelCvtFromX8((char *) propInfo, (int) numItems, type,
+ (Tk_Window) retrPtr->winPtr, &ds);
+ }
+ interp = retrPtr->interp;
+ Tcl_Preserve(interp);
+ result = retrPtr->proc(retrPtr->clientData, interp,
Tcl_DStringValue(&ds));
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
Tcl_DStringFree(&ds);
if (result != TCL_OK) {
retrPtr->result = result;
@@ -1303,25 +1294,24 @@ SelRcvIncrProc(clientData, eventPtr)
*
* SelectionSize --
*
- * This procedure is called when the selection is too large to
- * send in a single buffer; it computes the total length of
- * the selection in bytes.
+ * This function is called when the selection is too large to send in a
+ * single buffer; it computes the total length of the selection in bytes.
*
* Results:
- * The return value is the number of bytes in the selection
- * given by selPtr.
+ * The return value is the number of bytes in the selection given by
+ * selPtr.
*
* Side effects:
- * The selection is retrieved from its current owner (this is
- * the only way to compute its size).
+ * The selection is retrieved from its current owner (this is the only
+ * way to compute its size).
*
*----------------------------------------------------------------------
*/
static int
-SelectionSize(selPtr)
- TkSelHandler *selPtr; /* Information about how to retrieve
- * the selection whose size is wanted. */
+SelectionSize(
+ TkSelHandler *selPtr) /* Information about how to retrieve the
+ * selection whose size is wanted. */
{
char buffer[TK_SEL_BYTES_AT_ONCE+1];
int size, chunkSize;
@@ -1331,15 +1321,17 @@ SelectionSize(selPtr)
ip.selPtr = selPtr;
ip.nextPtr = TkSelGetInProgress();
TkSelSetInProgress(&ip);
+
do {
- chunkSize = (*selPtr->proc)(selPtr->clientData, size,
- (char *) buffer, TK_SEL_BYTES_AT_ONCE);
+ chunkSize = selPtr->proc(selPtr->clientData, size, (char *) buffer,
+ TK_SEL_BYTES_AT_ONCE);
if (ip.selPtr == NULL) {
size = 0;
break;
}
size += chunkSize;
} while (chunkSize == TK_SEL_BYTES_AT_ONCE);
+
TkSelSetInProgress(ip.nextPtr);
return size;
}
@@ -1349,26 +1341,26 @@ SelectionSize(selPtr)
*
* IncrTimeoutProc --
*
- * This procedure is invoked once a second while sending the
- * selection to a requestor in INCR mode. After a while it
- * gives up and aborts the selection operation.
+ * This function is invoked once a second while sending the selection to
+ * a requestor in INCR mode. After a while it gives up and aborts the
+ * selection operation.
*
* Results:
* None.
*
* Side effects:
- * A new timeout gets registered so that this procedure gets
- * called again in another second, unless too many seconds
- * have elapsed, in which case incrPtr is marked as "all done".
+ * A new timeout gets registered so that this function gets called again
+ * in another second, unless too many seconds have elapsed, in which case
+ * incrPtr is marked as "all done".
*
*----------------------------------------------------------------------
*/
static void
-IncrTimeoutProc(clientData)
- ClientData clientData; /* Information about INCR-mode
- * selection retrieval for which
- * we are selection owner. */
+IncrTimeoutProc(
+ ClientData clientData) /* Information about INCR-mode selection
+ * retrieval for which we are selection
+ * owner. */
{
register IncrInfo *incrPtr = (IncrInfo *) clientData;
@@ -1377,7 +1369,7 @@ IncrTimeoutProc(clientData)
incrPtr->numIncrs = 0;
} else {
incrPtr->timeout = Tcl_CreateTimerHandler(1000, IncrTimeoutProc,
- (ClientData) incrPtr);
+ incrPtr);
}
}
@@ -1387,15 +1379,16 @@ IncrTimeoutProc(clientData)
* SelCvtToX --
*
* Given a selection represented as a string (the normal Tcl form),
- * convert it to the ICCCM-mandated format for X, depending on
- * the type argument. This procedure and SelCvtFromX are inverses.
+ * convert it to the ICCCM-mandated format for X, depending on the type
+ * argument. This function and SelCvtFromX are inverses.
*
* Results:
- * The return value is a malloc'ed buffer holding a value
- * equivalent to "string", but formatted as for "type". It is
- * the caller's responsibility to free the string when done with
- * it. The word at *numLongsPtr is filled in with the number of
- * 32-bit words returned in the result.
+ * The return value is a malloc'ed buffer holding a value equivalent to
+ * "string", but formatted as for "type". It is the caller's
+ * responsibility to free the string when done with it. The word at
+ * *numLongsPtr is filled in with the number of 32-bit words returned in
+ * the result. If NULL is returned, the input list was not actually a
+ * list.
*
* Side effects:
* None.
@@ -1404,14 +1397,14 @@ IncrTimeoutProc(clientData)
*/
static long *
-SelCvtToX(string, type, tkwin, numLongsPtr)
- char *string; /* String representation of selection. */
- Atom type; /* Atom specifying the X format that is
- * desired for the selection. Should not
- * be XA_STRING (if so, don't bother calling
- * this procedure at all). */
- Tk_Window tkwin; /* Window that governs atom conversion. */
- int *numLongsPtr; /* Number of 32-bit words contained in the
+SelCvtToX(
+ char *string, /* String representation of selection. */
+ Atom type, /* Atom specifying the X format that is
+ * desired for the selection. Should not be
+ * XA_STRING (if so, don't bother calling this
+ * function at all). */
+ Tk_Window tkwin, /* Window that governs atom conversion. */
+ int *numLongsPtr) /* Number of 32-bit words contained in the
* result. */
{
const char **field;
@@ -1430,7 +1423,7 @@ SelCvtToX(string, type, tkwin, numLongsPtr)
if (Tcl_SplitList(NULL, string, &numFields, &field) != TCL_OK) {
return NULL;
}
- propPtr = (long *) ckalloc((unsigned) numFields*sizeof(long));
+ propPtr = ckalloc(numFields * sizeof(long));
/*
* Convert the fields one-by-one.
@@ -1455,7 +1448,7 @@ SelCvtToX(string, type, tkwin, numLongsPtr)
* Release the parsed list.
*/
- ckfree((char *) field);
+ ckfree(field);
*numLongsPtr = i;
return propPtr;
}
@@ -1463,12 +1456,12 @@ SelCvtToX(string, type, tkwin, numLongsPtr)
/*
*----------------------------------------------------------------------
*
- * SelCvtFromX --
+ * SelCvtFromX32, SelCvtFromX8 --
*
- * Given an X property value, formatted as a collection of 32-bit
- * values according to "type" and the ICCCM conventions, convert
- * the value to a string suitable for manipulation by Tcl. This
- * procedure is the inverse of SelCvtToX.
+ * Given an X property value, formatted as a collection of 32-bit or
+ * 8-bit values according to "type" and the ICCCM conventions, convert
+ * the value to a string suitable for manipulation by Tcl. These
+ * functions are the inverse of SelCvtToX.
*
* Results:
* The return value (stored in a Tcl_DString) is the string equivalent of
@@ -1481,14 +1474,14 @@ SelCvtToX(string, type, tkwin, numLongsPtr)
*/
static void
-SelCvtFromX(propPtr, numValues, type, tkwin, dsPtr)
- register long *propPtr; /* Property value from X. */
- int numValues; /* Number of 32-bit values in property. */
- Atom type; /* Type of property Should not be
- * XA_STRING (if so, don't bother calling
- * this procedure at all). */
- Tk_Window tkwin; /* Window to use for atom conversion. */
- Tcl_DString *dsPtr; /* Where to store the converted string. */
+SelCvtFromX32(
+ register long *propPtr, /* Property value from X. */
+ int numValues, /* Number of 32-bit values in property. */
+ Atom type, /* Type of property Should not be XA_STRING
+ * (if so, don't bother calling this function
+ * at all). */
+ Tk_Window tkwin, /* Window to use for atom conversion. */
+ Tcl_DString *dsPtr) /* Where to store the converted string. */
{
/*
* Convert each long in the property to a string value, which is either
@@ -1510,4 +1503,38 @@ SelCvtFromX(propPtr, numValues, type, tkwin, dsPtr)
Tcl_DStringAppendElement(dsPtr, buf);
}
}
+ Tcl_DStringAppend(dsPtr, " ", 1);
+}
+
+static void
+SelCvtFromX8(
+ register char *propPtr, /* Property value from X. */
+ int numValues, /* Number of 8-bit values in property. */
+ Atom type, /* Type of property Should not be XA_STRING
+ * (if so, don't bother calling this function
+ * at all). */
+ Tk_Window tkwin, /* Window to use for atom conversion. */
+ Tcl_DString *dsPtr) /* Where to store the converted string. */
+{
+ /*
+ * Convert each long in the property to a string value, which is a
+ * hexadecimal string. We build the list in a Tcl_DString because this is
+ * easier than trying to get the quoting correct ourselves.
+ */
+
+ for ( ; numValues > 0; propPtr++, numValues--) {
+ char buf[12];
+
+ sprintf(buf, "0x%x", (unsigned char) *propPtr);
+ Tcl_DStringAppendElement(dsPtr, buf);
+ }
+ Tcl_DStringAppend(dsPtr, " ", 1);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c
index 2b54506..be53ec6 100644
--- a/unix/tkUnixSend.c
+++ b/unix/tkUnixSend.c
@@ -1,295 +1,279 @@
-/*
+/*
* tkUnixSend.c --
*
- * This file provides procedures that implement the "send"
- * command, allowing commands to be passed from interpreter
- * to interpreter.
+ * This file provides functions that implement the "send" command,
+ * allowing commands to be passed from interpreter to interpreter.
*
* Copyright (c) 1989-1994 The Regents of the University of California.
* Copyright (c) 1994-1996 Sun Microsystems, Inc.
* Copyright (c) 1998-1999 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
-#include "tkInt.h"
#include "tkUnixInt.h"
-/*
+/*
* The following structure is used to keep track of the interpreters
* registered by this process.
*/
typedef struct RegisteredInterp {
char *name; /* Interpreter's name (malloc-ed). */
- Tcl_Interp *interp; /* Interpreter associated with name. NULL
+ Tcl_Interp *interp; /* Interpreter associated with name. NULL
* means that the application was unregistered
- * or deleted while a send was in progress
- * to it. */
- TkDisplay *dispPtr; /* Display for the application. Needed
- * because we may need to unregister the
- * interpreter after its main window has
- * been deleted. */
+ * or deleted while a send was in progress to
+ * it. */
+ TkDisplay *dispPtr; /* Display for the application. Needed because
+ * we may need to unregister the interpreter
+ * after its main window has been deleted. */
struct RegisteredInterp *nextPtr;
- /* Next in list of names associated
- * with interps in this process.
- * NULL means end of list. */
+ /* Next in list of names associated with
+ * interps in this process. NULL means end of
+ * list. */
} RegisteredInterp;
/*
- * A registry of all interpreters for a display is kept in a
- * property "InterpRegistry" on the root window of the display.
- * It is organized as a series of zero or more concatenated strings
- * (in no particular order), each of the form
+ * A registry of all interpreters for a display is kept in a property
+ * "InterpRegistry" on the root window of the display. It is organized as a
+ * series of zero or more concatenated strings (in no particular order), each
+ * of the form
* window space name '\0'
- * where "window" is the hex id of the comm. window to use to talk
- * to an interpreter named "name".
+ * where "window" is the hex id of the comm. window to use to talk to an
+ * interpreter named "name".
*
- * When the registry is being manipulated by an application (e.g. to
- * add or remove an entry), it is loaded into memory using a structure
- * of the following type:
+ * When the registry is being manipulated by an application (e.g. to add or
+ * remove an entry), it is loaded into memory using a structure of the
+ * following type:
*/
typedef struct NameRegistry {
TkDisplay *dispPtr; /* Display from which the registry was
* read. */
- int locked; /* Non-zero means that the display was
- * locked when the property was read in. */
- int modified; /* Non-zero means that the property has
- * been modified, so it needs to be written
- * out when the NameRegistry is closed. */
+ int locked; /* Non-zero means that the display was locked
+ * when the property was read in. */
+ int modified; /* Non-zero means that the property has been
+ * modified, so it needs to be written out
+ * when the NameRegistry is closed. */
unsigned long propLength; /* Length of the property, in bytes. */
- char *property; /* The contents of the property, or NULL
- * if none. See format description above;
- * this is *not* terminated by the first
- * null character. Dynamically allocated. */
+ char *property; /* The contents of the property, or NULL if
+ * none. See format description above; this is
+ * *not* terminated by the first null
+ * character. Dynamically allocated. */
int allocedByX; /* Non-zero means must free property with
- * XFree; zero means use ckfree. */
+ * XFree; zero means use ckfree. */
} NameRegistry;
/*
- * When a result is being awaited from a sent command, one of
- * the following structures is present on a list of all outstanding
- * sent commands. The information in the structure is used to
- * process the result when it arrives. You're probably wondering
- * how there could ever be multiple outstanding sent commands.
- * This could happen if interpreters invoke each other recursively.
+ * When a result is being awaited from a sent command, one of the following
+ * structures is present on a list of all outstanding sent commands. The
+ * information in the structure is used to process the result when it arrives.
+ * You're probably wondering how there could ever be multiple outstanding sent
+ * commands. This could happen if interpreters invoke each other recursively.
* It's unlikely, but possible.
*/
typedef struct PendingCommand {
- int serial; /* Serial number expected in
- * result. */
+ int serial; /* Serial number expected in result. */
TkDisplay *dispPtr; /* Display being used for communication. */
- CONST char *target; /* Name of interpreter command is
- * being sent to. */
+ const char *target; /* Name of interpreter command is being sent
+ * to. */
Window commWindow; /* Target's communication window. */
- Tcl_Interp *interp; /* Interpreter from which the send
- * was invoked. */
- int code; /* Tcl return code for command
- * will be stored here. */
- char *result; /* String result for command (malloc'ed),
- * or NULL. */
- char *errorInfo; /* Information for "errorInfo" variable,
- * or NULL (malloc'ed). */
- char *errorCode; /* Information for "errorCode" variable,
- * or NULL (malloc'ed). */
- int gotResponse; /* 1 means a response has been received,
- * 0 means the command is still outstanding. */
+ Tcl_Interp *interp; /* Interpreter from which the send was
+ * invoked. */
+ int code; /* Tcl return code for command will be stored
+ * here. */
+ char *result; /* String result for command (malloc'ed), or
+ * NULL. */
+ char *errorInfo; /* Information for "errorInfo" variable, or
+ * NULL (malloc'ed). */
+ char *errorCode; /* Information for "errorCode" variable, or
+ * NULL (malloc'ed). */
+ int gotResponse; /* 1 means a response has been received, 0
+ * means the command is still outstanding. */
struct PendingCommand *nextPtr;
- /* Next in list of all outstanding
- * commands. NULL means end of
- * list. */
+ /* Next in list of all outstanding commands.
+ * NULL means end of list. */
} PendingCommand;
typedef struct ThreadSpecificData {
- PendingCommand *pendingCommands;
- /* List of all commands currently
- * being waited for. */
+ PendingCommand *pendingCommands;
+ /* List of all commands currently being waited
+ * for. */
RegisteredInterp *interpListPtr;
- /* List of all interpreters registered
- * in the current process. */
+ /* List of all interpreters registered in the
+ * current process. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
- * The information below is used for communication between processes
- * during "send" commands. Each process keeps a private window, never
- * even mapped, with one property, "Comm". When a command is sent to
- * an interpreter, the command is appended to the comm property of the
- * communication window associated with the interp's process. Similarly,
- * when a result is returned from a sent command, it is also appended
- * to the comm property.
- *
- * Each command and each result takes the form of ASCII text. For a
- * command, the text consists of a zero character followed by several
- * null-terminated ASCII strings. The first string consists of the
- * single letter "c". Subsequent strings have the form "option value"
- * where the following options are supported:
+ * The information below is used for communication between processes during
+ * "send" commands. Each process keeps a private window, never even mapped,
+ * with one property, "Comm". When a command is sent to an interpreter, the
+ * command is appended to the comm property of the communication window
+ * associated with the interp's process. Similarly, when a result is returned
+ * from a sent command, it is also appended to the comm property.
+ *
+ * Each command and each result takes the form of ASCII text. For a command,
+ * the text consists of a zero character followed by several null-terminated
+ * ASCII strings. The first string consists of the single letter "c".
+ * Subsequent strings have the form "option value" where the following options
+ * are supported:
*
* -r commWindow serial
*
- * This option means that a response should be sent to the window
- * whose X identifier is "commWindow" (in hex), and the response should
- * be identified with the serial number given by "serial" (in decimal).
- * If this option isn't specified then the send is asynchronous and
- * no response is sent.
+ * This option means that a response should be sent to the window whose X
+ * identifier is "commWindow" (in hex), and the response should be
+ * identified with the serial number given by "serial" (in decimal). If
+ * this option isn't specified then the send is asynchronous and no
+ * response is sent.
*
* -n name
+ *
* "Name" gives the name of the application for which the command is
- * intended. This option must be present.
+ * intended. This option must be present.
*
* -s script
*
- * "Script" is the script to be executed. This option must be present.
+ * "Script" is the script to be executed. This option must be present.
*
- * The options may appear in any order. The -n and -s options must be
- * present, but -r may be omitted for asynchronous RPCs. For compatibility
- * with future releases that may add new features, there may be additional
- * options present; as long as they start with a "-" character, they will
- * be ignored.
+ * The options may appear in any order. The -n and -s options must be present,
+ * but -r may be omitted for asynchronous RPCs. For compatibility with future
+ * releases that may add new features, there may be additional options
+ * present; as long as they start with a "-" character, they will be ignored.
*
* A result also consists of a zero character followed by several null-
- * terminated ASCII strings. The first string consists of the single
- * letter "r". Subsequent strings have the form "option value" where
- * the following options are supported:
+ * terminated ASCII strings. The first string consists of the single letter
+ * "r". Subsequent strings have the form "option value" where the following
+ * options are supported:
*
* -s serial
*
- * Identifies the command for which this is the result. It is the
- * same as the "serial" field from the -s option in the command. This
- * option must be present.
+ * Identifies the command for which this is the result. It is the same as
+ * the "serial" field from the -s option in the command. This option must
+ * be present.
*
* -c code
*
- * "Code" is the completion code for the script, in decimal. If the
- * code is omitted it defaults to TCL_OK.
+ * "Code" is the completion code for the script, in decimal. If the code
+ * is omitted it defaults to TCL_OK.
*
* -r result
*
- * "Result" is the result string for the script, which may be either
- * a result or an error message. If this field is omitted then it
- * defaults to an empty string.
+ * "Result" is the result string for the script, which may be either a
+ * result or an error message. If this field is omitted then it defaults
+ * to an empty string.
*
* -i errorInfo
*
* "ErrorInfo" gives a string with which to initialize the errorInfo
- * variable. This option may be omitted; it is ignored unless the
+ * variable. This option may be omitted; it is ignored unless the
* completion code is TCL_ERROR.
*
* -e errorCode
*
* "ErrorCode" gives a string with with to initialize the errorCode
- * variable. This option may be omitted; it is ignored unless the
+ * variable. This option may be omitted; it is ignored unless the
* completion code is TCL_ERROR.
*
- * Options may appear in any order, and only the -s option must be
- * present. As with commands, there may be additional options besides
- * these; unknown options are ignored.
+ * Options may appear in any order, and only the -s option must be present. As
+ * with commands, there may be additional options besides these; unknown
+ * options are ignored.
*/
/*
- * The following variable is the serial number that was used in the
- * last "send" command. It is exported only for testing purposes.
+ * Other miscellaneous per-process data:
*/
-int tkSendSerial = 0;
+static struct {
+ int sendSerial; /* The serial number that was used in the last
+ * "send" command. */
+ int sendDebug; /* This can be set while debugging to do
+ * things like skip locking the server. */
+} localData = {0, 0};
/*
- * Maximum size property that can be read at one time by
- * this module:
+ * Maximum size property that can be read at one time by this module:
*/
#define MAX_PROP_WORDS 100000
/*
- * The following variable can be set while debugging to do things like
- * skip locking the server.
- */
-
-static int sendDebug = 0;
-
-/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-static int AppendErrorProc _ANSI_ARGS_((ClientData clientData,
- XErrorEvent *errorPtr));
-static void AppendPropCarefully _ANSI_ARGS_((Display *display,
+static int AppendErrorProc(ClientData clientData,
+ XErrorEvent *errorPtr);
+static void AppendPropCarefully(Display *display,
Window window, Atom property, char *value,
- int length, PendingCommand *pendingPtr));
-static void DeleteProc _ANSI_ARGS_((ClientData clientData));
-static void RegAddName _ANSI_ARGS_((NameRegistry *regPtr,
- CONST char *name, Window commWindow));
-static void RegClose _ANSI_ARGS_((NameRegistry *regPtr));
-static void RegDeleteName _ANSI_ARGS_((NameRegistry *regPtr,
- CONST char *name));
-static Window RegFindName _ANSI_ARGS_((NameRegistry *regPtr,
- CONST char *name));
-static NameRegistry * RegOpen _ANSI_ARGS_((Tcl_Interp *interp,
- TkDisplay *dispPtr, int lock));
-static void SendEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static int SendInit _ANSI_ARGS_((Tcl_Interp *interp,
- TkDisplay *dispPtr));
-static Tk_RestrictAction SendRestrictProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static int ServerSecure _ANSI_ARGS_((TkDisplay *dispPtr));
-static void UpdateCommWindow _ANSI_ARGS_((TkDisplay *dispPtr));
-static int ValidateName _ANSI_ARGS_((TkDisplay *dispPtr,
- CONST char *name, Window commWindow, int oldOK));
+ int length, PendingCommand *pendingPtr);
+static void DeleteProc(ClientData clientData);
+static void RegAddName(NameRegistry *regPtr,
+ const char *name, Window commWindow);
+static void RegClose(NameRegistry *regPtr);
+static void RegDeleteName(NameRegistry *regPtr, const char *name);
+static Window RegFindName(NameRegistry *regPtr, const char *name);
+static NameRegistry * RegOpen(Tcl_Interp *interp,
+ TkDisplay *dispPtr, int lock);
+static void SendEventProc(ClientData clientData, XEvent *eventPtr);
+static int SendInit(Tcl_Interp *interp, TkDisplay *dispPtr);
+static Tk_RestrictProc SendRestrictProc;
+static int ServerSecure(TkDisplay *dispPtr);
+static void UpdateCommWindow(TkDisplay *dispPtr);
+static int ValidateName(TkDisplay *dispPtr, const char *name,
+ Window commWindow, int oldOK);
/*
*----------------------------------------------------------------------
*
* RegOpen --
*
- * This procedure loads the name registry for a display into
- * memory so that it can be manipulated.
+ * This function loads the name registry for a display into memory so
+ * that it can be manipulated.
*
* Results:
* The return value is a pointer to the loaded registry.
*
* Side effects:
- * If "lock" is set then the server will be locked. It is the
- * caller's responsibility to call RegClose when finished with
- * the registry, so that we can write back the registry if
- * needed, unlock the server if needed, and free memory.
+ * If "lock" is set then the server will be locked. It is the caller's
+ * responsibility to call RegClose when finished with the registry, so
+ * that we can write back the registry if needed, unlock the server if
+ * needed, and free memory.
*
*----------------------------------------------------------------------
*/
static NameRegistry *
-RegOpen(interp, dispPtr, lock)
- Tcl_Interp *interp; /* Interpreter to use for error reporting
- * (errors cause a panic so in fact no
- * error is ever returned, but the interpreter
- * is needed anyway). */
- TkDisplay *dispPtr; /* Display whose name registry is to be
+RegOpen(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting
+ * (errors cause a panic so in fact no error
+ * is ever returned, but the interpreter is
+ * needed anyway). */
+ TkDisplay *dispPtr, /* Display whose name registry is to be
* opened. */
- int lock; /* Non-zero means lock the window server
- * when opening the registry, so no-one
- * else can use the registry until we
- * close it. */
+ int lock) /* Non-zero means lock the window server when
+ * opening the registry, so no-one else can
+ * use the registry until we close it. */
{
NameRegistry *regPtr;
int result, actualFormat;
unsigned long bytesAfter;
Atom actualType;
+ char **propertyPtr;
if (dispPtr->commTkwin == NULL) {
SendInit(interp, dispPtr);
}
- regPtr = (NameRegistry *) ckalloc(sizeof(NameRegistry));
+ regPtr = ckalloc(sizeof(NameRegistry));
regPtr->dispPtr = dispPtr;
regPtr->locked = 0;
regPtr->modified = 0;
regPtr->allocedByX = 1;
+ propertyPtr = &regPtr->property;
- if (lock && !sendDebug) {
+ if (lock && !localData.sendDebug) {
XGrabServer(dispPtr->display);
regPtr->locked = 1;
}
@@ -303,7 +287,7 @@ RegOpen(interp, dispPtr, lock)
dispPtr->registryProperty, 0, MAX_PROP_WORDS,
False, XA_STRING, &actualType, &actualFormat,
&regPtr->propLength, &bytesAfter,
- (unsigned char **) &regPtr->property);
+ (unsigned char **) propertyPtr);
if (actualType == None) {
regPtr->propLength = 0;
@@ -311,7 +295,7 @@ RegOpen(interp, dispPtr, lock)
} else if ((result != Success) || (actualFormat != 8)
|| (actualType != XA_STRING)) {
/*
- * The property is improperly formed; delete it.
+ * The property is improperly formed; delete it.
*/
if (regPtr->property != NULL) {
@@ -325,11 +309,11 @@ RegOpen(interp, dispPtr, lock)
}
/*
- * Xlib placed an extra null byte after the end of the property, just
- * to make sure that it is always NULL-terminated. Be sure to include
- * this byte in our count if it's needed to ensure null termination
- * (note: as of 8/95 I'm no longer sure why this code is needed; seems
- * like it shouldn't be).
+ * Xlib placed an extra null byte after the end of the property, just to
+ * make sure that it is always NULL-terminated. Be sure to include this
+ * byte in our count if it's needed to ensure null termination (note: as
+ * of 8/95 I'm no longer sure why this code is needed; seems like it
+ * shouldn't be).
*/
if ((regPtr->propLength > 0)
@@ -344,14 +328,13 @@ RegOpen(interp, dispPtr, lock)
*
* RegFindName --
*
- * Given an open name registry, this procedure finds an entry
- * with a given name, if there is one, and returns information
- * about that entry.
+ * Given an open name registry, this function finds an entry with a given
+ * name, if there is one, and returns information about that entry.
*
* Results:
- * The return value is the X identifier for the comm window for
- * the application named "name", or None if there is no such
- * entry in the registry.
+ * The return value is the X identifier for the comm window for the
+ * application named "name", or None if there is no such entry in the
+ * registry.
*
* Side effects:
* None.
@@ -360,24 +343,26 @@ RegOpen(interp, dispPtr, lock)
*/
static Window
-RegFindName(regPtr, name)
- NameRegistry *regPtr; /* Pointer to a registry opened with a
+RegFindName(
+ NameRegistry *regPtr, /* Pointer to a registry opened with a
* previous call to RegOpen. */
- CONST char *name; /* Name of an application. */
+ const char *name) /* Name of an application. */
{
- char *p, *entry;
- unsigned int id;
+ char *p;
+
+ for (p=regPtr->property ; p-regPtr->property<(int)regPtr->propLength ;) {
+ char *entry = p;
- for (p = regPtr->property; (p-regPtr->property) < (int) regPtr->propLength; ) {
- entry = p;
while ((*p != 0) && (!isspace(UCHAR(*p)))) {
p++;
}
if ((*p != 0) && (strcmp(name, p+1) == 0)) {
+ unsigned id;
+
if (sscanf(entry, "%x", &id) == 1) {
/*
- * Must cast from an unsigned int to a Window in case we
- * are on a 64-bit architecture.
+ * Must cast from an unsigned int to a Window in case we are
+ * on a 64-bit architecture.
*/
return (Window) id;
@@ -396,31 +381,31 @@ RegFindName(regPtr, name)
*
* RegDeleteName --
*
- * This procedure deletes the entry for a given name from
- * an open registry.
+ * This function deletes the entry for a given name from an open
+ * registry.
*
* Results:
* None.
*
* Side effects:
- * If there used to be an entry named "name" in the registry,
- * then it is deleted and the registry is marked as modified
- * so it will be written back when closed.
+ * If there used to be an entry named "name" in the registry, then it is
+ * deleted and the registry is marked as modified so it will be written
+ * back when closed.
*
*----------------------------------------------------------------------
*/
static void
-RegDeleteName(regPtr, name)
- NameRegistry *regPtr; /* Pointer to a registry opened with a
+RegDeleteName(
+ NameRegistry *regPtr, /* Pointer to a registry opened with a
* previous call to RegOpen. */
- CONST char *name; /* Name of an application. */
+ const char *name) /* Name of an application. */
{
- char *p, *entry, *entryName;
- int count;
+ char *p;
+
+ for (p=regPtr->property ; p-regPtr->property<(int)regPtr->propLength ;) {
+ char *entry = p, *entryName;
- for (p = regPtr->property; (p-regPtr->property) < (int) regPtr->propLength; ) {
- entry = p;
while ((*p != 0) && (!isspace(UCHAR(*p)))) {
p++;
}
@@ -432,21 +417,23 @@ RegDeleteName(regPtr, name)
p++;
}
p++;
- if ((strcmp(name, entryName) == 0)) {
+ if (strcmp(name, entryName) == 0) {
+ int count;
+
/*
- * Found the matching entry. Copy everything after it
- * down on top of it.
+ * Found the matching entry. Copy everything after it down on top
+ * of it.
*/
count = regPtr->propLength - (p - regPtr->property);
- if (count > 0) {
+ if (count > 0) {
char *src, *dst;
- for (src = p, dst = entry; count > 0; src++, dst++, count--) {
+ for (src=p , dst=entry ; count>0 ; src++, dst++, count--) {
*dst = *src;
}
}
- regPtr->propLength -= p - entry;
+ regPtr->propLength -= p - entry;
regPtr->modified = 1;
return;
}
@@ -464,35 +451,33 @@ RegDeleteName(regPtr, name)
* None.
*
* Side effects:
- * The open registry is expanded; it is marked as modified so that
- * it will be written back when closed.
+ * The open registry is expanded; it is marked as modified so that it
+ * will be written back when closed.
*
*----------------------------------------------------------------------
*/
static void
-RegAddName(regPtr, name, commWindow)
- NameRegistry *regPtr; /* Pointer to a registry opened with a
+RegAddName(
+ NameRegistry *regPtr, /* Pointer to a registry opened with a
* previous call to RegOpen. */
- CONST char *name; /* Name of an application. The caller
- * must ensure that this name isn't
- * already registered. */
- Window commWindow; /* X identifier for comm. window of
- * application. */
+ const char *name, /* Name of an application. The caller must
+ * ensure that this name isn't already
+ * registered. */
+ Window commWindow) /* X identifier for comm. window of
+ * application. */
{
- char id[30];
- char *newProp;
+ char id[30], *newProp;
int idLength, newBytes;
- sprintf(id, "%x ", (unsigned int) commWindow);
+ sprintf(id, "%x ", (unsigned) commWindow);
idLength = strlen(id);
newBytes = idLength + strlen(name) + 1;
- newProp = (char *) ckalloc((unsigned) (regPtr->propLength + newBytes));
+ newProp = ckalloc(regPtr->propLength + newBytes);
strcpy(newProp, id);
strcpy(newProp+idLength, name);
if (regPtr->property != NULL) {
- memcpy((VOID *) (newProp + newBytes), (VOID *) regPtr->property,
- regPtr->propLength);
+ memcpy(newProp + newBytes, regPtr->property, regPtr->propLength);
if (regPtr->allocedByX) {
XFree(regPtr->property);
} else {
@@ -510,29 +495,28 @@ RegAddName(regPtr, name, commWindow)
*
* RegClose --
*
- * This procedure is called to end a series of operations on
- * a name registry.
+ * This function is called to end a series of operations on a name
+ * registry.
*
* Results:
* None.
*
* Side effects:
- * The registry is written back if it has been modified, and the
- * X server is unlocked if it was locked. Memory for the
- * registry is freed, so the caller should never use regPtr
- * again.
+ * The registry is written back if it has been modified, and the X server
+ * is unlocked if it was locked. Memory for the registry is freed, so the
+ * caller should never use regPtr again.
*
*----------------------------------------------------------------------
*/
static void
-RegClose(regPtr)
- NameRegistry *regPtr; /* Pointer to a registry opened with a
+RegClose(
+ NameRegistry *regPtr) /* Pointer to a registry opened with a
* previous call to RegOpen. */
{
if (regPtr->modified) {
- if (!regPtr->locked && !sendDebug) {
- panic("The name registry was modified without being locked!");
+ if (!regPtr->locked && !localData.sendDebug) {
+ Tcl_Panic("The name registry was modified without being locked!");
}
XChangeProperty(regPtr->dispPtr->display,
RootWindow(regPtr->dispPtr->display, 0),
@@ -547,11 +531,11 @@ RegClose(regPtr)
/*
* After ungrabbing the server, it's important to flush the output
- * immediately so that the server sees the ungrab command. Otherwise
- * we might do something else that needs to communicate with the
- * server (such as invoking a subprocess that needs to do I/O to
- * the screen); if the ungrab command is still sitting in our
- * output buffer, we could deadlock.
+ * immediately so that the server sees the ungrab command. Otherwise we
+ * might do something else that needs to communicate with the server (such
+ * as invoking a subprocess that needs to do I/O to the screen); if the
+ * ungrab command is still sitting in our output buffer, we could
+ * deadlock.
*/
XFlush(regPtr->dispPtr->display);
@@ -563,7 +547,7 @@ RegClose(regPtr)
ckfree(regPtr->property);
}
}
- ckfree((char *) regPtr);
+ ckfree(regPtr);
}
/*
@@ -571,12 +555,12 @@ RegClose(regPtr)
*
* ValidateName --
*
- * This procedure checks to see if an entry in the registry
- * is still valid.
+ * This function checks to see if an entry in the registry is still
+ * valid.
*
* Results:
- * The return value is 1 if the given commWindow exists and its
- * name is "name". Otherwise 0 is returned.
+ * The return value is 1 if the given commWindow exists and its name is
+ * "name". Otherwise 0 is returned.
*
* Side effects:
* None.
@@ -585,52 +569,50 @@ RegClose(regPtr)
*/
static int
-ValidateName(dispPtr, name, commWindow, oldOK)
- TkDisplay *dispPtr; /* Display for which to perform the
+ValidateName(
+ TkDisplay *dispPtr, /* Display for which to perform the
* validation. */
- CONST char *name; /* The name of an application. */
- Window commWindow; /* X identifier for the application's
- * comm. window. */
- int oldOK; /* Non-zero means that we should consider
- * an application to be valid even if it
- * looks like an old-style (pre-4.0) one;
- * 0 means consider these invalid. */
+ const char *name, /* The name of an application. */
+ Window commWindow, /* X identifier for the application's comm.
+ * window. */
+ int oldOK) /* Non-zero means that we should consider an
+ * application to be valid even if it looks
+ * like an old-style (pre-4.0) one; 0 means
+ * consider these invalid. */
{
int result, actualFormat, argc, i;
unsigned long length, bytesAfter;
Atom actualType;
- char *property;
+ char *property, **propertyPtr = &property;
Tk_ErrorHandler handler;
- CONST char **argv;
+ const char **argv;
property = NULL;
/*
- * Ignore X errors when reading the property (e.g., the window
- * might not exist). If an error occurs, result will be some
- * value other than Success.
+ * Ignore X errors when reading the property (e.g., the window might not
+ * exist). If an error occurs, result will be some value other than
+ * Success.
*/
- handler = Tk_CreateErrorHandler(dispPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ handler = Tk_CreateErrorHandler(dispPtr->display, -1, -1, -1, NULL, NULL);
result = XGetWindowProperty(dispPtr->display, commWindow,
dispPtr->appNameProperty, 0, MAX_PROP_WORDS,
False, XA_STRING, &actualType, &actualFormat,
- &length, &bytesAfter, (unsigned char **) &property);
+ &length, &bytesAfter, (unsigned char **) propertyPtr);
if ((result == Success) && (actualType == None)) {
XWindowAttributes atts;
/*
- * The comm. window exists but the property we're looking for
- * doesn't exist. This probably means that the application
- * comes from an older version of Tk (< 4.0) that didn't set the
- * property; if this is the case, then assume for compatibility's
- * sake that everything's OK. However, it's also possible that
- * some random application has re-used the window id for something
- * totally unrelated. Check a few characteristics of the window,
- * such as its dimensions and mapped state, to be sure that it
- * still "smells" like a commWindow.
+ * The comm. window exists but the property we're looking for doesn't
+ * exist. This probably means that the application comes from an older
+ * version of Tk (< 4.0) that didn't set the property; if this is the
+ * case, then assume for compatibility's sake that everything's OK.
+ * However, it's also possible that some random application has
+ * re-used the window id for something totally unrelated. Check a few
+ * characteristics of the window, such as its dimensions and mapped
+ * state, to be sure that it still "smells" like a commWindow.
*/
if (!oldOK
@@ -642,20 +624,19 @@ ValidateName(dispPtr, name, commWindow, oldOK)
result = 1;
}
} else if ((result == Success) && (actualFormat == 8)
- && (actualType == XA_STRING)) {
+ && (actualType == XA_STRING)) {
result = 0;
- if (Tcl_SplitList((Tcl_Interp *) NULL, property, &argc, &argv)
- == TCL_OK) {
+ if (Tcl_SplitList(NULL, property, &argc, &argv) == TCL_OK) {
for (i = 0; i < argc; i++) {
if (strcmp(argv[i], name) == 0) {
result = 1;
break;
}
}
- ckfree((char *) argv);
+ ckfree(argv);
}
} else {
- result = 0;
+ result = 0;
}
Tk_DeleteErrorHandler(handler);
if (property != NULL) {
@@ -669,15 +650,14 @@ ValidateName(dispPtr, name, commWindow, oldOK)
*
* ServerSecure --
*
- * Check whether a server is secure enough for us to trust
- * Tcl scripts arriving via that server.
+ * Check whether a server is secure enough for us to trust Tcl scripts
+ * arriving via that server.
*
* Results:
- * The return value is 1 if the server is secure, which means
- * that host-style authentication is turned on but there are
- * no hosts in the enabled list. This means that some other
- * form of authorization (presumably more secure, such as xauth)
- * is in use.
+ * The return value is 1 if the server is secure, which means that
+ * host-style authentication is turned on but there are no hosts in the
+ * enabled list. This means that some other form of authorization
+ * (presumably more secure, such as xauth) is in use.
*
* Side effects:
* None.
@@ -686,8 +666,8 @@ ValidateName(dispPtr, name, commWindow, oldOK)
*/
static int
-ServerSecure(dispPtr)
- TkDisplay *dispPtr; /* Display to check. */
+ServerSecure(
+ TkDisplay *dispPtr) /* Display to check. */
{
#ifdef TK_NO_SECURITY
return 1;
@@ -696,10 +676,74 @@ ServerSecure(dispPtr)
int numHosts, secure;
Bool enabled;
- secure = 0;
addrPtr = XListHosts(dispPtr->display, &numHosts, &enabled);
- if (enabled && (numHosts == 0)) {
+ if (!enabled) {
+ insecure:
+ secure = 0;
+ } else if (numHosts == 0) {
secure = 1;
+ } else {
+ /*
+ * Recent versions of X11 have the extra feature of allowing more
+ * sophisticated authorization checks to be performed than the dozy
+ * old ones that used to plague xhost usage. However, not all deployed
+ * versions of Xlib know how to deal with this feature, so this code
+ * is conditional on having the right #def in place. [Bug 1909931]
+ *
+ * Note that at this point we know that there's at least one entry in
+ * the list returned by XListHosts. However there may be multiple
+ * entries; as long as each is one of either 'SI:localhost:*' or
+ * 'SI:localgroup:*' then we will claim to be secure enough.
+ */
+
+#ifdef FamilyServerInterpreted
+ XServerInterpretedAddress *siPtr;
+ int i;
+
+ for (i=0 ; i<numHosts ; i++) {
+ if (addrPtr[i].family != FamilyServerInterpreted) {
+ /*
+ * We don't understand what the X server is letting in, so we
+ * err on the side of safety.
+ */
+
+ goto insecure;
+ }
+ siPtr = (XServerInterpretedAddress *) addrPtr[0].address;
+
+ /*
+ * We don't check the username or group here. This is because it's
+ * officially non-portable and we are just making sure there
+ * aren't silly misconfigurations. (Apparently 'root' is not a
+ * very good choice, but we still don't put any effort in to spot
+ * that.) However we do check to see that the constraints are
+ * imposed against the connecting user and/or group.
+ */
+
+ if ( !(siPtr->typelength == 9 /* ==strlen("localuser") */
+ && !memcmp(siPtr->type, "localuser", 9))
+ && !(siPtr->typelength == 10 /* ==strlen("localgroup") */
+ && !memcmp(siPtr->type, "localgroup", 10))) {
+ /*
+ * The other defined types of server-interpreted controls
+ * involve particular hosts. These are still insecure for the
+ * same reasons that classic xhost access is insecure; there's
+ * just no way to be sure that the users on those systems are
+ * the ones who should be allowed to connect to this display.
+ */
+
+ goto insecure;
+ }
+ }
+ secure = 1;
+#else
+ /*
+ * We don't understand what the X server is letting in, so we err on
+ * the side of safety.
+ */
+
+ secure = 0;
+#endif /* FamilyServerInterpreted */
}
if (addrPtr != NULL) {
XFree((char *) addrPtr);
@@ -709,39 +753,38 @@ ServerSecure(dispPtr)
}
/*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*
* Tk_SetAppName --
*
- * This procedure is called to associate an ASCII name with a Tk
- * application. If the application has already been named, the
- * name replaces the old one.
+ * This function is called to associate an ASCII name with a Tk
+ * application. If the application has already been named, the name
+ * replaces the old one.
*
* Results:
- * The return value is the name actually given to the application.
- * This will normally be the same as name, but if name was already
- * in use for an application then a name of the form "name #2" will
- * be chosen, with a high enough number to make the name unique.
+ * The return value is the name actually given to the application. This
+ * will normally be the same as name, but if name was already in use for
+ * an application then a name of the form "name #2" will be chosen, with
+ * a high enough number to make the name unique.
*
* Side effects:
- * Registration info is saved, thereby allowing the "send" command
- * to be used later to invoke commands in the application. In
- * addition, the "send" command is created in the application's
- * interpreter. The registration will be removed automatically
- * if the interpreter is deleted or the "send" command is removed.
+ * Registration info is saved, thereby allowing the "send" command to be
+ * used later to invoke commands in the application. In addition, the
+ * "send" command is created in the application's interpreter. The
+ * registration will be removed automatically if the interpreter is
+ * deleted or the "send" command is removed.
*
- *--------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
-CONST char *
-Tk_SetAppName(tkwin, name)
- Tk_Window tkwin; /* Token for any window in the application
- * to be named: it is just used to identify
- * the application and the display. */
- CONST char *name; /* The name that will be used to
- * refer to the interpreter in later
- * "send" commands. Must be globally
- * unique. */
+const char *
+Tk_SetAppName(
+ Tk_Window tkwin, /* Token for any window in the application to
+ * be named: it is just used to identify the
+ * application and the display. */
+ const char *name) /* The name that will be used to refer to the
+ * interpreter in later "send" commands. Must
+ * be globally unique. */
{
RegisteredInterp *riPtr, *riPtr2;
Window w;
@@ -749,11 +792,11 @@ Tk_SetAppName(tkwin, name)
TkDisplay *dispPtr = winPtr->dispPtr;
NameRegistry *regPtr;
Tcl_Interp *interp;
- CONST char *actualName;
+ const char *actualName;
Tcl_DString dString;
int offset, i;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr =
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
interp = winPtr->mainPtr->interp;
if (dispPtr->commTkwin == NULL) {
@@ -761,37 +804,35 @@ Tk_SetAppName(tkwin, name)
}
/*
- * See if the application is already registered; if so, remove its
- * current name from the registry.
+ * See if the application is already registered; if so, remove its current
+ * name from the registry.
*/
regPtr = RegOpen(interp, winPtr->dispPtr, 1);
for (riPtr = tsdPtr->interpListPtr; ; riPtr = riPtr->nextPtr) {
if (riPtr == NULL) {
-
/*
- * This interpreter isn't currently registered; create
- * the data structure that will be used to register it locally,
- * plus add the "send" command to the interpreter.
+ * This interpreter isn't currently registered; create the data
+ * structure that will be used to register it locally, plus add
+ * the "send" command to the interpreter.
*/
- riPtr = (RegisteredInterp *) ckalloc(sizeof(RegisteredInterp));
+ riPtr = ckalloc(sizeof(RegisteredInterp));
riPtr->interp = interp;
riPtr->dispPtr = winPtr->dispPtr;
riPtr->nextPtr = tsdPtr->interpListPtr;
tsdPtr->interpListPtr = riPtr;
riPtr->name = NULL;
- Tcl_CreateCommand(interp, "send", Tk_SendCmd, (ClientData) riPtr,
- DeleteProc);
- if (Tcl_IsSafe(interp)) {
- Tcl_HideCommand(interp, "send", "send");
- }
+ Tcl_CreateCommand(interp, "send", Tk_SendCmd, riPtr, DeleteProc);
+ if (Tcl_IsSafe(interp)) {
+ Tcl_HideCommand(interp, "send", "send");
+ }
break;
}
if (riPtr->interp == interp) {
/*
- * The interpreter is currently registered; remove it from
- * the name registry.
+ * The interpreter is currently registered; remove it from the
+ * name registry.
*/
if (riPtr->name) {
@@ -803,10 +844,9 @@ Tk_SetAppName(tkwin, name)
}
/*
- * Pick a name to use for the application. Use "name" if it's not
- * already in use. Otherwise add a suffix such as " #2", trying
- * larger and larger numbers until we eventually find one that is
- * unique.
+ * Pick a name to use for the application. Use "name" if it's not already
+ * in use. Otherwise add a suffix such as " #2", trying larger and larger
+ * numbers until we eventually find one that is unique.
*/
actualName = name;
@@ -828,16 +868,16 @@ Tk_SetAppName(tkwin, name)
if (w == None) {
break;
}
-
+
/*
- * The name appears to be in use already, but double-check to
- * be sure (perhaps the application died without removing its
- * name from the registry?).
+ * The name appears to be in use already, but double-check to be sure
+ * (perhaps the application died without removing its name from the
+ * registry?).
*/
if (w == Tk_WindowId(dispPtr->commTkwin)) {
- for (riPtr2 = tsdPtr->interpListPtr; riPtr2 != NULL;
- riPtr2 = riPtr2->nextPtr) {
+ for (riPtr2 = tsdPtr->interpListPtr; riPtr2 != NULL;
+ riPtr2 = riPtr2->nextPtr) {
if ((riPtr2->interp != interp) &&
(strcmp(riPtr2->name, actualName) == 0)) {
goto nextSuffix;
@@ -849,19 +889,19 @@ Tk_SetAppName(tkwin, name)
RegDeleteName(regPtr, actualName);
break;
}
- nextSuffix:
+ nextSuffix:
continue;
}
/*
- * We've now got a name to use. Store it in the name registry and
- * in the local entry for this application, plus put it in a property
- * on the commWindow.
+ * We've now got a name to use. Store it in the name registry and in the
+ * local entry for this application, plus put it in a property on the
+ * commWindow.
*/
RegAddName(regPtr, actualName, Tk_WindowId(dispPtr->commTkwin));
RegClose(regPtr);
- riPtr->name = (char *) ckalloc((unsigned) (strlen(actualName) + 1));
+ riPtr->name = ckalloc(strlen(actualName) + 1);
strcpy(riPtr->name, actualName);
if (actualName != name) {
Tcl_DStringFree(&dString);
@@ -876,8 +916,8 @@ Tk_SetAppName(tkwin, name)
*
* Tk_SendCmd --
*
- * This procedure is invoked to process the "send" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "send" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -889,31 +929,30 @@ Tk_SetAppName(tkwin, name)
*/
int
-Tk_SendCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Information about sender (only
- * dispPtr field is used). */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+Tk_SendCmd(
+ ClientData clientData, /* Information about sender (only dispPtr
+ * field is used). */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ const char **argv) /* Argument strings. */
{
TkWindow *winPtr;
Window commWindow;
PendingCommand pending;
register RegisteredInterp *riPtr;
- CONST char *destName;
+ const char *destName;
int result, c, async, i, firstArg;
size_t length;
- Tk_RestrictProc *prevRestrictProc;
+ Tk_RestrictProc *prevProc;
ClientData prevArg;
TkDisplay *dispPtr;
Tcl_Time timeout;
NameRegistry *regPtr;
Tcl_DString request;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- Tcl_Interp *localInterp; /* Used when the interpreter to
- * send the command to is within
- * the same process. */
+ ThreadSpecificData *tsdPtr =
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_Interp *localInterp; /* Used when the interpreter to send the
+ * command to is within the same process. */
/*
* Process options, if any.
@@ -946,14 +985,14 @@ Tk_SendCmd(clientData, interp, argc, argv)
break;
} else {
Tcl_AppendResult(interp, "bad option \"", argv[i],
- "\": must be -async, -displayof, or --", (char *) NULL);
+ "\": must be -async, -displayof, or --", NULL);
return TCL_ERROR;
}
}
if (argc < (i+2)) {
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " ?options? interpName arg ?arg ...?\"", (char *) NULL);
+ " ?-option value ...? interpName arg ?arg ...?\"", NULL);
return TCL_ERROR;
}
destName = argv[i];
@@ -965,22 +1004,21 @@ Tk_SendCmd(clientData, interp, argc, argv)
}
/*
- * See if the target interpreter is local. If so, execute
- * the command directly without going through the X server.
- * The only tricky thing is passing the result from the target
- * interpreter to the invoking interpreter. Watch out: they
- * could be the same!
+ * See if the target interpreter is local. If so, execute the command
+ * directly without going through the X server. The only tricky thing is
+ * passing the result from the target interpreter to the invoking
+ * interpreter. Watch out: they could be the same!
*/
- for (riPtr = tsdPtr->interpListPtr; riPtr != NULL;
- riPtr = riPtr->nextPtr) {
+ for (riPtr = tsdPtr->interpListPtr; riPtr != NULL;
+ riPtr = riPtr->nextPtr) {
if ((riPtr->dispPtr != dispPtr)
|| (strcmp(riPtr->name, destName) != 0)) {
continue;
}
- Tcl_Preserve((ClientData) riPtr);
- localInterp = riPtr->interp;
- Tcl_Preserve((ClientData) localInterp);
+ Tcl_Preserve(riPtr);
+ localInterp = riPtr->interp;
+ Tcl_Preserve(localInterp);
if (firstArg == (argc-1)) {
result = Tcl_GlobalEval(localInterp, argv[firstArg]);
} else {
@@ -999,25 +1037,25 @@ Tk_SendCmd(clientData, interp, argc, argv)
/*
* An error occurred, so transfer error information from the
- * destination interpreter back to our interpreter. Must clear
+ * destination interpreter back to our interpreter. Must clear
* interp's result before calling Tcl_AddErrorInfo, since
- * Tcl_AddErrorInfo will store the interp's result in errorInfo
- * before appending riPtr's $errorInfo; we've already got
- * everything we need in riPtr's $errorInfo.
+ * Tcl_AddErrorInfo will store the interp's result in
+ * errorInfo before appending riPtr's $errorInfo; we've
+ * already got everything we need in riPtr's $errorInfo.
*/
Tcl_ResetResult(interp);
Tcl_AddErrorInfo(interp, Tcl_GetVar2(localInterp,
- "errorInfo", (char *) NULL, TCL_GLOBAL_ONLY));
+ "errorInfo", NULL, TCL_GLOBAL_ONLY));
errorObjPtr = Tcl_GetVar2Ex(localInterp, "errorCode", NULL,
TCL_GLOBAL_ONLY);
Tcl_SetObjErrorCode(interp, errorObjPtr);
}
Tcl_SetObjResult(interp, Tcl_GetObjResult(localInterp));
- Tcl_ResetResult(localInterp);
+ Tcl_ResetResult(localInterp);
}
- Tcl_Release((ClientData) riPtr);
- Tcl_Release((ClientData) localInterp);
+ Tcl_Release(riPtr);
+ Tcl_Release(localInterp);
return result;
}
@@ -1029,17 +1067,16 @@ Tk_SendCmd(clientData, interp, argc, argv)
commWindow = RegFindName(regPtr, destName);
RegClose(regPtr);
if (commWindow == None) {
- Tcl_AppendResult(interp, "no application named \"",
- destName, "\"", (char *) NULL);
+ Tcl_AppendResult(interp, "no application named \"",destName,"\"",NULL);
return TCL_ERROR;
}
/*
- * Send the command to the target interpreter by appending it to the
- * comm window in the communication window.
+ * Send the command to the target interpreter by appending it to the comm
+ * window in the communication window.
*/
- tkSendSerial++;
+ localData.sendSerial++;
Tcl_DStringInit(&request);
Tcl_DStringAppend(&request, "\0c\0-n ", 6);
Tcl_DStringAppend(&request, destName, -1);
@@ -1047,8 +1084,8 @@ Tk_SendCmd(clientData, interp, argc, argv)
char buffer[TCL_INTEGER_SPACE * 2];
sprintf(buffer, "%x %d",
- (unsigned int) Tk_WindowId(dispPtr->commTkwin),
- tkSendSerial);
+ (unsigned) Tk_WindowId(dispPtr->commTkwin),
+ localData.sendSerial);
Tcl_DStringAppend(&request, "\0-r ", 4);
Tcl_DStringAppend(&request, buffer, -1);
}
@@ -1060,27 +1097,26 @@ Tk_SendCmd(clientData, interp, argc, argv)
}
(void) AppendPropCarefully(dispPtr->display, commWindow,
dispPtr->commProperty, Tcl_DStringValue(&request),
- Tcl_DStringLength(&request) + 1,
- (async) ? (PendingCommand *) NULL : &pending);
+ Tcl_DStringLength(&request) + 1, (async ? NULL : &pending));
Tcl_DStringFree(&request);
if (async) {
/*
- * This is an asynchronous send: return immediately without
- * waiting for a response.
+ * This is an asynchronous send: return immediately without waiting
+ * for a response.
*/
return TCL_OK;
}
/*
- * Register the fact that we're waiting for a command to complete
- * (this is needed by SendEventProc and by AppendErrorProc to pass
- * back the command's results). Set up a timeout handler so that
- * we can check during long sends to make sure that the destination
- * application is still alive.
+ * Register the fact that we're waiting for a command to complete (this is
+ * needed by SendEventProc and by AppendErrorProc to pass back the
+ * command's results). Set up a timeout handler so that we can check
+ * during long sends to make sure that the destination application is
+ * still alive.
*/
- pending.serial = tkSendSerial;
+ pending.serial = localData.sendSerial;
pending.dispPtr = dispPtr;
pending.target = destName;
pending.commWindow = commWindow;
@@ -1093,28 +1129,27 @@ Tk_SendCmd(clientData, interp, argc, argv)
tsdPtr->pendingCommands = &pending;
/*
- * Enter a loop processing X events until the result comes
- * in or the target is declared to be dead. While waiting
- * for a result, look only at send-related events so that
- * the send is synchronous with respect to other events in
- * the application.
+ * Enter a loop processing X events until the result comes in or the
+ * target is declared to be dead. While waiting for a result, look only at
+ * send-related events so that the send is synchronous with respect to
+ * other events in the application.
*/
- prevRestrictProc = Tk_RestrictEvents(SendRestrictProc,
- (ClientData) NULL, &prevArg);
+ prevProc = Tk_RestrictEvents(SendRestrictProc, NULL, &prevArg);
Tcl_GetTime(&timeout);
timeout.sec += 2;
while (!pending.gotResponse) {
if (!TkUnixDoOneXEvent(&timeout)) {
/*
* An unusually long amount of time has elapsed during the
- * processing of a sent command. Check to make sure that the
- * target application still exists. If it does, reset the timeout.
+ * processing of a sent command. Check to make sure that the
+ * target application still exists. If it does, reset the timeout.
*/
if (!ValidateName(pending.dispPtr, pending.target,
pending.commWindow, 0)) {
- char *msg;
+ const char *msg;
+
if (ValidateName(pending.dispPtr, pending.target,
pending.commWindow, 1)) {
msg = "target application died or uses a Tk version before 4.0";
@@ -1122,7 +1157,7 @@ Tk_SendCmd(clientData, interp, argc, argv)
msg = "target application died";
}
pending.code = TCL_ERROR;
- pending.result = (char *) ckalloc((unsigned) (strlen(msg) + 1));
+ pending.result = ckalloc(strlen(msg) + 1);
strcpy(pending.result, msg);
pending.gotResponse = 1;
} else {
@@ -1131,22 +1166,22 @@ Tk_SendCmd(clientData, interp, argc, argv)
}
}
}
- (void) Tk_RestrictEvents(prevRestrictProc, prevArg, &prevArg);
+ Tk_RestrictEvents(prevProc, prevArg, &prevArg);
/*
- * Unregister the information about the pending command
- * and return the result.
+ * Unregister the information about the pending command and return the
+ * result.
*/
if (tsdPtr->pendingCommands != &pending) {
- panic("Tk_SendCmd: corrupted send stack");
+ Tcl_Panic("Tk_SendCmd: corrupted send stack");
}
tsdPtr->pendingCommands = pending.nextPtr;
if (pending.errorInfo != NULL) {
/*
* Special trick: must clear the interp's result before calling
* Tcl_AddErrorInfo, since Tcl_AddErrorInfo will store the interp's
- * result in errorInfo before appending pending.errorInfo; we've
+ * result in errorInfo before appending pending.errorInfo; we've
* already got everything we need in pending.errorInfo.
*/
@@ -1155,12 +1190,13 @@ Tk_SendCmd(clientData, interp, argc, argv)
ckfree(pending.errorInfo);
}
if (pending.errorCode != NULL) {
- Tcl_Obj *errorObjPtr;
- errorObjPtr = Tcl_NewStringObj(pending.errorCode, -1);
+ Tcl_Obj *errorObjPtr = Tcl_NewStringObj(pending.errorCode, -1);
+
Tcl_SetObjErrorCode(interp, errorObjPtr);
ckfree(pending.errorCode);
}
- Tcl_SetResult(interp, pending.result, TCL_DYNAMIC);
+ Tcl_SetResult(interp, pending.result, TCL_VOLATILE);
+ ckfree(pending.result);
return pending.code;
}
@@ -1169,15 +1205,14 @@ Tk_SendCmd(clientData, interp, argc, argv)
*
* TkGetInterpNames --
*
- * This procedure is invoked to fetch a list of all the
- * interpreter names currently registered for the display
- * of a particular window.
+ * This function is invoked to fetch a list of all the interpreter names
+ * currently registered for the display of a particular window.
*
* Results:
- * A standard Tcl return value. The interp's result will be set
- * to hold a list of all the interpreter names defined for
- * tkwin's display. If an error occurs, then TCL_ERROR
- * is returned and the interp's result will hold an error message.
+ * A standard Tcl return value. The interp's result will be set to hold a
+ * list of all the interpreter names defined for tkwin's display. If an
+ * error occurs, then TCL_ERROR is returned and the interp's result will
+ * hold an error message.
*
* Side effects:
* None.
@@ -1186,17 +1221,14 @@ Tk_SendCmd(clientData, interp, argc, argv)
*/
int
-TkGetInterpNames(interp, tkwin)
- Tcl_Interp *interp; /* Interpreter for returning a result. */
- Tk_Window tkwin; /* Window whose display is to be used
- * for the lookup. */
+TkGetInterpNames(
+ Tcl_Interp *interp, /* Interpreter for returning a result. */
+ Tk_Window tkwin) /* Window whose display is to be used for the
+ * lookup. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
- char *p, *entry, *entryName;
NameRegistry *regPtr;
- Window commWindow;
- int count;
- unsigned int id;
+ char *p;
/*
* Read the registry property, then scan through all of its entries.
@@ -1204,10 +1236,13 @@ TkGetInterpNames(interp, tkwin)
*/
regPtr = RegOpen(interp, winPtr->dispPtr, 1);
- for (p = regPtr->property; (p-regPtr->property) < (int) regPtr->propLength; ) {
- entry = p;
- if (sscanf(p, "%x",(unsigned int *) &id) != 1) {
- commWindow = None;
+ for (p=regPtr->property ; p-regPtr->property<(int)regPtr->propLength ;) {
+ char *entry = p, *entryName;
+ Window commWindow;
+ unsigned id;
+
+ if (sscanf(p, "%x", (unsigned *) &id) != 1) {
+ commWindow = None;
} else {
commWindow = id;
}
@@ -1229,13 +1264,15 @@ TkGetInterpNames(interp, tkwin)
Tcl_AppendElement(interp, entryName);
} else {
+ int count;
+
/*
* This name is bogus (perhaps the application died without
- * cleaning up its entry in the registry?). Delete the name.
+ * cleaning up its entry in the registry?). Delete the name.
*/
count = regPtr->propLength - (p - regPtr->property);
- if (count > 0) {
+ if (count > 0) {
char *src, *dst;
for (src = p, dst = entry; count > 0; src++, dst++, count--) {
@@ -1256,9 +1293,8 @@ TkGetInterpNames(interp, tkwin)
*
* TkSendCleanup --
*
- * This procedure is called to free resources used by the
- * communication channels for sending commands and
- * receiving results.
+ * This function is called to free resources used by the communication
+ * channels for sending commands and receiving results.
*
* Results:
* None.
@@ -1270,14 +1306,14 @@ TkGetInterpNames(interp, tkwin)
*/
void
-TkSendCleanup(dispPtr)
- TkDisplay *dispPtr;
+TkSendCleanup(
+ TkDisplay *dispPtr)
{
if (dispPtr->commTkwin != NULL) {
Tk_DeleteEventHandler(dispPtr->commTkwin, PropertyChangeMask,
- SendEventProc, (ClientData) dispPtr);
+ SendEventProc, dispPtr);
Tk_DestroyWindow(dispPtr->commTkwin);
- Tcl_Release((ClientData) dispPtr->commTkwin);
+ Tcl_Release(dispPtr->commTkwin);
dispPtr->commTkwin = NULL;
}
}
@@ -1287,9 +1323,8 @@ TkSendCleanup(dispPtr)
*
* SendInit --
*
- * This procedure is called to initialize the
- * communication channels for sending commands and
- * receiving results.
+ * This function is called to initialize the communication channels for
+ * sending commands and receiving results.
*
* Results:
* None.
@@ -1301,30 +1336,30 @@ TkSendCleanup(dispPtr)
*/
static int
-SendInit(interp, dispPtr)
- Tcl_Interp *interp; /* Interpreter to use for error reporting
- * (no errors are ever returned, but the
+SendInit(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting (no
+ * errors are ever returned, but the
* interpreter is needed anyway). */
- TkDisplay *dispPtr; /* Display to initialize. */
+ TkDisplay *dispPtr) /* Display to initialize. */
{
XSetWindowAttributes atts;
/*
- * Create the window used for communication, and set up an
- * event handler for it.
+ * Create the window used for communication, and set up an event handler
+ * for it.
*/
dispPtr->commTkwin = Tk_CreateWindow(interp, (Tk_Window) NULL,
"_comm", DisplayString(dispPtr->display));
if (dispPtr->commTkwin == NULL) {
- panic("Tk_CreateWindow failed in SendInit!");
+ Tcl_Panic("Tk_CreateWindow failed in SendInit!");
}
- Tcl_Preserve((ClientData) dispPtr->commTkwin);
+ Tcl_Preserve(dispPtr->commTkwin);
atts.override_redirect = True;
Tk_ChangeWindowAttributes(dispPtr->commTkwin,
CWOverrideRedirect, &atts);
Tk_CreateEventHandler(dispPtr->commTkwin, PropertyChangeMask,
- SendEventProc, (ClientData) dispPtr);
+ SendEventProc, dispPtr);
Tk_MakeWindowExist(dispPtr->commTkwin);
/*
@@ -1345,37 +1380,35 @@ SendInit(interp, dispPtr)
*
* SendEventProc --
*
- * This procedure is invoked automatically by the toolkit
- * event manager when a property changes on the communication
- * window. This procedure reads the property and handles
- * command requests and responses.
+ * This function is invoked automatically by the toolkit event manager
+ * when a property changes on the communication window. This function
+ * reads the property and handles command requests and responses.
*
* Results:
* None.
*
* Side effects:
- * If there are command requests in the property, they
- * are executed. If there are responses in the property,
- * their information is saved for the (ostensibly waiting)
- * "send" commands. The property is deleted.
+ * If there are command requests in the property, they are executed. If
+ * there are responses in the property, their information is saved for
+ * the (ostensibly waiting) "send" commands. The property is deleted.
*
*--------------------------------------------------------------
*/
static void
-SendEventProc(clientData, eventPtr)
- ClientData clientData; /* Display information. */
- XEvent *eventPtr; /* Information about event. */
+SendEventProc(
+ ClientData clientData, /* Display information. */
+ XEvent *eventPtr) /* Information about event. */
{
- TkDisplay *dispPtr = (TkDisplay *) clientData;
- char *propInfo;
- register char *p;
+ TkDisplay *dispPtr = clientData;
+ char *propInfo, **propInfoPtr = &propInfo;
+ const char *p;
int result, actualFormat;
unsigned long numItems, bytesAfter;
Atom actualType;
Tcl_Interp *remoteInterp; /* Interp in which to execute the command. */
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr =
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if ((eventPtr->xproperty.atom != dispPtr->commProperty)
|| (eventPtr->xproperty.state != PropertyNewValue)) {
@@ -1388,14 +1421,12 @@ SendEventProc(clientData, eventPtr)
propInfo = NULL;
result = XGetWindowProperty(dispPtr->display,
- Tk_WindowId(dispPtr->commTkwin),
- dispPtr->commProperty, 0, MAX_PROP_WORDS, True,
- XA_STRING, &actualType, &actualFormat,
- &numItems, &bytesAfter, (unsigned char **) &propInfo);
+ Tk_WindowId(dispPtr->commTkwin), dispPtr->commProperty, 0,
+ MAX_PROP_WORDS, True, XA_STRING, &actualType, &actualFormat,
+ &numItems, &bytesAfter, (unsigned char **) propInfoPtr);
/*
- * If the property doesn't exist or is improperly formed
- * then ignore it.
+ * If the property doesn't exist or is improperly formed then ignore it.
*/
if ((result != Success) || (actualType != XA_STRING)
@@ -1407,17 +1438,16 @@ SendEventProc(clientData, eventPtr)
}
/*
- * Several commands and results could arrive in the property at
- * one time; each iteration through the outer loop handles a
- * single command or result.
+ * Several commands and results could arrive in the property at one time;
+ * each iteration through the outer loop handles a single command or
+ * result.
*/
for (p = propInfo; (p-propInfo) < (int) numItems; ) {
/*
- * Ignore leading NULLs; each command or result starts with a
- * NULL so that no matter how badly formed a preceding command
- * is, we'll be able to tell that a new command/result is
- * starting.
+ * Ignore leading NULLs; each command or result starts with a NULL so
+ * that no matter how badly formed a preceding command is, we'll be
+ * able to tell that a new command/result is starting.
*/
if (*p == 0) {
@@ -1427,16 +1457,16 @@ SendEventProc(clientData, eventPtr)
if ((*p == 'c') && (p[1] == 0)) {
Window commWindow;
- char *interpName, *script, *serial, *end;
+ const char *interpName, *script, *serial;
+ char *end;
Tcl_DString reply;
RegisteredInterp *riPtr;
/*
*----------------------------------------------------------
* This is an incoming command from some other application.
- * Iterate over all of its options. Stop when we reach
- * the end of the property or something that doesn't look
- * like an option.
+ * Iterate over all of its options. Stop when we reach the end of
+ * the property or something that doesn't look like an option.
*----------------------------------------------------------
*/
@@ -1447,24 +1477,24 @@ SendEventProc(clientData, eventPtr)
script = NULL;
while (((p-propInfo) < (int) numItems) && (*p == '-')) {
switch (p[1]) {
- case 'r':
- commWindow = (Window) strtoul(p+2, &end, 16);
- if ((end == p+2) || (*end != ' ')) {
- commWindow = None;
- } else {
- p = serial = end+1;
- }
- break;
- case 'n':
- if (p[2] == ' ') {
- interpName = p+3;
- }
- break;
- case 's':
- if (p[2] == ' ') {
- script = p+3;
- }
- break;
+ case 'r':
+ commWindow = (Window) strtoul(p+2, &end, 16);
+ if ((end == p+2) || (*end != ' ')) {
+ commWindow = None;
+ } else {
+ p = serial = end+1;
+ }
+ break;
+ case 'n':
+ if (p[2] == ' ') {
+ interpName = p+3;
+ }
+ break;
+ case 's':
+ if (p[2] == ' ') {
+ script = p+3;
+ }
+ break;
}
while (*p != 0) {
p++;
@@ -1477,8 +1507,8 @@ SendEventProc(clientData, eventPtr)
}
/*
- * Initialize the result property, so that we're ready at any
- * time if we need to return an error.
+ * Initialize the result property, so that we're ready at any time
+ * if we need to return an error.
*/
if (commWindow != None) {
@@ -1490,7 +1520,9 @@ SendEventProc(clientData, eventPtr)
if (!ServerSecure(dispPtr)) {
if (commWindow != None) {
- Tcl_DStringAppend(&reply, "X server insecure (must use xauth-style authorization); command ignored", -1);
+ Tcl_DStringAppend(&reply,
+ "X server insecure (must use xauth-style "
+ "authorization); command ignored", -1);
}
result = TCL_ERROR;
goto returnResult;
@@ -1515,81 +1547,80 @@ SendEventProc(clientData, eventPtr)
break;
}
}
- Tcl_Preserve((ClientData) riPtr);
+ Tcl_Preserve(riPtr);
- /*
- * We must protect the interpreter because the script may
- * enter another event loop, which might call Tcl_DeleteInterp.
- */
+ /*
+ * We must protect the interpreter because the script may enter
+ * another event loop, which might call Tcl_DeleteInterp.
+ */
- remoteInterp = riPtr->interp;
- Tcl_Preserve((ClientData) remoteInterp);
+ remoteInterp = riPtr->interp;
+ Tcl_Preserve(remoteInterp);
- result = Tcl_GlobalEval(remoteInterp, script);
+ result = Tcl_GlobalEval(remoteInterp, script);
- /*
- * The call to Tcl_Release may have released the interpreter
- * which will cause the "send" command for that interpreter
- * to be deleted. The command deletion callback will set the
- * riPtr->interp field to NULL, hence the check below for NULL.
- */
+ /*
+ * The call to Tcl_Release may have released the interpreter which
+ * will cause the "send" command for that interpreter to be
+ * deleted. The command deletion callback will set the
+ * riPtr->interp field to NULL, hence the check below for NULL.
+ */
if (commWindow != None) {
Tcl_DStringAppend(&reply, Tcl_GetStringResult(remoteInterp),
-1);
if (result == TCL_ERROR) {
- CONST char *varValue;
-
+ const char *varValue;
+
varValue = Tcl_GetVar2(remoteInterp, "errorInfo",
- (char *) NULL, TCL_GLOBAL_ONLY);
+ NULL, TCL_GLOBAL_ONLY);
if (varValue != NULL) {
Tcl_DStringAppend(&reply, "\0-i ", 4);
Tcl_DStringAppend(&reply, varValue, -1);
}
varValue = Tcl_GetVar2(remoteInterp, "errorCode",
- (char *) NULL, TCL_GLOBAL_ONLY);
+ NULL, TCL_GLOBAL_ONLY);
if (varValue != NULL) {
Tcl_DStringAppend(&reply, "\0-e ", 4);
Tcl_DStringAppend(&reply, varValue, -1);
}
}
}
- Tcl_Release((ClientData) remoteInterp);
- Tcl_Release((ClientData) riPtr);
+ Tcl_Release(remoteInterp);
+ Tcl_Release(riPtr);
/*
- * Return the result to the sender if a commWindow was
- * specified (if none was specified then this is an asynchronous
- * call). Right now reply has everything but the completion
- * code, but it needs the NULL to terminate the current option.
+ * Return the result to the sender if a commWindow was specified
+ * (if none was specified then this is an asynchronous call).
+ * Right now reply has everything but the completion code, but it
+ * needs the NULL to terminate the current option.
*/
- returnResult:
+ returnResult:
if (commWindow != None) {
if (result != TCL_OK) {
char buffer[TCL_INTEGER_SPACE];
-
+
sprintf(buffer, "%d", result);
Tcl_DStringAppend(&reply, "\0-c ", 4);
Tcl_DStringAppend(&reply, buffer, -1);
}
(void) AppendPropCarefully(dispPtr->display, commWindow,
dispPtr->commProperty, Tcl_DStringValue(&reply),
- Tcl_DStringLength(&reply) + 1,
- (PendingCommand *) NULL);
+ Tcl_DStringLength(&reply) + 1, NULL);
XFlush(dispPtr->display);
Tcl_DStringFree(&reply);
}
} else if ((*p == 'r') && (p[1] == 0)) {
int serial, code, gotSerial;
- char *errorInfo, *errorCode, *resultString;
+ const char *errorInfo, *errorCode, *resultString;
PendingCommand *pcPtr;
/*
*----------------------------------------------------------
- * This is a reply to some command that we sent out. Iterate
- * over all of its options. Stop when we reach the end of the
- * property or something that doesn't look like an option.
+ * This is a reply to some command that we sent out. Iterate over
+ * all of its options. Stop when we reach the end of the property
+ * or something that doesn't look like an option.
*----------------------------------------------------------
*/
@@ -1601,31 +1632,31 @@ SendEventProc(clientData, eventPtr)
resultString = "";
while (((p-propInfo) < (int) numItems) && (*p == '-')) {
switch (p[1]) {
- case 'c':
- if (sscanf(p+2, " %d", &code) != 1) {
- code = TCL_OK;
- }
- break;
- case 'e':
- if (p[2] == ' ') {
- errorCode = p+3;
- }
- break;
- case 'i':
- if (p[2] == ' ') {
- errorInfo = p+3;
- }
- break;
- case 'r':
- if (p[2] == ' ') {
- resultString = p+3;
- }
- break;
- case 's':
- if (sscanf(p+2, " %d", &serial) == 1) {
- gotSerial = 1;
- }
- break;
+ case 'c':
+ if (sscanf(p+2, " %d", &code) != 1) {
+ code = TCL_OK;
+ }
+ break;
+ case 'e':
+ if (p[2] == ' ') {
+ errorCode = p+3;
+ }
+ break;
+ case 'i':
+ if (p[2] == ' ') {
+ errorInfo = p+3;
+ }
+ break;
+ case 'r':
+ if (p[2] == ' ') {
+ resultString = p+3;
+ }
+ break;
+ case 's':
+ if (sscanf(p+2, " %d", &serial) == 1) {
+ gotSerial = 1;
+ }
+ break;
}
while (*p != 0) {
p++;
@@ -1638,8 +1669,7 @@ SendEventProc(clientData, eventPtr)
}
/*
- * Give the result information to anyone who's
- * waiting for it.
+ * Give the result information to anyone who's waiting for it.
*/
for (pcPtr = tsdPtr->pendingCommands; pcPtr != NULL;
@@ -1649,19 +1679,16 @@ SendEventProc(clientData, eventPtr)
}
pcPtr->code = code;
if (resultString != NULL) {
- pcPtr->result = (char *) ckalloc((unsigned)
- (strlen(resultString) + 1));
+ pcPtr->result = ckalloc(strlen(resultString) + 1);
strcpy(pcPtr->result, resultString);
}
if (code == TCL_ERROR) {
if (errorInfo != NULL) {
- pcPtr->errorInfo = (char *) ckalloc((unsigned)
- (strlen(errorInfo) + 1));
+ pcPtr->errorInfo = ckalloc(strlen(errorInfo) + 1);
strcpy(pcPtr->errorInfo, errorInfo);
}
if (errorCode != NULL) {
- pcPtr->errorCode = (char *) ckalloc((unsigned)
- (strlen(errorCode) + 1));
+ pcPtr->errorCode = ckalloc(strlen(errorCode) + 1);
strcpy(pcPtr->errorCode, errorCode);
}
}
@@ -1670,8 +1697,8 @@ SendEventProc(clientData, eventPtr)
}
} else {
/*
- * Didn't recognize this thing. Just skip through the next
- * null character and try again.
+ * Didn't recognize this thing. Just skip through the next null
+ * character and try again.
*/
while (*p != 0) {
@@ -1688,60 +1715,56 @@ SendEventProc(clientData, eventPtr)
*
* AppendPropCarefully --
*
- * Append a given property to a given window, but set up
- * an X error handler so that if the append fails this
- * procedure can return an error code rather than having
- * Xlib panic.
+ * Append a given property to a given window, but set up an X error
+ * handler so that if the append fails this function can return an error
+ * code rather than having Xlib panic.
*
* Results:
* None.
*
* Side effects:
- * The given property on the given window is appended to.
- * If this operation fails and if pendingPtr is non-NULL,
- * then the pending operation is marked as complete with
- * an error.
+ * The given property on the given window is appended to. If this
+ * operation fails and if pendingPtr is non-NULL, then the pending
+ * operation is marked as complete with an error.
*
*--------------------------------------------------------------
*/
static void
-AppendPropCarefully(display, window, property, value, length, pendingPtr)
- Display *display; /* Display on which to operate. */
- Window window; /* Window whose property is to
- * be modified. */
- Atom property; /* Name of property. */
- char *value; /* Characters to append to property. */
- int length; /* Number of bytes to append. */
- PendingCommand *pendingPtr; /* Pending command to mark complete
- * if an error occurs during the
- * property op. NULL means just
- * ignore the error. */
+AppendPropCarefully(
+ Display *display, /* Display on which to operate. */
+ Window window, /* Window whose property is to be modified. */
+ Atom property, /* Name of property. */
+ char *value, /* Characters to append to property. */
+ int length, /* Number of bytes to append. */
+ PendingCommand *pendingPtr) /* Pending command to mark complete if an
+ * error occurs during the property op. NULL
+ * means just ignore the error. */
{
Tk_ErrorHandler handler;
handler = Tk_CreateErrorHandler(display, -1, -1, -1, AppendErrorProc,
- (ClientData) pendingPtr);
+ pendingPtr);
XChangeProperty(display, window, property, XA_STRING, 8,
PropModeAppend, (unsigned char *) value, length);
Tk_DeleteErrorHandler(handler);
}
/*
- * The procedure below is invoked if an error occurs during
- * the XChangeProperty operation above.
+ * The function below is invoked if an error occurs during the XChangeProperty
+ * operation above.
*/
/* ARGSUSED */
static int
-AppendErrorProc(clientData, errorPtr)
- ClientData clientData; /* Command to mark complete, or NULL. */
- XErrorEvent *errorPtr; /* Information about error. */
+AppendErrorProc(
+ ClientData clientData, /* Command to mark complete, or NULL. */
+ XErrorEvent *errorPtr) /* Information about error. */
{
- PendingCommand *pendingPtr = (PendingCommand *) clientData;
+ PendingCommand *pendingPtr = clientData;
register PendingCommand *pcPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr =
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (pendingPtr == NULL) {
return 0;
@@ -1754,8 +1777,7 @@ AppendErrorProc(clientData, errorPtr)
for (pcPtr = tsdPtr->pendingCommands; pcPtr != NULL;
pcPtr = pcPtr->nextPtr) {
if ((pcPtr == pendingPtr) && (pcPtr->result == NULL)) {
- pcPtr->result = (char *) ckalloc((unsigned)
- (strlen(pcPtr->target) + 50));
+ pcPtr->result = ckalloc(strlen(pcPtr->target) + 50);
sprintf(pcPtr->result, "no application named \"%s\"",
pcPtr->target);
pcPtr->code = TCL_ERROR;
@@ -1771,8 +1793,8 @@ AppendErrorProc(clientData, errorPtr)
*
* DeleteProc --
*
- * This procedure is invoked by Tcl when the "send" command
- * is deleted in an interpreter. It unregisters the interpreter.
+ * This function is invoked by Tcl when the "send" command is deleted in
+ * an interpreter. It unregisters the interpreter.
*
* Results:
* None.
@@ -1784,15 +1806,15 @@ AppendErrorProc(clientData, errorPtr)
*/
static void
-DeleteProc(clientData)
- ClientData clientData; /* Info about registration, passed
- * as ClientData. */
+DeleteProc(
+ ClientData clientData) /* Info about registration, passed as
+ * ClientData. */
{
- RegisteredInterp *riPtr = (RegisteredInterp *) clientData;
+ RegisteredInterp *riPtr = clientData;
register RegisteredInterp *riPtr2;
NameRegistry *regPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr =
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
regPtr = RegOpen(riPtr->interp, riPtr->dispPtr, 1);
RegDeleteName(regPtr, riPtr->name);
@@ -1809,10 +1831,10 @@ DeleteProc(clientData)
}
}
}
- ckfree((char *) riPtr->name);
+ ckfree(riPtr->name);
riPtr->interp = NULL;
UpdateCommWindow(riPtr->dispPtr);
- Tcl_EventuallyFree((ClientData) riPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(riPtr, TCL_DYNAMIC);
}
/*
@@ -1820,13 +1842,12 @@ DeleteProc(clientData)
*
* SendRestrictProc --
*
- * This procedure filters incoming events when a "send" command
- * is outstanding. It defers all events except those containing
- * send commands and results.
+ * This function filters incoming events when a "send" command is
+ * outstanding. It defers all events except those containing send
+ * commands and results.
*
* Results:
- * False is returned except for property-change events on a
- * commWindow.
+ * False is returned except for property-change events on a commWindow.
*
* Side effects:
* None.
@@ -1836,17 +1857,17 @@ DeleteProc(clientData)
/* ARGSUSED */
static Tk_RestrictAction
-SendRestrictProc(clientData, eventPtr)
- ClientData clientData; /* Not used. */
- register XEvent *eventPtr; /* Event that just arrived. */
+SendRestrictProc(
+ ClientData clientData, /* Not used. */
+ register XEvent *eventPtr) /* Event that just arrived. */
{
TkDisplay *dispPtr;
if (eventPtr->type != PropertyNotify) {
return TK_DEFER_EVENT;
}
- for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
- dispPtr = dispPtr->nextPtr) {
+ for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
+ dispPtr = dispPtr->nextPtr) {
if ((eventPtr->xany.display == dispPtr->display)
&& (eventPtr->xproperty.window
== Tk_WindowId(dispPtr->commTkwin))) {
@@ -1861,9 +1882,9 @@ SendRestrictProc(clientData, eventPtr)
*
* UpdateCommWindow --
*
- * This procedure updates the list of application names stored
- * on our commWindow. It is typically called when interpreters
- * are registered and unregistered.
+ * This function updates the list of application names stored on our
+ * commWindow. It is typically called when interpreters are registered
+ * and unregistered.
*
* Results:
* None.
@@ -1875,18 +1896,18 @@ SendRestrictProc(clientData, eventPtr)
*/
static void
-UpdateCommWindow(dispPtr)
- TkDisplay *dispPtr; /* Display whose commWindow is to be
+UpdateCommWindow(
+ TkDisplay *dispPtr) /* Display whose commWindow is to be
* updated. */
{
Tcl_DString names;
RegisteredInterp *riPtr;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr =
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_DStringInit(&names);
- for (riPtr = tsdPtr->interpListPtr; riPtr != NULL;
- riPtr = riPtr->nextPtr) {
+ for (riPtr = tsdPtr->interpListPtr; riPtr != NULL;
+ riPtr = riPtr->nextPtr) {
Tcl_DStringAppendElement(&names, riPtr->name);
}
XChangeProperty(dispPtr->display, Tk_WindowId(dispPtr->commTkwin),
@@ -1895,3 +1916,119 @@ UpdateCommWindow(dispPtr)
Tcl_DStringLength(&names));
Tcl_DStringFree(&names);
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpTestsendCmd --
+ *
+ * This function implements the "testsend" command. It provides a set of
+ * functions for testing the "send" command and support function in
+ * tkSend.c.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * Depends on option; see below.
+ *
+ *----------------------------------------------------------------------
+ */
+
+ /* ARGSUSED */
+int
+TkpTestsendCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ const char **argv) /* Argument strings. */
+{
+ TkWindow *winPtr = clientData;
+
+ if (argc < 2) {
+ Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0],
+ " option ?arg ...?\"", NULL);
+ return TCL_ERROR;
+ }
+
+ if (strcmp(argv[1], "bogus") == 0) {
+ XChangeProperty(winPtr->dispPtr->display,
+ RootWindow(winPtr->dispPtr->display, 0),
+ winPtr->dispPtr->registryProperty, XA_INTEGER, 32,
+ PropModeReplace,
+ (unsigned char *) "This is bogus information", 6);
+ } else if (strcmp(argv[1], "prop") == 0) {
+ int result, actualFormat;
+ unsigned long length, bytesAfter;
+ Atom actualType, propName;
+ char *property, **propertyPtr = &property, *p, *end;
+ Window w;
+
+ if ((argc != 4) && (argc != 5)) {
+ Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0],
+ " prop window name ?value ?\"", NULL);
+ return TCL_ERROR;
+ }
+ if (strcmp(argv[2], "root") == 0) {
+ w = RootWindow(winPtr->dispPtr->display, 0);
+ } else if (strcmp(argv[2], "comm") == 0) {
+ w = Tk_WindowId(winPtr->dispPtr->commTkwin);
+ } else {
+ w = strtoul(argv[2], &end, 0);
+ }
+ propName = Tk_InternAtom((Tk_Window) winPtr, argv[3]);
+ if (argc == 4) {
+ property = NULL;
+ result = XGetWindowProperty(winPtr->dispPtr->display, w, propName,
+ 0, 100000, False, XA_STRING, &actualType, &actualFormat,
+ &length, &bytesAfter, (unsigned char **) propertyPtr);
+ if ((result == Success) && (actualType != None)
+ && (actualFormat == 8) && (actualType == XA_STRING)) {
+ for (p = property; (unsigned long)(p-property) < length; p++) {
+ if (*p == 0) {
+ *p = '\n';
+ }
+ }
+ Tcl_SetResult(interp, property, TCL_VOLATILE);
+ }
+ if (property != NULL) {
+ XFree(property);
+ }
+ } else if (argv[4][0] == 0) {
+ XDeleteProperty(winPtr->dispPtr->display, w, propName);
+ } else {
+ Tcl_DString tmp;
+
+ Tcl_DStringInit(&tmp);
+ for (p = Tcl_DStringAppend(&tmp, argv[4],
+ (int) strlen(argv[4])); *p != 0; p++) {
+ if (*p == '\n') {
+ *p = 0;
+ }
+ }
+
+ XChangeProperty(winPtr->dispPtr->display, w, propName, XA_STRING,
+ 8, PropModeReplace, (unsigned char*)Tcl_DStringValue(&tmp),
+ p-Tcl_DStringValue(&tmp));
+ Tcl_DStringFree(&tmp);
+ }
+ } else if (strcmp(argv[1], "serial") == 0) {
+ char buf[TCL_INTEGER_SPACE];
+
+ sprintf(buf, "%d", localData.sendSerial+1);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ } else {
+ Tcl_AppendResult(interp, "bad option \"", argv[1],
+ "\": must be bogus, prop, or serial", NULL);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index 1ab5980..48d9021 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -2,45 +2,61 @@
* tkUnixWm.c --
*
* This module takes care of the interactions between a Tk-based
- * application and the window manager. Among other things, it
- * implements the "wm" command and passes geometry information
- * to the window manager.
+ * application and the window manager. Among other things, it implements
+ * the "wm" command and passes geometry information to the window
+ * manager.
*
* Copyright (c) 1991-1994 The Regents of the University of California.
* Copyright (c) 1994-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.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "tkPort.h"
-#include "tkInt.h"
#include "tkUnixInt.h"
/*
- * A data structure of the following type holds information for
- * each window manager protocol (such as WM_DELETE_WINDOW) for
- * which a handler (i.e. a Tcl command) has been defined for a
- * particular top-level window.
+ * A data structure of the following type holds information for each window
+ * manager protocol (such as WM_DELETE_WINDOW) for which a handler (i.e. a Tcl
+ * command) has been defined for a particular top-level window.
*/
typedef struct ProtocolHandler {
Atom protocol; /* Identifies the protocol. */
struct ProtocolHandler *nextPtr;
- /* Next in list of protocol handlers for
- * the same top-level window, or NULL for
- * end of list. */
+ /* Next in list of protocol handlers for the
+ * same top-level window, or NULL for end of
+ * list. */
Tcl_Interp *interp; /* Interpreter in which to invoke command. */
- char command[4]; /* Tcl command to invoke when a client
- * message for this protocol arrives.
- * The actual size of the structure varies
- * to accommodate the needs of the actual
- * command. THIS MUST BE THE LAST FIELD OF
- * THE STRUCTURE. */
+ char command[1]; /* Tcl command to invoke when a client message
+ * for this protocol arrives. The actual size
+ * of the structure varies to accommodate the
+ * needs of the actual command. THIS MUST BE
+ * THE LAST FIELD OF THE STRUCTURE. */
} ProtocolHandler;
#define HANDLER_SIZE(cmdLength) \
- ((unsigned) (sizeof(ProtocolHandler) - 3 + cmdLength))
+ ((unsigned) ((Tk_Offset(ProtocolHandler, command) + 1) + cmdLength))
+
+/*
+ * Data for [wm attributes] command:
+ */
+typedef struct {
+ double alpha; /* Transparency; 0.0=transparent, 1.0=opaque */
+ int topmost; /* Flag: true=>stay-on-top */
+ int zoomed; /* Flag: true=>maximized */
+ int fullscreen; /* Flag: true=>fullscreen */
+} WmAttributes;
+
+typedef enum {
+ WMATT_ALPHA, WMATT_TOPMOST, WMATT_ZOOMED, WMATT_FULLSCREEN,
+ WMATT_TYPE, _WMATT_LAST_ATTRIBUTE
+} WmAttribute;
+
+static const char *const WmAttributeNames[] = {
+ "-alpha", "-topmost", "-zoomed", "-fullscreen",
+ "-type", NULL
+};
/*
* A data structure of the following type holds window-manager-related
@@ -48,113 +64,112 @@ typedef struct ProtocolHandler {
*/
typedef struct TkWmInfo {
- TkWindow *winPtr; /* Pointer to main Tk information for
- * this window. */
+ TkWindow *winPtr; /* Pointer to main Tk information for this
+ * window. */
Window reparent; /* If the window has been reparented, this
* gives the ID of the ancestor of the window
- * that is a child of the root window (may
- * not be window's immediate parent). If
- * the window isn't reparented, this has the
- * value None. */
- char *title; /* Title to display in window caption. If
- * NULL, use name of widget. Malloced. */
- char *iconName; /* Name to display in icon. Malloced. */
- XWMHints hints; /* Various pieces of information for
- * window manager. */
+ * that is a child of the root window (may not
+ * be window's immediate parent). If the
+ * window isn't reparented, this has the value
+ * None. */
+ char *title; /* Title to display in window caption. If
+ * NULL, use name of widget. Malloced. */
+ char *iconName; /* Name to display in icon. Malloced. */
+ XWMHints hints; /* Various pieces of information for window
+ * manager. */
char *leaderName; /* Path name of leader of window group
* (corresponds to hints.window_group).
- * Malloc-ed. Note: this field doesn't
- * get updated if leader is destroyed. */
+ * Malloc-ed. Note: this field doesn't get
+ * updated if leader is destroyed. */
TkWindow *masterPtr; /* Master window for TRANSIENT_FOR property,
* or NULL. */
- Tk_Window icon; /* Window to use as icon for this window,
- * or NULL. */
+ Tk_Window icon; /* Window to use as icon for this window, or
+ * NULL. */
Tk_Window iconFor; /* Window for which this window is icon, or
* NULL if this isn't an icon for anyone. */
int withdrawn; /* Non-zero means window has been withdrawn. */
/*
* In order to support menubars transparently under X, each toplevel
- * window is encased in an additional window, called the wrapper,
- * that holds the toplevel and the menubar, if any. The information
- * below is used to keep track of the wrapper and the menubar.
+ * window is encased in an additional window, called the wrapper, that
+ * holds the toplevel and the menubar, if any. The information below is
+ * used to keep track of the wrapper and the menubar.
*/
TkWindow *wrapperPtr; /* Pointer to information about the wrapper.
- * This is the "real" toplevel window as
- * seen by the window manager. Although
- * this is an official Tk window, it
- * doesn't appear in the application's
- * window hierarchy. NULL means that
- * the wrapper hasn't been created yet. */
- Tk_Window menubar; /* Pointer to information about the
- * menubar, or NULL if there is no
- * menubar for this toplevel. */
+ * This is the "real" toplevel window as seen
+ * by the window manager. Although this is an
+ * official Tk window, it doesn't appear in
+ * the application's window hierarchy. NULL
+ * means that the wrapper hasn't been created
+ * yet. */
+ Tk_Window menubar; /* Pointer to information about the menubar,
+ * or NULL if there is no menubar for this
+ * toplevel. */
int menuHeight; /* Amount of vertical space needed for
- * menubar, measured in pixels. If
- * menubar is non-NULL, this is >= 1 (X
- * servers don't like dimensions of 0). */
+ * menubar, measured in pixels. If menubar is
+ * non-NULL, this is >= 1 (X servers don't
+ * like dimensions of 0). */
/*
- * Information used to construct an XSizeHints structure for
- * the window manager:
+ * Information used to construct an XSizeHints structure for the window
+ * manager:
*/
- int sizeHintsFlags; /* Flags word for XSizeHints structure.
- * If the PBaseSize flag is set then the
- * window is gridded; otherwise it isn't
- * gridded. */
- int minWidth, minHeight; /* Minimum dimensions of window, in
- * pixels or grid units. */
- int maxWidth, maxHeight; /* Maximum dimensions of window, in
- * pixels or grid units. 0 to default.*/
+ int sizeHintsFlags; /* Flags word for XSizeHints structure. If the
+ * PBaseSize flag is set then the window is
+ * gridded; otherwise it isn't gridded. */
+ int minWidth, minHeight; /* Minimum dimensions of window, in pixels or
+ * grid units. */
+ int maxWidth, maxHeight; /* Maximum dimensions of window, in pixels or
+ * grid units. 0 to default.*/
Tk_Window gridWin; /* Identifies the window that controls
- * gridding for this top-level, or NULL if
- * the top-level isn't currently gridded. */
- int widthInc, heightInc; /* Increments for size changes (# pixels
- * per step). */
+ * gridding for this top-level, or NULL if the
+ * top-level isn't currently gridded. */
+ int widthInc, heightInc; /* Increments for size changes (# pixels per
+ * step). */
struct {
- int x; /* numerator */
- int y; /* denominator */
+ int x; /* numerator */
+ int y; /* denominator */
} minAspect, maxAspect; /* Min/max aspect ratios for window. */
int reqGridWidth, reqGridHeight;
- /* The dimensions of the window (in
- * grid units) requested through
- * the geometry manager. */
+ /* The dimensions of the window (in grid
+ * units) requested through the geometry
+ * manager. */
int gravity; /* Desired window gravity. */
/*
* Information used to manage the size and location of a window.
*/
- int width, height; /* Desired dimensions of window, specified
- * in pixels or grid units. These values are
- * set by the "wm geometry" command and by
- * ConfigureNotify events (for when wm
- * resizes window). -1 means user hasn't
- * requested dimensions. */
+ int width, height; /* Desired dimensions of window, specified in
+ * pixels or grid units. These values are set
+ * by the "wm geometry" command and by
+ * ConfigureNotify events (for when wm resizes
+ * window). -1 means user hasn't requested
+ * dimensions. */
int x, y; /* Desired X and Y coordinates for window.
- * These values are set by "wm geometry",
- * plus by ConfigureNotify events (when wm
- * moves window). These numbers are
- * different than the numbers stored in
- * winPtr->changes because (a) they could be
- * measured from the right or bottom edge
- * of the screen (see WM_NEGATIVE_X and
- * WM_NEGATIVE_Y flags) and (b) if the window
- * has been reparented then they refer to the
- * parent rather than the window itself. */
+ * These values are set by "wm geometry", plus
+ * by ConfigureNotify events (when wm moves
+ * window). These numbers are different than
+ * the numbers stored in winPtr->changes
+ * because (a) they could be measured from the
+ * right or bottom edge of the screen (see
+ * WM_NEGATIVE_X and WM_NEGATIVE_Y flags) and
+ * (b) if the window has been reparented then
+ * they refer to the parent rather than the
+ * window itself. */
int parentWidth, parentHeight;
/* Width and height of reparent, in pixels
- * *including border*. If window hasn't been
+ * *including border*. If window hasn't been
* reparented then these will be the outer
* dimensions of the window, including
* border. */
int xInParent, yInParent; /* Offset of wrapperPtr within reparent,
* measured in pixels from upper-left outer
* corner of reparent's border to upper-left
- * outer corner of wrapperPtr's border. If
- * not reparented then these are zero. */
+ * outer corner of wrapperPtr's border. If not
+ * reparented then these are zero. */
int configWidth, configHeight;
/* Dimensions passed to last request that we
* issued to change geometry of the wrapper.
@@ -162,35 +177,36 @@ typedef struct TkWmInfo {
* operations. */
/*
- * Information about the virtual root window for this top-level,
- * if there is one.
+ * Information about the virtual root window for this top-level, if there
+ * is one.
*/
- Window vRoot; /* Virtual root window for this top-level,
- * or None if there is no virtual root
- * window (i.e. just use the screen's root). */
+ Window vRoot; /* Virtual root window for this top-level, or
+ * None if there is no virtual root window
+ * (i.e. just use the screen's root). */
int vRootX, vRootY; /* Position of the virtual root inside the
- * root window. If the WM_VROOT_OFFSET_STALE
+ * root window. If the WM_VROOT_OFFSET_STALE
* flag is set then this information may be
* incorrect and needs to be refreshed from
- * the X server. If vRoot is None then these
+ * the X server. If vRoot is None then these
* values are both 0. */
- int vRootWidth, vRootHeight;/* Dimensions of the virtual root window.
- * If vRoot is None, gives the dimensions
- * of the containing screen. This information
- * is never stale, even though vRootX and
- * vRootY can be. */
+ int vRootWidth, vRootHeight;/* Dimensions of the virtual root window. If
+ * vRoot is None, gives the dimensions of the
+ * containing screen. This information is
+ * never stale, even though vRootX and vRootY
+ * can be. */
/*
* Miscellaneous information.
*/
- ProtocolHandler *protPtr; /* First in list of protocol handlers for
- * this window (NULL means none). */
+ WmAttributes attributes; /* Current state of [wm attributes] */
+ WmAttributes reqState; /* Requested state of [wm attributes] */
+ ProtocolHandler *protPtr; /* First in list of protocol handlers for this
+ * window (NULL means none). */
int cmdArgc; /* Number of elements in cmdArgv below. */
- CONST char **cmdArgv; /* Array of strings to store in the
- * WM_COMMAND property. NULL means nothing
- * available. */
+ 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
* property, or NULL. */
int flags; /* Miscellaneous flags, defined below. */
@@ -203,15 +219,15 @@ typedef struct TkWmInfo {
/*
* Flag values for WmInfo structures:
*
- * WM_NEVER_MAPPED - non-zero means window has never been
- * mapped; need to update all info when
- * window is first mapped.
+ * WM_NEVER_MAPPED - non-zero means window has never been mapped;
+ * need to update all info when window is first
+ * mapped.
* WM_UPDATE_PENDING - non-zero means a call to UpdateGeometryInfo
- * has already been scheduled for this
- * window; no need to schedule another one.
+ * has already been scheduled for this window;
+ * no need to schedule another one.
* WM_NEGATIVE_X - non-zero means x-coordinate is measured in
- * pixels from right edge of screen, rather
- * than from left edge.
+ * pixels from right edge of screen, rather than
+ * from left edge.
* WM_NEGATIVE_Y - non-zero means y-coordinate is measured in
* pixels up from bottom of screen, rather than
* down from top.
@@ -222,27 +238,24 @@ typedef struct TkWmInfo {
* WM_VROOT_OFFSET_STALE - non-zero means that (x,y) offset information
* about the virtual root window is stale and
* needs to be fetched fresh from the X server.
- * WM_ABOUT_TO_MAP - non-zero means that the window is about to
- * be mapped by TkWmMapWindow. This is used
- * by UpdateGeometryInfo to modify its behavior.
- * WM_MOVE_PENDING - non-zero means the application has requested
- * a new position for the window, but it hasn't
- * been reflected through the window manager
- * yet.
- * WM_COLORMAPS_EXPLICIT - non-zero means the colormap windows were
- * set explicitly via "wm colormapwindows".
+ * WM_ABOUT_TO_MAP - non-zero means that the window is about to be
+ * mapped by TkWmMapWindow. This is used by
+ * UpdateGeometryInfo to modify its behavior.
+ * WM_MOVE_PENDING - non-zero means the application has requested a
+ * new position for the window, but it hasn't
+ * been reflected through the window manager yet.
+ * WM_COLORMAPS_EXPLICIT - non-zero means the colormap windows were set
+ * explicitly via "wm colormapwindows".
* WM_ADDED_TOPLEVEL_COLORMAP - non-zero means that when "wm colormapwindows"
* was called the top-level itself wasn't
- * specified, so we added it implicitly at
- * the end of the list.
+ * specified, so we added it implicitly at the
+ * end of the list.
* WM_WIDTH_NOT_RESIZABLE - non-zero means that we're not supposed to
* allow the user to change the width of the
- * window (controlled by "wm resizable"
- * command).
+ * window (controlled by "wm resizable" command).
* WM_HEIGHT_NOT_RESIZABLE - non-zero means that we're not supposed to
* allow the user to change the height of the
- * window (controlled by "wm resizable"
- * command).
+ * window (controlled by "wm resizable" command).
* WM_WITHDRAWN - non-zero means that this window has explicitly
* been withdrawn. If it's a transient, it should
* not mirror state changes in the master.
@@ -261,12 +274,12 @@ typedef struct TkWmInfo {
#define WM_ADDED_TOPLEVEL_COLORMAP 0x800
#define WM_WIDTH_NOT_RESIZABLE 0x1000
#define WM_HEIGHT_NOT_RESIZABLE 0x2000
-#define WM_WITHDRAWN 0x4000
+#define WM_WITHDRAWN 0x4000
/*
- * This module keeps a list of all top-level windows, primarily to
- * simplify the job of Tk_CoordsToWindow. The list is called
- * firstWmPtr and is stored in the TkDisplay structure.
+ * This module keeps a list of all top-level windows, primarily to simplify
+ * the job of Tk_CoordsToWindow. The list is called firstWmPtr and is stored
+ * in the TkDisplay structure.
*/
/*
@@ -274,22 +287,20 @@ typedef struct TkWmInfo {
* management of top-level and menubar windows.
*/
-static void TopLevelReqProc _ANSI_ARGS_((ClientData dummy,
- Tk_Window tkwin));
+static void TopLevelReqProc(ClientData dummy, Tk_Window tkwin);
+static void RemapWindows(TkWindow *winPtr, TkWindow *parentPtr);
+static void MenubarReqProc(ClientData clientData,
+ Tk_Window tkwin);
-static Tk_GeomMgr wmMgrType = {
- "wm", /* name */
- TopLevelReqProc, /* requestProc */
- (Tk_GeomLostSlaveProc *) NULL, /* lostSlaveProc */
+static const Tk_GeomMgr wmMgrType = {
+ "wm", /* name */
+ TopLevelReqProc, /* requestProc */
+ NULL, /* lostSlaveProc */
};
-
-static void MenubarReqProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
-
-static Tk_GeomMgr menubarMgrType = {
- "menubar", /* name */
- MenubarReqProc, /* requestProc */
- (Tk_GeomLostSlaveProc *) NULL, /* lostSlaveProc */
+static const Tk_GeomMgr menubarMgrType = {
+ "menubar", /* name */
+ MenubarReqProc, /* requestProc */
+ NULL, /* lostSlaveProc */
};
/*
@@ -302,161 +313,159 @@ typedef struct WaitRestrictInfo {
WmInfo *wmInfoPtr;
int type; /* We only care about this type of event. */
XEvent *eventPtr; /* Where to store the event when it's found. */
- int foundEvent; /* Non-zero means that an event of the
- * desired type has been found. */
+ int foundEvent; /* Non-zero means that an event of the desired
+ * type has been found. */
} WaitRestrictInfo;
/*
- * Forward declarations for procedures defined in this file:
+ * Forward declarations for functions defined in this file:
*/
-static int ComputeReparentGeometry _ANSI_ARGS_((WmInfo *wmPtr));
-static void ConfigureEvent _ANSI_ARGS_((WmInfo *wmPtr,
- XConfigureEvent *eventPtr));
-static void CreateWrapper _ANSI_ARGS_((WmInfo *wmPtr));
-static void GetMaxSize _ANSI_ARGS_((WmInfo *wmPtr,
- int *maxWidthPtr, int *maxHeightPtr));
-static void MenubarDestroyProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static int ParseGeometry _ANSI_ARGS_((Tcl_Interp *interp,
- char *string, TkWindow *winPtr));
-static void ReparentEvent _ANSI_ARGS_((WmInfo *wmPtr,
- XReparentEvent *eventPtr));
-static int SetNetWmType _ANSI_ARGS_((TkWindow *winPtr,
- Tcl_Obj *typePtr));
-static Tcl_Obj * GetNetWmType _ANSI_ARGS_((TkWindow *winPtr));
-static void TkSetTransientFor _ANSI_ARGS_((Tk_Window tkwin,
- Tk_Window parent));
-static void TkWmStackorderToplevelWrapperMap _ANSI_ARGS_((
- TkWindow *winPtr,
- Display *display,
- Tcl_HashTable *reparentTable));
-static void TopLevelReqProc _ANSI_ARGS_((ClientData dummy,
- Tk_Window tkwin));
-static void UpdateCommand _ANSI_ARGS_((TkWindow *winPtr));
-static void UpdateGeometryInfo _ANSI_ARGS_((
- ClientData clientData));
-static void UpdateHints _ANSI_ARGS_((TkWindow *winPtr));
-static void UpdateSizeHints _ANSI_ARGS_((TkWindow *winPtr,
- int newWidth, int newHeight));
-static void UpdateTitle _ANSI_ARGS_((TkWindow *winPtr));
-static void UpdatePhotoIcon _ANSI_ARGS_((TkWindow *winPtr));
-static void UpdateVRootGeometry _ANSI_ARGS_((WmInfo *wmPtr));
-static void UpdateWmProtocols _ANSI_ARGS_((WmInfo *wmPtr));
-static void WaitForConfigureNotify _ANSI_ARGS_((TkWindow *winPtr,
- unsigned long serial));
-static int WaitForEvent _ANSI_ARGS_((Display *display,
- WmInfo *wmInfoPtr, int type, XEvent *eventPtr));
-static void WaitForMapNotify _ANSI_ARGS_((TkWindow *winPtr,
- int mapped));
-static Tk_RestrictAction
- WaitRestrictProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void WrapperEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void WmWaitMapProc _ANSI_ARGS_((
- ClientData clientData, XEvent *eventPtr));
-
-static int WmAspectCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmAttributesCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmClientCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmColormapwindowsCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmCommandCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmDeiconifyCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmFocusmodelCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmFrameCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmGeometryCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmGridCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmGroupCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconbitmapCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconifyCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconmaskCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconnameCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconphotoCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconpositionCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmIconwindowCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmMaxsizeCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmMinsizeCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmOverrideredirectCmd _ANSI_ARGS_((Tk_Window tkwin,
+static int ComputeReparentGeometry(WmInfo *wmPtr);
+static void ConfigureEvent(WmInfo *wmPtr,
+ XConfigureEvent *eventPtr);
+static void CreateWrapper(WmInfo *wmPtr);
+static void GetMaxSize(WmInfo *wmPtr, int *maxWidthPtr,
+ int *maxHeightPtr);
+static void MenubarDestroyProc(ClientData clientData,
+ XEvent *eventPtr);
+static int ParseGeometry(Tcl_Interp *interp, const char *string,
+ TkWindow *winPtr);
+static void ReparentEvent(WmInfo *wmPtr, XReparentEvent *eventPtr);
+static void PropertyEvent(WmInfo *wmPtr, XPropertyEvent *eventPtr);
+static void TkWmStackorderToplevelWrapperMap(TkWindow *winPtr,
+ Display *display, Tcl_HashTable *reparentTable);
+static void TopLevelReqProc(ClientData dummy, Tk_Window tkwin);
+static void RemapWindows(TkWindow *winPtr, TkWindow *parentPtr);
+static void UpdateCommand(TkWindow *winPtr);
+static void UpdateGeometryInfo(ClientData clientData);
+static void UpdateHints(TkWindow *winPtr);
+static void UpdateSizeHints(TkWindow *winPtr,
+ int newWidth, int newHeight);
+static void UpdateTitle(TkWindow *winPtr);
+static void UpdatePhotoIcon(TkWindow *winPtr);
+static void UpdateVRootGeometry(WmInfo *wmPtr);
+static void UpdateWmProtocols(WmInfo *wmPtr);
+static int SetNetWmType(TkWindow *winPtr, Tcl_Obj *typePtr);
+static Tcl_Obj * GetNetWmType(TkWindow *winPtr);
+static void SetNetWmState(TkWindow*, const char *atomName, int on);
+static void CheckNetWmState(WmInfo *, Atom *atoms, int numAtoms);
+static void UpdateNetWmState(WmInfo *);
+static void WaitForConfigureNotify(TkWindow *winPtr,
+ unsigned long serial);
+static int WaitForEvent(Display *display,
+ WmInfo *wmInfoPtr, int type, XEvent *eventPtr);
+static void WaitForMapNotify(TkWindow *winPtr, int mapped);
+static Tk_RestrictProc WaitRestrictProc;
+static void WrapperEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static void WmWaitMapProc(ClientData clientData,
+ XEvent *eventPtr);
+static int WmAspectCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmAttributesCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmClientCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmColormapwindowsCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmPositionfromCmd _ANSI_ARGS_((Tk_Window tkwin,
+ Tcl_Obj *const objv[]);
+static int WmCommandCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmDeiconifyCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmFocusmodelCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmForgetCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmFrameCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmGeometryCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmGridCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmGroupCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmIconbitmapCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmIconifyCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmIconmaskCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmIconnameCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmIconphotoCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmIconpositionCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmIconwindowCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmManageCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmMaxsizeCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmMinsizeCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmOverrideredirectCmd(Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmProtocolCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmResizableCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmSizefromCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmStackorderCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmStateCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmTitleCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmTransientCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static int WmWithdrawCmd _ANSI_ARGS_((Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
- Tcl_Obj *CONST objv[]));
-static void WmUpdateGeom _ANSI_ARGS_((WmInfo *wmPtr,
- TkWindow *winPtr));
+ Tcl_Obj *const objv[]);
+static int WmPositionfromCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmProtocolCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmResizableCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmSizefromCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmStackorderCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmStateCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmTitleCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmTransientCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmWithdrawCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr);
/*
*--------------------------------------------------------------
*
* TkWmCleanup --
*
- * This procedure is invoked to cleanup remaining wm resources
- * associated with a display.
+ * This function is invoked to cleanup remaining wm resources associated
+ * with a display.
*
* Results:
* None.
@@ -467,15 +476,17 @@ static void WmUpdateGeom _ANSI_ARGS_((WmInfo *wmPtr,
*--------------------------------------------------------------
*/
-void TkWmCleanup(dispPtr)
- TkDisplay *dispPtr;
+void TkWmCleanup(
+ TkDisplay *dispPtr)
{
WmInfo *wmPtr, *nextPtr;
+
for (wmPtr = dispPtr->firstWmPtr; wmPtr != NULL; wmPtr = nextPtr) {
/*
- * We can't assume we have access to winPtr's anymore, so some
- * cleanup requiring winPtr data is avoided.
+ * We can't assume we have access to winPtr's anymore, so some cleanup
+ * requiring winPtr data is avoided.
*/
+
nextPtr = wmPtr->nextPtr;
if (wmPtr->title != NULL) {
ckfree(wmPtr->title);
@@ -484,7 +495,7 @@ void TkWmCleanup(dispPtr)
ckfree(wmPtr->iconName);
}
if (wmPtr->iconDataPtr != NULL) {
- ckfree((char *)wmPtr->iconDataPtr);
+ ckfree(wmPtr->iconDataPtr);
}
if (wmPtr->leaderName != NULL) {
ckfree(wmPtr->leaderName);
@@ -496,22 +507,21 @@ void TkWmCleanup(dispPtr)
Tk_DestroyWindow((Tk_Window) wmPtr->wrapperPtr);
}
while (wmPtr->protPtr != NULL) {
- ProtocolHandler *protPtr;
+ ProtocolHandler *protPtr = wmPtr->protPtr;
- protPtr = wmPtr->protPtr;
wmPtr->protPtr = protPtr->nextPtr;
- Tcl_EventuallyFree((ClientData) protPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(protPtr, TCL_DYNAMIC);
}
if (wmPtr->cmdArgv != NULL) {
- ckfree((char *) wmPtr->cmdArgv);
+ ckfree(wmPtr->cmdArgv);
}
if (wmPtr->clientMachine != NULL) {
- ckfree((char *) wmPtr->clientMachine);
+ ckfree(wmPtr->clientMachine);
}
- ckfree((char *) wmPtr);
+ ckfree(wmPtr);
}
if (dispPtr->iconDataPtr != NULL) {
- ckfree((char *)dispPtr->iconDataPtr);
+ ckfree(dispPtr->iconDataPtr);
dispPtr->iconDataPtr = NULL;
}
}
@@ -521,9 +531,8 @@ void TkWmCleanup(dispPtr)
*
* TkWmNewWindow --
*
- * This procedure is invoked whenever a new top-level
- * window is created. Its job is to initialize the WmInfo
- * structure for the window.
+ * This function is invoked whenever a new top-level window is created.
+ * Its job is to initialize the WmInfo structure for the window.
*
* Results:
* None.
@@ -535,13 +544,13 @@ void TkWmCleanup(dispPtr)
*/
void
-TkWmNewWindow(winPtr)
- TkWindow *winPtr; /* Newly-created top-level window. */
+TkWmNewWindow(
+ TkWindow *winPtr) /* Newly-created top-level window. */
{
register WmInfo *wmPtr;
TkDisplay *dispPtr = winPtr->dispPtr;
- wmPtr = (WmInfo *) ckalloc(sizeof(WmInfo));
+ wmPtr = ckalloc(sizeof(WmInfo));
memset(wmPtr, 0, sizeof(WmInfo));
wmPtr->winPtr = winPtr;
wmPtr->reparent = None;
@@ -557,8 +566,18 @@ TkWmNewWindow(winPtr)
wmPtr->hints.window_group = None;
/*
- * Default the maximum dimensions to the size of the display, minus
- * a guess about how space is needed for window manager decorations.
+ * Initialize attributes.
+ */
+
+ wmPtr->attributes.alpha = 1.0;
+ wmPtr->attributes.topmost = 0;
+ wmPtr->attributes.zoomed = 0;
+ wmPtr->attributes.fullscreen = 0;
+ wmPtr->reqState = wmPtr->attributes;
+
+ /*
+ * Default the maximum dimensions to the size of the display, minus a
+ * guess about how space is needed for window manager decorations.
*/
wmPtr->gridWin = NULL;
@@ -588,11 +607,11 @@ TkWmNewWindow(winPtr)
UpdateVRootGeometry(wmPtr);
/*
- * Arrange for geometry requests to be reflected from the window
- * to the window manager.
+ * Arrange for geometry requests to be reflected from the window to the
+ * window manager.
*/
- Tk_ManageGeometry((Tk_Window) winPtr, &wmMgrType, (ClientData) 0);
+ Tk_ManageGeometry((Tk_Window) winPtr, &wmMgrType, NULL);
}
/*
@@ -600,28 +619,28 @@ TkWmNewWindow(winPtr)
*
* TkWmMapWindow --
*
- * This procedure is invoked to map a top-level window. This
- * module gets a chance to update all window-manager-related
- * information in properties before the window manager sees
- * the map event and checks the properties. It also gets to
- * decide whether or not to even map the window after all.
+ * This function is invoked to map a top-level window. This module gets a
+ * chance to update all window-manager-related information in properties
+ * before the window manager sees the map event and checks the
+ * properties. It also gets to decide whether or not to even map the
+ * window after all.
*
* Results:
* None.
*
* Side effects:
- * Properties of winPtr may get updated to provide up-to-date
- * information to the window manager. The window may also get
- * mapped, but it may not be if this procedure decides that
- * isn't appropriate (e.g. because the window is withdrawn).
+ * Properties of winPtr may get updated to provide up-to-date information
+ * to the window manager. The window may also get mapped, but it may not
+ * be if this function decides that isn't appropriate (e.g. because the
+ * window is withdrawn).
*
*--------------------------------------------------------------
*/
void
-TkWmMapWindow(winPtr)
- TkWindow *winPtr; /* Top-level window that's about to
- * be mapped. */
+TkWmMapWindow(
+ TkWindow *winPtr) /* Top-level window that's about to be
+ * mapped. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
XTextProperty textProp;
@@ -632,9 +651,8 @@ TkWmMapWindow(winPtr)
wmPtr->flags &= ~WM_NEVER_MAPPED;
/*
- * This is the first time this window has ever been mapped.
- * First create the wrapper window that provides space for a
- * menubar.
+ * This is the first time this window has ever been mapped. First
+ * create the wrapper window that provides space for a menubar.
*/
if (wmPtr->wrapperPtr == NULL) {
@@ -642,8 +660,7 @@ TkWmMapWindow(winPtr)
}
/*
- * Store all the window-manager-related information for the
- * window.
+ * Store all the window-manager-related information for the window.
*/
TkWmSetClass(winPtr);
@@ -656,12 +673,17 @@ TkWmMapWindow(winPtr)
*/
if (!Tk_IsMapped(wmPtr->masterPtr)) {
- wmPtr->withdrawn = 1;
- wmPtr->hints.initial_state = WithdrawnState;
- } else {
- XSetTransientForHint(winPtr->display, wmPtr->wrapperPtr->window,
- wmPtr->masterPtr->wmInfoPtr->wrapperPtr->window);
+ wmPtr->withdrawn = 1;
+ wmPtr->hints.initial_state = WithdrawnState;
}
+
+ /*
+ * Make sure that we actually set the transient-for property, even
+ * if we are withdrawn. [Bug 1163496]
+ */
+
+ XSetTransientForHint(winPtr->display, wmPtr->wrapperPtr->window,
+ wmPtr->masterPtr->wmInfoPtr->wrapperPtr->window);
}
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
@@ -674,9 +696,24 @@ TkWmMapWindow(winPtr)
Tcl_UtfToExternalDString(NULL, wmPtr->clientMachine, -1, &ds);
if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1,
&textProp) != 0) {
- XSetWMClientMachine(winPtr->display, wmPtr->wrapperPtr->window,
- &textProp);
+ unsigned long pid = (unsigned long) getpid();
+ Atom atom;
+
+ XSetWMClientMachine(winPtr->display,
+ wmPtr->wrapperPtr->window, &textProp);
XFree((char *) textProp.value);
+
+ /*
+ * Inform the server (and more particularly any session
+ * manager) what our process ID is. We only do this when the
+ * CLIENT_MACHINE property is set since the spec for
+ * _NET_WM_PID requires that to be set too.
+ */
+
+ atom = Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_PID");
+ XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window,
+ atom, XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *) &pid, 1);
}
Tcl_DStringFree(&ds);
}
@@ -686,25 +723,29 @@ TkWmMapWindow(winPtr)
}
if (wmPtr->iconFor != NULL) {
/*
- * This window is an icon for somebody else. Make sure that
- * the geometry is up-to-date, then return without mapping
- * the window.
+ * This window is an icon for somebody else. Make sure that the
+ * geometry is up-to-date, then return without mapping the window.
*/
if (wmPtr->flags & WM_UPDATE_PENDING) {
- Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_CancelIdleCall(UpdateGeometryInfo, winPtr);
}
- UpdateGeometryInfo((ClientData) winPtr);
+ UpdateGeometryInfo(winPtr);
return;
}
wmPtr->flags |= WM_ABOUT_TO_MAP;
if (wmPtr->flags & WM_UPDATE_PENDING) {
- Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_CancelIdleCall(UpdateGeometryInfo, winPtr);
}
- UpdateGeometryInfo((ClientData) winPtr);
+ UpdateGeometryInfo(winPtr);
wmPtr->flags &= ~WM_ABOUT_TO_MAP;
/*
+ * Update _NET_WM_STATE hints:
+ */
+ UpdateNetWmState(wmPtr);
+
+ /*
* Map the window, then wait to be sure that the window manager has
* processed the map operation.
*/
@@ -720,9 +761,8 @@ TkWmMapWindow(winPtr)
*
* TkWmUnmapWindow --
*
- * This procedure is invoked to unmap a top-level window. The
- * only thing it does special is to wait for the window actually
- * to be unmapped.
+ * This function is invoked to unmap a top-level window. The only thing
+ * it does special is to wait for the window actually to be unmapped.
*
* Results:
* None.
@@ -734,20 +774,20 @@ TkWmMapWindow(winPtr)
*/
void
-TkWmUnmapWindow(winPtr)
- TkWindow *winPtr; /* Top-level window that's about to
- * be mapped. */
+TkWmUnmapWindow(
+ TkWindow *winPtr) /* Top-level window that's about to be
+ * mapped. */
{
/*
- * It seems to be important to wait after unmapping a top-level
- * window until the window really gets unmapped. I don't completely
- * understand all the interactions with the window manager, but if
- * we go on without waiting, and if the window is then mapped again
- * quickly, events seem to get lost so that we think the window isn't
- * mapped when in fact it is mapped. I suspect that this has something
- * to do with the window manager filtering Map events (and possily not
- * filtering Unmap events?).
+ * It seems to be important to wait after unmapping a top-level window
+ * until the window really gets unmapped. I don't completely understand
+ * all the interactions with the window manager, but if we go on without
+ * waiting, and if the window is then mapped again quickly, events seem to
+ * get lost so that we think the window isn't mapped when in fact it is
+ * mapped. I suspect that this has something to do with the window manager
+ * filtering Map events (and possily not filtering Unmap events?).
*/
+
XUnmapWindow(winPtr->display, winPtr->wmInfoPtr->wrapperPtr->window);
WaitForMapNotify(winPtr, 0);
}
@@ -757,9 +797,8 @@ TkWmUnmapWindow(winPtr)
*
* TkWmDeadWindow --
*
- * This procedure is invoked when a top-level window is
- * about to be deleted. It cleans up the wm-related data
- * structures for the window.
+ * This function is invoked when a top-level window is about to be
+ * deleted. It cleans up the wm-related data structures for the window.
*
* Results:
* None.
@@ -771,8 +810,8 @@ TkWmUnmapWindow(winPtr)
*/
void
-TkWmDeadWindow(winPtr)
- TkWindow *winPtr; /* Top-level window that's being deleted. */
+TkWmDeadWindow(
+ TkWindow *winPtr) /* Top-level window that's being deleted. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
WmInfo *wmPtr2;
@@ -786,10 +825,8 @@ TkWmDeadWindow(winPtr)
register WmInfo *prevPtr;
for (prevPtr = (WmInfo *) winPtr->dispPtr->firstWmPtr; ;
- prevPtr = prevPtr->nextPtr) {
- if (prevPtr == NULL) {
- Tcl_Panic("couldn't unlink window in TkWmDeadWindow");
- }
+ prevPtr = prevPtr->nextPtr) {
+ /* ASSERT: prevPtr != NULL [Bug 1789819] */
if (prevPtr->nextPtr == wmPtr) {
prevPtr->nextPtr = wmPtr->nextPtr;
break;
@@ -803,7 +840,7 @@ TkWmDeadWindow(winPtr)
ckfree(wmPtr->iconName);
}
if (wmPtr->iconDataPtr != NULL) {
- ckfree((char *)wmPtr->iconDataPtr);
+ ckfree(wmPtr->iconDataPtr);
}
if (wmPtr->hints.flags & IconPixmapHint) {
Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap);
@@ -830,10 +867,10 @@ TkWmDeadWindow(winPtr)
}
if (wmPtr->wrapperPtr != NULL) {
/*
- * The rest of Tk doesn't know that we reparent the toplevel
- * inside the wrapper, so reparent it back out again before
- * deleting the wrapper; otherwise the toplevel will get deleted
- * twice (once implicitly by the deletion of the wrapper).
+ * The rest of Tk doesn't know that we reparent the toplevel inside
+ * the wrapper, so reparent it back out again before deleting the
+ * wrapper; otherwise the toplevel will get deleted twice (once
+ * implicitly by the deletion of the wrapper).
*/
XUnmapWindow(winPtr->display, winPtr->window);
@@ -842,60 +879,61 @@ TkWmDeadWindow(winPtr)
Tk_DestroyWindow((Tk_Window) wmPtr->wrapperPtr);
}
while (wmPtr->protPtr != NULL) {
- ProtocolHandler *protPtr;
+ ProtocolHandler *protPtr = wmPtr->protPtr;
- protPtr = wmPtr->protPtr;
wmPtr->protPtr = protPtr->nextPtr;
- Tcl_EventuallyFree((ClientData) protPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(protPtr, TCL_DYNAMIC);
}
if (wmPtr->cmdArgv != NULL) {
- ckfree((char *) wmPtr->cmdArgv);
+ ckfree(wmPtr->cmdArgv);
}
if (wmPtr->clientMachine != NULL) {
- ckfree((char *) wmPtr->clientMachine);
+ ckfree(wmPtr->clientMachine);
}
if (wmPtr->flags & WM_UPDATE_PENDING) {
- Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_CancelIdleCall(UpdateGeometryInfo, winPtr);
}
+
/*
* Reset all transient windows whose master is the dead window.
*/
for (wmPtr2 = winPtr->dispPtr->firstWmPtr; wmPtr2 != NULL;
- wmPtr2 = wmPtr2->nextPtr) {
+ wmPtr2 = wmPtr2->nextPtr) {
if (wmPtr2->masterPtr == winPtr) {
wmPtr->numTransients--;
Tk_DeleteEventHandler((Tk_Window) wmPtr2->masterPtr,
- StructureNotifyMask,
- WmWaitMapProc, (ClientData) wmPtr2->winPtr);
+ StructureNotifyMask, WmWaitMapProc, wmPtr2->winPtr);
wmPtr2->masterPtr = NULL;
if (!(wmPtr2->flags & WM_NEVER_MAPPED)) {
XDeleteProperty(winPtr->display, wmPtr2->wrapperPtr->window,
Tk_InternAtom((Tk_Window) winPtr, "WM_TRANSIENT_FOR"));
- /* FIXME: Need a call like Win32's UpdateWrapper() so
- we can recreate the wrapper and get rid of the
- transient window decorations. */
+
+ /*
+ * FIXME: Need a call like Win32's UpdateWrapper() so we can
+ * recreate the wrapper and get rid of the transient window
+ * decorations.
+ */
}
}
}
- if (wmPtr->numTransients != 0)
- Tcl_Panic("numTransients should be 0");
+ /* ASSERT: numTransients == 0 [Bug 1789819] */
if (wmPtr->masterPtr != NULL) {
wmPtr2 = wmPtr->masterPtr->wmInfoPtr;
+
/*
- * If we had a master, tell them that we aren't tied
- * to them anymore
+ * If we had a master, tell them that we aren't tied to them anymore
*/
+
if (wmPtr2 != NULL) {
wmPtr2->numTransients--;
}
Tk_DeleteEventHandler((Tk_Window) wmPtr->masterPtr,
- StructureNotifyMask,
- WmWaitMapProc, (ClientData) winPtr);
+ StructureNotifyMask, WmWaitMapProc, winPtr);
wmPtr->masterPtr = NULL;
}
- ckfree((char *) wmPtr);
+ ckfree(wmPtr);
winPtr->wmInfoPtr = NULL;
}
@@ -904,11 +942,10 @@ TkWmDeadWindow(winPtr)
*
* TkWmSetClass --
*
- * This procedure is invoked whenever a top-level window's
- * class is changed. If the window has been mapped then this
- * procedure updates the window manager property for the
- * class. If the window hasn't been mapped, the update is
- * deferred until just before the first mapping.
+ * This function is invoked whenever a top-level window's class is
+ * changed. If the window has been mapped then this function updates the
+ * window manager property for the class. If the window hasn't been
+ * mapped, the update is deferred until just before the first mapping.
*
* Results:
* None.
@@ -920,8 +957,8 @@ TkWmDeadWindow(winPtr)
*/
void
-TkWmSetClass(winPtr)
- TkWindow *winPtr; /* Newly-created top-level window. */
+TkWmSetClass(
+ TkWindow *winPtr) /* Newly-created top-level window. */
{
if (winPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) {
return;
@@ -949,56 +986,47 @@ TkWmSetClass(winPtr)
*
* Tk_WmObjCmd --
*
- * This procedure is invoked to process the "wm" Tcl command.
- * See the user documentation for details on what it does.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
+ * This function is invoked to process the "wm" Tcl command.
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
int
-Tk_WmObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_WmObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = (Tk_Window) clientData;
- static CONST char *optionStrings[] = {
+ Tk_Window tkwin = clientData;
+ static const char *const optionStrings[] = {
"aspect", "attributes", "client", "colormapwindows",
- "command", "deiconify", "focusmodel", "frame",
- "geometry", "grid", "group", "iconbitmap",
- "iconify", "iconmask", "iconname",
- "iconphoto", "iconposition",
- "iconwindow", "maxsize", "minsize", "overrideredirect",
- "positionfrom", "protocol", "resizable", "sizefrom",
- "stackorder", "state", "title", "transient",
- "withdraw", (char *) NULL };
+ "command", "deiconify", "focusmodel", "forget",
+ "frame", "geometry", "grid", "group", "iconbitmap",
+ "iconify", "iconmask", "iconname", "iconphoto",
+ "iconposition", "iconwindow", "manage", "maxsize",
+ "minsize", "overrideredirect", "positionfrom",
+ "protocol", "resizable", "sizefrom", "stackorder",
+ "state", "title", "transient", "withdraw", NULL };
enum options {
- WMOPT_ASPECT, WMOPT_ATTRIBUTES, WMOPT_CLIENT, WMOPT_COLORMAPWINDOWS,
- WMOPT_COMMAND, WMOPT_DEICONIFY, WMOPT_FOCUSMODEL, WMOPT_FRAME,
- WMOPT_GEOMETRY, WMOPT_GRID, WMOPT_GROUP, WMOPT_ICONBITMAP,
- WMOPT_ICONIFY, WMOPT_ICONMASK, WMOPT_ICONNAME,
- WMOPT_ICONPHOTO, WMOPT_ICONPOSITION,
- WMOPT_ICONWINDOW, WMOPT_MAXSIZE, WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT,
- WMOPT_POSITIONFROM, WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM,
- WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT,
- WMOPT_WITHDRAW };
- int index;
- int length;
- char *argv1;
+ 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_ICONIFY, WMOPT_ICONMASK, WMOPT_ICONNAME, WMOPT_ICONPHOTO,
+ WMOPT_ICONPOSITION, WMOPT_ICONWINDOW, WMOPT_MANAGE, WMOPT_MAXSIZE,
+ WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT, WMOPT_POSITIONFROM,
+ WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM, WMOPT_STACKORDER,
+ WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT, WMOPT_WITHDRAW };
+ int index, length;
+ const char *argv1;
TkWindow *winPtr;
+ Tk_Window targetWin;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (objc < 2) {
- wrongNumArgs:
+ wrongNumArgs:
Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?");
return TCL_ERROR;
}
@@ -1007,6 +1035,7 @@ Tk_WmObjCmd(clientData, interp, objc, objv)
if ((argv1[0] == 't') && (strncmp(argv1, "tracing", (size_t) length) == 0)
&& (length >= 3)) {
int wmTracing;
+
if ((objc != 2) && (objc != 3)) {
Tcl_WrongNumArgs(interp, 2, objv, "?boolean?");
return TCL_ERROR;
@@ -1037,76 +1066,81 @@ Tk_WmObjCmd(clientData, interp, objc, objv)
goto wrongNumArgs;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], (Tk_Window *) &winPtr)
- != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &targetWin) != TCL_OK) {
return TCL_ERROR;
}
- if (!Tk_IsTopLevel(winPtr)) {
+ winPtr = (TkWindow *) targetWin;
+ if (!Tk_IsTopLevel(winPtr) &&
+ (index != WMOPT_MANAGE) && (index != WMOPT_FORGET)) {
Tcl_AppendResult(interp, "window \"", winPtr->pathName,
- "\" isn't a top-level window", (char *) NULL);
+ "\" isn't a top-level window", NULL);
return TCL_ERROR;
}
switch ((enum options) index) {
- case WMOPT_ASPECT:
+ case WMOPT_ASPECT:
return WmAspectCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ATTRIBUTES:
+ case WMOPT_ATTRIBUTES:
return WmAttributesCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_CLIENT:
+ case WMOPT_CLIENT:
return WmClientCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_COLORMAPWINDOWS:
+ case WMOPT_COLORMAPWINDOWS:
return WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_COMMAND:
+ case WMOPT_COMMAND:
return WmCommandCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_DEICONIFY:
+ case WMOPT_DEICONIFY:
return WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_FOCUSMODEL:
+ case WMOPT_FOCUSMODEL:
return WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_FRAME:
+ case WMOPT_FORGET:
+ return WmForgetCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_FRAME:
return WmFrameCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_GEOMETRY:
+ case WMOPT_GEOMETRY:
return WmGeometryCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_GRID:
+ case WMOPT_GRID:
return WmGridCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_GROUP:
+ case WMOPT_GROUP:
return WmGroupCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONBITMAP:
+ case WMOPT_ICONBITMAP:
return WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONIFY:
+ case WMOPT_ICONIFY:
return WmIconifyCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONMASK:
+ case WMOPT_ICONMASK:
return WmIconmaskCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONNAME:
+ case WMOPT_ICONNAME:
return WmIconnameCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONPHOTO:
- return WmIconphotoCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONPOSITION:
+ case WMOPT_ICONPHOTO:
+ return WmIconphotoCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONPOSITION:
return WmIconpositionCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_ICONWINDOW:
+ case WMOPT_ICONWINDOW:
return WmIconwindowCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_MAXSIZE:
+ case WMOPT_MANAGE:
+ return WmManageCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_MAXSIZE:
return WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_MINSIZE:
+ case WMOPT_MINSIZE:
return WmMinsizeCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_OVERRIDEREDIRECT:
+ case WMOPT_OVERRIDEREDIRECT:
return WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_POSITIONFROM:
+ case WMOPT_POSITIONFROM:
return WmPositionfromCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_PROTOCOL:
+ case WMOPT_PROTOCOL:
return WmProtocolCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_RESIZABLE:
+ case WMOPT_RESIZABLE:
return WmResizableCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_SIZEFROM:
+ case WMOPT_SIZEFROM:
return WmSizefromCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_STACKORDER:
+ case WMOPT_STACKORDER:
return WmStackorderCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_STATE:
+ case WMOPT_STATE:
return WmStateCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_TITLE:
+ case WMOPT_TITLE:
return WmTitleCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_TRANSIENT:
+ case WMOPT_TRANSIENT:
return WmTransientCmd(tkwin, winPtr, interp, objc, objv);
- case WMOPT_WITHDRAW:
+ case WMOPT_WITHDRAW:
return WmWithdrawCmd(tkwin, winPtr, interp, objc, objv);
}
@@ -1119,8 +1153,8 @@ Tk_WmObjCmd(clientData, interp, objc, objv)
*
* WmAspectCmd --
*
- * This procedure is invoked to process the "wm aspect" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm aspect" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1132,12 +1166,12 @@ Tk_WmObjCmd(clientData, interp, objc, objv)
*/
static int
-WmAspectCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmAspectCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int numer1, denom1, numer2, denom2;
@@ -1187,45 +1221,198 @@ WmAspectCmd(tkwin, winPtr, interp, objc, objv)
/*
*----------------------------------------------------------------------
*
- * WmAttributesCmd --
+ * WmSetAttribute --
*
- * This procedure is invoked to process the "wm attributes" Tcl command.
- * See the user documentation for details on what it does.
+ * Helper routine for WmAttributesCmd. Sets the value of the specified
+ * attribute.
*
- * Results:
- * A standard Tcl result.
+ * Returns:
*
- * Side effects:
- * See the user documentation.
+ * TCL_OK if successful, TCL_ERROR otherwise. In case of an error, leaves
+ * a message in the interpreter's result.
*
*----------------------------------------------------------------------
*/
static int
-WmAttributesCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmSetAttribute(
+ TkWindow *winPtr, /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter */
+ WmAttribute attribute, /* Code of attribute to set */
+ Tcl_Obj *value) /* New value */
{
- if (objc < 4) {
- Tcl_Obj *listObj = Tcl_NewListObj(0, NULL);
- Tcl_ListObjAppendElement(interp, listObj,
- Tcl_NewStringObj("-type", -1));
- Tcl_ListObjAppendElement(interp, listObj, GetNetWmType(winPtr));
- Tcl_SetObjResult(interp, listObj);
- return TCL_OK;
- }
- if (objc > 5 || strcmp("-type", Tcl_GetString(objv[3]))) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?-type list?");
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+
+ switch (attribute) {
+ case WMATT_ALPHA: {
+ unsigned long opacity; /* 0=transparent, 0xFFFFFFFF=opaque */
+
+ if (TCL_OK != Tcl_GetDoubleFromObj(interp, value,
+ &wmPtr->reqState.alpha)) {
+ return TCL_ERROR;
+ }
+ if (wmPtr->reqState.alpha < 0.0) {
+ wmPtr->reqState.alpha = 0.0;
+ }
+ if (wmPtr->reqState.alpha > 1.0) {
+ wmPtr->reqState.alpha = 1.0;
+ }
+
+ if (!wmPtr->wrapperPtr) {
+ break;
+ }
+
+ opacity = 0xFFFFFFFFul * wmPtr->reqState.alpha;
+ XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window,
+ Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_WINDOW_OPACITY"),
+ XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &opacity,
+ 1L);
+ wmPtr->attributes.alpha = wmPtr->reqState.alpha;
+
+ break;
+ }
+ case WMATT_TOPMOST:
+ if (Tcl_GetBooleanFromObj(interp, value,
+ &wmPtr->reqState.topmost) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ SetNetWmState(winPtr, "_NET_WM_STATE_ABOVE", wmPtr->reqState.topmost);
+ break;
+ case WMATT_TYPE:
+ if (TCL_OK != SetNetWmType(winPtr, value))
+ return TCL_ERROR;
+ break;
+ case WMATT_ZOOMED:
+ if (Tcl_GetBooleanFromObj(interp, value,
+ &wmPtr->reqState.zoomed) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ SetNetWmState(winPtr, "_NET_WM_STATE_MAXIMIZED_VERT",
+ wmPtr->reqState.zoomed);
+ SetNetWmState(winPtr, "_NET_WM_STATE_MAXIMIZED_HORZ",
+ wmPtr->reqState.zoomed);
+ break;
+ case WMATT_FULLSCREEN:
+ if (Tcl_GetBooleanFromObj(interp, value,
+ &wmPtr->reqState.fullscreen) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ SetNetWmState(winPtr, "_NET_WM_STATE_FULLSCREEN",
+ wmPtr->reqState.fullscreen);
+ break;
+ case _WMATT_LAST_ATTRIBUTE: /* NOTREACHED */
return TCL_ERROR;
}
- if (objc == 4) {
- Tcl_SetObjResult(interp, GetNetWmType(winPtr));
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmGetAttribute --
+ *
+ * Helper routine for WmAttributesCmd. Returns the current value of the
+ * specified attribute.
+ *
+ * See also: CheckNetWmState().
+ *
+ *----------------------------------------------------------------------
+ */
+
+static Tcl_Obj *
+WmGetAttribute(
+ TkWindow *winPtr, /* Toplevel to work with */
+ WmAttribute attribute) /* Code of attribute to get */
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+
+ switch (attribute) {
+ case WMATT_ALPHA:
+ return Tcl_NewDoubleObj(wmPtr->attributes.alpha);
+ case WMATT_TOPMOST:
+ return Tcl_NewBooleanObj(wmPtr->attributes.topmost);
+ case WMATT_ZOOMED:
+ return Tcl_NewBooleanObj(wmPtr->attributes.zoomed);
+ case WMATT_FULLSCREEN:
+ return Tcl_NewBooleanObj(wmPtr->attributes.fullscreen);
+ case WMATT_TYPE:
+ return GetNetWmType(winPtr);
+ case _WMATT_LAST_ATTRIBUTE: /*NOTREACHED*/
+ break;
+ }
+ /*NOTREACHED*/
+ return NULL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmAttributesCmd --
+ *
+ * This function is invoked to process the "wm attributes" Tcl command.
+ *
+ * Syntax:
+ *
+ * wm attributes $win ?-attribute ?value attribute value...??
+ *
+ * Notes:
+ *
+ * Attributes of mapped windows are set by sending a _NET_WM_STATE
+ * ClientMessage to the root window (see SetNetWmState). For withdrawn
+ * windows, we keep track of the requested attribute state, and set the
+ * _NET_WM_STATE property ourselves immediately prior to mapping the
+ * window.
+ *
+ * See also: TIP#231, EWMH.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+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_Obj *const objv[]) /* Argument objects. */
+{
+ int attribute = 0;
+
+ if (objc == 3) { /* wm attributes $win */
+ Tcl_Obj *result = Tcl_NewListObj(0,0);
+
+ for (attribute = 0; attribute < _WMATT_LAST_ATTRIBUTE; ++attribute) {
+ Tcl_ListObjAppendElement(interp, result,
+ Tcl_NewStringObj(WmAttributeNames[attribute], -1));
+ Tcl_ListObjAppendElement(interp, result,
+ WmGetAttribute(winPtr, attribute));
+ }
+ Tcl_SetObjResult(interp, result);
+ return TCL_OK;
+ } else if (objc == 4) { /* wm attributes $win -attribute */
+ if (Tcl_GetIndexFromObj(interp, objv[3], WmAttributeNames,
+ "attribute", 0, &attribute) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ Tcl_SetObjResult(interp, WmGetAttribute(winPtr, attribute));
+ return TCL_OK;
+ } else if ((objc - 3) % 2 == 0) { /* wm attributes $win -att value... */
+ int i;
+
+ for (i = 3; i < objc; i += 2) {
+ if (Tcl_GetIndexFromObj(interp, objv[i], WmAttributeNames,
+ "attribute", 0, &attribute) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (WmSetAttribute(winPtr,interp,attribute,objv[i+1]) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ }
return TCL_OK;
}
- return SetNetWmType(winPtr, objv[4]);
+
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?-attribute ?value ...??");
+ return TCL_ERROR;
}
/*
@@ -1233,8 +1420,8 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv)
*
* WmClientCmd --
*
- * This procedure is invoked to process the "wm client" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm client" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1246,15 +1433,15 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmClientCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmClientCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- char *argv3;
+ const char *argv3;
int length;
if ((objc != 3) && (objc != 4)) {
@@ -1270,7 +1457,7 @@ WmClientCmd(tkwin, winPtr, interp, objc, objv)
argv3 = Tcl_GetStringFromObj(objv[3], &length);
if (argv3[0] == 0) {
if (wmPtr->clientMachine != NULL) {
- ckfree((char *) wmPtr->clientMachine);
+ ckfree(wmPtr->clientMachine);
wmPtr->clientMachine = NULL;
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XDeleteProperty(winPtr->display, wmPtr->wrapperPtr->window,
@@ -1281,10 +1468,9 @@ WmClientCmd(tkwin, winPtr, interp, objc, objv)
return TCL_OK;
}
if (wmPtr->clientMachine != NULL) {
- ckfree((char *) wmPtr->clientMachine);
+ ckfree(wmPtr->clientMachine);
}
- wmPtr->clientMachine = (char *)
- ckalloc((unsigned) (length + 1));
+ wmPtr->clientMachine = ckalloc(length + 1);
strcpy(wmPtr->clientMachine, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XTextProperty textProp;
@@ -1293,9 +1479,22 @@ WmClientCmd(tkwin, winPtr, interp, objc, objv)
Tcl_UtfToExternalDString(NULL, wmPtr->clientMachine, -1, &ds);
if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1,
&textProp) != 0) {
+ unsigned long pid = (unsigned long) getpid();
+
XSetWMClientMachine(winPtr->display, wmPtr->wrapperPtr->window,
&textProp);
XFree((char *) textProp.value);
+
+ /*
+ * Inform the server (and more particularly any session manager)
+ * what our process ID is. We only do this when the CLIENT_MACHINE
+ * property is set since the spec for _NET_WM_PID requires that to
+ * be set too.
+ */
+
+ XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window,
+ Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_PID"),
+ XA_CARDINAL,32, PropModeReplace, (unsigned char*)&pid, 1);
}
Tcl_DStringFree(&ds);
}
@@ -1307,9 +1506,8 @@ WmClientCmd(tkwin, winPtr, interp, objc, objv)
*
* WmColormapwindowsCmd --
*
- * This procedure is invoked to process the "wm colormapwindows"
- * Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm colormapwindows" Tcl
+ * command. See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1321,12 +1519,12 @@ WmClientCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Window *cmapList;
@@ -1353,8 +1551,8 @@ WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv)
&& (wmPtr->flags & WM_ADDED_TOPLEVEL_COLORMAP)) {
break;
}
- winPtr2 = (TkWindow *) Tk_IdToWindow(winPtr->display,
- cmapList[i]);
+ winPtr2 = (TkWindow *)
+ Tk_IdToWindow(winPtr->display, cmapList[i]);
if (winPtr2 == NULL) {
sprintf(buffer, "0x%lx", cmapList[i]);
Tcl_AppendElement(interp, buffer);
@@ -1369,16 +1567,17 @@ WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv)
!= TCL_OK) {
return TCL_ERROR;
}
- cmapList = (Window *) ckalloc((unsigned)
- ((windowObjc+1)*sizeof(Window)));
+ cmapList = ckalloc((windowObjc+1) * sizeof(Window));
gotToplevel = 0;
for (i = 0; i < windowObjc; i++) {
+ Tk_Window mapWin;
+
if (TkGetWindowFromObj(interp, tkwin, windowObjv[i],
- (Tk_Window *) &winPtr2) != TCL_OK)
- {
- ckfree((char *) cmapList);
+ &mapWin) != TCL_OK) {
+ ckfree(cmapList);
return TCL_ERROR;
}
+ winPtr2 = (TkWindow *) mapWin;
if (winPtr2 == winPtr) {
gotToplevel = 1;
}
@@ -1397,7 +1596,7 @@ WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv)
wmPtr->flags |= WM_COLORMAPS_EXPLICIT;
XSetWMColormapWindows(winPtr->display, wmPtr->wrapperPtr->window,
cmapList, windowObjc);
- ckfree((char *) cmapList);
+ ckfree(cmapList);
return TCL_OK;
}
@@ -1406,8 +1605,8 @@ WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv)
*
* WmCommandCmd --
*
- * This procedure is invoked to process the "wm command" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm command" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1419,17 +1618,17 @@ WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmCommandCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmCommandCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- char *argv3;
+ const char *argv3;
int cmdArgc;
- CONST char **cmdArgv;
+ const char **cmdArgv;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?value?");
@@ -1437,16 +1636,16 @@ WmCommandCmd(tkwin, winPtr, interp, objc, objv)
}
if (objc == 3) {
if (wmPtr->cmdArgv != NULL) {
- Tcl_SetResult(interp,
- Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv),
- TCL_DYNAMIC);
+ char *arg = Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv);
+
+ Tcl_SetResult(interp, arg, TCL_DYNAMIC);
}
return TCL_OK;
}
argv3 = Tcl_GetString(objv[3]);
if (argv3[0] == 0) {
if (wmPtr->cmdArgv != NULL) {
- ckfree((char *) wmPtr->cmdArgv);
+ ckfree(wmPtr->cmdArgv);
wmPtr->cmdArgv = NULL;
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XDeleteProperty(winPtr->display, wmPtr->wrapperPtr->window,
@@ -1459,7 +1658,7 @@ WmCommandCmd(tkwin, winPtr, interp, objc, objv)
return TCL_ERROR;
}
if (wmPtr->cmdArgv != NULL) {
- ckfree((char *) wmPtr->cmdArgv);
+ ckfree(wmPtr->cmdArgv);
}
wmPtr->cmdArgc = cmdArgc;
wmPtr->cmdArgv = cmdArgv;
@@ -1474,7 +1673,7 @@ WmCommandCmd(tkwin, winPtr, interp, objc, objv)
*
* WmDeiconifyCmd --
*
- * This procedure is invoked to process the "wm deiconify" Tcl command.
+ * This function is invoked to process the "wm deiconify" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -1487,12 +1686,12 @@ WmCommandCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmDeiconifyCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -1502,13 +1701,12 @@ WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv)
}
if (wmPtr->iconFor != NULL) {
Tcl_AppendResult(interp, "can't deiconify ", Tcl_GetString(objv[2]),
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
+ ": it is an icon for ", Tk_PathName(wmPtr->iconFor), NULL);
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
Tcl_AppendResult(interp, "can't deiconify ", winPtr->pathName,
- ": it is an embedded window", (char *) NULL);
+ ": it is an embedded window", NULL);
return TCL_ERROR;
}
wmPtr->flags &= ~WM_WITHDRAWN;
@@ -1521,7 +1719,7 @@ WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv)
*
* WmFocusmodelCmd --
*
- * This procedure is invoked to process the "wm focusmodel" Tcl command.
+ * This function is invoked to process the "wm focusmodel" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -1534,16 +1732,16 @@ WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmFocusmodelCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- static CONST char *optionStrings[] = {
- "active", "passive", (char *) NULL };
+ static const char *const optionStrings[] = {
+ "active", "passive", NULL };
enum options {
OPT_ACTIVE, OPT_PASSIVE };
int index;
@@ -1574,10 +1772,58 @@ WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv)
/*
*----------------------------------------------------------------------
*
+ * WmForgetCmd --
+ *
+ * This procedure is invoked to process the "wm forget" 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
+WmForgetCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel or Frame to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
+{
+ register Tk_Window frameWin = (Tk_Window) winPtr;
+
+ if (Tk_IsTopLevel(frameWin)) {
+ TkFocusJoin(winPtr);
+ Tk_UnmapWindow(frameWin);
+ TkWmDeadWindow(winPtr);
+ winPtr->flags &=
+ ~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
+ RemapWindows(winPtr, winPtr->parentPtr);
+
+ /*
+ * Flags (above) must be cleared before calling TkMapTopFrame (below).
+ */
+
+ TkMapTopFrame(frameWin);
+ } else {
+ /*
+ * Already not managed by wm - ignore it.
+ */
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* WmFrameCmd --
*
- * This procedure is invoked to process the "wm frame" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm frame" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1589,12 +1835,12 @@ WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmFrameCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmFrameCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Window window;
@@ -1608,7 +1854,7 @@ WmFrameCmd(tkwin, winPtr, interp, objc, objv)
if (window == None) {
window = Tk_WindowId((Tk_Window) winPtr);
}
- sprintf(buf, "0x%x", (unsigned int) window);
+ sprintf(buf, "0x%x", (unsigned) window);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_OK;
}
@@ -1618,7 +1864,7 @@ WmFrameCmd(tkwin, winPtr, interp, objc, objv)
*
* WmGeometryCmd --
*
- * This procedure is invoked to process the "wm geometry" Tcl command.
+ * This function is invoked to process the "wm geometry" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -1631,17 +1877,17 @@ WmFrameCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmGeometryCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmGeometryCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char xSign, ySign;
int width, height;
- char *argv3;
+ const char *argv3;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?newGeometry?");
@@ -1681,8 +1927,8 @@ WmGeometryCmd(tkwin, winPtr, interp, objc, objv)
*
* WmGridCmd --
*
- * This procedure is invoked to process the "wm grid" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm grid" Tcl command. See the
+ * user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1694,12 +1940,12 @@ WmGeometryCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmGridCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmGridCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int reqWidth, reqHeight, widthInc, heightInc;
@@ -1722,8 +1968,8 @@ WmGridCmd(tkwin, winPtr, interp, objc, objv)
}
if (*Tcl_GetString(objv[3]) == '\0') {
/*
- * Turn off gridding and reset the width and height
- * to make sense as ungridded numbers.
+ * Turn off gridding and reset the width and height to make sense as
+ * ungridded numbers.
*/
wmPtr->sizeHintsFlags &= ~(PBaseSize|PResizeInc);
@@ -1739,7 +1985,7 @@ WmGridCmd(tkwin, winPtr, interp, objc, objv)
if ((Tcl_GetIntFromObj(interp, objv[3], &reqWidth) != TCL_OK)
|| (Tcl_GetIntFromObj(interp, objv[4], &reqHeight) != TCL_OK)
|| (Tcl_GetIntFromObj(interp, objv[5], &widthInc) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[6], &heightInc) != TCL_OK)) {
+ || (Tcl_GetIntFromObj(interp, objv[6], &heightInc) !=TCL_OK)) {
return TCL_ERROR;
}
if (reqWidth < 0) {
@@ -1771,8 +2017,8 @@ WmGridCmd(tkwin, winPtr, interp, objc, objv)
*
* WmGroupCmd --
*
- * This procedure is invoked to process the "wm group" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm group" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1784,17 +2030,17 @@ WmGridCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmGroupCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Tk_Window tkwin2;
WmInfo *wmPtr2;
- char *argv3;
+ const char *argv3;
int length;
if ((objc != 3) && (objc != 4)) {
@@ -1835,7 +2081,7 @@ WmGroupCmd(tkwin, winPtr, interp, objc, objv)
}
wmPtr->hints.window_group = Tk_WindowId(wmPtr2->wrapperPtr);
wmPtr->hints.flags |= WindowGroupHint;
- wmPtr->leaderName = ckalloc((unsigned) (length + 1));
+ wmPtr->leaderName = ckalloc(length + 1);
strcpy(wmPtr->leaderName, argv3);
}
UpdateHints(winPtr);
@@ -1847,7 +2093,7 @@ WmGroupCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconbitmapCmd --
*
- * This procedure is invoked to process the "wm iconbitmap" Tcl command.
+ * This function is invoked to process the "wm iconbitmap" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -1860,16 +2106,16 @@ WmGroupCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmIconbitmapCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Pixmap pixmap;
- char *argv3;
+ const char *argv3;
if ((objc < 3) || (objc > 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?bitmap?");
@@ -1878,7 +2124,8 @@ WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv)
if (objc == 3) {
if (wmPtr->hints.flags & IconPixmapHint) {
Tcl_SetResult(interp, (char *)
- Tk_NameOfBitmap(winPtr->display, wmPtr->hints.icon_pixmap),
+ Tk_NameOfBitmap(winPtr->display,
+ wmPtr->hints.icon_pixmap),
TCL_STATIC);
}
return TCL_OK;
@@ -1907,8 +2154,8 @@ WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconifyCmd --
*
- * This procedure is invoked to process the "wm iconify" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm iconify" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -1920,37 +2167,37 @@ WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconifyCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmIconifyCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
+
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
- "\": override-redirect flag is set", (char *) NULL);
+ "\": override-redirect flag is set", NULL);
return TCL_ERROR;
}
if (wmPtr->masterPtr != NULL) {
Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
- "\": it is a transient", (char *) NULL);
+ "\": it is a transient", NULL);
return TCL_ERROR;
}
if (wmPtr->iconFor != NULL) {
Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName,
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
+ ": it is an icon for ", Tk_PathName(wmPtr->iconFor), NULL);
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName,
- ": it is an embedded window", (char *) NULL);
+ ": it is an embedded window", NULL);
return TCL_ERROR;
}
if (TkpWmSetState(winPtr, IconicState) == 0) {
@@ -1967,7 +2214,7 @@ WmIconifyCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconmaskCmd --
*
- * This procedure is invoked to process the "wm iconmask" Tcl command.
+ * This function is invoked to process the "wm iconmask" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -1980,16 +2227,16 @@ WmIconifyCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconmaskCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Pixmap pixmap;
- char *argv3;
+ const char *argv3;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?bitmap?");
@@ -2026,7 +2273,7 @@ WmIconmaskCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconnameCmd --
*
- * This procedure is invoked to process the "wm iconname" Tcl command.
+ * This function is invoked to process the "wm iconname" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -2039,15 +2286,15 @@ WmIconmaskCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconnameCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmIconnameCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- char *argv3;
+ const char *argv3;
int length;
if (objc > 4) {
@@ -2061,10 +2308,10 @@ WmIconnameCmd(tkwin, winPtr, interp, objc, objv)
return TCL_OK;
} else {
if (wmPtr->iconName != NULL) {
- ckfree((char *) wmPtr->iconName);
+ ckfree(wmPtr->iconName);
}
argv3 = Tcl_GetStringFromObj(objv[3], &length);
- wmPtr->iconName = ckalloc((unsigned) (length + 1));
+ wmPtr->iconName = ckalloc(length + 1);
strcpy(wmPtr->iconName, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
UpdateTitle(winPtr);
@@ -2078,8 +2325,7 @@ WmIconnameCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconphotoCmd --
*
- * This procedure is invoked to process the "wm iconphoto"
- * Tcl command.
+ * This function is invoked to process the "wm iconphoto" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -2092,20 +2338,18 @@ WmIconnameCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconphotoCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmIconphotoCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Tk_PhotoHandle photo;
Tk_PhotoImageBlock block;
int i, size = 0, width, height, index = 0, x, y, isDefault = 0;
- long R, G, B, A;
- long *iconPropertyData;
- unsigned char *pixelByte;
+ unsigned long *iconPropertyData;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -2120,29 +2364,41 @@ WmIconphotoCmd(tkwin, winPtr, interp, objc, objv)
return TCL_ERROR;
}
}
+
/*
* Iterate over all images to retrieve their sizes, in order to allocate a
* buffer large enough to hold all images.
*/
+
for (i = 3 + isDefault; i < objc; i++) {
photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i]));
if (photo == NULL) {
Tcl_AppendResult(interp, "can't use \"", Tcl_GetString(objv[i]),
- "\" as iconphoto: not a photo image", (char *) NULL);
+ "\" as iconphoto: not a photo image", NULL);
return TCL_ERROR;
}
Tk_PhotoGetSize(photo, &width, &height);
- /* We need to cardinals for width & height and one cardinal for each
- * image pixel. */
+
+ /*
+ * We need to cardinals for width & height and one cardinal for each
+ * image pixel.
+ */
+
size += 2 + width * height;
}
- /* We have calculated the size of the data. Try to allocate the needed
- * memory space. */
- iconPropertyData = (long *) Tcl_AttemptAlloc(sizeof(long)*size);
+
+ /*
+ * We have calculated the size of the data. Try to allocate the needed
+ * memory space. This is an unsigned long array (despite this being twice
+ * as much as is really needed on LP64 platforms) because that's what X
+ * defines CARD32 arrays to use. [Bug 2902814]
+ */
+
+ iconPropertyData = attemptckalloc(sizeof(unsigned long) * size);
if (iconPropertyData == NULL) {
return TCL_ERROR;
}
- memset(iconPropertyData, 0, sizeof(long)*size);
+ memset(iconPropertyData, 0, sizeof(unsigned long) * size);
for (i = 3 + isDefault; i < objc; i++) {
photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i]));
@@ -2152,60 +2408,54 @@ WmIconphotoCmd(tkwin, winPtr, interp, objc, objv)
}
Tk_PhotoGetSize(photo, &width, &height);
Tk_PhotoGetImage(photo, &block);
+
/*
* Each image data will be placed as an array of 32bit packed
- * CARDINAL, in a window property named "_NET_WM_ICON":
- * _NET_WM_ICON
+ * CARDINAL, in a window property named "_NET_WM_ICON": _NET_WM_ICON
*
* _NET_WM_ICON CARDINAL[][2+n]/32
*
- * This is an array of possible icons for the client.
- * This specification does not stipulate what size these icons should
- * be, but individual desktop environments or toolkits may do so.
- * The Window Manager MAY scale any of these icons to an appropriate
- * size.
+ * This is an array of possible icons for the client. This spec. does
+ * not stipulate what size these icons should be, but individual
+ * desktop environments or toolkits may do so. The Window Manager MAY
+ * scale any of these icons to an appropriate size.
*
* This is an array of 32bit packed CARDINAL ARGB with high byte being
* A, low byte being B. The first two cardinals are width, height.
- * Data is in rows, left to right and top to bottom.
+ * Data is in rows, left to right and top to bottom. The data will be
+ * endian-swapped going to the server if necessary. [Bug 2830420]
+ *
+ * The image data will be encoded in the iconPropertyData array.
*/
- /*
- * Encode the image data in the iconPropertyData array.
- */
- iconPropertyData[index++] = width;
- iconPropertyData[index++] = height;
+ iconPropertyData[index++] = (unsigned long) width;
+ iconPropertyData[index++] = (unsigned long) height;
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
- R = *(block.pixelPtr + x*block.pixelSize +
- y*block.pitch + block.offset[0]);
- G = *(block.pixelPtr + x*block.pixelSize +
- y*block.pitch + block.offset[1]);
- B = *(block.pixelPtr + x*block.pixelSize +
- y*block.pitch + block.offset[2]);
- A = *(block.pixelPtr + x*block.pixelSize +
- y*block.pitch + block.offset[3]);
- pixelByte = (unsigned char *) &iconPropertyData[index];
- pixelByte[3] = A;
- pixelByte[2] = R;
- pixelByte[1] = G;
- pixelByte[0] = B;
- index++;
+ register unsigned char *pixelPtr =
+ block.pixelPtr + x*block.pixelSize + y*block.pitch;
+ register unsigned long R, G, B, A;
+
+ R = pixelPtr[block.offset[0]];
+ G = pixelPtr[block.offset[1]];
+ B = pixelPtr[block.offset[2]];
+ A = pixelPtr[block.offset[3]];
+ iconPropertyData[index++] = A<<24 | R<<16 | G<<8 | B<<0;
}
}
}
if (wmPtr->iconDataPtr != NULL) {
- ckfree((char *)wmPtr->iconDataPtr);
+ ckfree(wmPtr->iconDataPtr);
wmPtr->iconDataPtr = NULL;
}
if (isDefault) {
if (winPtr->dispPtr->iconDataPtr != NULL) {
- ckfree((char *) winPtr->dispPtr->iconDataPtr);
+ ckfree(winPtr->dispPtr->iconDataPtr);
}
- winPtr->dispPtr->iconDataPtr = (unsigned char *) iconPropertyData;
+ winPtr->dispPtr->iconDataPtr = (unsigned char *) iconPropertyData;
winPtr->dispPtr->iconDataSize = size;
} else {
- wmPtr->iconDataPtr = (unsigned char *) iconPropertyData;
+ wmPtr->iconDataPtr = (unsigned char *) iconPropertyData;
wmPtr->iconDataSize = size;
}
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
@@ -2219,8 +2469,7 @@ WmIconphotoCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconpositionCmd --
*
- * This procedure is invoked to process the "wm iconposition"
- * Tcl command.
+ * This function is invoked to process the "wm iconposition" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -2233,12 +2482,12 @@ WmIconphotoCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconpositionCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmIconpositionCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int x, y;
@@ -2257,11 +2506,11 @@ WmIconpositionCmd(tkwin, winPtr, interp, objc, objv)
}
return TCL_OK;
}
- if (*Tcl_GetString(objv[3]) == '\0') {
+ if (Tcl_GetString(objv[3])[0] == '\0') {
wmPtr->hints.flags &= ~IconPositionHint;
} else {
if ((Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)){
+ || (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)) {
return TCL_ERROR;
}
wmPtr->hints.icon_x = x;
@@ -2277,7 +2526,7 @@ WmIconpositionCmd(tkwin, winPtr, interp, objc, objv)
*
* WmIconwindowCmd --
*
- * This procedure is invoked to process the "wm iconwindow" Tcl command.
+ * This function is invoked to process the "wm iconwindow" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -2290,12 +2539,12 @@ WmIconpositionCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Tk_Window tkwin2;
@@ -2308,7 +2557,7 @@ WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
}
if (objc == 3) {
if (wmPtr->icon != NULL) {
- Tcl_SetResult(interp, Tk_PathName(wmPtr->icon), TCL_STATIC);
+ Tcl_SetObjResult(interp, TkNewWindowObj(wmPtr->icon));
}
return TCL_OK;
}
@@ -2316,13 +2565,12 @@ WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
wmPtr->hints.flags &= ~IconWindowHint;
if (wmPtr->icon != NULL) {
/*
- * Remove the icon window relationship. In principle we
- * should also re-enable button events for the window, but
- * this doesn't work in general because the window manager
- * is probably selecting on them (we'll get an error if
- * we try to re-enable the events). So, just leave the
- * icon window event-challenged; the user will have to
- * recreate it if they want button events.
+ * Remove the icon window relationship. In principle we should
+ * also re-enable button events for the window, but this doesn't
+ * work in general because the window manager is probably
+ * selecting on them (we'll get an error if we try to re-enable
+ * the events). So, just leave the icon window event-challenged;
+ * the user will have to recreate it if they want button events.
*/
wmPtr2 = ((TkWindow *) wmPtr->icon)->wmInfoPtr;
@@ -2337,28 +2585,28 @@ WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
}
if (!Tk_IsTopLevel(tkwin2)) {
Tcl_AppendResult(interp, "can't use ", Tcl_GetString(objv[3]),
- " as icon window: not at top level", (char *) NULL);
+ " as icon window: not at top level", NULL);
return TCL_ERROR;
}
wmPtr2 = ((TkWindow *) tkwin2)->wmInfoPtr;
if (wmPtr2->iconFor != NULL) {
Tcl_AppendResult(interp, Tcl_GetString(objv[3]),
- " is already an icon for ",
- Tk_PathName(wmPtr2->iconFor), (char *) NULL);
+ " is already an icon for ", Tk_PathName(wmPtr2->iconFor),
+ NULL);
return TCL_ERROR;
}
if (wmPtr->icon != NULL) {
WmInfo *wmPtr3 = ((TkWindow *) wmPtr->icon)->wmInfoPtr;
+
wmPtr3->iconFor = NULL;
wmPtr3->withdrawn = 1;
wmPtr3->hints.initial_state = WithdrawnState;
}
/*
- * Disable button events in the icon window: some window
- * managers (like olvwm) want to get the events themselves,
- * but X only allows one application at a time to receive
- * button events for a window.
+ * Disable button events in the icon window: some window managers
+ * (like olvwm) want to get the events themselves, but X only allows
+ * one application at a time to receive button events for a window.
*/
atts.event_mask = Tk_Attributes(tkwin2)->event_mask
@@ -2392,10 +2640,71 @@ WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
/*
*----------------------------------------------------------------------
*
+ * WmManageCmd --
+ *
+ * This procedure is invoked to process the "wm manage" 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
+WmManageCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel or Frame to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
+{
+ register Tk_Window frameWin = (Tk_Window) winPtr;
+ register WmInfo *wmPtr = winPtr->wmInfoPtr;
+
+ if (!Tk_IsTopLevel(frameWin)) {
+ if (!Tk_IsManageable(frameWin)) {
+ Tcl_AppendResult(interp, "window \"", Tk_PathName(frameWin),
+ "\" is not manageable: must be a frame, labelframe or "
+ "toplevel", NULL);
+ return TCL_ERROR;
+ }
+ TkFocusSplit(winPtr);
+ Tk_UnmapWindow(frameWin);
+ winPtr->flags |=
+ TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED;
+ if (wmPtr == NULL) {
+ TkWmNewWindow(winPtr);
+ TkWmMapWindow(winPtr);
+ Tk_UnmapWindow(frameWin);
+ }
+ wmPtr = winPtr->wmInfoPtr;
+ winPtr->flags &= ~TK_MAPPED;
+ RemapWindows(winPtr, wmPtr->wrapperPtr);
+
+ /*
+ * Flags (above) must be set before calling TkMapTopFrame (below).
+ */
+
+ TkMapTopFrame(frameWin);
+ } else if (Tk_IsTopLevel(frameWin)) {
+ /*
+ * Already managed by wm - ignore it.
+ */
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* WmMaxsizeCmd --
*
- * This procedure is invoked to process the "wm maxsize" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm maxsize" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2407,12 +2716,12 @@ WmIconwindowCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmMaxsizeCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
@@ -2452,8 +2761,8 @@ WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv)
*
* WmMinsizeCmd --
*
- * This procedure is invoked to process the "wm minsize" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm minsize" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2465,12 +2774,12 @@ WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmMinsizeCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmMinsizeCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
@@ -2502,9 +2811,8 @@ WmMinsizeCmd(tkwin, winPtr, interp, objc, objv)
*
* WmOverrideredirectCmd --
*
- * This procedure is invoked to process the "wm overrideredirect"
- * Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm overrideredirect" Tcl
+ * command. See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2516,12 +2824,12 @@ WmMinsizeCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmOverrideredirectCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
int boolean, curValue;
XSetWindowAttributes atts;
@@ -2532,7 +2840,7 @@ WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv)
}
curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect;
if (objc == 3) {
- Tcl_SetBooleanObj(Tcl_GetObjResult(interp), curValue);
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(curValue));
return TCL_OK;
}
if (Tcl_GetBooleanFromObj(interp, objv[3], &boolean) != TCL_OK) {
@@ -2540,9 +2848,10 @@ WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv)
}
if (curValue != boolean) {
/*
- * Only do this if we are really changing value, because it
- * causes some funky stuff to occur
+ * Only do this if we are really changing value, because it causes
+ * some funky stuff to occur
*/
+
atts.override_redirect = (boolean) ? True : False;
Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect,
&atts);
@@ -2560,8 +2869,7 @@ WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv)
*
* WmPositionfromCmd --
*
- * This procedure is invoked to process the "wm positionfrom"
- * Tcl command.
+ * This function is invoked to process the "wm positionfrom" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -2574,16 +2882,16 @@ WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmPositionfromCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmPositionfromCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- static CONST char *optionStrings[] = {
- "program", "user", (char *) NULL };
+ static const char *const optionStrings[] = {
+ "program", "user", NULL };
enum options {
OPT_PROGRAM, OPT_USER };
int index;
@@ -2625,8 +2933,8 @@ WmPositionfromCmd(tkwin, winPtr, interp, objc, objv)
*
* WmProtocolCmd --
*
- * This procedure is invoked to process the "wm protocol" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm protocol" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2638,17 +2946,17 @@ WmPositionfromCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmProtocolCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
register ProtocolHandler *protPtr, *prevPtr;
Atom protocol;
- char *cmd;
+ const char *cmd;
int cmdLength;
if ((objc < 3) || (objc > 5)) {
@@ -2659,8 +2967,9 @@ WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
/*
* Return a list of all defined protocols for the window.
*/
+
for (protPtr = wmPtr->protPtr; protPtr != NULL;
- protPtr = protPtr->nextPtr) {
+ protPtr = protPtr->nextPtr) {
Tcl_AppendElement(interp,
Tk_GetAtomName((Tk_Window) winPtr, protPtr->protocol));
}
@@ -2671,8 +2980,9 @@ WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
/*
* Return the command to handle a given protocol.
*/
+
for (protPtr = wmPtr->protPtr; protPtr != NULL;
- protPtr = protPtr->nextPtr) {
+ protPtr = protPtr->nextPtr) {
if (protPtr->protocol == protocol) {
Tcl_SetResult(interp, protPtr->command, TCL_STATIC);
return TCL_OK;
@@ -2682,26 +2992,35 @@ WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
}
/*
- * Delete any current protocol handler, then create a new
- * one with the specified command, unless the command is
- * empty.
+ * Special case for _NET_WM_PING: that's always handled directly.
+ */
+
+ if (strcmp(Tcl_GetString(objv[3]), "_NET_WM_PING") == 0) {
+ Tcl_SetResult(interp, "may not alter handling of that protocol",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Delete any current protocol handler, then create a new one with the
+ * specified command, unless the command is empty.
*/
for (protPtr = wmPtr->protPtr, prevPtr = NULL; protPtr != NULL;
- prevPtr = protPtr, protPtr = protPtr->nextPtr) {
+ prevPtr = protPtr, protPtr = protPtr->nextPtr) {
if (protPtr->protocol == protocol) {
if (prevPtr == NULL) {
wmPtr->protPtr = protPtr->nextPtr;
} else {
prevPtr->nextPtr = protPtr->nextPtr;
}
- Tcl_EventuallyFree((ClientData) protPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(protPtr, TCL_DYNAMIC);
break;
}
}
cmd = Tcl_GetStringFromObj(objv[4], &cmdLength);
if (cmdLength > 0) {
- protPtr = (ProtocolHandler *) ckalloc(HANDLER_SIZE(cmdLength));
+ protPtr = ckalloc(HANDLER_SIZE(cmdLength));
protPtr->protocol = protocol;
protPtr->nextPtr = wmPtr->protPtr;
wmPtr->protPtr = protPtr;
@@ -2719,7 +3038,7 @@ WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
*
* WmResizableCmd --
*
- * This procedure is invoked to process the "wm resizable" Tcl command.
+ * This function is invoked to process the "wm resizable" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -2732,12 +3051,12 @@ WmProtocolCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmResizableCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmResizableCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
@@ -2750,8 +3069,8 @@ WmResizableCmd(tkwin, winPtr, interp, objc, objv)
char buf[TCL_INTEGER_SPACE * 2];
sprintf(buf, "%d %d",
- (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) ? 0 : 1,
- (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) ? 0 : 1);
+ (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) ? 0 : 1,
+ (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) ? 0 : 1);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_OK;
}
@@ -2779,8 +3098,8 @@ WmResizableCmd(tkwin, winPtr, interp, objc, objv)
*
* WmSizefromCmd --
*
- * This procedure is invoked to process the "wm sizefrom" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm sizefrom" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2792,16 +3111,16 @@ WmResizableCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmSizefromCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmSizefromCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- static CONST char *optionStrings[] = {
- "program", "user", (char *) NULL };
+ static const char *const optionStrings[] = {
+ "program", "user", NULL };
enum options {
OPT_PROGRAM, OPT_USER };
int index;
@@ -2844,7 +3163,7 @@ WmSizefromCmd(tkwin, winPtr, interp, objc, objv)
*
* WmStackorderCmd --
*
- * This procedure is invoked to process the "wm stackorder" Tcl command.
+ * This function is invoked to process the "wm stackorder" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -2857,16 +3176,16 @@ WmSizefromCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmStackorderCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+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_Obj *const objv[]) /* Argument objects. */
{
TkWindow **windows, **window_ptr;
- static CONST char *optionStrings[] = {
- "isabove", "isbelow", (char *) NULL };
+ static const char *const optionStrings[] = {
+ "isabove", "isbelow", NULL };
enum options {
OPT_ISABOVE, OPT_ISBELOW };
int index;
@@ -2878,68 +3197,64 @@ WmStackorderCmd(tkwin, winPtr, interp, objc, objv)
if (objc == 3) {
windows = TkWmStackorderToplevel(winPtr);
- if (windows == NULL) {
- Tcl_Panic("TkWmStackorderToplevel failed");
- } else {
+ if (windows != NULL) {
+ /* ASSERT: true [Bug 1789819]*/
for (window_ptr = windows; *window_ptr ; window_ptr++) {
Tcl_AppendElement(interp, (*window_ptr)->pathName);
}
- ckfree((char *) windows);
+ ckfree(windows);
return TCL_OK;
}
} else {
+ Tk_Window relWin;
TkWindow *winPtr2;
int index1=-1, index2=-1, result;
- if (TkGetWindowFromObj(interp, tkwin, objv[4], (Tk_Window *) &winPtr2)
- != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[4], &relWin) != TCL_OK) {
return TCL_ERROR;
}
+ winPtr2 = (TkWindow *) relWin;
if (!Tk_IsTopLevel(winPtr2)) {
Tcl_AppendResult(interp, "window \"", winPtr2->pathName,
- "\" isn't a top-level window", (char *) NULL);
+ "\" isn't a top-level window", NULL);
return TCL_ERROR;
}
if (!Tk_IsMapped(winPtr)) {
Tcl_AppendResult(interp, "window \"", winPtr->pathName,
- "\" isn't mapped", (char *) NULL);
+ "\" isn't mapped", NULL);
return TCL_ERROR;
}
if (!Tk_IsMapped(winPtr2)) {
Tcl_AppendResult(interp, "window \"", winPtr2->pathName,
- "\" isn't mapped", (char *) NULL);
+ "\" isn't mapped", NULL);
return TCL_ERROR;
}
/*
- * Lookup stacking order of all toplevels that are children
- * of "." and find the position of winPtr and winPtr2
- * in the stacking order.
+ * Lookup stacking order of all toplevels that are children of "." and
+ * find the position of winPtr and winPtr2 in the stacking order.
*/
windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr);
if (windows == NULL) {
- Tcl_AppendResult(interp, "TkWmStackorderToplevel failed",
- (char *) NULL);
+ Tcl_AppendResult(interp, "TkWmStackorderToplevel failed", NULL);
return TCL_ERROR;
- } else {
- for (window_ptr = windows; *window_ptr ; window_ptr++) {
- if (*window_ptr == winPtr)
- index1 = (window_ptr - windows);
- if (*window_ptr == winPtr2)
- index2 = (window_ptr - windows);
- }
- if (index1 == -1)
- Tcl_Panic("winPtr window not found");
- if (index2 == -1)
- Tcl_Panic("winPtr2 window not found");
+ }
- ckfree((char *) windows);
+ for (window_ptr = windows; *window_ptr ; window_ptr++) {
+ if (*window_ptr == winPtr) {
+ index1 = (window_ptr - windows);
+ }
+ if (*window_ptr == winPtr2) {
+ index2 = (window_ptr - windows);
+ }
}
+ /* ASSERT: index1 != -1 && index2 != -2 [Bug 1789819] */
+ ckfree(windows);
if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
&index) != TCL_OK) {
@@ -2950,7 +3265,7 @@ WmStackorderCmd(tkwin, winPtr, interp, objc, objv)
} else { /* OPT_ISBELOW */
result = index1 < index2;
}
- Tcl_SetIntObj(Tcl_GetObjResult(interp), result);
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(result));
return TCL_OK;
}
return TCL_OK;
@@ -2961,8 +3276,8 @@ WmStackorderCmd(tkwin, winPtr, interp, objc, objv)
*
* WmStateCmd --
*
- * This procedure is invoked to process the "wm state" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm state" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -2974,16 +3289,16 @@ WmStackorderCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmStateCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmStateCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- static CONST char *optionStrings[] = {
- "normal", "iconic", "withdrawn", (char *) NULL };
+ static const char *const optionStrings[] = {
+ "normal", "iconic", "withdrawn", NULL };
enum options {
OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN };
int index;
@@ -2995,9 +3310,8 @@ WmStateCmd(tkwin, winPtr, interp, objc, objv)
if (objc == 4) {
if (wmPtr->iconFor != NULL) {
Tcl_AppendResult(interp, "can't change state of ",
- Tcl_GetString(objv[2]),
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
+ Tcl_GetString(objv[2]), ": it is an icon for ",
+ Tk_PathName(wmPtr->iconFor), NULL);
return TCL_ERROR;
}
@@ -3011,16 +3325,13 @@ WmStateCmd(tkwin, winPtr, interp, objc, objv)
(void) TkpWmSetState(winPtr, NormalState);
} else if (index == OPT_ICONIC) {
if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
- Tcl_AppendResult(interp, "can't iconify \"",
- winPtr->pathName,
- "\": override-redirect flag is set",
- (char *) NULL);
+ Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
+ "\": override-redirect flag is set", NULL);
return TCL_ERROR;
}
if (wmPtr->masterPtr != NULL) {
- Tcl_AppendResult(interp, "can't iconify \"",
- winPtr->pathName,
- "\": it is a transient", (char *) NULL);
+ Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
+ "\": it is a transient", NULL);
return TCL_ERROR;
}
if (TkpWmSetState(winPtr, IconicState) == 0) {
@@ -3059,8 +3370,8 @@ WmStateCmd(tkwin, winPtr, interp, objc, objv)
*
* WmTitleCmd --
*
- * This procedure is invoked to process the "wm title" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm title" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -3072,15 +3383,15 @@ WmStateCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmTitleCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmTitleCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- char *argv3;
+ const char *argv3;
int length;
if (objc > 4) {
@@ -3094,10 +3405,10 @@ WmTitleCmd(tkwin, winPtr, interp, objc, objv)
return TCL_OK;
} else {
if (wmPtr->title != NULL) {
- ckfree((char *) wmPtr->title);
+ ckfree(wmPtr->title);
}
argv3 = Tcl_GetStringFromObj(objv[3], &length);
- wmPtr->title = ckalloc((unsigned) (length + 1));
+ wmPtr->title = ckalloc(length + 1);
strcpy(wmPtr->title, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
@@ -3112,7 +3423,7 @@ WmTitleCmd(tkwin, winPtr, interp, objc, objv)
*
* WmTransientCmd --
*
- * This procedure is invoked to process the "wm transient" Tcl command.
+ * This function is invoked to process the "wm transient" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
@@ -3125,12 +3436,12 @@ WmTitleCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmTransientCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
TkWindow *masterPtr = wmPtr->masterPtr;
@@ -3142,33 +3453,36 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
}
if (objc == 3) {
if (masterPtr != NULL) {
- Tcl_SetResult(interp, Tk_PathName(masterPtr), TCL_STATIC);
+ Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) masterPtr));
}
return TCL_OK;
}
if (Tcl_GetString(objv[3])[0] == '\0') {
if (masterPtr != NULL) {
/*
- * If we had a master, tell them that we aren't tied
- * to them anymore
+ * If we had a master, tell them that we aren't tied to them
+ * anymore
*/
masterPtr->wmInfoPtr->numTransients--;
- Tk_DeleteEventHandler((Tk_Window) masterPtr,
- StructureNotifyMask,
- WmWaitMapProc, (ClientData) winPtr);
+ Tk_DeleteEventHandler((Tk_Window) masterPtr, StructureNotifyMask,
+ WmWaitMapProc, winPtr);
- /* FIXME: Need a call like Win32's UpdateWrapper() so
- we can recreate the wrapper and get rid of the
- transient window decorations. */
+ /*
+ * FIXME: Need a call like Win32's UpdateWrapper() so we can
+ * recreate the wrapper and get rid of the transient window
+ * decorations.
+ */
}
wmPtr->masterPtr = NULL;
} else {
- if (TkGetWindowFromObj(interp, tkwin, objv[3],
- (Tk_Window *) &masterPtr) != TCL_OK) {
+ Tk_Window masterWin;
+
+ if (TkGetWindowFromObj(interp, tkwin, objv[3], &masterWin)!=TCL_OK) {
return TCL_ERROR;
}
+ masterPtr = (TkWindow *) masterWin;
while (!Tk_TopWinHierarchy(masterPtr)) {
/*
* Ensure that the master window is actually a Tk toplevel.
@@ -3179,11 +3493,9 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
Tk_MakeWindowExist((Tk_Window) masterPtr);
if (wmPtr->iconFor != NULL) {
- Tcl_AppendResult(interp, "can't make \"",
- Tcl_GetString(objv[2]),
+ Tcl_AppendResult(interp, "can't make \"", Tcl_GetString(objv[2]),
"\" a transient: it is an icon for ",
- Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
+ Tk_PathName(wmPtr->iconFor), NULL);
return TCL_ERROR;
}
@@ -3193,37 +3505,32 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
}
if (wmPtr2->iconFor != NULL) {
- Tcl_AppendResult(interp, "can't make \"",
- Tcl_GetString(objv[3]),
+ Tcl_AppendResult(interp, "can't make \"", Tcl_GetString(objv[3]),
"\" a master: it is an icon for ",
- Tk_PathName(wmPtr2->iconFor),
- (char *) NULL);
+ Tk_PathName(wmPtr2->iconFor), NULL);
return TCL_ERROR;
}
if (masterPtr == winPtr) {
Tcl_AppendResult(interp, "can't make \"", Tk_PathName(winPtr),
- "\" its own master",
- (char *) NULL);
+ "\" its own master", NULL);
return TCL_ERROR;
} else if (masterPtr != wmPtr->masterPtr) {
/*
- * Remove old master map/unmap binding before setting
- * the new master. The event handler will ensure that
- * transient states reflect the state of the master.
+ * Remove old master map/unmap binding before setting the new
+ * master. The event handler will ensure that transient states
+ * reflect the state of the master.
*/
if (wmPtr->masterPtr != NULL) {
wmPtr->masterPtr->wmInfoPtr->numTransients--;
Tk_DeleteEventHandler((Tk_Window) wmPtr->masterPtr,
- StructureNotifyMask,
- WmWaitMapProc, (ClientData) winPtr);
+ StructureNotifyMask, WmWaitMapProc, winPtr);
}
masterPtr->wmInfoPtr->numTransients++;
Tk_CreateEventHandler((Tk_Window) masterPtr,
- StructureNotifyMask,
- WmWaitMapProc, (ClientData) winPtr);
+ StructureNotifyMask, WmWaitMapProc, winPtr);
wmPtr->masterPtr = masterPtr;
}
@@ -3238,11 +3545,12 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
}
} else {
if (wmPtr->masterPtr != NULL) {
- XSetTransientForHint(winPtr->display, wmPtr->wrapperPtr->window,
+ XSetTransientForHint(winPtr->display,
+ wmPtr->wrapperPtr->window,
wmPtr->masterPtr->wmInfoPtr->wrapperPtr->window);
} else {
XDeleteProperty(winPtr->display, wmPtr->wrapperPtr->window,
- Tk_InternAtom((Tk_Window)winPtr, "WM_TRANSIENT_FOR"));
+ Tk_InternAtom((Tk_Window) winPtr,"WM_TRANSIENT_FOR"));
}
}
}
@@ -3254,8 +3562,8 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
*
* WmWithdrawCmd --
*
- * This procedure is invoked to process the "wm withdraw" Tcl command.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the "wm withdraw" Tcl command. See
+ * the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
@@ -3267,12 +3575,12 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
*/
static int
-WmWithdrawCmd(tkwin, winPtr, interp, objc, objv)
- 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_Obj *CONST objv[]; /* Argument objects. */
+WmWithdrawCmd(
+ 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_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -3282,8 +3590,7 @@ WmWithdrawCmd(tkwin, winPtr, interp, objc, objv)
}
if (wmPtr->iconFor != NULL) {
Tcl_AppendResult(interp, "can't withdraw ", Tcl_GetString(objv[2]),
- ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
- (char *) NULL);
+ ": it is an icon for ", Tk_PathName(wmPtr->iconFor), NULL);
return TCL_ERROR;
}
wmPtr->flags |= WM_WITHDRAWN;
@@ -3297,40 +3604,44 @@ WmWithdrawCmd(tkwin, winPtr, interp, objc, objv)
}
/*
- * Invoked by those wm subcommands that affect geometry.
- * Schedules a geometry update.
+ * Invoked by those wm subcommands that affect geometry. Schedules a geometry
+ * update.
*/
+
static void
-WmUpdateGeom(wmPtr, winPtr)
- WmInfo *wmPtr;
- TkWindow *winPtr;
+WmUpdateGeom(
+ WmInfo *wmPtr,
+ TkWindow *winPtr)
{
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
/*
- * Invoked when a MapNotify or UnmapNotify event is delivered for a
- * toplevel that is the master of a transient toplevel.
+ * Invoked when a MapNotify or UnmapNotify event is delivered for a toplevel
+ * that is the master of a transient toplevel.
*/
+
static void
-WmWaitMapProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to window. */
- XEvent *eventPtr; /* Information about event. */
+WmWaitMapProc(
+ ClientData clientData, /* Pointer to window. */
+ XEvent *eventPtr) /* Information about event. */
{
- TkWindow *winPtr = (TkWindow *) clientData;
+ TkWindow *winPtr = clientData;
TkWindow *masterPtr = winPtr->wmInfoPtr->masterPtr;
- if (masterPtr == NULL)
- return;
+ if (masterPtr == NULL) {
+ return;
+ }
if (eventPtr->type == MapNotify) {
- if (!(winPtr->wmInfoPtr->flags & WM_WITHDRAWN))
- (void) TkpWmSetState(winPtr, NormalState);
+ if (!(winPtr->wmInfoPtr->flags & WM_WITHDRAWN)) {
+ (void) TkpWmSetState(winPtr, NormalState);
+ }
} else if (eventPtr->type == UnmapNotify) {
- (void) TkpWmSetState(winPtr, WithdrawnState);
+ (void) TkpWmSetState(winPtr, WithdrawnState);
}
}
@@ -3339,34 +3650,34 @@ WmWaitMapProc(clientData, eventPtr)
*
* Tk_SetGrid --
*
- * This procedure is invoked by a widget when it wishes to set a grid
- * coordinate system that controls the size of a top-level window.
- * It provides a C interface equivalent to the "wm grid" command and
- * is usually asscoiated with the -setgrid option.
+ * This function is invoked by a widget when it wishes to set a grid
+ * coordinate system that controls the size of a top-level window. It
+ * provides a C interface equivalent to the "wm grid" command and is
+ * usually asscoiated with the -setgrid option.
*
* Results:
* None.
*
* Side effects:
- * Grid-related information will be passed to the window manager, so
- * that the top-level window associated with tkwin will resize on
- * even grid units. If some other window already controls gridding
- * for the top-level window then this procedure call has no effect.
+ * Grid-related information will be passed to the window manager, so that
+ * the top-level window associated with tkwin will resize on even grid
+ * units. If some other window already controls gridding for the
+ * top-level window then this function call has no effect.
*
*----------------------------------------------------------------------
*/
void
-Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc)
- Tk_Window tkwin; /* Token for window. New window mgr info
- * will be posted for the top-level window
+Tk_SetGrid(
+ Tk_Window tkwin, /* Token for window. New window mgr info will
+ * be posted for the top-level window
* associated with this window. */
- int reqWidth; /* Width (in grid units) corresponding to
- * the requested geometry for tkwin. */
- int reqHeight; /* Height (in grid units) corresponding to
- * the requested geometry for tkwin. */
- int widthInc, heightInc; /* Pixel increments corresponding to a
- * change of one grid unit. */
+ int reqWidth, /* Width (in grid units) corresponding to the
+ * requested geometry for tkwin. */
+ int reqHeight, /* Height (in grid units) corresponding to the
+ * requested geometry for tkwin. */
+ int widthInc, int heightInc)/* Pixel increments corresponding to a change
+ * of one grid unit. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
register WmInfo *wmPtr;
@@ -3374,6 +3685,7 @@ Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc)
/*
* Ensure widthInc and heightInc are greater than 0
*/
+
if (widthInc <= 0) {
widthInc = 1;
}
@@ -3415,15 +3727,15 @@ Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc)
}
/*
- * If gridding was previously off, then forget about any window
- * size requests made by the user or via "wm geometry": these are
- * in pixel units and there's no easy way to translate them to
- * grid units since the new requested size of the top-level window in
- * pixels may not yet have been registered yet (it may filter up
- * the hierarchy in DoWhenIdle handlers). However, if the window
- * has never been mapped yet then just leave the window size alone:
- * assume that it is intended to be in grid units but just happened
- * to have been specified before this procedure was called.
+ * If gridding was previously off, then forget about any window size
+ * requests made by the user or via "wm geometry": these are in pixel
+ * units and there's no easy way to translate them to grid units since the
+ * new requested size of the top-level window in pixels may not yet have
+ * been registered yet (it may filter up the hierarchy in DoWhenIdle
+ * handlers). However, if the window has never been mapped yet then just
+ * leave the window size alone: assume that it is intended to be in grid
+ * units but just happened to have been specified before this function was
+ * called.
*/
if ((wmPtr->gridWin == NULL) && !(wmPtr->flags & WM_NEVER_MAPPED)) {
@@ -3432,8 +3744,8 @@ Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc)
}
/*
- * Set the new gridding information, and start the process of passing
- * all of this information to the window manager.
+ * Set the new gridding information, and start the process of passing all
+ * of this information to the window manager.
*/
wmPtr->gridWin = tkwin;
@@ -3444,7 +3756,7 @@ Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc)
wmPtr->sizeHintsFlags |= PBaseSize|PResizeInc;
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
@@ -3454,23 +3766,22 @@ Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc)
*
* Tk_UnsetGrid --
*
- * This procedure cancels the effect of a previous call
- * to Tk_SetGrid.
+ * This function cancels the effect of a previous call to Tk_SetGrid.
*
* Results:
* None.
*
* Side effects:
* If tkwin currently controls gridding for its top-level window,
- * gridding is cancelled for that top-level window; if some other
- * window controls gridding then this procedure has no effect.
+ * gridding is cancelled for that top-level window; if some other window
+ * controls gridding then this function has no effect.
*
*----------------------------------------------------------------------
*/
void
-Tk_UnsetGrid(tkwin)
- Tk_Window tkwin; /* Token for window that is currently
+Tk_UnsetGrid(
+ Tk_Window tkwin) /* Token for window that is currently
* controlling gridding. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
@@ -3513,7 +3824,7 @@ Tk_UnsetGrid(tkwin)
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
@@ -3523,24 +3834,25 @@ Tk_UnsetGrid(tkwin)
*
* ConfigureEvent --
*
- * This procedure is called to handle ConfigureNotify events on
- * wrapper windows.
+ * This function is called to handle ConfigureNotify events on wrapper
+ * windows.
*
* Results:
* None.
*
* Side effects:
- * Information gets updated in the WmInfo structure for the window
- * and the toplevel itself gets repositioned within the wrapper.
+ * Information gets updated in the WmInfo structure for the window and
+ * the toplevel itself gets repositioned within the wrapper.
*
*----------------------------------------------------------------------
*/
static void
-ConfigureEvent(wmPtr, configEventPtr)
- WmInfo *wmPtr; /* Information about toplevel window. */
- XConfigureEvent *configEventPtr; /* Event that just occurred for
- * wmPtr->wrapperPtr. */
+ConfigureEvent(
+ WmInfo *wmPtr, /* Information about toplevel window. */
+ XConfigureEvent *configEventPtr)
+ /* Event that just occurred for
+ * wmPtr->wrapperPtr. */
{
TkWindow *wrapperPtr = wmPtr->wrapperPtr;
TkWindow *winPtr = wmPtr->winPtr;
@@ -3548,21 +3860,21 @@ ConfigureEvent(wmPtr, configEventPtr)
Tk_ErrorHandler handler;
/*
- * Update size information from the event. There are a couple of
- * tricky points here:
+ * Update size information from the event. There are a couple of tricky
+ * points here:
*
- * 1. If the user changed the size externally then set wmPtr->width
- * and wmPtr->height just as if a "wm geometry" command had been
- * invoked with the same information.
- * 2. However, if the size is changing in response to a request
- * coming from us (WM_SYNC_PENDING is set), then don't set wmPtr->width
- * or wmPtr->height if they were previously -1 (otherwise the
- * window will stop tracking geometry manager requests).
+ * 1. If the user changed the size externally then set wmPtr->width and
+ * wmPtr->height just as if a "wm geometry" command had been invoked
+ * with the same information.
+ * 2. However, if the size is changing in response to a request coming
+ * from us (WM_SYNC_PENDING is set), then don't set wmPtr->width or
+ * wmPtr->height if they were previously -1 (otherwise the window will
+ * stop tracking geometry manager requests).
*/
if (((wrapperPtr->changes.width != configEventPtr->width)
|| (wrapperPtr->changes.height != configEventPtr->height))
- && !(wmPtr->flags & WM_SYNC_PENDING)){
+ && !(wmPtr->flags & WM_SYNC_PENDING)) {
if (dispPtr->flags & TK_DISPLAY_WM_TRACING) {
printf("TopLevelEventProc: user changed %s size to %dx%d\n",
winPtr->pathName, configEventPtr->width,
@@ -3571,17 +3883,17 @@ ConfigureEvent(wmPtr, configEventPtr)
if ((wmPtr->width == -1)
&& (configEventPtr->width == winPtr->reqWidth)) {
/*
- * Don't set external width, since the user didn't change it
- * from what the widgets asked for.
+ * Don't set external width, since the user didn't change it from
+ * what the widgets asked for.
*/
} else {
/*
* Note: if this window is embedded then don't set the external
* size, since it came from the containing application, not the
- * user. In this case we want to keep sending our size requests
- * to the containing application; if the user fixes the size
- * of that application then it will still percolate down to us
- * in the right way.
+ * user. In this case we want to keep sending our size requests to
+ * the containing application; if the user fixes the size of that
+ * application then it will still percolate down to us in the
+ * right way.
*/
if (!(winPtr->flags & TK_EMBEDDED)) {
@@ -3601,13 +3913,13 @@ ConfigureEvent(wmPtr, configEventPtr)
&& (configEventPtr->height ==
(winPtr->reqHeight + wmPtr->menuHeight))) {
/*
- * Don't set external height, since the user didn't change it
- * from what the widgets asked for.
+ * Don't set external height, since the user didn't change it from
+ * what the widgets asked for.
*/
} else {
/*
- * See note for wmPtr->width about not setting external size
- * for embedded windows.
+ * See note for wmPtr->width about not setting external size for
+ * embedded windows.
*/
if (!(winPtr->flags & TK_EMBEDDED)) {
@@ -3621,7 +3933,7 @@ ConfigureEvent(wmPtr, configEventPtr)
} else {
wmPtr->height = configEventPtr->height - wmPtr->menuHeight;
}
- }
+ }
}
wmPtr->configWidth = configEventPtr->width;
wmPtr->configHeight = configEventPtr->height;
@@ -3642,19 +3954,17 @@ ConfigureEvent(wmPtr, configEventPtr)
wrapperPtr->changes.stack_mode = Above;
/*
- * Reparenting window managers make life difficult. If the
- * window manager reparents a top-level window then the x and y
- * information that comes in events for the window is wrong:
- * it gives the location of the window inside its decorative
- * parent, rather than the location of the window in root
- * coordinates, which is what we want. Window managers
- * are supposed to send synthetic events with the correct
- * information, but ICCCM doesn't require them to do this
- * under all conditions, and the information provided doesn't
- * include everything we need here. So, the code below
- * maintains a bunch of information about the parent window.
- * If the window hasn't been reparented, we pretend that
- * there is a parent shrink-wrapped around the window.
+ * Reparenting window managers make life difficult. If the window manager
+ * reparents a top-level window then the x and y information that comes in
+ * events for the window is wrong: it gives the location of the window
+ * inside its decorative parent, rather than the location of the window in
+ * root coordinates, which is what we want. Window managers are supposed
+ * to send synthetic events with the correct information, but ICCCM
+ * doesn't require them to do this under all conditions, and the
+ * information provided doesn't include everything we need here. So, the
+ * code below maintains a bunch of information about the parent window.
+ * If the window hasn't been reparented, we pretend that there is a parent
+ * shrink-wrapped around the window.
*/
if (dispPtr->flags & TK_DISPLAY_WM_TRACING) {
@@ -3680,11 +3990,11 @@ ConfigureEvent(wmPtr, configEventPtr)
/*
* Make sure that the toplevel and menubar are properly positioned within
- * the wrapper. If the menuHeight happens to be zero, we'll get a
- * BadValue X error that we want to ignore [Bug: 3377]
+ * the wrapper. If the menuHeight happens to be zero, we'll get a BadValue
+ * X error that we want to ignore [Bug: 3377]
*/
- handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+
+ handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1, NULL, NULL);
XMoveResizeWindow(winPtr->display, winPtr->window, 0,
wmPtr->menuHeight, (unsigned) wrapperPtr->changes.width,
(unsigned) (wrapperPtr->changes.height - wmPtr->menuHeight));
@@ -3698,9 +4008,9 @@ ConfigureEvent(wmPtr, configEventPtr)
/*
* Update the coordinates in the toplevel (they should refer to the
- * position in root window coordinates, not the coordinates of the
- * wrapper window). Then synthesize a ConfigureNotify event to tell
- * the application about the change.
+ * position in root window coordinates, not the coordinates of the wrapper
+ * window). Then synthesize a ConfigureNotify event to tell the
+ * application about the change.
*/
winPtr->changes.x = wrapperPtr->changes.x;
@@ -3715,8 +4025,8 @@ ConfigureEvent(wmPtr, configEventPtr)
*
* ReparentEvent --
*
- * This procedure is called to handle ReparentNotify events on
- * wrapper windows.
+ * This function is called to handle ReparentNotify events on wrapper
+ * windows.
*
* Results:
* None.
@@ -3728,41 +4038,42 @@ ConfigureEvent(wmPtr, configEventPtr)
*/
static void
-ReparentEvent(wmPtr, reparentEventPtr)
- WmInfo *wmPtr; /* Information about toplevel window. */
- XReparentEvent *reparentEventPtr; /* Event that just occurred for
- * wmPtr->wrapperPtr. */
+ReparentEvent(
+ WmInfo *wmPtr, /* Information about toplevel window. */
+ XReparentEvent *reparentEventPtr)
+ /* Event that just occurred for
+ * wmPtr->wrapperPtr. */
{
TkWindow *wrapperPtr = wmPtr->wrapperPtr;
- Window vRoot, ancestor, *children, dummy2, *virtualRootPtr;
+ Window vRoot, ancestor, *children, dummy2, *virtualRootPtr, **vrPtrPtr;
Atom actualType;
int actualFormat;
unsigned long numItems, bytesAfter;
- unsigned int dummy;
+ unsigned dummy;
Tk_ErrorHandler handler;
TkDisplay *dispPtr = wmPtr->winPtr->dispPtr;
/*
- * Identify the root window for wrapperPtr. This is tricky because of
- * virtual root window managers like tvtwm. If the window has a
- * property named __SWM_ROOT or __WM_ROOT then this property gives
- * the id for a virtual root window that should be used instead of
- * the root window of the screen.
+ * Identify the root window for wrapperPtr. This is tricky because of
+ * virtual root window managers like tvtwm. If the window has a property
+ * named __SWM_ROOT or __WM_ROOT then this property gives the id for a
+ * virtual root window that should be used instead of the root window of
+ * the screen.
*/
vRoot = RootWindow(wrapperPtr->display, wrapperPtr->screenNum);
wmPtr->vRoot = None;
- handler = Tk_CreateErrorHandler(wrapperPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ handler = Tk_CreateErrorHandler(wrapperPtr->display, -1,-1,-1, NULL,NULL);
+ vrPtrPtr = &virtualRootPtr; /* Silence GCC warning */
if (((XGetWindowProperty(wrapperPtr->display, wrapperPtr->window,
Tk_InternAtom((Tk_Window) wrapperPtr, "__WM_ROOT"), 0, (long) 1,
False, XA_WINDOW, &actualType, &actualFormat, &numItems,
- &bytesAfter, (unsigned char **) &virtualRootPtr) == Success)
+ &bytesAfter, (unsigned char **) vrPtrPtr) == Success)
&& (actualType == XA_WINDOW))
|| ((XGetWindowProperty(wrapperPtr->display, wrapperPtr->window,
Tk_InternAtom((Tk_Window) wrapperPtr, "__SWM_ROOT"), 0, (long) 1,
False, XA_WINDOW, &actualType, &actualFormat, &numItems,
- &bytesAfter, (unsigned char **) &virtualRootPtr) == Success)
+ &bytesAfter, (unsigned char **) vrPtrPtr) == Success)
&& (actualType == XA_WINDOW))) {
if ((actualFormat == 32) && (numItems == 1)) {
vRoot = wmPtr->vRoot = *virtualRootPtr;
@@ -3778,7 +4089,7 @@ ReparentEvent(wmPtr, reparentEventPtr)
if (dispPtr->flags & TK_DISPLAY_WM_TRACING) {
printf("ReparentEvent: %s (%p) reparented to 0x%x, vRoot = 0x%x\n",
wmPtr->winPtr->pathName, wmPtr->winPtr,
- (unsigned int) reparentEventPtr->parent, (unsigned int) vRoot);
+ (unsigned) reparentEventPtr->parent, (unsigned) vRoot);
}
/*
@@ -3788,12 +4099,12 @@ ReparentEvent(wmPtr, reparentEventPtr)
UpdateVRootGeometry(wmPtr);
/*
- * If the window's new parent is the root window, then mark it as
- * no longer reparented.
+ * If the window's new parent is the root window, then mark it as no
+ * longer reparented.
*/
if (reparentEventPtr->parent == vRoot) {
- noReparent:
+ noReparent:
wmPtr->reparent = None;
wmPtr->parentWidth = wrapperPtr->changes.width;
wmPtr->parentHeight = wrapperPtr->changes.height;
@@ -3806,17 +4117,15 @@ ReparentEvent(wmPtr, reparentEventPtr)
}
/*
- * Search up the window hierarchy to find the ancestor of this
- * window that is just below the (virtual) root. This is tricky
- * because it's possible that things have changed since the event
- * was generated so that the ancestry indicated by the event no
- * longer exists. If this happens then an error will occur and
- * we just discard the event (there will be a more up-to-date
- * ReparentNotify event coming later).
+ * Search up the window hierarchy to find the ancestor of this window that
+ * is just below the (virtual) root. This is tricky because it's possible
+ * that things have changed since the event was generated so that the
+ * ancestry indicated by the event no longer exists. If this happens then
+ * an error will occur and we just discard the event (there will be a more
+ * up-to-date ReparentNotify event coming later).
*/
- handler = Tk_CreateErrorHandler(wrapperPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ handler = Tk_CreateErrorHandler(wrapperPtr->display, -1,-1,-1, NULL,NULL);
wmPtr->reparent = reparentEventPtr->parent;
while (1) {
if (XQueryTree(wrapperPtr->display, wmPtr->reparent, &dummy2,
@@ -3844,52 +4153,49 @@ ReparentEvent(wmPtr, reparentEventPtr)
*
* ComputeReparentGeometry --
*
- * This procedure is invoked to recompute geometry information
- * related to a reparented top-level window, such as the position
- * and total size of the parent and the position within it of
- * the top-level window.
+ * This function is invoked to recompute geometry information related to
+ * a reparented top-level window, such as the position and total size of
+ * the parent and the position within it of the top-level window.
*
* Results:
- * The return value is 1 if everything completed successfully
- * and 0 if an error occurred while querying information about
- * winPtr's parents. In this case winPtr is marked as no longer
- * being reparented.
+ * The return value is 1 if everything completed successfully and 0 if an
+ * error occurred while querying information about winPtr's parents. In
+ * this case winPtr is marked as no longer being reparented.
*
* Side effects:
- * Geometry information in wmPtr, wmPtr->winPtr, and
- * wmPtr->wrapperPtr gets updated.
+ * Geometry information in wmPtr, wmPtr->winPtr, and wmPtr->wrapperPtr
+ * gets updated.
*
*----------------------------------------------------------------------
*/
static int
-ComputeReparentGeometry(wmPtr)
- WmInfo *wmPtr; /* Information about toplevel window
- * whose reparent info is to be recomputed. */
+ComputeReparentGeometry(
+ WmInfo *wmPtr) /* Information about toplevel window whose
+ * reparent info is to be recomputed. */
{
TkWindow *wrapperPtr = wmPtr->wrapperPtr;
int width, height, bd;
- unsigned int dummy;
+ unsigned dummy;
int xOffset, yOffset, x, y;
Window dummy2;
Status status;
Tk_ErrorHandler handler;
TkDisplay *dispPtr = wmPtr->winPtr->dispPtr;
- handler = Tk_CreateErrorHandler(wrapperPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ handler = Tk_CreateErrorHandler(wrapperPtr->display, -1,-1,-1, NULL,NULL);
(void) XTranslateCoordinates(wrapperPtr->display, wrapperPtr->window,
wmPtr->reparent, 0, 0, &xOffset, &yOffset, &dummy2);
status = XGetGeometry(wrapperPtr->display, wmPtr->reparent,
- &dummy2, &x, &y, (unsigned int *) &width,
- (unsigned int *) &height, (unsigned int *) &bd, &dummy);
+ &dummy2, &x, &y, (unsigned *) &width, (unsigned *) &height,
+ (unsigned *) &bd, &dummy);
Tk_DeleteErrorHandler(handler);
if (status == 0) {
/*
- * It appears that the reparented parent went away and
- * no-one told us. Reset the window to indicate that
- * it's not reparented.
+ * It appears that the reparented parent went away and no-one told us.
+ * Reset the window to indicate that it's not reparented.
*/
+
wmPtr->reparent = None;
wmPtr->xInParent = wmPtr->yInParent = 0;
return 0;
@@ -3902,28 +4208,27 @@ ComputeReparentGeometry(wmPtr)
/*
* Some tricky issues in updating wmPtr->x and wmPtr->y:
*
- * 1. Don't update them if the event occurred because of something
- * we did (i.e. WM_SYNC_PENDING and WM_MOVE_PENDING are both set).
- * This is because window managers treat coords differently than Tk,
- * and no two window managers are alike. If the window manager moved
- * the window because we told it to, remember the coordinates we told
- * it, not the ones it actually moved it to. This allows us to move
- * the window back to the same coordinates later and get the same
- * result. Without this check, windows can "walk" across the screen
- * under some conditions.
+ * 1. Don't update them if the event occurred because of something we did
+ * (i.e. WM_SYNC_PENDING and WM_MOVE_PENDING are both set). This is
+ * because window managers treat coords differently than Tk, and no two
+ * window managers are alike. If the window manager moved the window
+ * because we told it to, remember the coordinates we told it, not the
+ * ones it actually moved it to. This allows us to move the window back to
+ * the same coordinates later and get the same result. Without this check,
+ * windows can "walk" across the screen under some conditions.
*
- * 2. Don't update wmPtr->x and wmPtr->y unless wrapperPtr->changes.x
- * or wrapperPtr->changes.y has changed (otherwise a size change can
- * spoof us into thinking that the position changed too and defeat
- * the intent of (1) above.
+ * 2. Don't update wmPtr->x and wmPtr->y unless wrapperPtr->changes.x or
+ * wrapperPtr->changes.y has changed (otherwise a size change can spoof us
+ * into thinking that the position changed too and defeat the intent of
+ * (1) above.
*
- * (As of 9/96 the above 2 comments appear to be stale. They're
- * being left in place as a reminder of what was once true (and
- * perhaps should still be true?)).
+ * (As of 9/96 the above 2 comments appear to be stale. They're being left
+ * in place as a reminder of what was once true (and perhaps should still
+ * be true?)).
*
- * 3. Ignore size changes coming from the window system if we're
- * about to change the size ourselves but haven't seen the event for
- * it yet: our size change is supposed to take priority.
+ * 3. Ignore size changes coming from the window system if we're about to
+ * change the size ourselves but haven't seen the event for it yet: our
+ * size change is supposed to take priority.
*/
if (!(wmPtr->flags & WM_MOVE_PENDING)
@@ -3953,27 +4258,71 @@ ComputeReparentGeometry(wmPtr)
/*
*----------------------------------------------------------------------
*
+ * PropertyEvent --
+ *
+ * Handle PropertyNotify events on wrapper windows. The following
+ * properties are of interest:
+ *
+ * _NET_WM_STATE:
+ * Used to keep wmPtr->attributes up to date.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+PropertyEvent(
+ WmInfo *wmPtr, /* Information about toplevel window. */
+ XPropertyEvent *eventPtr) /* PropertyNotify event structure */
+{
+ TkWindow *wrapperPtr = wmPtr->wrapperPtr;
+ Atom _NET_WM_STATE =
+ Tk_InternAtom((Tk_Window) wmPtr->winPtr, "_NET_WM_STATE");
+
+ if (eventPtr->atom == _NET_WM_STATE) {
+ Atom actualType;
+ int actualFormat;
+ unsigned long numItems, bytesAfter;
+ unsigned char *propertyValue = 0;
+ long maxLength = 1024;
+
+ if (XGetWindowProperty(
+ wrapperPtr->display, wrapperPtr->window, _NET_WM_STATE,
+ 0l, maxLength, False, XA_ATOM,
+ &actualType, &actualFormat, &numItems, &bytesAfter,
+ &propertyValue) == Success) {
+ CheckNetWmState(wmPtr, (Atom *) propertyValue, (int) numItems);
+ XFree(propertyValue);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* WrapperEventProc --
*
- * This procedure is invoked by the event loop when a wrapper window
- * is restructured.
+ * This function is invoked by the event loop when a wrapper window is
+ * restructured.
*
* Results:
* None.
*
* Side effects:
- * Tk's internal data structures for the window get modified to
- * reflect the structural change.
+ * Tk's internal data structures for the window get modified to reflect
+ * the structural change.
*
*----------------------------------------------------------------------
*/
+static const unsigned WrapperEventMask =
+ (StructureNotifyMask | PropertyChangeMask);
+
static void
-WrapperEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about toplevel window. */
- XEvent *eventPtr; /* Event that just happened. */
+WrapperEventProc(
+ ClientData clientData, /* Information about toplevel window. */
+ XEvent *eventPtr) /* Event that just happened. */
{
- WmInfo *wmPtr = (WmInfo *) clientData;
+ WmInfo *wmPtr = clientData;
XEvent mapEvent;
TkDisplay *dispPtr = wmPtr->winPtr->dispPtr;
@@ -3984,14 +4333,14 @@ WrapperEventProc(clientData, eventPtr)
if (!(wmPtr->wrapperPtr->flags & TK_ALREADY_DEAD)) {
/*
* A top-level window was deleted externally (e.g., by the window
- * manager). This is probably not a good thing, but cleanup as
- * best we can. The error handler is needed because
+ * manager). This is probably not a good thing, but cleanup as
+ * best we can. The error handler is needed because
* Tk_DestroyWindow will try to destroy the window, but of course
* it's already gone.
*/
handler = Tk_CreateErrorHandler(wmPtr->winPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ NULL, NULL);
Tk_DestroyWindow((Tk_Window) wmPtr->winPtr);
Tk_DeleteErrorHandler(handler);
}
@@ -4000,13 +4349,12 @@ WrapperEventProc(clientData, eventPtr)
}
} else if (eventPtr->type == ConfigureNotify) {
/*
- * Ignore the event if the window has never been mapped yet.
- * Such an event occurs only in weird cases like changing the
- * internal border width of a top-level window, which results
- * in a synthetic Configure event. These events are not relevant
- * to us, and if we process them confusion may result (e.g. we
- * may conclude erroneously that the user repositioned or resized
- * the window).
+ * Ignore the event if the window has never been mapped yet. Such an
+ * event occurs only in weird cases like changing the internal border
+ * width of a top-level window, which results in a synthetic Configure
+ * event. These events are not relevant to us, and if we process them
+ * confusion may result (e.g. we may conclude erroneously that the
+ * user repositioned or resized the window).
*/
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
@@ -4024,10 +4372,12 @@ WrapperEventProc(clientData, eventPtr)
goto doMapEvent;
} else if (eventPtr->type == ReparentNotify) {
ReparentEvent(wmPtr, &eventPtr->xreparent);
+ } else if (eventPtr->type == PropertyNotify) {
+ PropertyEvent(wmPtr, &eventPtr->xproperty);
}
return;
- doMapEvent:
+ doMapEvent:
mapEvent = *eventPtr;
mapEvent.xmap.event = wmPtr->winPtr->window;
mapEvent.xmap.window = wmPtr->winPtr->window;
@@ -4039,42 +4389,43 @@ WrapperEventProc(clientData, eventPtr)
*
* TopLevelReqProc --
*
- * This procedure is invoked by the geometry manager whenever
- * the requested size for a top-level window is changed.
+ * This function is invoked by the geometry manager whenever the
+ * requested size for a top-level window is changed.
*
* Results:
* None.
*
* Side effects:
- * Arrange for the window to be resized to satisfy the request
- * (this happens as a when-idle action).
+ * Arrange for the window to be resized to satisfy the request (this
+ * happens as a when-idle action).
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static void
-TopLevelReqProc(dummy, tkwin)
- ClientData dummy; /* Not used. */
- Tk_Window tkwin; /* Information about window. */
+TopLevelReqProc(
+ ClientData dummy, /* Not used. */
+ Tk_Window tkwin) /* Information about window. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
- WmInfo *wmPtr;
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
- wmPtr = winPtr->wmInfoPtr;
+ if (wmPtr == NULL) {
+ return;
+ }
if ((wmPtr->width >= 0) && (wmPtr->height >= 0)) {
/*
- * Explicit dimensions have been set for this window, so we
- * should ignore the geometry request. It's actually important
- * to ignore the geometry request because, due to quirks in
- * window managers, invoking UpdateGeometryInfo may cause the
- * window to move. For example, if "wm geometry -10-20" was
- * invoked, the window may be positioned incorrectly the first
- * time it appears (because we didn't know the proper width of
- * the window manager borders); if we invoke UpdateGeometryInfo
- * again, the window will be positioned correctly, which may
- * cause it to jump on the screen.
+ * Explicit dimensions have been set for this window, so we should
+ * ignore the geometry request. It's actually important to ignore the
+ * geometry request because, due to quirks in window managers,
+ * invoking UpdateGeometryInfo may cause the window to move. For
+ * example, if "wm geometry -10-20" was invoked, the window may be
+ * positioned incorrectly the first time it appears (because we didn't
+ * know the proper width of the window manager borders); if we invoke
+ * UpdateGeometryInfo again, the window will be positioned correctly,
+ * which may cause it to jump on the screen.
*/
return;
@@ -4082,13 +4433,13 @@ TopLevelReqProc(dummy, tkwin)
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
/*
- * If the window isn't being positioned by its upper left corner
- * then we have to move it as well.
+ * If the window isn't being positioned by its upper left corner then we
+ * have to move it as well.
*/
if (wmPtr->flags & (WM_NEGATIVE_X | WM_NEGATIVE_Y)) {
@@ -4101,28 +4452,27 @@ TopLevelReqProc(dummy, tkwin)
*
* UpdateGeometryInfo --
*
- * This procedure is invoked when a top-level window is first
- * mapped, and also as a when-idle procedure, to bring the
- * geometry and/or position of a top-level window back into
- * line with what has been requested by the user and/or widgets.
- * This procedure doesn't return until the window manager has
- * responded to the geometry change.
+ * This function is invoked when a top-level window is first mapped, and
+ * also as a when-idle function, to bring the geometry and/or position of
+ * a top-level window back into line with what has been requested by the
+ * user and/or widgets. This function doesn't return until the window
+ * manager has responded to the geometry change.
*
* Results:
* None.
*
* Side effects:
- * The size and location of both the toplevel window and its wrapper
- * may change, unless the WM prevents that from happening.
+ * The size and location of both the toplevel window and its wrapper may
+ * change, unless the WM prevents that from happening.
*
*----------------------------------------------------------------------
*/
static void
-UpdateGeometryInfo(clientData)
- ClientData clientData; /* Pointer to the window's record. */
+UpdateGeometryInfo(
+ ClientData clientData) /* Pointer to the window's record. */
{
- register TkWindow *winPtr = (TkWindow *) clientData;
+ register TkWindow *winPtr = clientData;
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int x, y, width, height, min, max;
unsigned long serial;
@@ -4130,15 +4480,13 @@ UpdateGeometryInfo(clientData)
wmPtr->flags &= ~WM_UPDATE_PENDING;
/*
- * Compute the new size for the top-level window. See the
- * user documentation for details on this, but the size
- * requested depends on (a) the size requested internally
- * by the window's widgets, (b) the size requested by the
- * user in a "wm geometry" command or via wm-based interactive
- * resizing (if any), (c) whether or not the window is
- * gridded, and (d) the current min or max size for
- * the toplevel. Don't permit sizes <= 0 because this
- * upsets the X server.
+ * Compute the new size for the top-level window. See the user
+ * documentation for details on this, but the size requested depends on
+ * (a) the size requested internally by the window's widgets, (b) the size
+ * requested by the user in a "wm geometry" command or via wm-based
+ * interactive resizing (if any), (c) whether or not the window is
+ * gridded, and (d) the current min or max size for the toplevel. Don't
+ * permit sizes <= 0 because this upsets the X server.
*/
if (wmPtr->width == -1) {
@@ -4152,9 +4500,11 @@ UpdateGeometryInfo(clientData)
if (width <= 0) {
width = 1;
}
+
/*
* Account for window max/min width
*/
+
if (wmPtr->gridWin != NULL) {
min = winPtr->reqWidth
+ (wmPtr->minWidth - wmPtr->reqGridWidth)*wmPtr->widthInc;
@@ -4185,9 +4535,11 @@ UpdateGeometryInfo(clientData)
if (height <= 0) {
height = 1;
}
+
/*
* Account for window max/min height
*/
+
if (wmPtr->gridWin != NULL) {
min = winPtr->reqHeight
+ (wmPtr->minHeight - wmPtr->reqGridHeight)*wmPtr->heightInc;
@@ -4209,30 +4561,30 @@ UpdateGeometryInfo(clientData)
/*
* Compute the new position for the upper-left pixel of the window's
- * decorative frame. This is tricky, because we need to include the
- * border widths supplied by a reparented parent in this calculation,
- * but can't use the parent's current overall size since that may
- * change as a result of this code.
+ * decorative frame. This is tricky, because we need to include the border
+ * widths supplied by a reparented parent in this calculation, but can't
+ * use the parent's current overall size since that may change as a result
+ * of this code.
*/
if (wmPtr->flags & WM_NEGATIVE_X) {
x = wmPtr->vRootWidth - wmPtr->x
- (width + (wmPtr->parentWidth - winPtr->changes.width));
} else {
- x = wmPtr->x;
+ x = wmPtr->x;
}
if (wmPtr->flags & WM_NEGATIVE_Y) {
y = wmPtr->vRootHeight - wmPtr->y
- (height + (wmPtr->parentHeight - winPtr->changes.height));
} else {
- y = wmPtr->y;
+ y = wmPtr->y;
}
/*
- * If the window's size is going to change and the window is
- * supposed to not be resizable by the user, then we have to
- * update the size hints. There may also be a size-hint-update
- * request pending from somewhere else, too.
+ * If the window's size is going to change and the window is supposed to
+ * not be resizable by the user, then we have to update the size hints.
+ * There may also be a size-hint-update request pending from somewhere
+ * else, too.
*/
if (((width != winPtr->changes.width)
@@ -4246,58 +4598,57 @@ UpdateGeometryInfo(clientData)
}
/*
- * Reconfigure the wrapper if it isn't already configured correctly.
- * A few tricky points:
+ * Reconfigure the wrapper if it isn't already configured correctly. A few
+ * tricky points:
*
- * 1. If the window is embeddedand the container is also in this
- * process, don't actually reconfigure the window; just pass the
- * desired size on to the container. Also, zero out any position
- * information, since embedded windows are not allowed to move.
- * 2. Sometimes the window manager will give us a different size
- * than we asked for (e.g. mwm has a minimum size for windows), so
- * base the size check on what we *asked for* last time, not what we
- * got.
+ * 1. If the window is embedded and the container is also in this process,
+ * don't actually reconfigure the window; just pass the desired size on
+ * to the container. Also, zero out any position information, since
+ * embedded windows are not allowed to move.
+ * 2. Sometimes the window manager will give us a different size than we
+ * asked for (e.g. mwm has a minimum size for windows), so base the
+ * size check on what we *asked for* last time, not what we got.
* 3. Can't just reconfigure always, because we may not get a
* ConfigureNotify event back if nothing changed, so
* WaitForConfigureNotify will hang a long time.
- * 4. Don't move window unless a new position has been requested for
- * it. This is because of "features" in some window managers (e.g.
- * twm, as of 4/24/91) where they don't interpret coordinates
- * according to ICCCM. Moving a window to its current location may
- * cause it to shift position on the screen.
+ * 4. Don't move window unless a new position has been requested for it.
+ * This is because of "features" in some window managers (e.g. twm, as
+ * of 4/24/91) where they don't interpret coordinates according to
+ * ICCCM. Moving a window to its current location may cause it to shift
+ * position on the screen.
*/
if ((winPtr->flags & (TK_EMBEDDED|TK_BOTH_HALVES))
== (TK_EMBEDDED|TK_BOTH_HALVES)) {
TkWindow *childPtr = TkpGetOtherWindow(winPtr);
+
/*
- * This window is embedded and the container is also in this
- * process, so we don't need to do anything special about the
- * geometry, except to make sure that the desired size is known
- * by the container. Also, zero out any position information,
- * since embedded windows are not allowed to move.
+ * This window is embedded and the container is also in this process,
+ * so we don't need to do anything special about the geometry, except
+ * to make sure that the desired size is known by the container. Also,
+ * zero out any position information, since embedded windows are not
+ * allowed to move.
*/
wmPtr->x = wmPtr->y = 0;
wmPtr->flags &= ~(WM_NEGATIVE_X|WM_NEGATIVE_Y);
+ height += wmPtr->menuHeight;
if (childPtr != NULL) {
- height += wmPtr->menuHeight;
Tk_GeometryRequest((Tk_Window) childPtr, width, height);
}
return;
}
-
serial = NextRequest(winPtr->display);
height += wmPtr->menuHeight;
if (wmPtr->flags & WM_MOVE_PENDING) {
if ((x + wmPtr->xInParent == winPtr->changes.x) &&
- (y + wmPtr->yInParent + wmPtr->menuHeight == winPtr->changes.y)
+ (y+wmPtr->yInParent+wmPtr->menuHeight == winPtr->changes.y)
&& (width == wmPtr->wrapperPtr->changes.width)
&& (height == wmPtr->wrapperPtr->changes.height)) {
/*
- * The window already has the correct geometry, so don't bother
- * to configure it; the X server appears to ignore these
- * requests, so we won't get back a ConfigureNotify and the
+ * The window already has the correct geometry, so don't bother to
+ * configure it; the X server appears to ignore these requests, so
+ * we won't get back a ConfigureNotify and the
* WaitForConfigureNotify call below will hang for a while.
*/
@@ -4307,8 +4658,8 @@ UpdateGeometryInfo(clientData)
wmPtr->configWidth = width;
wmPtr->configHeight = height;
if (winPtr->dispPtr->flags & TK_DISPLAY_WM_TRACING) {
- printf("UpdateGeometryInfo moving to %d %d, resizing to %d x %d,\n",
- x, y, width, height);
+ printf("UpdateGeometryInfo moving to %d %d, resizing to %dx%d,\n",
+ x, y, width, height);
}
XMoveResizeWindow(winPtr->display, wmPtr->wrapperPtr->window, x, y,
(unsigned) width, (unsigned) height);
@@ -4317,9 +4668,9 @@ UpdateGeometryInfo(clientData)
if ((width == wmPtr->wrapperPtr->changes.width)
&& (height == wmPtr->wrapperPtr->changes.height)) {
/*
- * The window is already just the size we want, so don't bother
- * to configure it; the X server appears to ignore these
- * requests, so we won't get back a ConfigureNotify and the
+ * The window is already just the size we want, so don't bother to
+ * configure it; the X server appears to ignore these requests, so
+ * we won't get back a ConfigureNotify and the
* WaitForConfigureNotify call below will hang for a while.
*/
@@ -4329,7 +4680,7 @@ UpdateGeometryInfo(clientData)
wmPtr->configHeight = height;
if (winPtr->dispPtr->flags & TK_DISPLAY_WM_TRACING) {
printf("UpdateGeometryInfo resizing %p to %d x %d\n",
- (void *)wmPtr->wrapperPtr->window, width, height);
+ (void *) wmPtr->wrapperPtr->window, width, height);
}
XResizeWindow(winPtr->display, wmPtr->wrapperPtr->window,
(unsigned) width, (unsigned) height);
@@ -4337,8 +4688,8 @@ UpdateGeometryInfo(clientData)
&& ((Tk_Width(wmPtr->menubar) != wmPtr->wrapperPtr->changes.width)
|| (Tk_Height(wmPtr->menubar) != wmPtr->menuHeight))) {
/*
- * It is possible that the window's overall size has not changed
- * but the menu size has.
+ * It is possible that the window's overall size has not changed but
+ * the menu size has.
*/
Tk_MoveResizeWindow(wmPtr->menubar, 0, 0,
@@ -4350,9 +4701,9 @@ UpdateGeometryInfo(clientData)
}
/*
- * Wait for the configure operation to complete. Don't need to do
- * this, however, if the window is about to be mapped: it will be
- * taken care of elsewhere.
+ * Wait for the configure operation to complete. Don't need to do this,
+ * however, if the window is about to be mapped: it will be taken care of
+ * elsewhere.
*/
if (!(wmPtr->flags & WM_ABOUT_TO_MAP)) {
@@ -4365,9 +4716,8 @@ UpdateGeometryInfo(clientData)
*
* UpdateSizeHints --
*
- * This procedure is called to update the window manager's
- * size hints information from the information in a WmInfo
- * structure.
+ * This function is called to update the window manager's size hints
+ * information from the information in a WmInfo structure.
*
* Results:
* None.
@@ -4379,10 +4729,10 @@ UpdateGeometryInfo(clientData)
*/
static void
-UpdateSizeHints(winPtr, newWidth, newHeight)
- TkWindow *winPtr;
- int newWidth;
- int newHeight;
+UpdateSizeHints(
+ TkWindow *winPtr,
+ int newWidth,
+ int newHeight)
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
XSizeHints *hintsPtr;
@@ -4396,9 +4746,8 @@ UpdateSizeHints(winPtr, newWidth, newHeight)
}
/*
- * Compute the pixel-based sizes for the various fields in the
- * size hints structure, based on the grid-based sizes in
- * our structure.
+ * Compute the pixel-based sizes for the various fields in the size hints
+ * structure, based on the grid-based sizes in our structure.
*/
GetMaxSize(wmPtr, &maxWidth, &maxHeight);
@@ -4439,18 +4788,18 @@ UpdateSizeHints(winPtr, newWidth, newHeight)
hintsPtr->flags = wmPtr->sizeHintsFlags | PMinSize;
/*
- * If the window isn't supposed to be resizable, then set the
- * minimum and maximum dimensions to be the same.
+ * If the window isn't supposed to be resizable, then set the minimum and
+ * maximum dimensions to be the same.
*/
if (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) {
hintsPtr->max_width = hintsPtr->min_width = newWidth;
- hintsPtr->flags |= PMaxSize;
+ hintsPtr->flags |= PMaxSize;
}
if (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) {
hintsPtr->max_height = hintsPtr->min_height =
- newHeight + wmPtr->menuHeight;
- hintsPtr->flags |= PMaxSize;
+ newHeight + wmPtr->menuHeight;
+ hintsPtr->flags |= PMaxSize;
}
XSetWMNormalHints(winPtr->display, wmPtr->wrapperPtr->window, hintsPtr);
@@ -4463,27 +4812,26 @@ UpdateSizeHints(winPtr, newWidth, newHeight)
*
* UpdateTitle --
*
- * This procedure is called to update the window title and
- * icon name. It sets the ICCCM-defined properties WM_NAME
- * and WM_ICON_NAME for older window managers, and the
- * freedesktop.org-defined _NET_WM_NAME and _NET_WM_ICON_NAME
- * properties for newer ones. The ICCCM properties are
- * stored in the system encoding, the newer properties
- * are stored in UTF-8.
+ * This function is called to update the window title and icon name. It
+ * sets the ICCCM-defined properties WM_NAME and WM_ICON_NAME for older
+ * window managers, and the freedesktop.org-defined _NET_WM_NAME and
+ * _NET_WM_ICON_NAME properties for newer ones. The ICCCM properties are
+ * stored in the system encoding, the newer properties are stored in
+ * UTF-8.
*
- * NOTE: the ICCCM specifies that WM_NAME and WM_ICON_NAME are
- * stored in ISO-Latin-1. Tk has historically used the default
- * system encoding (since 8.1). It's not clear whether this is
- * correct or not.
+ * NOTE: the ICCCM specifies that WM_NAME and WM_ICON_NAME are stored in
+ * ISO-Latin-1. Tk has historically used the default system encoding
+ * (since 8.1). It's not clear whether this is correct or not.
*
* Side effects:
* Properties get changed for winPtr.
*
*--------------------------------------------------------------
*/
+
static void
-UpdateTitle(winPtr)
- TkWindow *winPtr;
+UpdateTitle(
+ TkWindow *winPtr)
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
Atom XA_UTF8_STRING = Tk_InternAtom((Tk_Window) winPtr, "UTF8_STRING");
@@ -4493,6 +4841,7 @@ UpdateTitle(winPtr)
/*
* Set window title:
*/
+
string = (wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid;
Tcl_UtfToExternalDString(NULL, string, -1, &ds);
XStoreName(winPtr->display, wmPtr->wrapperPtr->window,
@@ -4501,12 +4850,13 @@ UpdateTitle(winPtr)
XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window,
Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_NAME"),
- XA_UTF8_STRING, 8, PropModeReplace,
- (const unsigned char*)string, (signed int)strlen(string));
+ XA_UTF8_STRING, 8, PropModeReplace,
+ (const unsigned char *) string, (signed int) strlen(string));
/*
* Set icon name:
*/
+
if (wmPtr->iconName != NULL) {
Tcl_UtfToExternalDString(NULL, wmPtr->iconName, -1, &ds);
XSetIconName(winPtr->display, wmPtr->wrapperPtr->window,
@@ -4516,8 +4866,8 @@ UpdateTitle(winPtr)
XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window,
Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_ICON_NAME"),
XA_UTF8_STRING, 8, PropModeReplace,
- (const unsigned char*)wmPtr->iconName,
- (signed int)strlen(wmPtr->iconName));
+ (const unsigned char *) wmPtr->iconName,
+ (signed int) strlen(wmPtr->iconName));
}
}
@@ -4526,17 +4876,18 @@ UpdateTitle(winPtr)
*
* UpdatePhotoIcon --
*
- * This procedure is called to update the window ohoto icon.
- * It sets the EWMH-defined properties _NET_WM_ICON.
+ * This function is called to update the window photo icon. It sets the
+ * EWMH-defined properties _NET_WM_ICON.
*
* Side effects:
* Properties get changed for winPtr.
*
*--------------------------------------------------------------
*/
+
static void
-UpdatePhotoIcon(winPtr)
- TkWindow *winPtr;
+UpdatePhotoIcon(
+ TkWindow *winPtr)
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
unsigned char *data = wmPtr->iconDataPtr;
@@ -4550,6 +4901,7 @@ UpdatePhotoIcon(winPtr)
/*
* Set icon:
*/
+
XChangeProperty(winPtr->display, wmPtr->wrapperPtr->window,
Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_ICON"),
XA_CARDINAL, 32, PropModeReplace,
@@ -4560,50 +4912,191 @@ UpdatePhotoIcon(winPtr)
/*
*----------------------------------------------------------------------
*
+ * SetNetWmState --
+ *
+ * Sets the specified state property by sending a _NET_WM_STATE
+ * ClientMessage to the root window.
+ *
+ * Preconditions:
+ * Wrapper window must be created.
+ *
+ * See also:
+ * UpdateNetWmState; EWMH spec, section _NET_WM_STATE.
+ *
+ *----------------------------------------------------------------------
+ */
+
+#define _NET_WM_STATE_REMOVE 0l
+#define _NET_WM_STATE_ADD 1l
+#define _NET_WM_STATE_TOGGLE 2l
+
+static void
+SetNetWmState(
+ TkWindow *winPtr,
+ const char *atomName,
+ int on)
+{
+ Tk_Window tkwin = (Tk_Window) winPtr;
+ Atom messageType = Tk_InternAtom(tkwin, "_NET_WM_STATE");
+ Atom action = on ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
+ Atom property = Tk_InternAtom(tkwin, atomName);
+ XEvent e;
+
+ if (!winPtr->wmInfoPtr->wrapperPtr) {
+ return;
+ }
+
+ e.xany.type = ClientMessage;
+ e.xany.window = winPtr->wmInfoPtr->wrapperPtr->window;
+ e.xclient.message_type = messageType;
+ e.xclient.format = 32;
+ e.xclient.data.l[0] = action;
+ e.xclient.data.l[1] = property;
+ e.xclient.data.l[2] = e.xclient.data.l[3] = e.xclient.data.l[4] = 0l;
+
+ XSendEvent(winPtr->display,
+ RootWindow(winPtr->display, winPtr->screenNum), 0,
+ SubstructureNotifyMask|SubstructureRedirectMask, &e);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CheckNetWmState --
+ *
+ * Updates the window attributes whenever the _NET_WM_STATE property
+ * changes.
+ *
+ * Notes:
+ *
+ * Tk uses a single -zoomed state, while the EWMH spec supports separate
+ * vertical and horizontal maximization. We consider the window to be
+ * "zoomed" if _NET_WM_STATE_MAXIMIZED_VERT and
+ * _NET_WM_STATE_MAXIMIZED_HORZ are both set.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+CheckNetWmState(
+ WmInfo *wmPtr,
+ Atom *atoms,
+ int numAtoms)
+{
+ Tk_Window tkwin = (Tk_Window) wmPtr->wrapperPtr;
+ int i;
+ Atom _NET_WM_STATE_ABOVE
+ = Tk_InternAtom(tkwin, "_NET_WM_STATE_ABOVE"),
+ _NET_WM_STATE_MAXIMIZED_VERT
+ = Tk_InternAtom(tkwin, "_NET_WM_STATE_MAXIMIZED_VERT"),
+ _NET_WM_STATE_MAXIMIZED_HORZ
+ = Tk_InternAtom(tkwin, "_NET_WM_STATE_MAXIMIZED_HORZ"),
+ _NET_WM_STATE_FULLSCREEN
+ = Tk_InternAtom(tkwin, "_NET_WM_STATE_FULLSCREEN");
+
+ wmPtr->attributes.topmost = 0;
+ wmPtr->attributes.zoomed = 0;
+ wmPtr->attributes.fullscreen = 0;
+ for (i = 0; i < numAtoms; ++i) {
+ if (atoms[i] == _NET_WM_STATE_ABOVE) {
+ wmPtr->attributes.topmost = 1;
+ } else if (atoms[i] == _NET_WM_STATE_MAXIMIZED_VERT) {
+ wmPtr->attributes.zoomed |= 1;
+ } else if (atoms[i] == _NET_WM_STATE_MAXIMIZED_HORZ) {
+ wmPtr->attributes.zoomed |= 2;
+ } else if (atoms[i] == _NET_WM_STATE_FULLSCREEN) {
+ wmPtr->attributes.fullscreen = 1;
+ }
+ }
+
+ wmPtr->attributes.zoomed = (wmPtr->attributes.zoomed == 3);
+
+ return;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * UpdateNetWmState --
+ *
+ * Sets the _NET_WM_STATE property to match the requested attribute state
+ * just prior to mapping a withdrawn window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+#define NET_WM_STATE_MAX_ATOMS 4
+
+static void
+UpdateNetWmState(
+ WmInfo *wmPtr)
+{
+ Tk_Window tkwin = (Tk_Window) wmPtr->wrapperPtr;
+ Atom atoms[NET_WM_STATE_MAX_ATOMS];
+ long numAtoms = 0;
+
+ if (wmPtr->reqState.topmost) {
+ atoms[numAtoms++] = Tk_InternAtom(tkwin,"_NET_WM_STATE_ABOVE");
+ }
+ if (wmPtr->reqState.zoomed) {
+ atoms[numAtoms++] = Tk_InternAtom(tkwin,"_NET_WM_STATE_MAXIMIZED_VERT");
+ atoms[numAtoms++] = Tk_InternAtom(tkwin,"_NET_WM_STATE_MAXIMIZED_HORZ");
+ }
+ if (wmPtr->reqState.fullscreen) {
+ atoms[numAtoms++] = Tk_InternAtom(tkwin, "_NET_WM_STATE_FULLSCREEN");
+ }
+
+ XChangeProperty(Tk_Display(tkwin), wmPtr->wrapperPtr->window,
+ Tk_InternAtom(tkwin, "_NET_WM_STATE"), XA_ATOM, 32,
+ PropModeReplace, (unsigned char *) atoms, numAtoms);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* WaitForConfigureNotify --
*
- * This procedure is invoked in order to synchronize with the
- * window manager. It waits for a ConfigureNotify event to
- * arrive, signalling that the window manager has seen an attempt
- * on our part to move or resize a top-level window.
+ * This function is invoked in order to synchronize with the window
+ * manager. It waits for a ConfigureNotify event to arrive, signalling
+ * that the window manager has seen an attempt on our part to move or
+ * resize a top-level window.
*
* Results:
* None.
*
* Side effects:
* Delays the execution of the process until a ConfigureNotify event
- * arrives with serial number at least as great as serial. This
- * is useful for two reasons:
+ * arrives with serial number at least as great as serial. This is useful
+ * for two reasons:
*
* 1. It's important to distinguish ConfigureNotify events that are
* coming in response to a request we've made from those generated
- * spontaneously by the user. The reason for this is that if the
- * user resizes the window we take that as an order to ignore
- * geometry requests coming from inside the window hierarchy. If
- * we accidentally interpret a response to our request as a
- * user-initiated action, the window will stop responding to
- * new geometry requests. To make this distinction, (a) this
- * procedure sets a flag for TopLevelEventProc to indicate that
- * we're waiting to sync with the wm, and (b) all changes to
- * the size of a top-level window are followed by calls to this
- * procedure.
- * 2. Races and confusion can come about if there are multiple
- * operations outstanding at a time (e.g. two different resizes
- * of the top-level window: it's hard to tell which of the
- * ConfigureNotify events coming back is for which request).
+ * spontaneously by the user. The reason for this is that if the user
+ * resizes the window we take that as an order to ignore geometry
+ * requests coming from inside the window hierarchy. If we
+ * accidentally interpret a response to our request as a user-
+ * initiated action, the window will stop responding to new geometry
+ * requests. To make this distinction, (a) this function sets a flag
+ * for TopLevelEventProc to indicate that we're waiting to sync with
+ * the wm, and (b) all changes to the size of a top-level window are
+ * followed by calls to this function.
+ * 2. Races and confusion can come about if there are multiple operations
+ * outstanding at a time (e.g. two different resizes of the top-level
+ * window: it's hard to tell which of the ConfigureNotify events
+ * coming back is for which request).
* While waiting, some events covered by StructureNotifyMask are
- * processed (ConfigureNotify, MapNotify, and UnmapNotify)
- * and all others are deferred.
+ * processed (ConfigureNotify, MapNotify, and UnmapNotify) and all others
+ * are deferred.
*
*----------------------------------------------------------------------
*/
static void
-WaitForConfigureNotify(winPtr, serial)
- TkWindow *winPtr; /* Top-level window for which we want
- * to see a ConfigureNotify. */
- unsigned long serial; /* Serial number of resize request. Want to
- * be sure wm has seen this. */
+WaitForConfigureNotify(
+ TkWindow *winPtr, /* Top-level window for which we want to see a
+ * ConfigureNotify. */
+ unsigned long serial) /* Serial number of resize request. Want to be
+ * sure wm has seen this. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
XEvent event;
@@ -4611,11 +5104,10 @@ WaitForConfigureNotify(winPtr, serial)
int gotConfig = 0;
/*
- * One more tricky detail about this procedure. In some cases the
- * window manager will decide to ignore a configure request (e.g.
- * because it thinks the window is already in the right place).
- * To avoid hanging in this situation, only wait for a few seconds,
- * then give up.
+ * One more tricky detail about this function. In some cases the window
+ * manager will decide to ignore a configure request (e.g. because it
+ * thinks the window is already in the right place). To avoid hanging in
+ * this situation, only wait for a few seconds, then give up.
*/
while (!gotConfig) {
@@ -4646,42 +5138,41 @@ WaitForConfigureNotify(winPtr, serial)
*
* WaitForEvent --
*
- * This procedure is used by WaitForConfigureNotify and
- * WaitForMapNotify to wait for an event of a certain type
- * to arrive.
+ * This function is used by WaitForConfigureNotify and WaitForMapNotify
+ * to wait for an event of a certain type to arrive.
*
* Results:
- * Under normal conditions, TCL_OK is returned and an event for
- * display and window that matches "mask" is stored in *eventPtr.
- * This event has already been processed by Tk before this procedure
- * returns. If a long time goes by with no event of the right type
- * arriving, or if an error occurs while waiting for the event to
- * arrive, then TCL_ERROR is returned.
+ * Under normal conditions, TCL_OK is returned and an event for display
+ * and window that matches "mask" is stored in *eventPtr. This event has
+ * already been processed by Tk before this function returns. If a long
+ * time goes by with no event of the right type arriving, or if an error
+ * occurs while waiting for the event to arrive, then TCL_ERROR is
+ * returned.
*
* Side effects:
* While waiting for the desired event to occur, Configurenotify,
- * MapNotify, and UnmapNotify events for window are processed,
- * as are all ReparentNotify events.
+ * MapNotify, and UnmapNotify events for window are processed, as are all
+ * ReparentNotify events.
*
*----------------------------------------------------------------------
*/
static int
-WaitForEvent(display, wmInfoPtr, type, eventPtr)
- Display *display; /* Display event is coming from. */
- WmInfo *wmInfoPtr; /* Window for which event is desired. */
- int type; /* Type of event that is wanted. */
- XEvent *eventPtr; /* Place to store event. */
+WaitForEvent(
+ Display *display, /* Display event is coming from. */
+ WmInfo *wmInfoPtr, /* Window for which event is desired. */
+ int type, /* Type of event that is wanted. */
+ XEvent *eventPtr) /* Place to store event. */
{
WaitRestrictInfo info;
- Tk_RestrictProc *oldRestrictProc;
- ClientData oldRestrictData;
+ Tk_RestrictProc *prevProc;
+ ClientData prevArg;
Tcl_Time timeout;
/*
- * Set up an event filter to select just the events we want, and
- * a timer handler, then wait for events until we get the event
- * we want or a timeout happens.
+ * Set up an event filter to select just the events we want, and a timer
+ * handler, then wait for events until we get the event we want or a
+ * timeout happens.
*/
info.display = display;
@@ -4689,8 +5180,7 @@ WaitForEvent(display, wmInfoPtr, type, eventPtr)
info.type = type;
info.eventPtr = eventPtr;
info.foundEvent = 0;
- oldRestrictProc = Tk_RestrictEvents(WaitRestrictProc, (ClientData) &info,
- &oldRestrictData);
+ prevProc = Tk_RestrictEvents(WaitRestrictProc, &info, &prevArg);
Tcl_GetTime(&timeout);
timeout.sec += 2;
@@ -4700,8 +5190,7 @@ WaitForEvent(display, wmInfoPtr, type, eventPtr)
break;
}
}
- (void) Tk_RestrictEvents(oldRestrictProc, oldRestrictData,
- &oldRestrictData);
+ Tk_RestrictEvents(prevProc, prevArg, &prevArg);
if (info.foundEvent) {
return TCL_OK;
}
@@ -4713,28 +5202,28 @@ WaitForEvent(display, wmInfoPtr, type, eventPtr)
*
* WaitRestrictProc --
*
- * This procedure is a Tk_RestrictProc that is used to filter
- * events while WaitForEvent is active.
+ * This function is a Tk_RestrictProc that is used to filter events while
+ * WaitForEvent is active.
*
* Results:
- * Returns TK_PROCESS_EVENT if the right event is found. Also
- * returns TK_PROCESS_EVENT if any ReparentNotify event is found
- * or if the event is a ConfigureNotify, MapNotify, or UnmapNotify
- * for window. Otherwise returns TK_DEFER_EVENT.
+ * Returns TK_PROCESS_EVENT if the right event is found. Also returns
+ * TK_PROCESS_EVENT if any ReparentNotify event is found or if the event
+ * is a ConfigureNotify, MapNotify, or UnmapNotify for window. Otherwise
+ * returns TK_DEFER_EVENT.
*
* Side effects:
- * An event may get stored in the area indicated by the caller
- * of WaitForEvent.
+ * An event may get stored in the area indicated by the caller of
+ * WaitForEvent.
*
*----------------------------------------------------------------------
*/
static Tk_RestrictAction
-WaitRestrictProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to WaitRestrictInfo structure. */
- XEvent *eventPtr; /* Event that is about to be handled. */
+WaitRestrictProc(
+ ClientData clientData, /* Pointer to WaitRestrictInfo structure. */
+ XEvent *eventPtr) /* Event that is about to be handled. */
{
- WaitRestrictInfo *infoPtr = (WaitRestrictInfo *) clientData;
+ WaitRestrictInfo *infoPtr = clientData;
if (eventPtr->type == ReparentNotify) {
return TK_PROCESS_EVENT;
@@ -4749,9 +5238,8 @@ WaitRestrictProc(clientData, eventPtr)
infoPtr->foundEvent = 1;
return TK_PROCESS_EVENT;
}
- if (eventPtr->type == ConfigureNotify
- || eventPtr->type == MapNotify
- || eventPtr->type == UnmapNotify) {
+ if (eventPtr->type == ConfigureNotify || eventPtr->type == MapNotify
+ || eventPtr->type == UnmapNotify) {
return TK_PROCESS_EVENT;
}
return TK_DEFER_EVENT;
@@ -4762,32 +5250,31 @@ WaitRestrictProc(clientData, eventPtr)
*
* WaitForMapNotify --
*
- * This procedure is invoked in order to synchronize with the
- * window manager. It waits for the window's mapped state to
- * reach the value given by mapped.
+ * This function is invoked in order to synchronize with the window
+ * manager. It waits for the window's mapped state to reach the value
+ * given by mapped.
*
* Results:
* None.
*
* Side effects:
- * Delays the execution of the process until winPtr becomes mapped
- * or unmapped, depending on the "mapped" argument. This allows us
- * to synchronize with the window manager, and allows us to
- * identify changes in window size that come about when the window
- * manager first starts managing the window (as opposed to those
- * requested interactively by the user later). See the comments
- * for WaitForConfigureNotify and WM_SYNC_PENDING. While waiting,
- * some events covered by StructureNotifyMask are processed and all
- * others are deferred.
+ * Delays the execution of the process until winPtr becomes mapped or
+ * unmapped, depending on the "mapped" argument. This allows us to
+ * synchronize with the window manager, and allows us to identify changes
+ * in window size that come about when the window manager first starts
+ * managing the window (as opposed to those requested interactively by
+ * the user later). See the comments for WaitForConfigureNotify and
+ * WM_SYNC_PENDING. While waiting, some events covered by
+ * StructureNotifyMask are processed and all others are deferred.
*
*----------------------------------------------------------------------
*/
static void
-WaitForMapNotify(winPtr, mapped)
- TkWindow *winPtr; /* Top-level window for which we want
- * to see a particular mapping state. */
- int mapped; /* If non-zero, wait for window to become
+WaitForMapNotify(
+ TkWindow *winPtr, /* Top-level window for which we want to see a
+ * particular mapping state. */
+ int mapped) /* If non-zero, wait for window to become
* mapped, otherwise wait for it to become
* unmapped. */
{
@@ -4809,10 +5296,9 @@ WaitForMapNotify(winPtr, mapped)
wmPtr->flags &= ~WM_SYNC_PENDING;
if (code != TCL_OK) {
/*
- * There are some bizarre situations in which the window
- * manager can't respond or chooses not to (e.g. if we've
- * got a grab set it can't respond). If this happens then
- * just quit.
+ * There are some bizarre situations in which the window manager
+ * can't respond or chooses not to (e.g. if we've got a grab set
+ * it can't respond). If this happens then just quit.
*/
if (winPtr->dispPtr->flags & TK_DISPLAY_WM_TRACING) {
@@ -4833,9 +5319,8 @@ WaitForMapNotify(winPtr, mapped)
*
* UpdateHints --
*
- * This procedure is called to update the window manager's
- * hints information from the information in a WmInfo
- * structure.
+ * This function is called to update the window manager's hints
+ * information from the information in a WmInfo structure.
*
* Results:
* None.
@@ -4847,8 +5332,8 @@ WaitForMapNotify(winPtr, mapped)
*/
static void
-UpdateHints(winPtr)
- TkWindow *winPtr;
+UpdateHints(
+ TkWindow *winPtr)
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -4874,9 +5359,7 @@ UpdateHints(winPtr)
*/
static int
-SetNetWmType(winPtr, typePtr)
- TkWindow *winPtr;
- Tcl_Obj *typePtr;
+SetNetWmType(TkWindow *winPtr, Tcl_Obj *typePtr)
{
Atom typeAtom, *atoms = NULL;
WmInfo *wmPtr;
@@ -4884,7 +5367,7 @@ SetNetWmType(winPtr, typePtr)
Tcl_Obj **objv;
int objc, n;
Tk_Window tkwin = (Tk_Window)winPtr;
- Tcl_Interp *interp = winPtr->mainPtr->interp;
+ Tcl_Interp *interp = Tk_Interp(tkwin);
if (TCL_OK != Tcl_ListObjGetElements(interp, typePtr, &objc, &objv)) {
return TCL_ERROR;
@@ -4895,13 +5378,14 @@ SetNetWmType(winPtr, typePtr)
}
if (objc > 0) {
- atoms = (Atom *)ckalloc(sizeof(Atom) * objc);
+ atoms = ckalloc(sizeof(Atom) * objc);
}
for (n = 0; n < objc; ++n) {
Tcl_DString ds, dsName;
int len;
char *name = Tcl_GetStringFromObj(objv[n], &len);
+
Tcl_UtfToUpper(name);
Tcl_UtfToExternalDString(NULL, name, len, &dsName);
Tcl_DStringInit(&ds);
@@ -4923,7 +5407,7 @@ SetNetWmType(winPtr, typePtr)
XChangeProperty(Tk_Display(tkwin), wrapperPtr->window, typeAtom,
XA_ATOM, 32, PropModeReplace, (unsigned char *) atoms, objc);
- ckfree((char *)atoms);
+ ckfree(atoms);
return TCL_OK;
}
@@ -4940,8 +5424,7 @@ SetNetWmType(winPtr, typePtr)
*/
static Tcl_Obj *
-GetNetWmType(winPtr)
- TkWindow *winPtr;
+GetNetWmType(TkWindow *winPtr)
{
Atom typeAtom, actualType, *atoms;
int actualFormat;
@@ -4954,7 +5437,7 @@ GetNetWmType(winPtr)
Tcl_Interp *interp;
Tcl_DString ds;
- interp = winPtr->mainPtr->interp;
+ interp = Tk_Interp(tkwin);
typePtr = Tcl_NewListObj(0, NULL);
if (winPtr->wmInfoPtr->wrapperPtr == NULL) {
@@ -4990,13 +5473,12 @@ GetNetWmType(winPtr)
*
* ParseGeometry --
*
- * This procedure parses a geometry string and updates
- * information used to control the geometry of a top-level
- * window.
+ * This function parses a geometry string and updates information used to
+ * control the geometry of a top-level window.
*
* Results:
- * A standard Tcl return value, plus an error message in
- * the interp's result if an error occurs.
+ * A standard Tcl return value, plus an error message in the interp's
+ * result if an error occurs.
*
* Side effects:
* The size and/or location of winPtr may change.
@@ -5005,17 +5487,17 @@ GetNetWmType(winPtr)
*/
static int
-ParseGeometry(interp, string, winPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- char *string; /* String containing new geometry. Has the
+ParseGeometry(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ const char *string, /* String containing new geometry. Has the
* standard form "=wxh+x+y". */
- TkWindow *winPtr; /* Pointer to top-level window whose
- * geometry is to be changed. */
+ TkWindow *winPtr) /* Pointer to top-level window whose geometry
+ * is to be changed. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int x, y, width, height, flags;
char *end;
- register char *p = string;
+ register const char *p = string;
/*
* The leading "=" is optional.
@@ -5026,9 +5508,9 @@ ParseGeometry(interp, string, winPtr)
}
/*
- * Parse the width and height, if they are present. Don't
- * actually update any of the fields of wmPtr until we've
- * successfully parsed the entire geometry string.
+ * Parse the width and height, if they are present. Don't actually update
+ * any of the fields of wmPtr until we've successfully parsed the entire
+ * geometry string.
*/
width = wmPtr->width;
@@ -5082,10 +5564,10 @@ ParseGeometry(interp, string, winPtr)
}
/*
- * Assume that the geometry information came from the user,
- * unless an explicit source has been specified. Otherwise
- * most window managers assume that the size hints were
- * program-specified and they ignore them.
+ * Assume that the geometry information came from the user, unless an
+ * explicit source has been specified. Otherwise most window managers
+ * assume that the size hints were program-specified and they ignore
+ * them.
*/
if ((wmPtr->sizeHintsFlags & (USPosition|PPosition)) == 0) {
@@ -5095,9 +5577,9 @@ ParseGeometry(interp, string, winPtr)
}
/*
- * Everything was parsed OK. Update the fields of *wmPtr and
- * arrange for the appropriate information to be percolated out
- * to the window manager at the next idle moment.
+ * Everything was parsed OK. Update the fields of *wmPtr and arrange for
+ * the appropriate information to be percolated out to the window manager
+ * at the next idle moment.
*/
wmPtr->width = width;
@@ -5108,14 +5590,13 @@ ParseGeometry(interp, string, winPtr)
wmPtr->flags = flags;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
return TCL_OK;
- error:
- Tcl_AppendResult(interp, "bad geometry specifier \"",
- string, "\"", (char *) NULL);
+ error:
+ Tcl_AppendResult(interp, "bad geometry specifier \"", string, "\"", NULL);
return TCL_ERROR;
}
@@ -5124,15 +5605,15 @@ ParseGeometry(interp, string, winPtr)
*
* Tk_GetRootCoords --
*
- * Given a token for a window, this procedure traces through the
- * window's lineage to find the (virtual) root-window coordinates
- * corresponding to point (0,0) in the window.
+ * Given a token for a window, this function traces through the window's
+ * lineage to find the (virtual) root-window coordinates corresponding to
+ * point (0,0) in the window.
*
* Results:
- * The locations pointed to by xPtr and yPtr are filled in with
- * the root coordinates of the (0,0) point in tkwin. If a virtual
- * root window is in effect for the window, then the coordinates
- * in the virtual root are returned.
+ * The locations pointed to by xPtr and yPtr are filled in with the root
+ * coordinates of the (0,0) point in tkwin. If a virtual root window is
+ * in effect for the window, then the coordinates in the virtual root are
+ * returned.
*
* Side effects:
* None.
@@ -5141,18 +5622,17 @@ ParseGeometry(interp, string, winPtr)
*/
void
-Tk_GetRootCoords(tkwin, xPtr, yPtr)
- Tk_Window tkwin; /* Token for window. */
- int *xPtr; /* Where to store x-displacement of (0,0). */
- int *yPtr; /* Where to store y-displacement of (0,0). */
+Tk_GetRootCoords(
+ Tk_Window tkwin, /* Token for window. */
+ int *xPtr, /* Where to store x-displacement of (0,0). */
+ int *yPtr) /* Where to store y-displacement of (0,0). */
{
int x, y;
register TkWindow *winPtr = (TkWindow *) tkwin;
/*
- * Search back through this window's parents all the way to a
- * top-level window, combining the offsets of each window within
- * its parent.
+ * Search back through this window's parents all the way to a top-level
+ * window, combining the offsets of each window within its parent.
*/
x = y = 0;
@@ -5162,10 +5642,9 @@ Tk_GetRootCoords(tkwin, xPtr, yPtr)
if ((winPtr->wmInfoPtr != NULL)
&& (winPtr->wmInfoPtr->menubar == (Tk_Window) winPtr)) {
/*
- * This window is a special menubar; switch over to its
- * associated toplevel, compensate for their differences in
- * y coordinates, then continue with the toplevel (in case
- * it's embedded).
+ * This window is a special menubar; switch over to its associated
+ * toplevel, compensate for their differences in y coordinates,
+ * then continue with the toplevel (in case it's embedded).
*/
y -= winPtr->wmInfoPtr->menuHeight;
@@ -5181,8 +5660,8 @@ Tk_GetRootCoords(tkwin, xPtr, yPtr)
otherPtr = TkpGetOtherWindow(winPtr);
if (otherPtr == NULL) {
/*
- * The container window is not in the same application.
- * Query the X server.
+ * The container window is not in the same application. Query
+ * the X server.
*/
Window root, dummyChild;
@@ -5190,17 +5669,17 @@ Tk_GetRootCoords(tkwin, xPtr, yPtr)
root = winPtr->wmInfoPtr->vRoot;
if (root == None) {
- root = RootWindowOfScreen(Tk_Screen((Tk_Window)winPtr));
+ root = RootWindowOfScreen(Tk_Screen((Tk_Window) winPtr));
}
XTranslateCoordinates(winPtr->display, winPtr->window,
- root, 0, 0, &rootX, &rootY, &dummyChild);
+ root, 0, 0, &rootX, &rootY, &dummyChild);
x += rootX;
y += rootY;
break;
} else {
/*
- * The container window is in the same application.
- * Let's query its coordinates.
+ * The container window is in the same application. Let's
+ * query its coordinates.
*/
winPtr = otherPtr;
@@ -5221,13 +5700,13 @@ Tk_GetRootCoords(tkwin, xPtr, yPtr)
*
* Tk_CoordsToWindow --
*
- * Given the (virtual) root coordinates of a point, this procedure
- * returns the token for the top-most window covering that point,
- * if there exists such a window in this application.
+ * Given the (virtual) root coordinates of a point, this function returns
+ * the token for the top-most window covering that point, if there exists
+ * such a window in this application.
*
* Results:
- * The return result is either a token for the window corresponding
- * to rootX and rootY, or else NULL to indicate that there is no such
+ * The return result is either a token for the window corresponding to
+ * rootX and rootY, or else NULL to indicate that there is no such
* window.
*
* Side effects:
@@ -5237,13 +5716,13 @@ Tk_GetRootCoords(tkwin, xPtr, yPtr)
*/
Tk_Window
-Tk_CoordsToWindow(rootX, rootY, tkwin)
- int rootX, rootY; /* Coordinates of point in root window. If
- * a virtual-root window manager is in use,
+Tk_CoordsToWindow(
+ int rootX, int rootY, /* Coordinates of point in root window. If a
+ * virtual-root window manager is in use,
* these coordinates refer to the virtual
* root, not the real root. */
- Tk_Window tkwin; /* Token for any window in application;
- * used to identify the display. */
+ Tk_Window tkwin) /* Token for any window in application; used
+ * to identify the display. */
{
Window window, parent, child;
int x, y, childX, childY, tmpx, tmpy, bd;
@@ -5253,16 +5732,16 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
Tk_ErrorHandler handler = NULL;
/*
- * Step 1: scan the list of toplevel windows to see if there is a
- * virtual root for the screen we're interested in. If so, we have
- * to translate the coordinates from virtual root to root
- * coordinates.
+ * Step 1: scan the list of toplevel windows to see if there is a virtual
+ * root for the screen we're interested in. If so, we have to translate
+ * the coordinates from virtual root to root coordinates.
*/
parent = window = RootWindowOfScreen(Tk_Screen(tkwin));
x = rootX;
y = rootY;
- for (wmPtr = (WmInfo *) dispPtr->firstWmPtr; wmPtr != NULL; wmPtr = wmPtr->nextPtr) {
+ for (wmPtr = (WmInfo *) dispPtr->firstWmPtr; wmPtr != NULL;
+ wmPtr = wmPtr->nextPtr) {
if (Tk_Screen(wmPtr->winPtr) != Tk_Screen(tkwin)) {
continue;
}
@@ -5275,29 +5754,28 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
}
/*
- * Step 2: work down through the window hierarchy starting at the
- * root. For each window, find the child that contains the given
- * point and then see if this child is either a wrapper for one of
- * our toplevel windows or a window manager decoration window for
- * one of our toplevels. This approach handles several tricky
- * cases:
+ * Step 2: work down through the window hierarchy starting at the root.
+ * For each window, find the child that contains the given point and then
+ * see if this child is either a wrapper for one of our toplevel windows
+ * or a window manager decoration window for one of our toplevels. This
+ * approach handles several tricky cases:
*
- * 1. There may be a virtual root window between the root and one of
- * our toplevels.
+ * 1. There may be a virtual root window between the root and one of our
+ * toplevels.
* 2. If a toplevel is embedded, we may have to search through the
- * windows of the container application(s) before getting to
- * the toplevel.
+ * windows of the container application(s) before getting to the
+ * toplevel.
*/
- handler = Tk_CreateErrorHandler(Tk_Display(tkwin), -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ handler = Tk_CreateErrorHandler(Tk_Display(tkwin), -1, -1, -1, NULL, NULL);
while (1) {
if (XTranslateCoordinates(Tk_Display(tkwin), parent, window,
x, y, &childX, &childY, &child) == False) {
/*
- * We can end up here when the window is in the middle of
- * being deleted
+ * We can end up here when the window is in the middle of being
+ * deleted
*/
+
Tk_DeleteErrorHandler(handler);
return NULL;
}
@@ -5306,7 +5784,7 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
return NULL;
}
for (wmPtr = (WmInfo *) dispPtr->firstWmPtr; wmPtr != NULL;
- wmPtr = wmPtr->nextPtr) {
+ wmPtr = wmPtr->nextPtr) {
if (wmPtr->reparent == child) {
goto gotToplevel;
}
@@ -5324,12 +5802,13 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
window = child;
}
- gotToplevel:
+ gotToplevel:
if (handler) {
/*
- * Check value of handler, because we can reach this label
- * from above or below
+ * Check value of handler, because we can reach this label from above
+ * or below
*/
+
Tk_DeleteErrorHandler(handler);
handler = NULL;
}
@@ -5341,10 +5820,9 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
/*
* Step 3: at this point winPtr and wmPtr refer to the toplevel that
* contains the given coordinates, and childX and childY give the
- * translated coordinates in the *parent* of the toplevel. Now
- * decide whether the coordinates are in the menubar or the actual
- * toplevel, and translate the coordinates into the coordinate
- * system of that window.
+ * translated coordinates in the *parent* of the toplevel. Now decide
+ * whether the coordinates are in the menubar or the actual toplevel, and
+ * translate the coordinates into the coordinate system of that window.
*/
x = childX - winPtr->changes.x;
@@ -5365,17 +5843,18 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
}
/*
- * Step 4: work down through the hierarchy underneath the current
- * window. At each level, scan through all the children to find the
- * highest one in the stacking order that contains the point. Then
- * repeat the whole process on that child.
+ * Step 4: work down through the hierarchy underneath the current window.
+ * At each level, scan through all the children to find the highest one in
+ * the stacking order that contains the point. Then repeat the whole
+ * process on that child.
*/
while (1) {
nextPtr = NULL;
for (childPtr = winPtr->childList; childPtr != NULL;
childPtr = childPtr->nextPtr) {
- if (!Tk_IsMapped(childPtr) || (childPtr->flags & TK_TOP_HIERARCHY)) {
+ if (!Tk_IsMapped(childPtr)
+ || (childPtr->flags & TK_TOP_HIERARCHY)) {
continue;
}
if (childPtr->flags & TK_REPARENTED) {
@@ -5400,9 +5879,9 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
&& (winPtr->flags & TK_BOTH_HALVES)) {
/*
* The window containing the point is a container, and the
- * embedded application is in this same process. Switch
- * over to the toplevel for the embedded application and
- * start processing that toplevel from scratch.
+ * embedded application is in this same process. Switch over to
+ * the toplevel for the embedded application and start processing
+ * that toplevel from scratch.
*/
winPtr = TkpGetOtherWindow(winPtr);
@@ -5423,28 +5902,27 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
*
* UpdateVRootGeometry --
*
- * This procedure is called to update all the virtual root
- * geometry information in wmPtr.
+ * This function is called to update all the virtual root geometry
+ * information in wmPtr.
*
* Results:
* None.
*
* Side effects:
- * The vRootX, vRootY, vRootWidth, and vRootHeight fields in
- * wmPtr are filled with the most up-to-date information.
+ * The vRootX, vRootY, vRootWidth, and vRootHeight fields in wmPtr are
+ * filled with the most up-to-date information.
*
*----------------------------------------------------------------------
*/
static void
-UpdateVRootGeometry(wmPtr)
- WmInfo *wmPtr; /* Window manager information to be
- * updated. The wmPtr->vRoot field must
- * be valid. */
+UpdateVRootGeometry(
+ WmInfo *wmPtr) /* Window manager information to be updated.
+ * The wmPtr->vRoot field must be valid. */
{
TkWindow *winPtr = wmPtr->winPtr;
int bd;
- unsigned int dummy;
+ unsigned dummy;
Window dummy2;
Status status;
Tk_ErrorHandler handler;
@@ -5456,7 +5934,7 @@ UpdateVRootGeometry(wmPtr)
wmPtr->flags &= ~WM_VROOT_OFFSET_STALE;
if (wmPtr->vRoot == None) {
- noVRoot:
+ noVRoot:
wmPtr->vRootX = wmPtr->vRootY = 0;
wmPtr->vRootWidth = DisplayWidth(winPtr->display, winPtr->screenNum);
wmPtr->vRootHeight = DisplayHeight(winPtr->display, winPtr->screenNum);
@@ -5467,12 +5945,11 @@ UpdateVRootGeometry(wmPtr)
* Refresh the virtual root information if it's out of date.
*/
- handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1,
- (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1, NULL, NULL);
status = XGetGeometry(winPtr->display, wmPtr->vRoot,
&dummy2, &wmPtr->vRootX, &wmPtr->vRootY,
- (unsigned int *) &wmPtr->vRootWidth,
- (unsigned int *) &wmPtr->vRootHeight, (unsigned int *) &bd,
+ (unsigned *) &wmPtr->vRootWidth,
+ (unsigned *) &wmPtr->vRootHeight, (unsigned *) &bd,
&dummy);
if (winPtr->dispPtr->flags & TK_DISPLAY_WM_TRACING) {
printf("UpdateVRootGeometry: x = %d, y = %d, width = %d, ",
@@ -5482,7 +5959,7 @@ UpdateVRootGeometry(wmPtr)
Tk_DeleteErrorHandler(handler);
if (status == 0) {
/*
- * The virtual root is gone! Pretend that it never existed.
+ * The virtual root is gone! Pretend that it never existed.
*/
wmPtr->vRoot = None;
@@ -5495,16 +5972,15 @@ UpdateVRootGeometry(wmPtr)
*
* Tk_GetVRootGeometry --
*
- * This procedure returns information about the virtual root
- * window corresponding to a particular Tk window.
+ * This function returns information about the virtual root window
+ * corresponding to a particular Tk window.
*
* Results:
- * The values at xPtr, yPtr, widthPtr, and heightPtr are set
- * with the offset and dimensions of the root window corresponding
- * to tkwin. If tkwin is being managed by a virtual root window
- * manager these values correspond to the virtual root window being
- * used for tkwin; otherwise the offsets will be 0 and the
- * dimensions will be those of the screen.
+ * The values at xPtr, yPtr, widthPtr, and heightPtr are set with the
+ * offset and dimensions of the root window corresponding to tkwin. If
+ * tkwin is being managed by a virtual root window manager these values
+ * correspond to the virtual root window being used for tkwin; otherwise
+ * the offsets will be 0 and the dimensions will be those of the screen.
*
* Side effects:
* Vroot window information is refreshed if it is out of date.
@@ -5513,12 +5989,13 @@ UpdateVRootGeometry(wmPtr)
*/
void
-Tk_GetVRootGeometry(tkwin, xPtr, yPtr, widthPtr, heightPtr)
- Tk_Window tkwin; /* Window whose virtual root is to be
+Tk_GetVRootGeometry(
+ Tk_Window tkwin, /* Window whose virtual root is to be
* queried. */
- int *xPtr, *yPtr; /* Store x and y offsets of virtual root
+ int *xPtr, int *yPtr, /* Store x and y offsets of virtual root
* here. */
- int *widthPtr, *heightPtr; /* Store dimensions of virtual root here. */
+ int *widthPtr, int *heightPtr)
+ /* Store dimensions of virtual root here. */
{
WmInfo *wmPtr;
TkWindow *winPtr = (TkWindow *) tkwin;
@@ -5528,7 +6005,8 @@ Tk_GetVRootGeometry(tkwin, xPtr, yPtr, widthPtr, heightPtr)
* information for that window.
*/
- while (!(winPtr->flags & TK_TOP_HIERARCHY) && (winPtr->parentPtr != NULL)) {
+ while (!(winPtr->flags & TK_TOP_HIERARCHY)
+ && (winPtr->parentPtr != NULL)) {
winPtr = winPtr->parentPtr;
}
wmPtr = winPtr->wmInfoPtr;
@@ -5540,10 +6018,9 @@ Tk_GetVRootGeometry(tkwin, xPtr, yPtr, widthPtr, heightPtr)
*heightPtr = 0;
}
-
/*
- * Make sure that the geometry information is up-to-date, then copy
- * it out to the caller.
+ * Make sure that the geometry information is up-to-date, then copy it out
+ * to the caller.
*/
if (wmPtr->flags & WM_VROOT_OFFSET_STALE) {
@@ -5560,27 +6037,25 @@ Tk_GetVRootGeometry(tkwin, xPtr, yPtr, widthPtr, heightPtr)
*
* Tk_MoveToplevelWindow --
*
- * This procedure is called instead of Tk_MoveWindow to adjust
- * the x-y location of a top-level window. It delays the actual
- * move to a later time and keeps window-manager information
- * up-to-date with the move
+ * This function is called instead of Tk_MoveWindow to adjust the x-y
+ * location of a top-level window. It delays the actual move to a later
+ * time and keeps window-manager information up-to-date with the move
*
* Results:
* None.
*
* Side effects:
* The window is eventually moved so that its upper-left corner
- * (actually, the upper-left corner of the window's decorative
- * frame, if there is one) is at (x,y).
+ * (actually, the upper-left corner of the window's decorative frame, if
+ * there is one) is at (x,y).
*
*----------------------------------------------------------------------
*/
void
-Tk_MoveToplevelWindow(tkwin, x, y)
- Tk_Window tkwin; /* Window to move. */
- int x, y; /* New location for window (within
- * parent). */
+Tk_MoveToplevelWindow(
+ Tk_Window tkwin, /* Window to move. */
+ int x, int y) /* New location for window (within parent). */
{
TkWindow *winPtr = (TkWindow *) tkwin;
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -5599,16 +6074,15 @@ Tk_MoveToplevelWindow(tkwin, x, y)
/*
* If the window has already been mapped, must bring its geometry
- * up-to-date immediately, otherwise an event might arrive from the
- * server that would overwrite wmPtr->x and wmPtr->y and lose the
- * new position.
+ * up-to-date immediately, otherwise an event might arrive from the server
+ * that would overwrite wmPtr->x and wmPtr->y and lose the new position.
*/
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
if (wmPtr->flags & WM_UPDATE_PENDING) {
- Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_CancelIdleCall(UpdateGeometryInfo, winPtr);
}
- UpdateGeometryInfo((ClientData) winPtr);
+ UpdateGeometryInfo(winPtr);
}
}
@@ -5617,9 +6091,9 @@ Tk_MoveToplevelWindow(tkwin, x, y)
*
* UpdateWmProtocols --
*
- * This procedure transfers the most up-to-date information about
- * window manager protocols from the WmInfo structure to the actual
- * property on the top-level window.
+ * This function transfers the most up-to-date information about window
+ * manager protocols from the WmInfo structure to the actual property on
+ * the top-level window.
*
* Results:
* None.
@@ -5631,41 +6105,44 @@ Tk_MoveToplevelWindow(tkwin, x, y)
*/
static void
-UpdateWmProtocols(wmPtr)
- register WmInfo *wmPtr; /* Information about top-level window. */
+UpdateWmProtocols(
+ register WmInfo *wmPtr) /* Information about top-level window. */
{
register ProtocolHandler *protPtr;
- Atom deleteWindowAtom;
+ Atom deleteWindowAtom, pingAtom;
int count;
Atom *arrayPtr, *atomPtr;
/*
- * There are only two tricky parts here. First, there could be any
- * number of atoms for the window, so count them and malloc an array
- * to hold all of their atoms. Second, we *always* want to respond
- * to the WM_DELETE_WINDOW protocol, even if no-one's officially asked.
+ * There are only two tricky parts here. First, there could be any number
+ * of atoms for the window, so count them and malloc an array to hold all
+ * of their atoms. Second, we *always* want to respond to the
+ * WM_DELETE_WINDOW and _NET_WM_PING protocols, even if no-one's
+ * officially asked.
*/
- for (protPtr = wmPtr->protPtr, count = 1; protPtr != NULL;
+ for (protPtr = wmPtr->protPtr, count = 2; protPtr != NULL;
protPtr = protPtr->nextPtr, count++) {
- /* Empty loop body; we're just counting the handlers. */
+ /* Empty loop body; we're just counting the handlers. */
}
- arrayPtr = (Atom *) ckalloc((unsigned) (count * sizeof(Atom)));
+ arrayPtr = ckalloc(count * sizeof(Atom));
deleteWindowAtom = Tk_InternAtom((Tk_Window) wmPtr->winPtr,
"WM_DELETE_WINDOW");
+ pingAtom = Tk_InternAtom((Tk_Window) wmPtr->winPtr, "_NET_WM_PING");
arrayPtr[0] = deleteWindowAtom;
+ arrayPtr[1] = pingAtom;
for (protPtr = wmPtr->protPtr, atomPtr = &arrayPtr[1];
protPtr != NULL; protPtr = protPtr->nextPtr) {
- if (protPtr->protocol != deleteWindowAtom) {
- *atomPtr = protPtr->protocol;
- atomPtr++;
+ if (protPtr->protocol != deleteWindowAtom
+ && protPtr->protocol != pingAtom) {
+ *(atomPtr++) = protPtr->protocol;
}
}
XChangeProperty(wmPtr->winPtr->display, wmPtr->wrapperPtr->window,
Tk_InternAtom((Tk_Window) wmPtr->winPtr, "WM_PROTOCOLS"),
XA_ATOM, 32, PropModeReplace, (unsigned char *) arrayPtr,
atomPtr-arrayPtr);
- ckfree((char *) arrayPtr);
+ ckfree(arrayPtr);
}
/*
@@ -5673,71 +6150,84 @@ UpdateWmProtocols(wmPtr)
*
* TkWmProtocolEventProc --
*
- * This procedure is called by the Tk_HandleEvent whenever a
- * ClientMessage event arrives whose type is "WM_PROTOCOLS".
- * This procedure handles the message from the window manager
- * in an appropriate fashion.
+ * This function is called by the Tk_HandleEvent whenever a ClientMessage
+ * event arrives whose type is "WM_PROTOCOLS". This function handles the
+ * message from the window manager in an appropriate fashion.
*
* Results:
* None.
*
* Side effects:
- * Depends on what sort of handler, if any, was set up for the
- * protocol.
+ * Depends on what sort of handler, if any, was set up for the protocol.
*
*----------------------------------------------------------------------
*/
void
-TkWmProtocolEventProc(winPtr, eventPtr)
- TkWindow *winPtr; /* Window to which the event was sent. */
- XEvent *eventPtr; /* X event. */
+TkWmProtocolEventProc(
+ TkWindow *winPtr, /* Window to which the event was sent. */
+ XEvent *eventPtr) /* X event. */
{
WmInfo *wmPtr;
register ProtocolHandler *protPtr;
Atom protocol;
int result;
- CONST char *protocolName;
+ const char *protocolName;
Tcl_Interp *interp;
+ protocol = (Atom) eventPtr->xclient.data.l[0];
+
+ /*
+ * If this is a _NET_WM_PING message, send it back to the root window
+ * immediately. We do that here because scripts *cannot* respond correctly
+ * to this protocol.
+ */
+
+ if (protocol == Tk_InternAtom((Tk_Window) winPtr, "_NET_WM_PING")) {
+ Window root = XRootWindow(winPtr->display, winPtr->screenNum);
+
+ eventPtr->xclient.window = root;
+ (void) XSendEvent(winPtr->display, root, False,
+ (SubstructureNotifyMask|SubstructureRedirectMask), eventPtr);
+ return;
+ }
+
wmPtr = winPtr->wmInfoPtr;
if (wmPtr == NULL) {
return;
}
- protocol = (Atom) eventPtr->xclient.data.l[0];
/*
- * Note: it's very important to retrieve the protocol name now,
- * before invoking the command, even though the name won't be used
- * until after the command returns. This is because the command
- * could delete winPtr, making it impossible for us to use it
- * later in the call to Tk_GetAtomName.
+ * Note: it's very important to retrieve the protocol name now, before
+ * invoking the command, even though the name won't be used until after
+ * the command returns. This is because the command could delete winPtr,
+ * making it impossible for us to use it later in the call to
+ * Tk_GetAtomName.
*/
protocolName = Tk_GetAtomName((Tk_Window) winPtr, protocol);
for (protPtr = wmPtr->protPtr; protPtr != NULL;
protPtr = protPtr->nextPtr) {
if (protocol == protPtr->protocol) {
- Tcl_Preserve((ClientData) protPtr);
- interp = protPtr->interp;
- Tcl_Preserve((ClientData) interp);
+ Tcl_Preserve(protPtr);
+ interp = protPtr->interp;
+ Tcl_Preserve(interp);
result = Tcl_GlobalEval(interp, protPtr->command);
if (result != TCL_OK) {
- Tcl_AddErrorInfo(interp, "\n (command for \"");
- Tcl_AddErrorInfo(interp, protocolName);
- Tcl_AddErrorInfo(interp,
- "\" window manager protocol)");
- Tcl_BackgroundError(interp);
+ Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
+ "\n (command for \"%s\" window manager protocol)",
+ protocolName));
+ Tcl_BackgroundException(interp, result);
}
- Tcl_Release((ClientData) interp);
- Tcl_Release((ClientData) protPtr);
+ Tcl_Release(interp);
+ Tcl_Release(protPtr);
return;
}
}
/*
- * No handler was present for this protocol. If this is a
- * WM_DELETE_WINDOW message then just destroy the window.
+ * No handler was present for this protocol. If this is a WM_DELETE_WINDOW
+ * message then just destroy the window.
*/
if (protocol == Tk_InternAtom((Tk_Window) winPtr, "WM_DELETE_WINDOW")) {
@@ -5750,12 +6240,12 @@ TkWmProtocolEventProc(winPtr, eventPtr)
*
* TkWmStackorderToplevelWrapperMap --
*
- * This procedure will create a table that maps the reparent wrapper
- * X id for a toplevel to the TkWindow structure that is wraps.
- * Tk keeps track of a mapping from the window X id to the TkWindow
- * structure but that does us no good here since we only get the X
- * id of the wrapper window. Only those toplevel windows that are
- * mapped have a position in the stacking order.
+ * This function will create a table that maps the reparent wrapper X id
+ * for a toplevel to the TkWindow structure that is wraps. Tk keeps track
+ * of a mapping from the window X id to the TkWindow structure but that
+ * does us no good here since we only get the X id of the wrapper window.
+ * Only those toplevel windows that are mapped have a position in the
+ * stacking order.
*
* Results:
* None.
@@ -5767,30 +6257,28 @@ TkWmProtocolEventProc(winPtr, eventPtr)
*/
static void
-TkWmStackorderToplevelWrapperMap(winPtr, display, table)
- TkWindow *winPtr; /* TkWindow to recurse on */
- Display *display; /* X display of parent window */
- Tcl_HashTable *table; /* Maps X id to TkWindow */
+TkWmStackorderToplevelWrapperMap(
+ TkWindow *winPtr, /* TkWindow to recurse on */
+ Display *display, /* X display of parent window */
+ Tcl_HashTable *table) /* Maps X id to TkWindow */
{
TkWindow *childPtr;
- Tcl_HashEntry *hPtr;
- Window wrapper;
- int newEntry;
if (Tk_IsMapped(winPtr) && Tk_IsTopLevel(winPtr) &&
- !Tk_IsEmbedded(winPtr) && (winPtr->display == display)) {
- wrapper = (winPtr->wmInfoPtr->reparent != None)
- ? winPtr->wmInfoPtr->reparent
- : winPtr->wmInfoPtr->wrapperPtr->window;
+ !Tk_IsEmbedded(winPtr) && (winPtr->display == display)) {
+ Window wrapper = (winPtr->wmInfoPtr->reparent != None)
+ ? winPtr->wmInfoPtr->reparent
+ : winPtr->wmInfoPtr->wrapperPtr->window;
+ Tcl_HashEntry *hPtr;
+ int newEntry;
- hPtr = Tcl_CreateHashEntry(table,
- (char *) wrapper, &newEntry);
- Tcl_SetHashValue(hPtr, winPtr);
+ hPtr = Tcl_CreateHashEntry(table, (char *) wrapper, &newEntry);
+ Tcl_SetHashValue(hPtr, winPtr);
}
for (childPtr = winPtr->childList; childPtr != NULL;
- childPtr = childPtr->nextPtr) {
- TkWmStackorderToplevelWrapperMap(childPtr, display, table);
+ childPtr = childPtr->nextPtr) {
+ TkWmStackorderToplevelWrapperMap(childPtr, display, table);
}
}
@@ -5799,11 +6287,11 @@ TkWmStackorderToplevelWrapperMap(winPtr, display, table)
*
* TkWmStackorderToplevel --
*
- * This procedure returns the stack order of toplevel windows.
+ * This function returns the stack order of toplevel windows.
*
* Results:
- * An array of pointers to tk window objects in stacking order
- * or else NULL if there was an error.
+ * An array of pointers to tk window objects in stacking order or else
+ * NULL if there was an error.
*
* Side effects:
* None.
@@ -5812,12 +6300,12 @@ TkWmStackorderToplevelWrapperMap(winPtr, display, table)
*/
TkWindow **
-TkWmStackorderToplevel(parentPtr)
- TkWindow *parentPtr; /* Parent toplevel window. */
+TkWmStackorderToplevel(
+ TkWindow *parentPtr) /* Parent toplevel window. */
{
Window dummy1, dummy2, vRoot;
Window *children;
- unsigned int numChildren, i;
+ unsigned numChildren, i;
TkWindow *childWinPtr, **windows, **window_ptr;
Tcl_HashTable table;
Tcl_HashEntry *hPtr;
@@ -5830,51 +6318,51 @@ TkWmStackorderToplevel(parentPtr)
Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS);
TkWmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table);
- window_ptr = windows = (TkWindow **) ckalloc((table.numEntries+1)
- * sizeof(TkWindow *));
+ window_ptr = windows = ckalloc((table.numEntries+1) * sizeof(TkWindow *));
/*
- * Special cases: If zero or one toplevels were mapped
- * there is no need to call XQueryTree.
+ * Special cases: If zero or one toplevels were mapped there is no need to
+ * call XQueryTree.
*/
switch (table.numEntries) {
case 0:
- windows[0] = NULL;
- goto done;
+ windows[0] = NULL;
+ goto done;
case 1:
- hPtr = Tcl_FirstHashEntry(&table, &search);
- windows[0] = (TkWindow *) Tcl_GetHashValue(hPtr);
- windows[1] = NULL;
- goto done;
+ hPtr = Tcl_FirstHashEntry(&table, &search);
+ windows[0] = (TkWindow *) Tcl_GetHashValue(hPtr);
+ windows[1] = NULL;
+ goto done;
}
vRoot = parentPtr->wmInfoPtr->vRoot;
if (vRoot == None) {
- vRoot = RootWindowOfScreen(Tk_Screen((Tk_Window) parentPtr));
+ vRoot = RootWindowOfScreen(Tk_Screen((Tk_Window) parentPtr));
}
if (XQueryTree(parentPtr->display, vRoot, &dummy1, &dummy2,
- &children, &numChildren) == 0) {
- ckfree((char *) windows);
- windows = NULL;
+ &children, &numChildren) == 0) {
+ ckfree(windows);
+ windows = NULL;
} else {
- for (i = 0; i < numChildren; i++) {
- hPtr = Tcl_FindHashEntry(&table, (char *) children[i]);
- if (hPtr != NULL) {
- childWinPtr = (TkWindow *) Tcl_GetHashValue(hPtr);
- *window_ptr++ = childWinPtr;
- }
- }
- if ((window_ptr - windows) != table.numEntries)
- Tcl_Panic("num matched toplevel windows does not equal num children");
- *window_ptr = NULL;
+ for (i = 0; i < numChildren; i++) {
+ hPtr = Tcl_FindHashEntry(&table, (char *) children[i]);
+ if (hPtr != NULL) {
+ childWinPtr = (TkWindow *) Tcl_GetHashValue(hPtr);
+ *window_ptr++ = childWinPtr;
+ }
+ }
+ /* ASSERT: window_ptr - windows == table.numEntries
+ * (#matched toplevel windows == #children) [Bug 1789819]
+ */
+ *window_ptr = NULL;
if (numChildren) {
XFree((char *) children);
}
}
- done:
+ done:
Tcl_DeleteHashTable(&table);
return windows;
}
@@ -5884,28 +6372,28 @@ TkWmStackorderToplevel(parentPtr)
*
* TkWmRestackToplevel --
*
- * This procedure restacks a top-level window.
+ * This function restacks a top-level window.
*
* Results:
* None.
*
* Side effects:
- * WinPtr gets restacked as specified by aboveBelow and otherPtr.
+ * WinPtr gets restacked as specified by aboveBelow and otherPtr.
*
*----------------------------------------------------------------------
*/
void
-TkWmRestackToplevel(winPtr, aboveBelow, otherPtr)
- TkWindow *winPtr; /* Window to restack. */
- int aboveBelow; /* Gives relative position for restacking;
+TkWmRestackToplevel(
+ TkWindow *winPtr, /* Window to restack. */
+ int aboveBelow, /* Gives relative position for restacking;
* must be Above or Below. */
- TkWindow *otherPtr; /* Window relative to which to restack;
- * if NULL, then winPtr gets restacked
- * above or below *all* siblings. */
+ TkWindow *otherPtr) /* Window relative to which to restack; if
+ * NULL, then winPtr gets restacked above or
+ * below *all* siblings. */
{
XWindowChanges changes;
- unsigned int mask;
+ unsigned mask;
TkWindow *wrapperPtr;
memset(&changes, 0, sizeof(XWindowChanges));
@@ -5915,6 +6403,7 @@ TkWmRestackToplevel(winPtr, aboveBelow, otherPtr)
/*
* Make sure that winPtr and its wrapper window have been created.
*/
+
if (winPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) {
TkWmMapWindow(winPtr);
}
@@ -5925,6 +6414,7 @@ TkWmRestackToplevel(winPtr, aboveBelow, otherPtr)
* The window is to be restacked with respect to another toplevel.
* Make sure it has been created as well.
*/
+
if (otherPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) {
TkWmMapWindow(otherPtr);
}
@@ -5933,15 +6423,14 @@ TkWmRestackToplevel(winPtr, aboveBelow, otherPtr)
}
/*
- * Reconfigure the window. Note that we use XReconfigureWMWindow
- * instead of XConfigureWindow, in order to handle the case
- * where the window is to be restacked with respect to another toplevel.
- * See [ICCCM] 4.1.5 "Configuring the Window" and XReconfigureWMWindow(3)
- * for details.
+ * Reconfigure the window. Note that we use XReconfigureWMWindow instead
+ * of XConfigureWindow, in order to handle the case where the window is to
+ * be restacked with respect to another toplevel. See [ICCCM] 4.1.5
+ * "Configuring the Window" and XReconfigureWMWindow(3) for details.
*/
XReconfigureWMWindow(winPtr->display, wrapperPtr->window,
- Tk_ScreenNumber((Tk_Window) winPtr), mask, &changes);
+ Tk_ScreenNumber((Tk_Window) winPtr), mask, &changes);
}
@@ -5950,28 +6439,27 @@ TkWmRestackToplevel(winPtr, aboveBelow, otherPtr)
*
* TkWmAddToColormapWindows --
*
- * This procedure is called to add a given window to the
- * WM_COLORMAP_WINDOWS property for its top-level, if it
- * isn't already there. It is invoked by the Tk code that
- * creates a new colormap, in order to make sure that colormap
- * information is propagated to the window manager by default.
+ * This function is called to add a given window to the
+ * WM_COLORMAP_WINDOWS property for its top-level, if it isn't already
+ * there. It is invoked by the Tk code that creates a new colormap, in
+ * order to make sure that colormap information is propagated to the
+ * window manager by default.
*
* Results:
* None.
*
* Side effects:
- * WinPtr's window gets added to the WM_COLORMAP_WINDOWS
- * property of its nearest top-level ancestor, unless the
- * colormaps have been set explicitly with the
- * "wm colormapwindows" command.
+ * WinPtr's window gets added to the WM_COLORMAP_WINDOWS property of its
+ * nearest top-level ancestor, unless the colormaps have been set
+ * explicitly with the "wm colormapwindows" command.
*
*----------------------------------------------------------------------
*/
void
-TkWmAddToColormapWindows(winPtr)
- TkWindow *winPtr; /* Window with a non-default colormap.
- * Should not be a top-level window. */
+TkWmAddToColormapWindows(
+ TkWindow *winPtr) /* Window with a non-default colormap. Should
+ * not be a top-level window. */
{
TkWindow *wrapperPtr;
TkWindow *topPtr;
@@ -5985,7 +6473,7 @@ TkWmAddToColormapWindows(winPtr)
for (topPtr = winPtr->parentPtr; ; topPtr = topPtr->parentPtr) {
if (topPtr == NULL) {
/*
- * Window is being deleted. Skip the whole operation.
+ * Window is being deleted. Skip the whole operation.
*/
return;
@@ -6027,12 +6515,11 @@ TkWmAddToColormapWindows(winPtr)
}
/*
- * Make a new bigger array and use it to reset the property.
- * Automatically add the toplevel itself as the last element
- * of the list.
+ * Make a new bigger array and use it to reset the property. Automatically
+ * add the toplevel itself as the last element of the list.
*/
- newPtr = (Window *) ckalloc((unsigned) ((count+2)*sizeof(Window)));
+ newPtr = ckalloc((count+2) * sizeof(Window));
for (i = 0; i < count; i++) {
newPtr[i] = oldPtr[i];
}
@@ -6043,7 +6530,7 @@ TkWmAddToColormapWindows(winPtr)
newPtr[count] = topPtr->window;
XSetWMColormapWindows(topPtr->display, wrapperPtr->window, newPtr,
count+1);
- ckfree((char *) newPtr);
+ ckfree(newPtr);
if (oldPtr != NULL) {
XFree((char *) oldPtr);
}
@@ -6054,26 +6541,26 @@ TkWmAddToColormapWindows(winPtr)
*
* TkWmRemoveFromColormapWindows --
*
- * This procedure is called to remove a given window from the
- * WM_COLORMAP_WINDOWS property for its top-level. It is invoked
- * when windows are deleted.
+ * This function is called to remove a given window from the
+ * WM_COLORMAP_WINDOWS property for its top-level. It is invoked when
+ * windows are deleted.
*
* Results:
* None.
*
* Side effects:
- * WinPtr's window gets removed from the WM_COLORMAP_WINDOWS
- * property of its nearest top-level ancestor, unless the
- * top-level itself is being deleted too.
+ * WinPtr's window gets removed from the WM_COLORMAP_WINDOWS property of
+ * its nearest top-level ancestor, unless the top-level itself is being
+ * deleted too.
*
*----------------------------------------------------------------------
*/
void
-TkWmRemoveFromColormapWindows(winPtr)
- TkWindow *winPtr; /* Window that may be present in
+TkWmRemoveFromColormapWindows(
+ TkWindow *winPtr) /* Window that may be present in
* WM_COLORMAP_WINDOWS property for its
- * top-level. Should not be a top-level
+ * top-level. Should not be a top-level
* window. */
{
TkWindow *wrapperPtr;
@@ -6100,8 +6587,8 @@ TkWmRemoveFromColormapWindows(winPtr)
}
if (topPtr->flags & TK_ALREADY_DEAD) {
/*
- * Top-level is being deleted, so there's no need to cleanup
- * the WM_COLORMAP_WINDOWS property.
+ * Top-level is being deleted, so there's no need to cleanup the
+ * WM_COLORMAP_WINDOWS property.
*/
return;
@@ -6128,8 +6615,7 @@ TkWmRemoveFromColormapWindows(winPtr)
}
/*
- * Find the window and slide the following ones down to cover
- * it up.
+ * Find the window and slide the following ones down to cover it up.
*/
for (i = 0; i < count; i++) {
@@ -6153,10 +6639,10 @@ TkWmRemoveFromColormapWindows(winPtr)
* Fetch the position of the mouse pointer.
*
* Results:
- * *xPtr and *yPtr are filled in with the (virtual) root coordinates
- * of the mouse pointer for tkwin's display. If the pointer isn't
- * on tkwin's screen, then -1 values are returned for both
- * coordinates. The argument tkwin must be a toplevel window.
+ * *xPtr and *yPtr are filled in with the (virtual) root coordinates of
+ * the mouse pointer for tkwin's display. If the pointer isn't on tkwin's
+ * screen, then -1 values are returned for both coordinates. The argument
+ * tkwin must be a toplevel window.
*
* Side effects:
* None.
@@ -6165,16 +6651,16 @@ TkWmRemoveFromColormapWindows(winPtr)
*/
void
-TkGetPointerCoords(tkwin, xPtr, yPtr)
- Tk_Window tkwin; /* Toplevel window that identifies screen
- * on which lookup is to be done. */
- int *xPtr, *yPtr; /* Store pointer coordinates here. */
+TkGetPointerCoords(
+ Tk_Window tkwin, /* Toplevel window that identifies screen on
+ * which lookup is to be done. */
+ int *xPtr, int *yPtr) /* Store pointer coordinates here. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
WmInfo *wmPtr;
Window w, root, child;
int rootX, rootY;
- unsigned int mask;
+ unsigned mask;
wmPtr = winPtr->wmInfoPtr;
@@ -6194,16 +6680,15 @@ TkGetPointerCoords(tkwin, xPtr, yPtr)
*
* GetMaxSize --
*
- * This procedure computes the current maxWidth and maxHeight
- * values for a window, taking into account the possibility
- * that they may be defaulted.
+ * This function computes the current maxWidth and maxHeight values for a
+ * window, taking into account the possibility that they may be
+ * defaulted.
*
* Results:
- * The values at *maxWidthPtr and *maxHeightPtr are filled
- * in with the maximum allowable dimensions of wmPtr's window,
- * in grid units. If no maximum has been specified for the
- * window, then this procedure computes the largest sizes that
- * will fit on the screen.
+ * The values at *maxWidthPtr and *maxHeightPtr are filled in with the
+ * maximum allowable dimensions of wmPtr's window, in grid units. If no
+ * maximum has been specified for the window, then this function computes
+ * the largest sizes that will fit on the screen.
*
* Side effects:
* None.
@@ -6212,13 +6697,13 @@ TkGetPointerCoords(tkwin, xPtr, yPtr)
*/
static void
-GetMaxSize(wmPtr, maxWidthPtr, maxHeightPtr)
- WmInfo *wmPtr; /* Window manager information for the
+GetMaxSize(
+ WmInfo *wmPtr, /* Window manager information for the
* window. */
- int *maxWidthPtr; /* Where to store the current maximum
- * width of the window. */
- int *maxHeightPtr; /* Where to store the current maximum
- * height of the window. */
+ int *maxWidthPtr, /* Where to store the current maximum width of
+ * the window. */
+ int *maxHeightPtr) /* Where to store the current maximum height
+ * of the window. */
{
int tmp;
@@ -6226,15 +6711,15 @@ GetMaxSize(wmPtr, maxWidthPtr, maxHeightPtr)
*maxWidthPtr = wmPtr->maxWidth;
} else {
/*
- * Must compute a default width. Fill up the display, leaving a
- * bit of extra space for the window manager's borders.
+ * Must compute a default width. Fill up the display, leaving a bit of
+ * extra space for the window manager's borders.
*/
tmp = DisplayWidth(wmPtr->winPtr->display, wmPtr->winPtr->screenNum)
- 15;
if (wmPtr->gridWin != NULL) {
/*
- * Gridding is turned on; convert from pixels to grid units.
+ * Gridding is turned on; convert from pixels to grid units.
*/
tmp = wmPtr->reqGridWidth
@@ -6267,9 +6752,7 @@ GetMaxSize(wmPtr, maxWidthPtr, maxHeightPtr)
*/
static void
-TkSetTransientFor(tkwin, parent)
- Tk_Window tkwin;
- Tk_Window parent;
+TkSetTransientFor(Tk_Window tkwin, Tk_Window parent)
{
if (parent == None) {
parent = Tk_Parent(tkwin);
@@ -6286,8 +6769,8 @@ TkSetTransientFor(tkwin, parent)
*
* TkpMakeMenuWindow --
*
- * Configure the window to be either a pull-down (or pop-up)
- * menu, or as a toplevel (torn-off) menu or palette.
+ * Configure the window to be either a pull-down menu, a pop-up menu, or
+ * as a toplevel (torn-off) menu or palette.
*
* Results:
* None.
@@ -6299,13 +6782,16 @@ TkSetTransientFor(tkwin, parent)
*/
void
-TkpMakeMenuWindow(tkwin, transient)
- Tk_Window tkwin; /* New window. */
- int transient; /* 1 means menu is only posted briefly as
- * a popup or pulldown or cascade. 0 means
- * menu is always visible, e.g. as a torn-off
- * menu. Determines whether save_under and
- * override_redirect should be set. */
+TkpMakeMenuWindow(
+ Tk_Window tkwin, /* New window. */
+ int typeFlag) /* TK_MAKE_MENU_DROPDOWN means menu is only
+ * posted briefly as a pulldown or cascade,
+ * TK_MAKE_MENU_POPUP means it is a popup.
+ * TK_MAKE_MENU_TEAROFF means menu is always
+ * visible, e.g. as a torn-off menu.
+ * Determines whether save_under and
+ * override_redirect should be set, plus how
+ * to flag it for the window manager. */
{
WmInfo *wmPtr;
XSetWindowAttributes atts;
@@ -6320,26 +6806,30 @@ TkpMakeMenuWindow(tkwin, transient)
CreateWrapper(wmPtr);
}
wrapperPtr = wmPtr->wrapperPtr;
- if (transient) {
- atts.override_redirect = True;
- atts.save_under = True;
- typeObj = Tcl_NewStringObj("dropdown_menu", -1);
- } else {
+ if (typeFlag == TK_MAKE_MENU_TEAROFF) {
atts.override_redirect = False;
atts.save_under = False;
typeObj = Tcl_NewStringObj("menu", -1);
- TkSetTransientFor(tkwin, None);
+ TkSetTransientFor(tkwin, NULL);
+ } else {
+ atts.override_redirect = True;
+ atts.save_under = True;
+ if (typeFlag == TK_MAKE_MENU_DROPDOWN) {
+ typeObj = Tcl_NewStringObj("dropdown_menu", -1);
+ } else {
+ typeObj = Tcl_NewStringObj("popup_menu", -1);
+ }
}
SetNetWmType((TkWindow *)tkwin, typeObj);
/*
- * The override-redirect and save-under bits must be set on the
- * wrapper window in order to have the desired effect. However,
- * also set the override-redirect bit on the window itself, so
- * that the "wm overrideredirect" command will see it.
+ * The override-redirect and save-under bits must be set on the wrapper
+ * window in order to have the desired effect. However, also set the
+ * override-redirect bit on the window itself, so that the "wm
+ * overrideredirect" command will see it.
*/
- if ((atts.override_redirect != Tk_Attributes(wrapperPtr)->override_redirect)
+ if ((atts.override_redirect!=Tk_Attributes(wrapperPtr)->override_redirect)
|| (atts.save_under != Tk_Attributes(wrapperPtr)->save_under)) {
Tk_ChangeWindowAttributes((Tk_Window) wrapperPtr,
CWOverrideRedirect|CWSaveUnder, &atts);
@@ -6354,9 +6844,9 @@ TkpMakeMenuWindow(tkwin, transient)
*
* CreateWrapper --
*
- * This procedure is invoked to create the wrapper window for a
- * toplevel window. It is called just before a toplevel is mapped
- * for the first time.
+ * This function is invoked to create the wrapper window for a toplevel
+ * window. It is called just before a toplevel is mapped for the first
+ * time.
*
* Results:
* None.
@@ -6368,8 +6858,8 @@ TkpMakeMenuWindow(tkwin, transient)
*/
static void
-CreateWrapper(wmPtr)
- WmInfo *wmPtr; /* Window manager information for the
+CreateWrapper(
+ WmInfo *wmPtr) /* Window manager information for the
* window. */
{
TkWindow *winPtr, *wrapperPtr;
@@ -6383,12 +6873,12 @@ CreateWrapper(wmPtr)
}
/*
- * The code below is copied from CreateTopLevelWindow,
- * Tk_MakeWindowExist, and TkpMakeWindow; The idea is to create an
- * "official" Tk window (so that we can get events on it), but to
- * hide the window outside the official Tk hierarchy so that it
- * isn't visible to the application. See the comments for the other
- * procedures if you have questions about this code.
+ * The code below is copied from CreateTopLevelWindow, Tk_MakeWindowExist,
+ * and TkpMakeWindow. The idea is to create an "official" Tk window (so
+ * that we can get events on it), but to hide the window outside the
+ * official Tk hierarchy so that it isn't visible to the application. See
+ * the comments for the other functions if you have questions about this
+ * code.
*/
wmPtr->wrapperPtr = wrapperPtr = TkAllocWindow(winPtr->dispPtr,
@@ -6396,12 +6886,11 @@ CreateWrapper(wmPtr)
wrapperPtr->dirtyAtts |= CWBorderPixel;
/*
- * Tk doesn't normally select for StructureNotifyMask events because
- * the events are synthesized internally. However, for wrapper
- * windows we need to know when the window manager modifies the
- * window configuration. We also need to select on focus change
- * events; these are the only windows for which we care about focus
- * changes.
+ * Tk doesn't normally select for StructureNotifyMask events because the
+ * events are synthesized internally. However, for wrapper windows we need
+ * to know when the window manager modifies the window configuration. We
+ * also need to select on focus change events; these are the only windows
+ * for which we care about focus changes.
*/
wrapperPtr->flags |= TK_WRAPPER;
@@ -6436,13 +6925,13 @@ CreateWrapper(wmPtr)
0, 0);
/*
- * Tk must monitor structure events for wrapper windows in order
- * to detect changes made by window managers such as resizing,
- * mapping, unmapping, etc..
+ * Tk must monitor structure events for wrapper windows in order to detect
+ * changes made by window managers such as resizing, mapping, unmapping,
+ * etc..
*/
- Tk_CreateEventHandler((Tk_Window) wmPtr->wrapperPtr, StructureNotifyMask,
- WrapperEventProc, (ClientData) wmPtr);
+ Tk_CreateEventHandler((Tk_Window) wmPtr->wrapperPtr,
+ WrapperEventMask, WrapperEventProc, wmPtr);
}
/*
@@ -6450,16 +6939,15 @@ CreateWrapper(wmPtr)
*
* TkWmFocusToplevel --
*
- * This is a utility procedure invoked by focus-management code.
- * The focus code responds to externally generated focus-related
- * events on wrapper windows but ignores those events for any other
- * windows. This procedure determines whether a given window is a
- * wrapper window and, if so, returns the toplevel window
- * corresponding to the wrapper.
+ * This is a utility function invoked by focus-management code. The focus
+ * code responds to externally generated focus-related events on wrapper
+ * windows but ignores those events for any other windows. This function
+ * determines whether a given window is a wrapper window and, if so,
+ * returns the toplevel window corresponding to the wrapper.
*
* Results:
- * If winPtr is a wrapper window, returns a pointer to the
- * corresponding toplevel window; otherwise returns NULL.
+ * If winPtr is a wrapper window, returns a pointer to the corresponding
+ * toplevel window; otherwise returns NULL.
*
* Side effects:
* None.
@@ -6468,8 +6956,8 @@ CreateWrapper(wmPtr)
*/
TkWindow *
-TkWmFocusToplevel(winPtr)
- TkWindow *winPtr; /* Window that received a focus-related
+TkWmFocusToplevel(
+ TkWindow *winPtr) /* Window that received a focus-related
* event. */
{
if (!(winPtr->flags & TK_WRAPPER)) {
@@ -6483,41 +6971,48 @@ TkWmFocusToplevel(winPtr)
*
* TkUnixSetMenubar --
*
- * This procedure is invoked by menu management code to specify the
- * window to use as a menubar for a given toplevel window.
+ * This function is invoked by menu management code to specify the window
+ * to use as a menubar for a given toplevel window.
*
* Results:
* None.
*
* Side effects:
- * The window given by menubar will be mapped and positioned inside
- * the wrapper for tkwin and above tkwin. Menubar will
- * automatically be resized to maintain the height specified by
- * TkUnixSetMenuHeight the same width as tkwin. Any previous
- * menubar specified for tkwin will be unmapped and ignored from
- * now on.
+ * The window given by menubar will be mapped and positioned inside the
+ * wrapper for tkwin and above tkwin. Menubar will automatically be
+ * resized to maintain the height specified by TkUnixSetMenuHeight the
+ * same width as tkwin. Any previous menubar specified for tkwin will be
+ * unmapped and ignored from now on.
*
*----------------------------------------------------------------------
*/
void
-TkUnixSetMenubar(tkwin, menubar)
- Tk_Window tkwin; /* Token for toplevel window. */
- Tk_Window menubar; /* Token for window that is to serve as
- * menubar for tkwin. Must not be a
- * toplevel window. If NULL, any
- * existing menubar is canceled and the
- * menu height is reset to 0. */
+TkUnixSetMenubar(
+ Tk_Window tkwin, /* Token for toplevel window. */
+ Tk_Window menubar) /* Token for window that is to serve as
+ * menubar for tkwin. Must not be a toplevel
+ * window. If NULL, any existing menubar is
+ * canceled and the menu height is reset to
+ * 0. */
{
WmInfo *wmPtr = ((TkWindow *) tkwin)->wmInfoPtr;
Tk_Window parent;
TkWindow *menubarPtr = (TkWindow *) menubar;
+ /*
+ * Could be a Frame (i.e. not a toplevel).
+ */
+
+ if (wmPtr == NULL) {
+ return;
+ }
+
if (wmPtr->menubar != NULL) {
/*
- * There's already a menubar for this toplevel. If it isn't the
- * same as the new menubar, unmap it so that it is out of the
- * way, and reparent it back to its original parent.
+ * There's already a menubar for this toplevel. If it isn't the same
+ * as the new menubar, unmap it so that it is out of the way, and
+ * reparent it back to its original parent.
*/
if (wmPtr->menubar == menubar) {
@@ -6533,8 +7028,8 @@ TkUnixSetMenubar(tkwin, menubar)
Tk_WindowId(wmPtr->menubar), Tk_WindowId(parent), 0, 0);
}
Tk_DeleteEventHandler(wmPtr->menubar, StructureNotifyMask,
- MenubarDestroyProc, (ClientData) wmPtr->menubar);
- Tk_ManageGeometry(wmPtr->menubar, NULL, (ClientData) NULL);
+ MenubarDestroyProc, wmPtr->menubar);
+ Tk_ManageGeometry(wmPtr->menubar, NULL, NULL);
}
wmPtr->menubar = menubar;
@@ -6542,7 +7037,7 @@ TkUnixSetMenubar(tkwin, menubar)
wmPtr->menuHeight = 0;
} else {
if ((menubarPtr->flags & TK_TOP_LEVEL)
- || (Tk_Screen(menubar) != Tk_Screen(tkwin))) {
+ || (Tk_Screen(menubar) != Tk_Screen(tkwin))) {
Tcl_Panic("TkUnixSetMenubar got bad menubar");
}
wmPtr->menuHeight = Tk_ReqHeight(menubar);
@@ -6559,14 +7054,14 @@ TkUnixSetMenubar(tkwin, menubar)
menubarPtr->wmInfoPtr = wmPtr;
Tk_MoveResizeWindow(menubar, 0, 0, Tk_Width(tkwin), wmPtr->menuHeight);
Tk_MapWindow(menubar);
- Tk_CreateEventHandler(menubar, StructureNotifyMask, MenubarDestroyProc,
- (ClientData) menubar);
- Tk_ManageGeometry(menubar, &menubarMgrType, (ClientData) wmPtr);
+ Tk_CreateEventHandler(menubar, StructureNotifyMask,
+ MenubarDestroyProc, menubar);
+ Tk_ManageGeometry(menubar, &menubarMgrType, wmPtr);
menubarPtr->flags |= TK_REPARENTED;
}
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) tkwin);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, tkwin);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
@@ -6576,24 +7071,24 @@ TkUnixSetMenubar(tkwin, menubar)
*
* MenubarDestroyProc --
*
- * This procedure is invoked by the event dispatcher whenever a
- * menubar window is destroyed (it's also invoked for a few other
- * kinds of events, but we ignore those).
+ * This function is invoked by the event dispatcher whenever a menubar
+ * window is destroyed (it's also invoked for a few other kinds of
+ * events, but we ignore those).
*
* Results:
* None.
*
* Side effects:
- * The association between the window and its toplevel is broken,
- * so that the window is no longer considered to be a menubar.
+ * The association between the window and its toplevel is broken, so that
+ * the window is no longer considered to be a menubar.
*
*----------------------------------------------------------------------
*/
static void
-MenubarDestroyProc(clientData, eventPtr)
- ClientData clientData; /* TkWindow pointer for menubar. */
- XEvent *eventPtr; /* Describes what just happened. */
+MenubarDestroyProc(
+ ClientData clientData, /* TkWindow pointer for menubar. */
+ XEvent *eventPtr) /* Describes what just happened. */
{
WmInfo *wmPtr;
@@ -6605,7 +7100,7 @@ MenubarDestroyProc(clientData, eventPtr)
wmPtr->menuHeight = 0;
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) wmPtr->winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, wmPtr->winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
@@ -6615,9 +7110,8 @@ MenubarDestroyProc(clientData, eventPtr)
*
* MenubarReqProc --
*
- * This procedure is invoked by the Tk geometry management code
- * whenever a menubar calls Tk_GeometryRequest to request a new
- * size.
+ * This function is invoked by the Tk geometry management code whenever a
+ * menubar calls Tk_GeometryRequest to request a new size.
*
* Results:
* None.
@@ -6629,12 +7123,12 @@ MenubarDestroyProc(clientData, eventPtr)
*/
static void
-MenubarReqProc(clientData, tkwin)
- ClientData clientData; /* Pointer to the window manager
- * information for tkwin's toplevel. */
- Tk_Window tkwin; /* Handle for menubar window. */
+MenubarReqProc(
+ ClientData clientData, /* Pointer to the window manager information
+ * for tkwin's toplevel. */
+ Tk_Window tkwin) /* Handle for menubar window. */
{
- WmInfo *wmPtr = (WmInfo *) clientData;
+ WmInfo *wmPtr = clientData;
wmPtr->menuHeight = Tk_ReqHeight(tkwin);
if (wmPtr->menuHeight <= 0) {
@@ -6642,7 +7136,7 @@ MenubarReqProc(clientData, tkwin)
}
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) wmPtr->winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, wmPtr->winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
@@ -6652,12 +7146,12 @@ MenubarReqProc(clientData, tkwin)
*
* TkpGetWrapperWindow --
*
- * Given a toplevel window return the hidden wrapper window for
- * the toplevel window if available.
+ * Given a toplevel window return the hidden wrapper window for the
+ * toplevel window if available.
*
* Results:
- * The wrapper window. NULL is we were not passed a toplevel
- * window or the wrapper has yet to be created.
+ * The wrapper window. NULL is we were not passed a toplevel window or
+ * the wrapper has yet to be created.
*
* Side effects:
* None.
@@ -6666,8 +7160,8 @@ MenubarReqProc(clientData, tkwin)
*/
TkWindow *
-TkpGetWrapperWindow(winPtr)
- TkWindow *winPtr; /* A toplevel window pointer. */
+TkpGetWrapperWindow(
+ TkWindow *winPtr) /* A toplevel window pointer. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -6683,8 +7177,8 @@ TkpGetWrapperWindow(winPtr)
*
* UpdateCommand --
*
- * Update the WM_COMMAND property, taking care to translate
- * the command strings into the external encoding.
+ * Update the WM_COMMAND property, taking care to translate the command
+ * strings into the external encoding.
*
* Results:
* None.
@@ -6696,8 +7190,8 @@ TkpGetWrapperWindow(winPtr)
*/
static void
-UpdateCommand(winPtr)
- TkWindow *winPtr;
+UpdateCommand(
+ TkWindow *winPtr)
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Tcl_DString cmds, ds;
@@ -6705,19 +7199,19 @@ UpdateCommand(winPtr)
char **cmdArgv;
/*
- * Translate the argv strings into the external encoding. To avoid
- * allocating lots of memory, the strings are appended to a buffer
- * with nulls between each string.
+ * Translate the argv strings into the external encoding. To avoid
+ * allocating lots of memory, the strings are appended to a buffer with
+ * nulls between each string.
*
- * This code is tricky because we need to pass and array of pointers
- * to XSetCommand. However, we can't compute the pointers as we go
- * because the DString buffer space could get reallocated. So, store
- * offsets for each element as we go, then compute pointers from the
- * offsets once the entire DString is done.
+ * This code is tricky because we need to pass and array of pointers to
+ * XSetCommand. However, we can't compute the pointers as we go because
+ * the DString buffer space could get reallocated. So, store offsets for
+ * each element as we go, then compute pointers from the offsets once the
+ * entire DString is done.
*/
- cmdArgv = (char **) ckalloc(sizeof(char *) * wmPtr->cmdArgc);
- offsets = (int *) ckalloc( sizeof(int) * wmPtr->cmdArgc);
+ cmdArgv = ckalloc(sizeof(char *) * wmPtr->cmdArgc);
+ offsets = ckalloc(sizeof(int) * wmPtr->cmdArgc);
Tcl_DStringInit(&cmds);
for (i = 0; i < wmPtr->cmdArgc; i++) {
Tcl_UtfToExternalDString(NULL, wmPtr->cmdArgv[i], -1, &ds);
@@ -6734,8 +7228,8 @@ UpdateCommand(winPtr)
XSetCommand(winPtr->display, wmPtr->wrapperPtr->window,
cmdArgv, wmPtr->cmdArgc);
Tcl_DStringFree(&cmds);
- ckfree((char *) cmdArgv);
- ckfree((char *) offsets);
+ ckfree(cmdArgv);
+ ckfree(offsets);
}
/*
@@ -6743,8 +7237,8 @@ UpdateCommand(winPtr)
*
* TkpWmSetState --
*
- * Sets the window manager state for the wrapper window of a
- * given toplevel window.
+ * Sets the window manager state for the wrapper window of a given
+ * toplevel window.
*
* Results:
* 0 on error, 1 otherwise
@@ -6756,49 +7250,95 @@ UpdateCommand(winPtr)
*/
int
-TkpWmSetState(winPtr, state)
- TkWindow *winPtr; /* Toplevel window to operate on. */
- int state; /* One of IconicState, NormalState,
- * or WithdrawnState. */
+TkpWmSetState(
+ TkWindow *winPtr, /* Toplevel window to operate on. */
+ int state) /* One of IconicState, NormalState, or
+ * WithdrawnState. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
if (state == WithdrawnState) {
- wmPtr->hints.initial_state = WithdrawnState;
- wmPtr->withdrawn = 1;
- if (wmPtr->flags & WM_NEVER_MAPPED) {
- return 1;
- }
- if (XWithdrawWindow(winPtr->display, wmPtr->wrapperPtr->window,
- winPtr->screenNum) == 0) {
- return 0;
- }
- WaitForMapNotify(winPtr, 0);
+ wmPtr->hints.initial_state = WithdrawnState;
+ wmPtr->withdrawn = 1;
+ if (wmPtr->flags & WM_NEVER_MAPPED) {
+ return 1;
+ }
+ if (XWithdrawWindow(winPtr->display, wmPtr->wrapperPtr->window,
+ winPtr->screenNum) == 0) {
+ return 0;
+ }
+ WaitForMapNotify(winPtr, 0);
} else if (state == NormalState) {
- wmPtr->hints.initial_state = NormalState;
- wmPtr->withdrawn = 0;
- if (wmPtr->flags & WM_NEVER_MAPPED) {
- return 1;
- }
- UpdateHints(winPtr);
- Tk_MapWindow((Tk_Window) winPtr);
+ wmPtr->hints.initial_state = NormalState;
+ wmPtr->withdrawn = 0;
+ if (wmPtr->flags & WM_NEVER_MAPPED) {
+ return 1;
+ }
+ UpdateHints(winPtr);
+ Tk_MapWindow((Tk_Window) winPtr);
} else if (state == IconicState) {
- wmPtr->hints.initial_state = IconicState;
- if (wmPtr->flags & WM_NEVER_MAPPED) {
- return 1;
- }
- if (wmPtr->withdrawn) {
- UpdateHints(winPtr);
- Tk_MapWindow((Tk_Window) winPtr);
- wmPtr->withdrawn = 0;
- } else {
- if (XIconifyWindow(winPtr->display, wmPtr->wrapperPtr->window,
- winPtr->screenNum) == 0) {
- return 0;
- }
- WaitForMapNotify(winPtr, 0);
- }
+ wmPtr->hints.initial_state = IconicState;
+ if (wmPtr->flags & WM_NEVER_MAPPED) {
+ return 1;
+ }
+ if (wmPtr->withdrawn) {
+ UpdateHints(winPtr);
+ Tk_MapWindow((Tk_Window) winPtr);
+ wmPtr->withdrawn = 0;
+ } else {
+ if (XIconifyWindow(winPtr->display, wmPtr->wrapperPtr->window,
+ winPtr->screenNum) == 0) {
+ return 0;
+ }
+ WaitForMapNotify(winPtr, 0);
+ }
}
return 1;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RemapWindows
+ *
+ * Adjust parent/child relation ships of
+ * the given window hierarchy.
+ *
+ * Results:
+ * none
+ *
+ * Side effects:
+ * keeps windowing system (X11) happy
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+RemapWindows(
+ TkWindow *winPtr,
+ TkWindow *parentPtr)
+{
+ XWindowAttributes win_attr;
+
+ if (winPtr->window) {
+ XGetWindowAttributes(winPtr->display, winPtr->window, &win_attr);
+ if (parentPtr == NULL) {
+ XReparentWindow(winPtr->display, winPtr->window,
+ XRootWindow(winPtr->display, winPtr->screenNum),
+ win_attr.x, win_attr.y);
+ } else if (parentPtr->window) {
+ XReparentWindow(parentPtr->display, winPtr->window,
+ parentPtr->window,
+ win_attr.x, win_attr.y);
+ }
+ }
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tkUnixXId.c b/unix/tkUnixXId.c
index 428d5fe..cbc0a5d 100644
--- a/unix/tkUnixXId.c
+++ b/unix/tkUnixXId.c
@@ -1,200 +1,23 @@
-/*
+/*
* tkUnixXId.c --
*
- * This file provides a replacement function for the default X
- * resource allocator (_XAllocID). The problem with the default
- * allocator is that it never re-uses ids, which causes long-lived
- * applications to crash when X resource identifiers wrap around.
- * The replacement functions in this file re-use old identifiers
- * to prevent this problem.
- *
- * The code in this file is based on similar implementations by
- * George C. Kaplan and Michael Hoegeman.
- *
* Copyright (c) 1993 The Regents of the University of California.
* Copyright (c) 1994-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.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-/*
- * The definition below is needed on some systems so that we can access
- * the resource_alloc field of Display structures in order to replace
- * the resource allocator.
- */
-
-#define XLIB_ILLEGAL_ACCESS 1
-
#include "tkUnixInt.h"
-#include "tkPort.h"
-
-/*
- * A structure of the following type is used to hold one or more
- * available resource identifiers. There is a list of these structures
- * for each display.
- */
-
-#define IDS_PER_STACK 10
-typedef struct TkIdStack {
- XID ids[IDS_PER_STACK]; /* Array of free identifiers. */
- int numUsed; /* Indicates how many of the entries
- * in ids are currently in use. */
- TkDisplay *dispPtr; /* Display to which ids belong. */
- struct TkIdStack *nextPtr; /* Next bunch of free identifiers
- * for the same display. */
-} TkIdStack;
-
-/*
- * Forward declarations for procedures defined in this file:
- */
-
-static XID AllocXId _ANSI_ARGS_((Display *display));
-static Tk_RestrictAction CheckRestrictProc _ANSI_ARGS_((
- ClientData clientData, XEvent *eventPtr));
-static void WindowIdCleanup _ANSI_ARGS_((ClientData clientData));
-static void WindowIdCleanup2 _ANSI_ARGS_((ClientData clientData));
-
-/*
- *----------------------------------------------------------------------
- *
- * TkInitXId --
- *
- * This procedure is called to initialize the id allocator for
- * a given display.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The official allocator for the display is set up to be AllocXId.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkInitXId(dispPtr)
- TkDisplay *dispPtr; /* Tk's information about the
- * display. */
-{
- dispPtr->idStackPtr = NULL;
- dispPtr->defaultAllocProc = (XID (*) _ANSI_ARGS_((Display *display)))
- dispPtr->display->resource_alloc;
- dispPtr->display->resource_alloc = AllocXId;
- dispPtr->windowStackPtr = NULL;
- dispPtr->idCleanupScheduled = (Tcl_TimerToken) 0;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkFreeXId --
- *
- * This procedure is called to free resources for the id allocator
- * for a given display.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Frees the id and window stack pools.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkFreeXId(dispPtr)
- TkDisplay *dispPtr; /* Tk's information about the
- * display. */
-{
- TkIdStack *stackPtr, *freePtr;
-
- if (dispPtr->idCleanupScheduled) {
- Tcl_DeleteTimerHandler(dispPtr->idCleanupScheduled);
- }
-
- for (stackPtr = dispPtr->idStackPtr; stackPtr != NULL; ) {
- freePtr = stackPtr;
- stackPtr = stackPtr->nextPtr;
- ckfree((char *) freePtr);
- }
- dispPtr->idStackPtr = NULL;
-
- for (stackPtr = dispPtr->windowStackPtr; stackPtr != NULL; ) {
- freePtr = stackPtr;
- stackPtr = stackPtr->nextPtr;
- ckfree((char *) freePtr);
- }
- dispPtr->windowStackPtr = NULL;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * AllocXId --
- *
- * This procedure is invoked by Xlib as the resource allocator
- * for a display.
- *
- * Results:
- * The return value is an X resource identifier that isn't currently
- * in use.
- *
- * Side effects:
- * The identifier is removed from the stack of free identifiers,
- * if it was previously on the stack.
- *
- *----------------------------------------------------------------------
- */
-static XID
-AllocXId(display)
- Display *display; /* Display for which to allocate. */
-{
- TkDisplay *dispPtr;
- TkIdStack *stackPtr;
-
- /*
- * Find Tk's information about the display.
- */
-
- dispPtr = TkGetDisplay(display);
-
- /*
- * If the topmost chunk on the stack is empty then free it. Then
- * check for a free id on the stack and return it if it exists.
- */
-
- stackPtr = dispPtr->idStackPtr;
- if (stackPtr != NULL) {
- while (stackPtr->numUsed == 0) {
- dispPtr->idStackPtr = stackPtr->nextPtr;
- ckfree((char *) stackPtr);
- stackPtr = dispPtr->idStackPtr;
- if (stackPtr == NULL) {
- goto defAlloc;
- }
- }
- stackPtr->numUsed--;
- return stackPtr->ids[stackPtr->numUsed];
- }
-
- /*
- * No free ids in the stack: just get one from the default
- * allocator.
- */
-
- defAlloc:
- return (*dispPtr->defaultAllocProc)(display);
-}
/*
*----------------------------------------------------------------------
*
* Tk_FreeXId --
*
- * This procedure is called to indicate that an X resource identifier
- * is now free.
+ * This function is called to indicate that an X resource identifier is
+ * now free.
*
* Results:
* None.
@@ -207,288 +30,27 @@ AllocXId(display)
*/
void
-Tk_FreeXId(display, xid)
- Display *display; /* Display for which xid was
- * allocated. */
- XID xid; /* Identifier that is no longer
- * in use. */
-{
- TkDisplay *dispPtr;
- TkIdStack *stackPtr;
-
- /*
- * Find Tk's information about the display.
- */
-
- dispPtr = TkGetDisplay(display);
-
- /*
- * Add a new chunk to the stack if the current chunk is full.
- */
-
- stackPtr = dispPtr->idStackPtr;
- if ((stackPtr == NULL) || (stackPtr->numUsed >= IDS_PER_STACK)) {
- stackPtr = (TkIdStack *) ckalloc(sizeof(TkIdStack));
- stackPtr->numUsed = 0;
- stackPtr->dispPtr = dispPtr;
- stackPtr->nextPtr = dispPtr->idStackPtr;
- dispPtr->idStackPtr = stackPtr;
- }
-
- /*
- * Add the id to the current chunk.
- */
-
- stackPtr->ids[stackPtr->numUsed] = xid;
- stackPtr->numUsed++;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkFreeWindowId --
- *
- * This procedure is invoked instead of TkFreeXId for window ids.
- * See below for the reason why.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The id given by w will eventually be freed, so that it can be
- * reused for other resources.
- *
- * Design:
- * Freeing window ids is very tricky because there could still be
- * events pending for a window in the event queue (or even in the
- * server) at the time the window is destroyed. If the window
- * id were to get reused immediately for another window, old
- * events could "drop in" on the new window, causing unexpected
- * behavior.
- *
- * Thus we have to wait to re-use a window id until we know that
- * there are no events left for it. Right now this is done in
- * two steps. First, we wait until we know that the server
- * has seen the XDestroyWindow request, so we can be sure that
- * it won't generate more events for the window and that any
- * existing events are in our queue. Second, we make sure that
- * there are no events whatsoever in our queue (this is conservative
- * but safe).
- *
- * The first step is done by remembering the request id of the
- * XDestroyWindow request and using LastKnownRequestProcessed to
- * see what events the server has processed. If multiple windows
- * get destroyed at about the same time, we just remember the
- * most recent request number for any of them (again, conservative
- * but safe).
- *
- * There are a few other complications as well. When Tk destroys a
- * sub-tree of windows, it only issues a single XDestroyWindow call,
- * at the very end for the root of the subtree. We can't free any of
- * the window ids until the final XDestroyWindow call. To make sure
- * that this happens, we have to keep track of deletions in progress,
- * hence the need for the "destroyCount" field of the display.
- *
- * One final problem. Some servers, like Sun X11/News servers still
- * seem to have problems with ids getting reused too quickly. I'm
- * not completely sure why this is a problem, but delaying the
- * recycling of ids appears to eliminate it. Therefore, we wait
- * an additional few seconds, even after "the coast is clear"
- * before reusing the ids.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkFreeWindowId(dispPtr, w)
- TkDisplay *dispPtr; /* Display that w belongs to. */
- Window w; /* X identifier for window on dispPtr. */
-{
- TkIdStack *stackPtr;
-
- /*
- * Put the window id on a separate stack of window ids, rather
- * than the main stack, so it won't get reused right away. Add
- * a new chunk to the stack if the current chunk is full.
- */
-
- stackPtr = dispPtr->windowStackPtr;
- if ((stackPtr == NULL) || (stackPtr->numUsed >= IDS_PER_STACK)) {
- stackPtr = (TkIdStack *) ckalloc(sizeof(TkIdStack));
- stackPtr->numUsed = 0;
- stackPtr->dispPtr = dispPtr;
- stackPtr->nextPtr = dispPtr->windowStackPtr;
- dispPtr->windowStackPtr = stackPtr;
- }
-
- /*
- * Add the id to the current chunk.
- */
-
- stackPtr->ids[stackPtr->numUsed] = w;
- stackPtr->numUsed++;
-
- /*
- * Schedule a call to WindowIdCleanup if one isn't already
- * scheduled.
- */
-
- if (!dispPtr->idCleanupScheduled) {
- dispPtr->idCleanupScheduled =
- Tcl_CreateTimerHandler(100, WindowIdCleanup, (ClientData) dispPtr);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WindowIdCleanup --
- *
- * See if we can now free up all the accumulated ids of
- * deleted windows.
- *
- * Results:
- * None.
- *
- * Side effects:
- * If it's safe to move the window ids back to the main free
- * list, we schedule this to happen after a few mores seconds
- * of delay. If it's not safe to move them yet, a timer handler
- * gets invoked to try again later.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-WindowIdCleanup(clientData)
- ClientData clientData; /* Pointer to TkDisplay for display */
+Tk_FreeXId(
+ Display *display, /* Display for which xid was allocated. */
+ XID xid) /* Identifier that is no longer in use. */
{
- TkDisplay *dispPtr = (TkDisplay *) clientData;
- int anyEvents, delta;
- Tk_RestrictProc *oldProc;
- ClientData oldData;
- static Tcl_Time timeout = {0, 0};
-
- dispPtr->idCleanupScheduled = (Tcl_TimerToken) 0;
-
/*
- * See if it's safe to recycle the window ids. It's safe if:
- * (a) no deletions are in progress.
- * (b) the server has seen all of the requests up to the last
- * XDestroyWindow request.
- * (c) there are no events in the event queue; the only way to
- * test for this right now is to create a restrict proc that
- * will filter the events, then call Tcl_DoOneEvent to see if
- * the procedure gets invoked.
+ * This does nothing, because the XC-MISC extension takes care of
+ * freeing XIDs for us. It has been a standard X11 extension for
+ * about 15 years as of 2008. Keith Packard and another X.org
+ * developer suggested that we remove the previous code that used:
+ * #define XLIB_ILLEGAL_ACCESS.
*/
-
- if (dispPtr->destroyCount > 0) {
- goto tryAgain;
- }
- delta = LastKnownRequestProcessed(dispPtr->display)
- - dispPtr->lastDestroyRequest;
- if (delta < 0) {
- XSync(dispPtr->display, False);
- }
- anyEvents = 0;
- oldProc = Tk_RestrictEvents(CheckRestrictProc, (ClientData) &anyEvents,
- &oldData);
- TkUnixDoOneXEvent(&timeout);
- Tk_RestrictEvents(oldProc, oldData, &oldData);
- if (anyEvents) {
- goto tryAgain;
- }
-
- /*
- * These ids look safe to recycle, but we still need to delay a bit
- * more (see comments for TkFreeWindowId). Schedule the final freeing.
- */
-
- if (dispPtr->windowStackPtr != NULL) {
- Tcl_CreateTimerHandler(5000, WindowIdCleanup2,
- (ClientData) dispPtr->windowStackPtr);
- dispPtr->windowStackPtr = NULL;
- }
- return;
-
- /*
- * It's still not safe to free up the ids. Try again a bit later.
- */
-
- tryAgain:
- dispPtr->idCleanupScheduled =
- Tcl_CreateTimerHandler(500, WindowIdCleanup, (ClientData) dispPtr);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * WindowIdCleanup2 --
- *
- * This procedure is the last one in the chain that recycles
- * window ids. It takes all of the ids indicated by its
- * argument and adds them back to the main id free list.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Window ids get added to the main free list for their display.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-WindowIdCleanup2(clientData)
- ClientData clientData; /* Pointer to TkIdStack list. */
-{
- TkIdStack *stackPtr = (TkIdStack *) clientData;
- TkIdStack *lastPtr;
-
- lastPtr = stackPtr;
- while (lastPtr->nextPtr != NULL) {
- lastPtr = lastPtr->nextPtr;
- }
- lastPtr->nextPtr = stackPtr->dispPtr->idStackPtr;
- stackPtr->dispPtr->idStackPtr = stackPtr;
}
-
-/*
- *----------------------------------------------------------------------
- *
- * CheckRestrictProc --
- *
- * This procedure is a restrict procedure, called by Tcl_DoOneEvent
- * to filter X events. All it does is to set a flag to indicate
- * that there are X events present.
- *
- * Results:
- * Sets the integer pointed to by the argument, then returns
- * TK_DEFER_EVENT.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-static Tk_RestrictAction
-CheckRestrictProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to flag to set. */
- XEvent *eventPtr; /* Event to filter; not used. */
-{
- int *flag = (int *) clientData;
- *flag = 1;
- return TK_DEFER_EVENT;
-}
/*
*----------------------------------------------------------------------
*
* Tk_GetPixmap --
*
- * Same as the XCreatePixmap procedure except that it manages
- * resource identifiers better.
+ * Same as the XCreatePixmap function except that it manages resource
+ * identifiers better.
*
* Results:
* Returns a new pixmap.
@@ -500,11 +62,11 @@ CheckRestrictProc(clientData, eventPtr)
*/
Pixmap
-Tk_GetPixmap(display, d, width, height, depth)
- Display *display; /* Display for new pixmap. */
- Drawable d; /* Drawable where pixmap will be used. */
- int width, height; /* Dimensions of pixmap. */
- int depth; /* Bits per pixel for pixmap. */
+Tk_GetPixmap(
+ Display *display, /* Display for new pixmap. */
+ Drawable d, /* Drawable where pixmap will be used. */
+ int width, int height, /* Dimensions of pixmap. */
+ int depth) /* Bits per pixel for pixmap. */
{
return XCreatePixmap(display, d, (unsigned) width, (unsigned) height,
(unsigned) depth);
@@ -515,66 +77,28 @@ Tk_GetPixmap(display, d, width, height, depth)
*
* Tk_FreePixmap --
*
- * Same as the XFreePixmap procedure except that it also marks
- * the resource identifier as free.
+ * Same as the XFreePixmap function except that it also marks the
+ * resource identifier as free.
*
* Results:
* None.
*
* Side effects:
- * The pixmap is freed in the X server and its resource identifier
- * is saved for re-use.
+ * The pixmap is freed in the X server and its resource identifier is
+ * saved for re-use.
*
*----------------------------------------------------------------------
*/
void
-Tk_FreePixmap(display, pixmap)
- Display *display; /* Display for which pixmap was allocated. */
- Pixmap pixmap; /* Identifier for pixmap. */
+Tk_FreePixmap(
+ Display *display, /* Display for which pixmap was allocated. */
+ Pixmap pixmap) /* Identifier for pixmap. */
{
XFreePixmap(display, pixmap);
Tk_FreeXId(display, (XID) pixmap);
}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpWindowWasRecentlyDeleted --
- *
- * Checks whether the window was recently deleted. This is called
- * by the generic error handler to detect asynchronous notification
- * of errors due to operations by Tk on a window that was already
- * deleted by the server.
- *
- * Results:
- * 1 if the window was deleted recently, 0 otherwise.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-int
-TkpWindowWasRecentlyDeleted(win, dispPtr)
- Window win; /* The window to check for. */
- TkDisplay *dispPtr; /* The window belongs to this display. */
-{
- TkIdStack *stackPtr;
- int i;
-
- for (stackPtr = dispPtr->windowStackPtr;
- stackPtr != NULL;
- stackPtr = stackPtr->nextPtr) {
- for (i = 0; i < stackPtr->numUsed; i++) {
- if ((Window) stackPtr->ids[i] == win) {
- return 1;
- }
- }
- }
- return 0;
-}
/*
*----------------------------------------------------------------------
@@ -584,10 +108,10 @@ TkpWindowWasRecentlyDeleted(win, dispPtr)
* Given a string, produce the corresponding Window Id.
*
* Results:
- * The return value is normally TCL_OK; in this case *idPtr
- * will be set to the Window value equivalent to string. If
- * string is improperly formed then TCL_ERROR is returned and
- * an error message will be left in the interp's result.
+ * The return value is normally TCL_OK; in this case *idPtr will be set
+ * to the Window value equivalent to string. If string is improperly
+ * formed then TCL_ERROR is returned and an error message will be left in
+ * the interp's result.
*
* Side effects:
* None.
@@ -596,16 +120,24 @@ TkpWindowWasRecentlyDeleted(win, dispPtr)
*/
int
-TkpScanWindowId(interp, string, idPtr)
- Tcl_Interp *interp;
- CONST char *string;
- Window *idPtr;
+TkpScanWindowId(
+ Tcl_Interp *interp,
+ const char *string,
+ Window *idPtr)
{
int value;
+
if (Tcl_GetInt(interp, string, &value) != TCL_OK) {
return TCL_ERROR;
}
*idPtr = (Window) value;
return TCL_OK;
}
-
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */