Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98ddf300b2 |
+8
-1
@@ -123,9 +123,16 @@
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "itk/itk"]
|
||||
[submodule "itcl3/itcl"]
|
||||
path = itcl/itcl
|
||||
url = https://github.com/BRL-CAD/itcl
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "itk3/itk"]
|
||||
path = itk/itk
|
||||
url = https://github.com/BRL-CAD/itk
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "iwidgets/iwidgets"]
|
||||
|
||||
+3
-10
@@ -677,19 +677,12 @@ add_project(embree GROUPS "APPLESEED;OSPRAY")
|
||||
# static lib building on so we get the stub libraries.
|
||||
# https://www.tcl.tk
|
||||
set(TCL_ENABLE_TK ON CACHE BOOL "enable tk")
|
||||
# Tcl 8.6.18 bundles Itcl 4.3.7. Itk remains a separate upstream project.
|
||||
# Keep the compatibility floors distinct from the bundled versions so a newer
|
||||
# system installation can be used without changing the versions we ship.
|
||||
set(BEXT_ITCL_MIN_VERSION "4.3.0")
|
||||
set(BEXT_ITCL_BUNDLED_VERSION "4.3.7")
|
||||
set(BEXT_ITCL_BUNDLED_SOURCE_DIR
|
||||
"${CMAKE_SOURCE_DIR}/tcl/tcl/pkgs/itcl${BEXT_ITCL_BUNDLED_VERSION}"
|
||||
)
|
||||
set(BEXT_ITK_MIN_VERSION "4.2.3")
|
||||
set(BEXT_ITK_BUNDLED_VERSION "4.2.7")
|
||||
set(BEXT_ITCL_MIN_VERSION "3.4")
|
||||
set(BEXT_ITK_MIN_VERSION "3.4")
|
||||
set(BEXT_TK_COMPONENTS "archer;mged;bwish;rtwizard;brlman")
|
||||
add_project(tcl GROUPS "TCL")
|
||||
add_project(tk GROUPS "TCL")
|
||||
add_project(itcl GROUPS "TCL")
|
||||
add_project(itk GROUPS "TCL")
|
||||
add_project(iwidgets GROUPS "TCL")
|
||||
add_project(tkhtml GROUPS "TCL")
|
||||
|
||||
+3
-2
@@ -37,8 +37,9 @@ selection further.
|
||||
| `gte` | `USE_BRLCAD` | `noinstall` | `patch` | [repository](https://github.com/BRL-CAD/GeometricTools) |
|
||||
| `icu` | `USE_APPLESEED` | `install` | `patch` | [repository](https://github.com/BRL-CAD/icu) |
|
||||
| `ispc` | `USE_OSPRAY` | `install` | `bison`, `flex`, `patch`, `llvm`, `ncurses`, `zlib` | [repository](https://github.com/BRL-CAD/ispc) |
|
||||
| `itk` | `USE_TCL` | `install` | `patch`, `tcl`, `tk` | [repository](https://github.com/BRL-CAD/itk) |
|
||||
| `iwidgets` | `USE_TCL` | `install` | `patch`, `itk` | [repository](https://github.com/BRL-CAD/iwidgets) |
|
||||
| `itcl` | `USE_TCL` | `install` | `patch`, `tcl` | [repository](https://github.com/BRL-CAD/itcl) |
|
||||
| `itk` | `USE_TCL` | `install` | `patch`, `tcl`, `tk`, `itcl` | [repository](https://github.com/BRL-CAD/itk) |
|
||||
| `iwidgets` | `USE_TCL` | `install` | `patch`, `itcl`, `itk` | [repository](https://github.com/BRL-CAD/iwidgets) |
|
||||
| `jpeg` | `USE_APPLESEED`, `USE_BRLCAD`, `USE_GDAL` | `install` | `patch` | [repository](https://github.com/BRL-CAD/libjpeg-turbo) |
|
||||
| `lemon` | `USE_BRLCAD` | `noinstall` | `patch` | [repository](https://github.com/BRL-CAD/lemon) |
|
||||
| `lief` | `USE_BRLCAD` | `noinstall` | `patch` | [repository](https://github.com/BRL-CAD/LIEF) |
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
if (USE_BRLCAD)
|
||||
|
||||
# Decide if we're using ITcl
|
||||
cad_enable(ITCL "${BEXT_TK_COMPONENTS}")
|
||||
|
||||
else (USE_BRLCAD)
|
||||
|
||||
if (ENABLE_TCL AND NOT DEFINED ENABLE_ITCL)
|
||||
set(ENABLE_ITCL ON)
|
||||
endif (ENABLE_TCL AND NOT DEFINED ENABLE_ITCL)
|
||||
|
||||
endif (USE_BRLCAD)
|
||||
|
||||
# A bundled Tcl requires the matching bundled Itcl, even when a system
|
||||
# installation advertises the same package name.
|
||||
if (TARGET TCL_BLD AND NOT DISABLE_ITCL)
|
||||
set(ENABLE_ITCL ON)
|
||||
endif ()
|
||||
|
||||
if (NOT ENABLE_ITCL AND NOT DEFINED DISABLE_ITCL)
|
||||
|
||||
find_package(ITCL)
|
||||
|
||||
if (NOT ITCL_FOUND AND NOT DEFINED ENABLE_ITCL)
|
||||
set(ENABLE_ITCL "ON" CACHE BOOL "Enable itcl build")
|
||||
endif (NOT ITCL_FOUND AND NOT DEFINED ENABLE_ITCL)
|
||||
|
||||
endif (NOT ENABLE_ITCL AND NOT DEFINED DISABLE_ITCL)
|
||||
set(ENABLE_ITCL "${ENABLE_ITCL}" CACHE BOOL "Enable itcl build")
|
||||
|
||||
if (ENABLE_ITCL)
|
||||
|
||||
git_submodule_init(itcl configure.in)
|
||||
|
||||
RegisterDeps(ITCL)
|
||||
|
||||
# Itcl3 has a problem in that it requires internal Tcl headers.
|
||||
# Occasionally (but not always) we can get these headers from
|
||||
# a system include path.
|
||||
|
||||
if (NOT TARGET TCL_BLD)
|
||||
# If we're not building the bundled Tcl, see if the system
|
||||
# Tcl gives us the private headers.
|
||||
set(CMAKE_FIND_FRAMEWORK NEVER)
|
||||
find_package(TCL)
|
||||
set(HDRS_CANDIDATE_DIR ${TCL_INCLUDE_PATH}8.6/tcl-private)
|
||||
if (EXISTS ${HDRS_CANDIDATE_DIR})
|
||||
set(TCL_PRIVATE_HDRS ${HDRS_CANDIDATE_DIR}/generic)
|
||||
if(NOT WIN32)
|
||||
set(TCL_PRIVATE_HDRS_OS ${HDRS_CANDIDATE_DIR}/unix)
|
||||
else(NOT WIN32)
|
||||
set(TCL_PRIVATE_HDRS_OS ${HDRS_CANDIDATE_DIR}/win)
|
||||
endif(NOT WIN32)
|
||||
endif (EXISTS ${HDRS_CANDIDATE_DIR})
|
||||
endif (NOT TARGET TCL_BLD)
|
||||
|
||||
|
||||
# If we can't find them from the system, see if we have a local
|
||||
# clone of Tcl to use
|
||||
if (NOT TCL_PRIVATE_HDRS AND EXISTS ${CMAKE_SOURCE_DIR}/tcl/tcl)
|
||||
set(TCL_SOURCE_DIR ${CMAKE_SOURCE_DIR}/tcl/tcl)
|
||||
set(TCL_PRIVATE_HDRS ${TCL_SOURCE_DIR}/generic)
|
||||
if(NOT WIN32)
|
||||
set(TCL_PRIVATE_HDRS_OS ${TCL_SOURCE_DIR}/unix)
|
||||
else(NOT WIN32)
|
||||
set(TCL_PRIVATE_HDRS_OS ${TCL_SOURCE_DIR}/win)
|
||||
endif(NOT WIN32)
|
||||
endif (NOT TCL_PRIVATE_HDRS AND EXISTS ${CMAKE_SOURCE_DIR}/tcl/tcl)
|
||||
|
||||
|
||||
|
||||
# We need to know where the ITcl sources will wind up for some of
|
||||
# this logic
|
||||
set(ITCL_SRC_CPY_TGT "${CMAKE_CURRENT_BINARY_DIR}/ITCL_BLD-prefix/src/ITCL_BLD")
|
||||
|
||||
# If we STILL don't have anything, patch the Itcl sources to add
|
||||
# the headers in question
|
||||
set(TCL_HDRS_PATCH_CMD)
|
||||
if (NOT TCL_PRIVATE_HDRS)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.26.0")
|
||||
set(TCL_HDRS_PATCH_CMD ${CMAKE_COMMAND};-E;copy_directory;${CMAKE_CURRENT_SOURCE_DIR}/addfiles/tcl_hdrs;${ITCL_SRC_CPY_TGT}/tcl_hdrs)
|
||||
else()
|
||||
set(TCL_HDRS_PATCH_CMD ${CMAKE_COMMAND};-E;copy_directory_if_different;${CMAKE_CURRENT_SOURCE_DIR}/addfiles/tcl_hdrs;${ITCL_SRC_CPY_TGT}/tcl_hdrs)
|
||||
endif()
|
||||
set(TCL_PRIVATE_HDRS "${ITCL_SRC_CPY_TGT}/tcl_hdrs")
|
||||
if(NOT WIN32)
|
||||
set(TCL_PRIVATE_HDRS_OS ${TCL_PRIVATE_HDRS}/unix)
|
||||
else(NOT WIN32)
|
||||
set(TCL_PRIVATE_HDRS_OS ${TCL_PRIVATE_HDRS}/win)
|
||||
endif(NOT WIN32)
|
||||
endif (NOT TCL_PRIVATE_HDRS)
|
||||
|
||||
|
||||
# When building ITCL, its path setup must take into account the subdirectory
|
||||
# in which we are storing the library.
|
||||
set(RPATH_SUFFIX itcl3.4)
|
||||
|
||||
|
||||
ExternalProject_Add(ITCL_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/itcl"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/itcl.patch
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${ITCL_SRC_CPY_TGT}/CMake
|
||||
COMMAND ${TCL_HDRS_PATCH_CMD}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/addfiles/CMakeLists.txt ${ITCL_SRC_CPY_TGT}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/addfiles/FindTCL.cmake ${ITCL_SRC_CPY_TGT}/CMake
|
||||
CMAKE_ARGS
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
-DBIN_DIR=$<IF:$<BOOL:${WIN32}>,${LIB_DIR},${BIN_DIR}>
|
||||
-DLIB_DIR=${LIB_DIR}
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BUNDLE_INSTALL_PREFIX}
|
||||
-DCMAKE_INSTALL_RPATH=${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR}/${RPATH_SUFFIX}
|
||||
-DINCLUDE_DIR=${INCLUDE_DIR}
|
||||
-DSHARED_DIR=${LIB_DIR}
|
||||
-DTCL_ENABLE_TK=ON
|
||||
-DTCL_ROOT=$<$<BOOL:${TCL_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DTCL_PRIVATE_HDRS=${TCL_PRIVATE_HDRS}
|
||||
-DTCL_PRIVATE_HDRS_OS=${TCL_PRIVATE_HDRS_OS}
|
||||
LOG_CONFIGURE ${EXT_BUILD_QUIET}
|
||||
LOG_BUILD ${EXT_BUILD_QUIET}
|
||||
LOG_INSTALL ${EXT_BUILD_QUIET}
|
||||
LOG_OUTPUT_ON_FAILURE ${EXT_BUILD_QUIET}
|
||||
STEP_TARGETS install
|
||||
)
|
||||
|
||||
TargetInstallDeps(ITCL ITCL_DEPENDS)
|
||||
|
||||
# Copy the license into position in CMAKE_BUNDLE_INSTALL_PREFIX
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/itcl/license.terms
|
||||
${DOC_LICENSE_DIR}/itcl3.txt
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
endif (ENABLE_ITCL)
|
||||
|
||||
mark_as_advanced(ITCL_LIBRARY)
|
||||
mark_as_advanced(ITCL_LIBRARIES)
|
||||
mark_as_advanced(ITCL_VERSION)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -0,0 +1,222 @@
|
||||
# C M A K E L I S T S . T X T
|
||||
# ITCL
|
||||
#
|
||||
# Copyright (c) 2010 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
#
|
||||
# 3. The name of the author may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# *******************************************************************
|
||||
# *** ITCL CMakeLists.txt ***
|
||||
# *******************************************************************
|
||||
|
||||
# Minimum required version of CMake
|
||||
cmake_minimum_required(VERSION 3.18)
|
||||
|
||||
# set CMake project name
|
||||
project(ITCL)
|
||||
|
||||
# install(CODE) uses generator expressions - requires 3.14 or newer.
|
||||
# We want it to be on, but until we can bump our minimum requirement
|
||||
# set it to OLD to make sure we don't break anything.
|
||||
if (POLICY CMP0087)
|
||||
cmake_policy(SET CMP0087 OLD)
|
||||
endif (POLICY CMP0087)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
|
||||
|
||||
set(CMAKE_FIND_FRAMEWORK NEVER)
|
||||
find_package(TCL)
|
||||
|
||||
# version numbers
|
||||
set(ITCL_VERSION_MAJOR 3)
|
||||
set(ITCL_VERSION_MINOR 4)
|
||||
set(ITCL_PATCH_LEVEL 3)
|
||||
|
||||
set(ITCL_VERSION "${ITCL_VERSION_MAJOR}.${ITCL_VERSION_MINOR}")
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Initialize some relative variable names
|
||||
if(NOT BIN_DIR)
|
||||
if (WIN32)
|
||||
set(BIN_DIR lib)
|
||||
else (WIN32)
|
||||
set(BIN_DIR bin)
|
||||
endif (WIN32)
|
||||
endif(NOT BIN_DIR)
|
||||
if(NOT SHARED_DIR)
|
||||
set(SHARED_DIR lib)
|
||||
endif(NOT SHARED_DIR)
|
||||
if(NOT LIB_DIR)
|
||||
set(LIB_DIR lib)
|
||||
endif(NOT LIB_DIR)
|
||||
if(NOT INCLUDE_DIR)
|
||||
set(INCLUDE_DIR include)
|
||||
endif(NOT INCLUDE_DIR)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# First, get some standard options out of the way
|
||||
add_definitions(-DSTDC_HEADERS=1)
|
||||
|
||||
# We're building Itcl
|
||||
add_definitions(-DBUILD_itcl)
|
||||
|
||||
# Use fPIC if we have it
|
||||
include(CheckCCompilerFlag)
|
||||
check_c_compiler_flag(-fPIC HAVE_PIC_COMPILER_FLAG)
|
||||
if(HAVE_PIC_COMPILER_FLAG)
|
||||
add_definitions(-fPIC)
|
||||
endif(HAVE_PIC_COMPILER_FLAG)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Header checks.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
include(CMakeParseArguments)
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckCSourceCompiles)
|
||||
function(Tcl_Check_Include_File filename)
|
||||
cmake_parse_arguments(OPT "USE" "" "" ${ARGN})
|
||||
string(REPLACE "." "_" var "${filename}")
|
||||
string(REPLACE "/" "_" var "${var}")
|
||||
string(TOUPPER "${var}" var)
|
||||
check_include_files(${filename} HAVE_${var})
|
||||
if(HAVE_${var})
|
||||
set(CVAR HAVE_${var})
|
||||
if(OPT_USE)
|
||||
# Usability test requested - we're not done yet.
|
||||
check_c_source_compiles("#include <${filename}>\nint main() {return 0;}" ${var}_USABLE)
|
||||
if(${var}_USABLE)
|
||||
set(HAVE_${var} 1 PARENT_SCOPE)
|
||||
set(${CVAR} 1 PARENT_SCOPE)
|
||||
add_definitions(-D${CVAR}=1)
|
||||
endif(${var}_USABLE)
|
||||
else(OPT_USE)
|
||||
set(HAVE_${var} 1 PARENT_SCOPE)
|
||||
set(${CVAR} 1 PARENT_SCOPE)
|
||||
add_definitions(-D${CVAR}=1)
|
||||
endif(OPT_USE)
|
||||
endif(HAVE_${var})
|
||||
endfunction(Tcl_Check_Include_File)
|
||||
|
||||
Tcl_Check_Include_File(sys/types.h)
|
||||
Tcl_Check_Include_File(sys/stat.h)
|
||||
Tcl_Check_Include_File(stdlib.h)
|
||||
Tcl_Check_Include_File(string.h)
|
||||
Tcl_Check_Include_File(strings.h)
|
||||
Tcl_Check_Include_File(memory.h)
|
||||
Tcl_Check_Include_File(inttypes.h)
|
||||
Tcl_Check_Include_File(stdint.h)
|
||||
Tcl_Check_Include_File(unistd.h)
|
||||
Tcl_Check_Include_File(net/errno.h)
|
||||
Tcl_Check_Include_File(dirent.h)
|
||||
Tcl_Check_Include_File(errno.h USE)
|
||||
Tcl_Check_Include_File(float.h USE)
|
||||
Tcl_Check_Include_File(values.h USE)
|
||||
Tcl_Check_Include_File(limits.h USE)
|
||||
Tcl_Check_Include_File(sys/wait.h USE)
|
||||
Tcl_Check_Include_File(dlfcn.h USE)
|
||||
Tcl_Check_Include_File(sys/param.h USE)
|
||||
|
||||
set(ITCL_SRCS
|
||||
generic/itclStubInit.c
|
||||
generic/itclStubLib.c
|
||||
generic/itcl_bicmds.c
|
||||
generic/itcl_class.c
|
||||
generic/itcl_cmds.c
|
||||
generic/itcl_ensemble.c
|
||||
generic/itcl_linkage.c
|
||||
generic/itcl_methods.c
|
||||
generic/itcl_migrate.c
|
||||
generic/itcl_objects.c
|
||||
generic/itcl_parse.c
|
||||
generic/itcl_util.c
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
set(ITCL_SRCS ${ITCL_SRCS} win/dllEntryPoint.c)
|
||||
endif(WIN32)
|
||||
|
||||
set(ITCL_STUB_SRCS generic/itclStubLib.c)
|
||||
|
||||
set(ITCL_INCLUDE_PATH ${ITCL_SOURCE_DIR}/generic ${ITCL_BINARY_DIR}/include)
|
||||
mark_as_advanced(ITCL_INCLUDE_PATH)
|
||||
|
||||
# ITcl requires private Tcl headers, which we can't always assume from a system
|
||||
# install of Tcl. Require the build to tell us where to look
|
||||
if (NOT DEFINED TCL_PRIVATE_HDRS)
|
||||
message(FATAL_ERROR "Itcl3 needs to know where to find the Tcl private headers")
|
||||
endif (NOT DEFINED TCL_PRIVATE_HDRS)
|
||||
|
||||
include_directories(
|
||||
${TCL_INCLUDE_PATH}
|
||||
${ITCL_INCLUDE_PATH}
|
||||
${TCL_PRIVATE_HDRS};${TCL_PRIVATE_HDRS_OS}
|
||||
)
|
||||
|
||||
add_library(itcl${ITCL_VERSION} SHARED ${ITCL_SRCS})
|
||||
target_link_libraries(itcl${ITCL_VERSION} ${M_LIBRARY} ${TCL_STUB_LIBRARY} )
|
||||
set_property(TARGET itcl${ITCL_VERSION} APPEND PROPERTY COMPILE_DEFINITIONS USE_TCL_STUBS)
|
||||
install(TARGETS itcl${ITCL_VERSION}
|
||||
RUNTIME DESTINATION ${BIN_DIR}/itcl${ITCL_VERSION}
|
||||
LIBRARY DESTINATION ${SHARED_DIR}/itcl${ITCL_VERSION}
|
||||
ARCHIVE DESTINATION ${LIB_DIR}/itcl${ITCL_VERSION})
|
||||
|
||||
add_library(itclstub STATIC ${ITCL_STUB_SRCS})
|
||||
install(TARGETS itclstub
|
||||
RUNTIME DESTINATION ${BIN_DIR}/itcl${ITCL_VERSION}
|
||||
LIBRARY DESTINATION ${LIB_DIR}/itcl${ITCL_VERSION}
|
||||
ARCHIVE DESTINATION ${LIB_DIR}/itcl${ITCL_VERSION})
|
||||
set_property(TARGET itclstub APPEND PROPERTY COMPILE_DEFINITIONS USE_TCL_STUBS)
|
||||
|
||||
# Create pkgIndex.tcl files
|
||||
file(GENERATE
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl"
|
||||
CONTENT "
|
||||
if {![package vsatisfies [package provide Tcl] 8.5]} {return}
|
||||
package ifneeded Itcl ${ITCL_VERSION} [list load [file join $dir ../../${SHARED_DIR}/itcl${ITCL_VERSION} $<TARGET_FILE_NAME:itcl${ITCL_VERSION}>] Itcl]
|
||||
")
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl DESTINATION ${LIB_DIR}/itcl${ITCL_VERSION})
|
||||
|
||||
install(FILES library/itcl.tcl DESTINATION ${LIB_DIR}/itcl${ITCL_VERSION})
|
||||
|
||||
set(ITCL_HDRS
|
||||
generic/itcl.h
|
||||
generic/itclDecls.h
|
||||
generic/itclInt.h
|
||||
generic/itclIntDecls.h
|
||||
)
|
||||
install(FILES ${ITCL_HDRS} DESTINATION ${INCLUDE_DIR})
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -0,0 +1,554 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindTCL
|
||||
-------
|
||||
|
||||
This module finds if Tcl is installed and determines where the include
|
||||
files and libraries are. It also determines what the name of the
|
||||
library is. This code sets the following variables:
|
||||
|
||||
::
|
||||
|
||||
TCL_FOUND = Tcl was found
|
||||
TCLSH_FOUND = TRUE if tclsh has been found
|
||||
TCL_LIBRARY = path to Tcl library (tcl tcl80)
|
||||
TCL_INCLUDE_PATH = path to where tcl.h can be found
|
||||
TCL_TCLSH = path to tclsh binary (tcl tcl80)
|
||||
|
||||
|
||||
|
||||
If TCL_ENABLE_TK is set, the following are also set:
|
||||
|
||||
::
|
||||
|
||||
TK_FOUND = Tk was found
|
||||
TCLTK_FOUND = Tcl and Tk were found
|
||||
TK_LIBRARY = path to Tk library (tk tk80 etc)
|
||||
TK_INCLUDE_PATH = path to where tk.h can be found
|
||||
TK_WISH = full path to the wish executable
|
||||
TCL_STUB_LIBRARY = path to Tcl stub library
|
||||
TK_STUB_LIBRARY = path to Tk stub library
|
||||
TTK_STUB_LIBRARY = path to ttk stub library
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
|
||||
set(_TCL_SEARCHES)
|
||||
|
||||
# Search TCL_ROOT first if it is set.
|
||||
if(TCL_ROOT)
|
||||
set(_TCL_SEARCH_ROOT PATHS ${TCL_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _TCL_SEARCHES _TCL_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
get_filename_component(
|
||||
ActiveTcl_CurrentVersion
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]"
|
||||
NAME
|
||||
)
|
||||
set(
|
||||
TCLTK_POSSIBLE_BIN_PATHS
|
||||
${TCLTK_POSSIBLE_BIN_PATHS}
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/bin"
|
||||
)
|
||||
|
||||
get_filename_component(
|
||||
ActiveTcl_CurrentVersion
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]"
|
||||
NAME
|
||||
)
|
||||
set(
|
||||
TCLTK_POSSIBLE_LIB_PATHS
|
||||
${TCLTK_POSSIBLE_LIB_PATHS}
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/lib"
|
||||
"$ENV{ProgramFiles}/Tcl/Lib"
|
||||
"C:/Program Files/Tcl/lib"
|
||||
"C:/Tcl/lib"
|
||||
)
|
||||
|
||||
set(
|
||||
TCLTK_POSSIBLE_INCLUDE_PATHS
|
||||
${TCLTK_POSSIBLE_INCLUDE_PATHS}
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/include"
|
||||
"$ENV{ProgramFiles}/Tcl/include"
|
||||
"C:/Program Files/Tcl/include"
|
||||
"C:/Tcl/include"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(
|
||||
TCL_TCLSH_NAMES
|
||||
tclsh
|
||||
tclsh${TCL_LIBRARY_VERSION}
|
||||
tclsh${TK_LIBRARY_VERSION}
|
||||
tclsh${TK_WISH_VERSION}
|
||||
tclsh87
|
||||
tclsh8.7
|
||||
tclsh86
|
||||
tclsh8.6
|
||||
tclsh85
|
||||
tclsh8.5
|
||||
tclsh84
|
||||
tclsh8.4
|
||||
tclsh83
|
||||
tclsh8.3
|
||||
tclsh82
|
||||
tclsh8.2
|
||||
tclsh80
|
||||
tclsh8.0
|
||||
)
|
||||
if(CYGWIN)
|
||||
set(TCL_TCLSH_NAMES ${TCL_TCLSH_NAMES} cygtclsh83 cygtclsh80)
|
||||
endif(CYGWIN)
|
||||
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_program(TCL_TCLSH NAMES ${TCL_TCLSH_NAMES} ${${search}} PATH_SUFFIXES bin)
|
||||
endforeach()
|
||||
if(NOT TCL_TCLSH)
|
||||
find_program(TCL_TCLSH NAMES ${TCL_TCLSH_NAMES} HINTS ${TCLTK_POSSIBLE_BIN_PATHS})
|
||||
endif(NOT TCL_TCLSH)
|
||||
|
||||
if(TCL_ENABLE_TK)
|
||||
set(
|
||||
TK_WISH_NAMES
|
||||
wish
|
||||
wish${TCL_LIBRARY_VERSION}
|
||||
wish${TK_LIBRARY_VERSION}
|
||||
wish${TCL_TCLSH_VERSION}
|
||||
wish86
|
||||
wish8.6
|
||||
wish85
|
||||
wish8.5
|
||||
wish84
|
||||
wish8.4
|
||||
wish83
|
||||
wish8.3
|
||||
wish82
|
||||
wish8.2
|
||||
wish80
|
||||
wish8.0
|
||||
)
|
||||
|
||||
if(CYGWIN)
|
||||
set(TK_WISH_NAMES ${TK_WISH_NAMES} cygwish80)
|
||||
endif()
|
||||
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_program(TK_WISH NAMES ${TK_WISH_NAMES} ${${search}} PATH_SUFFIXES bin)
|
||||
endforeach()
|
||||
if(NOT TK_WISH)
|
||||
find_program(TK_WISH NAMES ${TK_WISH_NAMES} HINTS ${TCLTK_POSSIBLE_BIN_PATHS})
|
||||
endif(NOT TK_WISH)
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
if(TCLSH_VERSION_STRING)
|
||||
set(TCL_TCLSH_VERSION "${TCLSH_VERSION_STRING}")
|
||||
else()
|
||||
get_filename_component(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH)
|
||||
get_filename_component(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH)
|
||||
string(REGEX REPLACE "^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}")
|
||||
endif()
|
||||
|
||||
set(TCLTK_POSSIBLE_LIB_PATHS "${TCL_INCLUDE_PATH_PARENT}/lib" "${TCL_LIBRARY_PATH}" "${TCL_TCLSH_PATH_PARENT}/lib")
|
||||
if(TCL_ENABLE_TK)
|
||||
set(
|
||||
TCLTK_POSSIBLE_LIB_PATHS
|
||||
${TCLTK_POSSIBLE_LIB_PATHS}
|
||||
"${TK_INCLUDE_PATH_PARENT}/lib"
|
||||
"${TK_LIBRARY_PATH}"
|
||||
"${TK_WISH_PATH_PARENT}/lib"
|
||||
)
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
set(
|
||||
TCLTK_POSSIBLE_LIB_PATH_SUFFIXES
|
||||
lib
|
||||
lib/tcl
|
||||
lib/tcl/tcl8.7
|
||||
lib/tcl/tcl8.6
|
||||
lib/tcl/tcl8.5
|
||||
lib/tcl/tcl8.4
|
||||
)
|
||||
if(TCL_ENABLE_TK)
|
||||
set(
|
||||
TCLTK_POSSIBLE_LIB_PATH_SUFFIXES
|
||||
${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
lib/tcl/tk8.7
|
||||
lib/tcl/tk8.6
|
||||
lib/tcl/tk8.5
|
||||
lib/tcl/tk8.4
|
||||
)
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
set(
|
||||
TCL_POSSIBLE_LIB_NAMES
|
||||
tcl
|
||||
tcl${TCL_LIBRARY_VERSION}
|
||||
tcl${TCL_TCLSH_VERSION}
|
||||
tcl${TK_WISH_VERSION}
|
||||
tcl87
|
||||
tcl8.7
|
||||
tcl87t
|
||||
tcl8.7t
|
||||
tcl86
|
||||
tcl8.6
|
||||
tcl86t
|
||||
tcl8.6t
|
||||
tcl85
|
||||
tcl8.5
|
||||
tcl84
|
||||
tcl8.4
|
||||
tcl83
|
||||
tcl8.3
|
||||
tcl82
|
||||
tcl8.2
|
||||
tcl80
|
||||
tcl8.0
|
||||
)
|
||||
|
||||
if(NOT TCL_LIBRARY)
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_library(
|
||||
TCL_LIBRARY
|
||||
NAMES ${TCL_POSSIBLE_LIB_NAMES}
|
||||
NAMES_PER_DIR
|
||||
${${search}}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT TCL_LIBRARY)
|
||||
find_library(
|
||||
TCL_LIBRARY
|
||||
NAMES ${TCL_POSSIBLE_LIB_NAMES}
|
||||
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endif(NOT TCL_LIBRARY)
|
||||
|
||||
set(
|
||||
TCLSTUB_POSSIBLE_LIB_NAMES
|
||||
tclstub
|
||||
tclstub${TK_LIBRARY_VERSION}
|
||||
tclstub${TCL_TCLSH_VERSION}
|
||||
tclstub${TK_WISH_VERSION}
|
||||
tclstub87
|
||||
tclstub8.7
|
||||
tclstub86
|
||||
tclstub8.6
|
||||
tclstub85
|
||||
tclstub8.5
|
||||
tclstub84
|
||||
tclstub8.4
|
||||
tclstub83
|
||||
tclstub8.3
|
||||
tclstub82
|
||||
tclstub8.2
|
||||
tclstub80
|
||||
tclstub8.0
|
||||
)
|
||||
if(NOT TCL_STUB_LIBRARY)
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_library(
|
||||
TCL_STUB_LIBRARY
|
||||
NAMES ${TCLSTUB_POSSIBLE_LIB_NAMES}
|
||||
NAMES_PER_DIR
|
||||
${${search}}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT TCL_STUB_LIBRARY)
|
||||
find_library(TCL_STUB_LIBRARY NAMES ${TCLSTUB_POSSIBLE_LIB_NAMES} PATHS ${TCLTK_POSSIBLE_LIB_PATHS})
|
||||
endif()
|
||||
|
||||
if(TCL_ENABLE_TK)
|
||||
set(
|
||||
TK_POSSIBLE_LIB_NAMES
|
||||
tk
|
||||
tk${TK_LIBRARY_VERSION}
|
||||
tk${TCL_TCLSH_VERSION}
|
||||
tk${TK_WISH_VERSION}
|
||||
tk87
|
||||
tk8.7
|
||||
tk87t
|
||||
tk8.7t
|
||||
tk86
|
||||
tk8.6
|
||||
tk86t
|
||||
tk8.6t
|
||||
tk85
|
||||
tk8.5
|
||||
tk84
|
||||
tk8.4
|
||||
tk83
|
||||
tk8.3
|
||||
tk82
|
||||
tk8.2
|
||||
tk80
|
||||
tk8.0
|
||||
)
|
||||
|
||||
if(NOT TK_LIBRARY)
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_library(
|
||||
TK_LIBRARY
|
||||
NAMES ${TK_POSSIBLE_LIB_NAMES}
|
||||
NAMES_PER_DIR
|
||||
${${search}}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT TK_LIBRARY)
|
||||
find_library(
|
||||
TK_LIBRARY
|
||||
NAMES ${TK_POSSIBLE_LIB_NAMES}
|
||||
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endif(NOT TK_LIBRARY)
|
||||
|
||||
set(
|
||||
TK_STUB_POSSIBLE_LIB_NAMES
|
||||
tkstub
|
||||
tkstub${TCL_LIBRARY_VERSION}
|
||||
tkstub${TCL_TCLSH_VERSION}
|
||||
tkstub${TK_WISH_VERSION}
|
||||
tkstub87
|
||||
tkstub8.7
|
||||
tkstub86
|
||||
tkstub8.6
|
||||
tkstub85
|
||||
tkstub8.5
|
||||
tkstub84
|
||||
tkstub8.4
|
||||
tkstub83
|
||||
tkstub8.3
|
||||
tkstub82
|
||||
tkstub8.2
|
||||
tkstub80
|
||||
tkstub8.0
|
||||
)
|
||||
|
||||
if(NOT TK_STUB_LIBRARY)
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_library(
|
||||
TK_STUB_LIBRARY
|
||||
NAMES ${TK_STUB_POSSIBLE_LIB_NAMES}
|
||||
NAMES_PER_DIR
|
||||
${${search}}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT TK_STUB_LIBRARY)
|
||||
find_library(TK_STUB_LIBRARY NAMES ${TK_STUB_POSSIBLE_LIB_NAMES} PATHS ${TCLTK_POSSIBLE_LIB_PATHS})
|
||||
endif()
|
||||
|
||||
set(
|
||||
TTK_STUB_POSSIBLE_LIB_NAMES
|
||||
ttkstub
|
||||
ttkstub${TCL_LIBRARY_VERSION}
|
||||
ttkstub${TCL_TCLSH_VERSION}
|
||||
ttkstub${TK_WISH_VERSION}
|
||||
ttkstub88
|
||||
ttkstub8.8
|
||||
ttkstub87
|
||||
ttkstub8.7
|
||||
ttkstub86
|
||||
ttkstub8.6
|
||||
ttkstub85
|
||||
ttkstub8.5
|
||||
)
|
||||
|
||||
if(NOT TTK_STUB_LIBRARY)
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_library(
|
||||
TTK_STUB_LIBRARY
|
||||
NAMES ${TTK_STUB_POSSIBLE_LIB_NAMES}
|
||||
NAMES_PER_DIR
|
||||
${${search}}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT TTK_STUB_LIBRARY)
|
||||
find_library(TTK_STUB_LIBRARY NAMES ${TTK_STUB_POSSIBLE_LIB_NAMES} PATHS ${TCLTK_POSSIBLE_LIB_PATHS})
|
||||
endif()
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
set(
|
||||
TCLTK_POSSIBLE_INCLUDE_PATHS
|
||||
"${TCL_LIBRARY_PATH_PARENT}/include"
|
||||
"${TCL_INCLUDE_PATH}"
|
||||
"${TCL_TCLSH_PATH_PARENT}/include"
|
||||
)
|
||||
if(TCL_ENABLE_TK)
|
||||
set(
|
||||
TCLTK_POSSIBLE_INCLUDE_PATHS
|
||||
${TCLTK_POSSIBLE_INCLUDE_PATHS}
|
||||
"${TCL_LIBRARY_PATH_PARENT}/include"
|
||||
"${TCL_INCLUDE_PATH}"
|
||||
"${TCL_TCLSH_PATH_PARENT}/include"
|
||||
)
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
set(
|
||||
TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES
|
||||
include
|
||||
include/tcl${TCL_LIBRARY_VERSION}
|
||||
include/tcl8.7
|
||||
include/tcl8.6
|
||||
include/tcl8.5
|
||||
include/tcl8.4
|
||||
include/tcl8.3
|
||||
include/tcl8.2
|
||||
include/tcl8.0
|
||||
)
|
||||
|
||||
if(TCL_ENABLE_TK)
|
||||
set(
|
||||
TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES
|
||||
${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES}
|
||||
include/tcl${TK_LIBRARY_VERSION}
|
||||
include/tk8.7
|
||||
include/tk8.6
|
||||
include/tk8.5
|
||||
include/tk8.4
|
||||
)
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_path(TCL_INCLUDE_PATH NAMES tcl.h ${${search}} PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES})
|
||||
endforeach()
|
||||
if(NOT TCL_INCLUDE_PATH)
|
||||
find_path(
|
||||
TCL_INCLUDE_PATH
|
||||
NAMES tcl.h
|
||||
HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TCL_ENABLE_TK)
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_path(TK_INCLUDE_PATH NAMES tk.h ${${search}} PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES})
|
||||
endforeach()
|
||||
if(NOT TK_INCLUDE_PATH)
|
||||
find_path(
|
||||
TK_INCLUDE_PATH
|
||||
NAMES tk.h
|
||||
HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES}
|
||||
)
|
||||
endif()
|
||||
|
||||
# IFF we have TCL_TK_SYSTEM_GRAPHICS set and have a system TK_WISH, check that the
|
||||
# windowing system matches the specified type
|
||||
if(NOT "${TCL_TK_SYSTEM_GRAPHICS}" STREQUAL "" AND TK_WISH AND NOT TARGET "${TK_WISH}")
|
||||
set(
|
||||
tkwin_script
|
||||
"
|
||||
set filename \"${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM\"
|
||||
set fileId [open $filename \"w\"]
|
||||
set windowingsystem [tk windowingsystem]
|
||||
puts $fileId $windowingsystem
|
||||
close $fileId
|
||||
exit
|
||||
"
|
||||
)
|
||||
set(tkwin_scriptfile "${CMAKE_BINARY_DIR}/CMakeTmp/tk_windowingsystem.tcl")
|
||||
set(WSYS "wm-NOTFOUND")
|
||||
file(WRITE ${tkwin_scriptfile} ${tkwin_script})
|
||||
execute_process(COMMAND ${TK_WISH} ${tkwin_scriptfile} OUTPUT_VARIABLE EXECOUTPUT)
|
||||
if(EXISTS "${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM")
|
||||
file(READ "${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM" readresultvar)
|
||||
string(REGEX REPLACE "\n" "" WSYS "${readresultvar}")
|
||||
endif(EXISTS "${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM")
|
||||
|
||||
# If we have no information about the windowing system or it does not match
|
||||
# a specified system, the find_package detection has failed
|
||||
if(NOT "${WSYS}" STREQUAL "${TCL_TK_SYSTEM_GRAPHICS}")
|
||||
unset(TCL_LIBRARY CACHE)
|
||||
unset(TCL_STUB_LIBRARY CACHE)
|
||||
unset(TK_LIBRARY CACHE)
|
||||
unset(TK_STUB_LIBRARY CACHE)
|
||||
unset(TCL_FOUND CACHE)
|
||||
unset(TK_FOUND CACHE)
|
||||
unset(TCLTK_FOUND CACHE)
|
||||
unset(TCLSH_FOUND CACHE)
|
||||
unset(TCL_LIBRARY CACHE)
|
||||
unset(TCL_INCLUDE_PATH CACHE)
|
||||
unset(TCL_TCLSH CACHE)
|
||||
unset(TK_LIBRARY CACHE)
|
||||
unset(TK_INCLUDE_PATH CACHE)
|
||||
unset(TK_WISH CACHE)
|
||||
unset(TCL_STUB_LIBRARY CACHE)
|
||||
unset(TK_STUB_LIBRARY CACHE)
|
||||
unset(TTK_STUB_LIBRARY CACHE)
|
||||
endif(NOT "${WSYS}" STREQUAL "${TCL_TK_SYSTEM_GRAPHICS}")
|
||||
endif(NOT "${TCL_TK_SYSTEM_GRAPHICS}" STREQUAL "" AND TK_WISH AND NOT TARGET "${TK_WISH}")
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(
|
||||
TCL
|
||||
REQUIRED_VARS TCL_LIBRARY TCL_STUB_LIBRARY TCL_INCLUDE_PATH TCL_TCLSH
|
||||
VERSION_VAR TCLSH_VERSION_STRING
|
||||
)
|
||||
|
||||
if(TCL_ENABLE_TK)
|
||||
set(FPHSA_NAME_MISMATCHED 1)
|
||||
set(TCLTK_FIND_REQUIRED ${TCL_FIND_REQUIRED})
|
||||
set(TCLTK_FIND_QUIETLY ${TCL_FIND_QUIETLY})
|
||||
find_package_handle_standard_args(
|
||||
TCLTK
|
||||
REQUIRED_VARS TCL_LIBRARY TCL_STUB_LIBRARY TCL_INCLUDE_PATH TK_LIBRARY TK_STUB_LIBRARY TK_INCLUDE_PATH
|
||||
)
|
||||
set(TK_FIND_REQUIRED ${TCL_FIND_REQUIRED})
|
||||
set(TK_FIND_QUIETLY ${TCL_FIND_QUIETLY})
|
||||
find_package_handle_standard_args(TK REQUIRED_VARS TK_LIBRARY TK_STUB_LIBRARY TK_INCLUDE_PATH TK_WISH)
|
||||
unset(FPHSA_NAME_MISMATCHED)
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
mark_as_advanced(
|
||||
TCL_INCLUDE_PATH
|
||||
TCL_LIBRARY
|
||||
TCL_STUB_LIBRARY
|
||||
TCL_TCLSH
|
||||
TK_INCLUDE_PATH
|
||||
TK_LIBRARY
|
||||
TK_STUB_LIBRARY
|
||||
TK_WISH
|
||||
TTK_STUB_LIBRARY
|
||||
)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,600 @@
|
||||
/*
|
||||
* tclIntPlatDecls.h --
|
||||
*
|
||||
* This file contains the declarations for all platform dependent
|
||||
* unsupported functions that are exported by the Tcl library. These
|
||||
* interfaces are not guaranteed to remain the same between
|
||||
* versions. Use at your own risk.
|
||||
*
|
||||
* Copyright (c) 1998-1999 by Scriptics Corporation.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _TCLINTPLATDECLS
|
||||
#define _TCLINTPLATDECLS
|
||||
|
||||
#undef TCL_STORAGE_CLASS
|
||||
#ifdef BUILD_tcl
|
||||
# define TCL_STORAGE_CLASS DLLEXPORT
|
||||
#else
|
||||
# ifdef USE_TCL_STUBS
|
||||
# define TCL_STORAGE_CLASS
|
||||
# else
|
||||
# define TCL_STORAGE_CLASS DLLIMPORT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* WARNING: This file is automatically generated by the tools/genStubs.tcl
|
||||
* script. Any modifications to the function declarations below should be made
|
||||
* in the generic/tclInt.decls script.
|
||||
*/
|
||||
|
||||
/* !BEGIN!: Do not edit below this line. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Exported function declarations:
|
||||
*/
|
||||
|
||||
#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */
|
||||
/* 0 */
|
||||
EXTERN void TclGetAndDetachPids(Tcl_Interp *interp,
|
||||
Tcl_Channel chan);
|
||||
/* 1 */
|
||||
EXTERN int TclpCloseFile(TclFile file);
|
||||
/* 2 */
|
||||
EXTERN Tcl_Channel TclpCreateCommandChannel(TclFile readFile,
|
||||
TclFile writeFile, TclFile errorFile,
|
||||
int numPids, Tcl_Pid *pidPtr);
|
||||
/* 3 */
|
||||
EXTERN int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe);
|
||||
/* 4 */
|
||||
EXTERN int TclpCreateProcess(Tcl_Interp *interp, int argc,
|
||||
const char **argv, TclFile inputFile,
|
||||
TclFile outputFile, TclFile errorFile,
|
||||
Tcl_Pid *pidPtr);
|
||||
/* 5 */
|
||||
EXTERN int TclUnixWaitForFile_(int fd, int mask, int timeout);
|
||||
/* 6 */
|
||||
EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction);
|
||||
/* 7 */
|
||||
EXTERN TclFile TclpOpenFile(const char *fname, int mode);
|
||||
/* 8 */
|
||||
EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout);
|
||||
/* 9 */
|
||||
EXTERN TclFile TclpCreateTempFile(const char *contents);
|
||||
/* 10 */
|
||||
EXTERN Tcl_DirEntry * TclpReaddir(TclDIR *dir);
|
||||
/* 11 */
|
||||
EXTERN struct tm * TclpLocaltime_unix(const time_t *clock);
|
||||
/* 12 */
|
||||
EXTERN struct tm * TclpGmtime_unix(const time_t *clock);
|
||||
/* 13 */
|
||||
EXTERN char * TclpInetNtoa(struct in_addr addr);
|
||||
/* 14 */
|
||||
EXTERN int TclUnixCopyFile(const char *src, const char *dst,
|
||||
const Tcl_StatBuf *statBufPtr,
|
||||
int dontCopyAtts);
|
||||
/* 15 */
|
||||
EXTERN int TclMacOSXGetFileAttribute(Tcl_Interp *interp,
|
||||
int objIndex, Tcl_Obj *fileName,
|
||||
Tcl_Obj **attributePtrPtr);
|
||||
/* 16 */
|
||||
EXTERN int TclMacOSXSetFileAttribute(Tcl_Interp *interp,
|
||||
int objIndex, Tcl_Obj *fileName,
|
||||
Tcl_Obj *attributePtr);
|
||||
/* 17 */
|
||||
EXTERN int TclMacOSXCopyFileAttributes(const char *src,
|
||||
const char *dst,
|
||||
const Tcl_StatBuf *statBufPtr);
|
||||
/* 18 */
|
||||
EXTERN int TclMacOSXMatchType(Tcl_Interp *interp,
|
||||
const char *pathName, const char *fileName,
|
||||
Tcl_StatBuf *statBufPtr,
|
||||
Tcl_GlobTypeData *types);
|
||||
/* 19 */
|
||||
EXTERN void TclMacOSXNotifierAddRunLoopMode(
|
||||
const void *runLoopMode);
|
||||
/* Slot 20 is reserved */
|
||||
/* Slot 21 is reserved */
|
||||
/* 22 */
|
||||
EXTERN TclFile TclpCreateTempFile_(const char *contents);
|
||||
/* Slot 23 is reserved */
|
||||
/* Slot 24 is reserved */
|
||||
/* Slot 25 is reserved */
|
||||
/* Slot 26 is reserved */
|
||||
/* Slot 27 is reserved */
|
||||
/* Slot 28 is reserved */
|
||||
/* 29 */
|
||||
EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs);
|
||||
/* 30 */
|
||||
EXTERN int TclUnixOpenTemporaryFile(Tcl_Obj *dirObj,
|
||||
Tcl_Obj *basenameObj, Tcl_Obj *extensionObj,
|
||||
Tcl_Obj *resultingNameObj);
|
||||
#endif /* UNIX */
|
||||
#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
|
||||
/* 0 */
|
||||
EXTERN void TclWinConvertError(DWORD errCode);
|
||||
/* 1 */
|
||||
EXTERN void TclWinConvertWSAError(DWORD errCode);
|
||||
/* 2 */
|
||||
EXTERN struct servent * TclWinGetServByName(const char *nm,
|
||||
const char *proto);
|
||||
/* 3 */
|
||||
EXTERN int TclWinGetSockOpt(SOCKET s, int level, int optname,
|
||||
char *optval, int *optlen);
|
||||
/* 4 */
|
||||
EXTERN HINSTANCE TclWinGetTclInstance(void);
|
||||
/* 5 */
|
||||
EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout);
|
||||
/* 6 */
|
||||
EXTERN unsigned short TclWinNToHS(unsigned short ns);
|
||||
/* 7 */
|
||||
EXTERN int TclWinSetSockOpt(SOCKET s, int level, int optname,
|
||||
const char *optval, int optlen);
|
||||
/* 8 */
|
||||
EXTERN int TclpGetPid(Tcl_Pid pid);
|
||||
/* 9 */
|
||||
EXTERN int TclWinGetPlatformId(void);
|
||||
/* 10 */
|
||||
EXTERN Tcl_DirEntry * TclpReaddir(TclDIR *dir);
|
||||
/* 11 */
|
||||
EXTERN void TclGetAndDetachPids(Tcl_Interp *interp,
|
||||
Tcl_Channel chan);
|
||||
/* 12 */
|
||||
EXTERN int TclpCloseFile(TclFile file);
|
||||
/* 13 */
|
||||
EXTERN Tcl_Channel TclpCreateCommandChannel(TclFile readFile,
|
||||
TclFile writeFile, TclFile errorFile,
|
||||
int numPids, Tcl_Pid *pidPtr);
|
||||
/* 14 */
|
||||
EXTERN int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe);
|
||||
/* 15 */
|
||||
EXTERN int TclpCreateProcess(Tcl_Interp *interp, int argc,
|
||||
const char **argv, TclFile inputFile,
|
||||
TclFile outputFile, TclFile errorFile,
|
||||
Tcl_Pid *pidPtr);
|
||||
/* 16 */
|
||||
EXTERN int TclpIsAtty(int fd);
|
||||
/* 17 */
|
||||
EXTERN int TclUnixCopyFile(const char *src, const char *dst,
|
||||
const Tcl_StatBuf *statBufPtr,
|
||||
int dontCopyAtts);
|
||||
/* 18 */
|
||||
EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction);
|
||||
/* 19 */
|
||||
EXTERN TclFile TclpOpenFile(const char *fname, int mode);
|
||||
/* 20 */
|
||||
EXTERN void TclWinAddProcess(HANDLE hProcess, DWORD id);
|
||||
/* 21 */
|
||||
EXTERN char * TclpInetNtoa(struct in_addr addr);
|
||||
/* 22 */
|
||||
EXTERN TclFile TclpCreateTempFile(const char *contents);
|
||||
/* Slot 23 is reserved */
|
||||
/* 24 */
|
||||
EXTERN char * TclWinNoBackslash(char *path);
|
||||
/* Slot 25 is reserved */
|
||||
/* 26 */
|
||||
EXTERN void TclWinSetInterfaces(int wide);
|
||||
/* 27 */
|
||||
EXTERN void TclWinFlushDirtyChannels(void);
|
||||
/* 28 */
|
||||
EXTERN void TclWinResetInterfaces(void);
|
||||
/* 29 */
|
||||
EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs);
|
||||
/* 30 */
|
||||
EXTERN int TclUnixOpenTemporaryFile(Tcl_Obj *dirObj,
|
||||
Tcl_Obj *basenameObj, Tcl_Obj *extensionObj,
|
||||
Tcl_Obj *resultingNameObj);
|
||||
#endif /* WIN */
|
||||
#ifdef MAC_OSX_TCL /* MACOSX */
|
||||
/* 0 */
|
||||
EXTERN void TclGetAndDetachPids(Tcl_Interp *interp,
|
||||
Tcl_Channel chan);
|
||||
/* 1 */
|
||||
EXTERN int TclpCloseFile(TclFile file);
|
||||
/* 2 */
|
||||
EXTERN Tcl_Channel TclpCreateCommandChannel(TclFile readFile,
|
||||
TclFile writeFile, TclFile errorFile,
|
||||
int numPids, Tcl_Pid *pidPtr);
|
||||
/* 3 */
|
||||
EXTERN int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe);
|
||||
/* 4 */
|
||||
EXTERN int TclpCreateProcess(Tcl_Interp *interp, int argc,
|
||||
const char **argv, TclFile inputFile,
|
||||
TclFile outputFile, TclFile errorFile,
|
||||
Tcl_Pid *pidPtr);
|
||||
/* 5 */
|
||||
EXTERN int TclUnixWaitForFile_(int fd, int mask, int timeout);
|
||||
/* 6 */
|
||||
EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction);
|
||||
/* 7 */
|
||||
EXTERN TclFile TclpOpenFile(const char *fname, int mode);
|
||||
/* 8 */
|
||||
EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout);
|
||||
/* 9 */
|
||||
EXTERN TclFile TclpCreateTempFile(const char *contents);
|
||||
/* 10 */
|
||||
EXTERN Tcl_DirEntry * TclpReaddir(TclDIR *dir);
|
||||
/* 11 */
|
||||
EXTERN struct tm * TclpLocaltime_unix(const time_t *clock);
|
||||
/* 12 */
|
||||
EXTERN struct tm * TclpGmtime_unix(const time_t *clock);
|
||||
/* 13 */
|
||||
EXTERN char * TclpInetNtoa(struct in_addr addr);
|
||||
/* 14 */
|
||||
EXTERN int TclUnixCopyFile(const char *src, const char *dst,
|
||||
const Tcl_StatBuf *statBufPtr,
|
||||
int dontCopyAtts);
|
||||
/* 15 */
|
||||
EXTERN int TclMacOSXGetFileAttribute(Tcl_Interp *interp,
|
||||
int objIndex, Tcl_Obj *fileName,
|
||||
Tcl_Obj **attributePtrPtr);
|
||||
/* 16 */
|
||||
EXTERN int TclMacOSXSetFileAttribute(Tcl_Interp *interp,
|
||||
int objIndex, Tcl_Obj *fileName,
|
||||
Tcl_Obj *attributePtr);
|
||||
/* 17 */
|
||||
EXTERN int TclMacOSXCopyFileAttributes(const char *src,
|
||||
const char *dst,
|
||||
const Tcl_StatBuf *statBufPtr);
|
||||
/* 18 */
|
||||
EXTERN int TclMacOSXMatchType(Tcl_Interp *interp,
|
||||
const char *pathName, const char *fileName,
|
||||
Tcl_StatBuf *statBufPtr,
|
||||
Tcl_GlobTypeData *types);
|
||||
/* 19 */
|
||||
EXTERN void TclMacOSXNotifierAddRunLoopMode(
|
||||
const void *runLoopMode);
|
||||
/* Slot 20 is reserved */
|
||||
/* Slot 21 is reserved */
|
||||
/* 22 */
|
||||
EXTERN TclFile TclpCreateTempFile_(const char *contents);
|
||||
/* Slot 23 is reserved */
|
||||
/* Slot 24 is reserved */
|
||||
/* Slot 25 is reserved */
|
||||
/* Slot 26 is reserved */
|
||||
/* Slot 27 is reserved */
|
||||
/* Slot 28 is reserved */
|
||||
/* 29 */
|
||||
EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs);
|
||||
/* 30 */
|
||||
EXTERN int TclUnixOpenTemporaryFile(Tcl_Obj *dirObj,
|
||||
Tcl_Obj *basenameObj, Tcl_Obj *extensionObj,
|
||||
Tcl_Obj *resultingNameObj);
|
||||
#endif /* MACOSX */
|
||||
|
||||
typedef struct TclIntPlatStubs {
|
||||
int magic;
|
||||
void *hooks;
|
||||
|
||||
#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */
|
||||
void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 0 */
|
||||
int (*tclpCloseFile) (TclFile file); /* 1 */
|
||||
Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 2 */
|
||||
int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 3 */
|
||||
int (*tclpCreateProcess) (Tcl_Interp *interp, int argc, const char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr); /* 4 */
|
||||
int (*tclUnixWaitForFile_) (int fd, int mask, int timeout); /* 5 */
|
||||
TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 6 */
|
||||
TclFile (*tclpOpenFile) (const char *fname, int mode); /* 7 */
|
||||
int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */
|
||||
TclFile (*tclpCreateTempFile) (const char *contents); /* 9 */
|
||||
Tcl_DirEntry * (*tclpReaddir) (TclDIR *dir); /* 10 */
|
||||
struct tm * (*tclpLocaltime_unix) (const time_t *clock); /* 11 */
|
||||
struct tm * (*tclpGmtime_unix) (const time_t *clock); /* 12 */
|
||||
char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */
|
||||
int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */
|
||||
int (*tclMacOSXGetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr); /* 15 */
|
||||
int (*tclMacOSXSetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj *attributePtr); /* 16 */
|
||||
int (*tclMacOSXCopyFileAttributes) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr); /* 17 */
|
||||
int (*tclMacOSXMatchType) (Tcl_Interp *interp, const char *pathName, const char *fileName, Tcl_StatBuf *statBufPtr, Tcl_GlobTypeData *types); /* 18 */
|
||||
void (*tclMacOSXNotifierAddRunLoopMode) (const void *runLoopMode); /* 19 */
|
||||
void (*reserved20)(void);
|
||||
void (*reserved21)(void);
|
||||
TclFile (*tclpCreateTempFile_) (const char *contents); /* 22 */
|
||||
void (*reserved23)(void);
|
||||
void (*reserved24)(void);
|
||||
void (*reserved25)(void);
|
||||
void (*reserved26)(void);
|
||||
void (*reserved27)(void);
|
||||
void (*reserved28)(void);
|
||||
int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */
|
||||
int (*tclUnixOpenTemporaryFile) (Tcl_Obj *dirObj, Tcl_Obj *basenameObj, Tcl_Obj *extensionObj, Tcl_Obj *resultingNameObj); /* 30 */
|
||||
#endif /* UNIX */
|
||||
#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
|
||||
void (*tclWinConvertError) (DWORD errCode); /* 0 */
|
||||
void (*tclWinConvertWSAError) (DWORD errCode); /* 1 */
|
||||
struct servent * (*tclWinGetServByName) (const char *nm, const char *proto); /* 2 */
|
||||
int (*tclWinGetSockOpt) (SOCKET s, int level, int optname, char *optval, int *optlen); /* 3 */
|
||||
HINSTANCE (*tclWinGetTclInstance) (void); /* 4 */
|
||||
int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 5 */
|
||||
unsigned short (*tclWinNToHS) (unsigned short ns); /* 6 */
|
||||
int (*tclWinSetSockOpt) (SOCKET s, int level, int optname, const char *optval, int optlen); /* 7 */
|
||||
int (*tclpGetPid) (Tcl_Pid pid); /* 8 */
|
||||
int (*tclWinGetPlatformId) (void); /* 9 */
|
||||
Tcl_DirEntry * (*tclpReaddir) (TclDIR *dir); /* 10 */
|
||||
void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 11 */
|
||||
int (*tclpCloseFile) (TclFile file); /* 12 */
|
||||
Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 13 */
|
||||
int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 14 */
|
||||
int (*tclpCreateProcess) (Tcl_Interp *interp, int argc, const char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr); /* 15 */
|
||||
int (*tclpIsAtty) (int fd); /* 16 */
|
||||
int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 17 */
|
||||
TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 18 */
|
||||
TclFile (*tclpOpenFile) (const char *fname, int mode); /* 19 */
|
||||
void (*tclWinAddProcess) (HANDLE hProcess, DWORD id); /* 20 */
|
||||
char * (*tclpInetNtoa) (struct in_addr addr); /* 21 */
|
||||
TclFile (*tclpCreateTempFile) (const char *contents); /* 22 */
|
||||
void (*reserved23)(void);
|
||||
char * (*tclWinNoBackslash) (char *path); /* 24 */
|
||||
void (*reserved25)(void);
|
||||
void (*tclWinSetInterfaces) (int wide); /* 26 */
|
||||
void (*tclWinFlushDirtyChannels) (void); /* 27 */
|
||||
void (*tclWinResetInterfaces) (void); /* 28 */
|
||||
int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */
|
||||
int (*tclUnixOpenTemporaryFile) (Tcl_Obj *dirObj, Tcl_Obj *basenameObj, Tcl_Obj *extensionObj, Tcl_Obj *resultingNameObj); /* 30 */
|
||||
#endif /* WIN */
|
||||
#ifdef MAC_OSX_TCL /* MACOSX */
|
||||
void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 0 */
|
||||
int (*tclpCloseFile) (TclFile file); /* 1 */
|
||||
Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 2 */
|
||||
int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 3 */
|
||||
int (*tclpCreateProcess) (Tcl_Interp *interp, int argc, const char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr); /* 4 */
|
||||
int (*tclUnixWaitForFile_) (int fd, int mask, int timeout); /* 5 */
|
||||
TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 6 */
|
||||
TclFile (*tclpOpenFile) (const char *fname, int mode); /* 7 */
|
||||
int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */
|
||||
TclFile (*tclpCreateTempFile) (const char *contents); /* 9 */
|
||||
Tcl_DirEntry * (*tclpReaddir) (TclDIR *dir); /* 10 */
|
||||
struct tm * (*tclpLocaltime_unix) (const time_t *clock); /* 11 */
|
||||
struct tm * (*tclpGmtime_unix) (const time_t *clock); /* 12 */
|
||||
char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */
|
||||
int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */
|
||||
int (*tclMacOSXGetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr); /* 15 */
|
||||
int (*tclMacOSXSetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj *attributePtr); /* 16 */
|
||||
int (*tclMacOSXCopyFileAttributes) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr); /* 17 */
|
||||
int (*tclMacOSXMatchType) (Tcl_Interp *interp, const char *pathName, const char *fileName, Tcl_StatBuf *statBufPtr, Tcl_GlobTypeData *types); /* 18 */
|
||||
void (*tclMacOSXNotifierAddRunLoopMode) (const void *runLoopMode); /* 19 */
|
||||
void (*reserved20)(void);
|
||||
void (*reserved21)(void);
|
||||
TclFile (*tclpCreateTempFile_) (const char *contents); /* 22 */
|
||||
void (*reserved23)(void);
|
||||
void (*reserved24)(void);
|
||||
void (*reserved25)(void);
|
||||
void (*reserved26)(void);
|
||||
void (*reserved27)(void);
|
||||
void (*reserved28)(void);
|
||||
int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */
|
||||
int (*tclUnixOpenTemporaryFile) (Tcl_Obj *dirObj, Tcl_Obj *basenameObj, Tcl_Obj *extensionObj, Tcl_Obj *resultingNameObj); /* 30 */
|
||||
#endif /* MACOSX */
|
||||
} TclIntPlatStubs;
|
||||
|
||||
extern const TclIntPlatStubs *tclIntPlatStubsPtr;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(USE_TCL_STUBS)
|
||||
|
||||
/*
|
||||
* Inline function declarations:
|
||||
*/
|
||||
|
||||
#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */
|
||||
#define TclGetAndDetachPids \
|
||||
(tclIntPlatStubsPtr->tclGetAndDetachPids) /* 0 */
|
||||
#define TclpCloseFile \
|
||||
(tclIntPlatStubsPtr->tclpCloseFile) /* 1 */
|
||||
#define TclpCreateCommandChannel \
|
||||
(tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 2 */
|
||||
#define TclpCreatePipe \
|
||||
(tclIntPlatStubsPtr->tclpCreatePipe) /* 3 */
|
||||
#define TclpCreateProcess \
|
||||
(tclIntPlatStubsPtr->tclpCreateProcess) /* 4 */
|
||||
#define TclUnixWaitForFile_ \
|
||||
(tclIntPlatStubsPtr->tclUnixWaitForFile_) /* 5 */
|
||||
#define TclpMakeFile \
|
||||
(tclIntPlatStubsPtr->tclpMakeFile) /* 6 */
|
||||
#define TclpOpenFile \
|
||||
(tclIntPlatStubsPtr->tclpOpenFile) /* 7 */
|
||||
#define TclUnixWaitForFile \
|
||||
(tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */
|
||||
#define TclpCreateTempFile \
|
||||
(tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */
|
||||
#define TclpReaddir \
|
||||
(tclIntPlatStubsPtr->tclpReaddir) /* 10 */
|
||||
#define TclpLocaltime_unix \
|
||||
(tclIntPlatStubsPtr->tclpLocaltime_unix) /* 11 */
|
||||
#define TclpGmtime_unix \
|
||||
(tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */
|
||||
#define TclpInetNtoa \
|
||||
(tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */
|
||||
#define TclUnixCopyFile \
|
||||
(tclIntPlatStubsPtr->tclUnixCopyFile) /* 14 */
|
||||
#define TclMacOSXGetFileAttribute \
|
||||
(tclIntPlatStubsPtr->tclMacOSXGetFileAttribute) /* 15 */
|
||||
#define TclMacOSXSetFileAttribute \
|
||||
(tclIntPlatStubsPtr->tclMacOSXSetFileAttribute) /* 16 */
|
||||
#define TclMacOSXCopyFileAttributes \
|
||||
(tclIntPlatStubsPtr->tclMacOSXCopyFileAttributes) /* 17 */
|
||||
#define TclMacOSXMatchType \
|
||||
(tclIntPlatStubsPtr->tclMacOSXMatchType) /* 18 */
|
||||
#define TclMacOSXNotifierAddRunLoopMode \
|
||||
(tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) /* 19 */
|
||||
/* Slot 20 is reserved */
|
||||
/* Slot 21 is reserved */
|
||||
#define TclpCreateTempFile_ \
|
||||
(tclIntPlatStubsPtr->tclpCreateTempFile_) /* 22 */
|
||||
/* Slot 23 is reserved */
|
||||
/* Slot 24 is reserved */
|
||||
/* Slot 25 is reserved */
|
||||
/* Slot 26 is reserved */
|
||||
/* Slot 27 is reserved */
|
||||
/* Slot 28 is reserved */
|
||||
#define TclWinCPUID \
|
||||
(tclIntPlatStubsPtr->tclWinCPUID) /* 29 */
|
||||
#define TclUnixOpenTemporaryFile \
|
||||
(tclIntPlatStubsPtr->tclUnixOpenTemporaryFile) /* 30 */
|
||||
#endif /* UNIX */
|
||||
#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
|
||||
#define TclWinConvertError \
|
||||
(tclIntPlatStubsPtr->tclWinConvertError) /* 0 */
|
||||
#define TclWinConvertWSAError \
|
||||
(tclIntPlatStubsPtr->tclWinConvertWSAError) /* 1 */
|
||||
#define TclWinGetServByName \
|
||||
(tclIntPlatStubsPtr->tclWinGetServByName) /* 2 */
|
||||
#define TclWinGetSockOpt \
|
||||
(tclIntPlatStubsPtr->tclWinGetSockOpt) /* 3 */
|
||||
#define TclWinGetTclInstance \
|
||||
(tclIntPlatStubsPtr->tclWinGetTclInstance) /* 4 */
|
||||
#define TclUnixWaitForFile \
|
||||
(tclIntPlatStubsPtr->tclUnixWaitForFile) /* 5 */
|
||||
#define TclWinNToHS \
|
||||
(tclIntPlatStubsPtr->tclWinNToHS) /* 6 */
|
||||
#define TclWinSetSockOpt \
|
||||
(tclIntPlatStubsPtr->tclWinSetSockOpt) /* 7 */
|
||||
#define TclpGetPid \
|
||||
(tclIntPlatStubsPtr->tclpGetPid) /* 8 */
|
||||
#define TclWinGetPlatformId \
|
||||
(tclIntPlatStubsPtr->tclWinGetPlatformId) /* 9 */
|
||||
#define TclpReaddir \
|
||||
(tclIntPlatStubsPtr->tclpReaddir) /* 10 */
|
||||
#define TclGetAndDetachPids \
|
||||
(tclIntPlatStubsPtr->tclGetAndDetachPids) /* 11 */
|
||||
#define TclpCloseFile \
|
||||
(tclIntPlatStubsPtr->tclpCloseFile) /* 12 */
|
||||
#define TclpCreateCommandChannel \
|
||||
(tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 13 */
|
||||
#define TclpCreatePipe \
|
||||
(tclIntPlatStubsPtr->tclpCreatePipe) /* 14 */
|
||||
#define TclpCreateProcess \
|
||||
(tclIntPlatStubsPtr->tclpCreateProcess) /* 15 */
|
||||
#define TclpIsAtty \
|
||||
(tclIntPlatStubsPtr->tclpIsAtty) /* 16 */
|
||||
#define TclUnixCopyFile \
|
||||
(tclIntPlatStubsPtr->tclUnixCopyFile) /* 17 */
|
||||
#define TclpMakeFile \
|
||||
(tclIntPlatStubsPtr->tclpMakeFile) /* 18 */
|
||||
#define TclpOpenFile \
|
||||
(tclIntPlatStubsPtr->tclpOpenFile) /* 19 */
|
||||
#define TclWinAddProcess \
|
||||
(tclIntPlatStubsPtr->tclWinAddProcess) /* 20 */
|
||||
#define TclpInetNtoa \
|
||||
(tclIntPlatStubsPtr->tclpInetNtoa) /* 21 */
|
||||
#define TclpCreateTempFile \
|
||||
(tclIntPlatStubsPtr->tclpCreateTempFile) /* 22 */
|
||||
/* Slot 23 is reserved */
|
||||
#define TclWinNoBackslash \
|
||||
(tclIntPlatStubsPtr->tclWinNoBackslash) /* 24 */
|
||||
/* Slot 25 is reserved */
|
||||
#define TclWinSetInterfaces \
|
||||
(tclIntPlatStubsPtr->tclWinSetInterfaces) /* 26 */
|
||||
#define TclWinFlushDirtyChannels \
|
||||
(tclIntPlatStubsPtr->tclWinFlushDirtyChannels) /* 27 */
|
||||
#define TclWinResetInterfaces \
|
||||
(tclIntPlatStubsPtr->tclWinResetInterfaces) /* 28 */
|
||||
#define TclWinCPUID \
|
||||
(tclIntPlatStubsPtr->tclWinCPUID) /* 29 */
|
||||
#define TclUnixOpenTemporaryFile \
|
||||
(tclIntPlatStubsPtr->tclUnixOpenTemporaryFile) /* 30 */
|
||||
#endif /* WIN */
|
||||
#ifdef MAC_OSX_TCL /* MACOSX */
|
||||
#define TclGetAndDetachPids \
|
||||
(tclIntPlatStubsPtr->tclGetAndDetachPids) /* 0 */
|
||||
#define TclpCloseFile \
|
||||
(tclIntPlatStubsPtr->tclpCloseFile) /* 1 */
|
||||
#define TclpCreateCommandChannel \
|
||||
(tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 2 */
|
||||
#define TclpCreatePipe \
|
||||
(tclIntPlatStubsPtr->tclpCreatePipe) /* 3 */
|
||||
#define TclpCreateProcess \
|
||||
(tclIntPlatStubsPtr->tclpCreateProcess) /* 4 */
|
||||
#define TclUnixWaitForFile_ \
|
||||
(tclIntPlatStubsPtr->tclUnixWaitForFile_) /* 5 */
|
||||
#define TclpMakeFile \
|
||||
(tclIntPlatStubsPtr->tclpMakeFile) /* 6 */
|
||||
#define TclpOpenFile \
|
||||
(tclIntPlatStubsPtr->tclpOpenFile) /* 7 */
|
||||
#define TclUnixWaitForFile \
|
||||
(tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */
|
||||
#define TclpCreateTempFile \
|
||||
(tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */
|
||||
#define TclpReaddir \
|
||||
(tclIntPlatStubsPtr->tclpReaddir) /* 10 */
|
||||
#define TclpLocaltime_unix \
|
||||
(tclIntPlatStubsPtr->tclpLocaltime_unix) /* 11 */
|
||||
#define TclpGmtime_unix \
|
||||
(tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */
|
||||
#define TclpInetNtoa \
|
||||
(tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */
|
||||
#define TclUnixCopyFile \
|
||||
(tclIntPlatStubsPtr->tclUnixCopyFile) /* 14 */
|
||||
#define TclMacOSXGetFileAttribute \
|
||||
(tclIntPlatStubsPtr->tclMacOSXGetFileAttribute) /* 15 */
|
||||
#define TclMacOSXSetFileAttribute \
|
||||
(tclIntPlatStubsPtr->tclMacOSXSetFileAttribute) /* 16 */
|
||||
#define TclMacOSXCopyFileAttributes \
|
||||
(tclIntPlatStubsPtr->tclMacOSXCopyFileAttributes) /* 17 */
|
||||
#define TclMacOSXMatchType \
|
||||
(tclIntPlatStubsPtr->tclMacOSXMatchType) /* 18 */
|
||||
#define TclMacOSXNotifierAddRunLoopMode \
|
||||
(tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) /* 19 */
|
||||
/* Slot 20 is reserved */
|
||||
/* Slot 21 is reserved */
|
||||
#define TclpCreateTempFile_ \
|
||||
(tclIntPlatStubsPtr->tclpCreateTempFile_) /* 22 */
|
||||
/* Slot 23 is reserved */
|
||||
/* Slot 24 is reserved */
|
||||
/* Slot 25 is reserved */
|
||||
/* Slot 26 is reserved */
|
||||
/* Slot 27 is reserved */
|
||||
/* Slot 28 is reserved */
|
||||
#define TclWinCPUID \
|
||||
(tclIntPlatStubsPtr->tclWinCPUID) /* 29 */
|
||||
#define TclUnixOpenTemporaryFile \
|
||||
(tclIntPlatStubsPtr->tclUnixOpenTemporaryFile) /* 30 */
|
||||
#endif /* MACOSX */
|
||||
|
||||
#endif /* defined(USE_TCL_STUBS) */
|
||||
|
||||
/* !END!: Do not edit above this line. */
|
||||
|
||||
#undef TCL_STORAGE_CLASS
|
||||
#define TCL_STORAGE_CLASS DLLIMPORT
|
||||
#undef TclpLocaltime_unix
|
||||
#undef TclpGmtime_unix
|
||||
#undef TclWinConvertWSAError
|
||||
#define TclWinConvertWSAError TclWinConvertError
|
||||
#undef TclpInetNtoa
|
||||
#define TclpInetNtoa inet_ntoa
|
||||
|
||||
#undef TclpCreateTempFile_
|
||||
#undef TclUnixWaitForFile_
|
||||
#ifndef MAC_OSX_TCL /* not accessible on Win32/UNIX */
|
||||
#undef TclMacOSXGetFileAttribute /* 15 */
|
||||
#undef TclMacOSXSetFileAttribute /* 16 */
|
||||
#undef TclMacOSXCopyFileAttributes /* 17 */
|
||||
#undef TclMacOSXMatchType /* 18 */
|
||||
#undef TclMacOSXNotifierAddRunLoopMode /* 19 */
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
# undef TclWinNToHS
|
||||
# undef TclWinGetServByName
|
||||
# undef TclWinGetSockOpt
|
||||
# undef TclWinSetSockOpt
|
||||
# define TclWinNToHS ntohs
|
||||
# define TclWinGetServByName getservbyname
|
||||
# define TclWinGetSockOpt getsockopt
|
||||
# define TclWinSetSockOpt setsockopt
|
||||
#else
|
||||
# undef TclpGetPid
|
||||
# define TclpGetPid(pid) ((unsigned long) (pid))
|
||||
#endif
|
||||
|
||||
#endif /* _TCLINTPLATDECLS */
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* tclPort.h --
|
||||
*
|
||||
* This header file handles porting issues that occur because
|
||||
* of differences between systems. It reads in platform specific
|
||||
* portability files.
|
||||
*
|
||||
* Copyright (c) 1994-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.
|
||||
*/
|
||||
|
||||
#ifndef _TCLPORT
|
||||
#define _TCLPORT
|
||||
|
||||
#ifdef HAVE_TCL_CONFIG_H
|
||||
#include "tclConfig.h"
|
||||
#endif
|
||||
#if defined(_WIN32)
|
||||
# include "tclWinPort.h"
|
||||
#else
|
||||
# include "tclUnixPort.h"
|
||||
#endif
|
||||
#include "tcl.h"
|
||||
|
||||
#if !defined(LLONG_MIN)
|
||||
# ifdef TCL_WIDE_INT_IS_LONG
|
||||
# define LLONG_MIN LONG_MIN
|
||||
# else
|
||||
# ifdef LLONG_BIT
|
||||
# define LLONG_MIN ((Tcl_WideInt)(Tcl_LongAsWide(1)<<(LLONG_BIT-1)))
|
||||
# else
|
||||
/* Assume we're on a system with a 64-bit 'long long' type */
|
||||
# define LLONG_MIN ((Tcl_WideInt)(Tcl_LongAsWide(1)<<63))
|
||||
# endif
|
||||
# endif
|
||||
/* Assume that if LLONG_MIN is undefined, then so is LLONG_MAX */
|
||||
# define LLONG_MAX (~LLONG_MIN)
|
||||
#endif
|
||||
|
||||
#define UWIDE_MAX ((Tcl_WideUInt)-1)
|
||||
#define WIDE_MAX ((Tcl_WideInt)(UWIDE_MAX >> 1))
|
||||
#define WIDE_MIN ((Tcl_WideInt)((Tcl_WideUInt)WIDE_MAX+1))
|
||||
|
||||
#endif /* _TCLPORT */
|
||||
@@ -0,0 +1,732 @@
|
||||
/*
|
||||
* tclUnixPort.h --
|
||||
*
|
||||
* This header file handles porting issues that occur because of
|
||||
* differences between systems. It reads in UNIX-related header files and
|
||||
* sets up UNIX-related macros for Tcl's UNIX core. It should be the only
|
||||
* file that contains #ifdefs to handle different flavors of UNIX. This
|
||||
* file sets up the union of all UNIX-related things needed by any of the
|
||||
* Tcl core files. This file depends on configuration #defines such as
|
||||
* NO_DIRENT_H that are set up by the "configure" script.
|
||||
*
|
||||
* Much of the material in this file was originally contributed by Karl
|
||||
* Lehenbauer, Mark Diekhans and Peter da Silva.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _TCLUNIXPORT
|
||||
#define _TCLUNIXPORT
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* The following sets of #includes and #ifdefs are required to get Tcl to
|
||||
* compile under the various flavors of unix.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef HAVE_NET_ERRNO_H
|
||||
# include <net/errno.h>
|
||||
#endif
|
||||
#include <pwd.h>
|
||||
#include <signal.h>
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#ifdef USE_DIRENT2_H
|
||||
# include "../compat/dirent2.h"
|
||||
#else
|
||||
#ifdef NO_DIRENT_H
|
||||
# include "../compat/dirent.h"
|
||||
#else
|
||||
# include <dirent.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Parameterize for 64-bit filesystem support.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef HAVE_STRUCT_DIRENT64
|
||||
typedef struct dirent64 Tcl_DirEntry;
|
||||
# define TclOSreaddir readdir64
|
||||
#else
|
||||
typedef struct dirent Tcl_DirEntry;
|
||||
# define TclOSreaddir readdir
|
||||
#endif
|
||||
#ifdef HAVE_DIR64
|
||||
typedef DIR64 TclDIR;
|
||||
# define TclOSopendir opendir64
|
||||
# define TclOSrewinddir rewinddir64
|
||||
# define TclOSclosedir closedir64
|
||||
#else
|
||||
typedef DIR TclDIR;
|
||||
# define TclOSopendir opendir
|
||||
# define TclOSrewinddir rewinddir
|
||||
# define TclOSclosedir closedir
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TYPE_OFF64_T
|
||||
typedef off64_t Tcl_SeekOffset;
|
||||
# define TclOSseek lseek64
|
||||
# define TclOSopen open64
|
||||
#else
|
||||
typedef off_t Tcl_SeekOffset;
|
||||
# define TclOSseek lseek
|
||||
# define TclOSopen open
|
||||
#endif
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Make some symbols available without including <windows.h> */
|
||||
# define DWORD unsigned int
|
||||
# define CP_UTF8 65001
|
||||
# define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004
|
||||
# define HANDLE void *
|
||||
# define HINSTANCE void *
|
||||
# define SOCKET unsigned int
|
||||
# define WSAEWOULDBLOCK 10035
|
||||
typedef unsigned short WCHAR;
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wignored-attributes"
|
||||
#endif
|
||||
__declspec(dllimport) extern __stdcall int GetModuleHandleExW(unsigned int, const void *, void *);
|
||||
__declspec(dllimport) extern __stdcall int GetModuleFileNameW(void *, const void *, int);
|
||||
__declspec(dllimport) extern __stdcall int WideCharToMultiByte(int, int, const void *, int,
|
||||
char *, int, const char *, void *);
|
||||
__declspec(dllimport) extern __stdcall int MultiByteToWideChar(int, int, const char *, int,
|
||||
WCHAR *, int);
|
||||
__declspec(dllimport) extern __stdcall void OutputDebugStringW(const WCHAR *);
|
||||
__declspec(dllimport) extern __stdcall int IsDebuggerPresent(void);
|
||||
__declspec(dllimport) extern __stdcall int GetLastError(void);
|
||||
__declspec(dllimport) extern __stdcall int GetFileAttributesW(const WCHAR *);
|
||||
__declspec(dllimport) extern __stdcall int SetFileAttributesW(const WCHAR *, int);
|
||||
__declspec(dllimport) extern int cygwin_conv_path(int, const void *, void *, int);
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
# define timezone _timezone
|
||||
extern int TclOSstat(const char *name, void *statBuf);
|
||||
extern int TclOSlstat(const char *name, void *statBuf);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#elif defined(HAVE_STRUCT_STAT64) && !defined(__APPLE__)
|
||||
# define TclOSstat(name, buf) stat64(name, (struct stat64 *)buf)
|
||||
# define TclOSlstat(name,buf) lstat64(name, (struct stat64 *)buf)
|
||||
#else
|
||||
# define TclOSstat(name, buf) stat(name, (struct stat *)buf)
|
||||
# define TclOSlstat(name, buf) lstat(name, (struct stat *)buf)
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Miscellaneous includes that might be missing.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <sys/file.h>
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
# include <sys/select.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
#else
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
#else
|
||||
# include <time.h>
|
||||
#endif
|
||||
#endif
|
||||
#ifndef NO_SYS_WAIT_H
|
||||
# include <sys/wait.h>
|
||||
#endif
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#ifdef HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#else
|
||||
# include "../compat/unistd.h"
|
||||
#endif
|
||||
|
||||
extern int TclUnixSetBlockingMode(int fd, int mode);
|
||||
|
||||
#include <utime.h>
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Socket support stuff: This likely needs more work to parameterize for each
|
||||
* system.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <sys/socket.h> /* struct sockaddr, SOCK_STREAM, ... */
|
||||
#ifndef NO_UNAME
|
||||
# include <sys/utsname.h> /* uname system call. */
|
||||
#endif
|
||||
#include <netinet/in.h> /* struct in_addr, struct sockaddr_in */
|
||||
#include <arpa/inet.h> /* inet_ntoa() */
|
||||
#include <netdb.h> /* getaddrinfo() */
|
||||
#ifdef NEED_FAKE_RFC2553
|
||||
# include "../compat/fake-rfc2553.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Some platforms (e.g. SunOS) don't define FLT_MAX and FLT_MIN, so we look
|
||||
* for an alternative definition. If no other alternative is available we use
|
||||
* a reasonable guess.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef NO_FLOAT_H
|
||||
# include <float.h>
|
||||
#else
|
||||
#ifndef NO_VALUES_H
|
||||
# include <values.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef FLT_MAX
|
||||
# ifdef MAXFLOAT
|
||||
# define FLT_MAX MAXFLOAT
|
||||
# else
|
||||
# define FLT_MAX 3.402823466E+38F
|
||||
# endif
|
||||
#endif
|
||||
#ifndef FLT_MIN
|
||||
# ifdef MINFLOAT
|
||||
# define FLT_MIN MINFLOAT
|
||||
# else
|
||||
# define FLT_MIN 1.175494351E-38F
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* NeXT doesn't define O_NONBLOCK, so #define it here if necessary.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef O_NONBLOCK
|
||||
# define O_NONBLOCK 0x80
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* The type of the status returned by wait varies from UNIX system to UNIX
|
||||
* system. The macro below defines it:
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef _AIX
|
||||
# define WAIT_STATUS_TYPE pid_t
|
||||
#else
|
||||
#ifndef NO_UNION_WAIT
|
||||
# define WAIT_STATUS_TYPE union wait
|
||||
#else
|
||||
# define WAIT_STATUS_TYPE int
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Supply definitions for macros to query wait status, if not already defined
|
||||
* in header files above.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef WIFEXITED
|
||||
# define WIFEXITED(stat) (((*((int *) &(stat))) & 0xFF) == 0)
|
||||
#endif
|
||||
|
||||
#ifndef WEXITSTATUS
|
||||
# define WEXITSTATUS(stat) (((*((int *) &(stat))) >> 8) & 0xFF)
|
||||
#endif
|
||||
|
||||
#ifndef WIFSIGNALED
|
||||
# define WIFSIGNALED(stat) \
|
||||
(((*((int *) &(stat)))) && ((*((int *) &(stat))) \
|
||||
== ((*((int *) &(stat))) & 0x00FF)))
|
||||
#endif
|
||||
|
||||
#ifndef WTERMSIG
|
||||
# define WTERMSIG(stat) ((*((int *) &(stat))) & 0x7F)
|
||||
#endif
|
||||
|
||||
#ifndef WIFSTOPPED
|
||||
# define WIFSTOPPED(stat) (((*((int *) &(stat))) & 0xFF) == 0177)
|
||||
#endif
|
||||
|
||||
#ifndef WSTOPSIG
|
||||
# define WSTOPSIG(stat) (((*((int *) &(stat))) >> 8) & 0xFF)
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Define constants for waitpid() system call if they aren't defined by a
|
||||
* system header file.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef WNOHANG
|
||||
# define WNOHANG 1
|
||||
#endif
|
||||
#ifndef WUNTRACED
|
||||
# define WUNTRACED 2
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Supply macros for seek offsets, if they're not already provided by an
|
||||
* include file.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef SEEK_SET
|
||||
# define SEEK_SET 0
|
||||
#endif
|
||||
#ifndef SEEK_CUR
|
||||
# define SEEK_CUR 1
|
||||
#endif
|
||||
#ifndef SEEK_END
|
||||
# define SEEK_END 2
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* The stuff below is needed by the "time" command. If this system has no
|
||||
* gettimeofday call, then must use times() instead.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef NO_GETTOD
|
||||
# include <sys/times.h>
|
||||
#else
|
||||
# ifdef HAVE_BSDGETTIMEOFDAY
|
||||
# define gettimeofday BSDgettimeofday
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef GETTOD_NOT_DECLARED
|
||||
extern int gettimeofday(struct timeval *tp,
|
||||
struct timezone *tzp);
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Define access mode constants if they aren't already defined.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef F_OK
|
||||
# define F_OK 00
|
||||
#endif
|
||||
#ifndef X_OK
|
||||
# define X_OK 01
|
||||
#endif
|
||||
#ifndef W_OK
|
||||
# define W_OK 02
|
||||
#endif
|
||||
#ifndef R_OK
|
||||
# define R_OK 04
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Define FD_CLOEEXEC (the close-on-exec flag bit) if it isn't already
|
||||
* defined.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef FD_CLOEXEC
|
||||
# define FD_CLOEXEC 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* On systems without symbolic links (i.e. S_IFLNK isn't defined) define
|
||||
* "lstat" to use "stat" instead.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef S_IFLNK
|
||||
# undef TclOSlstat
|
||||
# define lstat stat
|
||||
# define lstat64 stat64
|
||||
# define TclOSlstat TclOSstat
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Define macros to query file type bits, if they're not already defined.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef S_ISREG
|
||||
# ifdef S_IFREG
|
||||
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
# else
|
||||
# define S_ISREG(m) 0
|
||||
# endif
|
||||
#endif /* !S_ISREG */
|
||||
#ifndef S_ISDIR
|
||||
# ifdef S_IFDIR
|
||||
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
# else
|
||||
# define S_ISDIR(m) 0
|
||||
# endif
|
||||
#endif /* !S_ISDIR */
|
||||
#ifndef S_ISCHR
|
||||
# ifdef S_IFCHR
|
||||
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
|
||||
# else
|
||||
# define S_ISCHR(m) 0
|
||||
# endif
|
||||
#endif /* !S_ISCHR */
|
||||
|
||||
#ifndef S_ISBLK
|
||||
# ifdef S_IFBLK
|
||||
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
||||
# else
|
||||
# define S_ISBLK(m) 0
|
||||
# endif
|
||||
#endif /* !S_ISBLK */
|
||||
|
||||
#ifndef S_ISFIFO
|
||||
# ifdef S_IFIFO
|
||||
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
|
||||
# else
|
||||
# define S_ISFIFO(m) 0
|
||||
# endif
|
||||
#endif /* !S_ISFIFO */
|
||||
|
||||
#ifndef S_ISLNK
|
||||
# ifdef S_IFLNK
|
||||
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
|
||||
# else
|
||||
# define S_ISLNK(m) 0
|
||||
# endif
|
||||
#endif /* !S_ISLNK */
|
||||
|
||||
#ifndef S_ISSOCK
|
||||
# ifdef S_IFSOCK
|
||||
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
|
||||
# else
|
||||
# define S_ISSOCK(m) 0
|
||||
# endif
|
||||
#endif /* !S_ISSOCK */
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Make sure that MAXPATHLEN and MAXNAMLEN are defined.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
# ifdef PATH_MAX
|
||||
# define MAXPATHLEN PATH_MAX
|
||||
# else
|
||||
# define MAXPATHLEN 2048
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef MAXNAMLEN
|
||||
# ifdef NAME_MAX
|
||||
# define MAXNAMLEN NAME_MAX
|
||||
# else
|
||||
# define MAXNAMLEN 255
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* The following macro defines the type of the mask arguments to select:
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef NO_FD_SET
|
||||
# define SELECT_MASK fd_set
|
||||
#else /* NO_FD_SET */
|
||||
# ifndef _AIX
|
||||
typedef long fd_mask;
|
||||
# endif /* !AIX */
|
||||
# if defined(_IBMR2)
|
||||
# define SELECT_MASK void
|
||||
# else /* !defined(_IBMR2) */
|
||||
# define SELECT_MASK int
|
||||
# endif /* defined(_IBMR2) */
|
||||
#endif /* !NO_FD_SET */
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Define "NBBY" (number of bits per byte) if it's not already defined.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef NBBY
|
||||
# define NBBY 8
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* The following macro defines the number of fd_masks in an fd_set:
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef FD_SETSIZE
|
||||
# ifdef OPEN_MAX
|
||||
# define FD_SETSIZE OPEN_MAX
|
||||
# else
|
||||
# define FD_SETSIZE 256
|
||||
# endif
|
||||
#endif /* FD_SETSIZE */
|
||||
|
||||
#ifndef howmany
|
||||
# define howmany(x, y) (((x)+((y)-1))/(y))
|
||||
#endif /* !defined(howmany) */
|
||||
|
||||
#ifndef NFDBITS
|
||||
# define NFDBITS NBBY*sizeof(fd_mask)
|
||||
#endif /* NFDBITS */
|
||||
|
||||
#define MASK_SIZE howmany(FD_SETSIZE, NFDBITS)
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Not all systems declare the errno variable in errno.h, so this file does it
|
||||
* explicitly. The list of system error messages also isn't generally declared
|
||||
* in a header file anywhere.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef NO_ERRNO
|
||||
extern int errno;
|
||||
#endif /* NO_ERRNO */
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Not all systems declare all the errors that Tcl uses! Provide some
|
||||
* work-arounds...
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef EOVERFLOW
|
||||
# ifdef EFBIG
|
||||
# define EOVERFLOW EFBIG
|
||||
# else /* !EFBIG */
|
||||
# define EOVERFLOW EINVAL
|
||||
# endif /* EFBIG */
|
||||
#endif /* EOVERFLOW */
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Variables provided by the C library:
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#if defined(__APPLE__) && defined(__DYNAMIC__)
|
||||
# include <crt_externs.h>
|
||||
# define environ (*_NSGetEnviron())
|
||||
# define USE_PUTENV 1
|
||||
#else
|
||||
# if defined(_sgi) || defined(__sgi)
|
||||
# define environ _environ
|
||||
# endif
|
||||
extern char ** environ;
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Darwin specifc configure overrides.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Support for fat compiles: configure runs only once for multiple architectures
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
# if defined(__LP64__) && defined (NO_COREFOUNDATION_64)
|
||||
# undef HAVE_COREFOUNDATION
|
||||
# endif /* __LP64__ && NO_COREFOUNDATION_64 */
|
||||
# include <sys/cdefs.h>
|
||||
# ifdef __DARWIN_UNIX03
|
||||
# if __DARWIN_UNIX03
|
||||
# undef HAVE_PUTENV_THAT_COPIES
|
||||
# else
|
||||
# define HAVE_PUTENV_THAT_COPIES 1
|
||||
# endif
|
||||
# endif /* __DARWIN_UNIX03 */
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Include AvailabilityMacros.h here (when available) to ensure any symbolic
|
||||
* MAC_OS_X_VERSION_* constants passed on the command line are translated.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
# ifdef HAVE_AVAILABILITYMACROS_H
|
||||
# include <AvailabilityMacros.h>
|
||||
# endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Support for weak import.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
# ifdef HAVE_WEAK_IMPORT
|
||||
# if !defined(HAVE_AVAILABILITYMACROS_H) || !defined(MAC_OS_X_VERSION_MIN_REQUIRED)
|
||||
# undef HAVE_WEAK_IMPORT
|
||||
# else
|
||||
# ifndef WEAK_IMPORT_ATTRIBUTE
|
||||
# define WEAK_IMPORT_ATTRIBUTE __attribute__((weak_import))
|
||||
# endif
|
||||
# endif
|
||||
# endif /* HAVE_WEAK_IMPORT */
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Support for MAC_OS_X_VERSION_MAX_ALLOWED define from AvailabilityMacros.h:
|
||||
* only use API available in the indicated OS version or earlier.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
# ifdef MAC_OS_X_VERSION_MAX_ALLOWED
|
||||
# if MAC_OS_X_VERSION_MAX_ALLOWED < 1050 && defined(__LP64__)
|
||||
# undef HAVE_COREFOUNDATION
|
||||
# endif
|
||||
# if MAC_OS_X_VERSION_MAX_ALLOWED < 1040
|
||||
# undef HAVE_OSSPINLOCKLOCK
|
||||
# undef HAVE_PTHREAD_ATFORK
|
||||
# undef HAVE_COPYFILE
|
||||
# endif
|
||||
# if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
|
||||
# ifdef TCL_THREADS
|
||||
/* prior to 10.3, realpath is not threadsafe, c.f. bug 711232 */
|
||||
# define NO_REALPATH 1
|
||||
# endif
|
||||
# undef HAVE_LANGINFO
|
||||
# endif
|
||||
# endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
|
||||
# if defined(HAVE_COREFOUNDATION) && defined(__LP64__) && \
|
||||
defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050
|
||||
# warning "Weak import of 64-bit CoreFoundation is not supported, will not run on Mac OS X < 10.5."
|
||||
# endif
|
||||
/*
|
||||
* For now, test exec-17.1 fails (I/O setup after closing stdout) with
|
||||
* posix_spawnp(), but the classic implementation (based on fork()+execvp())
|
||||
* works well under macOS.
|
||||
*/
|
||||
# undef HAVE_POSIX_SPAWNP
|
||||
# undef HAVE_VFORK
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* The following macros and declarations represent the interface between
|
||||
* generic and unix-specific parts of Tcl. Some of the macros may override
|
||||
* functions declared in tclInt.h.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* The default platform eol translation on Unix is TCL_TRANSLATE_LF.
|
||||
*/
|
||||
|
||||
#ifdef DJGPP
|
||||
#define TCL_PLATFORM_TRANSLATION TCL_TRANSLATE_CRLF
|
||||
typedef int socklen_t;
|
||||
#else
|
||||
#define TCL_PLATFORM_TRANSLATION TCL_TRANSLATE_LF
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* The following macros have trivial definitions, allowing generic code to
|
||||
* address platform-specific issues.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define TclpReleaseFile(file) /* Nothing. */
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* The following defines wrap the system memory allocation routines.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define TclpSysAlloc(size, isBin) malloc((size_t)(size))
|
||||
#define TclpSysFree(ptr) free((char *)(ptr))
|
||||
#define TclpSysRealloc(ptr, size) realloc((char *)(ptr), (size_t)(size))
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* The following macros and declaration wrap the C runtime library functions.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define TclpExit exit
|
||||
|
||||
#ifdef TCL_THREADS
|
||||
# include <pthread.h>
|
||||
#endif /* TCL_THREADS */
|
||||
|
||||
/* FIXME - Hyper-enormous platform assumption! */
|
||||
#ifndef AF_INET6
|
||||
# define AF_INET6 10
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* Set of MT-safe implementations of some known-to-be-MT-unsafe library calls.
|
||||
* Instead of returning pointers to the static storage, those return pointers
|
||||
* to the TSD data.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
|
||||
extern struct passwd * TclpGetPwNam(const char *name);
|
||||
extern struct group * TclpGetGrNam(const char *name);
|
||||
extern struct passwd * TclpGetPwUid(uid_t uid);
|
||||
extern struct group * TclpGetGrGid(gid_t gid);
|
||||
extern struct hostent * TclpGetHostByName(const char *name);
|
||||
extern struct hostent * TclpGetHostByAddr(const char *addr,
|
||||
int length, int type);
|
||||
extern void *TclpMakeTcpClientChannelMode(
|
||||
void *tcpSocket, int mode);
|
||||
|
||||
#endif /* _TCLUNIXPORT */
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: c
|
||||
* c-basic-offset: 4
|
||||
* fill-column: 78
|
||||
* End:
|
||||
*/
|
||||
@@ -0,0 +1,582 @@
|
||||
/*
|
||||
* tclWinPort.h --
|
||||
*
|
||||
* This header file handles porting issues that occur because of
|
||||
* differences between Windows and Unix. It should be the only
|
||||
* file that contains #ifdefs to handle different flavors of OS.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _TCLWINPORT
|
||||
#define _TCLWINPORT
|
||||
|
||||
#if !defined(_WIN64) && !defined(__MINGW_USE_VC2005_COMPAT)
|
||||
/* See [Bug 3354324]: file mtime sets wrong time */
|
||||
# define __MINGW_USE_VC2005_COMPAT
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We must specify the lower version we intend to support.
|
||||
*
|
||||
* WINVER = 0x0501 means Windows XP and above
|
||||
*/
|
||||
|
||||
#ifndef WINVER
|
||||
# define WINVER 0x0501
|
||||
#endif
|
||||
#ifndef _WIN32_WINNT
|
||||
# define _WIN32_WINNT 0x0501
|
||||
#endif
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
/* Compatibility to older visual studio / windows platform SDK */
|
||||
#if !defined(MAXULONG_PTR)
|
||||
typedef DWORD DWORD_PTR;
|
||||
typedef DWORD_PTR * PDWORD_PTR;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Ask for the winsock function typedefs, also.
|
||||
*/
|
||||
#ifndef INCL_WINSOCK_API_TYPEDEFS
|
||||
# define INCL_WINSOCK_API_TYPEDEFS 1
|
||||
#endif
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#ifdef HAVE_WSPIAPI_H
|
||||
# include <wspiapi.h>
|
||||
#endif
|
||||
|
||||
#ifdef CHECK_UNICODE_CALLS
|
||||
# define _UNICODE
|
||||
# define UNICODE
|
||||
# define __TCHAR_DEFINED
|
||||
typedef float *_TCHAR;
|
||||
# define _TCHAR_DEFINED
|
||||
typedef float *TCHAR;
|
||||
#endif /* CHECK_UNICODE_CALLS */
|
||||
|
||||
/*
|
||||
* Pull in the typedef of TCHAR for windows.
|
||||
*/
|
||||
#include <tchar.h>
|
||||
#ifndef _TCHAR_DEFINED
|
||||
/* Borland seems to forget to set this. */
|
||||
typedef _TCHAR TCHAR;
|
||||
# define _TCHAR_DEFINED
|
||||
#endif
|
||||
#if defined(_MSC_VER) && defined(__STDC__)
|
||||
/* VS2005 SP1 misses this. See [Bug #3110161] */
|
||||
typedef _TCHAR TCHAR;
|
||||
#endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* The following sets of #includes and #ifdefs are required to get Tcl to
|
||||
* compile under the windows compilers.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
#include <wchar.h>
|
||||
#include <io.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <float.h>
|
||||
#include <malloc.h>
|
||||
#include <process.h>
|
||||
#include <signal.h>
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
|
||||
#ifndef __GNUC__
|
||||
# define strncasecmp _strnicmp
|
||||
# define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Need to block out these includes for building extensions with MetroWerks
|
||||
* compiler for Win32.
|
||||
*/
|
||||
|
||||
#ifndef __MWERKS__
|
||||
#include <sys/stat.h>
|
||||
#include <sys/timeb.h>
|
||||
# ifdef __BORLANDC__
|
||||
# include <utime.h>
|
||||
# else
|
||||
# include <sys/utime.h>
|
||||
# endif /* __BORLANDC__ */
|
||||
#endif /* __MWERKS__ */
|
||||
|
||||
/*
|
||||
* The following defines redefine the Windows Socket errors as
|
||||
* BSD errors so Tcl_PosixError can do the right thing.
|
||||
*/
|
||||
|
||||
#ifndef ENOTEMPTY
|
||||
# define ENOTEMPTY 41 /* Directory not empty */
|
||||
#endif
|
||||
#ifndef EREMOTE
|
||||
# define EREMOTE 66 /* The object is remote */
|
||||
#endif
|
||||
#ifndef EPFNOSUPPORT
|
||||
# define EPFNOSUPPORT 96 /* Protocol family not supported */
|
||||
#endif
|
||||
#ifndef EADDRINUSE
|
||||
# define EADDRINUSE 100 /* Address already in use */
|
||||
#endif
|
||||
#ifndef EADDRNOTAVAIL
|
||||
# define EADDRNOTAVAIL 101 /* Can't assign requested address */
|
||||
#endif
|
||||
#ifndef EAFNOSUPPORT
|
||||
# define EAFNOSUPPORT 102 /* Address family not supported */
|
||||
#endif
|
||||
#ifndef EALREADY
|
||||
# define EALREADY 103 /* Operation already in progress */
|
||||
#endif
|
||||
#ifndef EBADMSG
|
||||
# define EBADMSG 104 /* Not a data message */
|
||||
#endif
|
||||
#ifndef ECANCELED
|
||||
# define ECANCELED 105 /* Canceled */
|
||||
#endif
|
||||
#ifndef ECONNABORTED
|
||||
# define ECONNABORTED 106 /* Software caused connection abort */
|
||||
#endif
|
||||
#ifndef ECONNREFUSED
|
||||
# define ECONNREFUSED 107 /* Connection refused */
|
||||
#endif
|
||||
#ifndef ECONNRESET
|
||||
# define ECONNRESET 108 /* Connection reset by peer */
|
||||
#endif
|
||||
#ifndef EDESTADDRREQ
|
||||
# define EDESTADDRREQ 109 /* Destination address required */
|
||||
#endif
|
||||
#ifndef EHOSTUNREACH
|
||||
# define EHOSTUNREACH 110 /* No route to host */
|
||||
#endif
|
||||
#ifndef EIDRM
|
||||
# define EIDRM 111 /* Identifier removed */
|
||||
#endif
|
||||
#ifndef EINPROGRESS
|
||||
# define EINPROGRESS 112 /* Operation now in progress */
|
||||
#endif
|
||||
#ifndef EISCONN
|
||||
# define EISCONN 113 /* Socket is already connected */
|
||||
#endif
|
||||
#ifndef ELOOP
|
||||
# define ELOOP 114 /* Symbolic link loop */
|
||||
#endif
|
||||
#ifndef EMSGSIZE
|
||||
# define EMSGSIZE 115 /* Message too long */
|
||||
#endif
|
||||
#ifndef ENETDOWN
|
||||
# define ENETDOWN 116 /* Network is down */
|
||||
#endif
|
||||
#ifndef ENETRESET
|
||||
# define ENETRESET 117 /* Network dropped connection on reset */
|
||||
#endif
|
||||
#ifndef ENETUNREACH
|
||||
# define ENETUNREACH 118 /* Network is unreachable */
|
||||
#endif
|
||||
#ifndef ENOBUFS
|
||||
# define ENOBUFS 119 /* No buffer space available */
|
||||
#endif
|
||||
#ifndef ENODATA
|
||||
# define ENODATA 120 /* No data available */
|
||||
#endif
|
||||
#ifndef ENOLINK
|
||||
# define ENOLINK 121 /* Link has be severed */
|
||||
#endif
|
||||
#ifndef ENOMSG
|
||||
# define ENOMSG 122 /* No message of desired type */
|
||||
#endif
|
||||
#ifndef ENOPROTOOPT
|
||||
# define ENOPROTOOPT 123 /* Protocol not available */
|
||||
#endif
|
||||
#ifndef ENOSR
|
||||
# define ENOSR 124 /* Out of stream resources */
|
||||
#endif
|
||||
#ifndef ENOSTR
|
||||
# define ENOSTR 125 /* Not a stream device */
|
||||
#endif
|
||||
#ifndef ENOTCONN
|
||||
# define ENOTCONN 126 /* Socket is not connected */
|
||||
#endif
|
||||
#ifndef ENOTRECOVERABLE
|
||||
# define ENOTRECOVERABLE 127 /* Not recoverable */
|
||||
#endif
|
||||
#ifndef ENOTSOCK
|
||||
# define ENOTSOCK 128 /* Socket operation on non-socket */
|
||||
#endif
|
||||
#ifndef ENOTSUP
|
||||
# define ENOTSUP 129 /* Operation not supported */
|
||||
#endif
|
||||
#ifndef EOPNOTSUPP
|
||||
# define EOPNOTSUPP 130 /* Operation not supported on socket */
|
||||
#endif
|
||||
#ifndef EOTHER
|
||||
# define EOTHER 131 /* Other error */
|
||||
#endif
|
||||
#ifndef EOVERFLOW
|
||||
# define EOVERFLOW 132 /* File too big */
|
||||
#endif
|
||||
#ifndef EOWNERDEAD
|
||||
# define EOWNERDEAD 133 /* Owner dead */
|
||||
#endif
|
||||
#ifndef EPROTO
|
||||
# define EPROTO 134 /* Protocol error */
|
||||
#endif
|
||||
#ifndef EPROTONOSUPPORT
|
||||
# define EPROTONOSUPPORT 135 /* Protocol not supported */
|
||||
#endif
|
||||
#ifndef EPROTOTYPE
|
||||
# define EPROTOTYPE 136 /* Protocol wrong type for socket */
|
||||
#endif
|
||||
#ifndef ETIME
|
||||
# define ETIME 137 /* Timer expired */
|
||||
#endif
|
||||
#ifndef ETIMEDOUT
|
||||
# define ETIMEDOUT 138 /* Connection timed out */
|
||||
#endif
|
||||
#ifndef ETXTBSY
|
||||
# define ETXTBSY 139 /* Text file or pseudo-device busy */
|
||||
#endif
|
||||
#ifndef EWOULDBLOCK
|
||||
# define EWOULDBLOCK 140 /* Operation would block */
|
||||
#endif
|
||||
|
||||
|
||||
/* Visual Studio doesn't have these, so just choose some high numbers */
|
||||
#ifndef ESOCKTNOSUPPORT
|
||||
# define ESOCKTNOSUPPORT 240 /* Socket type not supported */
|
||||
#endif
|
||||
#ifndef ESHUTDOWN
|
||||
# define ESHUTDOWN 241 /* Can't send after socket shutdown */
|
||||
#endif
|
||||
#ifndef ETOOMANYREFS
|
||||
# define ETOOMANYREFS 242 /* Too many references: can't splice */
|
||||
#endif
|
||||
#ifndef EHOSTDOWN
|
||||
# define EHOSTDOWN 243 /* Host is down */
|
||||
#endif
|
||||
#ifndef EUSERS
|
||||
# define EUSERS 244 /* Too many users (for UFS) */
|
||||
#endif
|
||||
#ifndef EDQUOT
|
||||
# define EDQUOT 245 /* Disc quota exceeded */
|
||||
#endif
|
||||
#ifndef ESTALE
|
||||
# define ESTALE 246 /* Stale NFS file handle */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Signals not known to the standard ANSI signal.h. These are used
|
||||
* by Tcl_WaitPid() and generic/tclPosixStr.c
|
||||
*/
|
||||
|
||||
#ifndef SIGTRAP
|
||||
# define SIGTRAP 5
|
||||
#endif
|
||||
#ifndef SIGBUS
|
||||
# define SIGBUS 10
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Supply definitions for macros to query wait status, if not already
|
||||
* defined in header files above.
|
||||
*/
|
||||
|
||||
#ifdef TCL_UNION_WAIT
|
||||
# define WAIT_STATUS_TYPE union wait
|
||||
#else
|
||||
# define WAIT_STATUS_TYPE int
|
||||
#endif /* TCL_UNION_WAIT */
|
||||
|
||||
#ifndef WIFEXITED
|
||||
# define WIFEXITED(stat) (((*((int *) &(stat))) & 0xC0000000) == 0)
|
||||
#endif
|
||||
|
||||
#ifndef WEXITSTATUS
|
||||
# define WEXITSTATUS(stat) (*((int *) &(stat)))
|
||||
#endif
|
||||
|
||||
#ifndef WIFSIGNALED
|
||||
# define WIFSIGNALED(stat) ((*((int *) &(stat))) & 0xC0000000)
|
||||
#endif
|
||||
|
||||
#ifndef WTERMSIG
|
||||
# define WTERMSIG(stat) ((*((int *) &(stat))) & 0x7F)
|
||||
#endif
|
||||
|
||||
#ifndef WIFSTOPPED
|
||||
# define WIFSTOPPED(stat) 0
|
||||
#endif
|
||||
|
||||
#ifndef WSTOPSIG
|
||||
# define WSTOPSIG(stat) (((*((int *) &(stat))) >> 8) & 0xFF)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define constants for waitpid() system call if they aren't defined
|
||||
* by a system header file.
|
||||
*/
|
||||
|
||||
#ifndef WNOHANG
|
||||
# define WNOHANG 1
|
||||
#endif
|
||||
#ifndef WUNTRACED
|
||||
# define WUNTRACED 2
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define access mode constants if they aren't already defined.
|
||||
*/
|
||||
|
||||
#ifndef F_OK
|
||||
# define F_OK 00
|
||||
#endif
|
||||
#ifndef X_OK
|
||||
# define X_OK 01
|
||||
#endif
|
||||
#ifndef W_OK
|
||||
# define W_OK 02
|
||||
#endif
|
||||
#ifndef R_OK
|
||||
# define R_OK 04
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define macros to query file type bits, if they're not already
|
||||
* defined.
|
||||
*/
|
||||
|
||||
#ifndef S_IFLNK
|
||||
# define S_IFLNK 0120000 /* Symbolic Link */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Windows compilers do not define S_IFBLK. However, Tcl uses it in
|
||||
* GetTypeFromMode to identify blockSpecial devices based on the
|
||||
* value in the statsbuf st_mode field. We have no other way to pass this
|
||||
* from NativeStat on Windows so are forced to define it here.
|
||||
* The definition here is essentially what is seen on Linux and MingW.
|
||||
* XXX - the root problem is Tcl using Unix definitions instead of
|
||||
* abstracting the structure into a platform independent one. Sigh - perhaps
|
||||
* Tcl 9
|
||||
*/
|
||||
#ifndef S_IFBLK
|
||||
# define S_IFBLK (S_IFDIR | S_IFCHR)
|
||||
#endif
|
||||
|
||||
#ifndef S_ISREG
|
||||
# ifdef S_IFREG
|
||||
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
# else
|
||||
# define S_ISREG(m) 0
|
||||
# endif
|
||||
#endif /* !S_ISREG */
|
||||
#ifndef S_ISDIR
|
||||
# ifdef S_IFDIR
|
||||
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
# else
|
||||
# define S_ISDIR(m) 0
|
||||
# endif
|
||||
#endif /* !S_ISDIR */
|
||||
#ifndef S_ISCHR
|
||||
# ifdef S_IFCHR
|
||||
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
|
||||
# else
|
||||
# define S_ISCHR(m) 0
|
||||
# endif
|
||||
#endif /* !S_ISCHR */
|
||||
#ifndef S_ISBLK
|
||||
# ifdef S_IFBLK
|
||||
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
||||
# else
|
||||
# define S_ISBLK(m) 0
|
||||
# endif
|
||||
#endif /* !S_ISBLK */
|
||||
#ifndef S_ISFIFO
|
||||
# ifdef S_IFIFO
|
||||
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
|
||||
# else
|
||||
# define S_ISFIFO(m) 0
|
||||
# endif
|
||||
#endif /* !S_ISFIFO */
|
||||
#ifndef S_ISLNK
|
||||
# ifdef S_IFLNK
|
||||
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
|
||||
# else
|
||||
# define S_ISLNK(m) 0
|
||||
# endif
|
||||
#endif /* !S_ISLNK */
|
||||
|
||||
|
||||
/*
|
||||
* Define MAXPATHLEN in terms of MAXPATH if available
|
||||
*/
|
||||
|
||||
#ifndef MAXPATH
|
||||
# define MAXPATH MAX_PATH
|
||||
#endif /* MAXPATH */
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
# define MAXPATHLEN MAXPATH
|
||||
#endif /* MAXPATHLEN */
|
||||
|
||||
/*
|
||||
* Define pid_t and uid_t if they're not already defined.
|
||||
*/
|
||||
|
||||
#if !defined(TCL_PID_T)
|
||||
# define pid_t int
|
||||
#endif /* !TCL_PID_T */
|
||||
#if !defined(TCL_UID_T)
|
||||
# define uid_t int
|
||||
#endif /* !TCL_UID_T */
|
||||
|
||||
/*
|
||||
* Visual C++ has some odd names for common functions, so we need to
|
||||
* define a few macros to handle them. Also, it defines EDEADLOCK and
|
||||
* EDEADLK as the same value, which confuses Tcl_ErrnoId().
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MSVCRT__)
|
||||
# define environ _environ
|
||||
# if defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||
# define hypot _hypot
|
||||
# endif
|
||||
# define exception _exception
|
||||
# undef EDEADLOCK
|
||||
# if defined(_MSC_VER) && (_MSC_VER >= 1700)
|
||||
# define timezone _timezone
|
||||
# endif
|
||||
#endif /* _MSC_VER || __MSVCRT__ */
|
||||
|
||||
/*
|
||||
* Borland's timezone and environ functions.
|
||||
*/
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
# define timezone _timezone
|
||||
# define environ _environ
|
||||
#endif /* __BORLANDC__ */
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
# if !defined(__CHAR_SIGNED__)
|
||||
# error "You must use the -j switch to ensure char is signed."
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* MSVC 8.0 started to mark many standard C library functions depreciated
|
||||
* including the *printf family and others. Tell it to shut up.
|
||||
* (_MSC_VER is 1200 for VC6, 1300 or 1310 for vc7.net, 1400 for 8.0)
|
||||
*/
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(disable:4090) /* see: https://developercommunity.visualstudio.com/t/c-compiler-incorrect-propagation-of-const-qualifie/390711 */
|
||||
# pragma warning(disable:4146)
|
||||
# pragma warning(disable:4244)
|
||||
# if _MSC_VER >= 1400
|
||||
# pragma warning(disable:4267)
|
||||
# pragma warning(disable:4996)
|
||||
# endif
|
||||
#endif
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* The following macros and declarations represent the interface between
|
||||
* generic and windows-specific parts of Tcl. Some of the macros may
|
||||
* override functions declared in tclInt.h.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* The default platform eol translation on Windows is TCL_TRANSLATE_CRLF:
|
||||
*/
|
||||
|
||||
#define TCL_PLATFORM_TRANSLATION TCL_TRANSLATE_CRLF
|
||||
|
||||
/*
|
||||
* Declare dynamic loading extension macro.
|
||||
*/
|
||||
|
||||
#define TCL_SHLIB_EXT ".dll"
|
||||
|
||||
/*
|
||||
* The following define ensures that we use the native putenv
|
||||
* implementation to modify the environment array. This keeps
|
||||
* the C level environment in synch with the system level environment.
|
||||
*/
|
||||
|
||||
#define USE_PUTENV 1
|
||||
#define USE_PUTENV_FOR_UNSET 1
|
||||
|
||||
/*
|
||||
* Msvcrt's putenv() copies the string rather than takes ownership of it.
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MSVCRT__)
|
||||
# define HAVE_PUTENV_THAT_COPIES 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Older version of Mingw are known to lack a MWMO_ALERTABLE define.
|
||||
*/
|
||||
#if !defined(MWMO_ALERTABLE)
|
||||
# define MWMO_ALERTABLE 2
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following defines wrap the system memory allocation routines for
|
||||
* use by tclAlloc.c.
|
||||
*/
|
||||
|
||||
#define TclpSysAlloc(size, isBin) ((void*)HeapAlloc(GetProcessHeap(), \
|
||||
(DWORD)0, (DWORD)size))
|
||||
#define TclpSysFree(ptr) (HeapFree(GetProcessHeap(), \
|
||||
(DWORD)0, (HGLOBAL)ptr))
|
||||
#define TclpSysRealloc(ptr, size) ((void*)HeapReAlloc(GetProcessHeap(), \
|
||||
(DWORD)0, (LPVOID)ptr, (DWORD)size))
|
||||
|
||||
/* This type is not defined in the Windows headers */
|
||||
#define socklen_t int
|
||||
|
||||
|
||||
/*
|
||||
* The following macros have trivial definitions, allowing generic code to
|
||||
* address platform-specific issues.
|
||||
*/
|
||||
|
||||
#define TclpReleaseFile(file) ckfree((char *) file)
|
||||
|
||||
/*
|
||||
* The following macros and declarations wrap the C runtime library
|
||||
* functions.
|
||||
*/
|
||||
|
||||
#define TclpExit exit
|
||||
|
||||
#ifndef INVALID_SET_FILE_POINTER
|
||||
#define INVALID_SET_FILE_POINTER 0xFFFFFFFF
|
||||
#endif /* INVALID_SET_FILE_POINTER */
|
||||
|
||||
#ifndef LABEL_SECURITY_INFORMATION
|
||||
# define LABEL_SECURITY_INFORMATION (0x00000010L)
|
||||
#endif
|
||||
|
||||
#define Tcl_DirEntry void
|
||||
#define TclDIR void
|
||||
|
||||
#endif /* _TCLWINPORT */
|
||||
Submodule
+1
Submodule itcl/itcl added at 33cea588fa
@@ -0,0 +1,2 @@
|
||||
PATCH
|
||||
TCL
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
diff -Naur itcl/generic/itcl_cmds.c ITCL_BLD/generic/itcl_cmds.c
|
||||
--- itcl/generic/itcl_cmds.c 2024-08-06 13:13:08.429776852 -0400
|
||||
+++ ITCL_BLD/generic/itcl_cmds.c 2024-08-06 13:12:35.230286310 -0400
|
||||
@@ -53,9 +53,6 @@
|
||||
if {[info exists library]} {\n\
|
||||
lappend dirs $library\n\
|
||||
} else {\n\
|
||||
- if {[catch {uplevel #0 source -rsrc itcl}] == 0} {\n\
|
||||
- return\n\
|
||||
- }\n\
|
||||
set dirs {}\n\
|
||||
if {[info exists env(ITCL_LIBRARY)]} {\n\
|
||||
lappend dirs $env(ITCL_LIBRARY)\n\
|
||||
@@ -866,7 +863,7 @@
|
||||
int objc; /* number of arguments */
|
||||
Tcl_Obj *CONST objv[]; /* argument objects */
|
||||
{
|
||||
- int pLevel = (int)clientData;
|
||||
+ int pLevel = (int)(size_t)clientData;
|
||||
|
||||
int result;
|
||||
int oldLevel;
|
||||
@@ -1145,7 +1142,7 @@
|
||||
if (!entry) {
|
||||
Tcl_AppendResult(interp,
|
||||
"can't scope variable \"", token,
|
||||
- "\": missing object context\"",
|
||||
+ "\": missing object context",
|
||||
(char*)NULL);
|
||||
result = TCL_ERROR;
|
||||
goto scopeCmdDone;
|
||||
diff -Naur itcl/generic/itclInt.decls ITCL_BLD/generic/itclInt.decls
|
||||
--- itcl/generic/itclInt.decls 2024-08-06 13:13:08.429776852 -0400
|
||||
+++ ITCL_BLD/generic/itclInt.decls 2024-08-06 13:12:35.230286310 -0400
|
||||
@@ -252,7 +252,7 @@
|
||||
CONST char* arglist, CONST char* body, ItclMemberCode** mcodePtr)
|
||||
}
|
||||
declare 58 generic {
|
||||
- void Itcl_DeleteMemberCode (CONST char* cdata)
|
||||
+ void Itcl_DeleteMemberCode (char* cdata)
|
||||
}
|
||||
declare 59 generic {
|
||||
int Itcl_GetMemberCode (Tcl_Interp* interp, ItclMember* member)
|
||||
diff -Naur itcl/generic/itclIntDecls.h ITCL_BLD/generic/itclIntDecls.h
|
||||
--- itcl/generic/itclIntDecls.h 2024-08-06 13:13:08.429776852 -0400
|
||||
+++ ITCL_BLD/generic/itclIntDecls.h 2024-08-06 13:12:35.230286310 -0400
|
||||
@@ -410,7 +410,7 @@
|
||||
#ifndef Itcl_DeleteMemberCode_TCL_DECLARED
|
||||
#define Itcl_DeleteMemberCode_TCL_DECLARED
|
||||
/* 58 */
|
||||
-TCL_EXTERN(void) Itcl_DeleteMemberCode _ANSI_ARGS_((CONST char* cdata));
|
||||
+TCL_EXTERN(void) Itcl_DeleteMemberCode _ANSI_ARGS_((char* cdata));
|
||||
#endif
|
||||
#ifndef Itcl_GetMemberCode_TCL_DECLARED
|
||||
#define Itcl_GetMemberCode_TCL_DECLARED
|
||||
@@ -853,7 +853,7 @@
|
||||
int (*itcl_ChangeMemberFunc) _ANSI_ARGS_((Tcl_Interp* interp, ItclMemberFunc* mfunc, CONST char* arglist, CONST char* body)); /* 55 */
|
||||
void (*itcl_DeleteMemberFunc) _ANSI_ARGS_((CONST char* cdata)); /* 56 */
|
||||
int (*itcl_CreateMemberCode) _ANSI_ARGS_((Tcl_Interp* interp, ItclClass * cdefn, CONST char* arglist, CONST char* body, ItclMemberCode** mcodePtr)); /* 57 */
|
||||
- void (*itcl_DeleteMemberCode) _ANSI_ARGS_((CONST char* cdata)); /* 58 */
|
||||
+ void (*itcl_DeleteMemberCode) _ANSI_ARGS_((char* cdata)); /* 58 */
|
||||
int (*itcl_GetMemberCode) _ANSI_ARGS_((Tcl_Interp* interp, ItclMember* member)); /* 59 */
|
||||
void *reserved60;
|
||||
int (*itcl_EvalMemberCode) _ANSI_ARGS_((Tcl_Interp * interp, ItclMemberFunc * mfunc, ItclMember * member, ItclObject * contextObj, int objc, Tcl_Obj *CONST objv[])); /* 61 */
|
||||
diff -Naur itcl/generic/itcl_methods.c ITCL_BLD/generic/itcl_methods.c
|
||||
--- itcl/generic/itcl_methods.c 2024-08-06 13:13:08.429776852 -0400
|
||||
+++ ITCL_BLD/generic/itcl_methods.c 2024-08-06 13:12:35.230286310 -0400
|
||||
@@ -731,8 +731,7 @@
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
-Itcl_DeleteMemberCode(cdata)
|
||||
- CONST char* cdata; /* pointer to member function definition */
|
||||
+Itcl_DeleteMemberCode(char *cdata)
|
||||
{
|
||||
ItclMemberCode* mcode = (ItclMemberCode*)cdata;
|
||||
|
||||
@@ -1156,7 +1155,7 @@
|
||||
nameLen = strlen(name);
|
||||
|
||||
localPtr = (CompiledLocal*)ckalloc(
|
||||
- (unsigned)(sizeof(CompiledLocal)-sizeof(localPtr->name) + nameLen+1)
|
||||
+ TclOffset(CompiledLocal, name) + nameLen+1
|
||||
);
|
||||
|
||||
localPtr->nextPtr = NULL;
|
||||
diff -Naur itcl/win/itcl.rc ITCL_BLD/win/itcl.rc
|
||||
--- itcl/win/itcl.rc 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ ITCL_BLD/win/itcl.rc 2024-08-06 13:12:35.230286310 -0400
|
||||
@@ -0,0 +1,55 @@
|
||||
+//
|
||||
+// Version resource script.
|
||||
+//
|
||||
+
|
||||
+#include <winver.h>
|
||||
+#include <itcl.h>
|
||||
+
|
||||
+//
|
||||
+// build-up the name suffix that defines the type of build this is.
|
||||
+//
|
||||
+#if DEBUG && !UNCHECKED
|
||||
+#define SUFFIX_DEBUG "g"
|
||||
+#else
|
||||
+#define SUFFIX_DEBUG ""
|
||||
+#endif
|
||||
+
|
||||
+#define SUFFIX SUFFIX_DEBUG
|
||||
+
|
||||
+
|
||||
+VS_VERSION_INFO VERSIONINFO
|
||||
+ FILEVERSION ITCL_MAJOR_VERSION,ITCL_MINOR_VERSION,ITCL_RELEASE_LEVEL,ITCL_RELEASE_SERIAL
|
||||
+ PRODUCTVERSION ITCL_MAJOR_VERSION,ITCL_MINOR_VERSION,ITCL_RELEASE_LEVEL,ITCL_RELEASE_SERIAL
|
||||
+ FILEFLAGSMASK 0x3fL
|
||||
+#ifdef DEBUG
|
||||
+ FILEFLAGS VS_FF_DEBUG
|
||||
+#else
|
||||
+ FILEFLAGS 0x0L
|
||||
+#endif
|
||||
+ FILEOS VOS__WINDOWS32
|
||||
+ FILETYPE VFT_DLL
|
||||
+ FILESUBTYPE 0x0L
|
||||
+BEGIN
|
||||
+ BLOCK "StringFileInfo"
|
||||
+ BEGIN
|
||||
+ BLOCK "040904b0"
|
||||
+ BEGIN
|
||||
+ VALUE "FileDescription", "Itcl language extension for Tcl\0"
|
||||
+ VALUE "Authors", "Michael McLennan\0"
|
||||
+ VALUE "OriginalFilename", "itcl" STRINGIFY(ITCL_MAJOR_VERSION) STRINGIFY(ITCL_MINOR_VERSION) SUFFIX ".dll\0"
|
||||
+ VALUE "CompanyName", "Bell Labs Innovations for Lucent Technologies\0"
|
||||
+ VALUE "FileVersion", ITCL_PATCH_LEVEL
|
||||
+ VALUE "LegalCopyright", "Copyright \251 1993-2004\0"
|
||||
+ VALUE "ProductName", "[Incr Tcl] " ITCL_VERSION " for Windows\0"
|
||||
+ VALUE "ProductVersion", ITCL_PATCH_LEVEL
|
||||
+ END
|
||||
+ END
|
||||
+ BLOCK "VarFileInfo"
|
||||
+ BEGIN
|
||||
+ VALUE "Translation", 0x409, 1200
|
||||
+ END
|
||||
+END
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+62
-81
@@ -1,116 +1,97 @@
|
||||
# Itk uses private Tcl and Itcl interfaces plus Tk stubs. Build it only as
|
||||
# part of bext's internally consistent Tcl/Tk stack; system Tcl/Tk must supply
|
||||
# Itk.
|
||||
# Itk 3 uses private Tcl and Itcl interfaces, so a local Tcl, Tk, or Itcl
|
||||
# build must be matched by a local Itk build. A system stack is accepted only
|
||||
# after the Tcl package path advertises Itcl 3 and Itk 3.
|
||||
|
||||
if (USE_BRLCAD)
|
||||
|
||||
# Decide if we're using Itk
|
||||
cad_enable(ITK "${BEXT_TK_COMPONENTS}")
|
||||
|
||||
else (USE_BRLCAD)
|
||||
|
||||
bext_enable_all_default(ITK itk)
|
||||
if (ENABLE_ITCL AND NOT DEFINED ENABLE_ITK AND NOT DISABLE_TCL)
|
||||
set(ENABLE_ITK ON)
|
||||
endif (ENABLE_ITCL AND NOT DEFINED ENABLE_ITK AND NOT DISABLE_TCL)
|
||||
|
||||
endif (USE_BRLCAD)
|
||||
|
||||
if (TARGET TK_BLD AND NOT DEFINED ENABLE_ITK AND NOT DISABLE_ITK)
|
||||
# Itk uses private interfaces from the selected Tk and Itcl builds.
|
||||
if ((TARGET ITCL_BLD OR TARGET TK_BLD) AND NOT DISABLE_ITK)
|
||||
set(ENABLE_ITK ON)
|
||||
endif ()
|
||||
|
||||
if (NOT ENABLE_ITK AND NOT DISABLE_ITCL AND NOT DISABLE_TCL)
|
||||
find_library(ITK_SYS_LIBRARY NAMES itk3)
|
||||
|
||||
if (NOT ITK_SYS_LIBRARY AND NOT DEFINED ENABLE_ITK)
|
||||
set(ENABLE_ITK "ON" CACHE BOOL "Enable itk build")
|
||||
endif (NOT ITK_SYS_LIBRARY AND NOT DEFINED ENABLE_ITK)
|
||||
|
||||
endif (NOT ENABLE_ITK AND NOT DISABLE_ITCL AND NOT DISABLE_TCL)
|
||||
set(ENABLE_ITK "${ENABLE_ITK}" CACHE BOOL "Enable itk build")
|
||||
|
||||
if (ENABLE_ITK)
|
||||
|
||||
if (NOT TARGET TCL_BLD OR NOT TARGET TK_BLD)
|
||||
message(FATAL_ERROR
|
||||
"A local Itk build requires bext's bundled Tcl and Tk because Itk uses "
|
||||
"private Tcl and Itcl interfaces. A system Tcl/Tk stack must provide "
|
||||
"Itk ${BEXT_ITK_MIN_VERSION} or newer; otherwise configure with "
|
||||
"-DENABLE_TCL=ON."
|
||||
)
|
||||
endif ()
|
||||
|
||||
git_submodule_init(itk configure)
|
||||
git_submodule_init(itk configure.in)
|
||||
|
||||
RegisterDeps(ITK)
|
||||
|
||||
set(BEXT_ITK_VERSION "${BEXT_ITK_BUNDLED_VERSION}" CACHE INTERNAL "Bundled Itk version" FORCE)
|
||||
set(RPATH_SUFFIX "itk${BEXT_ITK_BUNDLED_VERSION}")
|
||||
set(ITK_SRC_DIR "${CMAKE_CURRENT_BINARY_DIR}/ITK_BLD-prefix/src/ITK_BLD")
|
||||
set(ITK_BIN_DIR "${CMAKE_CURRENT_BINARY_DIR}/ITK_BLD-prefix/src/ITK_BLD-build")
|
||||
# If we're building ITK, it's path setup must take into account the
|
||||
# subdirectory in which we are storing the library.
|
||||
set(RPATH_SUFFIX itk3.4)
|
||||
|
||||
set(WITH_TCL_DIR "${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR}")
|
||||
set(WITH_TCL_INCLUDE_DIR "${CMAKE_BUNDLE_INSTALL_PREFIX}/${INCLUDE_DIR}")
|
||||
set(TCL_SRC_DIR "${CMAKE_BINARY_DIR}/tcl/TCL_BLD-prefix/src/TCL_BLD")
|
||||
set(WITH_TK_DIR "${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR}")
|
||||
set(WITH_TK_INCLUDE_DIR "${CMAKE_BUNDLE_INSTALL_PREFIX}/${INCLUDE_DIR}")
|
||||
set(TK_SRC_DIR "${CMAKE_BINARY_DIR}/tk/TK_BLD-prefix/src/TK_BLD")
|
||||
set(WITH_ITCL_DIR "${BEXT_ITCL_CONFIG_DIR}")
|
||||
set(ITCL_SRC_DIR "${BEXT_ITCL_SOURCE_DIR}")
|
||||
set(ITK_SRC_CPY_TGT "${CMAKE_CURRENT_BINARY_DIR}/ITK_BLD-prefix/src/ITK_BLD")
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/itk_configure.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/itk_configure.cmake @ONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/itk_build.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/itk_build.cmake @ONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/itk_install.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/itk_install.cmake @ONLY)
|
||||
|
||||
set(ITK_PATCH_COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
"-DITK_SOURCE_DIR=<SOURCE_DIR>"
|
||||
"-DITK_PATCH_EXECUTABLE=${PATCH_NATIVE_EXECUTABLE}"
|
||||
"-DITK_PATCH_CHECK_OPTION=${PATCH_CHECK_OPTION}"
|
||||
"-DITK_PATCH_REJECT_DIR=${PATCH_REJECT_DIR}"
|
||||
"-DITK_PATCH_FILE=${CMAKE_CURRENT_SOURCE_DIR}/itk.patch"
|
||||
"-DITK_INSTALL_PATCH_FILE=${CMAKE_CURRENT_SOURCE_DIR}/itk_install.patch"
|
||||
-P "${CMAKE_CURRENT_SOURCE_DIR}/itk_apply_patch.cmake"
|
||||
ExternalProject_Add(ITK_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/itk"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/itk.patch
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${ITK_SRC_CPY_TGT}/CMake
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/addfiles/CMakeLists.txt ${ITK_SRC_CPY_TGT}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/addfiles/FindTCL.cmake ${ITK_SRC_CPY_TGT}/CMake
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/addfiles/FindITCL.cmake ${ITK_SRC_CPY_TGT}/CMake
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${ITK_SRC_CPY_TGT}/generic/itcl3
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/addfiles/itclDecls.h ${ITK_SRC_CPY_TGT}/generic/itcl3
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/addfiles/itcl.h ${ITK_SRC_CPY_TGT}/generic/itcl3
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/addfiles/itclIntDecls.h ${ITK_SRC_CPY_TGT}/generic/itcl3
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/addfiles/itclInt.h ${ITK_SRC_CPY_TGT}/generic/itcl3
|
||||
CMAKE_ARGS
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
-DBIN_DIR=$<IF:$<BOOL:${WIN32}>,${LIB_DIR},${BIN_DIR}>
|
||||
-DLIB_DIR=${LIB_DIR}
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BUNDLE_INSTALL_PREFIX}
|
||||
-DCMAKE_INSTALL_RPATH=${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR}/${RPATH_SUFFIX}
|
||||
-DINCLUDE_DIR=${INCLUDE_DIR}
|
||||
-DITCL_ROOT=$<$<BOOL:${ITCL_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DSHARED_DIR=${LIB_DIR}
|
||||
-DTCL_ENABLE_TK=ON
|
||||
-DTCL_ROOT=$<$<BOOL:${TCL_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DTCL_SOURCE_DIR=${CMAKE_SOURCE_DIR}/tcl/tcl
|
||||
-DTK_SOURCE_DIR=${CMAKE_SOURCE_DIR}/tk/tk
|
||||
LOG_CONFIGURE ${EXT_BUILD_QUIET}
|
||||
LOG_BUILD ${EXT_BUILD_QUIET}
|
||||
LOG_INSTALL ${EXT_BUILD_QUIET}
|
||||
LOG_OUTPUT_ON_FAILURE ${EXT_BUILD_QUIET}
|
||||
STEP_TARGETS install
|
||||
)
|
||||
|
||||
if (NOT MSVC)
|
||||
ExternalProject_Add(ITK_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/itk"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
PATCH_COMMAND ${ITK_PATCH_COMMAND}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/manifest.uuid <SOURCE_DIR>/manifest.uuid
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory <SOURCE_DIR>/tclconfig
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BEXT_ITCL_BUNDLED_SOURCE_DIR}/tclconfig/install-sh <SOURCE_DIR>/tclconfig/install-sh
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/itk_configure.cmake
|
||||
BUILD_COMMAND ${BEXT_MAKE_COMMAND} -j${pcnt}
|
||||
INSTALL_COMMAND ${BEXT_MAKE_COMMAND} -j1 INSTALL_OPTIONS=-C install
|
||||
LOG_CONFIGURE ${EXT_BUILD_QUIET}
|
||||
LOG_BUILD ${EXT_BUILD_QUIET}
|
||||
LOG_INSTALL ${EXT_BUILD_QUIET}
|
||||
LOG_OUTPUT_ON_FAILURE ${EXT_BUILD_QUIET}
|
||||
STEP_TARGETS install
|
||||
)
|
||||
else (NOT MSVC)
|
||||
# Itk's rules.vc is newer than Tcl 8.6's, so rules-ext.vc selects the
|
||||
# local nmake support files. Upstream omits the matching targets.vc;
|
||||
# supply the complete file rather than patching one into existence.
|
||||
ExternalProject_Add(ITK_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/itk"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
PATCH_COMMAND ${ITK_PATCH_COMMAND}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/manifest.uuid <SOURCE_DIR>/manifest.uuid
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/targets.vc <SOURCE_DIR>/win/targets.vc
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory <SOURCE_DIR>/tclconfig
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BEXT_ITCL_BUNDLED_SOURCE_DIR}/tclconfig/install-sh <SOURCE_DIR>/tclconfig/install-sh
|
||||
CONFIGURE_COMMAND ""
|
||||
BINARY_DIR ${ITK_SRC_DIR}/win
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/itk_build.cmake
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/itk_install.cmake
|
||||
LOG_BUILD ${EXT_BUILD_QUIET}
|
||||
LOG_INSTALL ${EXT_BUILD_QUIET}
|
||||
LOG_OUTPUT_ON_FAILURE ${EXT_BUILD_QUIET}
|
||||
STEP_TARGETS install
|
||||
)
|
||||
endif (NOT MSVC)
|
||||
|
||||
TargetInstallDeps(ITK ITK_DEPENDS)
|
||||
|
||||
# Copy the license into position in CMAKE_BUNDLE_INSTALL_PREFIX
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/itk/license.terms
|
||||
${DOC_LICENSE_DIR}/itk.txt
|
||||
${DOC_LICENSE_DIR}/itk3.txt
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
endif (ENABLE_ITK)
|
||||
|
||||
mark_as_advanced(ITK_LIBRARY)
|
||||
mark_as_advanced(ITK_LIBRARIES)
|
||||
mark_as_advanced(ITK_VERSION)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
Itk in bext
|
||||
===========
|
||||
|
||||
Tcl 8.6.18 already bundles Itcl 4.3.7, so bext deliberately has no separate
|
||||
Itcl project. Itk is not part of either source distribution, so the bundled
|
||||
stack builds Itk from its own upstream repository after Tcl and Tk. A system
|
||||
Tcl/Tk stack must already provide Itcl and Itk; bext never builds Itk against
|
||||
system Tcl/Tk.
|
||||
|
||||
Itk cannot be built from installed public headers alone. Its implementation
|
||||
includes Tcl's private tclInt.h and Itcl's private itclInt.h and directly uses
|
||||
the corresponding internal structures and entry points. The Itk build must
|
||||
therefore use the private headers and stubs from the exact Tcl/Itcl sources it
|
||||
accompanies. Bext supplies the standard install-sh helper omitted from the Itk
|
||||
repository. On Windows, explicit Tcl, Tk, and Itcl source directories are
|
||||
passed to nmake. On Unix-like platforms, upstream's generated TEA configure
|
||||
logic gets the corresponding source locations from the bundled configuration.
|
||||
|
||||
Upstream's generic Windows TEA install target copies only ``*.tcl`` library
|
||||
files. Itk also needs its ``*.itk`` class definitions and ``tclIndex`` at
|
||||
runtime, so bext extends the nmake install target to copy them and verifies the
|
||||
complete script set before accepting the install.
|
||||
|
||||
Itk itself makes no direct Xlib calls: all of its window-system interaction
|
||||
goes through Tk stubs. Upstream's TEA configuration nevertheless adds the
|
||||
host X library to Itk. Bext suppresses that unnecessary dependency so Itk
|
||||
uses the X implementation selected by its matching Tk build and does not mix
|
||||
two incompatible X ABIs in builds such as the Xmin test configuration.
|
||||
|
||||
Itk's own nominal Itcl 4.1 requirement is not sufficient: its upstream suite
|
||||
has seven failures with Itcl 4.1.0, involving private/protected components and
|
||||
destroyed-component cleanup, while all 100 tests pass with Itcl 4.1.1. Bext
|
||||
therefore retains 4.1.1 as Itk's stub and package-index floor.
|
||||
|
||||
BRL-CAD has a stronger system-stack requirement. With Tcl/Tk 8.6.18, Itcl
|
||||
4.1.1, 4.1.2, and 4.2.3 fail the Tk-first Iwidgets baseline because they lack
|
||||
Itcl 4.3.0's workaround for Tcl 8.6.15's `Tcl_NewObjectInstance` behavior.
|
||||
The complete baseline passes with Itcl 4.3.0 and Itk 4.2.3, so bext requires
|
||||
Itcl 4.3.0 or newer before accepting a system stack.
|
||||
|
||||
System selection is all-or-nothing: Tcl must load Itcl 4.3.0 or newer, and its
|
||||
package path must advertise Itk 4.2.3 or newer before bext accepts the matching
|
||||
system Tk. Itk detection asks Tcl's package handler to index available versions
|
||||
without executing the selected package's load script, enforcing the floor on
|
||||
headless builders without trying to create a Tk window. If either extension is
|
||||
missing or too old, bext selects the complete bundled stack.
|
||||
|
||||
The bundled Itk revision reports version 4.2.7 and includes the upstream August
|
||||
2024 release plus subsequent Windows, Tcl/Tk 9, warning, and TEA maintenance.
|
||||
The complete upstream suite and BRL-CAD GUI baseline pass with the bundled
|
||||
Itcl under Xmin using the Xmin-compatible Tk build.
|
||||
@@ -0,0 +1,279 @@
|
||||
# C M A K E L I S T S . T X T
|
||||
# ITK
|
||||
#
|
||||
# Copyright (c) 2010 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
#
|
||||
# 3. The name of the author may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# *******************************************************************
|
||||
# *** Itk CMakeLists.txt ***
|
||||
# *******************************************************************
|
||||
|
||||
# Minimum required version of CMake
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
# set CMake project name
|
||||
project(ITK)
|
||||
|
||||
# install(CODE) uses generator expressions - requires 3.14 or newer.
|
||||
# We want it to be on, but until we can bump our minimum requirement
|
||||
# set it to OLD to make sure we don't break anything.
|
||||
if (POLICY CMP0087)
|
||||
cmake_policy(SET CMP0087 OLD)
|
||||
endif (POLICY CMP0087)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
|
||||
|
||||
set(CMAKE_FIND_FRAMEWORK NEVER)
|
||||
find_package(TCL REQUIRED)
|
||||
find_package(ITCL REQUIRED)
|
||||
|
||||
# version numbers
|
||||
set(ITK_VERSION_MAJOR 3)
|
||||
set(ITK_VERSION_MINOR 4)
|
||||
set(ITK_PATCH_LEVEL 2)
|
||||
set(ITK_VERSION "${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}")
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Initialize some relative variable names
|
||||
if(NOT BIN_DIR)
|
||||
if (WIN32)
|
||||
set(BIN_DIR lib)
|
||||
else (WIN32)
|
||||
set(BIN_DIR bin)
|
||||
endif (WIN32)
|
||||
endif(NOT BIN_DIR)
|
||||
if(NOT SHARED_DIR)
|
||||
set(SHARED_DIR lib)
|
||||
endif(NOT SHARED_DIR)
|
||||
if(NOT LIB_DIR)
|
||||
set(LIB_DIR lib)
|
||||
endif(NOT LIB_DIR)
|
||||
if(NOT INCLUDE_DIR)
|
||||
set(INCLUDE_DIR include)
|
||||
endif(NOT INCLUDE_DIR)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# First, get some standard options out of the way
|
||||
add_definitions(-DSTDC_HEADERS=1)
|
||||
|
||||
# We're building Itk
|
||||
add_definitions(-DBUILD_itk)
|
||||
|
||||
# We want to check /usr/local by default, so add it if it exists. (We need
|
||||
# this to find X11 headers on FreeBSD, for example...)
|
||||
if (IS_DIRECTORY /usr/local)
|
||||
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} /usr/local)
|
||||
if (IS_DIRECTORY /usr/local/include)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} /usr/local/include)
|
||||
endif (IS_DIRECTORY /usr/local/include)
|
||||
endif (IS_DIRECTORY /usr/local)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# We need to enable the threading macros found in tcl.h and tclInt.h.
|
||||
# The use of the threading features is determined by the core the
|
||||
# extension is loaded into, but we need to compile with these macros
|
||||
# turned on.
|
||||
#--------------------------------------------------------------------
|
||||
add_definitions(-DTCL_THREADS=1)
|
||||
|
||||
include(CMakeParseArguments)
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckCSourceCompiles)
|
||||
function(Tcl_Check_Include_File filename)
|
||||
cmake_parse_arguments(OPT "USE" "" "" ${ARGN})
|
||||
string(REPLACE "." "_" var "${filename}")
|
||||
string(REPLACE "/" "_" var "${var}")
|
||||
string(TOUPPER "${var}" var)
|
||||
check_include_files(${filename} HAVE_${var})
|
||||
if(HAVE_${var})
|
||||
set(CVAR HAVE_${var})
|
||||
if(OPT_USE)
|
||||
# Usability test requested - we're not done yet.
|
||||
check_c_source_compiles("#include <${filename}>\nint main() {return 0;}" ${var}_USABLE)
|
||||
if(${var}_USABLE)
|
||||
set(HAVE_${var} 1 PARENT_SCOPE)
|
||||
set(${CVAR} 1 PARENT_SCOPE)
|
||||
add_definitions(-D${CVAR}=1)
|
||||
endif(${var}_USABLE)
|
||||
else(OPT_USE)
|
||||
set(HAVE_${var} 1 PARENT_SCOPE)
|
||||
set(${CVAR} 1 PARENT_SCOPE)
|
||||
add_definitions(-D${CVAR}=1)
|
||||
endif(OPT_USE)
|
||||
endif(HAVE_${var})
|
||||
endfunction(Tcl_Check_Include_File)
|
||||
|
||||
Tcl_Check_Include_File(dlfcn.h USE)
|
||||
Tcl_Check_Include_File(errno.h USE)
|
||||
Tcl_Check_Include_File(float.h USE)
|
||||
Tcl_Check_Include_File(inttypes.h)
|
||||
Tcl_Check_Include_File(limits.h USE)
|
||||
Tcl_Check_Include_File(memory.h)
|
||||
Tcl_Check_Include_File(net/errno.h USE)
|
||||
Tcl_Check_Include_File(stdint.h)
|
||||
Tcl_Check_Include_File(stdlib.h)
|
||||
Tcl_Check_Include_File(string.h)
|
||||
Tcl_Check_Include_File(strings.h)
|
||||
Tcl_Check_Include_File(sys/param.h USE)
|
||||
Tcl_Check_Include_File(sys/stat.h)
|
||||
Tcl_Check_Include_File(sys/types.h)
|
||||
Tcl_Check_Include_File(sys/wait.h USE)
|
||||
Tcl_Check_Include_File(unistd.h)
|
||||
Tcl_Check_Include_File(values.h USE)
|
||||
|
||||
# TODO - for now, we need X11 on both *nix and Mac platforms.
|
||||
# Eventually we'll need to re-enable support for Aqua on Mac...
|
||||
if(NOT WIN32)
|
||||
find_package(X11)
|
||||
endif()
|
||||
|
||||
set(ITK_SRCS
|
||||
generic/itkStubInit.c
|
||||
generic/itkStubLib.c
|
||||
generic/itk_archetype.c
|
||||
generic/itk_cmds.c
|
||||
generic/itk_option.c
|
||||
generic/itk_util.c
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
set(ITK_SRCS ${ITK_SRCS} win/dllEntryPoint.c)
|
||||
endif(WIN32)
|
||||
|
||||
set(ITK_STUB_SRCS generic/itkStubLib.c)
|
||||
|
||||
set(ITK_INCLUDE_DIRS ${ITK_SOURCE_DIR}/generic ${ITK_BINARY_DIR}/include)
|
||||
mark_as_advanced(ITK_INCLUDE_DIRS)
|
||||
|
||||
|
||||
# Like ITcl, Itk requires private Tcl headers
|
||||
# At least one Linux distro puts what we need here
|
||||
set(HDRS_CANDIDATE_DIR ${TCL_INCLUDE_PATH}8.6/tcl-private)
|
||||
if (EXISTS ${HDRS_CANDIDATE_DIR})
|
||||
set(TCL_PRIVATE_HDRS ${HDRS_CANDIDATE_DIR}/generic)
|
||||
if(NOT WIN32)
|
||||
set(TCL_PRIVATE_HDRS ${TCL_PRIVATE_HDRS} ${HDRS_CANDIDATE_DIR}/unix)
|
||||
else(NOT WIN32)
|
||||
set(TCL_PRIVATE_HDRS ${TCL_PRIVATE_HDRS} ${HDRS_CANDIDATE_DIR}/win)
|
||||
endif(NOT WIN32)
|
||||
endif ()
|
||||
# Itk also requires private Tk headers
|
||||
set(HDRS_CANDIDATE_DIR ${TCL_INCLUDE_PATH}8.6/tk-private)
|
||||
if (EXISTS ${HDRS_CANDIDATE_DIR})
|
||||
set(TCL_PRIVATE_HDRS ${TCL_PRIVATE_HDRS} ${HDRS_CANDIDATE_DIR}/generic)
|
||||
if(NOT WIN32)
|
||||
set(TCL_PRIVATE_HDRS ${TCL_PRIVATE_HDRS} ${HDRS_CANDIDATE_DIR}/unix)
|
||||
else(NOT WIN32)
|
||||
set(TCL_PRIVATE_HDRS ${TCL_PRIVATE_HDRS} ${HDRS_CANDIDATE_DIR}/win)
|
||||
endif(NOT WIN32)
|
||||
endif ()
|
||||
|
||||
# If we don't have what we need, see if we know where to find
|
||||
# a source directory
|
||||
if (NOT TCL_PRIVATE_HDRS)
|
||||
if (NOT DEFINED TCL_SOURCE_DIR)
|
||||
message(FATAL_ERROR "Itk3 needs to know where to find the Tcl source directory")
|
||||
endif (NOT DEFINED TCL_SOURCE_DIR)
|
||||
set(TCL_PRIVATE_HDRS ${TCL_SOURCE_DIR}/generic)
|
||||
if(NOT WIN32)
|
||||
set(TCL_PRIVATE_HDRS ${TCL_PRIVATE_HDRS} ${TCL_SOURCE_DIR}/unix)
|
||||
else(NOT WIN32)
|
||||
set(TCL_PRIVATE_HDRS ${TCL_PRIVATE_HDRS} ${TCL_SOURCE_DIR}/win)
|
||||
endif(NOT WIN32)
|
||||
if (NOT DEFINED TK_SOURCE_DIR)
|
||||
message(FATAL_ERROR "Itk3 needs to know where to find the Tk source directory")
|
||||
endif (NOT DEFINED TK_SOURCE_DIR)
|
||||
if(WIN32)
|
||||
set(TCL_PRIVATE_HDRS ${TCL_PRIVATE_HDRS} ${TK_SOURCE_DIR}/xlib)
|
||||
endif(WIN32)
|
||||
endif (NOT TCL_PRIVATE_HDRS)
|
||||
|
||||
include_directories(
|
||||
# Itcl3 is iffy as a system install - just reference the local copy
|
||||
${CMAKE_SOURCE_DIR}/generic/itcl3
|
||||
${TCL_INCLUDE_PATH}
|
||||
${TK_INCLUDE_PATH}
|
||||
${ITCL_INCLUDE_PATH}
|
||||
${ITK_INCLUDE_DIRS}
|
||||
${X11_INCLUDE_DIR}
|
||||
${TCL_PRIVATE_HDRS}
|
||||
)
|
||||
|
||||
add_library(itk${ITK_VERSION} SHARED ${ITK_SRCS})
|
||||
target_link_libraries(itk${ITK_VERSION} ${M_LIBRARY} ${TCL_STUB_LIBRARY} ${TK_STUB_LIBRARY} ${ITCL_STUB_LIBRARY})
|
||||
set_property(TARGET itk${ITK_VERSION} APPEND PROPERTY COMPILE_DEFINITIONS USE_TCL_STUBS)
|
||||
set_property(TARGET itk${ITK_VERSION} APPEND PROPERTY COMPILE_DEFINITIONS USE_ITCL_STUBS)
|
||||
set_property(TARGET itk${ITK_VERSION} APPEND PROPERTY COMPILE_DEFINITIONS USE_TK_STUBS)
|
||||
install(TARGETS itk${ITK_VERSION}
|
||||
RUNTIME DESTINATION ${BIN_DIR}/itk${ITK_VERSION}
|
||||
LIBRARY DESTINATION ${SHARED_DIR}/itk${ITK_VERSION}
|
||||
ARCHIVE DESTINATION ${LIB_DIR}/itk${ITK_VERSION})
|
||||
|
||||
add_library(itkstub STATIC ${ITK_STUB_SRCS})
|
||||
target_link_libraries(itkstub ${ITCL_STUB_LIBRARY} ${TCL_STUB_LIBRARY} ${TK_STUB_LIBRARY})
|
||||
set_property(TARGET itkstub APPEND PROPERTY COMPILE_DEFINITIONS USE_TCL_STUBS)
|
||||
set_property(TARGET itkstub APPEND PROPERTY COMPILE_DEFINITIONS USE_ITCL_STUBS)
|
||||
set_property(TARGET itkstub APPEND PROPERTY COMPILE_DEFINITIONS USE_TK_STUBS)
|
||||
install(TARGETS itkstub
|
||||
RUNTIME DESTINATION ${BIN_DIR}/itk${ITK_VERSION}
|
||||
LIBRARY DESTINATION ${LIB_DIR}/itk${ITK_VERSION}
|
||||
ARCHIVE DESTINATION ${LIB_DIR}/itk${ITK_VERSION})
|
||||
|
||||
# Create pkgIndex.tcl files
|
||||
file(GENERATE
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl"
|
||||
CONTENT "
|
||||
if {![package vsatisfies [package provide Tcl] 8.5]} {return}
|
||||
package ifneeded Itk ${ITK_VERSION} [list load [file join $dir ../../${SHARED_DIR}/itk${ITK_VERSION} $<TARGET_FILE_NAME:itk${ITK_VERSION}>] Itk]
|
||||
")
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl DESTINATION ${LIB_DIR}/itk${ITK_VERSION})
|
||||
|
||||
set(ITK_LIBRARY_FILES
|
||||
library/Archetype.itk
|
||||
library/Toplevel.itk
|
||||
library/Widget.itk
|
||||
library/itk.tcl
|
||||
library/tclIndex
|
||||
)
|
||||
install(FILES ${ITK_LIBRARY_FILES} DESTINATION lib/itk${ITK_VERSION})
|
||||
|
||||
set(ITK_HDRS
|
||||
generic/itk.h
|
||||
generic/itkDecls.h
|
||||
)
|
||||
install(FILES ${ITK_HDRS} DESTINATION ${INCLUDE_DIR})
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -0,0 +1,116 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindTCL
|
||||
-------
|
||||
|
||||
This module finds if Tcl is installed and determines where the include
|
||||
files and libraries are. It also determines what the name of the
|
||||
library is. This code sets the following variables:
|
||||
|
||||
::
|
||||
|
||||
ITCL_FOUND = Tcl was found
|
||||
ITCL_LIBRARY = path to Tcl library (tcl tcl80)
|
||||
ITCL_INCLUDE_PATH = path to where tcl.h can be found
|
||||
ITCL_STUB_LIBRARY = path to Tcl stub library
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
|
||||
set(_ITCL_SEARCHES)
|
||||
|
||||
# Search ITCL_ROOT first if it is set.
|
||||
if(ITCL_ROOT)
|
||||
set(_ITCL_SEARCH_ROOT PATHS ${ITCL_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _ITCL_SEARCHES _ITCL_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
set(ITCL_POSSIBLE_LIB_PATH_SUFFIXES
|
||||
lib
|
||||
lib/itcl
|
||||
lib/itcl3.4
|
||||
itcl
|
||||
itcl3.4
|
||||
)
|
||||
|
||||
set(ITCL_POSSIBLE_LIB_NAMES
|
||||
itcl
|
||||
itcl3
|
||||
itcl3.4
|
||||
)
|
||||
|
||||
if(NOT ITCL_LIBRARY)
|
||||
foreach(search ${_ITCL_SEARCHES})
|
||||
find_library(ITCL_LIBRARY
|
||||
NAMES ${ITCL_POSSIBLE_LIB_NAMES}
|
||||
NAMES_PER_DIR ${${search}}
|
||||
PATH_SUFFIXES ${ITCL_POSSIBLE_LIB_PATH_SUFFIXES})
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT ITCL_LIBRARY)
|
||||
find_library(ITCL_LIBRARY
|
||||
NAMES ${ITCL_POSSIBLE_LIB_NAMES}
|
||||
PATH_SUFFIXES ${ITCL_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endif(NOT ITCL_LIBRARY)
|
||||
|
||||
set(ITCLSTUB_POSSIBLE_LIB_NAMES
|
||||
itclstub
|
||||
itclstub3
|
||||
itclstub3.4
|
||||
)
|
||||
if(NOT ITCL_STUB_LIBRARY)
|
||||
foreach(search ${_ITCL_SEARCHES})
|
||||
find_library(ITCL_STUB_LIBRARY
|
||||
NAMES ${ITCLSTUB_POSSIBLE_LIB_NAMES}
|
||||
NAMES_PER_DIR ${${search}}
|
||||
PATH_SUFFIXES ${ITCL_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT ITCL_STUB_LIBRARY)
|
||||
find_library(ITCL_STUB_LIBRARY
|
||||
NAMES ${ITCLSTUB_POSSIBLE_LIB_NAMES}
|
||||
PATH_SUFFIXES ${ITCL_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endif()
|
||||
|
||||
set(ITCL_POSSIBLE_INCLUDE_PATH_SUFFIXES
|
||||
include
|
||||
include/itcl
|
||||
include/itcl3
|
||||
include/itcl3.4
|
||||
)
|
||||
|
||||
foreach(search ${_ITCL_SEARCHES})
|
||||
find_path(ITCL_INCLUDE_PATH
|
||||
NAMES itcl.h ${${search}}
|
||||
PATH_SUFFIXES ${ITCL_POSSIBLE_INCLUDE_PATH_SUFFIXES}
|
||||
)
|
||||
endforeach()
|
||||
if (NOT ITCL_INCLUDE_PATH)
|
||||
find_path(ITCL_INCLUDE_PATH
|
||||
NAMES itcl.h
|
||||
HINTS ${ITCL_POSSIBLE_INCLUDE_PATHS}
|
||||
)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ITCL
|
||||
REQUIRED_VARS ITCL_LIBRARY ITCL_STUB_LIBRARY ITCL_INCLUDE_PATH
|
||||
)
|
||||
|
||||
mark_as_advanced(
|
||||
ITCL_INCLUDE_PATH
|
||||
ITCL_LIBRARY
|
||||
ITCL_STUB_LIBRARY
|
||||
)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
@@ -0,0 +1,554 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindTCL
|
||||
-------
|
||||
|
||||
This module finds if Tcl is installed and determines where the include
|
||||
files and libraries are. It also determines what the name of the
|
||||
library is. This code sets the following variables:
|
||||
|
||||
::
|
||||
|
||||
TCL_FOUND = Tcl was found
|
||||
TCLSH_FOUND = TRUE if tclsh has been found
|
||||
TCL_LIBRARY = path to Tcl library (tcl tcl80)
|
||||
TCL_INCLUDE_PATH = path to where tcl.h can be found
|
||||
TCL_TCLSH = path to tclsh binary (tcl tcl80)
|
||||
|
||||
|
||||
|
||||
If TCL_ENABLE_TK is set, the following are also set:
|
||||
|
||||
::
|
||||
|
||||
TK_FOUND = Tk was found
|
||||
TCLTK_FOUND = Tcl and Tk were found
|
||||
TK_LIBRARY = path to Tk library (tk tk80 etc)
|
||||
TK_INCLUDE_PATH = path to where tk.h can be found
|
||||
TK_WISH = full path to the wish executable
|
||||
TCL_STUB_LIBRARY = path to Tcl stub library
|
||||
TK_STUB_LIBRARY = path to Tk stub library
|
||||
TTK_STUB_LIBRARY = path to ttk stub library
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
|
||||
set(_TCL_SEARCHES)
|
||||
|
||||
# Search TCL_ROOT first if it is set.
|
||||
if(TCL_ROOT)
|
||||
set(_TCL_SEARCH_ROOT PATHS ${TCL_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _TCL_SEARCHES _TCL_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
get_filename_component(
|
||||
ActiveTcl_CurrentVersion
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]"
|
||||
NAME
|
||||
)
|
||||
set(
|
||||
TCLTK_POSSIBLE_BIN_PATHS
|
||||
${TCLTK_POSSIBLE_BIN_PATHS}
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/bin"
|
||||
)
|
||||
|
||||
get_filename_component(
|
||||
ActiveTcl_CurrentVersion
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]"
|
||||
NAME
|
||||
)
|
||||
set(
|
||||
TCLTK_POSSIBLE_LIB_PATHS
|
||||
${TCLTK_POSSIBLE_LIB_PATHS}
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/lib"
|
||||
"$ENV{ProgramFiles}/Tcl/Lib"
|
||||
"C:/Program Files/Tcl/lib"
|
||||
"C:/Tcl/lib"
|
||||
)
|
||||
|
||||
set(
|
||||
TCLTK_POSSIBLE_INCLUDE_PATHS
|
||||
${TCLTK_POSSIBLE_INCLUDE_PATHS}
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/include"
|
||||
"$ENV{ProgramFiles}/Tcl/include"
|
||||
"C:/Program Files/Tcl/include"
|
||||
"C:/Tcl/include"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(
|
||||
TCL_TCLSH_NAMES
|
||||
tclsh
|
||||
tclsh${TCL_LIBRARY_VERSION}
|
||||
tclsh${TK_LIBRARY_VERSION}
|
||||
tclsh${TK_WISH_VERSION}
|
||||
tclsh87
|
||||
tclsh8.7
|
||||
tclsh86
|
||||
tclsh8.6
|
||||
tclsh85
|
||||
tclsh8.5
|
||||
tclsh84
|
||||
tclsh8.4
|
||||
tclsh83
|
||||
tclsh8.3
|
||||
tclsh82
|
||||
tclsh8.2
|
||||
tclsh80
|
||||
tclsh8.0
|
||||
)
|
||||
if(CYGWIN)
|
||||
set(TCL_TCLSH_NAMES ${TCL_TCLSH_NAMES} cygtclsh83 cygtclsh80)
|
||||
endif(CYGWIN)
|
||||
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_program(TCL_TCLSH NAMES ${TCL_TCLSH_NAMES} ${${search}} PATH_SUFFIXES bin)
|
||||
endforeach()
|
||||
if(NOT TCL_TCLSH)
|
||||
find_program(TCL_TCLSH NAMES ${TCL_TCLSH_NAMES} HINTS ${TCLTK_POSSIBLE_BIN_PATHS})
|
||||
endif(NOT TCL_TCLSH)
|
||||
|
||||
if(TCL_ENABLE_TK)
|
||||
set(
|
||||
TK_WISH_NAMES
|
||||
wish
|
||||
wish${TCL_LIBRARY_VERSION}
|
||||
wish${TK_LIBRARY_VERSION}
|
||||
wish${TCL_TCLSH_VERSION}
|
||||
wish86
|
||||
wish8.6
|
||||
wish85
|
||||
wish8.5
|
||||
wish84
|
||||
wish8.4
|
||||
wish83
|
||||
wish8.3
|
||||
wish82
|
||||
wish8.2
|
||||
wish80
|
||||
wish8.0
|
||||
)
|
||||
|
||||
if(CYGWIN)
|
||||
set(TK_WISH_NAMES ${TK_WISH_NAMES} cygwish80)
|
||||
endif()
|
||||
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_program(TK_WISH NAMES ${TK_WISH_NAMES} ${${search}} PATH_SUFFIXES bin)
|
||||
endforeach()
|
||||
if(NOT TK_WISH)
|
||||
find_program(TK_WISH NAMES ${TK_WISH_NAMES} HINTS ${TCLTK_POSSIBLE_BIN_PATHS})
|
||||
endif(NOT TK_WISH)
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
if(TCLSH_VERSION_STRING)
|
||||
set(TCL_TCLSH_VERSION "${TCLSH_VERSION_STRING}")
|
||||
else()
|
||||
get_filename_component(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH)
|
||||
get_filename_component(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH)
|
||||
string(REGEX REPLACE "^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}")
|
||||
endif()
|
||||
|
||||
set(TCLTK_POSSIBLE_LIB_PATHS "${TCL_INCLUDE_PATH_PARENT}/lib" "${TCL_LIBRARY_PATH}" "${TCL_TCLSH_PATH_PARENT}/lib")
|
||||
if(TCL_ENABLE_TK)
|
||||
set(
|
||||
TCLTK_POSSIBLE_LIB_PATHS
|
||||
${TCLTK_POSSIBLE_LIB_PATHS}
|
||||
"${TK_INCLUDE_PATH_PARENT}/lib"
|
||||
"${TK_LIBRARY_PATH}"
|
||||
"${TK_WISH_PATH_PARENT}/lib"
|
||||
)
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
set(
|
||||
TCLTK_POSSIBLE_LIB_PATH_SUFFIXES
|
||||
lib
|
||||
lib/tcl
|
||||
lib/tcl/tcl8.7
|
||||
lib/tcl/tcl8.6
|
||||
lib/tcl/tcl8.5
|
||||
lib/tcl/tcl8.4
|
||||
)
|
||||
if(TCL_ENABLE_TK)
|
||||
set(
|
||||
TCLTK_POSSIBLE_LIB_PATH_SUFFIXES
|
||||
${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
lib/tcl/tk8.7
|
||||
lib/tcl/tk8.6
|
||||
lib/tcl/tk8.5
|
||||
lib/tcl/tk8.4
|
||||
)
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
set(
|
||||
TCL_POSSIBLE_LIB_NAMES
|
||||
tcl
|
||||
tcl${TCL_LIBRARY_VERSION}
|
||||
tcl${TCL_TCLSH_VERSION}
|
||||
tcl${TK_WISH_VERSION}
|
||||
tcl87
|
||||
tcl8.7
|
||||
tcl87t
|
||||
tcl8.7t
|
||||
tcl86
|
||||
tcl8.6
|
||||
tcl86t
|
||||
tcl8.6t
|
||||
tcl85
|
||||
tcl8.5
|
||||
tcl84
|
||||
tcl8.4
|
||||
tcl83
|
||||
tcl8.3
|
||||
tcl82
|
||||
tcl8.2
|
||||
tcl80
|
||||
tcl8.0
|
||||
)
|
||||
|
||||
if(NOT TCL_LIBRARY)
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_library(
|
||||
TCL_LIBRARY
|
||||
NAMES ${TCL_POSSIBLE_LIB_NAMES}
|
||||
NAMES_PER_DIR
|
||||
${${search}}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT TCL_LIBRARY)
|
||||
find_library(
|
||||
TCL_LIBRARY
|
||||
NAMES ${TCL_POSSIBLE_LIB_NAMES}
|
||||
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endif(NOT TCL_LIBRARY)
|
||||
|
||||
set(
|
||||
TCLSTUB_POSSIBLE_LIB_NAMES
|
||||
tclstub
|
||||
tclstub${TK_LIBRARY_VERSION}
|
||||
tclstub${TCL_TCLSH_VERSION}
|
||||
tclstub${TK_WISH_VERSION}
|
||||
tclstub87
|
||||
tclstub8.7
|
||||
tclstub86
|
||||
tclstub8.6
|
||||
tclstub85
|
||||
tclstub8.5
|
||||
tclstub84
|
||||
tclstub8.4
|
||||
tclstub83
|
||||
tclstub8.3
|
||||
tclstub82
|
||||
tclstub8.2
|
||||
tclstub80
|
||||
tclstub8.0
|
||||
)
|
||||
if(NOT TCL_STUB_LIBRARY)
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_library(
|
||||
TCL_STUB_LIBRARY
|
||||
NAMES ${TCLSTUB_POSSIBLE_LIB_NAMES}
|
||||
NAMES_PER_DIR
|
||||
${${search}}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT TCL_STUB_LIBRARY)
|
||||
find_library(TCL_STUB_LIBRARY NAMES ${TCLSTUB_POSSIBLE_LIB_NAMES} PATHS ${TCLTK_POSSIBLE_LIB_PATHS})
|
||||
endif()
|
||||
|
||||
if(TCL_ENABLE_TK)
|
||||
set(
|
||||
TK_POSSIBLE_LIB_NAMES
|
||||
tk
|
||||
tk${TK_LIBRARY_VERSION}
|
||||
tk${TCL_TCLSH_VERSION}
|
||||
tk${TK_WISH_VERSION}
|
||||
tk87
|
||||
tk8.7
|
||||
tk87t
|
||||
tk8.7t
|
||||
tk86
|
||||
tk8.6
|
||||
tk86t
|
||||
tk8.6t
|
||||
tk85
|
||||
tk8.5
|
||||
tk84
|
||||
tk8.4
|
||||
tk83
|
||||
tk8.3
|
||||
tk82
|
||||
tk8.2
|
||||
tk80
|
||||
tk8.0
|
||||
)
|
||||
|
||||
if(NOT TK_LIBRARY)
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_library(
|
||||
TK_LIBRARY
|
||||
NAMES ${TK_POSSIBLE_LIB_NAMES}
|
||||
NAMES_PER_DIR
|
||||
${${search}}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT TK_LIBRARY)
|
||||
find_library(
|
||||
TK_LIBRARY
|
||||
NAMES ${TK_POSSIBLE_LIB_NAMES}
|
||||
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endif(NOT TK_LIBRARY)
|
||||
|
||||
set(
|
||||
TK_STUB_POSSIBLE_LIB_NAMES
|
||||
tkstub
|
||||
tkstub${TCL_LIBRARY_VERSION}
|
||||
tkstub${TCL_TCLSH_VERSION}
|
||||
tkstub${TK_WISH_VERSION}
|
||||
tkstub87
|
||||
tkstub8.7
|
||||
tkstub86
|
||||
tkstub8.6
|
||||
tkstub85
|
||||
tkstub8.5
|
||||
tkstub84
|
||||
tkstub8.4
|
||||
tkstub83
|
||||
tkstub8.3
|
||||
tkstub82
|
||||
tkstub8.2
|
||||
tkstub80
|
||||
tkstub8.0
|
||||
)
|
||||
|
||||
if(NOT TK_STUB_LIBRARY)
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_library(
|
||||
TK_STUB_LIBRARY
|
||||
NAMES ${TK_STUB_POSSIBLE_LIB_NAMES}
|
||||
NAMES_PER_DIR
|
||||
${${search}}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT TK_STUB_LIBRARY)
|
||||
find_library(TK_STUB_LIBRARY NAMES ${TK_STUB_POSSIBLE_LIB_NAMES} PATHS ${TCLTK_POSSIBLE_LIB_PATHS})
|
||||
endif()
|
||||
|
||||
set(
|
||||
TTK_STUB_POSSIBLE_LIB_NAMES
|
||||
ttkstub
|
||||
ttkstub${TCL_LIBRARY_VERSION}
|
||||
ttkstub${TCL_TCLSH_VERSION}
|
||||
ttkstub${TK_WISH_VERSION}
|
||||
ttkstub88
|
||||
ttkstub8.8
|
||||
ttkstub87
|
||||
ttkstub8.7
|
||||
ttkstub86
|
||||
ttkstub8.6
|
||||
ttkstub85
|
||||
ttkstub8.5
|
||||
)
|
||||
|
||||
if(NOT TTK_STUB_LIBRARY)
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_library(
|
||||
TTK_STUB_LIBRARY
|
||||
NAMES ${TTK_STUB_POSSIBLE_LIB_NAMES}
|
||||
NAMES_PER_DIR
|
||||
${${search}}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT TTK_STUB_LIBRARY)
|
||||
find_library(TTK_STUB_LIBRARY NAMES ${TTK_STUB_POSSIBLE_LIB_NAMES} PATHS ${TCLTK_POSSIBLE_LIB_PATHS})
|
||||
endif()
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
set(
|
||||
TCLTK_POSSIBLE_INCLUDE_PATHS
|
||||
"${TCL_LIBRARY_PATH_PARENT}/include"
|
||||
"${TCL_INCLUDE_PATH}"
|
||||
"${TCL_TCLSH_PATH_PARENT}/include"
|
||||
)
|
||||
if(TCL_ENABLE_TK)
|
||||
set(
|
||||
TCLTK_POSSIBLE_INCLUDE_PATHS
|
||||
${TCLTK_POSSIBLE_INCLUDE_PATHS}
|
||||
"${TCL_LIBRARY_PATH_PARENT}/include"
|
||||
"${TCL_INCLUDE_PATH}"
|
||||
"${TCL_TCLSH_PATH_PARENT}/include"
|
||||
)
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
set(
|
||||
TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES
|
||||
include
|
||||
include/tcl${TCL_LIBRARY_VERSION}
|
||||
include/tcl8.7
|
||||
include/tcl8.6
|
||||
include/tcl8.5
|
||||
include/tcl8.4
|
||||
include/tcl8.3
|
||||
include/tcl8.2
|
||||
include/tcl8.0
|
||||
)
|
||||
|
||||
if(TCL_ENABLE_TK)
|
||||
set(
|
||||
TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES
|
||||
${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES}
|
||||
include/tcl${TK_LIBRARY_VERSION}
|
||||
include/tk8.7
|
||||
include/tk8.6
|
||||
include/tk8.5
|
||||
include/tk8.4
|
||||
)
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_path(TCL_INCLUDE_PATH NAMES tcl.h ${${search}} PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES})
|
||||
endforeach()
|
||||
if(NOT TCL_INCLUDE_PATH)
|
||||
find_path(
|
||||
TCL_INCLUDE_PATH
|
||||
NAMES tcl.h
|
||||
HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TCL_ENABLE_TK)
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_path(TK_INCLUDE_PATH NAMES tk.h ${${search}} PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES})
|
||||
endforeach()
|
||||
if(NOT TK_INCLUDE_PATH)
|
||||
find_path(
|
||||
TK_INCLUDE_PATH
|
||||
NAMES tk.h
|
||||
HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES}
|
||||
)
|
||||
endif()
|
||||
|
||||
# IFF we have TCL_TK_SYSTEM_GRAPHICS set and have a system TK_WISH, check that the
|
||||
# windowing system matches the specified type
|
||||
if(NOT "${TCL_TK_SYSTEM_GRAPHICS}" STREQUAL "" AND TK_WISH AND NOT TARGET "${TK_WISH}")
|
||||
set(
|
||||
tkwin_script
|
||||
"
|
||||
set filename \"${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM\"
|
||||
set fileId [open $filename \"w\"]
|
||||
set windowingsystem [tk windowingsystem]
|
||||
puts $fileId $windowingsystem
|
||||
close $fileId
|
||||
exit
|
||||
"
|
||||
)
|
||||
set(tkwin_scriptfile "${CMAKE_BINARY_DIR}/CMakeTmp/tk_windowingsystem.tcl")
|
||||
set(WSYS "wm-NOTFOUND")
|
||||
file(WRITE ${tkwin_scriptfile} ${tkwin_script})
|
||||
execute_process(COMMAND ${TK_WISH} ${tkwin_scriptfile} OUTPUT_VARIABLE EXECOUTPUT)
|
||||
if(EXISTS "${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM")
|
||||
file(READ "${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM" readresultvar)
|
||||
string(REGEX REPLACE "\n" "" WSYS "${readresultvar}")
|
||||
endif(EXISTS "${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM")
|
||||
|
||||
# If we have no information about the windowing system or it does not match
|
||||
# a specified system, the find_package detection has failed
|
||||
if(NOT "${WSYS}" STREQUAL "${TCL_TK_SYSTEM_GRAPHICS}")
|
||||
unset(TCL_LIBRARY CACHE)
|
||||
unset(TCL_STUB_LIBRARY CACHE)
|
||||
unset(TK_LIBRARY CACHE)
|
||||
unset(TK_STUB_LIBRARY CACHE)
|
||||
unset(TCL_FOUND CACHE)
|
||||
unset(TK_FOUND CACHE)
|
||||
unset(TCLTK_FOUND CACHE)
|
||||
unset(TCLSH_FOUND CACHE)
|
||||
unset(TCL_LIBRARY CACHE)
|
||||
unset(TCL_INCLUDE_PATH CACHE)
|
||||
unset(TCL_TCLSH CACHE)
|
||||
unset(TK_LIBRARY CACHE)
|
||||
unset(TK_INCLUDE_PATH CACHE)
|
||||
unset(TK_WISH CACHE)
|
||||
unset(TCL_STUB_LIBRARY CACHE)
|
||||
unset(TK_STUB_LIBRARY CACHE)
|
||||
unset(TTK_STUB_LIBRARY CACHE)
|
||||
endif(NOT "${WSYS}" STREQUAL "${TCL_TK_SYSTEM_GRAPHICS}")
|
||||
endif(NOT "${TCL_TK_SYSTEM_GRAPHICS}" STREQUAL "" AND TK_WISH AND NOT TARGET "${TK_WISH}")
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(
|
||||
TCL
|
||||
REQUIRED_VARS TCL_LIBRARY TCL_STUB_LIBRARY TCL_INCLUDE_PATH TCL_TCLSH
|
||||
VERSION_VAR TCLSH_VERSION_STRING
|
||||
)
|
||||
|
||||
if(TCL_ENABLE_TK)
|
||||
set(FPHSA_NAME_MISMATCHED 1)
|
||||
set(TCLTK_FIND_REQUIRED ${TCL_FIND_REQUIRED})
|
||||
set(TCLTK_FIND_QUIETLY ${TCL_FIND_QUIETLY})
|
||||
find_package_handle_standard_args(
|
||||
TCLTK
|
||||
REQUIRED_VARS TCL_LIBRARY TCL_STUB_LIBRARY TCL_INCLUDE_PATH TK_LIBRARY TK_STUB_LIBRARY TK_INCLUDE_PATH
|
||||
)
|
||||
set(TK_FIND_REQUIRED ${TCL_FIND_REQUIRED})
|
||||
set(TK_FIND_QUIETLY ${TCL_FIND_QUIETLY})
|
||||
find_package_handle_standard_args(TK REQUIRED_VARS TK_LIBRARY TK_STUB_LIBRARY TK_INCLUDE_PATH TK_WISH)
|
||||
unset(FPHSA_NAME_MISMATCHED)
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
mark_as_advanced(
|
||||
TCL_INCLUDE_PATH
|
||||
TCL_LIBRARY
|
||||
TCL_STUB_LIBRARY
|
||||
TCL_TCLSH
|
||||
TK_INCLUDE_PATH
|
||||
TK_LIBRARY
|
||||
TK_STUB_LIBRARY
|
||||
TK_WISH
|
||||
TTK_STUB_LIBRARY
|
||||
)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* ------------------------------------------------------------------------
|
||||
* PACKAGE: [incr Tcl]
|
||||
* DESCRIPTION: Object-Oriented Extensions to Tcl
|
||||
*
|
||||
* [incr Tcl] provides object-oriented extensions to Tcl, much as
|
||||
* C++ provides object-oriented extensions to C. It provides a means
|
||||
* of encapsulating related procedures together with their shared data
|
||||
* in a local namespace that is hidden from the outside world. It
|
||||
* promotes code re-use through inheritance. More than anything else,
|
||||
* it encourages better organization of Tcl applications through the
|
||||
* object-oriented paradigm, leading to code that is easier to
|
||||
* understand and maintain.
|
||||
*
|
||||
* ADDING [incr Tcl] TO A Tcl-BASED APPLICATION:
|
||||
*
|
||||
* To add [incr Tcl] facilities to a Tcl application, modify the
|
||||
* Tcl_AppInit() routine as follows:
|
||||
*
|
||||
* 1) Include this header file near the top of the file containing
|
||||
* Tcl_AppInit():
|
||||
*
|
||||
* #include "itcl.h"
|
||||
*
|
||||
* 2) Within the body of Tcl_AppInit(), add the following lines:
|
||||
*
|
||||
* if (Itcl_Init(interp) == TCL_ERROR) {
|
||||
* return TCL_ERROR;
|
||||
* }
|
||||
*
|
||||
* 3) Link your application with libitcl.a
|
||||
*
|
||||
* NOTE: An example file "tclAppInit.c" containing the changes shown
|
||||
* above is included in this distribution.
|
||||
*
|
||||
* ========================================================================
|
||||
* AUTHOR: Michael J. McLennan
|
||||
* Bell Labs Innovations for Lucent Technologies
|
||||
* mmclennan@lucent.com
|
||||
* http://www.tcltk.com/itcl
|
||||
* ========================================================================
|
||||
* Copyright (c) 1993-1998 Lucent Technologies, Inc.
|
||||
* ------------------------------------------------------------------------
|
||||
* See the file "license.terms" for information on usage and redistribution
|
||||
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*/
|
||||
#ifndef ITCL_H
|
||||
#define ITCL_H
|
||||
|
||||
#include "tcl.h"
|
||||
|
||||
#ifndef TCL_ALPHA_RELEASE
|
||||
# define TCL_ALPHA_RELEASE 0
|
||||
#endif
|
||||
#ifndef TCL_BETA_RELEASE
|
||||
# define TCL_BETA_RELEASE 1
|
||||
#endif
|
||||
#ifndef TCL_FINAL_RELEASE
|
||||
# define TCL_FINAL_RELEASE 2
|
||||
#endif
|
||||
|
||||
|
||||
#define ITCL_MAJOR_VERSION 3
|
||||
#define ITCL_MINOR_VERSION 4
|
||||
#define ITCL_RELEASE_LEVEL TCL_FINAL_RELEASE
|
||||
#define ITCL_RELEASE_SERIAL 3
|
||||
|
||||
#define ITCL_VERSION "3.4"
|
||||
#define ITCL_PATCH_LEVEL "3.4.3"
|
||||
|
||||
/*
|
||||
* A special definition used to allow this header file to be included
|
||||
* in resource files so that they can get obtain version information from
|
||||
* this file. Resource compilers don't like all the C stuff, like typedefs
|
||||
* and procedure declarations, that occur below.
|
||||
*/
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
|
||||
#undef TCL_STORAGE_CLASS
|
||||
#ifdef BUILD_itcl
|
||||
# define TCL_STORAGE_CLASS DLLEXPORT
|
||||
#else
|
||||
# ifdef USE_ITCL_STUBS
|
||||
# define TCL_STORAGE_CLASS
|
||||
# else
|
||||
# define TCL_STORAGE_CLASS DLLIMPORT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Fix the Borland bug that's in the EXTERN macro from tcl.h.
|
||||
*/
|
||||
#ifndef TCL_EXTERN
|
||||
# undef DLLIMPORT
|
||||
# undef DLLEXPORT
|
||||
# ifdef __cplusplus
|
||||
# define TCL_EXTERNC extern "C"
|
||||
# else
|
||||
# define TCL_EXTERNC extern
|
||||
# endif
|
||||
# if defined(STATIC_BUILD)
|
||||
# define DLLIMPORT
|
||||
# define DLLEXPORT
|
||||
# define TCL_EXTERN(RTYPE) TCL_EXTERNC RTYPE
|
||||
# elif (defined(__WIN32__) && ( \
|
||||
defined(_MSC_VER) || (__BORLANDC__ >= 0x0550) || \
|
||||
defined(__LCC__) || defined(__WATCOMC__) || \
|
||||
(defined(__GNUC__) && defined(__declspec)) \
|
||||
)) || (defined(MAC_TCL) && FUNCTION_DECLSPEC)
|
||||
# define DLLIMPORT __declspec(dllimport)
|
||||
# define DLLEXPORT __declspec(dllexport)
|
||||
# define TCL_EXTERN(RTYPE) TCL_EXTERNC TCL_STORAGE_CLASS RTYPE
|
||||
# elif defined(__BORLANDC__)
|
||||
# define DLLIMPORT __import
|
||||
# define DLLEXPORT __export
|
||||
/* Pre-5.5 Borland requires the attributes be placed after the */
|
||||
/* return type instead. */
|
||||
# define TCL_EXTERN(RTYPE) TCL_EXTERNC RTYPE TCL_STORAGE_CLASS
|
||||
# else
|
||||
# define DLLIMPORT
|
||||
# define DLLEXPORT
|
||||
# define TCL_EXTERN(RTYPE) TCL_EXTERNC TCL_STORAGE_CLASS RTYPE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Protection levels:
|
||||
*
|
||||
* ITCL_PUBLIC - accessible from any namespace
|
||||
* ITCL_PROTECTED - accessible from namespace that imports in "protected" mode
|
||||
* ITCL_PRIVATE - accessible only within the namespace that contains it
|
||||
*/
|
||||
#define ITCL_PUBLIC 1
|
||||
#define ITCL_PROTECTED 2
|
||||
#define ITCL_PRIVATE 3
|
||||
#define ITCL_DEFAULT_PROTECT 4
|
||||
|
||||
|
||||
/*
|
||||
* Generic stack.
|
||||
*/
|
||||
typedef struct Itcl_Stack {
|
||||
ClientData *values; /* values on stack */
|
||||
int len; /* number of values on stack */
|
||||
int max; /* maximum size of stack */
|
||||
ClientData space[5]; /* initial space for stack data */
|
||||
} Itcl_Stack;
|
||||
|
||||
#define Itcl_GetStackSize(stackPtr) ((stackPtr)->len)
|
||||
|
||||
/*
|
||||
* Generic linked list.
|
||||
*/
|
||||
struct Itcl_List;
|
||||
typedef struct Itcl_ListElem {
|
||||
struct Itcl_List* owner; /* list containing this element */
|
||||
ClientData value; /* value associated with this element */
|
||||
struct Itcl_ListElem *prev; /* previous element in linked list */
|
||||
struct Itcl_ListElem *next; /* next element in linked list */
|
||||
} Itcl_ListElem;
|
||||
|
||||
typedef struct Itcl_List {
|
||||
int validate; /* validation stamp */
|
||||
int num; /* number of elements */
|
||||
struct Itcl_ListElem *head; /* previous element in linked list */
|
||||
struct Itcl_ListElem *tail; /* next element in linked list */
|
||||
} Itcl_List;
|
||||
|
||||
#define Itcl_FirstListElem(listPtr) ((listPtr)->head)
|
||||
#define Itcl_LastListElem(listPtr) ((listPtr)->tail)
|
||||
#define Itcl_NextListElem(elemPtr) ((elemPtr)->next)
|
||||
#define Itcl_PrevListElem(elemPtr) ((elemPtr)->prev)
|
||||
#define Itcl_GetListLength(listPtr) ((listPtr)->num)
|
||||
#define Itcl_GetListValue(elemPtr) ((elemPtr)->value)
|
||||
|
||||
/*
|
||||
* Token representing the state of an interpreter.
|
||||
*/
|
||||
typedef struct Itcl_InterpState_ *Itcl_InterpState;
|
||||
|
||||
|
||||
/*
|
||||
* Include the public function declarations that are accessible via
|
||||
* the stubs table.
|
||||
*/
|
||||
|
||||
#include "itclDecls.h"
|
||||
|
||||
|
||||
/*
|
||||
* Itcl_InitStubs is used by extensions like Itk that can be linked
|
||||
* against the itcl stubs library. If we are not using stubs
|
||||
* then this reduces to package require.
|
||||
*/
|
||||
|
||||
#ifdef USE_ITCL_STUBS
|
||||
|
||||
TCL_EXTERNC CONST char *
|
||||
Itcl_InitStubs _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
CONST char *version, int exact));
|
||||
#else
|
||||
#define Itcl_InitStubs(interp, version, exact) \
|
||||
Tcl_PkgRequire(interp, "Itcl", version, exact)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Public functions that are not accessible via the stubs table.
|
||||
*/
|
||||
|
||||
|
||||
#endif /* RC_INVOKED */
|
||||
|
||||
#undef TCL_STORAGE_CLASS
|
||||
#define TCL_STORAGE_CLASS DLLIMPORT
|
||||
|
||||
#endif /* ITCL_H */
|
||||
@@ -0,0 +1,331 @@
|
||||
/*
|
||||
* itclDecls.h --
|
||||
*
|
||||
* Declarations of functions in the platform independent public Itcl API.
|
||||
*
|
||||
* See the file "license.terms" for information on usage and redistribution
|
||||
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*/
|
||||
|
||||
#ifndef _ITCLDECLS
|
||||
#define _ITCLDECLS
|
||||
|
||||
/*
|
||||
* WARNING: This file is automatically generated by the tools/genStubs.tcl
|
||||
* script. Any modifications to the function declarations below should be made
|
||||
* in the itcl/generic/tcl.decls script.
|
||||
*/
|
||||
|
||||
/* !BEGIN!: Do not edit below this line. */
|
||||
|
||||
/*
|
||||
* Exported function declarations:
|
||||
*/
|
||||
|
||||
#ifndef Itcl_Init_TCL_DECLARED
|
||||
#define Itcl_Init_TCL_DECLARED
|
||||
/* 0 */
|
||||
TCL_EXTERN(int) Itcl_Init _ANSI_ARGS_((Tcl_Interp * interp));
|
||||
#endif
|
||||
#ifndef Itcl_SafeInit_TCL_DECLARED
|
||||
#define Itcl_SafeInit_TCL_DECLARED
|
||||
/* 1 */
|
||||
TCL_EXTERN(int) Itcl_SafeInit _ANSI_ARGS_((Tcl_Interp * interp));
|
||||
#endif
|
||||
#ifndef Itcl_RegisterC_TCL_DECLARED
|
||||
#define Itcl_RegisterC_TCL_DECLARED
|
||||
/* 2 */
|
||||
TCL_EXTERN(int) Itcl_RegisterC _ANSI_ARGS_((Tcl_Interp * interp,
|
||||
CONST char * name, Tcl_CmdProc * proc,
|
||||
ClientData clientData,
|
||||
Tcl_CmdDeleteProc * deleteProc));
|
||||
#endif
|
||||
#ifndef Itcl_RegisterObjC_TCL_DECLARED
|
||||
#define Itcl_RegisterObjC_TCL_DECLARED
|
||||
/* 3 */
|
||||
TCL_EXTERN(int) Itcl_RegisterObjC _ANSI_ARGS_((Tcl_Interp * interp,
|
||||
CONST char * name, Tcl_ObjCmdProc * proc,
|
||||
ClientData clientData,
|
||||
Tcl_CmdDeleteProc * deleteProc));
|
||||
#endif
|
||||
#ifndef Itcl_FindC_TCL_DECLARED
|
||||
#define Itcl_FindC_TCL_DECLARED
|
||||
/* 4 */
|
||||
TCL_EXTERN(int) Itcl_FindC _ANSI_ARGS_((Tcl_Interp * interp,
|
||||
CONST char * name, Tcl_CmdProc ** argProcPtr,
|
||||
Tcl_ObjCmdProc ** objProcPtr,
|
||||
ClientData * cDataPtr));
|
||||
#endif
|
||||
#ifndef Itcl_InitStack_TCL_DECLARED
|
||||
#define Itcl_InitStack_TCL_DECLARED
|
||||
/* 5 */
|
||||
TCL_EXTERN(void) Itcl_InitStack _ANSI_ARGS_((Itcl_Stack * stack));
|
||||
#endif
|
||||
#ifndef Itcl_DeleteStack_TCL_DECLARED
|
||||
#define Itcl_DeleteStack_TCL_DECLARED
|
||||
/* 6 */
|
||||
TCL_EXTERN(void) Itcl_DeleteStack _ANSI_ARGS_((Itcl_Stack * stack));
|
||||
#endif
|
||||
#ifndef Itcl_PushStack_TCL_DECLARED
|
||||
#define Itcl_PushStack_TCL_DECLARED
|
||||
/* 7 */
|
||||
TCL_EXTERN(void) Itcl_PushStack _ANSI_ARGS_((ClientData cdata,
|
||||
Itcl_Stack * stack));
|
||||
#endif
|
||||
#ifndef Itcl_PopStack_TCL_DECLARED
|
||||
#define Itcl_PopStack_TCL_DECLARED
|
||||
/* 8 */
|
||||
TCL_EXTERN(ClientData) Itcl_PopStack _ANSI_ARGS_((Itcl_Stack * stack));
|
||||
#endif
|
||||
#ifndef Itcl_PeekStack_TCL_DECLARED
|
||||
#define Itcl_PeekStack_TCL_DECLARED
|
||||
/* 9 */
|
||||
TCL_EXTERN(ClientData) Itcl_PeekStack _ANSI_ARGS_((Itcl_Stack * stack));
|
||||
#endif
|
||||
#ifndef Itcl_GetStackValue_TCL_DECLARED
|
||||
#define Itcl_GetStackValue_TCL_DECLARED
|
||||
/* 10 */
|
||||
TCL_EXTERN(ClientData) Itcl_GetStackValue _ANSI_ARGS_((Itcl_Stack * stack,
|
||||
int pos));
|
||||
#endif
|
||||
#ifndef Itcl_InitList_TCL_DECLARED
|
||||
#define Itcl_InitList_TCL_DECLARED
|
||||
/* 11 */
|
||||
TCL_EXTERN(void) Itcl_InitList _ANSI_ARGS_((Itcl_List * listPtr));
|
||||
#endif
|
||||
#ifndef Itcl_DeleteList_TCL_DECLARED
|
||||
#define Itcl_DeleteList_TCL_DECLARED
|
||||
/* 12 */
|
||||
TCL_EXTERN(void) Itcl_DeleteList _ANSI_ARGS_((Itcl_List * listPtr));
|
||||
#endif
|
||||
#ifndef Itcl_CreateListElem_TCL_DECLARED
|
||||
#define Itcl_CreateListElem_TCL_DECLARED
|
||||
/* 13 */
|
||||
TCL_EXTERN(Itcl_ListElem*) Itcl_CreateListElem _ANSI_ARGS_((
|
||||
Itcl_List * listPtr));
|
||||
#endif
|
||||
#ifndef Itcl_DeleteListElem_TCL_DECLARED
|
||||
#define Itcl_DeleteListElem_TCL_DECLARED
|
||||
/* 14 */
|
||||
TCL_EXTERN(Itcl_ListElem*) Itcl_DeleteListElem _ANSI_ARGS_((
|
||||
Itcl_ListElem * elemPtr));
|
||||
#endif
|
||||
#ifndef Itcl_InsertList_TCL_DECLARED
|
||||
#define Itcl_InsertList_TCL_DECLARED
|
||||
/* 15 */
|
||||
TCL_EXTERN(Itcl_ListElem*) Itcl_InsertList _ANSI_ARGS_((Itcl_List * listPtr,
|
||||
ClientData val));
|
||||
#endif
|
||||
#ifndef Itcl_InsertListElem_TCL_DECLARED
|
||||
#define Itcl_InsertListElem_TCL_DECLARED
|
||||
/* 16 */
|
||||
TCL_EXTERN(Itcl_ListElem*) Itcl_InsertListElem _ANSI_ARGS_((
|
||||
Itcl_ListElem * pos, ClientData val));
|
||||
#endif
|
||||
#ifndef Itcl_AppendList_TCL_DECLARED
|
||||
#define Itcl_AppendList_TCL_DECLARED
|
||||
/* 17 */
|
||||
TCL_EXTERN(Itcl_ListElem*) Itcl_AppendList _ANSI_ARGS_((Itcl_List * listPtr,
|
||||
ClientData val));
|
||||
#endif
|
||||
#ifndef Itcl_AppendListElem_TCL_DECLARED
|
||||
#define Itcl_AppendListElem_TCL_DECLARED
|
||||
/* 18 */
|
||||
TCL_EXTERN(Itcl_ListElem*) Itcl_AppendListElem _ANSI_ARGS_((
|
||||
Itcl_ListElem * pos, ClientData val));
|
||||
#endif
|
||||
#ifndef Itcl_SetListValue_TCL_DECLARED
|
||||
#define Itcl_SetListValue_TCL_DECLARED
|
||||
/* 19 */
|
||||
TCL_EXTERN(void) Itcl_SetListValue _ANSI_ARGS_((
|
||||
Itcl_ListElem * elemPtr, ClientData val));
|
||||
#endif
|
||||
#ifndef Itcl_EventuallyFree_TCL_DECLARED
|
||||
#define Itcl_EventuallyFree_TCL_DECLARED
|
||||
/* 20 */
|
||||
TCL_EXTERN(void) Itcl_EventuallyFree _ANSI_ARGS_((ClientData cdata,
|
||||
Tcl_FreeProc * fproc));
|
||||
#endif
|
||||
#ifndef Itcl_PreserveData_TCL_DECLARED
|
||||
#define Itcl_PreserveData_TCL_DECLARED
|
||||
/* 21 */
|
||||
TCL_EXTERN(void) Itcl_PreserveData _ANSI_ARGS_((ClientData cdata));
|
||||
#endif
|
||||
#ifndef Itcl_ReleaseData_TCL_DECLARED
|
||||
#define Itcl_ReleaseData_TCL_DECLARED
|
||||
/* 22 */
|
||||
TCL_EXTERN(void) Itcl_ReleaseData _ANSI_ARGS_((ClientData cdata));
|
||||
#endif
|
||||
#ifndef Itcl_SaveInterpState_TCL_DECLARED
|
||||
#define Itcl_SaveInterpState_TCL_DECLARED
|
||||
/* 23 */
|
||||
TCL_EXTERN(Itcl_InterpState) Itcl_SaveInterpState _ANSI_ARGS_((
|
||||
Tcl_Interp* interp, int status));
|
||||
#endif
|
||||
#ifndef Itcl_RestoreInterpState_TCL_DECLARED
|
||||
#define Itcl_RestoreInterpState_TCL_DECLARED
|
||||
/* 24 */
|
||||
TCL_EXTERN(int) Itcl_RestoreInterpState _ANSI_ARGS_((
|
||||
Tcl_Interp* interp, Itcl_InterpState state));
|
||||
#endif
|
||||
#ifndef Itcl_DiscardInterpState_TCL_DECLARED
|
||||
#define Itcl_DiscardInterpState_TCL_DECLARED
|
||||
/* 25 */
|
||||
TCL_EXTERN(void) Itcl_DiscardInterpState _ANSI_ARGS_((
|
||||
Itcl_InterpState state));
|
||||
#endif
|
||||
|
||||
typedef struct ItclStubHooks {
|
||||
struct ItclIntStubs *itclIntStubs;
|
||||
} ItclStubHooks;
|
||||
|
||||
typedef struct ItclStubs {
|
||||
int magic;
|
||||
struct ItclStubHooks *hooks;
|
||||
|
||||
int (*itcl_Init) _ANSI_ARGS_((Tcl_Interp * interp)); /* 0 */
|
||||
int (*itcl_SafeInit) _ANSI_ARGS_((Tcl_Interp * interp)); /* 1 */
|
||||
int (*itcl_RegisterC) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, Tcl_CmdProc * proc, ClientData clientData, Tcl_CmdDeleteProc * deleteProc)); /* 2 */
|
||||
int (*itcl_RegisterObjC) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, Tcl_ObjCmdProc * proc, ClientData clientData, Tcl_CmdDeleteProc * deleteProc)); /* 3 */
|
||||
int (*itcl_FindC) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, Tcl_CmdProc ** argProcPtr, Tcl_ObjCmdProc ** objProcPtr, ClientData * cDataPtr)); /* 4 */
|
||||
void (*itcl_InitStack) _ANSI_ARGS_((Itcl_Stack * stack)); /* 5 */
|
||||
void (*itcl_DeleteStack) _ANSI_ARGS_((Itcl_Stack * stack)); /* 6 */
|
||||
void (*itcl_PushStack) _ANSI_ARGS_((ClientData cdata, Itcl_Stack * stack)); /* 7 */
|
||||
ClientData (*itcl_PopStack) _ANSI_ARGS_((Itcl_Stack * stack)); /* 8 */
|
||||
ClientData (*itcl_PeekStack) _ANSI_ARGS_((Itcl_Stack * stack)); /* 9 */
|
||||
ClientData (*itcl_GetStackValue) _ANSI_ARGS_((Itcl_Stack * stack, int pos)); /* 10 */
|
||||
void (*itcl_InitList) _ANSI_ARGS_((Itcl_List * listPtr)); /* 11 */
|
||||
void (*itcl_DeleteList) _ANSI_ARGS_((Itcl_List * listPtr)); /* 12 */
|
||||
Itcl_ListElem* (*itcl_CreateListElem) _ANSI_ARGS_((Itcl_List * listPtr)); /* 13 */
|
||||
Itcl_ListElem* (*itcl_DeleteListElem) _ANSI_ARGS_((Itcl_ListElem * elemPtr)); /* 14 */
|
||||
Itcl_ListElem* (*itcl_InsertList) _ANSI_ARGS_((Itcl_List * listPtr, ClientData val)); /* 15 */
|
||||
Itcl_ListElem* (*itcl_InsertListElem) _ANSI_ARGS_((Itcl_ListElem * pos, ClientData val)); /* 16 */
|
||||
Itcl_ListElem* (*itcl_AppendList) _ANSI_ARGS_((Itcl_List * listPtr, ClientData val)); /* 17 */
|
||||
Itcl_ListElem* (*itcl_AppendListElem) _ANSI_ARGS_((Itcl_ListElem * pos, ClientData val)); /* 18 */
|
||||
void (*itcl_SetListValue) _ANSI_ARGS_((Itcl_ListElem * elemPtr, ClientData val)); /* 19 */
|
||||
void (*itcl_EventuallyFree) _ANSI_ARGS_((ClientData cdata, Tcl_FreeProc * fproc)); /* 20 */
|
||||
void (*itcl_PreserveData) _ANSI_ARGS_((ClientData cdata)); /* 21 */
|
||||
void (*itcl_ReleaseData) _ANSI_ARGS_((ClientData cdata)); /* 22 */
|
||||
Itcl_InterpState (*itcl_SaveInterpState) _ANSI_ARGS_((Tcl_Interp* interp, int status)); /* 23 */
|
||||
int (*itcl_RestoreInterpState) _ANSI_ARGS_((Tcl_Interp* interp, Itcl_InterpState state)); /* 24 */
|
||||
void (*itcl_DiscardInterpState) _ANSI_ARGS_((Itcl_InterpState state)); /* 25 */
|
||||
} ItclStubs;
|
||||
|
||||
TCL_EXTERNC ItclStubs *itclStubsPtr;
|
||||
|
||||
#if defined(USE_ITCL_STUBS) && !defined(USE_ITCL_STUB_PROCS)
|
||||
|
||||
/*
|
||||
* Inline function declarations:
|
||||
*/
|
||||
|
||||
#ifndef Itcl_Init
|
||||
#define Itcl_Init \
|
||||
(itclStubsPtr->itcl_Init) /* 0 */
|
||||
#endif
|
||||
#ifndef Itcl_SafeInit
|
||||
#define Itcl_SafeInit \
|
||||
(itclStubsPtr->itcl_SafeInit) /* 1 */
|
||||
#endif
|
||||
#ifndef Itcl_RegisterC
|
||||
#define Itcl_RegisterC \
|
||||
(itclStubsPtr->itcl_RegisterC) /* 2 */
|
||||
#endif
|
||||
#ifndef Itcl_RegisterObjC
|
||||
#define Itcl_RegisterObjC \
|
||||
(itclStubsPtr->itcl_RegisterObjC) /* 3 */
|
||||
#endif
|
||||
#ifndef Itcl_FindC
|
||||
#define Itcl_FindC \
|
||||
(itclStubsPtr->itcl_FindC) /* 4 */
|
||||
#endif
|
||||
#ifndef Itcl_InitStack
|
||||
#define Itcl_InitStack \
|
||||
(itclStubsPtr->itcl_InitStack) /* 5 */
|
||||
#endif
|
||||
#ifndef Itcl_DeleteStack
|
||||
#define Itcl_DeleteStack \
|
||||
(itclStubsPtr->itcl_DeleteStack) /* 6 */
|
||||
#endif
|
||||
#ifndef Itcl_PushStack
|
||||
#define Itcl_PushStack \
|
||||
(itclStubsPtr->itcl_PushStack) /* 7 */
|
||||
#endif
|
||||
#ifndef Itcl_PopStack
|
||||
#define Itcl_PopStack \
|
||||
(itclStubsPtr->itcl_PopStack) /* 8 */
|
||||
#endif
|
||||
#ifndef Itcl_PeekStack
|
||||
#define Itcl_PeekStack \
|
||||
(itclStubsPtr->itcl_PeekStack) /* 9 */
|
||||
#endif
|
||||
#ifndef Itcl_GetStackValue
|
||||
#define Itcl_GetStackValue \
|
||||
(itclStubsPtr->itcl_GetStackValue) /* 10 */
|
||||
#endif
|
||||
#ifndef Itcl_InitList
|
||||
#define Itcl_InitList \
|
||||
(itclStubsPtr->itcl_InitList) /* 11 */
|
||||
#endif
|
||||
#ifndef Itcl_DeleteList
|
||||
#define Itcl_DeleteList \
|
||||
(itclStubsPtr->itcl_DeleteList) /* 12 */
|
||||
#endif
|
||||
#ifndef Itcl_CreateListElem
|
||||
#define Itcl_CreateListElem \
|
||||
(itclStubsPtr->itcl_CreateListElem) /* 13 */
|
||||
#endif
|
||||
#ifndef Itcl_DeleteListElem
|
||||
#define Itcl_DeleteListElem \
|
||||
(itclStubsPtr->itcl_DeleteListElem) /* 14 */
|
||||
#endif
|
||||
#ifndef Itcl_InsertList
|
||||
#define Itcl_InsertList \
|
||||
(itclStubsPtr->itcl_InsertList) /* 15 */
|
||||
#endif
|
||||
#ifndef Itcl_InsertListElem
|
||||
#define Itcl_InsertListElem \
|
||||
(itclStubsPtr->itcl_InsertListElem) /* 16 */
|
||||
#endif
|
||||
#ifndef Itcl_AppendList
|
||||
#define Itcl_AppendList \
|
||||
(itclStubsPtr->itcl_AppendList) /* 17 */
|
||||
#endif
|
||||
#ifndef Itcl_AppendListElem
|
||||
#define Itcl_AppendListElem \
|
||||
(itclStubsPtr->itcl_AppendListElem) /* 18 */
|
||||
#endif
|
||||
#ifndef Itcl_SetListValue
|
||||
#define Itcl_SetListValue \
|
||||
(itclStubsPtr->itcl_SetListValue) /* 19 */
|
||||
#endif
|
||||
#ifndef Itcl_EventuallyFree
|
||||
#define Itcl_EventuallyFree \
|
||||
(itclStubsPtr->itcl_EventuallyFree) /* 20 */
|
||||
#endif
|
||||
#ifndef Itcl_PreserveData
|
||||
#define Itcl_PreserveData \
|
||||
(itclStubsPtr->itcl_PreserveData) /* 21 */
|
||||
#endif
|
||||
#ifndef Itcl_ReleaseData
|
||||
#define Itcl_ReleaseData \
|
||||
(itclStubsPtr->itcl_ReleaseData) /* 22 */
|
||||
#endif
|
||||
#ifndef Itcl_SaveInterpState
|
||||
#define Itcl_SaveInterpState \
|
||||
(itclStubsPtr->itcl_SaveInterpState) /* 23 */
|
||||
#endif
|
||||
#ifndef Itcl_RestoreInterpState
|
||||
#define Itcl_RestoreInterpState \
|
||||
(itclStubsPtr->itcl_RestoreInterpState) /* 24 */
|
||||
#endif
|
||||
#ifndef Itcl_DiscardInterpState
|
||||
#define Itcl_DiscardInterpState \
|
||||
(itclStubsPtr->itcl_DiscardInterpState) /* 25 */
|
||||
#endif
|
||||
|
||||
#endif /* defined(USE_ITCL_STUBS) && !defined(USE_ITCL_STUB_PROCS) */
|
||||
|
||||
/* !END!: Do not edit above this line. */
|
||||
|
||||
#endif /* _ITCLDECLS */
|
||||
@@ -0,0 +1,468 @@
|
||||
/*
|
||||
* ------------------------------------------------------------------------
|
||||
* PACKAGE: [incr Tcl]
|
||||
* DESCRIPTION: Object-Oriented Extensions to Tcl
|
||||
*
|
||||
* [incr Tcl] provides object-oriented extensions to Tcl, much as
|
||||
* C++ provides object-oriented extensions to C. It provides a means
|
||||
* of encapsulating related procedures together with their shared data
|
||||
* in a local namespace that is hidden from the outside world. It
|
||||
* promotes code re-use through inheritance. More than anything else,
|
||||
* it encourages better organization of Tcl applications through the
|
||||
* object-oriented paradigm, leading to code that is easier to
|
||||
* understand and maintain.
|
||||
*
|
||||
* ADDING [incr Tcl] TO A Tcl-BASED APPLICATION:
|
||||
*
|
||||
* To add [incr Tcl] facilities to a Tcl application, modify the
|
||||
* Tcl_AppInit() routine as follows:
|
||||
*
|
||||
* 1) Include this header file near the top of the file containing
|
||||
* Tcl_AppInit():
|
||||
*
|
||||
* #include "itcl.h"
|
||||
*
|
||||
* 2) Within the body of Tcl_AppInit(), add the following lines:
|
||||
*
|
||||
* if (Itcl_Init(interp) == TCL_ERROR) {
|
||||
* return TCL_ERROR;
|
||||
* }
|
||||
*
|
||||
* 3) Link your application with libitcl.a
|
||||
*
|
||||
* NOTE: An example file "tclAppInit.c" containing the changes shown
|
||||
* above is included in this distribution.
|
||||
*
|
||||
* ========================================================================
|
||||
* AUTHOR: Michael J. McLennan
|
||||
* Bell Labs Innovations for Lucent Technologies
|
||||
* mmclennan@lucent.com
|
||||
* http://www.tcltk.com/itcl
|
||||
* ========================================================================
|
||||
* Copyright (c) 1993-1998 Lucent Technologies, Inc.
|
||||
* ------------------------------------------------------------------------
|
||||
* See the file "license.terms" for information on usage and redistribution
|
||||
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*/
|
||||
#ifndef ITCLINT_H
|
||||
#define ITCLINT_H
|
||||
|
||||
#include "tclInt.h"
|
||||
#include "itcl.h"
|
||||
|
||||
#ifdef BUILD_itcl
|
||||
# undef TCL_STORAGE_CLASS
|
||||
# define TCL_STORAGE_CLASS DLLEXPORT
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Handle hiding of errorLine in 8.6
|
||||
*/
|
||||
#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 6)
|
||||
#define Tcl_GetErrorLine(interp) ((interp)->errorLine)
|
||||
#endif
|
||||
|
||||
#define ITCL_TCL_PRE_8_5 (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 5)
|
||||
|
||||
#define ItclCallFrame CallFrame
|
||||
|
||||
#if !ITCL_TCL_PRE_8_5
|
||||
|
||||
#define Itcl_CallFrame Tcl_CallFrame
|
||||
|
||||
#if defined(USE_TCL_STUBS)
|
||||
|
||||
/*
|
||||
* Fix Tcl bug #803489 the right way. We need to always use the old Stub
|
||||
* slot positions, not the new broken ones part of TIP 127. I do like
|
||||
* that these functions have moved to the public space (about time), but
|
||||
* the slot change is the killer and is the painful side affect.
|
||||
*/
|
||||
|
||||
# undef Tcl_CreateNamespace
|
||||
# define Tcl_CreateNamespace \
|
||||
(tclIntStubsPtr->tcl_CreateNamespace)
|
||||
# undef Tcl_DeleteNamespace
|
||||
# define Tcl_DeleteNamespace \
|
||||
(tclIntStubsPtr->tcl_DeleteNamespace)
|
||||
# undef Tcl_AppendExportList
|
||||
# define Tcl_AppendExportList \
|
||||
(tclIntStubsPtr->tcl_AppendExportList)
|
||||
# undef Tcl_Export
|
||||
# define Tcl_Export \
|
||||
(tclIntStubsPtr->tcl_Export)
|
||||
# undef Tcl_Import
|
||||
# define Tcl_Import \
|
||||
(tclIntStubsPtr->tcl_Import)
|
||||
# undef Tcl_ForgetImport
|
||||
# define Tcl_ForgetImport \
|
||||
(tclIntStubsPtr->tcl_ForgetImport)
|
||||
# undef Tcl_GetCurrentNamespace
|
||||
# define Tcl_GetCurrentNamespace \
|
||||
(tclIntStubsPtr->tcl_GetCurrentNamespace)
|
||||
# undef Tcl_GetGlobalNamespace
|
||||
# define Tcl_GetGlobalNamespace \
|
||||
(tclIntStubsPtr->tcl_GetGlobalNamespace)
|
||||
# undef Tcl_FindNamespace
|
||||
# define Tcl_FindNamespace \
|
||||
(tclIntStubsPtr->tcl_FindNamespace)
|
||||
# undef Tcl_FindCommand
|
||||
# define Tcl_FindCommand \
|
||||
(tclIntStubsPtr->tcl_FindCommand)
|
||||
# undef Tcl_GetCommandFromObj
|
||||
# define Tcl_GetCommandFromObj \
|
||||
(tclIntStubsPtr->tcl_GetCommandFromObj)
|
||||
# undef Tcl_GetCommandFullName
|
||||
# define Tcl_GetCommandFullName \
|
||||
(tclIntStubsPtr->tcl_GetCommandFullName)
|
||||
#endif /* use stubs */
|
||||
|
||||
#define ItclInitVarFlags(varPtr) \
|
||||
(varPtr)->flags = 0
|
||||
|
||||
#define ItclInitVarArgument(varPtr) \
|
||||
(varPtr)->flags = VAR_ARGUMENT
|
||||
|
||||
#define ItclVarHashCreateVar(tablePtr, key, newPtr) \
|
||||
TclVarHashCreateVar((tablePtr), (key), (newPtr))
|
||||
|
||||
#define ItclVarRefCount(varPtr) VarHashRefCount(varPtr)
|
||||
|
||||
#define ItclClearVarUndefined(varPtr)
|
||||
|
||||
#define ItclNextLocal(varPtr) ((varPtr)++)
|
||||
|
||||
#define ItclVarObjValue(varPtr) ((varPtr)->value.objPtr)
|
||||
|
||||
#define itclVarInHashSize sizeof(VarInHash)
|
||||
#define itclVarLocalSize sizeof(Var)
|
||||
|
||||
#else /* Compiling on Tcl8.x, x<5 */
|
||||
|
||||
typedef struct Itcl_CallFrame {
|
||||
Tcl_Namespace *nsPtr;
|
||||
int dummy1;
|
||||
int dummy2;
|
||||
void *dummy3;
|
||||
void *dummy4;
|
||||
void *dummy5;
|
||||
int dummy6;
|
||||
void *dummy7;
|
||||
void *dummy8;
|
||||
int dummy9;
|
||||
void *dummy10;
|
||||
void *dummy11;
|
||||
void *dummy12;
|
||||
void *dummy13;
|
||||
} Itcl_CallFrame;
|
||||
|
||||
/*
|
||||
* Definition of runtime behaviour to be able to run irrespective of the Tcl
|
||||
* version.
|
||||
*/
|
||||
|
||||
#define VarInHash Var
|
||||
|
||||
#define TclVarHashTable Tcl_HashTable
|
||||
|
||||
typedef struct ItclShortVar {
|
||||
int flags;
|
||||
union {
|
||||
Tcl_Obj *objPtr;
|
||||
TclVarHashTable *tablePtr;
|
||||
struct Var *linkPtr;
|
||||
} value;
|
||||
} ItclShortVar;
|
||||
|
||||
typedef struct ItclVarInHash {
|
||||
ItclShortVar var;
|
||||
int refCount;
|
||||
Tcl_HashEntry entry;
|
||||
} ItclVarInHash;
|
||||
|
||||
#define ItclOffset(type, field) ((int) ((char *) &((type *) 0)->field))
|
||||
|
||||
#define itclOldRuntime (itclVarFlagOffset!=0)
|
||||
|
||||
extern int itclVarFlagOffset;
|
||||
extern int itclVarRefCountOffset;
|
||||
extern int itclVarInHashSize;
|
||||
extern int itclVarLocalSize;
|
||||
extern int itclVarValueOffset;
|
||||
|
||||
/*
|
||||
* VarReform related macros: provide access to the Var fields with offsets
|
||||
* determined at load time, so that the same code copes with the different
|
||||
* structs in Tcl8.5 and previous Tcl.
|
||||
*/
|
||||
|
||||
#define ItclNextLocal(varPtr) \
|
||||
((varPtr) = (Var *) (((char *)(varPtr))+itclVarLocalSize))
|
||||
|
||||
#define ItclVarObjValue(varPtr) \
|
||||
(*((Tcl_Obj **) (((char *)(varPtr))+itclVarValueOffset)))
|
||||
|
||||
#define ItclVarRefCount(varPtr) \
|
||||
(*((int *) (((char *)(varPtr))+itclVarRefCountOffset)))
|
||||
|
||||
#define ItclVarFlags(varPtr) \
|
||||
(*((int *)(((char *)(varPtr))+itclVarFlagOffset)))
|
||||
|
||||
/* Note that itclVarFlagOffset==0 exactly when we are running in Tcl8.5 */
|
||||
#define ItclInitVarFlags(varPtr) \
|
||||
if (itclOldRuntime) { \
|
||||
(varPtr)->flags = (VAR_SCALAR | VAR_UNDEFINED | VAR_IN_HASHTABLE);\
|
||||
} else { \
|
||||
((ItclShortVar *)(varPtr))->flags = 0;\
|
||||
}
|
||||
|
||||
/* This is used for CompiledLocal, not for Var & Co. That struct did not
|
||||
* change, but the correct flag init did! The flags bits themselves are
|
||||
* unchanged */
|
||||
|
||||
#define ItclInitVarArgument(varPtr) \
|
||||
if (itclOldRuntime) { \
|
||||
(varPtr)->flags = (VAR_SCALAR | VAR_ARGUMENT);\
|
||||
} else { \
|
||||
(varPtr)->flags = VAR_ARGUMENT;\
|
||||
}
|
||||
|
||||
#define TclIsVarNamespaceVar(varPtr) \
|
||||
(ItclVarFlags(varPtr) & VAR_NAMESPACE_VAR)
|
||||
|
||||
#define TclSetVarNamespaceVar(varPtr) \
|
||||
if (!TclIsVarNamespaceVar(varPtr)) {\
|
||||
ItclVarFlags(varPtr) |= VAR_NAMESPACE_VAR;\
|
||||
ItclVarRefCount(varPtr)++;\
|
||||
}
|
||||
|
||||
#define ItclClearVarUndefined(varPtr) \
|
||||
if (itclOldRuntime) { \
|
||||
ItclVarFlags(varPtr) &= ~VAR_UNDEFINED;\
|
||||
}
|
||||
|
||||
#ifndef MODULE_SCOPE
|
||||
#define MODULE_SCOPE
|
||||
#endif
|
||||
|
||||
MODULE_SCOPE Var * ItclVarHashCreateVar (TclVarHashTable * tablePtr,
|
||||
const char * key, int * newPtr);
|
||||
|
||||
#endif /* Version dependent defs and macros */
|
||||
|
||||
|
||||
#define ItclVarHashFindVar(tablePtr, key) \
|
||||
ItclVarHashCreateVar((tablePtr), (key), NULL)
|
||||
|
||||
|
||||
/*
|
||||
* Common info for managing all known objects.
|
||||
* Each interpreter has one of these data structures stored as
|
||||
* clientData in the "itcl" namespace. It is also accessible
|
||||
* as associated data via the key ITCL_INTERP_DATA.
|
||||
*/
|
||||
struct ItclObject;
|
||||
typedef struct ItclObjectInfo {
|
||||
Tcl_Interp *interp; /* interpreter that manages this info */
|
||||
Tcl_HashTable objects; /* list of all known objects */
|
||||
|
||||
Itcl_Stack transparentFrames; /* stack of call frames that should be
|
||||
* treated transparently. When
|
||||
* Itcl_EvalMemberCode is invoked in
|
||||
* one of these contexts, it does an
|
||||
* "uplevel" to get past the transparent
|
||||
* frame and back to the calling context. */
|
||||
Tcl_HashTable contextFrames; /* object contexts for active call frames */
|
||||
|
||||
int protection; /* protection level currently in effect */
|
||||
|
||||
Itcl_Stack cdefnStack; /* stack of class definitions currently
|
||||
* being parsed */
|
||||
} ItclObjectInfo;
|
||||
|
||||
#define ITCL_INTERP_DATA "itcl_data"
|
||||
|
||||
/*
|
||||
* Representation for each [incr Tcl] class.
|
||||
*/
|
||||
typedef struct ItclClass {
|
||||
char *name; /* class name */
|
||||
char *fullname; /* fully qualified class name */
|
||||
Tcl_Interp *interp; /* interpreter that manages this info */
|
||||
Tcl_Namespace *namesp; /* namespace representing class scope */
|
||||
Tcl_Command accessCmd; /* access command for creating instances */
|
||||
|
||||
struct ItclObjectInfo *info; /* info about all known objects */
|
||||
Itcl_List bases; /* list of base classes */
|
||||
Itcl_List derived; /* list of all derived classes */
|
||||
Tcl_HashTable heritage; /* table of all base classes. Look up
|
||||
* by pointer to class definition. This
|
||||
* provides fast lookup for inheritance
|
||||
* tests. */
|
||||
Tcl_Obj *initCode; /* initialization code for new objs */
|
||||
Tcl_HashTable variables; /* definitions for all data members
|
||||
in this class. Look up simple string
|
||||
names and get back ItclVarDefn* ptrs */
|
||||
Tcl_HashTable functions; /* definitions for all member functions
|
||||
in this class. Look up simple string
|
||||
names and get back ItclMemberFunc* ptrs */
|
||||
int numInstanceVars; /* number of instance vars in variables
|
||||
table */
|
||||
Tcl_HashTable resolveVars; /* all possible names for variables in
|
||||
* this class (e.g., x, foo::x, etc.) */
|
||||
Tcl_HashTable resolveCmds; /* all possible names for functions in
|
||||
* this class (e.g., x, foo::x, etc.) */
|
||||
int unique; /* unique number for #auto generation */
|
||||
int flags; /* maintains class status */
|
||||
} ItclClass;
|
||||
|
||||
typedef struct ItclHierIter {
|
||||
ItclClass *current; /* current position in hierarchy */
|
||||
Itcl_Stack stack; /* stack used for traversal */
|
||||
} ItclHierIter;
|
||||
|
||||
/*
|
||||
* Representation for each [incr Tcl] object.
|
||||
*/
|
||||
typedef struct ItclObject {
|
||||
ItclClass *classDefn; /* most-specific class */
|
||||
Tcl_Command accessCmd; /* object access command */
|
||||
|
||||
int dataSize; /* number of elements in data array */
|
||||
Var** data; /* all object-specific data members */
|
||||
Tcl_HashTable* constructed; /* temp storage used during construction */
|
||||
Tcl_HashTable* destructed; /* temp storage used during destruction */
|
||||
} ItclObject;
|
||||
|
||||
#define ITCL_IGNORE_ERRS 0x002 /* useful for construction/destruction */
|
||||
|
||||
/*
|
||||
* Implementation for any code body in an [incr Tcl] class.
|
||||
*/
|
||||
typedef struct ItclMemberCode {
|
||||
int flags; /* flags describing implementation */
|
||||
CompiledLocal *arglist; /* list of arg names and initial values */
|
||||
int argcount; /* number of args in arglist */
|
||||
Proc *procPtr; /* Tcl proc representation (needed to
|
||||
* handle compiled locals) */
|
||||
union {
|
||||
Tcl_CmdProc *argCmd; /* (argc,argv) C implementation */
|
||||
Tcl_ObjCmdProc *objCmd; /* (objc,objv) C implementation */
|
||||
} cfunc;
|
||||
|
||||
ClientData clientData; /* client data for C implementations */
|
||||
|
||||
} ItclMemberCode;
|
||||
|
||||
#define Itcl_IsMemberCodeImplemented(mcode) \
|
||||
(((mcode)->flags & ITCL_IMPLEMENT_NONE) == 0)
|
||||
|
||||
/*
|
||||
* Basic representation for class members (commands/variables)
|
||||
*/
|
||||
typedef struct ItclMember {
|
||||
Tcl_Interp* interp; /* interpreter containing the class */
|
||||
ItclClass* classDefn; /* class containing this member */
|
||||
char* name; /* member name */
|
||||
char* fullname; /* member name with "class::" qualifier */
|
||||
int protection; /* protection level */
|
||||
int flags; /* flags describing member (see below) */
|
||||
ItclMemberCode *code; /* code associated with member */
|
||||
} ItclMember;
|
||||
|
||||
/*
|
||||
* Flag bits for ItclMemberCode and ItclMember:
|
||||
*/
|
||||
#define ITCL_IMPLEMENT_NONE 0x001 /* no implementation */
|
||||
#define ITCL_IMPLEMENT_TCL 0x002 /* Tcl implementation */
|
||||
#define ITCL_IMPLEMENT_ARGCMD 0x004 /* (argc,argv) C implementation */
|
||||
#define ITCL_IMPLEMENT_OBJCMD 0x008 /* (objc,objv) C implementation */
|
||||
#define ITCL_IMPLEMENT_C 0x00c /* either kind of C implementation */
|
||||
#define ITCL_CONSTRUCTOR 0x010 /* non-zero => is a constructor */
|
||||
#define ITCL_DESTRUCTOR 0x020 /* non-zero => is a destructor */
|
||||
#define ITCL_COMMON 0x040 /* non-zero => is a "proc" */
|
||||
#define ITCL_ARG_SPEC 0x080 /* non-zero => has an argument spec */
|
||||
|
||||
#define ITCL_OLD_STYLE 0x100 /* non-zero => old-style method
|
||||
* (process "config" argument) */
|
||||
|
||||
#define ITCL_THIS_VAR 0x200 /* non-zero => built-in "this" variable */
|
||||
|
||||
/*
|
||||
* Representation of member functions in an [incr Tcl] class.
|
||||
*/
|
||||
typedef struct ItclMemberFunc {
|
||||
ItclMember *member; /* basic member info */
|
||||
Tcl_Command accessCmd; /* Tcl command installed for this function */
|
||||
CompiledLocal *arglist; /* list of arg names and initial values */
|
||||
int argcount; /* number of args in arglist */
|
||||
} ItclMemberFunc;
|
||||
|
||||
/*
|
||||
* Instance variables.
|
||||
*/
|
||||
typedef struct ItclVarDefn {
|
||||
ItclMember *member; /* basic member info */
|
||||
char* init; /* initial value */
|
||||
} ItclVarDefn;
|
||||
|
||||
/*
|
||||
* Instance variable lookup entry.
|
||||
*/
|
||||
typedef struct ItclVarLookup {
|
||||
ItclVarDefn* vdefn; /* variable definition */
|
||||
int usage; /* number of uses for this record */
|
||||
int accessible; /* non-zero => accessible from class with
|
||||
* this lookup record in its resolveVars */
|
||||
char *leastQualName; /* simplist name for this variable, with
|
||||
* the fewest qualifiers. This string is
|
||||
* taken from the resolveVars table, so
|
||||
* it shouldn't be freed. */
|
||||
union {
|
||||
int index; /* index into virtual table (instance data) */
|
||||
Tcl_Var common; /* variable (common data) */
|
||||
} var;
|
||||
} ItclVarLookup;
|
||||
|
||||
/*
|
||||
* Representation for the context in which a body of [incr Tcl]
|
||||
* code executes. In ordinary Tcl, this is a CallFrame. But for
|
||||
* [incr Tcl] code bodies, we must be careful to set up the
|
||||
* CallFrame properly, to plug in instance variables before
|
||||
* executing the code body.
|
||||
*/
|
||||
typedef struct ItclContext {
|
||||
ItclClass *classDefn; /* class definition */
|
||||
Itcl_CallFrame frame; /* call frame for object context */
|
||||
Var *compiledLocals; /* points to storage for compiled locals */
|
||||
Var localStorage[20]; /* default storage for compiled locals */
|
||||
} ItclContext;
|
||||
|
||||
/*
|
||||
* Compatibility flags. Used to support small "hacks". These are stored
|
||||
* in the global variable named itclCompatFlags.
|
||||
*/
|
||||
|
||||
extern int itclCompatFlags;
|
||||
|
||||
#define ITCL_COMPAT_USE_ISTATE_API 0x2 /* Tcl 8.5a2 added interp state APIs */
|
||||
|
||||
#include "itclIntDecls.h"
|
||||
|
||||
/*
|
||||
* Since the Tcl/Tk distribution doesn't perform any asserts,
|
||||
* dynamic loading can fail to find the __assert function.
|
||||
* As a workaround, we'll include our own.
|
||||
*/
|
||||
|
||||
#undef assert
|
||||
#ifndef DEBUG
|
||||
#define assert(EX) ((void)0)
|
||||
#else
|
||||
#define assert(EX) (void)((EX) || (Itcl_Assert(STRINGIFY(EX), __FILE__, __LINE__), 0))
|
||||
#endif /* DEBUG */
|
||||
|
||||
#undef TCL_STORAGE_CLASS
|
||||
#define TCL_STORAGE_CLASS DLLIMPORT
|
||||
|
||||
#endif /* ITCLINT_H */
|
||||
File diff suppressed because it is too large
Load Diff
+1
-1
Submodule itk/itk updated: e697407849...0d1dc9780c
@@ -1,4 +1,5 @@
|
||||
PATCH
|
||||
TCL
|
||||
TK
|
||||
ITCL
|
||||
|
||||
|
||||
+209
-99
@@ -1,106 +1,216 @@
|
||||
diff -Naur itk/configure ITK_BLD/configure
|
||||
--- itk/configure 2026-09-14 11:05:50.343138038 -0400
|
||||
+++ ITK_BLD/configure 2026-09-14 11:04:56.453544503 -0400
|
||||
@@ -7050,7 +7050,9 @@
|
||||
fi
|
||||
# TEA specific:
|
||||
if test x"${XLIBSW}" != x ; then
|
||||
- PKG_LIBS="${PKG_LIBS} ${XLIBSW}"
|
||||
+ # Itk uses Tk stubs and does not make direct Xlib calls. Avoid
|
||||
+ # preserving TEA_PATH_X's platform X libraries.
|
||||
+ :
|
||||
fi
|
||||
|
||||
fi
|
||||
diff -Naur itk/configure.ac ITK_BLD/configure.ac
|
||||
--- itk/configure.ac 2026-09-14 11:07:25.749985453 -0400
|
||||
+++ ITK_BLD/configure.ac 2026-09-14 11:07:25.734985540 -0400
|
||||
@@ -162,7 +162,8 @@
|
||||
|
||||
TEA_PUBLIC_TK_HEADERS
|
||||
#TEA_PRIVATE_TK_HEADERS
|
||||
-TEA_PATH_X
|
||||
+# Itk uses Tk stubs and makes no direct Xlib calls. Its X implementation is
|
||||
+# selected by Tk, so do not add a second platform X library dependency.
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# We need to enable the threading macros found in tcl.h and tclInt.h.
|
||||
diff -Naur itk/generic/itkBase.c ITK_BLD/generic/itkBase.c
|
||||
--- itk/generic/itkBase.c 2026-09-14 11:07:25.763985372 -0400
|
||||
+++ ITK_BLD/generic/itkBase.c 2026-09-14 11:07:25.701985731 -0400
|
||||
@@ -129,7 +129,7 @@
|
||||
if (Tk_InitStubs(interp, "8.6-", 0) == NULL) {
|
||||
return TCL_ERROR;
|
||||
};
|
||||
- if (Itcl_InitStubs(interp, "4.1", 0) == NULL) {
|
||||
+ if (Itcl_InitStubs(interp, "4.1.1", 0) == NULL) {
|
||||
diff -Naur itk/generic/itk_cmds.c ITK_BLD/generic/itk_cmds.c
|
||||
--- itk/generic/itk_cmds.c 2024-07-10 10:44:13.330651607 -0400
|
||||
+++ ITK_BLD/generic/itk_cmds.c 2024-07-10 10:32:07.734264686 -0400
|
||||
@@ -111,8 +111,7 @@
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
-Initialize(interp)
|
||||
- Tcl_Interp *interp; /* interpreter to be updated */
|
||||
+Initialize(Tcl_Interp *interp)
|
||||
{
|
||||
Tcl_Namespace *itkNs, *parserNs;
|
||||
ClientData parserInfo;
|
||||
@@ -256,8 +255,7 @@
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
int
|
||||
-Itk_Init(interp)
|
||||
- Tcl_Interp *interp; /* interpreter to be updated */
|
||||
+Itk_Init(Tcl_Interp *interp)
|
||||
{
|
||||
if (Initialize(interp) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
@@ -282,8 +280,7 @@
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
int
|
||||
-Itk_SafeInit(interp)
|
||||
- Tcl_Interp *interp; /* interpreter to be updated */
|
||||
+Itk_SafeInit(Tcl_Interp *interp)
|
||||
{
|
||||
if (Initialize(interp) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
@@ -316,11 +313,7 @@
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
-Itk_ConfigBodyCmd(dummy, interp, objc, objv)
|
||||
- ClientData dummy; /* unused */
|
||||
- Tcl_Interp *interp; /* current interpreter */
|
||||
- int objc; /* number of arguments */
|
||||
- Tcl_Obj *CONST objv[]; /* argument objects */
|
||||
+Itk_ConfigBodyCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
|
||||
{
|
||||
int result = TCL_OK;
|
||||
|
||||
diff -Naur itk/generic/itk_archetype.c ITK_BLD/generic/itk_archetype.c
|
||||
--- itk/generic/itk_archetype.c 2026-05-31 11:06:17
|
||||
+++ ITK_BLD/generic/itk_archetype.c 2026-05-31 11:06:17
|
||||
@@ -3974,6 +3974,8 @@
|
||||
char **confv = NULL;
|
||||
int optc;
|
||||
char **optv = NULL;
|
||||
+ const char **splitConfv = NULL;
|
||||
+ const char **splitOptv = NULL;
|
||||
|
||||
int i, newEntry;
|
||||
Tcl_HashTable *tPtr;
|
||||
@@ -3988,13 +3990,15 @@
|
||||
* Only consider options with all 5 required components. Avoid
|
||||
* aliases like "-bg".
|
||||
*/
|
||||
- if (Tcl_SplitList(interp, options, &confc, &confv) != TCL_OK) {
|
||||
+ if (Tcl_SplitList(interp, options, &confc, &splitConfv) != TCL_OK) {
|
||||
goto tableFail;
|
||||
}
|
||||
+ confv = (char **)splitConfv;
|
||||
for (i=0; i < confc; i++) {
|
||||
- if (Tcl_SplitList(interp, confv[i], &optc, &optv) != TCL_OK) {
|
||||
+ if (Tcl_SplitList(interp, confv[i], &optc, &splitOptv) != TCL_OK) {
|
||||
goto tableFail;
|
||||
}
|
||||
+ optv = (char **)splitOptv;
|
||||
if (optc == 5) { /* avoid aliased options */
|
||||
entry = Tcl_CreateHashEntry(tPtr, optv[0], &newEntry);
|
||||
if (newEntry) {
|
||||
@@ -4089,6 +4093,7 @@
|
||||
|
||||
diff -Naur itk/pkgIndex.tcl.in ITK_BLD/pkgIndex.tcl.in
|
||||
--- itk/pkgIndex.tcl.in 2026-09-14 11:07:25.759985395 -0400
|
||||
+++ ITK_BLD/pkgIndex.tcl.in 2026-09-14 11:07:25.716985644 -0400
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
int optc, result;
|
||||
char **optv;
|
||||
+ const char **splitOptv = NULL;
|
||||
char *name, *info;
|
||||
Tcl_Obj *resultPtr;
|
||||
|
||||
if {![package vsatisfies [package provide Tcl] 8.6-]} {return}
|
||||
-if {[string length [package provide Itcl]] && ![package vsatisfies [package provide Itcl] 4.1]} return
|
||||
+if {[string length [package provide Itcl]] && ![package vsatisfies [package provide Itcl] 4.1.1]} return
|
||||
if {[package vsatisfies [package provide Tcl] 9.0-]} {
|
||||
package ifneeded itk @PACKAGE_VERSION@ \
|
||||
[list load [file join $dir @PKG_LIB_FILE9@] Itk]
|
||||
diff -Naur itk/win/makefile.vc ITK_BLD/win/makefile.vc
|
||||
--- itk/win/makefile.vc 2026-09-14 11:07:25.785985244 -0400
|
||||
+++ ITK_BLD/win/makefile.vc 2026-09-14 11:07:25.731985557 -0400
|
||||
@@ -60,28 +60,37 @@
|
||||
# In principle, we don't need the ITCL source directory, and an installed
|
||||
# ITCL should suffice. But that needs additional machinery not implemented
|
||||
# yet.
|
||||
+!if "$(ITCLDIR)" != ""
|
||||
+ITCL_DIR = $(ITCLDIR)
|
||||
+!else
|
||||
!if [echo ITCL_DIR = \> nmakehlp.out] \
|
||||
|| [nmakehlp -L generic\itcl.h >> nmakehlp.out]
|
||||
!error Could not locate ITCL source directory.
|
||||
!endif
|
||||
+!include nmakehlp.out
|
||||
+!endif
|
||||
# Locate TK headers and libraries.
|
||||
# In principle, we don't need the TK source directory, and an installed
|
||||
# TK should suffice. But that needs additional machinery not implemented
|
||||
# yet.
|
||||
+!if "$(TKDIR)" != ""
|
||||
+TK_DIR = $(TKDIR)
|
||||
+!else
|
||||
!if [echo TK_DIR = \> nmakehlp.out] \
|
||||
|| [nmakehlp -L generic\tk.h >> nmakehlp.out]
|
||||
!error Could not locate TK source directory.
|
||||
!endif
|
||||
!include nmakehlp.out
|
||||
+!endif
|
||||
@@ -4126,7 +4131,8 @@
|
||||
Tcl_IncrRefCount(resultPtr);
|
||||
info = Tcl_GetStringFromObj(resultPtr, (int*)NULL);
|
||||
|
||||
-# Get the ITCL version from its configure.ac
|
||||
+# Get the ITCL version from its public header.
|
||||
!if [echo ITCL_DOTVERSION = \> versions.vc] \
|
||||
- && [nmakehlp -V "$(ITCL_DIR)\configure.ac" itcl >> versions.vc]
|
||||
+ && [nmakehlp -V "$(ITCL_DIR)\generic\itcl.h" ITCL_PATCH_LEVEL >> versions.vc]
|
||||
!error Could not retrieve ITCL version.
|
||||
!endif
|
||||
-# Get the TK version from its configure.ac
|
||||
-!if [echo TK_DOTVERSION = \> versions.vc] \
|
||||
- && [nmakehlp -V "$(TK_DIR)\configure.ac" tk >> versions.vc]
|
||||
+# Get the Tk version from its public header.
|
||||
+!if [echo TK_DOTVERSION = \>> versions.vc] \
|
||||
+ && [nmakehlp -V "$(TK_DIR)\generic\tk.h" TK_VERSION >> versions.vc]
|
||||
!error Could not retrieve TK version.
|
||||
!endif
|
||||
!include versions.vc
|
||||
@@ -140,7 +149,7 @@
|
||||
git rev-parse HEAD >>$(ROOT)\manifest.uuid
|
||||
- result = Tcl_SplitList(interp, info, &optc, &optv);
|
||||
+ result = Tcl_SplitList(interp, info, &optc, &splitOptv);
|
||||
+ optv = (char **)splitOptv;
|
||||
|
||||
$(TMP_DIR)\itkUuid.h: $(ROOT)\manifest.uuid
|
||||
- copy $(WIN_DIR)\itkUuid.h.in+$(ROOT)\manifest.uuid $(TMP_DIR)\itkUuid.h
|
||||
+ copy /b $(WIN_DIR)\itkUuid.h.in+$(ROOT)\manifest.uuid $(TMP_DIR)\itkUuid.h
|
||||
Tcl_DecrRefCount(resultPtr);
|
||||
|
||||
test: setup $(PROJECT)
|
||||
@echo testing itk
|
||||
diff -Naur itk/win/rc/itk.rc ITK_BLD/win/rc/itk.rc
|
||||
--- itk/win/rc/itk.rc 2024-07-10 10:44:13.334651538 -0400
|
||||
+++ ITK_BLD/win/rc/itk.rc 2024-07-10 10:32:07.734264686 -0400
|
||||
@@ -1,59 +1,59 @@
|
||||
-//
|
||||
-// Version resource script.
|
||||
-//
|
||||
-
|
||||
-#include <winver.h>
|
||||
-#include <itcl.h>
|
||||
-#include <itk.h>
|
||||
-
|
||||
-//
|
||||
-// build-up the name suffix that defines the type of build this is.
|
||||
-//
|
||||
-#if DEBUG
|
||||
-#define SUFFIX_DEBUG "g"
|
||||
-#else
|
||||
-#define SUFFIX_DEBUG ""
|
||||
-#endif
|
||||
-
|
||||
-#define SUFFIX SUFFIX_DEBUG
|
||||
-
|
||||
-
|
||||
-VS_VERSION_INFO VERSIONINFO
|
||||
- FILEVERSION ITK_MAJOR_VERSION,ITK_MINOR_VERSION,ITK_RELEASE_LEVEL,ITK_RELEASE_SERIAL
|
||||
- PRODUCTVERSION ITK_MAJOR_VERSION,ITK_MINOR_VERSION,ITK_RELEASE_LEVEL,ITK_RELEASE_SERIAL
|
||||
- FILEFLAGSMASK 0x3fL
|
||||
-#if DEBUG
|
||||
- FILEFLAGS VS_FF_DEBUG
|
||||
-#else
|
||||
- FILEFLAGS 0x0L
|
||||
-#endif
|
||||
- FILEOS VOS__WINDOWS32
|
||||
- FILETYPE VFT_DLL
|
||||
- FILESUBTYPE 0x0L
|
||||
-
|
||||
-BEGIN
|
||||
- BLOCK "StringFileInfo"
|
||||
- BEGIN
|
||||
- BLOCK "040904b0"
|
||||
- BEGIN
|
||||
- VALUE "FileDescription", "[Incr Tk] Object-Oriented Tk extension\0"
|
||||
- VALUE "Authors", "Michael McLennan\0"
|
||||
- VALUE "OriginalFilename", "itk" STRINGIFY(ITK_MAJOR_VERSION) STRINGIFY(ITK_MINOR_VERSION) SUFFIX ".dll\0"
|
||||
- VALUE "CompanyName", "Bell Labs Innovations for Lucent Technologies\0"
|
||||
- VALUE "FileVersion", ITK_PATCH_LEVEL
|
||||
- VALUE "LegalCopyright", "Copyright \251 1993-2003\0"
|
||||
- VALUE "ProductName", "[Incr Tk] " ITK_VERSION " for Windows\0"
|
||||
- VALUE "ProductVersion", ITK_PATCH_LEVEL
|
||||
- END
|
||||
- END
|
||||
- BLOCK "VarFileInfo"
|
||||
- BEGIN
|
||||
- VALUE "Translation", 0x409, 1200
|
||||
- END
|
||||
-END
|
||||
-
|
||||
-//
|
||||
-// Icons
|
||||
-//
|
||||
-
|
||||
-toaster ICON DISCARDABLE "itk.ico"
|
||||
+//
|
||||
+// Version resource script.
|
||||
+//
|
||||
+
|
||||
+#include <winver.h>
|
||||
+#include <itcl.h>
|
||||
+#include <itk.h>
|
||||
+
|
||||
+//
|
||||
+// build-up the name suffix that defines the type of build this is.
|
||||
+//
|
||||
+#if DEBUG
|
||||
+#define SUFFIX_DEBUG "g"
|
||||
+#else
|
||||
+#define SUFFIX_DEBUG ""
|
||||
+#endif
|
||||
+
|
||||
+#define SUFFIX SUFFIX_DEBUG
|
||||
+
|
||||
+
|
||||
+VS_VERSION_INFO VERSIONINFO
|
||||
+ FILEVERSION ITK_MAJOR_VERSION,ITK_MINOR_VERSION,ITK_RELEASE_LEVEL,ITK_RELEASE_SERIAL
|
||||
+ PRODUCTVERSION ITK_MAJOR_VERSION,ITK_MINOR_VERSION,ITK_RELEASE_LEVEL,ITK_RELEASE_SERIAL
|
||||
+ FILEFLAGSMASK 0x3fL
|
||||
+#if DEBUG
|
||||
+ FILEFLAGS VS_FF_DEBUG
|
||||
+#else
|
||||
+ FILEFLAGS 0x0L
|
||||
+#endif
|
||||
+ FILEOS VOS__WINDOWS32
|
||||
+ FILETYPE VFT_DLL
|
||||
+ FILESUBTYPE 0x0L
|
||||
+
|
||||
+BEGIN
|
||||
+ BLOCK "StringFileInfo"
|
||||
+ BEGIN
|
||||
+ BLOCK "040904b0"
|
||||
+ BEGIN
|
||||
+ VALUE "FileDescription", "[Incr Tk] Object-Oriented Tk extension\0"
|
||||
+ VALUE "Authors", "Michael McLennan\0"
|
||||
+ VALUE "OriginalFilename", "itk" STRINGIFY(ITK_MAJOR_VERSION) STRINGIFY(ITK_MINOR_VERSION) SUFFIX ".dll\0"
|
||||
+ VALUE "CompanyName", "Bell Labs Innovations for Lucent Technologies\0"
|
||||
+ VALUE "FileVersion", ITK_PATCH_LEVEL
|
||||
+ VALUE "LegalCopyright", "Copyright \251 1993-2003\0"
|
||||
+ VALUE "ProductName", "[Incr Tk] " ITK_VERSION " for Windows\0"
|
||||
+ VALUE "ProductVersion", ITK_PATCH_LEVEL
|
||||
+ END
|
||||
+ END
|
||||
+ BLOCK "VarFileInfo"
|
||||
+ BEGIN
|
||||
+ VALUE "Translation", 0x409, 1200
|
||||
+ END
|
||||
+END
|
||||
+
|
||||
+//
|
||||
+// Icons
|
||||
+//
|
||||
+
|
||||
+toaster ICON DISCARDABLE "itk.ico"
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
if (NOT ITK_SOURCE_DIR OR NOT ITK_PATCH_EXECUTABLE OR
|
||||
NOT ITK_PATCH_CHECK_OPTION OR NOT ITK_PATCH_REJECT_DIR OR
|
||||
NOT ITK_PATCH_FILE OR NOT ITK_INSTALL_PATCH_FILE)
|
||||
message(FATAL_ERROR
|
||||
"Itk patching requires source, patch tool, check option, reject "
|
||||
"directory, and patch file paths")
|
||||
endif ()
|
||||
|
||||
# Upstream stores this Windows makefile with CRLF line endings. The BSD patch
|
||||
# utility used on some Unix hosts does not normalize them, so normalize the
|
||||
# staged copy before applying the cross-platform source patches.
|
||||
set(ITK_WINDOWS_MAKEFILE "${ITK_SOURCE_DIR}/win/makefile.vc")
|
||||
file(READ "${ITK_WINDOWS_MAKEFILE}" ITK_WINDOWS_MAKEFILE_CONTENTS)
|
||||
string(REPLACE "\r\n" "\n" ITK_WINDOWS_MAKEFILE_CONTENTS "${ITK_WINDOWS_MAKEFILE_CONTENTS}")
|
||||
file(WRITE "${ITK_WINDOWS_MAKEFILE}" "${ITK_WINDOWS_MAKEFILE_CONTENTS}")
|
||||
|
||||
set(ITK_PATCH_WRAPPER "${CMAKE_CURRENT_LIST_DIR}/../CMake/PatchWrapper.cmake")
|
||||
set(ITK_PATCH_FILES
|
||||
"${ITK_PATCH_FILE}"
|
||||
"${ITK_INSTALL_PATCH_FILE}"
|
||||
)
|
||||
foreach (ITK_CURRENT_PATCH_FILE IN LISTS ITK_PATCH_FILES)
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
"-DBEXT_PATCH_NATIVE_EXECUTABLE=${ITK_PATCH_EXECUTABLE}"
|
||||
"-DBEXT_PATCH_CHECK_OPTION=${ITK_PATCH_CHECK_OPTION}"
|
||||
"-DBEXT_PATCH_REJECT_DIR=${ITK_PATCH_REJECT_DIR}"
|
||||
-P "${ITK_PATCH_WRAPPER}" -- -E -p1 -N -i "${ITK_CURRENT_PATCH_FILE}"
|
||||
WORKING_DIRECTORY "${ITK_SOURCE_DIR}"
|
||||
RESULT_VARIABLE ITK_PATCH_RESULT
|
||||
OUTPUT_VARIABLE ITK_PATCH_OUTPUT
|
||||
ERROR_VARIABLE ITK_PATCH_ERROR
|
||||
)
|
||||
|
||||
if (ITK_PATCH_RESULT)
|
||||
message(FATAL_ERROR
|
||||
"Itk source patch failed for ${ITK_CURRENT_PATCH_FILE}:\n"
|
||||
"${ITK_PATCH_OUTPUT}${ITK_PATCH_ERROR}"
|
||||
)
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -1,37 +0,0 @@
|
||||
message("Itk build begins\n")
|
||||
|
||||
set(BUILD_SCRIPT "${CMAKE_BINARY_DIR}/build_itk.bat")
|
||||
file(WRITE "${BUILD_SCRIPT}"
|
||||
"@echo off\n"
|
||||
"set VSCMD_DEBUG=0\n"
|
||||
"set \"NoDefaultCurrentDirectoryInExePath=\"\n"
|
||||
"call \"@VCVARS_BAT@\"\n"
|
||||
"if errorlevel 1 exit /b %ERRORLEVEL%\n"
|
||||
"set \"PATH=@BEXT_MSVC_COMPILER_BIN_DIR@;%PATH%\"\n"
|
||||
"cd /D \"@ITK_SRC_DIR@/win\"\n"
|
||||
"set CC=\n"
|
||||
"set RC=\n"
|
||||
"nmake -f makefile.vc TCLDIR=@TCL_SRC_DIR@ TKDIR=@TK_SRC_DIR@ ITCLDIR=@ITCL_SRC_DIR@ INSTALLDIR=@CMAKE_BUNDLE_INSTALL_PREFIX@ SUFX=\n"
|
||||
"exit /b %ERRORLEVEL%\n"
|
||||
)
|
||||
|
||||
execute_process(
|
||||
WORKING_DIRECTORY "@ITK_SRC_DIR@/win"
|
||||
COMMAND cmd /c "${BUILD_SCRIPT}"
|
||||
RESULT_VARIABLE ITK_RET
|
||||
OUTPUT_VARIABLE CMD_OUT
|
||||
ERROR_VARIABLE CMD_OUT
|
||||
)
|
||||
|
||||
if (ITK_RET)
|
||||
message(FATAL_ERROR "Itk build failed:\n${CMD_OUT}\n")
|
||||
endif (ITK_RET)
|
||||
|
||||
message("Itk build succeeded:\n${CMD_OUT}\n")
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -1,41 +0,0 @@
|
||||
if (APPLE)
|
||||
execute_process(
|
||||
COMMAND xcrun --show-sdk-path
|
||||
OUTPUT_VARIABLE SDK_PATH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
set(ENV{LDFLAGS} "-isysroot ${SDK_PATH} -L${SDK_PATH}/usr/lib -L@CMAKE_BUNDLE_INSTALL_PREFIX@/@LIB_DIR@ -F${SDK_PATH}/System/Library/Frameworks -framework CoreFoundation")
|
||||
set(ENV{CFLAGS} "-isysroot ${SDK_PATH} -L${SDK_PATH}/usr/lib -L@CMAKE_BUNDLE_INSTALL_PREFIX@/@LIB_DIR@ -F${SDK_PATH}/System/Library/Frameworks")
|
||||
set(ENV{CPPFLAGS} "-isystem ${SDK_PATH}/usr/include -F${SDK_PATH}/System/Library/Frameworks -I@CMAKE_BUNDLE_INSTALL_PREFIX@/@INCLUDE_DIR@")
|
||||
else ()
|
||||
set(ENV{LD_LIBRARY_PATH} "@CMAKE_BUNDLE_INSTALL_PREFIX@/@LIB_DIR@")
|
||||
set(ENV{LDFLAGS} "-L@CMAKE_BUNDLE_INSTALL_PREFIX@/@LIB_DIR@")
|
||||
set(ENV{CPPFLAGS} "-I@CMAKE_BUNDLE_INSTALL_PREFIX@/@INCLUDE_DIR@")
|
||||
endif (APPLE)
|
||||
|
||||
execute_process(
|
||||
COMMAND "@ITK_SRC_DIR@/configure"
|
||||
--prefix=@CMAKE_BUNDLE_INSTALL_PREFIX@
|
||||
--with-tcl=@WITH_TCL_DIR@
|
||||
--with-tk=@WITH_TK_DIR@
|
||||
--with-itcl=@WITH_ITCL_DIR@
|
||||
--with-tclinclude=@WITH_TCL_INCLUDE_DIR@
|
||||
--with-tkinclude=@WITH_TK_INCLUDE_DIR@
|
||||
RESULT_VARIABLE ITK_RET
|
||||
WORKING_DIRECTORY "@ITK_BIN_DIR@"
|
||||
OUTPUT_VARIABLE MSG
|
||||
ERROR_VARIABLE MSG
|
||||
)
|
||||
|
||||
if (ITK_RET)
|
||||
message(FATAL_ERROR "Itk configure failed:\n${MSG}\n")
|
||||
endif (ITK_RET)
|
||||
|
||||
message("${MSG}\nItk configure succeeded.\n")
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -1,62 +0,0 @@
|
||||
set(INSTALL_SCRIPT "${CMAKE_BINARY_DIR}/install_itk.bat")
|
||||
file(WRITE "${INSTALL_SCRIPT}"
|
||||
"@echo off\n"
|
||||
"set VSCMD_DEBUG=0\n"
|
||||
"set \"NoDefaultCurrentDirectoryInExePath=\"\n"
|
||||
"call \"@VCVARS_BAT@\"\n"
|
||||
"if errorlevel 1 exit /b %ERRORLEVEL%\n"
|
||||
"set \"PATH=@BEXT_MSVC_COMPILER_BIN_DIR@;%PATH%\"\n"
|
||||
"cd /D \"@ITK_SRC_DIR@/win\"\n"
|
||||
"set CC=\n"
|
||||
"set RC=\n"
|
||||
"nmake -f makefile.vc install TCLDIR=@TCL_SRC_DIR@ TKDIR=@TK_SRC_DIR@ ITCLDIR=@ITCL_SRC_DIR@ INSTALLDIR=@CMAKE_BUNDLE_INSTALL_PREFIX@ SUFX=\n"
|
||||
"exit /b %ERRORLEVEL%\n"
|
||||
)
|
||||
|
||||
execute_process(
|
||||
WORKING_DIRECTORY "@ITK_SRC_DIR@/win"
|
||||
COMMAND cmd /c "${INSTALL_SCRIPT}"
|
||||
RESULT_VARIABLE ITK_RET
|
||||
OUTPUT_VARIABLE CMD_OUT
|
||||
ERROR_VARIABLE CMD_OUT
|
||||
)
|
||||
|
||||
if (ITK_RET)
|
||||
message(FATAL_ERROR "Itk install failed:\n${CMD_OUT}\n")
|
||||
endif (ITK_RET)
|
||||
|
||||
set(ITK_SCRIPT_INSTALL_DIR
|
||||
"@CMAKE_BUNDLE_INSTALL_PREFIX@/@LIB_DIR@/itk@BEXT_ITK_BUNDLED_VERSION@"
|
||||
)
|
||||
set(ITK_REQUIRED_SCRIPT_FILES
|
||||
Archetype.itk
|
||||
Toplevel.itk
|
||||
Widget.itk
|
||||
itk.tcl
|
||||
pkgIndex.tcl
|
||||
tclIndex
|
||||
)
|
||||
set(ITK_MISSING_SCRIPT_FILES)
|
||||
foreach (ITK_REQUIRED_SCRIPT_FILE ${ITK_REQUIRED_SCRIPT_FILES})
|
||||
if (NOT EXISTS "${ITK_SCRIPT_INSTALL_DIR}/${ITK_REQUIRED_SCRIPT_FILE}")
|
||||
list(APPEND ITK_MISSING_SCRIPT_FILES
|
||||
"${ITK_SCRIPT_INSTALL_DIR}/${ITK_REQUIRED_SCRIPT_FILE}"
|
||||
)
|
||||
endif ()
|
||||
endforeach ()
|
||||
if (ITK_MISSING_SCRIPT_FILES)
|
||||
list(JOIN ITK_MISSING_SCRIPT_FILES "\n " ITK_MISSING_SCRIPT_FILES_TEXT)
|
||||
message(FATAL_ERROR
|
||||
"Itk install did not produce required runtime scripts:\n"
|
||||
" ${ITK_MISSING_SCRIPT_FILES_TEXT}\n"
|
||||
)
|
||||
endif ()
|
||||
|
||||
message("Itk install succeeded:\n${CMD_OUT}\n")
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -1,16 +0,0 @@
|
||||
diff -Naur itk/win/makefile.vc ITK_BLD/win/makefile.vc
|
||||
--- itk/win/makefile.vc 2026-09-14 11:07:25.785985244 -0400
|
||||
+++ ITK_BLD/win/makefile.vc 2026-09-15 17:45:00.000000000 -0400
|
||||
@@ -130,5 +130,11 @@
|
||||
|
||||
# Additional default actions for install
|
||||
-install: default-install-docs-n
|
||||
+install: default-install-docs-n install-itk-class-library
|
||||
+
|
||||
+# The generic TEA target copies only *.tcl. Install Itk's class definitions
|
||||
+# and autoload index as well so the base classes are available at runtime.
|
||||
+install-itk-class-library: default-install-scripts
|
||||
+ @$(CPY) $(LIBDIR)\*.itk "$(SCRIPT_INSTALL_DIR)"
|
||||
+ @$(CPY) $(LIBDIR)\tclIndex "$(SCRIPT_INSTALL_DIR)"
|
||||
|
||||
# The TIP 477 generation of pkgIndex.tcl from pkgIndex.tcl.in does not include
|
||||
@@ -1 +0,0 @@
|
||||
git-e697407849b01d3498b56fc46e5a423690190954
|
||||
@@ -1,99 +0,0 @@
|
||||
#------------------------------------------------------------- -*- makefile -*-
|
||||
# targets.vc --
|
||||
#
|
||||
# Part of the nmake based build system for Tcl and its extensions.
|
||||
# This file defines some standard targets for the convenience of extensions
|
||||
# and can be optionally included by the extension makefile.
|
||||
# See TIP 477 (https://core.tcl-lang.org/tips/doc/main/tip/477.md) for docs.
|
||||
|
||||
$(PROJECT): setup pkgindex $(PRJLIB)
|
||||
|
||||
!ifdef PRJ_STUBOBJS
|
||||
$(PROJECT): $(PRJSTUBLIB)
|
||||
$(PRJSTUBLIB): $(PRJ_STUBOBJS)
|
||||
$(LIBCMD) $**
|
||||
|
||||
$(PRJ_STUBOBJS):
|
||||
$(CCSTUBSCMD) %s
|
||||
!endif # PRJ_STUBOBJS
|
||||
|
||||
!ifdef PRJ_MANIFEST
|
||||
$(PROJECT): $(PRJLIB).manifest
|
||||
$(PRJLIB).manifest: $(PRJ_MANIFEST)
|
||||
@nmakehlp -s << $** >$@
|
||||
@MACHINE@ $(MACHINE:IX86=X86)
|
||||
<<
|
||||
!endif
|
||||
|
||||
!if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk"
|
||||
$(PRJLIB): $(PRJ_OBJS) $(RESFILE)
|
||||
!if $(STATIC_BUILD)
|
||||
$(LIBCMD) $**
|
||||
!else
|
||||
$(DLLCMD) $**
|
||||
$(_VC_MANIFEST_EMBED_DLL)
|
||||
!endif
|
||||
-@del $*.exp
|
||||
!endif
|
||||
|
||||
!if "$(PRJ_HEADERS)" != "" && "$(PRJ_OBJS)" != ""
|
||||
$(PRJ_OBJS): $(PRJ_HEADERS)
|
||||
!endif
|
||||
|
||||
# If parent makefile has defined stub objects, add their installation
|
||||
# to the default install
|
||||
!if "$(PRJ_STUBOBJS)" != ""
|
||||
default-install: default-install-stubs
|
||||
!endif
|
||||
|
||||
# Unlike the other default targets, these cannot be in rules.vc because
|
||||
# the executed command depends on existence of macro PRJ_HEADERS_PUBLIC
|
||||
# that the parent makefile will not define until after including rules-ext.vc
|
||||
!if "$(PRJ_HEADERS_PUBLIC)" != ""
|
||||
default-install: default-install-headers
|
||||
default-install-headers:
|
||||
@$(ECHO) Installing headers to '$(INCLUDE_INSTALL_DIR)'
|
||||
@if not exist "$(INCLUDE_INSTALL_DIR)" $(MKDIR) "$(INCLUDE_INSTALL_DIR)"
|
||||
@for %f in ($(PRJ_HEADERS_PUBLIC)) do @$(COPY) %f "$(INCLUDE_INSTALL_DIR)"
|
||||
!endif
|
||||
|
||||
!if "$(DISABLE_STANDARD_TARGETS)" == ""
|
||||
DISABLE_STANDARD_TARGETS = 0
|
||||
!endif
|
||||
|
||||
!if "$(DISABLE_TARGET_setup)" == ""
|
||||
DISABLE_TARGET_setup = 0
|
||||
!endif
|
||||
!if "$(DISABLE_TARGET_install)" == ""
|
||||
DISABLE_TARGET_install = 0
|
||||
!endif
|
||||
!if "$(DISABLE_TARGET_clean)" == ""
|
||||
DISABLE_TARGET_clean = 0
|
||||
!endif
|
||||
!if "$(DISABLE_TARGET_test)" == ""
|
||||
DISABLE_TARGET_test = 0
|
||||
!endif
|
||||
!if "$(DISABLE_TARGET_shell)" == ""
|
||||
DISABLE_TARGET_shell = 0
|
||||
!endif
|
||||
|
||||
!if !$(DISABLE_STANDARD_TARGETS)
|
||||
!if !$(DISABLE_TARGET_setup)
|
||||
setup: default-setup
|
||||
!endif
|
||||
!if !$(DISABLE_TARGET_install)
|
||||
install: default-install
|
||||
!endif
|
||||
!if !$(DISABLE_TARGET_clean)
|
||||
clean: default-clean
|
||||
realclean: hose
|
||||
hose: default-hose
|
||||
distclean: realclean default-distclean
|
||||
!endif
|
||||
!if !$(DISABLE_TARGET_test)
|
||||
test: default-test
|
||||
!endif
|
||||
!if !$(DISABLE_TARGET_shell)
|
||||
shell: default-shell
|
||||
!endif
|
||||
!endif # DISABLE_STANDARD_TARGETS
|
||||
+11
-8
@@ -5,12 +5,16 @@ if (USE_BRLCAD)
|
||||
|
||||
endif (USE_BRLCAD)
|
||||
|
||||
# Tcl can inspect a system package index without loading Iwidgets, but the
|
||||
# advertised version does not establish Itcl 4 compatibility. The latest
|
||||
# upstream 4.1.1 sources still need the fixes in iwidgets_itcl4.patch, and a
|
||||
# system package using that same version may or may not carry equivalent
|
||||
# downstream fixes. Actually validating it loads Tk and requires a display.
|
||||
# Unless explicitly disabled, use the known patched copy.
|
||||
# Unfortunately, there does not appear to be a reliable way to test for the
|
||||
# presence of the IWidgets package on a system Tcl/Tk. As far as I can tell
|
||||
# the "package require Iwidgets" test (which is what is required to properly
|
||||
# test for an available Iwidgets package) can ONLY be performed successfully on
|
||||
# a system that supports creation of a graphics window. Window creation isn't
|
||||
# typically available on continuous integration runners, which means the test
|
||||
# will always fail there even when it shouldn't.
|
||||
|
||||
# Unless we have been specifically instructed not to, provide the bundled
|
||||
# version of IWidgets.
|
||||
|
||||
if (NOT DEFINED ENABLE_IWIDGETS AND NOT DISABLE_IWIDGETS)
|
||||
set(ENABLE_IWIDGETS ON)
|
||||
@@ -23,9 +27,8 @@ if (ENABLE_IWIDGETS)
|
||||
RegisterDeps(IWIDGETS)
|
||||
|
||||
ExternalProject_Add(IWIDGETS_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/iwidgets"
|
||||
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/iwidgets"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/iwidgets_itcl4.patch
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BUNDLE_INSTALL_PREFIX}
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
Iwidgets in bext
|
||||
================
|
||||
|
||||
Bext packages Iwidgets 4.1.1 because Iwidgets is not bundled with Tcl or Tk
|
||||
and cannot be assumed to be installed with a system Tcl/Tk stack. The source
|
||||
predates Itcl 4 and needs a small compatibility patch when used with the Itcl
|
||||
4.1.1-or-newer stack required by BRL-CAD.
|
||||
|
||||
Upstream status
|
||||
---------------
|
||||
|
||||
The latest official Incr Widgets source release is 4.1.1. The release archive
|
||||
and bext's generic widget sources match except for expanded CVS Id strings;
|
||||
bext omits obsolete build, CVS, demo, manual, and test files and supplies its
|
||||
own CMake packaging. The Tcl Core fossil project named "iwidgets for itk4"
|
||||
has only two check-ins, both from May 24, 2012, and its source retains the
|
||||
compatibility defects fixed here. There is consequently no newer maintained
|
||||
upstream source to import as of September 2026.
|
||||
|
||||
Tcl can discover versions advertised by system package indexes without loading
|
||||
Iwidgets or opening a display. That is sufficient for inventory, but not for
|
||||
safe selection: an unpatched system package and one with equivalent downstream
|
||||
fixes both advertise version 4.1.1. Loading enough code to validate behavior
|
||||
also loads Tk and requires a display. Bext therefore continues to use its
|
||||
known patched copy by default instead of treating the version string as proof
|
||||
of compatibility.
|
||||
|
||||
Compatibility patch
|
||||
-------------------
|
||||
|
||||
Itcl 3 accepted an array element as the argument to itcl::scope. Itcl 4
|
||||
instead resolves that argument as a variable name and rejects array element
|
||||
syntax. The patch resolves each common array's fully qualified variable name
|
||||
with namespace which, then appends the element index. This preserves the
|
||||
variable names expected by Tk -variable, -textvariable, trace, and tkwait
|
||||
without depending on Itcl 3's itcl::scope behavior.
|
||||
|
||||
The Finddialog match callback previously constructed a command with subst and
|
||||
then executed the resulting string. Tcl 8.5's argument expansion syntax
|
||||
invokes the stored command prefix directly, preserving argument boundaries and
|
||||
supporting the command prefixes produced by Itcl 4.
|
||||
|
||||
Labeledwidget::alignlabels originally passed the unqualified class name
|
||||
Labeledwidget to itcl::find. Itcl 4 resolves that name in the caller's object
|
||||
context. The result therefore depended on package initialization order: it
|
||||
worked when Itcl was loaded before Tk, but failed in applications such as
|
||||
bwish and Archer where Tk was initialized first. The patch uses the fully
|
||||
qualified ::iwidgets::Labeledwidget class name so both supported initialization
|
||||
orders behave identically.
|
||||
|
||||
These changes are kept as a bext patch rather than modifications to the source
|
||||
submodule. That keeps the imported upstream revision identifiable and makes
|
||||
the compatibility delta explicit and independently reviewable. The external
|
||||
project patches a staged copy so builds do not modify the source submodule.
|
||||
|
||||
Validation
|
||||
----------
|
||||
|
||||
The BRL-CAD Tcl/Itcl smoke baseline exercises the affected Iwidgets under both
|
||||
initialization orders:
|
||||
|
||||
* btclsh loads Itcl before Tk and represents command-line tools such as
|
||||
rtwizard;
|
||||
* bwish initializes Tk before tclcad loads Itcl and represents Archer and
|
||||
other Tk-first applications.
|
||||
|
||||
The baseline constructs and operates the affected widgets, invokes
|
||||
Labeledwidget::alignlabels, follows callbacks after returning to the event
|
||||
loop, and treats background Tcl errors as failures. Xmin supplies the X
|
||||
server needed to run the GUI case on headless builders.
|
||||
@@ -1,3 +1,4 @@
|
||||
PATCH
|
||||
ITCL
|
||||
ITK
|
||||
|
||||
|
||||
@@ -1,335 +0,0 @@
|
||||
diff --git a/generic/canvasprintbox.itk b/generic/canvasprintbox.itk
|
||||
index 9d41daa..4f7d1d0 100755
|
||||
--- a/generic/canvasprintbox.itk
|
||||
+++ b/generic/canvasprintbox.itk
|
||||
@@ -352,7 +352,7 @@ itcl::body iwidgets::Canvasprintbox::constructor {args} {
|
||||
itk_component add printerrb {
|
||||
radiobutton $cs.printerrb \
|
||||
-text Printer \
|
||||
- -variable [itcl::scope _globVar($this,output)] \
|
||||
+ -variable [namespace which -variable _globVar]($this,output) \
|
||||
-anchor w \
|
||||
-justify left \
|
||||
-value printer \
|
||||
@@ -366,7 +366,7 @@ itcl::body iwidgets::Canvasprintbox::constructor {args} {
|
||||
-labeltext "command:" \
|
||||
-state normal \
|
||||
-labelpos w \
|
||||
- -textvariable [itcl::scope _globVar($this,printeref)]
|
||||
+ -textvariable [namespace which -variable _globVar]($this,printeref)
|
||||
}
|
||||
|
||||
itk_component add filerb {
|
||||
@@ -374,7 +374,7 @@ itcl::body iwidgets::Canvasprintbox::constructor {args} {
|
||||
-text File \
|
||||
-justify left \
|
||||
-anchor w \
|
||||
- -variable [itcl::scope _globVar($this,output)] \
|
||||
+ -variable [namespace which -variable _globVar]($this,output) \
|
||||
-value file \
|
||||
-command [itcl::code $this _update_attr]
|
||||
} {
|
||||
@@ -386,7 +386,7 @@ itcl::body iwidgets::Canvasprintbox::constructor {args} {
|
||||
-labeltext "filename:" \
|
||||
-state disabled \
|
||||
-labelpos w \
|
||||
- -textvariable [itcl::scope _globVar($this,fileef)]
|
||||
+ -textvariable [namespace which -variable _globVar]($this,fileef)
|
||||
}
|
||||
|
||||
itk_component add propsframe {
|
||||
@@ -422,7 +422,7 @@ itcl::body iwidgets::Canvasprintbox::constructor {args} {
|
||||
-text {Stretch to fit} \
|
||||
-justify left \
|
||||
-anchor w \
|
||||
- -variable [itcl::scope _globVar($this,stretchcb)] \
|
||||
+ -variable [namespace which -variable _globVar]($this,stretchcb) \
|
||||
-command [itcl::code $this refresh]
|
||||
} {
|
||||
usual
|
||||
@@ -435,7 +435,7 @@ itcl::body iwidgets::Canvasprintbox::constructor {args} {
|
||||
-text Posterize \
|
||||
-justify left \
|
||||
-anchor w \
|
||||
- -variable [itcl::scope _globVar($this,postercb)] \
|
||||
+ -variable [namespace which -variable _globVar]($this,postercb) \
|
||||
-command [itcl::code $this refresh]
|
||||
} {
|
||||
usual
|
||||
@@ -445,7 +445,7 @@ itcl::body iwidgets::Canvasprintbox::constructor {args} {
|
||||
itk_component add hpcnt {
|
||||
iwidgets::entryfield $cs.hpcnt \
|
||||
-labeltext on \
|
||||
- -textvariable [itcl::scope _globVar($this,hpc)] \
|
||||
+ -textvariable [namespace which -variable _globVar]($this,hpc) \
|
||||
-validate integer -width 3 \
|
||||
-command [itcl::code $this refresh]
|
||||
}
|
||||
@@ -453,7 +453,7 @@ itcl::body iwidgets::Canvasprintbox::constructor {args} {
|
||||
itk_component add vpcnt {
|
||||
iwidgets::entryfield $cs.vpcnt \
|
||||
-labeltext by \
|
||||
- -textvariable [itcl::scope _globVar($this,vpc)] \
|
||||
+ -textvariable [namespace which -variable _globVar]($this,vpc) \
|
||||
-validate integer -width 3 \
|
||||
-command [itcl::code $this refresh]
|
||||
}
|
||||
diff --git a/generic/checkbox.itk b/generic/checkbox.itk
|
||||
index 49e8888..123be27 100755
|
||||
--- a/generic/checkbox.itk
|
||||
+++ b/generic/checkbox.itk
|
||||
@@ -172,7 +172,7 @@ itcl::body iwidgets::Checkbox::index {index} {
|
||||
itcl::body iwidgets::Checkbox::add {tag args} {
|
||||
itk_component add $tag {
|
||||
eval checkbutton $itk_component(childsite).cb[incr _unique] \
|
||||
- -variable [list [itcl::scope buttonVar($this,$tag)]] \
|
||||
+ -variable [list [namespace which -variable buttonVar]($this,$tag)] \
|
||||
-anchor w \
|
||||
-justify left \
|
||||
-highlightthickness 0 \
|
||||
@@ -207,7 +207,7 @@ itcl::body iwidgets::Checkbox::add {tag args} {
|
||||
itcl::body iwidgets::Checkbox::insert {index tag args} {
|
||||
itk_component add $tag {
|
||||
eval checkbutton $itk_component(childsite).cb[incr _unique] \
|
||||
- -variable [list [itcl::scope buttonVar($this,$tag)]] \
|
||||
+ -variable [list [namespace which -variable buttonVar]($this,$tag)] \
|
||||
-anchor w \
|
||||
-justify left \
|
||||
-highlightthickness 0 \
|
||||
@@ -258,7 +258,7 @@ itcl::body iwidgets::Checkbox::select {index} {
|
||||
# already selected. Check its associated variable, and if
|
||||
# it's set, then just ignore and return.
|
||||
#-----------------------------------------------------------
|
||||
- if {[set [itcl::scope buttonVar($this,$tag)]] ==
|
||||
+ if {[set [namespace which -variable buttonVar]($this,$tag)] ==
|
||||
[[component $tag] cget -onvalue]} {
|
||||
return
|
||||
}
|
||||
diff --git a/generic/combobox.itk b/generic/combobox.itk
|
||||
index 140724b..dfa690b 100755
|
||||
--- a/generic/combobox.itk
|
||||
+++ b/generic/combobox.itk
|
||||
@@ -1231,7 +1231,7 @@ itcl::body iwidgets::Combobox::_listShowing {{val ""}} {
|
||||
return $_listShowing($this)
|
||||
} elseif {$val == "-wait"} {
|
||||
while {!$_listShowing($this)} {
|
||||
- tkwait variable [itcl::scope _listShowing($this)]
|
||||
+ tkwait variable [namespace which -variable _listShowing]($this)
|
||||
}
|
||||
return
|
||||
}
|
||||
diff --git a/generic/finddialog.itk b/generic/finddialog.itk
|
||||
index 7bf38f1..608ebb9 100755
|
||||
--- a/generic/finddialog.itk
|
||||
+++ b/generic/finddialog.itk
|
||||
@@ -102,7 +102,7 @@ itcl::body ::iwidgets::Finddialog::constructor {args} {
|
||||
#
|
||||
itk_component add all {
|
||||
checkbutton $itk_interior.all \
|
||||
- -variable [itcl::scope _optionValues($this-all)] \
|
||||
+ -variable [namespace which -variable _optionValues]($this-all) \
|
||||
-text "All"
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ itcl::body ::iwidgets::Finddialog::constructor {args} {
|
||||
#
|
||||
itk_component add case {
|
||||
checkbutton $itk_interior.case \
|
||||
- -variable [itcl::scope _optionValues($this-case)] \
|
||||
+ -variable [namespace which -variable _optionValues]($this-case) \
|
||||
-text "Consider Case"
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ itcl::body ::iwidgets::Finddialog::constructor {args} {
|
||||
#
|
||||
itk_component add regexp {
|
||||
checkbutton $itk_interior.regexp \
|
||||
- -variable [itcl::scope _optionValues($this-regexp)] \
|
||||
+ -variable [namespace which -variable _optionValues]($this-regexp) \
|
||||
-text "Use Regular Expression"
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ itcl::body ::iwidgets::Finddialog::constructor {args} {
|
||||
#
|
||||
itk_component add backwards {
|
||||
checkbutton $itk_interior.backwards \
|
||||
- -variable [itcl::scope _optionValues($this-backwards)] \
|
||||
+ -variable [namespace which -variable _optionValues]($this-backwards) \
|
||||
-text "Find Backwards"
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ itcl::body ::iwidgets::Finddialog::find {} {
|
||||
# of the string matching the pattern.
|
||||
#
|
||||
set precmd "$itk_option(-textwidget) search \
|
||||
- -count [list [itcl::scope _matchLen($this)]]"
|
||||
+ -count [list [namespace which -variable _matchLen]($this)]"
|
||||
|
||||
if {! [_get case]} {
|
||||
append precmd " -nocase"
|
||||
@@ -423,7 +423,7 @@ itcl::body ::iwidgets::Finddialog::find {} {
|
||||
# If a match command is defined, then call it with the match point.
|
||||
#
|
||||
if {$itk_option(-matchcommand) != {}} {
|
||||
- [subst $itk_option(-matchcommand)] $matchPoint
|
||||
+ {*}$itk_option(-matchcommand) $matchPoint
|
||||
}
|
||||
|
||||
#
|
||||
diff --git a/generic/mainwindow.itk b/generic/mainwindow.itk
|
||||
index 032021e..4f94a4d 100755
|
||||
--- a/generic/mainwindow.itk
|
||||
+++ b/generic/mainwindow.itk
|
||||
@@ -84,7 +84,7 @@ itcl::body iwidgets::Mainwindow::constructor {args} {
|
||||
#
|
||||
itk_component add menubar {
|
||||
iwidgets::Menubar $itk_interior.menubar \
|
||||
- -helpvariable [itcl::scope _helpVar($this)]
|
||||
+ -helpvariable [namespace which -variable _helpVar]($this)
|
||||
} {
|
||||
keep -disabledforeground -cursor \
|
||||
-highlightbackground -highlightthickness
|
||||
@@ -101,7 +101,7 @@ itcl::body iwidgets::Mainwindow::constructor {args} {
|
||||
#
|
||||
itk_component add toolbar {
|
||||
iwidgets::Toolbar $itk_interior.toolbar -orient horizontal \
|
||||
- -helpvariable [itcl::scope _helpVar($this)]
|
||||
+ -helpvariable [namespace which -variable _helpVar]($this)
|
||||
} {
|
||||
keep -balloonbackground -balloondelay1 -balloondelay2 \
|
||||
-balloonfont -balloonforeground -disabledforeground -cursor \
|
||||
@@ -116,7 +116,7 @@ itcl::body iwidgets::Mainwindow::constructor {args} {
|
||||
#
|
||||
itk_component add mousebar {
|
||||
iwidgets::Toolbar $itk_interior.mousebar -orient vertical \
|
||||
- -helpvariable [itcl::scope _helpVar($this)]
|
||||
+ -helpvariable [namespace which -variable _helpVar]($this)
|
||||
} {
|
||||
keep -balloonbackground -balloondelay1 -balloondelay2 \
|
||||
-balloonfont -balloonforeground -disabledforeground -cursor \
|
||||
@@ -142,13 +142,13 @@ itcl::body iwidgets::Mainwindow::constructor {args} {
|
||||
|
||||
itk_component add help {
|
||||
label $itk_component(lineframe).help \
|
||||
- -textvariable [itcl::scope _helpVar($this)] \
|
||||
+ -textvariable [namespace which -variable _helpVar]($this) \
|
||||
-relief sunken -borderwidth 2 -width 10
|
||||
}
|
||||
|
||||
itk_component add status {
|
||||
label $itk_component(lineframe).status \
|
||||
- -textvariable [itcl::scope _statusVar($this)] \
|
||||
+ -textvariable [namespace which -variable _statusVar]($this) \
|
||||
-relief sunken -borderwidth 2 -width 10
|
||||
}
|
||||
|
||||
diff --git a/generic/radiobox.itk b/generic/radiobox.itk
|
||||
index 282eaa7..fe1b11e 100755
|
||||
--- a/generic/radiobox.itk
|
||||
+++ b/generic/radiobox.itk
|
||||
@@ -111,7 +111,7 @@ itcl::body iwidgets::Radiobox::constructor {args} {
|
||||
#
|
||||
set _modes($this) {}
|
||||
|
||||
- trace variable [itcl::scope _modes($this)] w [itcl::code $this _command]
|
||||
+ trace variable [namespace which -variable _modes]($this) w [itcl::code $this _command]
|
||||
|
||||
grid columnconfigure $itk_component(childsite) 0 -weight 1
|
||||
|
||||
@@ -123,7 +123,7 @@ itcl::body iwidgets::Radiobox::constructor {args} {
|
||||
# ------------------------------------------------------------------
|
||||
itcl::body iwidgets::Radiobox::destructor { } {
|
||||
|
||||
- trace vdelete [itcl::scope _modes($this)] w [itcl::code $this _command]
|
||||
+ trace vdelete [namespace which -variable _modes]($this) w [itcl::code $this _command]
|
||||
catch {unset _modes($this)}
|
||||
|
||||
}
|
||||
@@ -212,7 +212,7 @@ itcl::body iwidgets::Radiobox::add {tag args} {
|
||||
|
||||
itk_component add $tag {
|
||||
eval radiobutton $itk_component(childsite).rb[incr _unique] \
|
||||
- -variable [list [itcl::scope _modes($this)]] \
|
||||
+ -variable [list [namespace which -variable _modes]($this)] \
|
||||
-anchor w \
|
||||
-justify left \
|
||||
-highlightthickness 0 \
|
||||
@@ -250,7 +250,7 @@ itcl::body iwidgets::Radiobox::insert {index tag args} {
|
||||
|
||||
itk_component add $tag {
|
||||
eval radiobutton $itk_component(childsite).rb[incr _unique] \
|
||||
- -variable [list [itcl::scope _modes($this)]] \
|
||||
+ -variable [list [namespace which -variable _modes]($this)] \
|
||||
-highlightthickness 0 \
|
||||
-anchor w \
|
||||
-justify left \
|
||||
diff --git a/generic/shell.itk b/generic/shell.itk
|
||||
index c7b6f04..b326f05 100755
|
||||
--- a/generic/shell.itk
|
||||
+++ b/generic/shell.itk
|
||||
@@ -275,7 +275,7 @@ itcl::body iwidgets::Shell::activate {} {
|
||||
|
||||
lappend grabstack [list grab $itk_component(hull)]
|
||||
|
||||
- tkwait variable [itcl::scope _wait($this)]
|
||||
+ tkwait variable [namespace which -variable _wait]($this)
|
||||
return $_result
|
||||
|
||||
} elseif {$itk_option(-modality) == "global" } {
|
||||
@@ -293,7 +293,7 @@ itcl::body iwidgets::Shell::activate {} {
|
||||
|
||||
lappend grabstack [list grab -global $itk_component(hull)]
|
||||
|
||||
- tkwait variable [itcl::scope _wait($this)]
|
||||
+ tkwait variable [namespace which -variable _wait]($this)
|
||||
return $_result
|
||||
}
|
||||
}
|
||||
diff --git a/generic/watch.itk b/generic/watch.itk
|
||||
index ace2cc9..4993aca 100755
|
||||
--- a/generic/watch.itk
|
||||
+++ b/generic/watch.itk
|
||||
@@ -171,7 +171,7 @@ itcl::body iwidgets::Watch::constructor { args } {
|
||||
radiobutton $itk_component(frame).am \
|
||||
-text "AM" \
|
||||
-value "AM" \
|
||||
- -variable [itcl::scope _ampmVar($this)]
|
||||
+ -variable [namespace which -variable _ampmVar]($this)
|
||||
} {
|
||||
usual
|
||||
rename -font -labelfont labelFont Font
|
||||
@@ -181,7 +181,7 @@ itcl::body iwidgets::Watch::constructor { args } {
|
||||
radiobutton $itk_component(frame).pm \
|
||||
-text "PM" \
|
||||
-value "PM" \
|
||||
- -variable [itcl::scope _ampmVar($this)]
|
||||
+ -variable [namespace which -variable _ampmVar]($this)
|
||||
} {
|
||||
usual
|
||||
rename -font -labelfont labelFont Font
|
||||
diff --git a/generic/labeledwidget.itk b/generic/labeledwidget.itk
|
||||
index 2e0faa5..0f43ddb 100755
|
||||
--- a/generic/labeledwidget.itk
|
||||
+++ b/generic/labeledwidget.itk
|
||||
@@ -248,9 +248,9 @@
|
||||
# Verify that all the widgets are of type Labeledwidget and
|
||||
# determine the size of the maximum length label string.
|
||||
#
|
||||
foreach iwid $args {
|
||||
- set objcmd [itcl::find objects -isa Labeledwidget *::$iwid]
|
||||
+ set objcmd [itcl::find objects -isa ::iwidgets::Labeledwidget *::$iwid]
|
||||
|
||||
if {$objcmd == ""} {
|
||||
error "$iwid is not a \"Labeledwidget\""
|
||||
}
|
||||
@@ -273,9 +273,9 @@
|
||||
|
||||
set labelSize [expr {$shellWidth - $csWidth}]
|
||||
|
||||
if {$maxLabelWidth > $labelSize} {
|
||||
- set objcmd [itcl::find objects -isa Labeledwidget *::$iwid]
|
||||
+ set objcmd [itcl::find objects -isa ::iwidgets::Labeledwidget *::$iwid]
|
||||
set dist [expr {$maxLabelWidth - \
|
||||
($labelSize - [$objcmd cget -labelmargin])}]
|
||||
|
||||
$objcmd configure -labelmargin $dist
|
||||
+11
-35
@@ -32,13 +32,6 @@ endif (APPLE)
|
||||
|
||||
|
||||
if (NOT ENABLE_TCL AND NOT DISABLE_TCL)
|
||||
set(BEXT_TCLTK_SYSTEM_STACK OFF CACHE INTERNAL "System Tcl/Tk/Itcl/Itk stack passed validation" FORCE)
|
||||
set(BEXT_ITCL_VERSION "" CACHE INTERNAL "Detected Itcl version" FORCE)
|
||||
set(BEXT_ITK_VERSION "" CACHE INTERNAL "Detected Itk version" FORCE)
|
||||
set(BEXT_ITCL_CONFIG_DIR "" CACHE INTERNAL
|
||||
"Directory containing bundled itclConfig.sh" FORCE)
|
||||
set(BEXT_ITCL_SOURCE_DIR "" CACHE INTERNAL
|
||||
"Bundled Itcl source directory" FORCE)
|
||||
|
||||
set(TCL_ENABLE_TK ON CACHE BOOL "enable tk")
|
||||
find_package(TCL "${TCL_VERSION}")
|
||||
@@ -51,15 +44,12 @@ if (NOT ENABLE_TCL AND NOT DISABLE_TCL)
|
||||
execute_process(
|
||||
COMMAND ${TCL_TCLSH} ${CMAKE_CURRENT_SOURCE_DIR}/check_itcl.tcl ${BEXT_ITCL_MIN_VERSION}
|
||||
RESULT_VARIABLE ITCL_CHECK_RESULT
|
||||
OUTPUT_VARIABLE ITCL_CHECK_OUTPUT
|
||||
OUTPUT_QUIET
|
||||
ERROR_VARIABLE ITCL_CHECK_ERROR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if (ITCL_CHECK_RESULT)
|
||||
set(BEXT_SYSTEM_STACK_REASON "system Tcl does not provide Itcl ${BEXT_ITCL_MIN_VERSION} or newer")
|
||||
string(STRIP "${ITCL_CHECK_ERROR}" BEXT_SYSTEM_STACK_DETAIL)
|
||||
else ()
|
||||
set(BEXT_ITCL_VERSION "${ITCL_CHECK_OUTPUT}" CACHE INTERNAL "Detected Itcl version" FORCE)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
@@ -74,16 +64,12 @@ if (NOT ENABLE_TCL AND NOT DISABLE_TCL)
|
||||
execute_process(
|
||||
COMMAND ${TCL_TCLSH} ${CMAKE_SOURCE_DIR}/tk/check_itk.tcl ${BEXT_ITK_MIN_VERSION}
|
||||
RESULT_VARIABLE ITK_CHECK_RESULT
|
||||
OUTPUT_VARIABLE ITK_CHECK_OUTPUT
|
||||
OUTPUT_QUIET
|
||||
ERROR_VARIABLE ITK_CHECK_ERROR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
)
|
||||
if (ITK_CHECK_RESULT)
|
||||
set(BEXT_SYSTEM_STACK_REASON "system Tk does not provide Itk ${BEXT_ITK_MIN_VERSION} or newer")
|
||||
string(STRIP "${ITK_CHECK_ERROR}" BEXT_SYSTEM_STACK_DETAIL)
|
||||
else ()
|
||||
set(BEXT_ITK_VERSION "${ITK_CHECK_OUTPUT}" CACHE INTERNAL "Detected Itk version" FORCE)
|
||||
set(BEXT_TCLTK_SYSTEM_STACK ON CACHE INTERNAL "System Tcl/Tk/Itcl/Itk stack passed validation" FORCE)
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
@@ -108,29 +94,14 @@ set(DISABLE_TCL "${DISABLE_TCL}" CACHE BOOL "Disable tcl build")
|
||||
if (ENABLE_TCL)
|
||||
|
||||
git_submodule_init(tcl unix/configure)
|
||||
if (NOT EXISTS "${BEXT_ITCL_BUNDLED_SOURCE_DIR}/configure")
|
||||
message(FATAL_ERROR
|
||||
"The bundled Tcl source does not contain the expected Itcl "
|
||||
"${BEXT_ITCL_BUNDLED_VERSION} sources. Use the complete Tcl source "
|
||||
"distribution rather than the core-only source tree."
|
||||
)
|
||||
endif ()
|
||||
|
||||
set(TCL_SRC_DIR "${CMAKE_CURRENT_BINARY_DIR}/TCL_BLD-prefix/src/TCL_BLD")
|
||||
set(TCL_BIN_DIR "${CMAKE_CURRENT_BINARY_DIR}/TCL_BLD-prefix/src/TCL_BLD-build")
|
||||
|
||||
set(BEXT_TCLTK_SYSTEM_STACK OFF CACHE INTERNAL "System Tcl/Tk/Itcl/Itk stack passed validation" FORCE)
|
||||
set(BEXT_ITCL_VERSION "${BEXT_ITCL_BUNDLED_VERSION}" CACHE INTERNAL "Bundled Itcl version" FORCE)
|
||||
set(BEXT_ITCL_CONFIG_DIR
|
||||
"${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR}/itcl${BEXT_ITCL_BUNDLED_VERSION}"
|
||||
CACHE INTERNAL "Directory containing bundled itclConfig.sh" FORCE)
|
||||
set(BEXT_ITCL_SOURCE_DIR
|
||||
"${TCL_SRC_DIR}/pkgs/itcl${BEXT_ITCL_BUNDLED_VERSION}"
|
||||
CACHE INTERNAL "Bundled Itcl source directory" FORCE)
|
||||
|
||||
|
||||
RegisterDeps(TCL)
|
||||
|
||||
# Tcl 8.6.18 carries Itcl 4; this branch builds Itcl 3 separately.
|
||||
set(TCL_BUNDLED_ITCL4_PACKAGE_DIR "pkgs/itcl4.3.7")
|
||||
|
||||
set(TCL_PATCH_FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tcl_relocatable_config.patch")
|
||||
if (NOT MSVC)
|
||||
@@ -208,6 +179,9 @@ if (ENABLE_TCL)
|
||||
file(READ "${TCL_PACKAGE_MAKEFILE}" TCL_PACKAGE_MAKEFILE_CONTENTS)
|
||||
if (TCL_PACKAGE_MAKEFILE_CONTENTS MATCHES "manifest[.]uuid")
|
||||
get_filename_component(TCL_PACKAGE_NAME "${TCL_PACKAGE_SOURCE_DIR}" NAME)
|
||||
if (TCL_PACKAGE_NAME MATCHES "^itcl4[.]")
|
||||
continue ()
|
||||
endif ()
|
||||
list(APPEND TCL_PACKAGE_MANIFEST_SETUP_COMMANDS
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/package_manifest.uuid
|
||||
@@ -255,6 +229,7 @@ if (ENABLE_TCL)
|
||||
# use z_brl. Remove it only from this staging copy after patching Tcl to
|
||||
# require z_brl; the pristine source distribution remains untouched.
|
||||
COMMAND ${ZLIB_SETUP_COMMANDS}
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory <SOURCE_DIR>/${TCL_BUNDLED_ITCL4_PACKAGE_DIR}
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/tcl_configure.cmake
|
||||
|
||||
# NOTE: Forcing -j on all sub-make calls to work around cmake+make
|
||||
@@ -284,6 +259,7 @@ if (ENABLE_TCL)
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
PATCH_COMMAND ${TCL_PATCH_COMMAND}
|
||||
${TCL_PACKAGE_MANIFEST_SETUP_COMMANDS}
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory <SOURCE_DIR>/${TCL_BUNDLED_ITCL4_PACKAGE_DIR}
|
||||
CONFIGURE_COMMAND ""
|
||||
BINARY_DIR ${TCL_SRC_DIR}/win
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/tcl_build.cmake
|
||||
|
||||
+6
-15
@@ -1,20 +1,11 @@
|
||||
Tcl in bext
|
||||
===========
|
||||
|
||||
Bext builds Tcl from the complete upstream source distribution mirrored by the
|
||||
RELEASE branch of BRL-CAD/tcl. The Tcl core Git tags are not sufficient for
|
||||
this purpose: release assembly adds the packages under pkgs, including Itcl.
|
||||
Tcl 8.6.18 supplies Itcl 4.3.7 there. Configuration fails immediately if the
|
||||
declared Itcl source directory is absent, rather than allowing the later Itk
|
||||
build to fail with incomplete private headers or configuration data.
|
||||
|
||||
The bundled Itcl version and the minimum system version are deliberately
|
||||
separate. The source distribution determines the former. The latter is the
|
||||
oldest version that passes BRL-CAD's Tcl-first and Tk-first GUI baselines as
|
||||
well as upstream Itk compatibility testing. Itcl 4.3.0 is required for the
|
||||
workaround to Tcl 8.6.15's `Tcl_NewObjectInstance` behavior; earlier Itcl 4
|
||||
releases fail when Iwidgets classes are loaded after Tk. A newer Tcl release
|
||||
does not by itself raise the complete system-stack requirement.
|
||||
Bext builds Tcl 8.6.18 from the complete upstream source distribution.
|
||||
That distribution includes Itcl 4.3.7, which the itcl3 branch removes from
|
||||
its ExternalProject staging copy before configuration. Itcl 3 is built from
|
||||
its own pinned submodule, and system package selection requires the same
|
||||
major version for both Itcl and Itk.
|
||||
|
||||
zlib selection
|
||||
--------------
|
||||
@@ -60,5 +51,5 @@ A bundled-stack build must establish all of the following:
|
||||
* Tcl's configure probe resolves brl_deflateSetHeader from -lz_brl;
|
||||
* the installed Tcl library depends on libz_brl and has unresolved brl_ zlib
|
||||
symbols for that library to satisfy;
|
||||
* package require reports Itcl 4.3.7, Itk 4.2.7, and Iwidgets 4.1.1; and
|
||||
* package require reports Itcl 3.4, Itk 3.4, and Iwidgets 4.1.1; and
|
||||
* Itk's upstream suite and BRL-CAD's Tcl GUI baseline pass under Xmin.
|
||||
|
||||
+26
-2
@@ -4,8 +4,32 @@ if {[llength $argv] != 1} {
|
||||
}
|
||||
|
||||
set minimumVersion [lindex $argv 0]
|
||||
if {[catch {package require Itcl $minimumVersion} version]} {
|
||||
puts stderr "Itcl $minimumVersion or newer is required: $version"
|
||||
set packageHandler [package unknown]
|
||||
if {$packageHandler eq ""} {
|
||||
puts stderr "Tcl has no package discovery handler"
|
||||
exit 1
|
||||
}
|
||||
if {[catch {{*}$packageHandler Itcl $minimumVersion} message]} {
|
||||
puts stderr "Unable to inspect system Itcl packages: $message"
|
||||
exit 1
|
||||
}
|
||||
|
||||
set requiredMajor [lindex [split $minimumVersion .] 0]
|
||||
set selectedVersion ""
|
||||
foreach version [package versions Itcl] {
|
||||
if {[lindex [split $version .] 0] ne $requiredMajor ||
|
||||
[package vcompare $version $minimumVersion] < 0} {
|
||||
continue
|
||||
}
|
||||
if {$selectedVersion eq "" ||
|
||||
[package vcompare $version $selectedVersion] > 0} {
|
||||
set selectedVersion $version
|
||||
}
|
||||
}
|
||||
|
||||
if {$selectedVersion eq "" ||
|
||||
[catch {package require -exact Itcl $selectedVersion} version]} {
|
||||
puts stderr "Itcl $minimumVersion or newer in major version $requiredMajor is required"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@ file(WRITE "${BUILD_SCRIPT}"
|
||||
"set RC=\n"
|
||||
"nmake -f makefile.vc INSTALLDIR=@CMAKE_BUNDLE_INSTALL_PREFIX@ SUFX=\n"
|
||||
"if errorlevel 1 exit /b %ERRORLEVEL%\n"
|
||||
"cd /D \"@BEXT_ITCL_SOURCE_DIR@/win\"\n"
|
||||
"nmake -f makefile.vc TCLDIR=@TCL_SRC_DIR@ INSTALLDIR=@CMAKE_BUNDLE_INSTALL_PREFIX@ SUFX=\n"
|
||||
"exit /b %ERRORLEVEL%\n"
|
||||
)
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ file(WRITE "${INSTALL_SCRIPT}"
|
||||
"set RC=\n"
|
||||
"nmake -f makefile.vc install INSTALLDIR=@CMAKE_BUNDLE_INSTALL_PREFIX@ SUFX=\n"
|
||||
"if errorlevel 1 exit /b %ERRORLEVEL%\n"
|
||||
"cd /D \"@BEXT_ITCL_SOURCE_DIR@/win\"\n"
|
||||
"nmake -f makefile.vc install TCLDIR=@TCL_SRC_DIR@ INSTALLDIR=@CMAKE_BUNDLE_INSTALL_PREFIX@ SUFX=\n"
|
||||
"exit /b %ERRORLEVEL%\n"
|
||||
)
|
||||
|
||||
|
||||
@@ -182,17 +182,6 @@
|
||||
@$(CPY) "$(OUT_DIR)\tcl.nmake" "$(LIB_INSTALL_DIR)\nmake\"
|
||||
@echo Installing package http 1.0 (obsolete)
|
||||
@$(CPY) "$(ROOT)\library\http1.0\*.tcl" \
|
||||
--- a/pkgs/itcl4.3.7/win/makefile.vc
|
||||
+++ b/pkgs/itcl4.3.7/win/makefile.vc
|
||||
@@ -64,7 +64,7 @@
|
||||
git rev-parse HEAD >>$(ROOT)\manifest.uuid
|
||||
|
||||
$(TMP_DIR)\itclUuid.h: $(ROOT)\manifest.uuid
|
||||
- copy $(WIN_DIR)\itclUuid.h.in+$(ROOT)\manifest.uuid $(TMP_DIR)\itclUuid.h
|
||||
+ copy /b $(WIN_DIR)\itclUuid.h.in+$(ROOT)\manifest.uuid $(TMP_DIR)\itclUuid.h
|
||||
|
||||
(TMP_DIR)\itclBase.obj: $(TMP_DIR)\itclUuid.h
|
||||
|
||||
--- a/pkgs/sqlite3.53.0/win/makefile.vc
|
||||
+++ b/pkgs/sqlite3.53.0/win/makefile.vc
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
@@ -42,17 +42,6 @@ if (BEXT_XMIN_ROOT AND NOT DISABLE_TCL AND NOT DISABLE_TK)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Tcl selection happens first because a missing system Itk requires the whole
|
||||
# implementation-coupled stack to be bundled. Guard that earlier decision so
|
||||
# no later option combination can silently select an unvalidated system Tk.
|
||||
if (NOT TK_DO_BUILD AND NOT DISABLE_TCL AND NOT DISABLE_TK AND NOT BEXT_TCLTK_SYSTEM_STACK)
|
||||
message(FATAL_ERROR
|
||||
"System Tk may be used only when its Tcl package path provides Itcl "
|
||||
"${BEXT_ITCL_MIN_VERSION} or newer and Itk ${BEXT_ITK_MIN_VERSION} or "
|
||||
"newer. Enable the bundled stack with -DENABLE_TCL=ON."
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (TK_DO_BUILD)
|
||||
|
||||
git_submodule_init(tk unix/configure)
|
||||
|
||||
+4
-2
@@ -17,9 +17,11 @@ if {[catch {{*}$packageHandler Itk $minimumVersion} message]} {
|
||||
exit 1
|
||||
}
|
||||
|
||||
set requiredMajor [lindex [split $minimumVersion .] 0]
|
||||
set selectedVersion ""
|
||||
foreach version [package versions Itk] {
|
||||
if {[package vcompare $version $minimumVersion] < 0} {
|
||||
if {[lindex [split $version .] 0] ne $requiredMajor ||
|
||||
[package vcompare $version $minimumVersion] < 0} {
|
||||
continue
|
||||
}
|
||||
if {$selectedVersion eq "" ||
|
||||
@@ -29,7 +31,7 @@ foreach version [package versions Itk] {
|
||||
}
|
||||
|
||||
if {$selectedVersion eq ""} {
|
||||
puts stderr "Itk $minimumVersion or newer is required"
|
||||
puts stderr "Itk $minimumVersion or newer in major version $requiredMajor is required"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user