Import Tcl-core 8.6.6 (as of svn r86089)
This commit is contained in:
208
macosx/GNUmakefile
Normal file
208
macosx/GNUmakefile
Normal file
@@ -0,0 +1,208 @@
|
||||
########################################################################################################
|
||||
#
|
||||
# Makefile wrapper to build tcl on Mac OS X in a way compatible with the tk/macosx Xcode buildsystem
|
||||
# uses the standard unix build system in tcl/unix (which can be used directly instead of this
|
||||
# if you are not using the tk/macosx projects).
|
||||
#
|
||||
# Copyright (c) 2002-2008 Daniel A. Steffen <das@users.sourceforge.net>
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution of
|
||||
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
########################################################################################################
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------
|
||||
# customizable settings
|
||||
|
||||
DESTDIR ?=
|
||||
INSTALL_ROOT ?= ${DESTDIR}
|
||||
|
||||
BUILD_DIR ?= ${CURDIR}/../../build
|
||||
SYMROOT ?= ${BUILD_DIR}/${PROJECT}
|
||||
OBJROOT ?= ${SYMROOT}
|
||||
|
||||
EXTRA_CONFIGURE_ARGS ?=
|
||||
EXTRA_MAKE_ARGS ?=
|
||||
|
||||
INSTALL_PATH ?= /Library/Frameworks
|
||||
PREFIX ?= /usr/local
|
||||
BINDIR ?= ${PREFIX}/bin
|
||||
LIBDIR ?= ${INSTALL_PATH}
|
||||
MANDIR ?= ${PREFIX}/man
|
||||
|
||||
# set to non-empty value to install manpages in addition to html help:
|
||||
INSTALL_MANPAGES ?=
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------
|
||||
# meta targets
|
||||
|
||||
meta := all install embedded install-embedded clean distclean test
|
||||
|
||||
styles := develop deploy
|
||||
|
||||
all := ${styles}
|
||||
all : ${all}
|
||||
|
||||
install := ${styles:%=install-%}
|
||||
install : ${install}
|
||||
install-%: action := install-
|
||||
|
||||
embedded := ${styles:%=embedded-%}
|
||||
embedded : embedded-deploy
|
||||
install-embedded := ${embedded:%=install-%}
|
||||
install-embedded : install-embedded-deploy
|
||||
|
||||
clean := ${styles:%=clean-%}
|
||||
clean : ${clean}
|
||||
clean-%: action := clean-
|
||||
distclean := ${styles:%=distclean-%}
|
||||
distclean : ${distclean}
|
||||
distclean-%: action := distclean-
|
||||
|
||||
test := ${styles:%=test-%}
|
||||
test : ${test}
|
||||
test-%: action := test-
|
||||
|
||||
targets := $(foreach v,${meta},${$v})
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------
|
||||
# build styles
|
||||
|
||||
BUILD_STYLE =
|
||||
CONFIGURE_ARGS =
|
||||
OBJ_DIR = ${OBJROOT}/${BUILD_STYLE}
|
||||
|
||||
empty :=
|
||||
space := ${empty} ${empty}
|
||||
objdir = $(subst ${space},\ ,${OBJ_DIR})
|
||||
|
||||
develop_make_args := BUILD_STYLE=Development CONFIGURE_ARGS=--enable-symbols
|
||||
deploy_make_args := BUILD_STYLE=Deployment INSTALL_TARGET=install-strip \
|
||||
EXTRA_CFLAGS=-DNDEBUG
|
||||
embedded_make_args := EMBEDDED_BUILD=1
|
||||
install_make_args := INSTALL_BUILD=1
|
||||
|
||||
${targets}:
|
||||
${MAKE} ${action}${PROJECT} \
|
||||
$(foreach s,${styles} embedded install,$(if $(findstring $s,$@),${${s}_make_args}))
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------
|
||||
# project specific settings
|
||||
|
||||
PROJECT := tcl
|
||||
PRODUCT_NAME := Tcl
|
||||
|
||||
UNIX_DIR := ${CURDIR}/../unix
|
||||
VERSION := $(shell awk -F= '/^TCL_VERSION/ {print $$2; nextfile}' ${UNIX_DIR}/configure.in)
|
||||
TCLSH := tclsh${VERSION}
|
||||
|
||||
BUILD_TARGET := all tcltest
|
||||
INSTALL_TARGET := install
|
||||
|
||||
export CPPROG := cp -p
|
||||
|
||||
INSTALL_TARGETS = install-binaries install-headers install-libraries
|
||||
ifeq (${EMBEDDED_BUILD},)
|
||||
INSTALL_TARGETS += install-private-headers
|
||||
endif
|
||||
ifeq (${INSTALL_BUILD}_${EMBEDDED_BUILD}_${BUILD_STYLE},1__Deployment)
|
||||
INSTALL_TARGETS += install-packages html-tcl
|
||||
ifneq (${INSTALL_MANPAGES},)
|
||||
INSTALL_TARGETS += install-doc
|
||||
endif
|
||||
endif
|
||||
|
||||
MAKE_VARS := INSTALL_ROOT INSTALL_TARGETS VERSION GENERIC_FLAGS
|
||||
MAKE_ARGS_V = $(foreach v,${MAKE_VARS},$v='${$v}')
|
||||
|
||||
build-${PROJECT}: target = ${BUILD_TARGET}
|
||||
install-${PROJECT}: target = ${INSTALL_TARGET}
|
||||
clean-${PROJECT} distclean-${PROJECT} test-${PROJECT}: \
|
||||
target = $*
|
||||
|
||||
DO_MAKE = +${MAKE} -C "${OBJ_DIR}" ${target} ${MAKE_ARGS_V} ${MAKE_ARGS} ${EXTRA_MAKE_ARGS}
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------
|
||||
# build rules
|
||||
|
||||
${PROJECT}:
|
||||
${MAKE} install-${PROJECT} INSTALL_ROOT="${OBJ_DIR}/"
|
||||
|
||||
${objdir}/Makefile: ${UNIX_DIR}/Makefile.in ${UNIX_DIR}/configure \
|
||||
${UNIX_DIR}/tclConfig.sh.in Tcl-Info.plist.in
|
||||
mkdir -p "${OBJ_DIR}" && cd "${OBJ_DIR}" && \
|
||||
if [ ${UNIX_DIR}/configure -nt config.status ]; then ${UNIX_DIR}/configure -C \
|
||||
--prefix="${PREFIX}" --bindir="${BINDIR}" --libdir="${LIBDIR}" \
|
||||
--mandir="${MANDIR}" --enable-threads --enable-framework --enable-dtrace \
|
||||
${CONFIGURE_ARGS} ${EXTRA_CONFIGURE_ARGS}; else ./config.status; fi
|
||||
|
||||
build-${PROJECT}: ${objdir}/Makefile
|
||||
${DO_MAKE}
|
||||
ifeq (${INSTALL_BUILD},)
|
||||
# symolic link hackery to trick
|
||||
# 'make install INSTALL_ROOT=${OBJ_DIR}'
|
||||
# into building Tcl.framework and tclsh in ${SYMROOT}
|
||||
@cd "${OBJ_DIR}" && mkdir -p $(dir $(subst ${space},\ ,./${LIBDIR})) $(dir $(subst ${space},\ ,./${BINDIR})) "${SYMROOT}" && \
|
||||
rm -f "./${LIBDIR}" "./${BINDIR}" && ln -fs "${SYMROOT}" "./${LIBDIR}" && \
|
||||
ln -fs "${SYMROOT}" "./${BINDIR}" && ln -fs "${OBJ_DIR}/tcltest" "${SYMROOT}"
|
||||
endif
|
||||
|
||||
install-${PROJECT}: build-${PROJECT}
|
||||
ifeq (${EMBEDDED_BUILD}_${INSTALL_ROOT},1_)
|
||||
@echo "Cannot install-embedded with empty INSTALL_ROOT !" && false
|
||||
endif
|
||||
ifeq (${EMBEDDED_BUILD},1)
|
||||
@rm -rf "${INSTALL_ROOT}/${LIBDIR}/Tcl.framework"
|
||||
endif
|
||||
${DO_MAKE}
|
||||
ifeq (${INSTALL_BUILD},1)
|
||||
ifeq (${EMBEDDED_BUILD},1)
|
||||
# if we are embedding frameworks, don't install tclsh
|
||||
@rm -f "${INSTALL_ROOT}${BINDIR}/${TCLSH}" && \
|
||||
rmdir -p "${INSTALL_ROOT}${BINDIR}" 2>&- || true
|
||||
else
|
||||
# redo prebinding (when not building for Mac OS X 10.4 or later only)
|
||||
@if [ "`echo "$${MACOSX_DEPLOYMENT_TARGET}" | \
|
||||
awk -F '10\\.' '{print int($$2)}'`" -lt 4 -a "`echo "$${CFLAGS}" | \
|
||||
awk -F '-mmacosx-version-min=10\\.' '{print int($$2)}'`" -lt 4 ]; \
|
||||
then cd ${INSTALL_ROOT}/; \
|
||||
if [ ! -d usr/lib ]; then mkdir -p usr && ln -fs /usr/lib usr/ && RM_USRLIB=1; fi; \
|
||||
if [ ! -d System ]; then ln -fs /System . && RM_SYSTEM=1; fi; \
|
||||
redo_prebinding -r . "./${LIBDIR}/${PRODUCT_NAME}.framework/Versions/${VERSION}/${PRODUCT_NAME}"; \
|
||||
redo_prebinding -r . "./${BINDIR}/${TCLSH}"; \
|
||||
if [ -n "$${RM_USRLIB:-}" ]; then rm -f usr/lib; rmdir -p usr 2>&-; fi; \
|
||||
if [ -n "$${RM_SYSTEM:-}" ]; then rm -f System; fi; fi
|
||||
# install tclsh symbolic link
|
||||
@ln -fs ${TCLSH} "${INSTALL_ROOT}${BINDIR}/tclsh"
|
||||
endif
|
||||
endif
|
||||
ifeq (${BUILD_STYLE}_${EMBEDDED_BUILD},Development_)
|
||||
# keep copy of debug library around, so that
|
||||
# Deployment build can be installed on top
|
||||
# of Development build without overwriting
|
||||
# the debug library
|
||||
@cd "${INSTALL_ROOT}${LIBDIR}/${PRODUCT_NAME}.framework/Versions/${VERSION}" && \
|
||||
ln -f "${PRODUCT_NAME}" "${PRODUCT_NAME}_debug"
|
||||
endif
|
||||
|
||||
clean-${PROJECT}: %-${PROJECT}:
|
||||
${DO_MAKE}
|
||||
rm -rf "${SYMROOT}"/{${PRODUCT_NAME}.framework,${TCLSH},tcltest}
|
||||
rm -f "${OBJ_DIR}"{"${LIBDIR}","${BINDIR}"} && \
|
||||
rmdir -p "${OBJ_DIR}"$(dir $(subst ${space},\ ,${LIBDIR})) 2>&- || true && \
|
||||
rmdir -p "${OBJ_DIR}"$(dir $(subst ${space},\ ,${BINDIR})) 2>&- || true
|
||||
|
||||
distclean-${PROJECT}: %-${PROJECT}: clean-${PROJECT}
|
||||
${DO_MAKE}
|
||||
rm -rf "${OBJ_DIR}"
|
||||
|
||||
test-${PROJECT}: %-${PROJECT}: build-${PROJECT}
|
||||
${DO_MAKE}
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: ${meta} ${targets} ${PROJECT} build-${PROJECT} install-${PROJECT} \
|
||||
clean-${PROJECT} distclean-${PROJECT}
|
||||
|
||||
.NOTPARALLEL:
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------
|
||||
174
macosx/README
Normal file
174
macosx/README
Normal file
@@ -0,0 +1,174 @@
|
||||
Tcl Mac OS X README
|
||||
-------------------
|
||||
|
||||
This is the README file for the Mac OS X/Darwin version of Tcl.
|
||||
|
||||
|
||||
1. Where to go for support
|
||||
--------------------------
|
||||
|
||||
- The tcl-mac mailing list on sourceforge is the best place to ask questions
|
||||
specific to Tcl & Tk on Mac OS X:
|
||||
http://lists.sourceforge.net/lists/listinfo/tcl-mac
|
||||
(this page also has a link to searchable archives of the list, please check them
|
||||
before asking on the list, many questions have already been answered).
|
||||
|
||||
- For general Tcl/Tk questions, the newsgroup comp.lang.tcl is your best bet:
|
||||
http://groups.google.com/group/comp.lang.tcl/
|
||||
|
||||
- The Tcl'ers Wiki also has many pages dealing with Tcl & Tk on Mac OS X, see
|
||||
http://wiki.tcl.tk/_/ref?N=3753
|
||||
http://wiki.tcl.tk/_/ref?N=8361
|
||||
|
||||
- Please report bugs with Tcl on Mac OS X to the tracker:
|
||||
http://core.tcl.tk/tcl/reportlist
|
||||
|
||||
2. Using Tcl on Mac OS X
|
||||
------------------------
|
||||
|
||||
- At a minimum, Mac OS X 10.3 is required to run Tcl.
|
||||
|
||||
- Unless weak-linking is used, Tcl built on Mac OS X 10.x will not run on 10.y
|
||||
with y < x; on the other hand Tcl built on 10.y will always run on 10.x with
|
||||
y <= x (but without any of the fixes and optimizations that would be available
|
||||
in a binary built on 10.x).
|
||||
Weak-linking is available on OS X 10.2 or later, it additionally allows Tcl
|
||||
built on 10.x to run on any 10.y with x > y >= z (for a chosen z >= 2).
|
||||
|
||||
- Tcl extensions can be installed in any of:
|
||||
$HOME/Library/Tcl /Library/Tcl /System/Library/Tcl
|
||||
$HOME/Library/Frameworks /Library/Frameworks /System/Library/Frameworks
|
||||
(searched in that order).
|
||||
Given a potential package directory $pkg, Tcl on OSX checks for the file
|
||||
$pkg/Resources/Scripts/pkgIndex.tcl as well as the usual $pkg/pkgIndex.tcl.
|
||||
This allows building extensions as frameworks with all script files contained in
|
||||
the Resources/Scripts directory of the framework.
|
||||
|
||||
- [load]able binary extensions can linked as either ordinary shared libraries
|
||||
(.dylib) or as MachO bundles (since 8.4.10/8.5a3); bundles have the advantage
|
||||
that they are [load]ed more efficiently from a tcl VFS (no temporary copy to the
|
||||
native filesystem required), and prior to Mac OS X 10.5, only bundles can be
|
||||
[unload]ed.
|
||||
|
||||
- The 'deploy' target of macosx/GNUmakefile installs the html manpages into the
|
||||
standard documentation location in the Tcl framework:
|
||||
Tcl.framework/Resources/Documentation/Reference/Tcl
|
||||
No nroff manpages are installed by default by the GNUmakefile.
|
||||
|
||||
- The Tcl framework can be installed in any of the system's standard
|
||||
framework directories:
|
||||
$HOME/Library/Frameworks /Library/Frameworks /System/Library/Frameworks
|
||||
|
||||
|
||||
3. Building Tcl on Mac OS X
|
||||
---------------------------
|
||||
|
||||
- At least Mac OS X 10.3 is required to build Tcl.
|
||||
Apple's Xcode Developer Tools need to be installed (only the most recent version
|
||||
matching your OS release is supported), the Xcode installer is available on Mac
|
||||
OS X install media or may be present in /Applications/Installers on Macs that
|
||||
came with OS X preinstalled. The most recent version can always be downloaded
|
||||
from the ADC website http://connect.apple.com (free ADC membership required).
|
||||
|
||||
- Tcl is most easily built as a Mac OS X framework via GNUmakefile in tcl/macosx
|
||||
(see below for details), but can also be built with the standard unix configure
|
||||
and make buildsystem in tcl/unix as on any other unix platform (indeed, the
|
||||
GNUmakefile is just a wrapper around the unix buildsystem).
|
||||
The Mac OS X specific configure flags are --enable-framework and
|
||||
--disable-corefoundation (which disables CF and notably reverts to the standard
|
||||
select based notifier).
|
||||
|
||||
- It is also possible to build with the Xcode IDE via the projects in
|
||||
tcl/macosx, take care to use the project matching your DevTools and OS version:
|
||||
Tcl.xcode: for Xcode 3.1 on 10.5
|
||||
Tcl.xcodeproj: for Xcode 3.2 on 10.6
|
||||
These have the following targets:
|
||||
Tcl: calls through to tcl/macosx/GNUMakefile.
|
||||
tcltest: static build of tcltest for debugging.
|
||||
tests: build tcltest target and run tcl testsuite.
|
||||
The following build configurations are available:
|
||||
Debug: debug build for the active architecture,
|
||||
with Fix & Continue enabled.
|
||||
Debug clang: use clang compiler.
|
||||
Debug llvm-gcc: use llvm-gcc compiler.
|
||||
Debug gcc40: use gcc 4.0 compiler.
|
||||
DebugNoFixAndContinue: disable Fix & Continue.
|
||||
DebugUnthreaded: disable threading.
|
||||
DebugNoCF: disable corefoundation.
|
||||
DebugNoCFUnthreaded: disable corefoundation an threading.
|
||||
DebugMemCompile: enable memory and bytecode debugging.
|
||||
DebugLeaks: define PURIFY.
|
||||
DebugGCov: enable generation of gcov data files.
|
||||
Debug64bit: configure with --enable-64bit (requires
|
||||
building on a 64bit capable processor).
|
||||
Release: release build for the active architecture.
|
||||
ReleaseUniversal: 32/64-bit universal build.
|
||||
ReleaseUniversal clang: use clang compiler.
|
||||
ReleaseUniversal llvm-gcc: use llvm-gcc compiler.
|
||||
ReleaseUniversal gcc40: use gcc 4.0 compiler.
|
||||
ReleaseUniversal10.5SDK: build against the 10.5 SDK (with 10.5
|
||||
deployment target).
|
||||
Note that the non-SDK configurations have their deployment target set to
|
||||
10.5 (Tcl.xcode) resp. 10.6 (Tcl.xcodeproj).
|
||||
The Xcode projects refer to the toplevel tcl source directory via the
|
||||
TCL_SRCROOT user build setting, by default this is set to the project-relative
|
||||
path '../../tcl', if your tcl source directory is named differently, e.g.
|
||||
'../../tcl8.6', you need to manually change the TCL_SRCROOT setting by editing
|
||||
your ${USER}.pbxuser file (located inside the Tcl.xcodeproj bundle directory)
|
||||
with a text editor.
|
||||
|
||||
- To build universal binaries outside of the Xcode IDE, set CFLAGS as follows:
|
||||
export CFLAGS="-arch i386 -arch x86_64 -arch ppc"
|
||||
This requires Mac OS X 10.4 and Xcode 2.4 (or Xcode 2.2 if -arch x86_64 is
|
||||
omitted, but _not_ Xcode 2.1) and will work on any architecture (on PowerPC
|
||||
Tiger you need to add "-isysroot /Developer/SDKs/MacOSX10.4u.sdk").
|
||||
Note that configure requires CFLAGS to contain a least one architecture that can
|
||||
be run on the build machine (i.e. ppc on G3/G4, ppc or ppc64 on G5, ppc or i386
|
||||
on Core and ppc, i386 or x86_64 on Core2/Xeon).
|
||||
Universal builds of Tcl TEA extensions are also possible with CFLAGS set as
|
||||
above, they will be [load]able by universal as well as thin binaries of Tcl.
|
||||
|
||||
- To enable weak-linking, set the MACOSX_DEPLOYMENT_TARGET environment variable
|
||||
to the minimal OS version the binaries should be able to run on, e.g:
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.4
|
||||
This requires at least gcc 3.1; with gcc 4 or later, set/add to CFLAGS instead:
|
||||
export CFLAGS="-mmacosx-version-min=10.4"
|
||||
Support for weak-linking was added with 8.4.14/8.5a5.
|
||||
|
||||
Detailed Instructions for building with macosx/GNUmakefile
|
||||
----------------------------------------------------------
|
||||
|
||||
- Unpack the Tcl source release archive.
|
||||
|
||||
- The following instructions assume the Tcl source tree is named "tcl${ver}",
|
||||
(where ${ver} is a shell variable containing the Tcl version number e.g. '8.6').
|
||||
Setup this shell variable as follows:
|
||||
ver="8.6"
|
||||
If you are building from CVS, omit this step (CVS source tree names usually do
|
||||
not contain a version number).
|
||||
|
||||
- Setup environment variables as desired, e.g. for a universal build on 10.5:
|
||||
CFLAGS="-arch i386 -arch x86_64 -arch ppc -mmacosx-version-min=10.5"
|
||||
export CFLAGS
|
||||
|
||||
- Change to the directory containing the Tcl source tree and build:
|
||||
make -C tcl${ver}/macosx
|
||||
|
||||
- Install Tcl onto the root volume (admin password required):
|
||||
sudo make -C tcl${ver}/macosx install
|
||||
if you don't have an admin password, you can install into your home directory
|
||||
instead by passing an INSTALL_ROOT argument to make:
|
||||
make -C tcl${ver}/macosx install INSTALL_ROOT="${HOME}/"
|
||||
|
||||
- The default GNUmakefile targets will build _both_ debug and optimized versions
|
||||
of the Tcl framework with the standard convention of naming the debug library
|
||||
Tcl.framework/Tcl_debug.
|
||||
This allows switching to the debug libraries at runtime by setting
|
||||
export DYLD_IMAGE_SUFFIX=_debug
|
||||
(c.f. man dyld for more details)
|
||||
|
||||
If you only want to build and install the debug or optimized build, use the
|
||||
'develop' or 'deploy' target variants of the GNUmakefile, respectively.
|
||||
For example, to build and install only the optimized versions:
|
||||
make -C tcl${ver}/macosx deploy
|
||||
sudo make -C tcl${ver}/macosx install-deploy
|
||||
37
macosx/Tcl-Common.xcconfig
Normal file
37
macosx/Tcl-Common.xcconfig
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// Tcl-Common.xcconfig --
|
||||
//
|
||||
// This file contains the Xcode build settings comon to all
|
||||
// project configurations in Tcl.xcodeproj.
|
||||
//
|
||||
// Copyright (c) 2007-2008 Daniel A. Steffen <das@users.sourceforge.net>
|
||||
//
|
||||
// See the file "license.terms" for information on usage and redistribution
|
||||
// of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
|
||||
HEADER_SEARCH_PATHS = "$(DERIVED_FILE_DIR)/tcl" $(HEADER_SEARCH_PATHS)
|
||||
OTHER_LDFLAGS = -headerpad_max_install_names -sectcreate __TEXT __info_plist "$(DERIVED_FILE_DIR)/tcl/Tclsh-Info.plist" $(OTHER_LDFLAGS)
|
||||
INSTALL_PATH = $(BINDIR)
|
||||
INSTALL_MODE_FLAG = go-w,a+rX
|
||||
GCC_PREFIX_HEADER = $(DERIVED_FILE_DIR)/tcl/tclConfig.h
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
|
||||
GCC_NO_COMMON_BLOCKS = YES
|
||||
GCC_DYNAMIC_NO_PIC = YES
|
||||
GCC_VERSION = 4.2
|
||||
GCC = gcc-$(GCC_VERSION)
|
||||
WARNING_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-value -Winit-self -Wpointer-arith -Wcast-align -Wdisabled-optimization -Winline $(WARNING_CFLAGS)
|
||||
BINDIR = $(PREFIX)/bin
|
||||
CFLAGS = $(CFLAGS)
|
||||
CPPFLAGS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET) $(CPPFLAGS)
|
||||
FRAMEWORK_INSTALL_PATH = /Library/Frameworks
|
||||
INCLUDEDIR = $(PREFIX)/include
|
||||
LIBDIR = $(PREFIX)/lib
|
||||
MANDIR = $(PREFIX)/man
|
||||
PER_ARCH_CFLAGS_ppc = -mcpu=G3 -mtune=G4 $(PER_ARCH_CFLAGS_ppc)
|
||||
PER_ARCH_CFLAGS_ppc64 = -mcpu=G5 -mpowerpc64 $(PER_ARCH_CFLAGS_ppc64)
|
||||
PREFIX = /usr/local
|
||||
TCL_CONFIGURE_ARGS = --enable-threads --enable-dtrace
|
||||
TCL_LIBRARY = $(LIBDIR)/tcl$(VERSION)
|
||||
TCL_PACKAGE_PATH = "$(LIBDIR)"
|
||||
TCL_DEFS = HAVE_TCL_CONFIG_H
|
||||
VERSION = 8.6
|
||||
20
macosx/Tcl-Debug.xcconfig
Normal file
20
macosx/Tcl-Debug.xcconfig
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Tcl-Debug.xcconfig --
|
||||
//
|
||||
// This file contains the Xcode build settings for all Debug
|
||||
// project configurations in Tcl.xcodeproj.
|
||||
//
|
||||
// Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
|
||||
//
|
||||
// See the file "license.terms" for information on usage and redistribution
|
||||
// of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
|
||||
#include "Tcl-Common.xcconfig"
|
||||
|
||||
DEBUG_INFORMATION_FORMAT = dwarf
|
||||
DEAD_CODE_STRIPPING = NO
|
||||
DEPLOYMENT_POSTPROCESSING = NO
|
||||
GCC_OPTIMIZATION_LEVEL = 0
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(TCL_DEFS) $(GCC_PREPROCESSOR_DEFINITIONS)
|
||||
CONFIGURE_ARGS = --enable-symbols $(TCL_CONFIGURE_ARGS) $(CONFIGURE_ARGS)
|
||||
MAKE_TARGET = develop
|
||||
36
macosx/Tcl-Info.plist.in
Normal file
36
macosx/Tcl-Info.plist.in
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<!--
|
||||
Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
|
||||
|
||||
See the file "license.terms" for information on usage and redistribution of
|
||||
this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
-->
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>@TCL_LIB_FILE@</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Tcl @TCL_VERSION@@TCL_PATCH_LEVEL@,
|
||||
Copyright © 1987-@TCL_YEAR@ Tcl Core Team,
|
||||
Copyright © 2001-@TCL_YEAR@ Daniel A. Steffen,
|
||||
Copyright © 2001-2009 Apple Inc.,
|
||||
Copyright © 2001-2002 Jim Ingham & Ian Reid</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.tcltk.tcllibrary</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Tcl @TCL_VERSION@</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@TCL_VERSION@@TCL_PATCH_LEVEL@</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>Tcl </string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@TCL_VERSION@@TCL_PATCH_LEVEL@</string>
|
||||
</dict>
|
||||
</plist>
|
||||
20
macosx/Tcl-Release.xcconfig
Normal file
20
macosx/Tcl-Release.xcconfig
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Tcl-Release.xcconfig --
|
||||
//
|
||||
// This file contains the Xcode build settings for all Release
|
||||
// project configurations in Tcl.xcodeproj.
|
||||
//
|
||||
// Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
|
||||
//
|
||||
// See the file "license.terms" for information on usage and redistribution
|
||||
// of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
|
||||
#include "Tcl-Common.xcconfig"
|
||||
|
||||
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
|
||||
DEAD_CODE_STRIPPING = YES
|
||||
DEPLOYMENT_POSTPROCESSING = YES
|
||||
GCC_OPTIMIZATION_LEVEL = s
|
||||
GCC_PREPROCESSOR_DEFINITIONS = NDEBUG $(TCL_DEFS) $(GCC_PREPROCESSOR_DEFINITIONS)
|
||||
CONFIGURE_ARGS = --disable-symbols $(TCL_CONFIGURE_ARGS) $(CONFIGURE_ARGS)
|
||||
MAKE_TARGET = deploy
|
||||
200
macosx/Tcl.xcode/default.pbxuser
Normal file
200
macosx/Tcl.xcode/default.pbxuser
Normal file
@@ -0,0 +1,200 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
08FB7793FE84155DC02AAC07 /* Project object */ = {
|
||||
activeBuildConfigurationName = Debug;
|
||||
activeExecutable = F9E61D1C090A4282002B3151 /* tclsh */;
|
||||
activeTarget = F9E61D16090A3E94002B3151 /* Tcl */;
|
||||
codeSenseManager = F944EB9D08F798180049FDD4 /* Code sense */;
|
||||
executables = (
|
||||
F9E61D1C090A4282002B3151 /* tclsh */,
|
||||
F944EB8F08F798100049FDD4 /* tcltest */,
|
||||
);
|
||||
perUserDictionary = {
|
||||
com.apple.ide.smrt.PBXUserSmartGroupsKey.Rev10 = <040b73747265616d747970656481e8038401408484840e4e534d757461626c654172726179008484074e534172726179008484084e534f626a65637400858401690192848484134e534d757461626c6544696374696f6e6172790084840c4e5344696374696f6e6172790095960792848484084e53537472696e67019584012b046e616d658692849a9a14496d706c656d656e746174696f6e2046696c65738692849a9a146162736f6c75746550617468546f42756e646c658692849a9a008692849a9a195042585472616e7369656e744c6f636174696f6e4174546f708692849a9a06626f74746f6d8692849a9a03636c7a8692849a9a1550425846696c656e616d65536d61727447726f75708692849a9a0b6465736372697074696f6e8692849a9a103c6e6f206465736372697074696f6e3e8692849a9a0b707265666572656e63657386928497960892849a9a07666e6d617463688692849a9a008692849a9a05696d6167658692849a9a0b536d617274466f6c6465728692849a9a04726f6f748692849a9a093c50524f4a4543543e8692849a9a0572656765788692849a9a065c2e286329248692849a9a097265637572736976658692848484084e534e756d626572008484074e5356616c7565009584012a849696018692849a9a0669734c656166869284b09db296008692849a9a0763616e536176658692af92849a9a1250425850726f6a65637453636f70654b65798692849a9a03594553868692849a9a08676c6f62616c49448692849a9a18314343304541343030343335304546393030343434313042868686>;
|
||||
};
|
||||
sourceControlManager = F944EB9C08F798180049FDD4 /* Source Control */;
|
||||
userBuildSettings = {
|
||||
SYMROOT = "${SRCROOT}/../../build/tcl";
|
||||
TCL_SRCROOT = "${SRCROOT}/../../tcl";
|
||||
};
|
||||
};
|
||||
8DD76FA90486AB0100D96B5E /* tcltest */ = {
|
||||
activeExec = 0;
|
||||
executables = (
|
||||
F944EB8F08F798100049FDD4 /* tcltest */,
|
||||
);
|
||||
};
|
||||
F944EB8F08F798100049FDD4 /* tcltest */ = {
|
||||
isa = PBXExecutable;
|
||||
activeArgIndices = (
|
||||
NO,
|
||||
NO,
|
||||
NO,
|
||||
);
|
||||
argumentStrings = (
|
||||
"${TCL_SRCROOT}/tests/all.tcl",
|
||||
"-singleproc 1",
|
||||
"-verbose \"bet\"",
|
||||
);
|
||||
autoAttachOnCrash = 1;
|
||||
breakpointsEnabled = 1;
|
||||
configStateDict = {
|
||||
"PBXLSLaunchAction-0" = {
|
||||
PBXLSLaunchAction = 0;
|
||||
PBXLSLaunchStartAction = 1;
|
||||
PBXLSLaunchStdioStyle = 2;
|
||||
PBXLSLaunchStyle = 0;
|
||||
class = PBXLSRunLaunchConfig;
|
||||
displayName = "Executable Runner";
|
||||
identifier = com.apple.Xcode.launch.runConfig;
|
||||
remoteHostInfo = "";
|
||||
startActionInfo = "";
|
||||
};
|
||||
"PBXLSLaunchAction-1" = {
|
||||
PBXLSLaunchAction = 1;
|
||||
PBXLSLaunchStartAction = 1;
|
||||
PBXLSLaunchStdioStyle = 2;
|
||||
PBXLSLaunchStyle = 0;
|
||||
class = PBXGDB_LaunchConfig;
|
||||
displayName = GDB;
|
||||
identifier = com.apple.Xcode.launch.GDBMI_Config;
|
||||
remoteHostInfo = "";
|
||||
startActionInfo = "";
|
||||
};
|
||||
};
|
||||
customDataFormattersEnabled = 1;
|
||||
debuggerPlugin = GDBDebugging;
|
||||
disassemblyDisplayState = 0;
|
||||
dylibVariantSuffix = "";
|
||||
enableDebugStr = 0;
|
||||
environmentEntries = (
|
||||
{
|
||||
active = YES;
|
||||
name = TCL_LIBRARY;
|
||||
value = "${TCL_SRCROOT}/library";
|
||||
},
|
||||
{
|
||||
active = YES;
|
||||
name = TCLLIBPATH;
|
||||
value = /Library/Tcl;
|
||||
},
|
||||
{
|
||||
active = NO;
|
||||
name = DYLD_PRINT_LIBRARIES;
|
||||
},
|
||||
{
|
||||
active = NO;
|
||||
name = MallocBadFreeAbort;
|
||||
value = 1;
|
||||
},
|
||||
{
|
||||
active = NO;
|
||||
name = MallocLogFile;
|
||||
value = /tmp/malloc.log;
|
||||
},
|
||||
{
|
||||
active = NO;
|
||||
name = MallocStackLogging;
|
||||
value = 1;
|
||||
},
|
||||
{
|
||||
active = NO;
|
||||
name = MallocStackLoggingNoCompact;
|
||||
value = 1;
|
||||
},
|
||||
{
|
||||
active = NO;
|
||||
name = MallocPreScribble;
|
||||
value = 1;
|
||||
},
|
||||
{
|
||||
active = NO;
|
||||
name = MallocScribble;
|
||||
value = 1;
|
||||
},
|
||||
);
|
||||
executableSystemSymbolLevel = 0;
|
||||
executableUserSymbolLevel = 0;
|
||||
libgmallocEnabled = 0;
|
||||
name = tcltest;
|
||||
sourceDirectories = (
|
||||
);
|
||||
};
|
||||
F944EB9C08F798180049FDD4 /* Source Control */ = {
|
||||
isa = PBXSourceControlManager;
|
||||
fallbackIsa = XCSourceControlManager;
|
||||
isSCMEnabled = 0;
|
||||
scmConfiguration = {
|
||||
CVSToolPath = /usr/bin/cvs;
|
||||
CVSUseSSH = NO;
|
||||
SubversionToolPath = /usr/bin/svn;
|
||||
repositoryNamesForRoots = {
|
||||
.. = "";
|
||||
};
|
||||
};
|
||||
scmType = scm.cvs;
|
||||
};
|
||||
F944EB9D08F798180049FDD4 /* Code sense */ = {
|
||||
isa = PBXCodeSenseManager;
|
||||
indexTemplatePath = "";
|
||||
};
|
||||
F97258A50A86873C00096C78 /* tests */ = {
|
||||
activeExec = 0;
|
||||
};
|
||||
F9E61D16090A3E94002B3151 /* Tcl */ = {
|
||||
activeExec = 0;
|
||||
executables = (
|
||||
F9E61D1C090A4282002B3151 /* tclsh */,
|
||||
);
|
||||
};
|
||||
F9E61D1C090A4282002B3151 /* tclsh */ = {
|
||||
isa = PBXExecutable;
|
||||
activeArgIndices = (
|
||||
);
|
||||
argumentStrings = (
|
||||
);
|
||||
autoAttachOnCrash = 1;
|
||||
breakpointsEnabled = 1;
|
||||
configStateDict = {
|
||||
"PBXLSLaunchAction-0" = {
|
||||
PBXLSLaunchAction = 0;
|
||||
PBXLSLaunchStartAction = 1;
|
||||
PBXLSLaunchStdioStyle = 2;
|
||||
PBXLSLaunchStyle = 0;
|
||||
class = PBXLSRunLaunchConfig;
|
||||
displayName = "Executable Runner";
|
||||
identifier = com.apple.Xcode.launch.runConfig;
|
||||
remoteHostInfo = "";
|
||||
startActionInfo = "";
|
||||
};
|
||||
"PBXLSLaunchAction-1" = {
|
||||
PBXLSLaunchAction = 1;
|
||||
PBXLSLaunchStartAction = 1;
|
||||
PBXLSLaunchStdioStyle = 2;
|
||||
PBXLSLaunchStyle = 0;
|
||||
class = PBXGDB_LaunchConfig;
|
||||
displayName = GDB;
|
||||
identifier = com.apple.Xcode.launch.GDBMI_Config;
|
||||
remoteHostInfo = "";
|
||||
startActionInfo = "";
|
||||
};
|
||||
};
|
||||
customDataFormattersEnabled = 1;
|
||||
debuggerPlugin = GDBDebugging;
|
||||
disassemblyDisplayState = 0;
|
||||
dylibVariantSuffix = _debug;
|
||||
enableDebugStr = 0;
|
||||
environmentEntries = (
|
||||
{
|
||||
active = NO;
|
||||
name = DYLD_PRINT_LIBRARIES;
|
||||
},
|
||||
);
|
||||
executableSystemSymbolLevel = 0;
|
||||
executableUserSymbolLevel = 0;
|
||||
libgmallocEnabled = 0;
|
||||
name = tclsh;
|
||||
sourceDirectories = (
|
||||
);
|
||||
};
|
||||
}
|
||||
2934
macosx/Tcl.xcode/project.pbxproj
Normal file
2934
macosx/Tcl.xcode/project.pbxproj
Normal file
File diff suppressed because it is too large
Load Diff
211
macosx/Tcl.xcodeproj/default.pbxuser
Normal file
211
macosx/Tcl.xcodeproj/default.pbxuser
Normal file
@@ -0,0 +1,211 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
08FB7793FE84155DC02AAC07 /* Project object */ = {
|
||||
activeBuildConfigurationName = Debug;
|
||||
activeExecutable = F9E61D1C090A4282002B3151 /* tclsh */;
|
||||
activeTarget = F9E61D16090A3E94002B3151 /* Tcl */;
|
||||
codeSenseManager = F944EB9D08F798180049FDD4 /* Code sense */;
|
||||
executables = (
|
||||
F9E61D1C090A4282002B3151 /* tclsh */,
|
||||
F944EB8F08F798100049FDD4 /* tcltest */,
|
||||
);
|
||||
perUserDictionary = {
|
||||
com.apple.ide.smrt.PBXUserSmartGroupsKey.Rev10 = <040b73747265616d747970656481e8038401408484840e4e534d757461626c654172726179008484074e534172726179008484084e534f626a65637400858401690192848484134e534d757461626c6544696374696f6e6172790084840c4e5344696374696f6e6172790095960792848484084e53537472696e67019584012b046e616d658692849a9a14496d706c656d656e746174696f6e2046696c65738692849a9a195042585472616e7369656e744c6f636174696f6e4174546f708692849a9a06626f74746f6d8692849a9a0b707265666572656e63657386928497960892849a9a0669734c6561668692848484084e534e756d626572008484074e5356616c7565009584012a849696008692849a9a04726f6f748692849a9a093c50524f4a4543543e8692849a9a09726563757273697665869284a29da496018692849a9a05696d6167658692849a9a0b536d617274466f6c6465728692849a9a0763616e536176658692a892849a9a1250425850726f6a65637453636f70654b65798692849a9a035945538692849a9a0572656765788692849a9a065c2e286329248692849a9a07666e6d617463688692849a9a00868692849a9a146162736f6c75746550617468546f42756e646c658692849a9a008692849a9a0b6465736372697074696f6e8692849a9a103c6e6f206465736372697074696f6e3e8692849a9a08676c6f62616c49448692849a9a183143433045413430303433353045463930303434343130428692849a9a03636c7a8692849a9a1550425846696c656e616d65536d61727447726f7570868686>;
|
||||
};
|
||||
sourceControlManager = F944EB9C08F798180049FDD4 /* Source Control */;
|
||||
userBuildSettings = {
|
||||
SYMROOT = "${SRCROOT}/../../build/tcl";
|
||||
TCL_SRCROOT = "${SRCROOT}/../../tcl";
|
||||
};
|
||||
};
|
||||
8DD76FA90486AB0100D96B5E /* tcltest */ = {
|
||||
activeExec = 0;
|
||||
executables = (
|
||||
F944EB8F08F798100049FDD4 /* tcltest */,
|
||||
);
|
||||
};
|
||||
F944EB8F08F798100049FDD4 /* tcltest */ = {
|
||||
isa = PBXExecutable;
|
||||
activeArgIndices = (
|
||||
NO,
|
||||
NO,
|
||||
NO,
|
||||
);
|
||||
argumentStrings = (
|
||||
"${TCL_SRCROOT}/tests/all.tcl",
|
||||
"-singleproc 1",
|
||||
"-verbose \"bet\"",
|
||||
);
|
||||
autoAttachOnCrash = 1;
|
||||
breakpointsEnabled = 1;
|
||||
configStateDict = {
|
||||
"PBXLSLaunchAction-0" = {
|
||||
PBXLSLaunchAction = 0;
|
||||
PBXLSLaunchStartAction = 1;
|
||||
PBXLSLaunchStdioStyle = 2;
|
||||
PBXLSLaunchStyle = 0;
|
||||
class = PBXLSRunLaunchConfig;
|
||||
displayName = "Executable Runner";
|
||||
identifier = com.apple.Xcode.launch.runConfig;
|
||||
remoteHostInfo = "";
|
||||
startActionInfo = "";
|
||||
};
|
||||
"PBXLSLaunchAction-1" = {
|
||||
PBXLSLaunchAction = 1;
|
||||
PBXLSLaunchStartAction = 1;
|
||||
PBXLSLaunchStdioStyle = 2;
|
||||
PBXLSLaunchStyle = 0;
|
||||
class = PBXGDB_LaunchConfig;
|
||||
displayName = GDB;
|
||||
identifier = com.apple.Xcode.launch.GDBMI_Config;
|
||||
remoteHostInfo = "";
|
||||
startActionInfo = "";
|
||||
};
|
||||
};
|
||||
customDataFormattersEnabled = 1;
|
||||
dataTipCustomDataFormattersEnabled = 1;
|
||||
dataTipShowTypeColumn = 1;
|
||||
dataTipSortType = 0;
|
||||
debuggerPlugin = GDBDebugging;
|
||||
disassemblyDisplayState = 0;
|
||||
dylibVariantSuffix = "";
|
||||
enableDebugStr = 0;
|
||||
environmentEntries = (
|
||||
{
|
||||
active = YES;
|
||||
name = TCL_LIBRARY;
|
||||
value = "${TCL_SRCROOT}/library";
|
||||
},
|
||||
{
|
||||
active = YES;
|
||||
name = TCLLIBPATH;
|
||||
value = /Library/Tcl;
|
||||
},
|
||||
{
|
||||
active = NO;
|
||||
name = DYLD_PRINT_LIBRARIES;
|
||||
},
|
||||
{
|
||||
active = NO;
|
||||
name = MallocBadFreeAbort;
|
||||
value = 1;
|
||||
},
|
||||
{
|
||||
active = NO;
|
||||
name = MallocLogFile;
|
||||
value = /tmp/malloc.log;
|
||||
},
|
||||
{
|
||||
active = NO;
|
||||
name = MallocStackLogging;
|
||||
value = 1;
|
||||
},
|
||||
{
|
||||
active = NO;
|
||||
name = MallocStackLoggingNoCompact;
|
||||
value = 1;
|
||||
},
|
||||
{
|
||||
active = NO;
|
||||
name = MallocPreScribble;
|
||||
value = 1;
|
||||
},
|
||||
{
|
||||
active = NO;
|
||||
name = MallocScribble;
|
||||
value = 1;
|
||||
},
|
||||
);
|
||||
executableSystemSymbolLevel = 0;
|
||||
executableUserSymbolLevel = 0;
|
||||
libgmallocEnabled = 0;
|
||||
name = tcltest;
|
||||
showTypeColumn = 0;
|
||||
sourceDirectories = (
|
||||
);
|
||||
};
|
||||
F944EB9C08F798180049FDD4 /* Source Control */ = {
|
||||
isa = PBXSourceControlManager;
|
||||
fallbackIsa = XCSourceControlManager;
|
||||
isSCMEnabled = 0;
|
||||
repositoryNamesForRoots = {
|
||||
.. = "";
|
||||
};
|
||||
scmConfiguration = {
|
||||
CVSToolPath = /usr/bin/cvs;
|
||||
CVSUseSSH = NO;
|
||||
SubversionToolPath = /usr/bin/svn;
|
||||
repositoryNamesForRoots = {
|
||||
.. = "";
|
||||
};
|
||||
};
|
||||
scmType = scm.cvs;
|
||||
};
|
||||
F944EB9D08F798180049FDD4 /* Code sense */ = {
|
||||
isa = PBXCodeSenseManager;
|
||||
indexTemplatePath = "";
|
||||
};
|
||||
F97258A50A86873C00096C78 /* tests */ = {
|
||||
activeExec = 0;
|
||||
};
|
||||
F9E61D16090A3E94002B3151 /* Tcl */ = {
|
||||
activeExec = 0;
|
||||
executables = (
|
||||
F9E61D1C090A4282002B3151 /* tclsh */,
|
||||
);
|
||||
};
|
||||
F9E61D1C090A4282002B3151 /* tclsh */ = {
|
||||
isa = PBXExecutable;
|
||||
activeArgIndices = (
|
||||
);
|
||||
argumentStrings = (
|
||||
);
|
||||
autoAttachOnCrash = 1;
|
||||
breakpointsEnabled = 1;
|
||||
configStateDict = {
|
||||
"PBXLSLaunchAction-0" = {
|
||||
PBXLSLaunchAction = 0;
|
||||
PBXLSLaunchStartAction = 1;
|
||||
PBXLSLaunchStdioStyle = 2;
|
||||
PBXLSLaunchStyle = 0;
|
||||
class = PBXLSRunLaunchConfig;
|
||||
displayName = "Executable Runner";
|
||||
identifier = com.apple.Xcode.launch.runConfig;
|
||||
remoteHostInfo = "";
|
||||
startActionInfo = "";
|
||||
};
|
||||
"PBXLSLaunchAction-1" = {
|
||||
PBXLSLaunchAction = 1;
|
||||
PBXLSLaunchStartAction = 1;
|
||||
PBXLSLaunchStdioStyle = 2;
|
||||
PBXLSLaunchStyle = 0;
|
||||
class = PBXGDB_LaunchConfig;
|
||||
displayName = GDB;
|
||||
identifier = com.apple.Xcode.launch.GDBMI_Config;
|
||||
remoteHostInfo = "";
|
||||
startActionInfo = "";
|
||||
};
|
||||
};
|
||||
customDataFormattersEnabled = 1;
|
||||
dataTipCustomDataFormattersEnabled = 1;
|
||||
dataTipShowTypeColumn = 1;
|
||||
dataTipSortType = 0;
|
||||
debuggerPlugin = GDBDebugging;
|
||||
disassemblyDisplayState = 0;
|
||||
dylibVariantSuffix = _debug;
|
||||
enableDebugStr = 0;
|
||||
environmentEntries = (
|
||||
{
|
||||
active = NO;
|
||||
name = DYLD_PRINT_LIBRARIES;
|
||||
},
|
||||
);
|
||||
executableSystemSymbolLevel = 0;
|
||||
executableUserSymbolLevel = 0;
|
||||
libgmallocEnabled = 0;
|
||||
name = tclsh;
|
||||
showTypeColumn = 0;
|
||||
sourceDirectories = (
|
||||
);
|
||||
};
|
||||
}
|
||||
3039
macosx/Tcl.xcodeproj/project.pbxproj
Normal file
3039
macosx/Tcl.xcodeproj/project.pbxproj
Normal file
File diff suppressed because it is too large
Load Diff
36
macosx/Tclsh-Info.plist.in
Normal file
36
macosx/Tclsh-Info.plist.in
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<!--
|
||||
Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
|
||||
|
||||
See the file "license.terms" for information on usage and redistribution of
|
||||
this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
-->
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>tclsh@TCL_VERSION@</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Tcl Shell @TCL_VERSION@@TCL_PATCH_LEVEL@,
|
||||
Copyright © 1987-@TCL_YEAR@ Tcl Core Team,
|
||||
Copyright © 2001-@TCL_YEAR@ Daniel A. Steffen,
|
||||
Copyright © 2001-2009 Apple Inc.,
|
||||
Copyright © 2001-2002 Jim Ingham & Ian Reid</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.tcltk.tclsh</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>tclsh</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@TCL_VERSION@@TCL_PATCH_LEVEL@</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>TclS</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@TCL_VERSION@@TCL_PATCH_LEVEL@</string>
|
||||
</dict>
|
||||
</plist>
|
||||
11790
macosx/configure
vendored
Normal file
11790
macosx/configure
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11
macosx/configure.ac
Normal file
11
macosx/configure.ac
Normal file
@@ -0,0 +1,11 @@
|
||||
#! /bin/bash -norc
|
||||
dnl This file is an input file used by the GNU "autoconf" program to
|
||||
dnl generate the file "configure", which is run during Tcl installation
|
||||
dnl to configure the system for the local environment.
|
||||
|
||||
dnl Ensure that the config (auto)headers support is used, then just
|
||||
dnl include the configure sources from ../unix:
|
||||
|
||||
m4_include(../unix/aclocal.m4)
|
||||
m4_define(SC_USE_CONFIG_HEADERS)
|
||||
m4_include(../unix/configure.in)
|
||||
40
macosx/license.terms
Normal file
40
macosx/license.terms
Normal file
@@ -0,0 +1,40 @@
|
||||
This software is copyrighted by the Regents of the University of
|
||||
California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState
|
||||
Corporation and other parties. The following terms apply to all files
|
||||
associated with the software unless explicitly disclaimed in
|
||||
individual files.
|
||||
|
||||
The authors hereby grant permission to use, copy, modify, distribute,
|
||||
and license this software and its documentation for any purpose, provided
|
||||
that existing copyright notices are retained in all copies and that this
|
||||
notice is included verbatim in any distributions. No written agreement,
|
||||
license, or royalty fee is required for any of the authorized uses.
|
||||
Modifications to this software may be copyrighted by their authors
|
||||
and need not follow the licensing terms described here, provided that
|
||||
the new terms are clearly indicated on the first page of each file where
|
||||
they apply.
|
||||
|
||||
IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
|
||||
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
|
||||
DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
|
||||
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
|
||||
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
|
||||
MODIFICATIONS.
|
||||
|
||||
GOVERNMENT USE: If you are acquiring this software on behalf of the
|
||||
U.S. government, the Government shall have only "Restricted Rights"
|
||||
in the software and related documentation as defined in the Federal
|
||||
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
|
||||
are acquiring the software on behalf of the Department of Defense, the
|
||||
software shall be classified as "Commercial Computer Software" and the
|
||||
Government shall have only "Restricted Rights" as defined in Clause
|
||||
252.227-7014 (b) (3) of DFARs. Notwithstanding the foregoing, the
|
||||
authors grant the U.S. Government and others acting in its behalf
|
||||
permission to use and distribute the software in accordance with the
|
||||
terms specified in this license.
|
||||
312
macosx/tclMacOSXBundle.c
Normal file
312
macosx/tclMacOSXBundle.c
Normal file
@@ -0,0 +1,312 @@
|
||||
/*
|
||||
* tclMacOSXBundle.c --
|
||||
*
|
||||
* This file implements functions that inspect CFBundle structures on
|
||||
* MacOS X.
|
||||
*
|
||||
* Copyright 2001-2009, Apple Inc.
|
||||
* Copyright (c) 2003-2009 Daniel A. Steffen <das@users.sourceforge.net>
|
||||
*
|
||||
* See the file "license.terms" for information on usage and redistribution of
|
||||
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*/
|
||||
|
||||
#include "tclPort.h"
|
||||
|
||||
#ifdef HAVE_COREFOUNDATION
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
#ifndef TCL_DYLD_USE_DLFCN
|
||||
/*
|
||||
* Use preferred dlfcn API on 10.4 and later
|
||||
*/
|
||||
# if !defined(NO_DLFCN_H) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
|
||||
# define TCL_DYLD_USE_DLFCN 1
|
||||
# else
|
||||
# define TCL_DYLD_USE_DLFCN 0
|
||||
# endif
|
||||
#endif /* TCL_DYLD_USE_DLFCN */
|
||||
|
||||
#ifndef TCL_DYLD_USE_NSMODULE
|
||||
/*
|
||||
* Use deprecated NSModule API only to support 10.3 and earlier:
|
||||
*/
|
||||
# if MAC_OS_X_VERSION_MIN_REQUIRED < 1040
|
||||
# define TCL_DYLD_USE_NSMODULE 1
|
||||
# else
|
||||
# define TCL_DYLD_USE_NSMODULE 0
|
||||
# endif
|
||||
#endif /* TCL_DYLD_USE_NSMODULE */
|
||||
|
||||
#if TCL_DYLD_USE_DLFCN
|
||||
#include <dlfcn.h>
|
||||
#if defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1040
|
||||
/*
|
||||
* Support for weakly importing dlfcn API.
|
||||
*/
|
||||
extern void * dlsym(void *handle, const char *symbol)
|
||||
WEAK_IMPORT_ATTRIBUTE;
|
||||
extern char * dlerror(void) WEAK_IMPORT_ATTRIBUTE;
|
||||
#endif
|
||||
#endif /* TCL_DYLD_USE_DLFCN */
|
||||
|
||||
#if TCL_DYLD_USE_NSMODULE
|
||||
#include <mach-o/dyld.h>
|
||||
#endif
|
||||
|
||||
#if (TCL_DYLD_USE_DLFCN && MAC_OS_X_VERSION_MIN_REQUIRED < 1040) || \
|
||||
(MAC_OS_X_VERSION_MIN_REQUIRED < 1050)
|
||||
MODULE_SCOPE long tclMacOSXDarwinRelease;
|
||||
#endif
|
||||
|
||||
#ifdef TCL_DEBUG_LOAD
|
||||
#define TclLoadDbgMsg(m, ...) \
|
||||
do { \
|
||||
fprintf(stderr, "%s:%d: %s(): " m ".\n", \
|
||||
strrchr(__FILE__, '/')+1, __LINE__, __func__, \
|
||||
##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#else
|
||||
#define TclLoadDbgMsg(m, ...)
|
||||
#endif /* TCL_DEBUG_LOAD */
|
||||
|
||||
/*
|
||||
* Forward declaration of functions defined in this file:
|
||||
*/
|
||||
|
||||
static short OpenResourceMap(CFBundleRef bundleRef);
|
||||
|
||||
#endif /* HAVE_COREFOUNDATION */
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* OpenResourceMap --
|
||||
*
|
||||
* Wrapper that dynamically acquires the address for the function
|
||||
* CFBundleOpenBundleResourceMap before calling it, since it is only
|
||||
* present in full CoreFoundation on Mac OS X and not in CFLite on pure
|
||||
* Darwin. Factored out because it is moderately ugly code.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef HAVE_COREFOUNDATION
|
||||
|
||||
static short
|
||||
OpenResourceMap(
|
||||
CFBundleRef bundleRef)
|
||||
{
|
||||
static int initialized = FALSE;
|
||||
static short (*openresourcemap)(CFBundleRef) = NULL;
|
||||
|
||||
if (!initialized) {
|
||||
#if TCL_DYLD_USE_DLFCN
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1040
|
||||
if (tclMacOSXDarwinRelease >= 8)
|
||||
#endif
|
||||
{
|
||||
openresourcemap = dlsym(RTLD_NEXT,
|
||||
"CFBundleOpenBundleResourceMap");
|
||||
#ifdef TCL_DEBUG_LOAD
|
||||
if (!openresourcemap) {
|
||||
const char *errMsg = dlerror();
|
||||
|
||||
TclLoadDbgMsg("dlsym() failed: %s", errMsg);
|
||||
}
|
||||
#endif /* TCL_DEBUG_LOAD */
|
||||
}
|
||||
if (!openresourcemap)
|
||||
#endif /* TCL_DYLD_USE_DLFCN */
|
||||
{
|
||||
#if TCL_DYLD_USE_NSMODULE
|
||||
if (NSIsSymbolNameDefinedWithHint(
|
||||
"_CFBundleOpenBundleResourceMap", "CoreFoundation")) {
|
||||
NSSymbol nsSymbol = NSLookupAndBindSymbolWithHint(
|
||||
"_CFBundleOpenBundleResourceMap", "CoreFoundation");
|
||||
|
||||
if (nsSymbol) {
|
||||
openresourcemap = NSAddressOfSymbol(nsSymbol);
|
||||
}
|
||||
}
|
||||
#endif /* TCL_DYLD_USE_NSMODULE */
|
||||
}
|
||||
initialized = TRUE;
|
||||
}
|
||||
|
||||
if (openresourcemap) {
|
||||
return openresourcemap(bundleRef);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* HAVE_COREFOUNDATION */
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_MacOSXOpenBundleResources --
|
||||
*
|
||||
* Given the bundle name for a shared library, this routine sets
|
||||
* libraryPath to the Resources/Scripts directory in the framework
|
||||
* package. If hasResourceFile is true, it will also open the main
|
||||
* resource file for the bundle.
|
||||
*
|
||||
* Results:
|
||||
* TCL_OK if the bundle could be opened, and the Scripts folder found.
|
||||
* TCL_ERROR otherwise.
|
||||
*
|
||||
* Side effects:
|
||||
* libraryVariableName may be set, and the resource file opened.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
Tcl_MacOSXOpenBundleResources(
|
||||
Tcl_Interp *interp,
|
||||
const char *bundleName,
|
||||
int hasResourceFile,
|
||||
int maxPathLen,
|
||||
char *libraryPath)
|
||||
{
|
||||
return Tcl_MacOSXOpenVersionedBundleResources(interp, bundleName, NULL,
|
||||
hasResourceFile, maxPathLen, libraryPath);
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_MacOSXOpenVersionedBundleResources --
|
||||
*
|
||||
* Given the bundle and version name for a shared library (version name
|
||||
* can be NULL to indicate latest version), this routine sets libraryPath
|
||||
* to the Resources/Scripts directory in the framework package. If
|
||||
* hasResourceFile is true, it will also open the main resource file for
|
||||
* the bundle.
|
||||
*
|
||||
* Results:
|
||||
* TCL_OK if the bundle could be opened, and the Scripts folder found.
|
||||
* TCL_ERROR otherwise.
|
||||
*
|
||||
* Side effects:
|
||||
* libraryVariableName may be set, and the resource file opened.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
Tcl_MacOSXOpenVersionedBundleResources(
|
||||
Tcl_Interp *interp,
|
||||
const char *bundleName,
|
||||
const char *bundleVersion,
|
||||
int hasResourceFile,
|
||||
int maxPathLen,
|
||||
char *libraryPath)
|
||||
{
|
||||
#ifdef HAVE_COREFOUNDATION
|
||||
CFBundleRef bundleRef, versionedBundleRef = NULL;
|
||||
CFStringRef bundleNameRef;
|
||||
CFURLRef libURL;
|
||||
|
||||
libraryPath[0] = '\0';
|
||||
|
||||
bundleNameRef = CFStringCreateWithCString(NULL, bundleName,
|
||||
kCFStringEncodingUTF8);
|
||||
|
||||
bundleRef = CFBundleGetBundleWithIdentifier(bundleNameRef);
|
||||
CFRelease(bundleNameRef);
|
||||
|
||||
if (bundleVersion && bundleRef) {
|
||||
/*
|
||||
* Create bundle from bundleVersion subdirectory of 'Versions'.
|
||||
*/
|
||||
|
||||
CFURLRef bundleURL = CFBundleCopyBundleURL(bundleRef);
|
||||
|
||||
if (bundleURL) {
|
||||
CFStringRef bundleVersionRef = CFStringCreateWithCString(NULL,
|
||||
bundleVersion, kCFStringEncodingUTF8);
|
||||
|
||||
if (bundleVersionRef) {
|
||||
CFComparisonResult versionComparison = kCFCompareLessThan;
|
||||
CFStringRef bundleTailRef = CFURLCopyLastPathComponent(
|
||||
bundleURL);
|
||||
|
||||
if (bundleTailRef) {
|
||||
versionComparison = CFStringCompare(bundleTailRef,
|
||||
bundleVersionRef, 0);
|
||||
CFRelease(bundleTailRef);
|
||||
}
|
||||
if (versionComparison != kCFCompareEqualTo) {
|
||||
CFURLRef versURL = CFURLCreateCopyAppendingPathComponent(
|
||||
NULL, bundleURL, CFSTR("Versions"), TRUE);
|
||||
|
||||
if (versURL) {
|
||||
CFURLRef versionedBundleURL =
|
||||
CFURLCreateCopyAppendingPathComponent(
|
||||
NULL, versURL, bundleVersionRef, TRUE);
|
||||
|
||||
if (versionedBundleURL) {
|
||||
versionedBundleRef = CFBundleCreate(NULL,
|
||||
versionedBundleURL);
|
||||
if (versionedBundleRef) {
|
||||
bundleRef = versionedBundleRef;
|
||||
}
|
||||
CFRelease(versionedBundleURL);
|
||||
}
|
||||
CFRelease(versURL);
|
||||
}
|
||||
}
|
||||
CFRelease(bundleVersionRef);
|
||||
}
|
||||
CFRelease(bundleURL);
|
||||
}
|
||||
}
|
||||
|
||||
if (bundleRef) {
|
||||
if (hasResourceFile) {
|
||||
(void) OpenResourceMap(bundleRef);
|
||||
}
|
||||
|
||||
libURL = CFBundleCopyResourceURL(bundleRef, CFSTR("Scripts"),
|
||||
NULL, NULL);
|
||||
|
||||
if (libURL) {
|
||||
/*
|
||||
* FIXME: This is a quick fix, it is probably not right for
|
||||
* internationalization.
|
||||
*/
|
||||
|
||||
CFURLGetFileSystemRepresentation(libURL, TRUE,
|
||||
(unsigned char *) libraryPath, maxPathLen);
|
||||
CFRelease(libURL);
|
||||
}
|
||||
if (versionedBundleRef) {
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
|
||||
/*
|
||||
* Workaround CFBundle bug in Tiger and earlier. [Bug 2569449]
|
||||
*/
|
||||
|
||||
if (tclMacOSXDarwinRelease >= 9)
|
||||
#endif
|
||||
{
|
||||
CFRelease(versionedBundleRef);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (libraryPath[0]) {
|
||||
return TCL_OK;
|
||||
}
|
||||
#endif /* HAVE_COREFOUNDATION */
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: c
|
||||
* c-basic-offset: 4
|
||||
* fill-column: 78
|
||||
* End:
|
||||
*/
|
||||
721
macosx/tclMacOSXFCmd.c
Normal file
721
macosx/tclMacOSXFCmd.c
Normal file
@@ -0,0 +1,721 @@
|
||||
/*
|
||||
* tclMacOSXFCmd.c
|
||||
*
|
||||
* This file implements the MacOSX specific portion of file manipulation
|
||||
* subcommands of the "file" command.
|
||||
*
|
||||
* Copyright (c) 2003-2007 Daniel A. Steffen <das@users.sourceforge.net>
|
||||
*
|
||||
* See the file "license.terms" for information on usage and redistribution of
|
||||
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*/
|
||||
|
||||
#include "tclInt.h"
|
||||
|
||||
#ifdef HAVE_GETATTRLIST
|
||||
#include <sys/attr.h>
|
||||
#include <sys/paths.h>
|
||||
#include <libkern/OSByteOrder.h>
|
||||
#endif
|
||||
|
||||
/* Darwin 8 copyfile API. */
|
||||
#ifdef HAVE_COPYFILE
|
||||
#ifdef HAVE_COPYFILE_H
|
||||
#include <copyfile.h>
|
||||
#if defined(HAVE_WEAK_IMPORT) && (MAC_OS_X_VERSION_MIN_REQUIRED < 1040)
|
||||
/* Support for weakly importing copyfile. */
|
||||
#define WEAK_IMPORT_COPYFILE
|
||||
extern int copyfile(const char *from, const char *to,
|
||||
copyfile_state_t state, copyfile_flags_t flags)
|
||||
WEAK_IMPORT_ATTRIBUTE;
|
||||
#endif /* HAVE_WEAK_IMPORT */
|
||||
#else /* HAVE_COPYFILE_H */
|
||||
int copyfile(const char *from, const char *to,
|
||||
void *state, uint32_t flags);
|
||||
#define COPYFILE_ACL (1<<0)
|
||||
#define COPYFILE_XATTR (1<<2)
|
||||
#define COPYFILE_NOFOLLOW_SRC (1<<18)
|
||||
#if defined(HAVE_WEAK_IMPORT) && (MAC_OS_X_VERSION_MIN_REQUIRED < 1040)
|
||||
/* Support for weakly importing copyfile. */
|
||||
#define WEAK_IMPORT_COPYFILE
|
||||
extern int copyfile(const char *from, const char *to,
|
||||
void *state, uint32_t flags)
|
||||
WEAK_IMPORT_ATTRIBUTE;
|
||||
#endif /* HAVE_WEAK_IMPORT */
|
||||
#endif /* HAVE_COPYFILE_H */
|
||||
#endif /* HAVE_COPYFILE */
|
||||
|
||||
#ifdef WEAK_IMPORT_COPYFILE
|
||||
#define MayUseCopyFile() (copyfile != NULL)
|
||||
#elif defined(HAVE_COPYFILE)
|
||||
#define MayUseCopyFile() (1)
|
||||
#else
|
||||
#define MayUseCopyFile() (0)
|
||||
#endif
|
||||
|
||||
#include <libkern/OSByteOrder.h>
|
||||
|
||||
/*
|
||||
* Constants for file attributes subcommand. Need to be kept in sync with
|
||||
* tclUnixFCmd.c !
|
||||
*/
|
||||
|
||||
enum {
|
||||
UNIX_GROUP_ATTRIBUTE,
|
||||
UNIX_OWNER_ATTRIBUTE,
|
||||
UNIX_PERMISSIONS_ATTRIBUTE,
|
||||
#ifdef HAVE_CHFLAGS
|
||||
UNIX_READONLY_ATTRIBUTE,
|
||||
#endif
|
||||
#ifdef MAC_OSX_TCL
|
||||
MACOSX_CREATOR_ATTRIBUTE,
|
||||
MACOSX_TYPE_ATTRIBUTE,
|
||||
MACOSX_HIDDEN_ATTRIBUTE,
|
||||
MACOSX_RSRCLENGTH_ATTRIBUTE,
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef u_int32_t OSType;
|
||||
|
||||
static int GetOSTypeFromObj(Tcl_Interp *interp,
|
||||
Tcl_Obj *objPtr, OSType *osTypePtr);
|
||||
static Tcl_Obj * NewOSTypeObj(const OSType newOSType);
|
||||
static int SetOSTypeFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
|
||||
static void UpdateStringOfOSType(Tcl_Obj *objPtr);
|
||||
|
||||
static const Tcl_ObjType tclOSTypeType = {
|
||||
"osType", /* name */
|
||||
NULL, /* freeIntRepProc */
|
||||
NULL, /* dupIntRepProc */
|
||||
UpdateStringOfOSType, /* updateStringProc */
|
||||
SetOSTypeFromAny /* setFromAnyProc */
|
||||
};
|
||||
|
||||
enum {
|
||||
kIsInvisible = 0x4000,
|
||||
};
|
||||
|
||||
#define kFinfoIsInvisible (OSSwapHostToBigConstInt16(kIsInvisible))
|
||||
|
||||
typedef struct finderinfo {
|
||||
u_int32_t type;
|
||||
u_int32_t creator;
|
||||
u_int16_t fdFlags;
|
||||
u_int32_t location;
|
||||
u_int16_t reserved;
|
||||
u_int32_t extendedFileInfo[4];
|
||||
} __attribute__ ((__packed__)) finderinfo;
|
||||
|
||||
typedef struct fileinfobuf {
|
||||
u_int32_t info_length;
|
||||
u_int32_t data[8];
|
||||
} fileinfobuf;
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TclMacOSXGetFileAttribute
|
||||
*
|
||||
* Gets a MacOSX attribute of a file. Which attribute is controlled by
|
||||
* objIndex. The object will have ref count 0.
|
||||
*
|
||||
* Results:
|
||||
* Standard TCL result. Returns a new Tcl_Obj in attributePtrPtr if there
|
||||
* is no error.
|
||||
*
|
||||
* Side effects:
|
||||
* A new object is allocated.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
TclMacOSXGetFileAttribute(
|
||||
Tcl_Interp *interp, /* The interp we are using for errors. */
|
||||
int objIndex, /* The index of the attribute. */
|
||||
Tcl_Obj *fileName, /* The name of the file (UTF-8). */
|
||||
Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */
|
||||
{
|
||||
#ifdef HAVE_GETATTRLIST
|
||||
int result;
|
||||
Tcl_StatBuf statBuf;
|
||||
struct attrlist alist;
|
||||
fileinfobuf finfo;
|
||||
finderinfo *finder = (finderinfo *) &finfo.data;
|
||||
off_t *rsrcForkSize = (off_t *) &finfo.data;
|
||||
const char *native;
|
||||
|
||||
result = TclpObjStat(fileName, &statBuf);
|
||||
|
||||
if (result != 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"could not read \"%s\": %s",
|
||||
TclGetString(fileName), Tcl_PosixError(interp)));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if (S_ISDIR(statBuf.st_mode) && objIndex != MACOSX_HIDDEN_ATTRIBUTE) {
|
||||
/*
|
||||
* Directories only support attribute "-hidden".
|
||||
*/
|
||||
|
||||
errno = EISDIR;
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"invalid attribute: %s", Tcl_PosixError(interp)));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
bzero(&alist, sizeof(struct attrlist));
|
||||
alist.bitmapcount = ATTR_BIT_MAP_COUNT;
|
||||
if (objIndex == MACOSX_RSRCLENGTH_ATTRIBUTE) {
|
||||
alist.fileattr = ATTR_FILE_RSRCLENGTH;
|
||||
} else {
|
||||
alist.commonattr = ATTR_CMN_FNDRINFO;
|
||||
}
|
||||
native = Tcl_FSGetNativePath(fileName);
|
||||
result = getattrlist(native, &alist, &finfo, sizeof(fileinfobuf), 0);
|
||||
|
||||
if (result != 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"could not read attributes of \"%s\": %s",
|
||||
TclGetString(fileName), Tcl_PosixError(interp)));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
switch (objIndex) {
|
||||
case MACOSX_CREATOR_ATTRIBUTE:
|
||||
*attributePtrPtr = NewOSTypeObj(
|
||||
OSSwapBigToHostInt32(finder->creator));
|
||||
break;
|
||||
case MACOSX_TYPE_ATTRIBUTE:
|
||||
*attributePtrPtr = NewOSTypeObj(
|
||||
OSSwapBigToHostInt32(finder->type));
|
||||
break;
|
||||
case MACOSX_HIDDEN_ATTRIBUTE:
|
||||
*attributePtrPtr = Tcl_NewBooleanObj(
|
||||
(finder->fdFlags & kFinfoIsInvisible) != 0);
|
||||
break;
|
||||
case MACOSX_RSRCLENGTH_ATTRIBUTE:
|
||||
*attributePtrPtr = Tcl_NewWideIntObj(*rsrcForkSize);
|
||||
break;
|
||||
}
|
||||
return TCL_OK;
|
||||
#else
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"Mac OS X file attributes not supported", -1));
|
||||
Tcl_SetErrorCode(interp, "TCL", "UNSUPPORTED", NULL);
|
||||
return TCL_ERROR;
|
||||
#endif /* HAVE_GETATTRLIST */
|
||||
}
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
*
|
||||
* TclMacOSXSetFileAttribute --
|
||||
*
|
||||
* Sets a MacOSX attribute of a file. Which attribute is controlled by
|
||||
* objIndex.
|
||||
*
|
||||
* Results:
|
||||
* Standard TCL result.
|
||||
*
|
||||
* Side effects:
|
||||
* As above.
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
TclMacOSXSetFileAttribute(
|
||||
Tcl_Interp *interp, /* The interp for error reporting. */
|
||||
int objIndex, /* The index of the attribute. */
|
||||
Tcl_Obj *fileName, /* The name of the file (UTF-8). */
|
||||
Tcl_Obj *attributePtr) /* New owner for file. */
|
||||
{
|
||||
#ifdef HAVE_GETATTRLIST
|
||||
int result;
|
||||
Tcl_StatBuf statBuf;
|
||||
struct attrlist alist;
|
||||
fileinfobuf finfo;
|
||||
finderinfo *finder = (finderinfo *) &finfo.data;
|
||||
off_t *rsrcForkSize = (off_t *) &finfo.data;
|
||||
const char *native;
|
||||
|
||||
result = TclpObjStat(fileName, &statBuf);
|
||||
|
||||
if (result != 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"could not read \"%s\": %s",
|
||||
TclGetString(fileName), Tcl_PosixError(interp)));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if (S_ISDIR(statBuf.st_mode) && objIndex != MACOSX_HIDDEN_ATTRIBUTE) {
|
||||
/*
|
||||
* Directories only support attribute "-hidden".
|
||||
*/
|
||||
|
||||
errno = EISDIR;
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"invalid attribute: %s", Tcl_PosixError(interp)));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
bzero(&alist, sizeof(struct attrlist));
|
||||
alist.bitmapcount = ATTR_BIT_MAP_COUNT;
|
||||
if (objIndex == MACOSX_RSRCLENGTH_ATTRIBUTE) {
|
||||
alist.fileattr = ATTR_FILE_RSRCLENGTH;
|
||||
} else {
|
||||
alist.commonattr = ATTR_CMN_FNDRINFO;
|
||||
}
|
||||
native = Tcl_FSGetNativePath(fileName);
|
||||
result = getattrlist(native, &alist, &finfo, sizeof(fileinfobuf), 0);
|
||||
|
||||
if (result != 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"could not read attributes of \"%s\": %s",
|
||||
TclGetString(fileName), Tcl_PosixError(interp)));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if (objIndex != MACOSX_RSRCLENGTH_ATTRIBUTE) {
|
||||
OSType t;
|
||||
int h;
|
||||
|
||||
switch (objIndex) {
|
||||
case MACOSX_CREATOR_ATTRIBUTE:
|
||||
if (GetOSTypeFromObj(interp, attributePtr, &t) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
finder->creator = OSSwapHostToBigInt32(t);
|
||||
break;
|
||||
case MACOSX_TYPE_ATTRIBUTE:
|
||||
if (GetOSTypeFromObj(interp, attributePtr, &t) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
finder->type = OSSwapHostToBigInt32(t);
|
||||
break;
|
||||
case MACOSX_HIDDEN_ATTRIBUTE:
|
||||
if (Tcl_GetBooleanFromObj(interp, attributePtr, &h) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (h) {
|
||||
finder->fdFlags |= kFinfoIsInvisible;
|
||||
} else {
|
||||
finder->fdFlags &= ~kFinfoIsInvisible;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
result = setattrlist(native, &alist,
|
||||
&finfo.data, sizeof(finfo.data), 0);
|
||||
|
||||
if (result != 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"could not set attributes of \"%s\": %s",
|
||||
TclGetString(fileName), Tcl_PosixError(interp)));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
} else {
|
||||
Tcl_WideInt newRsrcForkSize;
|
||||
|
||||
if (Tcl_GetWideIntFromObj(interp, attributePtr,
|
||||
&newRsrcForkSize) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if (newRsrcForkSize != *rsrcForkSize) {
|
||||
Tcl_DString ds;
|
||||
|
||||
/*
|
||||
* Only setting rsrclength to 0 to strip a file's resource fork is
|
||||
* supported.
|
||||
*/
|
||||
|
||||
if (newRsrcForkSize != 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"setting nonzero rsrclength not supported", -1));
|
||||
Tcl_SetErrorCode(interp, "TCL", "UNSUPPORTED", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Construct path to resource fork.
|
||||
*/
|
||||
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_DStringAppend(&ds, native, -1);
|
||||
Tcl_DStringAppend(&ds, _PATH_RSRCFORKSPEC, -1);
|
||||
|
||||
result = truncate(Tcl_DStringValue(&ds), (off_t)0);
|
||||
if (result != 0) {
|
||||
/*
|
||||
* truncate() on a valid resource fork path may fail with a
|
||||
* permission error in some OS releases, try truncating with
|
||||
* open() instead:
|
||||
*/
|
||||
|
||||
int fd = open(Tcl_DStringValue(&ds), O_WRONLY | O_TRUNC);
|
||||
|
||||
if (fd > 0) {
|
||||
result = close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
Tcl_DStringFree(&ds);
|
||||
|
||||
if (result != 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"could not truncate resource fork of \"%s\": %s",
|
||||
TclGetString(fileName), Tcl_PosixError(interp)));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TCL_OK;
|
||||
#else
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"Mac OS X file attributes not supported", -1));
|
||||
Tcl_SetErrorCode(interp, "TCL", "UNSUPPORTED", NULL);
|
||||
return TCL_ERROR;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
*
|
||||
* TclMacOSXCopyFileAttributes --
|
||||
*
|
||||
* Copy the MacOSX attributes and resource fork (if present) from one
|
||||
* file to another.
|
||||
*
|
||||
* Results:
|
||||
* Standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* MacOSX attributes and resource fork are updated in the new file to
|
||||
* reflect the old file.
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
TclMacOSXCopyFileAttributes(
|
||||
const char *src, /* Path name of source file (native). */
|
||||
const char *dst, /* Path name of target file (native). */
|
||||
const Tcl_StatBuf *statBufPtr)
|
||||
/* Stat info for source file */
|
||||
{
|
||||
if (MayUseCopyFile()) {
|
||||
#ifdef HAVE_COPYFILE
|
||||
if (0 == copyfile(src, dst, NULL, (S_ISLNK(statBufPtr->st_mode)
|
||||
? COPYFILE_XATTR | COPYFILE_NOFOLLOW_SRC
|
||||
: COPYFILE_XATTR | COPYFILE_ACL))) {
|
||||
return TCL_OK;
|
||||
}
|
||||
#endif /* HAVE_COPYFILE */
|
||||
} else {
|
||||
#if (!defined(HAVE_COPYFILE) || defined(WEAK_IMPORT_COPYFILE)) && defined(HAVE_GETATTRLIST)
|
||||
struct attrlist alist;
|
||||
fileinfobuf finfo;
|
||||
off_t *rsrcForkSize = (off_t *) &finfo.data;
|
||||
Tcl_DString srcBuf, dstBuf;
|
||||
int result;
|
||||
|
||||
bzero(&alist, sizeof(struct attrlist));
|
||||
alist.bitmapcount = ATTR_BIT_MAP_COUNT;
|
||||
alist.commonattr = ATTR_CMN_FNDRINFO;
|
||||
|
||||
if (getattrlist(src, &alist, &finfo, sizeof(fileinfobuf), 0)) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (setattrlist(dst, &alist, &finfo.data, sizeof(finfo.data), 0)) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we're a directory, we're done as they never have resource forks.
|
||||
*/
|
||||
|
||||
if (S_ISDIR(statBufPtr->st_mode)) {
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* We only copy a non-empty resource fork, so determine if that's the
|
||||
* case first.
|
||||
*/
|
||||
|
||||
alist.commonattr = 0;
|
||||
alist.fileattr = ATTR_FILE_RSRCLENGTH;
|
||||
if (getattrlist(src, &alist, &finfo, sizeof(fileinfobuf), 0)) {
|
||||
return TCL_ERROR;
|
||||
} else if (*rsrcForkSize == 0) {
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Construct paths to resource forks.
|
||||
*/
|
||||
|
||||
Tcl_DStringInit(&srcBuf);
|
||||
Tcl_DStringAppend(&srcBuf, src, -1);
|
||||
Tcl_DStringAppend(&srcBuf, _PATH_RSRCFORKSPEC, -1);
|
||||
Tcl_DStringInit(&dstBuf);
|
||||
Tcl_DStringAppend(&dstBuf, dst, -1);
|
||||
Tcl_DStringAppend(&dstBuf, _PATH_RSRCFORKSPEC, -1);
|
||||
|
||||
/*
|
||||
* Do the copy.
|
||||
*/
|
||||
|
||||
result = TclUnixCopyFile(Tcl_DStringValue(&srcBuf),
|
||||
Tcl_DStringValue(&dstBuf), statBufPtr, 1);
|
||||
Tcl_DStringFree(&srcBuf);
|
||||
Tcl_DStringFree(&dstBuf);
|
||||
if (result == 0) {
|
||||
return TCL_OK;
|
||||
}
|
||||
#endif /* (!HAVE_COPYFILE || WEAK_IMPORT_COPYFILE) && HAVE_GETATTRLIST */
|
||||
}
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TclMacOSXMatchType --
|
||||
*
|
||||
* This routine is used by the globbing code to check if a file matches a
|
||||
* given mac type and/or creator code.
|
||||
*
|
||||
* Results:
|
||||
* The return value is 1, 0 or -1 indicating whether the file matches the
|
||||
* given criteria, does not match them, or an error occurred (in wich
|
||||
* case an error is left in interp).
|
||||
*
|
||||
* Side effects:
|
||||
* None.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
TclMacOSXMatchType(
|
||||
Tcl_Interp *interp, /* Interpreter to receive errors. */
|
||||
const char *pathName, /* Native path to check. */
|
||||
const char *fileName, /* Native filename to check. */
|
||||
Tcl_StatBuf *statBufPtr, /* Stat info for file to check */
|
||||
Tcl_GlobTypeData *types) /* Type description to match against. */
|
||||
{
|
||||
#ifdef HAVE_GETATTRLIST
|
||||
struct attrlist alist;
|
||||
fileinfobuf finfo;
|
||||
finderinfo *finder = (finderinfo *) &finfo.data;
|
||||
OSType osType;
|
||||
|
||||
bzero(&alist, sizeof(struct attrlist));
|
||||
alist.bitmapcount = ATTR_BIT_MAP_COUNT;
|
||||
alist.commonattr = ATTR_CMN_FNDRINFO;
|
||||
if (getattrlist(pathName, &alist, &finfo, sizeof(fileinfobuf), 0) != 0) {
|
||||
return 0;
|
||||
}
|
||||
if ((types->perm & TCL_GLOB_PERM_HIDDEN) &&
|
||||
!((finder->fdFlags & kFinfoIsInvisible) || (*fileName == '.'))) {
|
||||
return 0;
|
||||
}
|
||||
if (S_ISDIR(statBufPtr->st_mode)
|
||||
&& (types->macType || types->macCreator)) {
|
||||
/*
|
||||
* Directories don't support types or creators.
|
||||
*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
if (types->macType) {
|
||||
if (GetOSTypeFromObj(interp, types->macType, &osType) != TCL_OK) {
|
||||
return -1;
|
||||
}
|
||||
if (osType != OSSwapBigToHostInt32(finder->type)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (types->macCreator) {
|
||||
if (GetOSTypeFromObj(interp, types->macCreator, &osType) != TCL_OK) {
|
||||
return -1;
|
||||
}
|
||||
if (osType != OSSwapBigToHostInt32(finder->creator)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* GetOSTypeFromObj --
|
||||
*
|
||||
* Attempt to return an OSType from the Tcl object "objPtr".
|
||||
*
|
||||
* Results:
|
||||
* Standard TCL result. If an error occurs during conversion, an error
|
||||
* message is left in interp->objResult.
|
||||
*
|
||||
* Side effects:
|
||||
* The string representation of objPtr will be updated if necessary.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
GetOSTypeFromObj(
|
||||
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
|
||||
Tcl_Obj *objPtr, /* The object from which to get an OSType. */
|
||||
OSType *osTypePtr) /* Place to store resulting OSType. */
|
||||
{
|
||||
int result = TCL_OK;
|
||||
|
||||
if (objPtr->typePtr != &tclOSTypeType) {
|
||||
result = SetOSTypeFromAny(interp, objPtr);
|
||||
}
|
||||
*osTypePtr = (OSType) objPtr->internalRep.longValue;
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* NewOSTypeObj --
|
||||
*
|
||||
* Create a new OSType object.
|
||||
*
|
||||
* Results:
|
||||
* The newly created OSType object is returned, it has ref count 0.
|
||||
*
|
||||
* Side effects:
|
||||
* None.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static Tcl_Obj *
|
||||
NewOSTypeObj(
|
||||
const OSType osType) /* OSType used to initialize the new
|
||||
* object. */
|
||||
{
|
||||
Tcl_Obj *objPtr;
|
||||
|
||||
TclNewObj(objPtr);
|
||||
TclInvalidateStringRep(objPtr);
|
||||
objPtr->internalRep.longValue = (long) osType;
|
||||
objPtr->typePtr = &tclOSTypeType;
|
||||
return objPtr;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* SetOSTypeFromAny --
|
||||
*
|
||||
* Attempts to force the internal representation for a Tcl object to
|
||||
* tclOSTypeType, specifically.
|
||||
*
|
||||
* Results:
|
||||
* The return value is a standard object Tcl result. If an error occurs
|
||||
* during conversion, an error message is left in the interpreter's
|
||||
* result unless "interp" is NULL.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
SetOSTypeFromAny(
|
||||
Tcl_Interp *interp, /* Tcl interpreter */
|
||||
Tcl_Obj *objPtr) /* Pointer to the object to convert */
|
||||
{
|
||||
const char *string;
|
||||
int length, result = TCL_OK;
|
||||
Tcl_DString ds;
|
||||
Tcl_Encoding encoding = Tcl_GetEncoding(NULL, "macRoman");
|
||||
|
||||
string = Tcl_GetStringFromObj(objPtr, &length);
|
||||
Tcl_UtfToExternalDString(encoding, string, length, &ds);
|
||||
|
||||
if (Tcl_DStringLength(&ds) > 4) {
|
||||
if (interp) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"expected Macintosh OS type but got \"%s\": ", string));
|
||||
Tcl_SetErrorCode(interp, "TCL", "VALUE", "MAC_OSTYPE", NULL);
|
||||
}
|
||||
result = TCL_ERROR;
|
||||
} else {
|
||||
OSType osType;
|
||||
char bytes[4] = {'\0','\0','\0','\0'};
|
||||
|
||||
memcpy(bytes, Tcl_DStringValue(&ds), (size_t)Tcl_DStringLength(&ds));
|
||||
osType = (OSType) bytes[0] << 24 |
|
||||
(OSType) bytes[1] << 16 |
|
||||
(OSType) bytes[2] << 8 |
|
||||
(OSType) bytes[3];
|
||||
TclFreeIntRep(objPtr);
|
||||
objPtr->internalRep.longValue = (long) osType;
|
||||
objPtr->typePtr = &tclOSTypeType;
|
||||
}
|
||||
Tcl_DStringFree(&ds);
|
||||
Tcl_FreeEncoding(encoding);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* UpdateStringOfOSType --
|
||||
*
|
||||
* Update the string representation for an OSType object. Note: This
|
||||
* function does not free an existing old string rep so storage will be
|
||||
* lost if this has not already been done.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* The object's string is set to a valid string that results from the
|
||||
* OSType-to-string conversion.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static void
|
||||
UpdateStringOfOSType(
|
||||
register Tcl_Obj *objPtr) /* OSType object whose string rep to
|
||||
* update. */
|
||||
{
|
||||
char string[5];
|
||||
OSType osType = (OSType) objPtr->internalRep.longValue;
|
||||
Tcl_DString ds;
|
||||
Tcl_Encoding encoding = Tcl_GetEncoding(NULL, "macRoman");
|
||||
unsigned len;
|
||||
|
||||
string[0] = (char) (osType >> 24);
|
||||
string[1] = (char) (osType >> 16);
|
||||
string[2] = (char) (osType >> 8);
|
||||
string[3] = (char) (osType);
|
||||
string[4] = '\0';
|
||||
Tcl_ExternalToUtfDString(encoding, string, -1, &ds);
|
||||
len = (unsigned) Tcl_DStringLength(&ds) + 1;
|
||||
objPtr->bytes = ckalloc(len);
|
||||
memcpy(objPtr->bytes, Tcl_DStringValue(&ds), len);
|
||||
objPtr->length = Tcl_DStringLength(&ds);
|
||||
Tcl_DStringFree(&ds);
|
||||
Tcl_FreeEncoding(encoding);
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: c
|
||||
* c-basic-offset: 4
|
||||
* fill-column: 78
|
||||
* End:
|
||||
*/
|
||||
2037
macosx/tclMacOSXNotify.c
Normal file
2037
macosx/tclMacOSXNotify.c
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user