summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das>2007-03-07 23:46:33 (GMT)
committerdas <das>2007-03-07 23:46:33 (GMT)
commit3288ca4931072f874190455b686106df2d756cbd (patch)
treeb327533aebd6e8b2b22cd04e1e847fddbe5de52d
parent377fc83bb085523c857545603b7cd054ef49f160 (diff)
downloadtk-3288ca4931072f874190455b686106df2d756cbd.zip
tk-3288ca4931072f874190455b686106df2d756cbd.tar.gz
tk-3288ca4931072f874190455b686106df2d756cbd.tar.bz2
* generic/tkMain.c (Tk_MainEx): replicate macosx-specific code from
TkpInit() that ensures the console window appears when wish is started from the OS X Finder (i.e. with stdin == /dev/null), jeffh's 2006-11-24 change rendered the corresponding code in TkpInit() ineffective in wish because Tk_MainEx() sets tcl_interactive before calling TkpInit(). * generic/ttk/ttkGenStubs.tcl (new): add ttk-specific genstubs.tcl from * unix/Makefile.in (genstubs): tile and run it from 'genstubs' target, restores ability to generate all of Tk's stub sources. * generic/ttk/ttkTreeview.c: #ifdef out unused declaration. * macosx/tkMacOSXDebug.c (TkMacOSXGetNamedDebugSymbol): add fix for libraries loaded with a DYLD_IMAGE_SUFFIX. * macosx/Wish.xcodeproj/project.pbxproj: ensure gcc version used by * macosx/Wish.xcodeproj/default.pbxuser: Xcode and configure/make are * macosx/Wish-Common.xcconfig: consistent and independent of gcc_select default and CC env var; fixes for Xcode 3.0. * unix/tcl.m4 (Darwin): s/CFLAGS/CPPFLAGS/ in macosx-version-min check. * unix/configure: autoconf-2.59
-rw-r--r--ChangeLog25
-rw-r--r--generic/tkMain.c22
-rw-r--r--generic/ttk/ttkGenStubs.tcl887
-rw-r--r--generic/ttk/ttkTreeview.c4
-rw-r--r--generic/ttk/ttkWidget.c14
-rw-r--r--macosx/Wish-Common.xcconfig9
-rw-r--r--macosx/Wish.xcodeproj/default.pbxuser1
-rw-r--r--macosx/Wish.xcodeproj/project.pbxproj2
-rw-r--r--macosx/tkMacOSXDebug.c10
-rw-r--r--unix/Makefile.in5
-rwxr-xr-xunix/configure2
-rw-r--r--unix/tcl.m42
12 files changed, 965 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 3b620b6..92f92d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2007-03-07 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkMain.c (Tk_MainEx): replicate macosx-specific code from
+ TkpInit() that ensures the console window appears when wish is started
+ from the OS X Finder (i.e. with stdin == /dev/null), jeffh's 2006-11-24
+ change rendered the corresponding code in TkpInit() ineffective in wish
+ because Tk_MainEx() sets tcl_interactive before calling TkpInit().
+
+ * generic/ttk/ttkGenStubs.tcl (new): add ttk-specific genstubs.tcl from
+ * unix/Makefile.in (genstubs): tile and run it from 'genstubs'
+ target, restores ability to generate all of Tk's stub sources.
+
+ * generic/ttk/ttkTreeview.c: #ifdef out unused declaration.
+
+ * macosx/tkMacOSXDebug.c (TkMacOSXGetNamedDebugSymbol): add fix for
+ libraries loaded with a DYLD_IMAGE_SUFFIX.
+
+ * macosx/Wish.xcodeproj/project.pbxproj: ensure gcc version used by
+ * macosx/Wish.xcodeproj/default.pbxuser: Xcode and configure/make are
+ * macosx/Wish-Common.xcconfig: consistent and independent of
+ gcc_select default and CC env var; fixes for Xcode 3.0.
+
+ * unix/tcl.m4 (Darwin): s/CFLAGS/CPPFLAGS/ in macosx-version-min check.
+ * unix/configure: autoconf-2.59
+
2007-02-25 Peter Spjuth <peter.spjuth@space.se>
* generic/tkUtil.c: Fixed grid anchor center problem in labelframes.
diff --git a/generic/tkMain.c b/generic/tkMain.c
index 813343a..bf478fc 100644
--- a/generic/tkMain.c
+++ b/generic/tkMain.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMain.c,v 1.22 2006/09/22 19:02:07 andreas_kupries Exp $
+ * RCS: @(#) $Id: tkMain.c,v 1.23 2007/03/07 23:46:33 das Exp $
*/
#include <ctype.h>
@@ -99,7 +99,7 @@ Tk_MainEx(
{
Tcl_Obj *path, *argvPtr;
CONST char *encodingName;
- int code;
+ int code, nullStdin = 0;
Tcl_Channel inChannel, outChannel;
ThreadSpecificData *tsdPtr;
#ifdef __WIN32__
@@ -206,6 +206,7 @@ Tk_MainEx(
* Set the "tcl_interactive" variable.
*/
+#ifdef __WIN32__
/*
* For now, under Windows, we assume we are not running as a console mode
* app, so we need to use the GUI console. In order to enable this, we
@@ -213,7 +214,6 @@ Tk_MainEx(
* to do it.
*/
-#ifdef __WIN32__
handle = GetStdHandle(STD_INPUT_HANDLE);
if ((handle == INVALID_HANDLE_VALUE) || (handle == 0)
@@ -237,8 +237,22 @@ Tk_MainEx(
#else
tsdPtr->tty = isatty(0);
#endif
+#if defined(MAC_OSX_TK)
+ /*
+ * On TkAqua, if we don't have a TTY and stdin is a special character file
+ * of length 0, (e.g. /dev/null, which is what Finder sets when double
+ * clicking Wish) then use the GUI console.
+ */
+
+ if (!tsdPtr->tty) {
+ struct stat st;
+
+ nullStdin = fstat(0, &st) || (S_ISCHR(st.st_mode) && !st.st_blocks);
+ }
+#endif
Tcl_SetVar(interp, "tcl_interactive",
- ((path == NULL) && tsdPtr->tty) ? "1" : "0", TCL_GLOBAL_ONLY);
+ ((path == NULL) && (tsdPtr->tty || nullStdin)) ? "1" : "0",
+ TCL_GLOBAL_ONLY);
/*
* Invoke application-specific initialization.
diff --git a/generic/ttk/ttkGenStubs.tcl b/generic/ttk/ttkGenStubs.tcl
new file mode 100644
index 0000000..961f36b
--- /dev/null
+++ b/generic/ttk/ttkGenStubs.tcl
@@ -0,0 +1,887 @@
+# ttkGenStubs.tcl --
+#
+# This script generates a set of stub files for a given
+# interface.
+#
+#
+# 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.
+#
+# $Id: ttkGenStubs.tcl,v 1.1 2007/03/07 23:46:34 das Exp $
+#
+# SOURCE: tcl/tools/genStubs.tcl, revision 1.20
+#
+# CHANGES:
+# + Remove xxx_TCL_DECLARED #ifdeffery
+# + Use application-defined storage class specifier instead of "EXTERN"
+# + Add "epoch" and "revision" fields to stubs table record
+# + Remove dead code related to USE_*_STUB_PROCS (emitStubs, makeStub)
+# + Second argument to "declare" is used as a status guard
+# instead of a platform guard.
+# + Use void (*reserved$i)(void) = 0 instead of void *reserved$i = NULL
+# for unused stub entries, in case pointer-to-function and
+# pointer-to-object are different sizes.
+# + Allow trailing semicolon in function declarations
+# + stubs table is const-qualified
+#
+
+package require Tcl 8
+
+namespace eval genStubs {
+ # libraryName --
+ #
+ # The name of the entire library. This value is used to compute
+ # the USE_*_STUBS macro, the name of the init file, and others.
+
+ variable libraryName "UNKNOWN"
+
+ # interfaces --
+ #
+ # An array indexed by interface name that is used to maintain
+ # the set of valid interfaces. The value is empty.
+
+ array set interfaces {}
+
+ # curName --
+ #
+ # The name of the interface currently being defined.
+
+ variable curName "UNKNOWN"
+
+ # scspec --
+ #
+ # Storage class specifier for external function declarations.
+ # Normally "extern", may be set to something like XYZAPI
+ #
+ variable scspec "extern"
+
+ # epoch, revision --
+ #
+ # The epoch and revision numbers of the interface currently being defined.
+ # (@@@TODO: should be an array mapping interface names -> numbers)
+ #
+
+ variable epoch 0
+ variable revision 0
+
+ # hooks --
+ #
+ # An array indexed by interface name that contains the set of
+ # subinterfaces that should be defined for a given interface.
+
+ array set hooks {}
+
+ # stubs --
+ #
+ # This three dimensional array is indexed first by interface name,
+ # second by field name, and third by a numeric offset or the
+ # constant "lastNum". The lastNum entry contains the largest
+ # numeric offset used for a given interface.
+ #
+ # Field "decl,$i" contains the C function specification that
+ # should be used for the given entry in the stub table. The spec
+ # consists of a list in the form returned by parseDecl.
+ # Other fields TBD later.
+
+ array set stubs {}
+
+ # outDir --
+ #
+ # The directory where the generated files should be placed.
+
+ variable outDir .
+}
+
+# genStubs::library --
+#
+# This function is used in the declarations file to set the name
+# of the library that the interfaces are associated with (e.g. "tcl").
+# This value will be used to define the inline conditional macro.
+#
+# Arguments:
+# name The library name.
+#
+# Results:
+# None.
+
+proc genStubs::library {name} {
+ variable libraryName $name
+}
+
+# genStubs::interface --
+#
+# This function is used in the declarations file to set the name
+# of the interface currently being defined.
+#
+# Arguments:
+# name The name of the interface.
+#
+# Results:
+# None.
+
+proc genStubs::interface {name} {
+ variable curName $name
+ variable interfaces
+ variable stubs
+
+ set interfaces($name) {}
+ set stubs($name,lastNum) 0
+ return
+}
+
+# genStubs::scspec --
+#
+# Define the storage class macro used for external function declarations.
+# Typically, this will be a macro like XYZAPI or EXTERN that
+# expands to either DLLIMPORT or DLLEXPORT, depending on whether
+# -DBUILD_XYZ has been set.
+#
+proc genStubs::scspec {value} {
+ variable scspec $value
+}
+
+# genStubs::epoch --
+#
+# Define the epoch number for this library. The epoch
+# should be incrememented when a release is made that
+# contains incompatible changes to the public API.
+#
+proc genStubs::epoch {value} {
+ variable epoch $value
+}
+
+# genStubs::hooks --
+#
+# This function defines the subinterface hooks for the current
+# interface.
+#
+# Arguments:
+# names The ordered list of interfaces that are reachable through the
+# hook vector.
+#
+# Results:
+# None.
+
+proc genStubs::hooks {names} {
+ variable curName
+ variable hooks
+
+ set hooks($curName) $names
+ return
+}
+
+# genStubs::declare --
+#
+# This function is used in the declarations file to declare a new
+# interface entry.
+#
+# Arguments:
+# index The index number of the interface.
+# status Status of the interface: one of "current",
+# "deprecated", or "obsolete".
+# decl The C function declaration, or {} for an undefined
+# entry.
+#
+proc genStubs::declare {index status decl} {
+ variable stubs
+ variable curName
+ variable revision
+
+ incr revision
+
+ # Check for duplicate declarations, then add the declaration and
+ # bump the lastNum counter if necessary.
+
+ if {[info exists stubs($curName,decl,$index)]} {
+ puts stderr "Duplicate entry: $index"
+ }
+ regsub -all "\[ \t\n\]+" [string trim $decl] " " decl
+ set decl [parseDecl $decl]
+
+ set stubs($curName,status,$index) $status
+ set stubs($curName,decl,$index) $decl
+
+ if {$index > $stubs($curName,lastNum)} {
+ set stubs($curName,lastNum) $index
+ }
+
+ return
+}
+
+# genStubs::rewriteFile --
+#
+# This function replaces the machine generated portion of the
+# specified file with new contents. It looks for the !BEGIN! and
+# !END! comments to determine where to place the new text.
+#
+# Arguments:
+# file The name of the file to modify.
+# text The new text to place in the file.
+#
+# Results:
+# None.
+
+proc genStubs::rewriteFile {file text} {
+ if {![file exists $file]} {
+ puts stderr "Cannot find file: $file"
+ return
+ }
+ set in [open ${file} r]
+ set out [open ${file}.new w]
+
+ while {![eof $in]} {
+ set line [gets $in]
+ if {[string match "*!BEGIN!*" $line]} {
+ break
+ }
+ puts $out $line
+ }
+ puts $out "/* !BEGIN!: Do not edit below this line. */"
+ puts $out $text
+ while {![eof $in]} {
+ set line [gets $in]
+ if {[string match "*!END!*" $line]} {
+ break
+ }
+ }
+ puts $out "/* !END!: Do not edit above this line. */"
+ puts -nonewline $out [read $in]
+ close $in
+ close $out
+ file rename -force ${file}.new ${file}
+ return
+}
+
+# genStubs::addPlatformGuard --
+#
+# Wrap a string inside a platform #ifdef.
+#
+# Arguments:
+# plat Platform to test.
+#
+# Results:
+# Returns the original text inside an appropriate #ifdef.
+
+proc genStubs::addPlatformGuard {plat text} {
+ switch $plat {
+ win {
+ return "#ifdef __WIN32__\n${text}#endif /* __WIN32__ */\n"
+ }
+ unix {
+ return "#if !defined(__WIN32__) /* UNIX */\n${text}#endif /* UNIX */\n"
+ }
+ macosx {
+ return "#ifdef MAC_OSX_TCL\n${text}#endif /* MAC_OSX_TCL */\n"
+ }
+ aqua {
+ return "#ifdef MAC_OSX_TK\n${text}#endif /* MAC_OSX_TK */\n"
+ }
+ x11 {
+ return "#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */\n${text}#endif /* X11 */\n"
+ }
+ }
+ return "$text"
+}
+
+# genStubs::emitSlots --
+#
+# Generate the stub table slots for the given interface.
+#
+# Arguments:
+# name The name of the interface being emitted.
+# textVar The variable to use for output.
+#
+# Results:
+# None.
+
+proc genStubs::emitSlots {name textVar} {
+ upvar $textVar text
+ forAllStubs $name makeSlot noGuard text {" void (*reserved$i)(void);\n"}
+ return
+}
+
+# genStubs::parseDecl --
+#
+# Parse a C function declaration into its component parts.
+#
+# Arguments:
+# decl The function declaration.
+#
+# Results:
+# Returns a list of the form {returnType name args}. The args
+# element consists of a list of type/name pairs, or a single
+# element "void". If the function declaration is malformed
+# then an error is displayed and the return value is {}.
+
+proc genStubs::parseDecl {decl} {
+ if {![regexp {^(.*)\((.*)\);?$} $decl all prefix args]} {
+ set prefix $decl
+ set args {}
+ }
+ set prefix [string trim $prefix]
+ if {![regexp {^(.+[ ][*]*)([^ *]+)$} $prefix all rtype fname]} {
+ puts stderr "Bad return type: $decl"
+ return
+ }
+ set rtype [string trim $rtype]
+ if {$args == ""} {
+ return [list $rtype $fname {}]
+ }
+ foreach arg [split $args ,] {
+ lappend argList [string trim $arg]
+ }
+ if {![string compare [lindex $argList end] "..."]} {
+ set args TCL_VARARGS
+ foreach arg [lrange $argList 0 end-1] {
+ set argInfo [parseArg $arg]
+ if {[llength $argInfo] == 2 || [llength $argInfo] == 3} {
+ lappend args $argInfo
+ } else {
+ puts stderr "Bad argument: '$arg' in '$decl'"
+ return
+ }
+ }
+ } else {
+ set args {}
+ foreach arg $argList {
+ set argInfo [parseArg $arg]
+ if {![string compare $argInfo "void"]} {
+ lappend args "void"
+ break
+ } elseif {[llength $argInfo] == 2 || [llength $argInfo] == 3} {
+ lappend args $argInfo
+ } else {
+ puts stderr "Bad argument: '$arg' in '$decl'"
+ return
+ }
+ }
+ }
+ return [list $rtype $fname $args]
+}
+
+# genStubs::parseArg --
+#
+# This function parses a function argument into a type and name.
+#
+# Arguments:
+# arg The argument to parse.
+#
+# Results:
+# Returns a list of type and name with an optional third array
+# indicator. If the argument is malformed, returns "".
+
+proc genStubs::parseArg {arg} {
+ if {![regexp {^(.+[ ][*]*)([^][ *]+)(\[\])?$} $arg all type name array]} {
+ if {$arg == "void"} {
+ return $arg
+ } else {
+ return
+ }
+ }
+ set result [list [string trim $type] $name]
+ if {$array != ""} {
+ lappend result $array
+ }
+ return $result
+}
+
+# genStubs::makeDecl --
+#
+# Generate the prototype for a function.
+#
+# Arguments:
+# name The interface name.
+# decl The function declaration.
+# index The slot index for this function.
+#
+# Results:
+# Returns the formatted declaration string.
+
+proc genStubs::makeDecl {name decl index} {
+ variable scspec
+
+ lassign $decl rtype fname args
+
+ append text "/* $index */\n"
+ set line "$scspec $rtype"
+ set count [expr {2 - ([string length $line] / 8)}]
+ append line [string range "\t\t\t" 0 $count]
+ set pad [expr {24 - [string length $line]}]
+ if {$pad <= 0} {
+ append line " "
+ set pad 0
+ }
+ if {$args == ""} {
+ append line $fname
+ append text $line
+ append text ";\n"
+ return $text
+ }
+ append line "$fname "
+
+ set arg1 [lindex $args 0]
+ switch -exact $arg1 {
+ void {
+ append line "(void)"
+ }
+ TCL_VARARGS {
+ set sep "("
+ foreach arg [lrange $args 1 end] {
+ append line $sep
+ set next {}
+ append next [lindex $arg 0] " " [lindex $arg 1] \
+ [lindex $arg 2]
+ if {[string length $line] + [string length $next] \
+ + $pad > 76} {
+ append text $line \n
+ set line "\t\t\t\t"
+ set pad 28
+ }
+ append line $next
+ set sep ", "
+ }
+ append line ", ...)"
+ }
+ default {
+ set sep "("
+ foreach arg $args {
+ append line $sep
+ set next {}
+ append next [lindex $arg 0] " " [lindex $arg 1] \
+ [lindex $arg 2]
+ if {[string length $line] + [string length $next] \
+ + $pad > 76} {
+ append text $line \n
+ set line "\t\t\t\t"
+ set pad 28
+ }
+ append line $next
+ set sep ", "
+ }
+ append line ")"
+ }
+ }
+ append text $line
+
+ append text ";\n"
+ return $text
+}
+
+# genStubs::makeMacro --
+#
+# Generate the inline macro for a function.
+#
+# Arguments:
+# name The interface name.
+# decl The function declaration.
+# index The slot index for this function.
+#
+# Results:
+# Returns the formatted macro definition.
+
+proc genStubs::makeMacro {name decl index} {
+ lassign $decl rtype fname args
+
+ set lfname [string tolower [string index $fname 0]]
+ append lfname [string range $fname 1 end]
+
+ set text "#ifndef $fname\n#define $fname"
+ if {$args == ""} {
+ append text " \\\n\t(*${name}StubsPtr->$lfname)"
+ append text " /* $index */\n#endif\n"
+ return $text
+ }
+ append text " \\\n\t(${name}StubsPtr->$lfname)"
+ append text " /* $index */\n#endif\n"
+ return $text
+}
+
+# genStubs::makeSlot --
+#
+# Generate the stub table entry for a function.
+#
+# Arguments:
+# name The interface name.
+# decl The function declaration.
+# index The slot index for this function.
+#
+# Results:
+# Returns the formatted table entry.
+
+proc genStubs::makeSlot {name decl index} {
+ lassign $decl rtype fname args
+
+ set lfname [string tolower [string index $fname 0]]
+ append lfname [string range $fname 1 end]
+
+ set text " "
+ if {$args == ""} {
+ append text $rtype " *" $lfname "; /* $index */\n"
+ return $text
+ }
+ append text $rtype " (*" $lfname ") "
+
+ set arg1 [lindex $args 0]
+ switch -exact $arg1 {
+ void {
+ append text "(void)"
+ }
+ TCL_VARARGS {
+ set sep "("
+ foreach arg [lrange $args 1 end] {
+ append text $sep [lindex $arg 0] " " [lindex $arg 1] \
+ [lindex $arg 2]
+ set sep ", "
+ }
+ append text ", ...)"
+ }
+ default {
+ set sep "("
+ foreach arg $args {
+ append text $sep [lindex $arg 0] " " [lindex $arg 1] \
+ [lindex $arg 2]
+ set sep ", "
+ }
+ append text ")"
+ }
+ }
+
+ append text "; /* $index */\n"
+ return $text
+}
+
+# genStubs::makeInit --
+#
+# Generate the prototype for a function.
+#
+# Arguments:
+# name The interface name.
+# decl The function declaration.
+# index The slot index for this function.
+#
+# Results:
+# Returns the formatted declaration string.
+
+proc genStubs::makeInit {name decl index} {
+ if {[lindex $decl 2] == ""} {
+ append text " &" [lindex $decl 1] ", /* " $index " */\n"
+ } else {
+ append text " " [lindex $decl 1] ", /* " $index " */\n"
+ }
+ return $text
+}
+
+# genStubs::forAllStubs --
+#
+# This function iterates over all of the slots and invokes
+# a callback for each slot. The result of the callback is then
+# placed inside appropriate guards.
+#
+# Arguments:
+# name The interface name.
+# slotProc The proc to invoke to handle the slot. It will
+# have the interface name, the declaration, and
+# the index appended.
+# guardProc The proc to invoke to add guards. It will have
+# the slot status and text appended.
+# textVar The variable to use for output.
+# skipString The string to emit if a slot is skipped. This
+# string will be subst'ed in the loop so "$i" can
+# be used to substitute the index value.
+#
+# Results:
+# None.
+
+proc genStubs::forAllStubs {name slotProc guardProc textVar
+ {skipString {"/* Slot $i is reserved */\n"}}} {
+ variable stubs
+ upvar $textVar text
+
+ set lastNum $stubs($name,lastNum)
+
+ for {set i 0} {$i <= $lastNum} {incr i} {
+ if {[info exists stubs($name,decl,$i)]} {
+ append text [$guardProc $stubs($name,status,$i) \
+ [$slotProc $name $stubs($name,decl,$i) $i]]
+ } else {
+ eval {append text} $skipString
+ }
+ }
+}
+
+proc genStubs::noGuard {status text} { return $text }
+
+proc genStubs::addGuard {status text} {
+ variable libraryName
+ set upName [string toupper $libraryName]
+
+ switch -- $status {
+ current {
+ # No change
+ }
+ deprecated {
+ set text [ifdeffed "${upName}_DEPRECATED" $text]
+ }
+ obsolete {
+ set text ""
+ }
+ default {
+ puts stderr "Unrecognized status code $status"
+ }
+ }
+ return $text
+}
+
+proc genStubs::ifdeffed {macro text} {
+ join [list "#ifdef $macro" $text "#endif" ""] \n
+}
+
+# genStubs::emitDeclarations --
+#
+# This function emits the function declarations for this interface.
+#
+# Arguments:
+# name The interface name.
+# textVar The variable to use for output.
+#
+# Results:
+# None.
+
+proc genStubs::emitDeclarations {name textVar} {
+ variable libraryName
+ upvar $textVar text
+
+ set upName [string toupper $libraryName]
+ append text "\n#if !defined(USE_${upName}_STUBS)\n"
+ append text "\n/*\n * Exported function declarations:\n */\n\n"
+ forAllStubs $name makeDecl noGuard text
+ append text "\n#endif /* !defined(USE_${upName}_STUBS) */\n"
+
+ return
+}
+
+# genStubs::emitMacros --
+#
+# This function emits the inline macros for an interface.
+#
+# Arguments:
+# name The name of the interface being emitted.
+# textVar The variable to use for output.
+#
+# Results:
+# None.
+
+proc genStubs::emitMacros {name textVar} {
+ variable libraryName
+ upvar $textVar text
+
+ set upName [string toupper $libraryName]
+ append text "\n#if defined(USE_${upName}_STUBS)\n"
+ append text "\n/*\n * Inline function declarations:\n */\n\n"
+
+ forAllStubs $name makeMacro addGuard text
+
+ append text "\n#endif /* defined(USE_${upName}_STUBS) */\n"
+ return
+}
+
+# genStubs::emitHeader --
+#
+# This function emits the body of the <name>Decls.h file for
+# the specified interface.
+#
+# Arguments:
+# name The name of the interface being emitted.
+#
+# Results:
+# None.
+
+proc genStubs::emitHeader {name} {
+ variable outDir
+ variable hooks
+ variable epoch
+ variable revision
+
+ set capName [string toupper [string index $name 0]]
+ append capName [string range $name 1 end]
+
+ set CAPName [string toupper $name]
+ append text "\n"
+ append text "#define ${CAPName}_STUBS_EPOCH $epoch\n"
+ append text "#define ${CAPName}_STUBS_REVISION $revision\n"
+
+ emitDeclarations $name text
+
+ if {[info exists hooks($name)]} {
+ append text "\ntypedef struct ${capName}StubHooks {\n"
+ foreach hook $hooks($name) {
+ set capHook [string toupper [string index $hook 0]]
+ append capHook [string range $hook 1 end]
+ append text " struct ${capHook}Stubs *${hook}Stubs;\n"
+ }
+ append text "} ${capName}StubHooks;\n"
+ }
+ append text "\ntypedef struct ${capName}Stubs {\n"
+ append text " int magic;\n"
+ append text " int epoch;\n"
+ append text " int revision;\n"
+ append text " struct ${capName}StubHooks *hooks;\n\n"
+
+ emitSlots $name text
+
+ append text "} ${capName}Stubs;\n"
+
+ append text "\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n"
+ append text "extern const ${capName}Stubs *${name}StubsPtr;\n"
+ append text "#ifdef __cplusplus\n}\n#endif\n"
+
+ emitMacros $name text
+
+ rewriteFile [file join $outDir ${name}Decls.h] $text
+ return
+}
+
+# genStubs::emitInit --
+#
+# Generate the table initializers for an interface.
+#
+# Arguments:
+# name The name of the interface to initialize.
+# textVar The variable to use for output.
+#
+# Results:
+# Returns the formatted output.
+
+proc genStubs::emitInit {name textVar} {
+ variable hooks
+ variable epoch
+ variable revision
+
+ upvar $textVar text
+
+ set capName [string toupper [string index $name 0]]
+ append capName [string range $name 1 end]
+ set CAPName [string toupper $name]
+
+ if {[info exists hooks($name)]} {
+ append text "\nstatic ${capName}StubHooks ${name}StubHooks = \{\n"
+ set sep " "
+ foreach sub $hooks($name) {
+ append text $sep "&${sub}Stubs"
+ set sep ",\n "
+ }
+ append text "\n\};\n"
+ }
+ append text "\n${capName}Stubs ${name}Stubs = \{\n"
+ append text " TCL_STUB_MAGIC,\n"
+ append text " ${CAPName}_STUBS_EPOCH,\n"
+ append text " ${CAPName}_STUBS_REVISION,\n"
+ if {[info exists hooks($name)]} {
+ append text " &${name}StubHooks,\n"
+ } else {
+ append text " 0,\n"
+ }
+
+ forAllStubs $name makeInit noGuard text {" 0, /* $i */\n"}
+
+ append text "\};\n"
+ return
+}
+
+# genStubs::emitInits --
+#
+# This function emits the body of the <name>StubInit.c file for
+# the specified interface.
+#
+# Arguments:
+# name The name of the interface being emitted.
+#
+# Results:
+# None.
+
+proc genStubs::emitInits {} {
+ variable hooks
+ variable outDir
+ variable libraryName
+ variable interfaces
+
+ # Assuming that dependencies only go one level deep, we need to emit
+ # all of the leaves first to avoid needing forward declarations.
+
+ set leaves {}
+ set roots {}
+ foreach name [lsort [array names interfaces]] {
+ if {[info exists hooks($name)]} {
+ lappend roots $name
+ } else {
+ lappend leaves $name
+ }
+ }
+ foreach name $leaves {
+ emitInit $name text
+ }
+ foreach name $roots {
+ emitInit $name text
+ }
+
+ rewriteFile [file join $outDir ${libraryName}StubInit.c] $text
+}
+
+# genStubs::init --
+#
+# This is the main entry point.
+#
+# Arguments:
+# None.
+#
+# Results:
+# None.
+
+proc genStubs::init {} {
+ global argv argv0
+ variable outDir
+ variable interfaces
+
+ if {[llength $argv] < 2} {
+ puts stderr "usage: $argv0 outDir declFile ?declFile...?"
+ exit 1
+ }
+
+ set outDir [lindex $argv 0]
+
+ foreach file [lrange $argv 1 end] {
+ source $file
+ }
+
+ foreach name [lsort [array names interfaces]] {
+ puts "Emitting $name"
+ emitHeader $name
+ }
+
+ emitInits
+}
+
+# lassign --
+#
+# This function emulates the TclX lassign command.
+#
+# Arguments:
+# valueList A list containing the values to be assigned.
+# args The list of variables to be assigned.
+#
+# Results:
+# Returns any values that were not assigned to variables.
+
+if {[string length [namespace which lassign]] == 0} {
+proc lassign {valueList args} {
+ if {[llength $args] == 0} {
+ error "wrong # args: lassign list varname ?varname..?"
+ }
+
+ uplevel [list foreach $args $valueList {break}]
+ return [lrange $valueList [llength $args] end]
+}
+}
+
+genStubs::init
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
index c19a21a..9e94d6a 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -1,4 +1,4 @@
-/* $Id: ttkTreeview.c,v 1.14 2007/01/11 19:59:26 jenglish Exp $
+/* $Id: ttkTreeview.c,v 1.15 2007/03/07 23:46:34 das Exp $
* Copyright (c) 2004, Joe English
*
* ttk::treeview widget implementation.
@@ -3080,11 +3080,13 @@ TTK_END_LAYOUT
* +++ Tree indicator element.
*/
+#ifdef UNUSED
#if defined(WIN32)
static const int WIN32_XDRAWLINE_HACK = 1;
#else
static const int WIN32_XDRAWLINE_HACK = 0;
#endif
+#endif
typedef struct
{
diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c
index 7a9ca26..4562973 100644
--- a/generic/ttk/ttkWidget.c
+++ b/generic/ttk/ttkWidget.c
@@ -1,4 +1,4 @@
-/* $Id: ttkWidget.c,v 1.4 2007/01/03 05:06:25 nijtmans Exp $
+/* $Id: ttkWidget.c,v 1.5 2007/03/07 23:46:34 das Exp $
* Copyright (c) 2003, Joe English
*
* Ttk widget implementation, core widget utilities.
@@ -10,6 +10,10 @@
#include "ttkTheme.h"
#include "ttkWidget.h"
+#ifdef MAC_OSX_TK
+#define TK_NO_DOUBLE_BUFFERING 1
+#endif
+
/*------------------------------------------------------------------------
* +++ Internal helper routines.
*/
@@ -58,14 +62,17 @@ static void RedisplayWidget(ClientData recordPtr)
WidgetCore *corePtr = (WidgetCore *)recordPtr;
Tk_Window tkwin = corePtr->tkwin;
Drawable d;
+#ifndef TK_NO_DOUBLE_BUFFERING
XGCValues gcValues;
GC gc;
+#endif
corePtr->flags &= ~REDISPLAY_PENDING;
if (!Tk_IsMapped(tkwin)) {
return;
}
+#ifndef TK_NO_DOUBLE_BUFFERING
/*
* Get a Pixmap for drawing in the background:
*/
@@ -79,6 +86,9 @@ static void RedisplayWidget(ClientData recordPtr)
gcValues.function = GXcopy;
gcValues.graphics_exposures = False;
gc = Tk_GetGC(corePtr->tkwin, GCFunction|GCGraphicsExposures, &gcValues);
+#else
+ d = Tk_WindowId(tkwin);
+#endif
/*
* Recompute layout and draw widget contents:
@@ -86,6 +96,7 @@ static void RedisplayWidget(ClientData recordPtr)
corePtr->widgetSpec->layoutProc(recordPtr);
corePtr->widgetSpec->displayProc(recordPtr, d);
+#ifndef TK_NO_DOUBLE_BUFFERING
/*
* Copy to the screen.
*/
@@ -98,6 +109,7 @@ static void RedisplayWidget(ClientData recordPtr)
*/
Tk_FreePixmap(Tk_Display(tkwin), d);
Tk_FreeGC(Tk_Display(tkwin), gc);
+#endif
}
/* TtkRedisplayWidget --
diff --git a/macosx/Wish-Common.xcconfig b/macosx/Wish-Common.xcconfig
index 1500f88..08e041e 100644
--- a/macosx/Wish-Common.xcconfig
+++ b/macosx/Wish-Common.xcconfig
@@ -9,7 +9,7 @@
// See the file "license.terms" for information on usage and redistribution
// of this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
-// RCS: @(#) $Id: Wish-Common.xcconfig,v 1.1 2007/01/28 01:42:16 das Exp $
+// RCS: @(#) $Id: Wish-Common.xcconfig,v 1.2 2007/03/07 23:46:34 das Exp $
//
HEADER_SEARCH_PATHS = $(TK_SRCROOT)/generic $(TK_SRCROOT)/xlib $(DERIVED_FILE_DIR)/tcl $(DERIVED_FILE_DIR)/tk $(HEADER_SEARCH_PATHS)
@@ -21,8 +21,11 @@ OTHER_CFLAGS = -imacros $(DERIVED_FILE_DIR)/tcl/tclConfig.h $(OTHER_CFLAGS)
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
GCC_NO_COMMON_BLOCKS = YES
GCC_DYNAMIC_NO_PIC = YES
-WARNING_CFLAGS_GCC3 = -Wall -Wno-implicit-int -Wno-unused-parameter -Wno-deprecated-declarations $(WARNING_CFLAGS)
-WARNING_CFLAGS = -Wextra -Wno-missing-field-initializers $(WARNING_CFLAGS_GCC3)
+GCC = /usr/bin/gcc
+GCC_VERSION = 4.0
+CC = $(GCC)-$(GCC_VERSION)
+WARNING_CFLAGS_GCC3 = -Wall -Wno-implicit-int -Wno-unused-parameter -Wno-deprecated-declarations
+WARNING_CFLAGS = -Wextra -Wno-missing-field-initializers $(WARNING_CFLAGS_GCC3) $(WARNING_CFLAGS)
REZ_RESOURCE_MAP_READ_ONLY = YES
APPLICATION_INSTALL_PATH = /Applications/Utilities
BINDIR = $(PREFIX)/bin
diff --git a/macosx/Wish.xcodeproj/default.pbxuser b/macosx/Wish.xcodeproj/default.pbxuser
index eb4e7cd..853eaaa 100644
--- a/macosx/Wish.xcodeproj/default.pbxuser
+++ b/macosx/Wish.xcodeproj/default.pbxuser
@@ -14,6 +14,7 @@
};
sourceControlManager = F944EB9C08F798180049FDD4 /* Source Control */;
userBuildSettings = {
+ GCC = /usr/bin/gcc;
SYMROOT = "${SRCROOT}/../../build/tk";
};
};
diff --git a/macosx/Wish.xcodeproj/project.pbxproj b/macosx/Wish.xcodeproj/project.pbxproj
index 1f4be63..a0a4fbd 100644
--- a/macosx/Wish.xcodeproj/project.pbxproj
+++ b/macosx/Wish.xcodeproj/project.pbxproj
@@ -4121,6 +4121,7 @@
F9DB621F0B65AFDE00A370FB /* ReleasePPC10.3.9SDK */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ LDFLAGS = "-force_cpusubtype_ALL $(LDFLAGS)";
PRODUCT_NAME = Wish;
};
name = ReleasePPC10.3.9SDK;
@@ -4164,7 +4165,6 @@
baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */;
buildSettings = {
ARCHS = ppc;
- CC = "$(CC)-$(GCC_VERSION)";
CFLAGS = "$(PER_ARCH_CFLAGS_ppc) -fconstant-cfstrings $(CFLAGS)";
CPPFLAGS = "-arch ppc -D__CONSTANT_CFSTRINGS__ -DMAC_OS_X_VERSION_MIN_REQUIRED=1020 -nostdinc -isystem $(SDKROOT)/usr/include/gcc/darwin/$(GCC_VERSION) -isystem $(SDKROOT)/usr/include -F$(SDKROOT)/System/Library/Frameworks";
DEBUG_INFORMATION_FORMAT = stabs;
diff --git a/macosx/tkMacOSXDebug.c b/macosx/tkMacOSXDebug.c
index 4836a90..5537d1c 100644
--- a/macosx/tkMacOSXDebug.c
+++ b/macosx/tkMacOSXDebug.c
@@ -5,7 +5,7 @@
* regions, etc...
*
* Copyright 2001, Apple Computer, Inc.
- * Copyright (c) 2006 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -54,7 +54,7 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.10 2006/10/31 22:33:34 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.11 2007/03/07 23:46:34 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -494,7 +494,11 @@ TkMacOSXGetNamedDebugSymbol(const char* module, const char* symbol)
if (!addr) {
const struct mach_header *mh = NULL;
uint32_t i, n = _dyld_image_count();
+ size_t module_len;
+ if (module && *module) {
+ module_len = strlen(module);
+ }
for (i = 0; i < n; i++) {
if (module && *module) {
/* Find image with given module name */
@@ -505,7 +509,7 @@ TkMacOSXGetNamedDebugSymbol(const char* module, const char* symbol)
continue;
}
name = strrchr(path, '/') + 1;
- if (strncmp(name, module, strlen(name)) != 0) {
+ if (strncmp(name, module, module_len) != 0) {
continue;
}
}
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 177af09..a522a7a 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -5,7 +5,7 @@
# "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile.
#
-# RCS: @(#) $Id: Makefile.in,v 1.120 2006/12/13 23:04:33 hobbs Exp $
+# RCS: @(#) $Id: Makefile.in,v 1.121 2007/03/07 23:46:33 das Exp $
# Current Tk version; used in various names.
@@ -1430,8 +1430,7 @@ $(TTK_DIR)/ttkStubInit.c: $(TTK_DIR)/ttk.decls
genstubs:
$(TCL_EXE) $(TOOL_DIR)/genStubs.tcl $(GENERIC_DIR) \
$(GENERIC_DIR)/tk.decls $(GENERIC_DIR)/tkInt.decls
-# Need the Ttk specific genstubs as well
-# $(TCL_EXE) $(TOOL_DIR)/genStubs.tcl $(TTK_DIR) $(TTK_DIR)/ttk.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
diff --git a/unix/configure b/unix/configure
index 9487ac3..9a9b911 100755
--- a/unix/configure
+++ b/unix/configure
@@ -5938,7 +5938,7 @@ echo "${ECHO_T}$tcl_cv_ld_single_module" >&6
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 "${CFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4 && \
+ "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4 && \
LDFLAGS="$LDFLAGS -prebind"
LDFLAGS="$LDFLAGS -headerpad_max_install_names"
echo "$as_me:$LINENO: checking if ld accepts -search_paths_first flag" >&5
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 1ca5af3..d2e82c6 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -1656,7 +1656,7 @@ dnl AC_CHECK_TOOL(AR, ar)
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 "${CFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4 && \
+ "`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, [