Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
200e2e211e |
@@ -3,9 +3,7 @@
|
||||
*.dylib
|
||||
*.exe
|
||||
*.exp
|
||||
*.la
|
||||
*.lib
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
*.pdb
|
||||
@@ -21,18 +19,14 @@
|
||||
*/tcltest*
|
||||
*/versions.vc
|
||||
*/version.vc
|
||||
*/libtcl.vfs
|
||||
*/libtcl_*.zip
|
||||
html
|
||||
libtommath/bn.ilg
|
||||
libtommath/bn.ind
|
||||
libtommath/pretty.build
|
||||
libtommath/tommath.src
|
||||
libtommath/*.log
|
||||
libtommath/*.pdf
|
||||
libtommath/gen.pl
|
||||
libtommath/*.pl
|
||||
libtommath/*.sh
|
||||
libtommath/doc/*
|
||||
libtommath/tombc/*
|
||||
libtommath/pre_gen/*
|
||||
libtommath/pics/*
|
||||
@@ -49,8 +43,6 @@ unix/tclIndex
|
||||
unix/pkgs/*
|
||||
win/Debug*
|
||||
win/Release*
|
||||
win/*.manifest
|
||||
win/pkgs/*
|
||||
win/coffbase.txt
|
||||
win/tcl.hpj
|
||||
win/nmhlp-out.txt
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
# Set the default behavior, in case people don't have core.autocrlf set.
|
||||
* eol=lf
|
||||
* text=auto
|
||||
|
||||
# Explicitly declare text files you want to always be normalized and converted
|
||||
# to native line endings on checkout.
|
||||
*.3 text
|
||||
*.c text
|
||||
*.css text
|
||||
*.enc text
|
||||
*.h text
|
||||
*.htm text
|
||||
*.html text
|
||||
*.java text
|
||||
*.js text
|
||||
*.json text
|
||||
*.n text
|
||||
*.svg text
|
||||
*.ts text
|
||||
*.tcl text
|
||||
*.test text
|
||||
|
||||
# Declare files that will always have CRLF line endings on checkout.
|
||||
*.bat eol=crlf
|
||||
*.sln eol=crlf
|
||||
*.vc eol=crlf
|
||||
|
||||
# Denote all files that are truly binary and should not be modified.
|
||||
*.a binary
|
||||
*.dll binary
|
||||
*.exe binary
|
||||
*.gif binary
|
||||
*.gz binary
|
||||
*.jpg binary
|
||||
*.lib binary
|
||||
*.pdf binary
|
||||
*.png binary
|
||||
*.xlsx binary
|
||||
*.zip binary
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
*.a
|
||||
*.dll
|
||||
*.dylib
|
||||
*.exe
|
||||
*.exp
|
||||
*.lib
|
||||
*.o
|
||||
*.obj
|
||||
*.pdb
|
||||
*.res
|
||||
*.sl
|
||||
*.so
|
||||
*/Makefile
|
||||
*/config.cache
|
||||
*/config.log
|
||||
*/config.status
|
||||
*/tclConfig.sh
|
||||
*/tclsh*
|
||||
*/tcltest*
|
||||
*/versions.vc
|
||||
*/version.vc
|
||||
*/libtcl.vfs
|
||||
*/libtcl_*.zip
|
||||
html
|
||||
libtommath/bn.ilg
|
||||
libtommath/bn.ind
|
||||
libtommath/pretty.build
|
||||
libtommath/tommath.src
|
||||
libtommath/*.log
|
||||
libtommath/*.pdf
|
||||
libtommath/*.pl
|
||||
libtommath/*.sh
|
||||
libtommath/doc/*
|
||||
libtommath/tombc/*
|
||||
libtommath/pre_gen/*
|
||||
libtommath/pics/*
|
||||
libtommath/mtest/*
|
||||
libtommath/logs/*
|
||||
libtommath/etc/*
|
||||
libtommath/demo/*
|
||||
libtommath/*.out
|
||||
libtommath/*.tex
|
||||
unix/autoMkindex.tcl
|
||||
unix/dltest.marker
|
||||
unix/tcl.pc
|
||||
unix/tclIndex
|
||||
unix/pkgs/*
|
||||
win/Debug*
|
||||
win/Release*
|
||||
win/*.manifest
|
||||
win/pkgs/*
|
||||
win/coffbase.txt
|
||||
win/tcl.hpj
|
||||
win/nmhlp-out.txt
|
||||
+192
-237
@@ -1,58 +1,36 @@
|
||||
dist: trusty
|
||||
sudo: false
|
||||
language: c
|
||||
|
||||
matrix:
|
||||
include:
|
||||
# Testing on Linux with various compilers
|
||||
- name: "Linux/GCC/Shared"
|
||||
os: linux
|
||||
dist: bionic
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env:
|
||||
- MATRIX_EVAL="" BUILD_DIR=unix
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env:
|
||||
- MATRIX_EVAL="" BUILD_DIR=unix CFGOPT=--disable-shared
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env:
|
||||
- BUILD_DIR=unix
|
||||
- name: "Linux/GCC/Static"
|
||||
os: linux
|
||||
dist: bionic
|
||||
- MATRIX_EVAL="" BUILD_DIR=unix
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env:
|
||||
- CFGOPT="--disable-shared"
|
||||
- BUILD_DIR=unix
|
||||
- name: "Linux/GCC/Debug"
|
||||
os: linux
|
||||
dist: bionic
|
||||
- MATRIX_EVAL="" BUILD_DIR=unix CFGOPT=--disable-shared
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env:
|
||||
- BUILD_DIR=unix
|
||||
- CFGOPT="--enable-symbols"
|
||||
# Older versions of GCC...
|
||||
- name: "Linux/GCC 7/Shared"
|
||||
os: linux
|
||||
dist: bionic
|
||||
compiler: gcc-7
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-7
|
||||
- g++-4.9
|
||||
env:
|
||||
- BUILD_DIR=unix
|
||||
- name: "Linux/GCC 6/Shared"
|
||||
os: linux
|
||||
dist: bionic
|
||||
compiler: gcc-6
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-6
|
||||
env:
|
||||
- BUILD_DIR=unix
|
||||
- name: "Linux/GCC 5/Shared"
|
||||
os: linux
|
||||
dist: bionic
|
||||
compiler: gcc-5
|
||||
- MATRIX_EVAL="CC=gcc-4.9" BUILD_DIR=unix
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
@@ -60,98 +38,153 @@ matrix:
|
||||
packages:
|
||||
- g++-5
|
||||
env:
|
||||
- BUILD_DIR=unix
|
||||
# Clang
|
||||
- name: "Linux/Clang/Shared"
|
||||
os: linux
|
||||
dist: bionic
|
||||
compiler: clang
|
||||
env:
|
||||
- BUILD_DIR=unix
|
||||
- name: "Linux/Clang/Static"
|
||||
os: linux
|
||||
dist: bionic
|
||||
compiler: clang
|
||||
env:
|
||||
- CFGOPT="--disable-shared"
|
||||
- BUILD_DIR=unix
|
||||
- name: "Linux/Clang/Debug"
|
||||
os: linux
|
||||
dist: bionic
|
||||
compiler: clang
|
||||
env:
|
||||
- BUILD_DIR=unix
|
||||
- CFGOPT="--enable-symbols"
|
||||
# Testing on Mac, various styles
|
||||
- name: "macOS/Xcode 11.3/Shared/Unix-like"
|
||||
os: osx
|
||||
osx_image: xcode11.3
|
||||
env:
|
||||
- BUILD_DIR=unix
|
||||
- name: "macOS/Xcode 11.3/Shared"
|
||||
os: osx
|
||||
osx_image: xcode11.3
|
||||
env:
|
||||
- BUILD_DIR=macosx
|
||||
install: []
|
||||
script: &mactest
|
||||
- make all
|
||||
# The styles=develop avoids some weird problems on OSX
|
||||
- make test styles=develop
|
||||
- name: "macOS/Xcode 11/Shared"
|
||||
os: osx
|
||||
osx_image: xcode11
|
||||
env:
|
||||
- BUILD_DIR=macosx
|
||||
install: []
|
||||
script: *mactest
|
||||
- name: "macOS/Xcode 10/Shared"
|
||||
os: osx
|
||||
osx_image: xcode10.3
|
||||
env:
|
||||
- BUILD_DIR=macosx
|
||||
install: []
|
||||
script: *mactest
|
||||
- name: "macOS/Xcode 9/Shared"
|
||||
os: osx
|
||||
osx_image: xcode9
|
||||
env:
|
||||
- BUILD_DIR=macosx
|
||||
install: []
|
||||
script: *mactest
|
||||
- name: "macOS/Xcode 8/Shared"
|
||||
os: osx
|
||||
osx_image: xcode8
|
||||
env:
|
||||
- BUILD_DIR=macosx
|
||||
install: []
|
||||
script: *mactest
|
||||
# Test with mingw-w64 cross-compile
|
||||
# Doesn't run tests because wine is only an imperfect Windows emulation
|
||||
- name: "Linux-cross-Windows/GCC/Shared/no test"
|
||||
os: linux
|
||||
dist: bionic
|
||||
compiler: x86_64-w64-mingw32-gcc
|
||||
- MATRIX_EVAL="CC=gcc-5" BUILD_DIR=unix
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- gcc-mingw-w64-base
|
||||
- binutils-mingw-w64-x86-64
|
||||
- gcc-mingw-w64-x86-64
|
||||
- gcc-mingw-w64
|
||||
- g++-6
|
||||
env:
|
||||
- BUILD_DIR=win
|
||||
- CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit"
|
||||
script: &crosstest
|
||||
- make all tcltest
|
||||
# Include a high visibility marker that tests are skipped outright
|
||||
- >
|
||||
echo "`tput setaf 3`SKIPPED TEST: CROSS COMPILING`tput sgr0`"
|
||||
# Test with mingw-w64 (32 bit) cross-compile
|
||||
# Doesn't run tests because wine is only an imperfect Windows emulation
|
||||
- name: "Linux-cross-Windows-32/GCC/Shared/no test"
|
||||
os: linux
|
||||
dist: bionic
|
||||
- MATRIX_EVAL="CC=gcc-6" BUILD_DIR=unix
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-7
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-7" BUILD_DIR=unix
|
||||
- os: osx
|
||||
osx_image: xcode8
|
||||
env:
|
||||
- MATRIX_EVAL="" BUILD_DIR=unix
|
||||
- os: osx
|
||||
osx_image: xcode8
|
||||
env:
|
||||
- MATRIX_EVAL="" BUILD_DIR=macosx NO_DIRECT_CONFIGURE=1
|
||||
- os: osx
|
||||
osx_image: xcode9
|
||||
env:
|
||||
- MATRIX_EVAL="" BUILD_DIR=macosx NO_DIRECT_CONFIGURE=1
|
||||
- os: osx
|
||||
osx_image: xcode10
|
||||
env:
|
||||
- MATRIX_EVAL="" BUILD_DIR=macosx NO_DIRECT_CONFIGURE=1
|
||||
### C builds not currently supported on Windows instances
|
||||
# - os: windows
|
||||
# env:
|
||||
# - MATRIX_EVAL="" BUILD_DIR=win
|
||||
|
||||
before_install:
|
||||
- eval "${MATRIX_EVAL}"
|
||||
- export ERROR_ON_FAILURES=1
|
||||
- cd ${BUILD_DIR}
|
||||
install:
|
||||
- test -n "$NO_DIRECT_CONFIGURE" || ./configure ${CFGOPT}
|
||||
script:
|
||||
- make
|
||||
- make test
|
||||
dist: trusty
|
||||
sudo: false
|
||||
language: c
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env:
|
||||
- MATRIX_EVAL=""
|
||||
- BUILD_DIR=unix
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env:
|
||||
- MATRIX_EVAL=""
|
||||
- BUILD_DIR=unix
|
||||
- CFGOPT=--disable-shared
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env:
|
||||
- MATRIX_EVAL=""
|
||||
- BUILD_DIR=unix
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env:
|
||||
- MATRIX_EVAL=""
|
||||
- BUILD_DIR=unix
|
||||
- CFGOPT=--disable-shared
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.9
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-4.9"
|
||||
- BUILD_DIR=unix
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-5
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-5"
|
||||
- BUILD_DIR=unix
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-6
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-6"
|
||||
- BUILD_DIR=unix
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-7
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-7"
|
||||
- BUILD_DIR=unix
|
||||
- os: osx
|
||||
osx_image: xcode8
|
||||
env:
|
||||
- MATRIX_EVAL=""
|
||||
- BUILD_DIR=unix
|
||||
- os: osx
|
||||
osx_image: xcode8
|
||||
env:
|
||||
- MATRIX_EVAL=""
|
||||
- BUILD_DIR=macosx
|
||||
- NO_DIRECT_CONFIGURE=1
|
||||
- os: osx
|
||||
osx_image: xcode9
|
||||
env:
|
||||
- MATRIX_EVAL=""
|
||||
- BUILD_DIR=macosx
|
||||
- NO_DIRECT_CONFIGURE=1
|
||||
- os: osx
|
||||
osx_image: xcode10
|
||||
env:
|
||||
- MATRIX_EVAL=""
|
||||
- BUILD_DIR=macosx
|
||||
- NO_DIRECT_CONFIGURE=1
|
||||
# Test with mingw-w64 (32 bit)
|
||||
- os: linux
|
||||
compiler: i686-w64-mingw32-gcc
|
||||
addons:
|
||||
apt:
|
||||
@@ -161,121 +194,43 @@ matrix:
|
||||
- gcc-mingw-w64-i686
|
||||
- gcc-mingw-w64
|
||||
- gcc-multilib
|
||||
- wine
|
||||
env:
|
||||
- MATRIX_EVAL=""
|
||||
- BUILD_DIR=win
|
||||
- CFGOPT=--host=i686-w64-mingw32
|
||||
script: *crosstest
|
||||
# Test on Windows with MSVC native
|
||||
- name: "Windows/MSVC/Shared"
|
||||
os: windows
|
||||
compiler: cl
|
||||
env: &vcenv
|
||||
- BUILD_DIR=win
|
||||
- VCDIR="/C/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Auxiliary/Build"
|
||||
before_install: &vcpreinst
|
||||
- PATH="$PATH:$VCDIR"
|
||||
- cd ${BUILD_DIR}
|
||||
install: []
|
||||
script:
|
||||
- cmd.exe //C vcvarsall.bat x64 '&&' nmake '-f' makefile.vc all tcltest
|
||||
- cmd.exe //C vcvarsall.bat x64 '&&' nmake '-f' makefile.vc test
|
||||
- name: "Windows/MSVC/Static"
|
||||
os: windows
|
||||
compiler: cl
|
||||
env: *vcenv
|
||||
before_install: *vcpreinst
|
||||
install: []
|
||||
script:
|
||||
- cmd.exe //C vcvarsall.bat x64 '&&' nmake 'OPTS=static,msvcrt' '-f' makefile.vc all tcltest
|
||||
- cmd.exe //C vcvarsall.bat x64 '&&' nmake 'OPTS=static,msvcrt' '-f' makefile.vc test
|
||||
- name: "Windows/MSVC/Debug"
|
||||
os: windows
|
||||
compiler: cl
|
||||
env: *vcenv
|
||||
before_install: *vcpreinst
|
||||
install: []
|
||||
script:
|
||||
- cmd.exe //C vcvarsall.bat x64 '&&' nmake 'OPTS=symbols' '-f' makefile.vc all tcltest
|
||||
- cmd.exe //C vcvarsall.bat x64 '&&' nmake 'OPTS=symbols' '-f' makefile.vc test
|
||||
# Test on Windows with MSVC native (32-bit)
|
||||
- name: "Windows/MSVC-x86/Shared"
|
||||
os: windows
|
||||
compiler: cl
|
||||
env: *vcenv
|
||||
before_install: *vcpreinst
|
||||
install: []
|
||||
script:
|
||||
- cmd.exe //C vcvarsall.bat x86 '&&' nmake '-f' makefile.vc all tcltest
|
||||
- cmd.exe //C vcvarsall.bat x86 '&&' nmake '-f' makefile.vc test
|
||||
- name: "Windows/MSVC-x86/Static"
|
||||
os: windows
|
||||
compiler: cl
|
||||
env: *vcenv
|
||||
before_install: *vcpreinst
|
||||
install: []
|
||||
script:
|
||||
- cmd.exe //C vcvarsall.bat x86 '&&' nmake 'OPTS=static,msvcrt' '-f' makefile.vc all tcltest
|
||||
- cmd.exe //C vcvarsall.bat x86 '&&' nmake 'OPTS=static,msvcrt' '-f' makefile.vc test
|
||||
- name: "Windows/MSVC-x86/Debug"
|
||||
os: windows
|
||||
compiler: cl
|
||||
env: *vcenv
|
||||
before_install: *vcpreinst
|
||||
install: []
|
||||
script:
|
||||
- cmd.exe //C vcvarsall.bat x86 '&&' nmake 'OPTS=symbols' '-f' makefile.vc all tcltest
|
||||
- cmd.exe //C vcvarsall.bat x86 '&&' nmake 'OPTS=symbols' '-f' makefile.vc test
|
||||
# Test on Windows with GCC native
|
||||
- name: "Windows/GCC/Shared"
|
||||
os: windows
|
||||
compiler: gcc
|
||||
- NO_DIRECT_TEST=1
|
||||
|
||||
# Test with mingw-w64 (64 bit)
|
||||
- os: linux
|
||||
compiler: x86_64-w64-mingw32-gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-mingw-w64-base
|
||||
- binutils-mingw-w64-x86-64
|
||||
- gcc-mingw-w64-x86-64
|
||||
- gcc-mingw-w64
|
||||
- wine
|
||||
env:
|
||||
- MATRIX_EVAL=""
|
||||
- BUILD_DIR=win
|
||||
- CFGOPT="--enable-64bit"
|
||||
before_install: &makepreinst
|
||||
- choco install make
|
||||
- cd ${BUILD_DIR}
|
||||
- name: "Windows/GCC/Static"
|
||||
os: windows
|
||||
compiler: gcc
|
||||
env:
|
||||
- BUILD_DIR=win
|
||||
- CFGOPT="--enable-64bit --disable-shared"
|
||||
before_install: *makepreinst
|
||||
- name: "Windows/GCC/Debug"
|
||||
os: windows
|
||||
compiler: gcc
|
||||
env:
|
||||
- BUILD_DIR=win
|
||||
- CFGOPT="--enable-64bit --enable-symbols"
|
||||
before_install: *makepreinst
|
||||
# Test on Windows with GCC native (32-bit)
|
||||
- name: "Windows/GCC-x86/Shared"
|
||||
os: windows
|
||||
compiler: gcc
|
||||
env:
|
||||
- BUILD_DIR=win
|
||||
before_install: *makepreinst
|
||||
- name: "Windows/GCC-x86/Static"
|
||||
os: windows
|
||||
compiler: gcc
|
||||
env:
|
||||
- BUILD_DIR=win
|
||||
- CFGOPT="--disable-shared"
|
||||
before_install: *makepreinst
|
||||
- name: "Windows/GCC-x86/Debug"
|
||||
os: windows
|
||||
compiler: gcc
|
||||
env:
|
||||
- BUILD_DIR=win
|
||||
- CFGOPT="--enable-symbols"
|
||||
before_install: *makepreinst
|
||||
- CFGOPT=--host=x86_64-w64-mingw32 --enable-64bit
|
||||
- NO_DIRECT_TEST=1
|
||||
|
||||
### C builds not currently supported on Windows instances
|
||||
# - os: windows
|
||||
# env:
|
||||
# - MATRIX_EVAL=""
|
||||
# - BUILD_DIR=win
|
||||
|
||||
before_install:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then rvm get stable; fi
|
||||
- eval "${MATRIX_EVAL}"
|
||||
- export ERROR_ON_FAILURES=1
|
||||
- cd ${BUILD_DIR}
|
||||
install:
|
||||
- ./configure ${CFGOPT} --prefix=$HOME || (cat config.log && exit 1)
|
||||
before_script:
|
||||
- export ERROR_ON_FAILURES=1
|
||||
- test -n "$NO_DIRECT_CONFIGURE" || ./configure ${CFGOPT}
|
||||
script:
|
||||
- make all tcltest
|
||||
- make test
|
||||
- make
|
||||
- test -n "$NO_DIRECT_TEST" || make test
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
A NOTE ON THE CHANGELOG:
|
||||
Starting in early 2011, Tcl source code has been under the management of
|
||||
fossil, hosted at https://core.tcl-lang.org/tcl/ . Fossil presents a "Timeline"
|
||||
fossil, hosted at http://core.tcl.tk/tcl/ . Fossil presents a "Timeline"
|
||||
view of changes made that is superior in every way to a hand edited log file.
|
||||
Because of this, many Tcl developers are now out of the habit of maintaining
|
||||
this log file. You may still find useful things in it, but the Timeline is
|
||||
|
||||
@@ -1,148 +0,0 @@
|
||||
# README: Tcl
|
||||
|
||||
This is the **Tcl 8.6.10** source distribution.
|
||||
|
||||
You can get any source release of Tcl from [our distribution
|
||||
site](https://sourceforge.net/projects/tcl/files/Tcl/).
|
||||
|
||||
[](https://travis-ci.org/tcltk/tcl)
|
||||
|
||||
## Contents
|
||||
1. [Introduction](#intro)
|
||||
2. [Documentation](#doc)
|
||||
3. [Compiling and installing Tcl](#build)
|
||||
4. [Development tools](#devtools)
|
||||
5. [Tcl newsgroup](#complangtcl)
|
||||
6. [The Tcler's Wiki](#wiki)
|
||||
7. [Mailing lists](#email)
|
||||
8. [Support and Training](#support)
|
||||
9. [Tracking Development](#watch)
|
||||
10. [Thank You](#thanks)
|
||||
|
||||
## <a id="intro">1.</a> Introduction
|
||||
Tcl provides a powerful platform for creating integration applications that
|
||||
tie together diverse applications, protocols, devices, and frameworks.
|
||||
When paired with the Tk toolkit, Tcl provides the fastest and most powerful
|
||||
way to create GUI applications that run on PCs, Unix, and Mac OS X.
|
||||
Tcl can also be used for a variety of web-related tasks and for creating
|
||||
powerful command languages for applications.
|
||||
|
||||
Tcl is maintained, enhanced, and distributed freely by the Tcl community.
|
||||
Source code development and tracking of bug reports and feature requests
|
||||
takes place at [core.tcl-lang.org](https://core.tcl-lang.org/).
|
||||
Tcl/Tk release and mailing list services are [hosted by
|
||||
SourceForge](https://sourceforge.net/projects/tcl/)
|
||||
with the Tcl Developer Xchange hosted at
|
||||
[www.tcl-lang.org](https://www.tcl-lang.org).
|
||||
|
||||
Tcl is a freely available open source package. You can do virtually
|
||||
anything you like with it, such as modifying it, redistributing it,
|
||||
and selling it either in whole or in part. See the file
|
||||
`license.terms` for complete information.
|
||||
|
||||
## <a id="doc">2.</a> Documentation
|
||||
Extensive documentation is available at our website.
|
||||
The home page for this release, including new features, is
|
||||
[here](https://www.tcl.tk/software/tcltk/8.6.html).
|
||||
Detailed release notes can be found at the
|
||||
[file distributions page](https://sourceforge.net/projects/tcl/files/Tcl/)
|
||||
by clicking on the relevant version.
|
||||
|
||||
Information about Tcl itself can be found at the [Developer
|
||||
Xchange](https://www.tcl-lang.org/about/).
|
||||
There have been many Tcl books on the market. Many are mentioned in
|
||||
[the Wiki](https://wiki.tcl-lang.org/_/ref?N=25206).
|
||||
|
||||
The complete set of reference manual entries for Tcl 8.6 is [online,
|
||||
here](https://www.tcl-lang.org/man/tcl8.6/).
|
||||
|
||||
### <a id="doc.unix">2a.</a> Unix Documentation
|
||||
The `doc` subdirectory in this release contains a complete set of
|
||||
reference manual entries for Tcl. Files with extension "`.1`" are for
|
||||
programs (for example, `tclsh.1`); files with extension "`.3`" are for C
|
||||
library procedures; and files with extension "`.n`" describe Tcl
|
||||
commands. The file "`doc/Tcl.n`" gives a quick summary of the Tcl
|
||||
language syntax. To print any of the man pages on Unix, cd to the
|
||||
"doc" directory and invoke your favorite variant of troff using the
|
||||
normal -man macros, for example
|
||||
|
||||
groff -man -Tpdf Tcl.n >output.pdf
|
||||
|
||||
to print Tcl.n to PDF. If Tcl has been installed correctly and your "man" program
|
||||
supports it, you should be able to access the Tcl manual entries using the
|
||||
normal "man" mechanisms, such as
|
||||
|
||||
man Tcl
|
||||
|
||||
### <a id="doc.win">2b.</a> Windows Documentation
|
||||
The "doc" subdirectory in this release contains a complete set of Windows
|
||||
help files for Tcl. Once you install this Tcl release, a shortcut to the
|
||||
Windows help Tcl documentation will appear in the "Start" menu:
|
||||
|
||||
Start | Programs | Tcl | Tcl Help
|
||||
|
||||
## <a id="build">3.</a> Compiling and installing Tcl
|
||||
There are brief notes in the `unix/README`, `win/README`, and `macosx/README`
|
||||
about compiling on these different platforms. There is additional information
|
||||
about building Tcl from sources
|
||||
[online](https://www.tcl-lang.org/doc/howto/compile.html).
|
||||
|
||||
## <a id="devtools">4.</a> Development tools
|
||||
ActiveState produces a high quality set of commercial quality development
|
||||
tools that is available to accelerate your Tcl application development.
|
||||
Tcl Dev Kit builds on the earlier TclPro toolset and provides a debugger,
|
||||
static code checker, single-file wrapping utility, bytecode compiler and
|
||||
more. More information can be found at
|
||||
|
||||
http://www.ActiveState.com/Tcl
|
||||
|
||||
## <a id="complangtcl">5.</a> Tcl newsgroup
|
||||
There is a USENET news group, "`comp.lang.tcl`", intended for the exchange of
|
||||
information about Tcl, Tk, and related applications. The newsgroup is a
|
||||
great place to ask general information questions. For bug reports, please
|
||||
see the "Support and bug fixes" section below.
|
||||
|
||||
## <a id="wiki">6.</a> Tcl'ers Wiki
|
||||
There is a [wiki-based open community site](https://wiki.tcl-lang.org/)
|
||||
covering all aspects of Tcl/Tk.
|
||||
|
||||
It is dedicated to the Tcl programming language and its extensions. A
|
||||
wealth of useful information can be found there. It contains code
|
||||
snippets, references to papers, books, and FAQs, as well as pointers to
|
||||
development tools, extensions, and applications. You can also recommend
|
||||
additional URLs by editing the wiki yourself.
|
||||
|
||||
## <a id="email">7.</a> Mailing lists
|
||||
Several mailing lists are hosted at SourceForge to discuss development or use
|
||||
issues (like Macintosh and Windows topics). For more information and to
|
||||
subscribe, visit [here](https://sourceforge.net/projects/tcl/) and go to the
|
||||
Mailing Lists page.
|
||||
|
||||
## <a id="support">8.</a> Support and Training
|
||||
We are very interested in receiving bug reports, patches, and suggestions for
|
||||
improvements. We prefer that you send this information to us as tickets
|
||||
entered into [our issue tracker](https://core.tcl-lang.org/tcl/reportlist).
|
||||
|
||||
We will log and follow-up on each bug, although we cannot promise a
|
||||
specific turn-around time. Enhancements may take longer and may not happen
|
||||
at all unless there is widespread support for them (we're trying to
|
||||
slow the rate at which Tcl/Tk turns into a kitchen sink). It's very
|
||||
difficult to make incompatible changes to Tcl/Tk at this point, due to
|
||||
the size of the installed base.
|
||||
|
||||
The Tcl community is too large for us to provide much individual support for
|
||||
users. If you need help we suggest that you post questions to `comp.lang.tcl`
|
||||
or ask a question on [Stack
|
||||
Overflow](https://stackoverflow.com/questions/tagged/tcl). We read the
|
||||
newsgroup and will attempt to answer esoteric questions for which no one else
|
||||
is likely to know the answer. In addition, see the wiki for [links to other
|
||||
organizations](https://wiki.tcl-lang.org/training) that offer Tcl/Tk training.
|
||||
|
||||
## <a id="watch">9.</a> Tracking Development
|
||||
Tcl is developed in public. You can keep an eye on how Tcl is changing at
|
||||
[core.tcl-lang.org](https://core.tcl-lang.org/).
|
||||
|
||||
## <a id="thanks">10.</a> Thank You
|
||||
We'd like to express our thanks to the Tcl community for all the
|
||||
helpful suggestions, bug reports, and patches we have received.
|
||||
Tcl/Tk has improved vastly and will continue to do so with your help.
|
||||
@@ -8303,7 +8303,7 @@ reported usage of large expressions (porter)
|
||||
|
||||
Many optmizations, improvements, and tightened stack management in bytecode.
|
||||
|
||||
--- Released 8.6.1, September 20, 2013 --- https://core.tcl-lang.org/tcl/ for details
|
||||
--- Released 8.6.1, September 20, 2013 --- http://core.tcl.tk/tcl/ for details
|
||||
|
||||
2013-09-27 (enhancement) improved ::env synchronization (fellows)
|
||||
|
||||
@@ -8451,7 +8451,7 @@ include ::oo::class (fellows)
|
||||
|
||||
2014-08-25 (TIP 429) New command [string cat] (leitgeb,ferrieux)
|
||||
|
||||
--- Released 8.6.2, August 27, 2014 --- https://core.tcl-lang.org/tcl/ for details
|
||||
--- Released 8.6.2, August 27, 2014 --- http://core.tcl.tk/tcl/ for details
|
||||
|
||||
2014-08-28 (bug)[b9e1a3] Correct Method Search Order (nadkarni,fellows)
|
||||
=> TclOO 1.0.3
|
||||
@@ -8491,7 +8491,7 @@ include ::oo::class (fellows)
|
||||
|
||||
2014-11-06 (bug)[5adc35] Stop forcing EOF to be permanent (porter)
|
||||
|
||||
--- Released 8.6.3, November 12, 2014 --- https://core.tcl-lang.org/tcl/ for details
|
||||
--- Released 8.6.3, November 12, 2014 --- http://core.tcl.tk/tcl/ for details
|
||||
|
||||
2014-11-21 (bug)[743338] Win: socket error encoding (ladayaroslav,nijtmans)
|
||||
|
||||
@@ -8527,7 +8527,7 @@ include ::oo::class (fellows)
|
||||
2015-03-10 (enhancement) Revise OS X notifier for better Cocoa (walzer)
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
--- Released 8.6.4, March 12, 2015 --- https://core.tcl-lang.org/tcl/ for details
|
||||
--- Released 8.6.4, March 12, 2015 --- http://core.tcl.tk/tcl/ for details
|
||||
|
||||
2015-03-19 (bug)[e66e44] Win: Ctrl-C/Ctrl-Break in console not EOF (nadkarni)
|
||||
|
||||
@@ -8623,7 +8623,7 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich)
|
||||
|
||||
2016-02-22 (bug)[9b4702] [info exists env(missing)] kills trace (nijtmans)
|
||||
|
||||
--- Released 8.6.5, February 29, 2016 --- https://core.tcl-lang.org/tcl/ for details
|
||||
--- Released 8.6.5, February 29, 2016 --- http://core.tcl.tk/tcl/ for details
|
||||
|
||||
2016-03-01 (bug)[803042] mem leak due to reference cycle (porter)
|
||||
|
||||
@@ -8697,7 +8697,7 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich)
|
||||
|
||||
2016-07-20 tzdata updated to Olson's tzdata2016f (venkat)
|
||||
|
||||
--- Released 8.6.6, July 27, 2016 --- https://core.tcl-lang.org/tcl/ for details
|
||||
--- Released 8.6.6, July 27, 2016 --- http://core.tcl.tk/tcl/ for details
|
||||
|
||||
2016-09-07 (bug)[c09edf] Bad caching with custom resolver (neumann,nijtmans)
|
||||
|
||||
@@ -8794,7 +8794,7 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich)
|
||||
|
||||
2017-07-17 (bug)[fb2208] Repeatable tclIndex generation (wiedemann,nijtmans)
|
||||
|
||||
--- Released 8.6.7, August 9, 2017 --- https://core.tcl-lang.org/tcl/ for details
|
||||
--- Released 8.6.7, August 9, 2017 --- http://core.tcl.tk/tcl/ for details
|
||||
|
||||
2017-08-10 [array names -regexp] supports backrefs (goth)
|
||||
|
||||
@@ -8829,119 +8829,4 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich)
|
||||
|
||||
2017-12-19 (bug)[586e71] EvalObjv exception handling at level #0 (sebres,porter)
|
||||
|
||||
--- Released 8.6.8, December 22, 2017 --- https://core.tcl-lang.org/tcl/ for details
|
||||
|
||||
2018-02-11 (enhance) stop blocking conversion of object to/from class (coulter)
|
||||
|
||||
2018-02-12 (enhance) NR-enable [package require] (coulter)
|
||||
|
||||
2018-02-14 (bug)[9fd5c6] crash in object deletion, test oo-11.5 (coulter)
|
||||
|
||||
2018-02-14 (bug)[3c32a3] crash deleting object with class mixed in (coulter)
|
||||
|
||||
2018-02-15 (platform) stop using -lieee, removed from glibc-2.27 (porter)
|
||||
***POTENTIAL INCOMPATIBILITY for math programs that embed Tcl***
|
||||
|
||||
2018-02-23 (bug)[8e6a9a] bad binary [string match], test string-11.55 (porter)
|
||||
|
||||
2018-03-05 (bug)[1873ea] repair multi-thread std channel init (sebres)
|
||||
|
||||
2018-03-09 (bug)[db36fa] broken bytecode for index values (porter)
|
||||
|
||||
2018-03-13 (bug) broken compiled [string replace], test string-14.19 (porter)
|
||||
|
||||
2018-03-14 (bug) [string trim*] engine crashed on invalid UTF (sebres)
|
||||
|
||||
2018-04-17 (bug) missing trace in compiled [array set], test var-20.11 (porter)
|
||||
|
||||
2018-04-22 (bug)[46a241] crash in unset array with search, var-13.[23] (goth)
|
||||
|
||||
2018-04-30 (bug)[27b682] race made [file delete] raise "no such file" (sebres)
|
||||
|
||||
2018-06-04 (bug)[925643] 32/64 cleanup of filesystem DIR operations (sebres)
|
||||
|
||||
2018-06-18 (bug) leaks in TclSetEnv and env cache (coulter)
|
||||
|
||||
2018-06-24 (bug)[3592747] [yieldto] dying namespace, tailcall-14.1 (coulter)
|
||||
|
||||
2018-07-09 (bug)[270f78] race in [file mkdir] (sebres)
|
||||
|
||||
2018-07-12 (bug)[3f7af0] [file delete] raised "permission denied" (sebres)
|
||||
|
||||
2018-07-26 (bug)[d051b7] overflow crash in [format] (sebres)
|
||||
|
||||
2018-08-29 revised quoting of [exec] args in generated command line (sebres)
|
||||
***POTENTIAL INCOMPATIBILITY***
|
||||
|
||||
2018-09-20 HTTP Keep-Alive with pipelined requests (nash)
|
||||
=> http 2.9.0
|
||||
|
||||
2018-09-27 (new)[TIP 505] [lreplace] accepts all out of range indices (porter)
|
||||
|
||||
2018-10-04 (bug) Prevent crash from NULL keyName (nijtmans)
|
||||
=> registry 1.3.3
|
||||
|
||||
2018-10-26 (enhance) advance dde version (nijtmans)
|
||||
=> dde 1.4.1
|
||||
|
||||
2018-10-27 tzdata updated to Olson's tzdata2018g (jima)
|
||||
|
||||
2018-10-29 Update tcltest package for Travis support (fellows)
|
||||
=> tcltest 2.5.0
|
||||
|
||||
2018-11-09 (bug)[35a8f1] overlong string length of some lists (owens)
|
||||
|
||||
2018-11-16 (bug)[00d04c] Repair [binary encode base64] (sebres)
|
||||
|
||||
- Released 8.6.9, November 16, 2018 - details at http://core.tcl-lang.org/tcl/ -
|
||||
|
||||
2018-11-22 (bug)[7a9dc5] [file normalize ~/~foo] segfault (sebres)
|
||||
|
||||
2018-12-30 (bug)[3cf3a9] variable 'timezone' deprecated in vc2017 (nijtmans)
|
||||
|
||||
2019-01-09 (bug)[cc1e91] [list [list {*}[set a " "]]] regression (sebres)
|
||||
|
||||
2019-02-01 (bug)[e3f481] tests var-1.2[01] (sebres)
|
||||
|
||||
2019-03-01 (new) Update to Unicode 12.0 (nijtmans)
|
||||
|
||||
2019-03-05 (new)[TIP 527] New command [timerate] (sebres)
|
||||
|
||||
2019-03-08 (bug)[39fed4] [package require] memory validity (hume,porter)
|
||||
|
||||
2019-04-23 (new) New command tcl::unsupported::corotype (fellows)
|
||||
|
||||
2019-05-04 (bug) memlink when namespace deletion kills linked var (porter)
|
||||
|
||||
2019-05-28 (new) README file converted to README.md in Markdown (nijtmans)
|
||||
|
||||
2019-06-17 (bug)[8b9854] [info level 0] regression with ensembles (porter)
|
||||
|
||||
2019-06-20 (bug)[6bdadf] crash multi-arg write-traced [lappend] (fellows,porter)
|
||||
|
||||
2019-06-21 (bug)[f8a33c] crash Tcl_Exit before init (brooks,sebres)
|
||||
|
||||
2019-08-27 (bug)[fa6bf3] Bytecode fails epoch recovery at numLevel=0 (sebres)
|
||||
|
||||
2019-08-29 (bug)[fec0c1] C stack overflow compiling bytecode (ade,sebres)
|
||||
|
||||
2019-09-12 tzdata updated to Olson's tzdata2019c (jima)
|
||||
|
||||
2019-09-20 (new) registry/dde no longer need -DUNICODE (nijtmans)
|
||||
=> registry 1.3.4
|
||||
=> dde 1.4.2
|
||||
|
||||
2019-10-02 (bug)[16768d] Fix [info hostname] on NetBSD (rytaro)
|
||||
|
||||
2019-10-23 (new) libtommath updated to release 1.2.0 (nijtmans)
|
||||
|
||||
2019-10-25 OSX: system Tcl deprecated. End default use of its packages. (walzer)
|
||||
|
||||
2019-10-28 (bug)[bcd100] bad fs cache when system encoding changes (coulter)
|
||||
|
||||
2019-11-15 (bug)[135804] segfault in [next] after destroy (coulter,sebres)
|
||||
|
||||
2019-11-18 (bug)[13657a] application/json us text, not binary (noe,nijtmans)
|
||||
=> http 2.9.1
|
||||
|
||||
- Released 8.6.10, Nov 21, 2019 - details at http://core.tcl-lang.org/tcl/ -
|
||||
--- Released 8.6.8, December 22, 2017 --- http://core.tcl.tk/tcl/ for details
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ strtol(
|
||||
*/
|
||||
|
||||
p = string;
|
||||
while (TclIsSpaceProc(*p)) {
|
||||
while (isspace(UCHAR(*p))) {
|
||||
p += 1;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ strtoul(
|
||||
*/
|
||||
|
||||
p = string;
|
||||
while (TclIsSpaceProc(*p)) {
|
||||
while (isspace(UCHAR(*p))) {
|
||||
p += 1;
|
||||
}
|
||||
if (*p == '-') {
|
||||
|
||||
@@ -51,7 +51,7 @@ static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c)
|
||||
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
|
||||
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
|
||||
{
|
||||
int keyshift = (int)((*(pkeys+1)) >> 24);
|
||||
register int keyshift = (int)((*(pkeys+1)) >> 24);
|
||||
(*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
|
||||
}
|
||||
return c;
|
||||
|
||||
@@ -14,11 +14,7 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
||||
#define FTELLO_FUNC(stream) _ftelli64(stream)
|
||||
#define FSEEKO_FUNC(stream, offset, origin) _fseeki64(stream, offset, origin)
|
||||
#elif defined(__APPLE__) || defined(IOAPI_NO_64)
|
||||
#if defined(__APPLE__) || defined(IOAPI_NO_64)
|
||||
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
|
||||
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
||||
#define FTELLO_FUNC(stream) ftello(stream)
|
||||
|
||||
@@ -97,7 +97,7 @@ void change_file_date(filename,dosdate,tmu_date)
|
||||
SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
|
||||
CloseHandle(hFile);
|
||||
#else
|
||||
#if defined(unix) || defined(__APPLE__)
|
||||
#ifdef unix || __APPLE__
|
||||
struct utimbuf ut;
|
||||
struct tm newdate;
|
||||
newdate.tm_sec = tmu_date.tm_sec;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
|
||||
*/
|
||||
|
||||
|
||||
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
|
||||
#ifndef __USE_FILE_OFFSET64
|
||||
#define __USE_FILE_OFFSET64
|
||||
@@ -27,11 +28,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
||||
#define FTELLO_FUNC(stream) _ftelli64(stream)
|
||||
#define FSEEKO_FUNC(stream, offset, origin) _fseeki64(stream, offset, origin)
|
||||
#elif defined(__APPLE__) || defined(IOAPI_NO_64)
|
||||
#ifdef __APPLE__
|
||||
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
|
||||
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
||||
#define FTELLO_FUNC(stream) ftello(stream)
|
||||
@@ -42,7 +39,8 @@
|
||||
#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin)
|
||||
#endif
|
||||
|
||||
#include "tinydir.h"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -74,8 +72,8 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
uLong filetime(f, tmzip, dt)
|
||||
const char *f; /* name of file to get info on */
|
||||
tm_zip *tmzip; /* return value: access, modific. and creation times */
|
||||
char *f; /* name of file to get info on */
|
||||
tm_zip *tmzip; /* return value: access, modific. and creation times */
|
||||
uLong *dt; /* dostime */
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -96,9 +94,9 @@ uLong filetime(f, tmzip, dt)
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
#if defined(unix) || defined(__APPLE__)
|
||||
#ifdef unix || __APPLE__
|
||||
uLong filetime(f, tmzip, dt)
|
||||
const char *f; /* name of file to get info on */
|
||||
char *f; /* name of file to get info on */
|
||||
tm_zip *tmzip; /* return value: access, modific. and creation times */
|
||||
uLong *dt; /* dostime */
|
||||
{
|
||||
@@ -140,8 +138,8 @@ uLong filetime(f, tmzip, dt)
|
||||
}
|
||||
#else
|
||||
uLong filetime(f, tmzip, dt)
|
||||
const char *f; /* name of file to get info on */
|
||||
tm_zip *tmzip; /* return value: access, modific. and creation times */
|
||||
char *f; /* name of file to get info on */
|
||||
tm_zip *tmzip; /* return value: access, modific. and creation times */
|
||||
uLong *dt; /* dostime */
|
||||
{
|
||||
return 0;
|
||||
@@ -174,7 +172,6 @@ void do_banner()
|
||||
void do_help()
|
||||
{
|
||||
printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \
|
||||
" -r Scan directories recursively\n" \
|
||||
" -o Overwrite existing file.zip\n" \
|
||||
" -a Append to existing file.zip\n" \
|
||||
" -0 Store only\n" \
|
||||
@@ -246,153 +243,12 @@ int isLargeFile(const char* filename)
|
||||
return largeFile;
|
||||
}
|
||||
|
||||
void addFileToZip(zipFile zf, const char *filenameinzip, const char *password, int opt_exclude_path,int opt_compress_level) {
|
||||
FILE * fin;
|
||||
int size_read;
|
||||
const char *savefilenameinzip;
|
||||
zip_fileinfo zi;
|
||||
unsigned long crcFile=0;
|
||||
int zip64 = 0;
|
||||
int err=0;
|
||||
int size_buf=WRITEBUFFERSIZE;
|
||||
unsigned char buf[WRITEBUFFERSIZE];
|
||||
zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour =
|
||||
zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0;
|
||||
zi.dosDate = 0;
|
||||
zi.internal_fa = 0;
|
||||
zi.external_fa = 0;
|
||||
filetime(filenameinzip,&zi.tmz_date,&zi.dosDate);
|
||||
|
||||
/*
|
||||
err = zipOpenNewFileInZip(zf,filenameinzip,&zi,
|
||||
NULL,0,NULL,0,NULL / * comment * /,
|
||||
(opt_compress_level != 0) ? Z_DEFLATED : 0,
|
||||
opt_compress_level);
|
||||
*/
|
||||
if ((password != NULL) && (err==ZIP_OK))
|
||||
err = getFileCrc(filenameinzip,buf,size_buf,&crcFile);
|
||||
|
||||
zip64 = isLargeFile(filenameinzip);
|
||||
|
||||
/* The path name saved, should not include a leading slash. */
|
||||
/*if it did, windows/xp and dynazip couldn't read the zip file. */
|
||||
savefilenameinzip = filenameinzip;
|
||||
while( savefilenameinzip[0] == '\\' || savefilenameinzip[0] == '/' )
|
||||
{
|
||||
savefilenameinzip++;
|
||||
}
|
||||
|
||||
/*should the zip file contain any path at all?*/
|
||||
if( opt_exclude_path )
|
||||
{
|
||||
const char *tmpptr;
|
||||
const char *lastslash = 0;
|
||||
for( tmpptr = savefilenameinzip; *tmpptr; tmpptr++)
|
||||
{
|
||||
if( *tmpptr == '\\' || *tmpptr == '/')
|
||||
{
|
||||
lastslash = tmpptr;
|
||||
}
|
||||
}
|
||||
if( lastslash != NULL )
|
||||
{
|
||||
savefilenameinzip = lastslash+1; // base filename follows last slash.
|
||||
}
|
||||
}
|
||||
|
||||
/**/
|
||||
err = zipOpenNewFileInZip3_64(zf,savefilenameinzip,&zi,
|
||||
NULL,0,NULL,0,NULL /* comment*/,
|
||||
(opt_compress_level != 0) ? Z_DEFLATED : 0,
|
||||
opt_compress_level,0,
|
||||
/* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */
|
||||
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
||||
password,crcFile, zip64);
|
||||
|
||||
if (err != ZIP_OK)
|
||||
printf("error in opening %s in zipfile\n",filenameinzip);
|
||||
else
|
||||
{
|
||||
fin = FOPEN_FUNC(filenameinzip,"rb");
|
||||
if (fin==NULL)
|
||||
{
|
||||
err=ZIP_ERRNO;
|
||||
printf("error in opening %s for reading\n",filenameinzip);
|
||||
}
|
||||
}
|
||||
|
||||
if (err == ZIP_OK)
|
||||
do
|
||||
{
|
||||
err = ZIP_OK;
|
||||
size_read = (int)fread(buf,1,size_buf,fin);
|
||||
if (size_read < size_buf)
|
||||
if (feof(fin)==0)
|
||||
{
|
||||
printf("error in reading %s\n",filenameinzip);
|
||||
err = ZIP_ERRNO;
|
||||
}
|
||||
|
||||
if (size_read>0)
|
||||
{
|
||||
err = zipWriteInFileInZip (zf,buf,size_read);
|
||||
if (err<0)
|
||||
{
|
||||
printf("error in writing %s in the zipfile\n",
|
||||
filenameinzip);
|
||||
}
|
||||
|
||||
}
|
||||
} while ((err == ZIP_OK) && (size_read>0));
|
||||
|
||||
if (fin)
|
||||
fclose(fin);
|
||||
|
||||
if (err<0)
|
||||
err=ZIP_ERRNO;
|
||||
else
|
||||
{
|
||||
err = zipCloseFileInZip(zf);
|
||||
if (err!=ZIP_OK)
|
||||
printf("error in closing %s in the zipfile\n",
|
||||
filenameinzip);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void addPathToZip(zipFile zf, const char *filenameinzip, const char *password, int opt_exclude_path,int opt_compress_level) {
|
||||
tinydir_dir dir;
|
||||
int i;
|
||||
char newname[512];
|
||||
|
||||
tinydir_open_sorted(&dir, filenameinzip);
|
||||
|
||||
for (i = 0; i < dir.n_files; i++)
|
||||
{
|
||||
tinydir_file file;
|
||||
tinydir_readfile_n(&dir, &file, i);
|
||||
if(strcmp(file.name,".")==0) continue;
|
||||
if(strcmp(file.name,"..")==0) continue;
|
||||
sprintf(newname,"%s/%s",dir.path,file.name);
|
||||
if (file.is_dir)
|
||||
{
|
||||
addPathToZip(zf,newname,password,opt_exclude_path,opt_compress_level);
|
||||
} else {
|
||||
addFileToZip(zf,newname,password,opt_exclude_path,opt_compress_level);
|
||||
}
|
||||
}
|
||||
|
||||
tinydir_close(&dir);
|
||||
}
|
||||
|
||||
|
||||
int main(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int i;
|
||||
int opt_recursive=0;
|
||||
int opt_overwrite=1;
|
||||
int opt_overwrite=0;
|
||||
int opt_compress_level=Z_DEFAULT_COMPRESSION;
|
||||
int opt_exclude_path=0;
|
||||
int zipfilenamearg = 0;
|
||||
@@ -429,8 +285,7 @@ int main(argc,argv)
|
||||
opt_compress_level = c-'0';
|
||||
if ((c=='j') || (c=='J'))
|
||||
opt_exclude_path = 1;
|
||||
if ((c=='r') || (c=='R'))
|
||||
opt_recursive = 1;
|
||||
|
||||
if (((c=='p') || (c=='P')) && (i+1<argc))
|
||||
{
|
||||
password=argv[i+1];
|
||||
@@ -537,14 +392,117 @@ int main(argc,argv)
|
||||
((argv[i][1]=='o') || (argv[i][1]=='O') ||
|
||||
(argv[i][1]=='a') || (argv[i][1]=='A') ||
|
||||
(argv[i][1]=='p') || (argv[i][1]=='P') ||
|
||||
(argv[i][1]=='r') || (argv[i][1]=='R') ||
|
||||
((argv[i][1]>='0') || (argv[i][1]<='9'))) &&
|
||||
(strlen(argv[i]) == 2)))
|
||||
{
|
||||
if(opt_recursive) {
|
||||
addPathToZip(zf,argv[i],password,opt_exclude_path,opt_compress_level);
|
||||
} else {
|
||||
addFileToZip(zf,argv[i],password,opt_exclude_path,opt_compress_level);
|
||||
FILE * fin;
|
||||
int size_read;
|
||||
const char* filenameinzip = argv[i];
|
||||
const char *savefilenameinzip;
|
||||
zip_fileinfo zi;
|
||||
unsigned long crcFile=0;
|
||||
int zip64 = 0;
|
||||
|
||||
zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour =
|
||||
zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0;
|
||||
zi.dosDate = 0;
|
||||
zi.internal_fa = 0;
|
||||
zi.external_fa = 0;
|
||||
filetime(filenameinzip,&zi.tmz_date,&zi.dosDate);
|
||||
|
||||
/*
|
||||
err = zipOpenNewFileInZip(zf,filenameinzip,&zi,
|
||||
NULL,0,NULL,0,NULL / * comment * /,
|
||||
(opt_compress_level != 0) ? Z_DEFLATED : 0,
|
||||
opt_compress_level);
|
||||
*/
|
||||
if ((password != NULL) && (err==ZIP_OK))
|
||||
err = getFileCrc(filenameinzip,buf,size_buf,&crcFile);
|
||||
|
||||
zip64 = isLargeFile(filenameinzip);
|
||||
|
||||
/* The path name saved, should not include a leading slash. */
|
||||
/*if it did, windows/xp and dynazip couldn't read the zip file. */
|
||||
savefilenameinzip = filenameinzip;
|
||||
while( savefilenameinzip[0] == '\\' || savefilenameinzip[0] == '/' )
|
||||
{
|
||||
savefilenameinzip++;
|
||||
}
|
||||
|
||||
/*should the zip file contain any path at all?*/
|
||||
if( opt_exclude_path )
|
||||
{
|
||||
const char *tmpptr;
|
||||
const char *lastslash = 0;
|
||||
for( tmpptr = savefilenameinzip; *tmpptr; tmpptr++)
|
||||
{
|
||||
if( *tmpptr == '\\' || *tmpptr == '/')
|
||||
{
|
||||
lastslash = tmpptr;
|
||||
}
|
||||
}
|
||||
if( lastslash != NULL )
|
||||
{
|
||||
savefilenameinzip = lastslash+1; // base filename follows last slash.
|
||||
}
|
||||
}
|
||||
|
||||
/**/
|
||||
err = zipOpenNewFileInZip3_64(zf,savefilenameinzip,&zi,
|
||||
NULL,0,NULL,0,NULL /* comment*/,
|
||||
(opt_compress_level != 0) ? Z_DEFLATED : 0,
|
||||
opt_compress_level,0,
|
||||
/* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */
|
||||
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
||||
password,crcFile, zip64);
|
||||
|
||||
if (err != ZIP_OK)
|
||||
printf("error in opening %s in zipfile\n",filenameinzip);
|
||||
else
|
||||
{
|
||||
fin = FOPEN_FUNC(filenameinzip,"rb");
|
||||
if (fin==NULL)
|
||||
{
|
||||
err=ZIP_ERRNO;
|
||||
printf("error in opening %s for reading\n",filenameinzip);
|
||||
}
|
||||
}
|
||||
|
||||
if (err == ZIP_OK)
|
||||
do
|
||||
{
|
||||
err = ZIP_OK;
|
||||
size_read = (int)fread(buf,1,size_buf,fin);
|
||||
if (size_read < size_buf)
|
||||
if (feof(fin)==0)
|
||||
{
|
||||
printf("error in reading %s\n",filenameinzip);
|
||||
err = ZIP_ERRNO;
|
||||
}
|
||||
|
||||
if (size_read>0)
|
||||
{
|
||||
err = zipWriteInFileInZip (zf,buf,size_read);
|
||||
if (err<0)
|
||||
{
|
||||
printf("error in writing %s in the zipfile\n",
|
||||
filenameinzip);
|
||||
}
|
||||
|
||||
}
|
||||
} while ((err == ZIP_OK) && (size_read>0));
|
||||
|
||||
if (fin)
|
||||
fclose(fin);
|
||||
|
||||
if (err<0)
|
||||
err=ZIP_ERRNO;
|
||||
else
|
||||
{
|
||||
err = zipCloseFileInZip(zf);
|
||||
if (err!=ZIP_OK)
|
||||
printf("error in closing %s in the zipfile\n",
|
||||
filenameinzip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-16
@@ -79,9 +79,7 @@ The number of elements in the \fIobjv\fR array.
|
||||
The arguments to the command to create the instance of the class.
|
||||
.AP int skip in
|
||||
The number of arguments at the start of the argument array, \fIobjv\fR, that
|
||||
are not arguments to any constructors. This allows the generation of correct
|
||||
error messages even when complicated calling patterns are used (e.g., via the
|
||||
\fBnext\fR command).
|
||||
are not arguments to any constructors.
|
||||
.AP Tcl_ObjectMetadataType *metaTypePtr in
|
||||
The type of \fImetadata\fR being set with \fBTcl_ClassSetMetadata\fR or
|
||||
retrieved with \fBTcl_ClassGetMetadata\fR.
|
||||
@@ -111,9 +109,7 @@ may be retrieved using the \fBTcl_GetObjectCommand\fR function, the name of
|
||||
the object (and hence the name of the command) with \fBTcl_GetObjectName\fR,
|
||||
and the namespace may be retrieved using the \fBTcl_GetObjectNamespace\fR
|
||||
function. Note that the Tcl_Obj reference returned by \fBTcl_GetObjectName\fR
|
||||
is a shared reference. You can also get whether the object has been marked for
|
||||
deletion with \fBTcl_ObjectDeleted\fR (it returns true if deletion of the
|
||||
object has begun); this can be useful during the processing of methods.
|
||||
is a shared reference.
|
||||
.PP
|
||||
Instances of classes are created using \fBTcl_NewObjectInstance\fR, which
|
||||
creates an object from any class (and which is internally called by both
|
||||
@@ -125,16 +121,6 @@ created object, or NULL if the creation failed (when an error message will be
|
||||
left in the interpreter result). In addition, objects may be copied by using
|
||||
\fBTcl_CopyObjectInstance\fR which creates a copy of an object without running
|
||||
any constructors.
|
||||
.PP
|
||||
Note that the lifetime management of objects is handled internally within
|
||||
TclOO, and does not use \fBTcl_Preserve\fR. \fIIt is not safe to put a
|
||||
Tcl_Object handle in a C structure with a lifespan different to the object;\fR
|
||||
you should use the object's command name (as retrieved with
|
||||
\fBTcl_GetObjectName\fR) instead. It is safe to use a Tcl_Object handle for
|
||||
the lifespan of a call of a method on that object; handles do not become
|
||||
invalid while there is an outstanding call on their object (even if the only
|
||||
operation guaranteed to be safe on them is \fBTcl_ObjectDeleted\fR; the other
|
||||
operations are only guaranteed to work on non-deleted objects).
|
||||
.SH "OBJECT AND CLASS METADATA"
|
||||
.PP
|
||||
Every object and every class may have arbitrary amounts of metadata attached
|
||||
|
||||
+1
-1
@@ -277,7 +277,7 @@ If an error occurs while opening the channel, \fBTcl_OpenCommandChannel\fR
|
||||
returns NULL and records a POSIX error code that can be retrieved with
|
||||
\fBTcl_GetErrno\fR.
|
||||
In addition, \fBTcl_OpenCommandChannel\fR leaves an error message in
|
||||
the interpreter's result. \fIinterp\fR cannot be NULL.
|
||||
the interpreter's result if \fIinterp\fR is not NULL.
|
||||
.PP
|
||||
The newly created channel is not registered in the supplied interpreter; to
|
||||
register it, use \fBTcl_RegisterChannel\fR, described below.
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
'\"
|
||||
.TH Tcl_ParseArgsObjv 3 8.6 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
@@ -103,8 +103,8 @@ the argument's value. The following values are acceptable values for
|
||||
\fBTCL_ARGV_CONSTANT\fR
|
||||
.
|
||||
The argument does not take any following value argument. If this argument is
|
||||
present, the (integer) value of the \fIsrcPtr\fR field is copied to the variable
|
||||
pointed to by the \fIdstPtr\fR field. The \fIclientData\fR field is ignored.
|
||||
present, the int pointed to by the \fIsrcPtr\fR field is copied to the
|
||||
\fIdstPtr\fR field. The \fIclientData\fR field is ignored.
|
||||
.TP
|
||||
\fBTCL_ARGV_END\fR
|
||||
.
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ Points to the first byte of an array of UTF-8-encoded bytes
|
||||
used to set or append to a string value.
|
||||
This byte array may contain embedded null characters
|
||||
unless \fInumChars\fR is negative. (Applications needing null bytes
|
||||
should represent them as the two-byte sequence \fI\e300\e200\fR, use
|
||||
should represent them as the two-byte sequence \fI\e700\e600\fR, use
|
||||
\fBTcl_ExternalToUtf\fR to convert, or \fBTcl_NewByteArrayObj\fR if
|
||||
the string is a collection of uninterpreted bytes.)
|
||||
.AP int length in
|
||||
|
||||
+3
-4
@@ -80,10 +80,9 @@ and all following characters into their lower-case equivalents.
|
||||
|
||||
.SH BUGS
|
||||
.PP
|
||||
At this time, the case conversions are only defined for the Unicode
|
||||
plane 0 characters. The result for Unicode characters above 0xffff
|
||||
is undefined, but - actually - only the lower 16 bits of the
|
||||
character value is handled.
|
||||
At this time, the case conversions are only defined for the ISO8859-1
|
||||
characters. Unicode characters above 0x00ff are not modified by these
|
||||
routines.
|
||||
|
||||
.SH KEYWORDS
|
||||
utf, unicode, toupper, tolower, totitle, case
|
||||
|
||||
+4
-4
@@ -331,11 +331,11 @@ trace procedures will always be invoked.
|
||||
.SH "RESTRICTIONS"
|
||||
.PP
|
||||
A trace procedure can be called at any time, even when there
|
||||
are partially formed results stored in the interpreter. If
|
||||
is a partially formed result in the interpreter's result area. If
|
||||
the trace procedure does anything that could damage this result (such
|
||||
as calling \fBTcl_Eval\fR) then it must use the \fBTcl_SaveInterpState\fR
|
||||
and related routines to save and restore the original state of
|
||||
the interpreter before it returns.
|
||||
as calling \fBTcl_Eval\fR) then it must save the original values of
|
||||
the interpreter's \fBresult\fR and \fBfreeProc\fR fields and restore
|
||||
them before it returns.
|
||||
.SH "UNDEFINED VARIABLES"
|
||||
.PP
|
||||
It is legal to set a trace on an undefined variable.
|
||||
|
||||
+6
-12
@@ -55,8 +55,7 @@ string, the constructor will be deleted.
|
||||
This deletes each of the methods called \fIname\fR from a class. The methods
|
||||
must have previously existed in that class. Does not affect the superclasses
|
||||
of the class, nor does it affect the subclasses or instances of the class
|
||||
(except when they have a call chain through the class being modified) or the
|
||||
class object itself.
|
||||
(except when they have a call chain through the class being modified).
|
||||
.TP
|
||||
\fBdestructor\fI bodyScript\fR
|
||||
.
|
||||
@@ -136,8 +135,7 @@ This renames the method called \fIfromName\fR in a class to \fItoName\fR. The
|
||||
method must have previously existed in the class, and \fItoName\fR must not
|
||||
previously refer to a method in that class. Does not affect the superclasses
|
||||
of the class, nor does it affect the subclasses or instances of the class
|
||||
(except when they have a call chain through the class being modified), or the
|
||||
class object itself. Does
|
||||
(except when they have a call chain through the class being modified). Does
|
||||
not change the export status of the method; if it was exported before, it will
|
||||
be afterwards.
|
||||
.TP
|
||||
@@ -205,10 +203,8 @@ well be in an inconsistent state unless additional configuration work is done.
|
||||
\fBdeletemethod\fI name\fR ?\fIname ...\fR
|
||||
.
|
||||
This deletes each of the methods called \fIname\fR from an object. The methods
|
||||
must have previously existed in that object (e.g., because it was created
|
||||
through \fBoo::objdefine method\fR). Does not affect the classes that the
|
||||
object is an instance of, or remove the exposure of those class-provided
|
||||
methods in the instance of that class.
|
||||
must have previously existed in that object. Does not affect the classes that
|
||||
the object is an instance of.
|
||||
.TP
|
||||
\fBexport\fI name \fR?\fIname ...\fR?
|
||||
.
|
||||
@@ -266,10 +262,8 @@ By default, this slot works by replacement.
|
||||
This renames the method called \fIfromName\fR in an object to \fItoName\fR.
|
||||
The method must have previously existed in the object, and \fItoName\fR must
|
||||
not previously refer to a method in that object. Does not affect the classes
|
||||
that the object is an instance of and cannot rename in an instance object the
|
||||
methods provided by those classes (though a \fBoo::objdefine forward\fRed
|
||||
method may provide an equivalent capability). Does not change the export
|
||||
status of the method; if it was exported before, it will be afterwards.
|
||||
that the object is an instance of. Does not change the export status of the
|
||||
method; if it was exported before, it will be afterwards.
|
||||
.TP
|
||||
\fBunexport\fI name \fR?\fIname ...\fR?
|
||||
.
|
||||
|
||||
+7
-31
@@ -106,7 +106,7 @@ Then the command on the left side of each of the lines below
|
||||
will produce the value on the right side of the line:
|
||||
.PP
|
||||
.CS
|
||||
.ta 9c
|
||||
.ta 6c
|
||||
\fBexpr\fR 3.1 + $a \fI6.1\fR
|
||||
\fBexpr\fR 2 + "$a.$b" \fI5.6\fR
|
||||
\fBexpr\fR 4*[llength "6 2"] \fI8\fR
|
||||
@@ -126,8 +126,7 @@ applied only to integers.
|
||||
.TP 20
|
||||
\fB**\fR
|
||||
.
|
||||
Exponentiation. Valid for any numeric operands. The maximum exponent value
|
||||
that Tcl can handle if the first number is an integer > 1 is 268435455.
|
||||
Exponentiation. Valid for any numeric operands.
|
||||
.TP 20
|
||||
\fB*\0\0/\0\0%\fR
|
||||
.
|
||||
@@ -201,23 +200,18 @@ Bit-wise OR. Valid for integer operands only.
|
||||
Logical AND. Produces a 1 result if both operands are non-zero,
|
||||
0 otherwise.
|
||||
Valid for boolean and numeric (integers or floating-point) operands only.
|
||||
This operator evaluates lazily; it only evaluates its second operand if it
|
||||
must in order to determine its result.
|
||||
.TP 20
|
||||
\fB||\fR
|
||||
.
|
||||
Logical OR. Produces a 0 result if both operands are zero, 1 otherwise.
|
||||
Valid for boolean and numeric (integers or floating-point) operands only.
|
||||
This operator evaluates lazily; it only evaluates its second operand if it
|
||||
must in order to determine its result.
|
||||
.TP 20
|
||||
\fIx \fB?\fI y \fB:\fI z\fR
|
||||
\fIx\fB?\fIy\fB:\fIz\fR
|
||||
.
|
||||
If-then-else, as in C. If \fIx\fR
|
||||
evaluates to non-zero, then the result is the value of \fIy\fR.
|
||||
Otherwise the result is the value of \fIz\fR.
|
||||
The \fIx\fR operand must have a boolean or numeric value.
|
||||
This operator evaluates lazily; it evaluates only one of \fIy\fR or \fIz\fR.
|
||||
.PP
|
||||
See the C manual for more details on the results
|
||||
produced by each operator.
|
||||
@@ -227,7 +221,6 @@ of the \fBpow\fR function (after any type conversions.)
|
||||
All of the binary operators but exponentiation group left-to-right
|
||||
within the same precedence level; exponentiation groups right-to-left. For example, the command
|
||||
.PP
|
||||
.PP
|
||||
.CS
|
||||
\fBexpr\fR {4*2 < 7}
|
||||
.CE
|
||||
@@ -265,7 +258,7 @@ before invoking the \fBexpr\fR command.
|
||||
.PP
|
||||
When the expression parser encounters a mathematical function
|
||||
such as \fBsin($x)\fR, it replaces it with a call to an ordinary
|
||||
Tcl command in the \fBtcl::mathfunc\fR namespace. The processing
|
||||
Tcl function in the \fBtcl::mathfunc\fR namespace. The processing
|
||||
of an expression such as:
|
||||
.PP
|
||||
.CS
|
||||
@@ -397,11 +390,9 @@ set b {$a + 2}
|
||||
.CE
|
||||
.PP
|
||||
return 11, not a multiple of 4.
|
||||
This is because the Tcl parser will first substitute
|
||||
.QW "\fB$a + 2\fR"
|
||||
for the variable \fBb\fR,
|
||||
then the \fBexpr\fR command will evaluate the expression
|
||||
.QW "\fB$a + 2*4\fR" .
|
||||
This is because the Tcl parser will first substitute \fB$a + 2\fR for
|
||||
the variable \fBb\fR,
|
||||
then the \fBexpr\fR command will evaluate the expression \fB$a + 2*4\fR.
|
||||
.PP
|
||||
Most expressions do not require a second round of substitutions.
|
||||
Either they are enclosed in braces or, if not,
|
||||
@@ -415,21 +406,6 @@ The most expensive code is required for
|
||||
unbraced expressions that contain command substitutions.
|
||||
These expressions must be implemented by generating new code
|
||||
each time the expression is executed.
|
||||
.PP
|
||||
If it is necessary to include a non-constant expression string within the
|
||||
wider context of an otherwise-constant expression, the most efficient
|
||||
technique is to put the varying part inside a recursive \fBexpr\fR, as this at
|
||||
least allows for the compilation of the outer part, though it does mean that
|
||||
the varying part must itself be evaluated as a separate expression. Thus, in
|
||||
this example the result is 20 and the outer expression benefits from fully
|
||||
cached bytecode compilation.
|
||||
.PP
|
||||
.CS
|
||||
set a 3
|
||||
set b {$a + 2}
|
||||
\fBexpr\fR {[\fBexpr\fR $b] * 4}
|
||||
.CE
|
||||
.PP
|
||||
When the expression is unbraced to allow the substitution of a function or
|
||||
operator, consider using the commands documented in the \fBmathfunc\fR(n) or
|
||||
\fBmathop\fR(n) manual pages directly instead.
|
||||
|
||||
+1
-1
@@ -201,7 +201,7 @@ slave interpreter identified by \fIpath\fR. If no arguments are
|
||||
given, option and current setting are returned. If \fB\-frame\fR
|
||||
is given, the debug setting is set to the given boolean if provided
|
||||
and the current setting is returned.
|
||||
This only affects the output of \fBinfo frame\fR, in that exact
|
||||
This only effects the output of \fBinfo frame\fR, in that exact
|
||||
frame-level information for command invocation at the bytecode level
|
||||
is only captured with this setting on.
|
||||
.RS
|
||||
|
||||
+4
-5
@@ -151,11 +151,10 @@ is the same as
|
||||
.QW "\fB** 2 [** 3 4]\fR" .
|
||||
Each \fInumber\fR may be
|
||||
any numeric value, though the second number must not be fractional if the
|
||||
first is negative. The maximum exponent value that Tcl can handle if the
|
||||
first number is an integer > 1 is 268435455. If no arguments are given,
|
||||
the result will be one, and if only one argument is given, the result will
|
||||
be that argument. The result will have an integral value only when all
|
||||
arguments are integral values.
|
||||
first is negative. If no arguments are given, the result will be one, and if
|
||||
only one argument is given, the result will be that argument. The
|
||||
result will have an integral value only when all arguments are
|
||||
integral values.
|
||||
.SS "COMPARISON OPERATORS"
|
||||
.PP
|
||||
The behaviors of the comparison operator commands (most of which operate
|
||||
|
||||
+3
-3
@@ -333,21 +333,21 @@ specified using the forms described in \fBSTRING INDICES\fR.
|
||||
Returns a value equal to \fIstring\fR except that any leading or
|
||||
trailing characters present in the string given by \fIchars\fR are removed. If
|
||||
\fIchars\fR is not specified then white space is removed (any character
|
||||
for which \fBstring is space\fR returns 1, and "\e0").
|
||||
for which \fBstring is space\fR returns 1, and "\0").
|
||||
.TP
|
||||
\fBstring trimleft \fIstring\fR ?\fIchars\fR?
|
||||
.
|
||||
Returns a value equal to \fIstring\fR except that any leading
|
||||
characters present in the string given by \fIchars\fR are removed. If
|
||||
\fIchars\fR is not specified then white space is removed (any character
|
||||
for which \fBstring is space\fR returns 1, and "\e0").
|
||||
for which \fBstring is space\fR returns 1, and "\0").
|
||||
.TP
|
||||
\fBstring trimright \fIstring\fR ?\fIchars\fR?
|
||||
.
|
||||
Returns a value equal to \fIstring\fR except that any trailing
|
||||
characters present in the string given by \fIchars\fR are removed. If
|
||||
\fIchars\fR is not specified then white space is removed (any character
|
||||
for which \fBstring is space\fR returns 1, and "\e0").
|
||||
for which \fBstring is space\fR returns 1, and "\0").
|
||||
.SS "OBSOLETE SUBCOMMANDS"
|
||||
.PP
|
||||
These subcommands are currently supported, but are likely to go away in a
|
||||
|
||||
-146
@@ -1,146 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 2005 Sergey Brester aka sebres.
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH timerate n "" Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
timerate \- Calibrated performance measurements of script execution time
|
||||
.SH SYNOPSIS
|
||||
\fBtimerate \fIscript\fR ?\fItime\fR? ?\fImax-count\fR?
|
||||
.sp
|
||||
\fBtimerate \fR?\fB\-direct\fR? ?\fB\-overhead\fI double\fR? \fIscript\fR ?\fItime\fR? ?\fImax-count\fR?
|
||||
.sp
|
||||
\fBtimerate \fR?\fB\-calibrate\fR? ?\fB\-direct\fR? \fIscript\fR ?\fItime\fR? ?\fImax-count\fR?
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The \fBtimerate\fR command does calibrated performance measurement of a Tcl
|
||||
command or script, \fIscript\fR. The \fIscript\fR should be written so that it
|
||||
can be executed multiple times during the performance measurement process.
|
||||
Time is measured in elapsed time using the finest timer resolution as possible,
|
||||
not CPU time; if \fIscript\fR interacts with the OS, the cost of that
|
||||
interaction is included.
|
||||
This command may be used to provide information as to how well a script or
|
||||
Tcl command is performing, and can help determine bottlenecks and fine-tune
|
||||
application performance.
|
||||
.PP
|
||||
The first and second form will evaluate \fIscript\fR until the interval
|
||||
\fItime\fR given in milliseconds elapses, or for 1000 milliseconds (1 second)
|
||||
if \fItime\fR is not specified.
|
||||
.sp
|
||||
The parameter \fImax-count\fR could additionally impose a further restriction
|
||||
by the maximal number of iterations to evaluate the script.
|
||||
If \fImax-count\fR is specified, the evalution will stop either this count of
|
||||
iterations is reached or the time is exceeded.
|
||||
.sp
|
||||
It will then return a canonical tcl-list of the form:
|
||||
.PP
|
||||
.CS
|
||||
\fB0.095977 \(mcs/# 52095836 # 10419167 #/sec 5000.000 net-ms\fR
|
||||
.CE
|
||||
.PP
|
||||
which indicates:
|
||||
.IP \(bu 3
|
||||
the average amount of time required per iteration, in microseconds ([\fBlindex\fR $result 0])
|
||||
.IP \(bu 3
|
||||
the count how many times it was executed ([\fBlindex\fR $result 2])
|
||||
.IP \(bu 3
|
||||
the estimated rate per second ([\fBlindex\fR $result 4])
|
||||
.IP \(bu 3
|
||||
the estimated real execution time without measurement overhead ([\fBlindex\fR $result 6])
|
||||
.PP
|
||||
The following options may be supplied to the \fBtimerate\fR command:
|
||||
.TP
|
||||
\fB\-calibrate\fR
|
||||
.
|
||||
To measure very fast scripts as exactly as possible, a calibration process
|
||||
may be required.
|
||||
The \fB\-calibrate\fR option is used to calibrate \fBtimerate\fR itself,
|
||||
calculating the estimated overhead of the given script as the default overhead
|
||||
for future invocations of the \fBtimerate\fR command. If the \fItime\fR
|
||||
parameter is not specified, the calibrate procedure runs for up to 10 seconds.
|
||||
.RS
|
||||
.PP
|
||||
Note that calibration is not thread safe in the current implementation.
|
||||
.RE
|
||||
.TP
|
||||
\fB\-overhead \fIdouble\fR
|
||||
.
|
||||
The \fB\-overhead\fR parameter supplies an estimate (in microseconds) of the
|
||||
measurement overhead of each iteration of the tested script. This quantity
|
||||
will be subtracted from the measured time prior to reporting results. This can
|
||||
be useful for removing the cost of interpreter state reset commands from the
|
||||
script being measured.
|
||||
.TP
|
||||
\fB\-direct\fR
|
||||
.
|
||||
The \fB-direct\fR option causes direct execution of the supplied script,
|
||||
without compilation, in a manner similar to the \fBtime\fR command. It can be
|
||||
used to measure the cost of \fBTcl_EvalObjEx\fR, of the invocation of canonical
|
||||
lists, and of the uncompiled versions of bytecoded commands.
|
||||
.PP
|
||||
As opposed to the \fBtime\fR commmand, which runs the tested script for a fixed
|
||||
number of iterations, the timerate command runs it for a fixed time.
|
||||
Additionally, the compiled variant of the script will be used during the entire
|
||||
measurement, as if the script were part of a compiled procedure, if the \fB\-direct\fR
|
||||
option is not specified. The fixed time period and possibility of compilation allow
|
||||
for more precise results and prevent very long execution times by slow scripts, making
|
||||
it practical for measuring scripts with highly uncertain execution times.
|
||||
.SH EXAMPLES
|
||||
Estimate how fast it takes for a simple Tcl \fBfor\fR loop (including
|
||||
operations on variable \fIi\fR) to count to ten:
|
||||
.PP
|
||||
.CS
|
||||
\fI# calibrate\fR
|
||||
\fBtimerate\fR -calibrate {}
|
||||
|
||||
\fI# measure\fR
|
||||
\fBtimerate\fR { for {set i 0} {$i<10} {incr i} {} } 5000
|
||||
.CE
|
||||
.PP
|
||||
Estimate how fast it takes for a simple Tcl \fBfor\fR loop, ignoring the
|
||||
overhead of the management of the variable that controls the loop:
|
||||
.PP
|
||||
.CS
|
||||
\fI# calibrate for overhead of variable operations\fR
|
||||
set i 0; \fBtimerate\fR -calibrate {expr {$i<10}; incr i} 1000
|
||||
|
||||
\fI# measure\fR
|
||||
\fBtimerate\fR {
|
||||
for {set i 0} {$i<10} {incr i} {}
|
||||
} 5000
|
||||
.CE
|
||||
.PP
|
||||
Estimate the speed of calculating the hour of the day using \fBclock format\fR only,
|
||||
ignoring overhead of the portion of the script that prepares the time for it to
|
||||
calculate:
|
||||
.PP
|
||||
.CS
|
||||
\fI# calibrate\fR
|
||||
\fBtimerate\fR -calibrate {}
|
||||
|
||||
\fI# estimate overhead\fR
|
||||
set tm 0
|
||||
set ovh [lindex [\fBtimerate\fR {
|
||||
incr tm [expr {24*60*60}]
|
||||
}] 0]
|
||||
|
||||
\fI# measure using estimated overhead\fR
|
||||
set tm 0
|
||||
\fBtimerate\fR -overhead $ovh {
|
||||
clock format $tm -format %H
|
||||
incr tm [expr {24*60*60}]; # overhead for this is ignored
|
||||
} 5000
|
||||
.CE
|
||||
.SH "SEE ALSO"
|
||||
time(n)
|
||||
.SH KEYWORDS
|
||||
performance measurement, script, time
|
||||
.\" Local Variables:
|
||||
.\" mode: nroff
|
||||
.\" End:
|
||||
+3
-1
@@ -905,7 +905,9 @@ lexescape(
|
||||
|
||||
v->now = save;
|
||||
|
||||
/* FALLTHRU */
|
||||
/*
|
||||
* And fall through into octal number.
|
||||
*/
|
||||
|
||||
case CHR('0'):
|
||||
NOTE(REG_UUNPORT);
|
||||
|
||||
+161
-166
@@ -153,46 +153,46 @@ static const crange alphaRangeTable[] = {
|
||||
{0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xd05, 0xd0c},
|
||||
{0xd0e, 0xd10}, {0xd12, 0xd3a}, {0xd54, 0xd56}, {0xd5f, 0xd61},
|
||||
{0xd7a, 0xd7f}, {0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb},
|
||||
{0xdc0, 0xdc6}, {0xe01, 0xe30}, {0xe40, 0xe46}, {0xe86, 0xe8a},
|
||||
{0xe8c, 0xea3}, {0xea7, 0xeb0}, {0xec0, 0xec4}, {0xedc, 0xedf},
|
||||
{0xf40, 0xf47}, {0xf49, 0xf6c}, {0xf88, 0xf8c}, {0x1000, 0x102a},
|
||||
{0x1050, 0x1055}, {0x105a, 0x105d}, {0x106e, 0x1070}, {0x1075, 0x1081},
|
||||
{0x10a0, 0x10c5}, {0x10d0, 0x10fa}, {0x10fc, 0x1248}, {0x124a, 0x124d},
|
||||
{0x1250, 0x1256}, {0x125a, 0x125d}, {0x1260, 0x1288}, {0x128a, 0x128d},
|
||||
{0x1290, 0x12b0}, {0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c2, 0x12c5},
|
||||
{0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135a},
|
||||
{0x1380, 0x138f}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd}, {0x1401, 0x166c},
|
||||
{0x166f, 0x167f}, {0x1681, 0x169a}, {0x16a0, 0x16ea}, {0x16f1, 0x16f8},
|
||||
{0x1700, 0x170c}, {0x170e, 0x1711}, {0x1720, 0x1731}, {0x1740, 0x1751},
|
||||
{0x1760, 0x176c}, {0x176e, 0x1770}, {0x1780, 0x17b3}, {0x1820, 0x1878},
|
||||
{0x1880, 0x1884}, {0x1887, 0x18a8}, {0x18b0, 0x18f5}, {0x1900, 0x191e},
|
||||
{0x1950, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab}, {0x19b0, 0x19c9},
|
||||
{0x1a00, 0x1a16}, {0x1a20, 0x1a54}, {0x1b05, 0x1b33}, {0x1b45, 0x1b4b},
|
||||
{0x1b83, 0x1ba0}, {0x1bba, 0x1be5}, {0x1c00, 0x1c23}, {0x1c4d, 0x1c4f},
|
||||
{0x1c5a, 0x1c7d}, {0x1c80, 0x1c88}, {0x1c90, 0x1cba}, {0x1cbd, 0x1cbf},
|
||||
{0x1ce9, 0x1cec}, {0x1cee, 0x1cf3}, {0x1d00, 0x1dbf}, {0x1e00, 0x1f15},
|
||||
{0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, {0x1f50, 0x1f57},
|
||||
{0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc}, {0x1fc2, 0x1fc4},
|
||||
{0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec},
|
||||
{0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc}, {0x2090, 0x209c}, {0x210a, 0x2113},
|
||||
{0x2119, 0x211d}, {0x212a, 0x212d}, {0x212f, 0x2139}, {0x213c, 0x213f},
|
||||
{0x2145, 0x2149}, {0x2c00, 0x2c2e}, {0x2c30, 0x2c5e}, {0x2c60, 0x2ce4},
|
||||
{0x2ceb, 0x2cee}, {0x2d00, 0x2d25}, {0x2d30, 0x2d67}, {0x2d80, 0x2d96},
|
||||
{0x2da0, 0x2da6}, {0x2da8, 0x2dae}, {0x2db0, 0x2db6}, {0x2db8, 0x2dbe},
|
||||
{0x2dc0, 0x2dc6}, {0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde},
|
||||
{0x3031, 0x3035}, {0x3041, 0x3096}, {0x309d, 0x309f}, {0x30a1, 0x30fa},
|
||||
{0x30fc, 0x30ff}, {0x3105, 0x312f}, {0x3131, 0x318e}, {0x31a0, 0x31ba},
|
||||
{0x31f0, 0x31ff}, {0x3400, 0x4db5}, {0x4e00, 0x9fef}, {0xa000, 0xa48c},
|
||||
{0xa4d0, 0xa4fd}, {0xa500, 0xa60c}, {0xa610, 0xa61f}, {0xa640, 0xa66e},
|
||||
{0xa67f, 0xa69d}, {0xa6a0, 0xa6e5}, {0xa717, 0xa71f}, {0xa722, 0xa788},
|
||||
{0xa78b, 0xa7bf}, {0xa7c2, 0xa7c6}, {0xa7f7, 0xa801}, {0xa803, 0xa805},
|
||||
{0xdc0, 0xdc6}, {0xe01, 0xe30}, {0xe40, 0xe46}, {0xe94, 0xe97},
|
||||
{0xe99, 0xe9f}, {0xea1, 0xea3}, {0xead, 0xeb0}, {0xec0, 0xec4},
|
||||
{0xedc, 0xedf}, {0xf40, 0xf47}, {0xf49, 0xf6c}, {0xf88, 0xf8c},
|
||||
{0x1000, 0x102a}, {0x1050, 0x1055}, {0x105a, 0x105d}, {0x106e, 0x1070},
|
||||
{0x1075, 0x1081}, {0x10a0, 0x10c5}, {0x10d0, 0x10fa}, {0x10fc, 0x1248},
|
||||
{0x124a, 0x124d}, {0x1250, 0x1256}, {0x125a, 0x125d}, {0x1260, 0x1288},
|
||||
{0x128a, 0x128d}, {0x1290, 0x12b0}, {0x12b2, 0x12b5}, {0x12b8, 0x12be},
|
||||
{0x12c2, 0x12c5}, {0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315},
|
||||
{0x1318, 0x135a}, {0x1380, 0x138f}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd},
|
||||
{0x1401, 0x166c}, {0x166f, 0x167f}, {0x1681, 0x169a}, {0x16a0, 0x16ea},
|
||||
{0x16f1, 0x16f8}, {0x1700, 0x170c}, {0x170e, 0x1711}, {0x1720, 0x1731},
|
||||
{0x1740, 0x1751}, {0x1760, 0x176c}, {0x176e, 0x1770}, {0x1780, 0x17b3},
|
||||
{0x1820, 0x1878}, {0x1880, 0x1884}, {0x1887, 0x18a8}, {0x18b0, 0x18f5},
|
||||
{0x1900, 0x191e}, {0x1950, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab},
|
||||
{0x19b0, 0x19c9}, {0x1a00, 0x1a16}, {0x1a20, 0x1a54}, {0x1b05, 0x1b33},
|
||||
{0x1b45, 0x1b4b}, {0x1b83, 0x1ba0}, {0x1bba, 0x1be5}, {0x1c00, 0x1c23},
|
||||
{0x1c4d, 0x1c4f}, {0x1c5a, 0x1c7d}, {0x1c80, 0x1c88}, {0x1c90, 0x1cba},
|
||||
{0x1cbd, 0x1cbf}, {0x1ce9, 0x1cec}, {0x1cee, 0x1cf1}, {0x1d00, 0x1dbf},
|
||||
{0x1e00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, {0x1f48, 0x1f4d},
|
||||
{0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc},
|
||||
{0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3}, {0x1fd6, 0x1fdb},
|
||||
{0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc}, {0x2090, 0x209c},
|
||||
{0x210a, 0x2113}, {0x2119, 0x211d}, {0x212a, 0x212d}, {0x212f, 0x2139},
|
||||
{0x213c, 0x213f}, {0x2145, 0x2149}, {0x2c00, 0x2c2e}, {0x2c30, 0x2c5e},
|
||||
{0x2c60, 0x2ce4}, {0x2ceb, 0x2cee}, {0x2d00, 0x2d25}, {0x2d30, 0x2d67},
|
||||
{0x2d80, 0x2d96}, {0x2da0, 0x2da6}, {0x2da8, 0x2dae}, {0x2db0, 0x2db6},
|
||||
{0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6}, {0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6},
|
||||
{0x2dd8, 0x2dde}, {0x3031, 0x3035}, {0x3041, 0x3096}, {0x309d, 0x309f},
|
||||
{0x30a1, 0x30fa}, {0x30fc, 0x30ff}, {0x3105, 0x312f}, {0x3131, 0x318e},
|
||||
{0x31a0, 0x31ba}, {0x31f0, 0x31ff}, {0x3400, 0x4db5}, {0x4e00, 0x9fef},
|
||||
{0xa000, 0xa48c}, {0xa4d0, 0xa4fd}, {0xa500, 0xa60c}, {0xa610, 0xa61f},
|
||||
{0xa640, 0xa66e}, {0xa67f, 0xa69d}, {0xa6a0, 0xa6e5}, {0xa717, 0xa71f},
|
||||
{0xa722, 0xa788}, {0xa78b, 0xa7b9}, {0xa7f7, 0xa801}, {0xa803, 0xa805},
|
||||
{0xa807, 0xa80a}, {0xa80c, 0xa822}, {0xa840, 0xa873}, {0xa882, 0xa8b3},
|
||||
{0xa8f2, 0xa8f7}, {0xa90a, 0xa925}, {0xa930, 0xa946}, {0xa960, 0xa97c},
|
||||
{0xa984, 0xa9b2}, {0xa9e0, 0xa9e4}, {0xa9e6, 0xa9ef}, {0xa9fa, 0xa9fe},
|
||||
{0xaa00, 0xaa28}, {0xaa40, 0xaa42}, {0xaa44, 0xaa4b}, {0xaa60, 0xaa76},
|
||||
{0xaa7e, 0xaaaf}, {0xaab9, 0xaabd}, {0xaadb, 0xaadd}, {0xaae0, 0xaaea},
|
||||
{0xaaf2, 0xaaf4}, {0xab01, 0xab06}, {0xab09, 0xab0e}, {0xab11, 0xab16},
|
||||
{0xab20, 0xab26}, {0xab28, 0xab2e}, {0xab30, 0xab5a}, {0xab5c, 0xab67},
|
||||
{0xab20, 0xab26}, {0xab28, 0xab2e}, {0xab30, 0xab5a}, {0xab5c, 0xab65},
|
||||
{0xab70, 0xabe2}, {0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb},
|
||||
{0xf900, 0xfa6d}, {0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17},
|
||||
{0xfb1f, 0xfb28}, {0xfb2a, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb46, 0xfbb1},
|
||||
@@ -213,22 +213,21 @@ static const crange alphaRangeTable[] = {
|
||||
{0x10a80, 0x10a9c}, {0x10ac0, 0x10ac7}, {0x10ac9, 0x10ae4}, {0x10b00, 0x10b35},
|
||||
{0x10b40, 0x10b55}, {0x10b60, 0x10b72}, {0x10b80, 0x10b91}, {0x10c00, 0x10c48},
|
||||
{0x10c80, 0x10cb2}, {0x10cc0, 0x10cf2}, {0x10d00, 0x10d23}, {0x10f00, 0x10f1c},
|
||||
{0x10f30, 0x10f45}, {0x10fe0, 0x10ff6}, {0x11003, 0x11037}, {0x11083, 0x110af},
|
||||
{0x110d0, 0x110e8}, {0x11103, 0x11126}, {0x11150, 0x11172}, {0x11183, 0x111b2},
|
||||
{0x111c1, 0x111c4}, {0x11200, 0x11211}, {0x11213, 0x1122b}, {0x11280, 0x11286},
|
||||
{0x1128a, 0x1128d}, {0x1128f, 0x1129d}, {0x1129f, 0x112a8}, {0x112b0, 0x112de},
|
||||
{0x11305, 0x1130c}, {0x11313, 0x11328}, {0x1132a, 0x11330}, {0x11335, 0x11339},
|
||||
{0x1135d, 0x11361}, {0x11400, 0x11434}, {0x11447, 0x1144a}, {0x11480, 0x114af},
|
||||
{0x11580, 0x115ae}, {0x115d8, 0x115db}, {0x11600, 0x1162f}, {0x11680, 0x116aa},
|
||||
{0x11700, 0x1171a}, {0x11800, 0x1182b}, {0x118a0, 0x118df}, {0x119a0, 0x119a7},
|
||||
{0x119aa, 0x119d0}, {0x11a0b, 0x11a32}, {0x11a5c, 0x11a89}, {0x11ac0, 0x11af8},
|
||||
{0x11c00, 0x11c08}, {0x11c0a, 0x11c2e}, {0x11c72, 0x11c8f}, {0x11d00, 0x11d06},
|
||||
{0x11d0b, 0x11d30}, {0x11d60, 0x11d65}, {0x11d6a, 0x11d89}, {0x11ee0, 0x11ef2},
|
||||
{0x12000, 0x12399}, {0x12480, 0x12543}, {0x13000, 0x1342e}, {0x14400, 0x14646},
|
||||
{0x16800, 0x16a38}, {0x16a40, 0x16a5e}, {0x16ad0, 0x16aed}, {0x16b00, 0x16b2f},
|
||||
{0x16b40, 0x16b43}, {0x16b63, 0x16b77}, {0x16b7d, 0x16b8f}, {0x16e40, 0x16e7f},
|
||||
{0x16f00, 0x16f4a}, {0x16f93, 0x16f9f}, {0x17000, 0x187f7}, {0x18800, 0x18af2},
|
||||
{0x1b000, 0x1b11e}, {0x1b150, 0x1b152}, {0x1b164, 0x1b167}, {0x1b170, 0x1b2fb},
|
||||
{0x10f30, 0x10f45}, {0x11003, 0x11037}, {0x11083, 0x110af}, {0x110d0, 0x110e8},
|
||||
{0x11103, 0x11126}, {0x11150, 0x11172}, {0x11183, 0x111b2}, {0x111c1, 0x111c4},
|
||||
{0x11200, 0x11211}, {0x11213, 0x1122b}, {0x11280, 0x11286}, {0x1128a, 0x1128d},
|
||||
{0x1128f, 0x1129d}, {0x1129f, 0x112a8}, {0x112b0, 0x112de}, {0x11305, 0x1130c},
|
||||
{0x11313, 0x11328}, {0x1132a, 0x11330}, {0x11335, 0x11339}, {0x1135d, 0x11361},
|
||||
{0x11400, 0x11434}, {0x11447, 0x1144a}, {0x11480, 0x114af}, {0x11580, 0x115ae},
|
||||
{0x115d8, 0x115db}, {0x11600, 0x1162f}, {0x11680, 0x116aa}, {0x11700, 0x1171a},
|
||||
{0x11800, 0x1182b}, {0x118a0, 0x118df}, {0x11a0b, 0x11a32}, {0x11a5c, 0x11a83},
|
||||
{0x11a86, 0x11a89}, {0x11ac0, 0x11af8}, {0x11c00, 0x11c08}, {0x11c0a, 0x11c2e},
|
||||
{0x11c72, 0x11c8f}, {0x11d00, 0x11d06}, {0x11d0b, 0x11d30}, {0x11d60, 0x11d65},
|
||||
{0x11d6a, 0x11d89}, {0x11ee0, 0x11ef2}, {0x12000, 0x12399}, {0x12480, 0x12543},
|
||||
{0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38}, {0x16a40, 0x16a5e},
|
||||
{0x16ad0, 0x16aed}, {0x16b00, 0x16b2f}, {0x16b40, 0x16b43}, {0x16b63, 0x16b77},
|
||||
{0x16b7d, 0x16b8f}, {0x16e40, 0x16e7f}, {0x16f00, 0x16f44}, {0x16f93, 0x16f9f},
|
||||
{0x17000, 0x187f1}, {0x18800, 0x18af2}, {0x1b000, 0x1b11e}, {0x1b170, 0x1b2fb},
|
||||
{0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, {0x1bc90, 0x1bc99},
|
||||
{0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b9},
|
||||
{0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514},
|
||||
@@ -236,13 +235,12 @@ static const crange alphaRangeTable[] = {
|
||||
{0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d6c0}, {0x1d6c2, 0x1d6da},
|
||||
{0x1d6dc, 0x1d6fa}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d734}, {0x1d736, 0x1d74e},
|
||||
{0x1d750, 0x1d76e}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d7a8}, {0x1d7aa, 0x1d7c2},
|
||||
{0x1d7c4, 0x1d7cb}, {0x1e100, 0x1e12c}, {0x1e137, 0x1e13d}, {0x1e2c0, 0x1e2eb},
|
||||
{0x1e800, 0x1e8c4}, {0x1e900, 0x1e943}, {0x1ee00, 0x1ee03}, {0x1ee05, 0x1ee1f},
|
||||
{0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37}, {0x1ee4d, 0x1ee4f}, {0x1ee67, 0x1ee6a},
|
||||
{0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77}, {0x1ee79, 0x1ee7c}, {0x1ee80, 0x1ee89},
|
||||
{0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3}, {0x1eea5, 0x1eea9}, {0x1eeab, 0x1eebb},
|
||||
{0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, {0x2b740, 0x2b81d}, {0x2b820, 0x2cea1},
|
||||
{0x2ceb0, 0x2ebe0}, {0x2f800, 0x2fa1d}
|
||||
{0x1d7c4, 0x1d7cb}, {0x1e800, 0x1e8c4}, {0x1e900, 0x1e943}, {0x1ee00, 0x1ee03},
|
||||
{0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37}, {0x1ee4d, 0x1ee4f},
|
||||
{0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77}, {0x1ee79, 0x1ee7c},
|
||||
{0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3}, {0x1eea5, 0x1eea9},
|
||||
{0x1eeab, 0x1eebb}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, {0x2b740, 0x2b81d},
|
||||
{0x2b820, 0x2cea1}, {0x2ceb0, 0x2ebe0}, {0x2f800, 0x2fa1d}
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -259,24 +257,24 @@ static const chr alphaCharTable[] = {
|
||||
0xb83, 0xb99, 0xb9a, 0xb9c, 0xb9e, 0xb9f, 0xba3, 0xba4, 0xbd0,
|
||||
0xc3d, 0xc60, 0xc61, 0xc80, 0xcbd, 0xcde, 0xce0, 0xce1, 0xcf1,
|
||||
0xcf2, 0xd3d, 0xd4e, 0xdbd, 0xe32, 0xe33, 0xe81, 0xe82, 0xe84,
|
||||
0xea5, 0xeb2, 0xeb3, 0xebd, 0xec6, 0xf00, 0x103f, 0x1061, 0x1065,
|
||||
0x1066, 0x108e, 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x17d7, 0x17dc, 0x18aa,
|
||||
0x1aa7, 0x1bae, 0x1baf, 0x1cf5, 0x1cf6, 0x1cfa, 0x1f59, 0x1f5b, 0x1f5d,
|
||||
0x1fbe, 0x2071, 0x207f, 0x2102, 0x2107, 0x2115, 0x2124, 0x2126, 0x2128,
|
||||
0x214e, 0x2183, 0x2184, 0x2cf2, 0x2cf3, 0x2d27, 0x2d2d, 0x2d6f, 0x2e2f,
|
||||
0x3005, 0x3006, 0x303b, 0x303c, 0xa62a, 0xa62b, 0xa8fb, 0xa8fd, 0xa8fe,
|
||||
0xa9cf, 0xaa7a, 0xaab1, 0xaab5, 0xaab6, 0xaac0, 0xaac2, 0xfb1d, 0xfb3e,
|
||||
0xfb40, 0xfb41, 0xfb43, 0xfb44
|
||||
0xe87, 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, 0xeab, 0xeb2,
|
||||
0xeb3, 0xebd, 0xec6, 0xf00, 0x103f, 0x1061, 0x1065, 0x1066, 0x108e,
|
||||
0x10c7, 0x10cd, 0x1258, 0x12c0, 0x17d7, 0x17dc, 0x18aa, 0x1aa7, 0x1bae,
|
||||
0x1baf, 0x1cf5, 0x1cf6, 0x1f59, 0x1f5b, 0x1f5d, 0x1fbe, 0x2071, 0x207f,
|
||||
0x2102, 0x2107, 0x2115, 0x2124, 0x2126, 0x2128, 0x214e, 0x2183, 0x2184,
|
||||
0x2cf2, 0x2cf3, 0x2d27, 0x2d2d, 0x2d6f, 0x2e2f, 0x3005, 0x3006, 0x303b,
|
||||
0x303c, 0xa62a, 0xa62b, 0xa8fb, 0xa8fd, 0xa8fe, 0xa9cf, 0xaa7a, 0xaab1,
|
||||
0xaab5, 0xaab6, 0xaac0, 0xaac2, 0xfb1d, 0xfb3e, 0xfb40, 0xfb41, 0xfb43,
|
||||
0xfb44
|
||||
#if CHRBITS > 16
|
||||
,0x1003c, 0x1003d, 0x10808, 0x10837, 0x10838, 0x1083c, 0x108f4, 0x108f5, 0x109be,
|
||||
0x109bf, 0x10a00, 0x10f27, 0x11144, 0x11176, 0x111da, 0x111dc, 0x11288, 0x1130f,
|
||||
0x11310, 0x11332, 0x11333, 0x1133d, 0x11350, 0x1145f, 0x114c4, 0x114c5, 0x114c7,
|
||||
0x11644, 0x116b8, 0x118ff, 0x119e1, 0x119e3, 0x11a00, 0x11a3a, 0x11a50, 0x11a9d,
|
||||
0x11c40, 0x11d08, 0x11d09, 0x11d46, 0x11d67, 0x11d68, 0x11d98, 0x16f50, 0x16fe0,
|
||||
0x16fe1, 0x16fe3, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546,
|
||||
0x1e14e, 0x1e94b, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27, 0x1ee39, 0x1ee3b, 0x1ee42,
|
||||
0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b,
|
||||
0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e
|
||||
0x11310, 0x11332, 0x11333, 0x1133d, 0x11350, 0x114c4, 0x114c5, 0x114c7, 0x11644,
|
||||
0x118ff, 0x11a00, 0x11a3a, 0x11a50, 0x11a9d, 0x11c40, 0x11d08, 0x11d09, 0x11d46,
|
||||
0x11d67, 0x11d68, 0x11d98, 0x16f50, 0x16fe0, 0x16fe1, 0x1d49e, 0x1d49f, 0x1d4a2,
|
||||
0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27, 0x1ee39,
|
||||
0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee57,
|
||||
0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -291,8 +289,8 @@ static const crange controlRangeTable[] = {
|
||||
{0x202a, 0x202e}, {0x2060, 0x2064}, {0x2066, 0x206f}, {0xe000, 0xf8ff},
|
||||
{0xfff9, 0xfffb}
|
||||
#if CHRBITS > 16
|
||||
,{0x13430, 0x13438}, {0x1bca0, 0x1bca3}, {0x1d173, 0x1d17a}, {0xe0020, 0xe007f},
|
||||
{0xf0000, 0xffffd}, {0x100000, 0x10fffd}
|
||||
,{0x1bca0, 0x1bca3}, {0x1d173, 0x1d17a}, {0xe0020, 0xe007f}, {0xf0000, 0xffffd},
|
||||
{0x100000, 0x10fffd}
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -327,8 +325,7 @@ static const crange digitRangeTable[] = {
|
||||
{0x11136, 0x1113f}, {0x111d0, 0x111d9}, {0x112f0, 0x112f9}, {0x11450, 0x11459},
|
||||
{0x114d0, 0x114d9}, {0x11650, 0x11659}, {0x116c0, 0x116c9}, {0x11730, 0x11739},
|
||||
{0x118e0, 0x118e9}, {0x11c50, 0x11c59}, {0x11d50, 0x11d59}, {0x11da0, 0x11da9},
|
||||
{0x16a60, 0x16a69}, {0x16b50, 0x16b59}, {0x1d7ce, 0x1d7ff}, {0x1e140, 0x1e149},
|
||||
{0x1e2f0, 0x1e2f9}, {0x1e950, 0x1e959}
|
||||
{0x16a60, 0x16a69}, {0x16b50, 0x16b59}, {0x1d7ce, 0x1d7ff}, {0x1e950, 0x1e959}
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -351,7 +348,7 @@ static const crange punctRangeTable[] = {
|
||||
{0x1b5a, 0x1b60}, {0x1bfc, 0x1bff}, {0x1c3b, 0x1c3f}, {0x1cc0, 0x1cc7},
|
||||
{0x2010, 0x2027}, {0x2030, 0x2043}, {0x2045, 0x2051}, {0x2053, 0x205e},
|
||||
{0x2308, 0x230b}, {0x2768, 0x2775}, {0x27e6, 0x27ef}, {0x2983, 0x2998},
|
||||
{0x29d8, 0x29db}, {0x2cf9, 0x2cfc}, {0x2e00, 0x2e2e}, {0x2e30, 0x2e4f},
|
||||
{0x29d8, 0x29db}, {0x2cf9, 0x2cfc}, {0x2e00, 0x2e2e}, {0x2e30, 0x2e4e},
|
||||
{0x3001, 0x3003}, {0x3008, 0x3011}, {0x3014, 0x301f}, {0xa60d, 0xa60f},
|
||||
{0xa6f2, 0xa6f7}, {0xa874, 0xa877}, {0xa8f8, 0xa8fa}, {0xa9c1, 0xa9cd},
|
||||
{0xaa5c, 0xaa5f}, {0xfe10, 0xfe19}, {0xfe30, 0xfe52}, {0xfe54, 0xfe61},
|
||||
@@ -375,8 +372,8 @@ static const chr punctCharTable[] = {
|
||||
0xab, 0xb6, 0xb7, 0xbb, 0xbf, 0x37e, 0x387, 0x589, 0x58a,
|
||||
0x5be, 0x5c0, 0x5c3, 0x5c6, 0x5f3, 0x5f4, 0x609, 0x60a, 0x60c,
|
||||
0x60d, 0x61b, 0x61e, 0x61f, 0x6d4, 0x85e, 0x964, 0x965, 0x970,
|
||||
0x9fd, 0xa76, 0xaf0, 0xc77, 0xc84, 0xdf4, 0xe4f, 0xe5a, 0xe5b,
|
||||
0xf14, 0xf85, 0xfd9, 0xfda, 0x10fb, 0x1400, 0x166e, 0x169b, 0x169c,
|
||||
0x9fd, 0xa76, 0xaf0, 0xc84, 0xdf4, 0xe4f, 0xe5a, 0xe5b, 0xf14,
|
||||
0xf85, 0xfd9, 0xfda, 0x10fb, 0x1400, 0x166d, 0x166e, 0x169b, 0x169c,
|
||||
0x1735, 0x1736, 0x1944, 0x1945, 0x1a1e, 0x1a1f, 0x1c7e, 0x1c7f, 0x1cd3,
|
||||
0x207d, 0x207e, 0x208d, 0x208e, 0x2329, 0x232a, 0x27c5, 0x27c6, 0x29fc,
|
||||
0x29fd, 0x2cfe, 0x2cff, 0x2d70, 0x3030, 0x303d, 0x30a0, 0x30fb, 0xa4fe,
|
||||
@@ -387,8 +384,8 @@ static const chr punctCharTable[] = {
|
||||
#if CHRBITS > 16
|
||||
,0x1039f, 0x103d0, 0x1056f, 0x10857, 0x1091f, 0x1093f, 0x10a7f, 0x110bb, 0x110bc,
|
||||
0x11174, 0x11175, 0x111cd, 0x111db, 0x112a9, 0x1145b, 0x1145d, 0x114c6, 0x1183b,
|
||||
0x119e2, 0x11c70, 0x11c71, 0x11ef7, 0x11ef8, 0x11fff, 0x16a6e, 0x16a6f, 0x16af5,
|
||||
0x16b44, 0x16fe2, 0x1bc9f, 0x1e95e, 0x1e95f
|
||||
0x11c70, 0x11c71, 0x11ef7, 0x11ef8, 0x16a6e, 0x16a6f, 0x16af5, 0x16b44, 0x1bc9f,
|
||||
0x1e95e, 0x1e95f
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -427,7 +424,7 @@ static const crange lowerRangeTable[] = {
|
||||
{0x1f90, 0x1f97}, {0x1fa0, 0x1fa7}, {0x1fb0, 0x1fb4}, {0x1fc2, 0x1fc4},
|
||||
{0x1fd0, 0x1fd3}, {0x1fe0, 0x1fe7}, {0x1ff2, 0x1ff4}, {0x2146, 0x2149},
|
||||
{0x2c30, 0x2c5e}, {0x2c76, 0x2c7b}, {0x2d00, 0x2d25}, {0xa72f, 0xa731},
|
||||
{0xa771, 0xa778}, {0xa793, 0xa795}, {0xab30, 0xab5a}, {0xab60, 0xab67},
|
||||
{0xa771, 0xa778}, {0xa793, 0xa795}, {0xab30, 0xab5a}, {0xab60, 0xab65},
|
||||
{0xab70, 0xabbf}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xff41, 0xff5a}
|
||||
#if CHRBITS > 16
|
||||
,{0x10428, 0x1044f}, {0x104d8, 0x104fb}, {0x10cc0, 0x10cf2}, {0x118c0, 0x118df},
|
||||
@@ -507,7 +504,7 @@ static const chr lowerCharTable[] = {
|
||||
0xa763, 0xa765, 0xa767, 0xa769, 0xa76b, 0xa76d, 0xa76f, 0xa77a, 0xa77c,
|
||||
0xa77f, 0xa781, 0xa783, 0xa785, 0xa787, 0xa78c, 0xa78e, 0xa791, 0xa797,
|
||||
0xa799, 0xa79b, 0xa79d, 0xa79f, 0xa7a1, 0xa7a3, 0xa7a5, 0xa7a7, 0xa7a9,
|
||||
0xa7af, 0xa7b5, 0xa7b7, 0xa7b9, 0xa7bb, 0xa7bd, 0xa7bf, 0xa7c3, 0xa7fa
|
||||
0xa7af, 0xa7b5, 0xa7b7, 0xa7b9, 0xa7fa
|
||||
#if CHRBITS > 16
|
||||
,0x1d4bb, 0x1d7cb
|
||||
#endif
|
||||
@@ -530,7 +527,7 @@ static const crange upperRangeTable[] = {
|
||||
{0x1fe8, 0x1fec}, {0x1ff8, 0x1ffb}, {0x210b, 0x210d}, {0x2110, 0x2112},
|
||||
{0x2119, 0x211d}, {0x212a, 0x212d}, {0x2130, 0x2133}, {0x2c00, 0x2c2e},
|
||||
{0x2c62, 0x2c64}, {0x2c6d, 0x2c70}, {0x2c7e, 0x2c80}, {0xa7aa, 0xa7ae},
|
||||
{0xa7b0, 0xa7b4}, {0xa7c4, 0xa7c6}, {0xff21, 0xff3a}
|
||||
{0xa7b0, 0xa7b4}, {0xff21, 0xff3a}
|
||||
#if CHRBITS > 16
|
||||
,{0x10400, 0x10427}, {0x104b0, 0x104d3}, {0x10c80, 0x10cb2}, {0x118a0, 0x118bf},
|
||||
{0x16e40, 0x16e5f}, {0x1d400, 0x1d419}, {0x1d434, 0x1d44d}, {0x1d468, 0x1d481},
|
||||
@@ -609,7 +606,7 @@ static const chr upperCharTable[] = {
|
||||
0xa768, 0xa76a, 0xa76c, 0xa76e, 0xa779, 0xa77b, 0xa77d, 0xa77e, 0xa780,
|
||||
0xa782, 0xa784, 0xa786, 0xa78b, 0xa78d, 0xa790, 0xa792, 0xa796, 0xa798,
|
||||
0xa79a, 0xa79c, 0xa79e, 0xa7a0, 0xa7a2, 0xa7a4, 0xa7a6, 0xa7a8, 0xa7b6,
|
||||
0xa7b8, 0xa7ba, 0xa7bc, 0xa7be, 0xa7c2
|
||||
0xa7b8
|
||||
#if CHRBITS > 16
|
||||
,0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d504, 0x1d505, 0x1d538,
|
||||
0x1d539, 0x1d546, 0x1d7ca
|
||||
@@ -643,53 +640,54 @@ static const crange graphRangeTable[] = {
|
||||
{0xbae, 0xbb9}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8}, {0xbca, 0xbcd},
|
||||
{0xbe6, 0xbfa}, {0xc00, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28},
|
||||
{0xc2a, 0xc39}, {0xc3d, 0xc44}, {0xc46, 0xc48}, {0xc4a, 0xc4d},
|
||||
{0xc58, 0xc5a}, {0xc60, 0xc63}, {0xc66, 0xc6f}, {0xc77, 0xc8c},
|
||||
{0xc58, 0xc5a}, {0xc60, 0xc63}, {0xc66, 0xc6f}, {0xc78, 0xc8c},
|
||||
{0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9},
|
||||
{0xcbc, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xce0, 0xce3},
|
||||
{0xce6, 0xcef}, {0xd00, 0xd03}, {0xd05, 0xd0c}, {0xd0e, 0xd10},
|
||||
{0xd12, 0xd44}, {0xd46, 0xd48}, {0xd4a, 0xd4f}, {0xd54, 0xd63},
|
||||
{0xd66, 0xd7f}, {0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb},
|
||||
{0xdc0, 0xdc6}, {0xdcf, 0xdd4}, {0xdd8, 0xddf}, {0xde6, 0xdef},
|
||||
{0xdf2, 0xdf4}, {0xe01, 0xe3a}, {0xe3f, 0xe5b}, {0xe86, 0xe8a},
|
||||
{0xe8c, 0xea3}, {0xea7, 0xebd}, {0xec0, 0xec4}, {0xec8, 0xecd},
|
||||
{0xed0, 0xed9}, {0xedc, 0xedf}, {0xf00, 0xf47}, {0xf49, 0xf6c},
|
||||
{0xf71, 0xf97}, {0xf99, 0xfbc}, {0xfbe, 0xfcc}, {0xfce, 0xfda},
|
||||
{0x1000, 0x10c5}, {0x10d0, 0x1248}, {0x124a, 0x124d}, {0x1250, 0x1256},
|
||||
{0x125a, 0x125d}, {0x1260, 0x1288}, {0x128a, 0x128d}, {0x1290, 0x12b0},
|
||||
{0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c2, 0x12c5}, {0x12c8, 0x12d6},
|
||||
{0x12d8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135a}, {0x135d, 0x137c},
|
||||
{0x1380, 0x1399}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd}, {0x1400, 0x167f},
|
||||
{0x1681, 0x169c}, {0x16a0, 0x16f8}, {0x1700, 0x170c}, {0x170e, 0x1714},
|
||||
{0x1720, 0x1736}, {0x1740, 0x1753}, {0x1760, 0x176c}, {0x176e, 0x1770},
|
||||
{0x1780, 0x17dd}, {0x17e0, 0x17e9}, {0x17f0, 0x17f9}, {0x1800, 0x180d},
|
||||
{0x1810, 0x1819}, {0x1820, 0x1878}, {0x1880, 0x18aa}, {0x18b0, 0x18f5},
|
||||
{0x1900, 0x191e}, {0x1920, 0x192b}, {0x1930, 0x193b}, {0x1944, 0x196d},
|
||||
{0x1970, 0x1974}, {0x1980, 0x19ab}, {0x19b0, 0x19c9}, {0x19d0, 0x19da},
|
||||
{0x19de, 0x1a1b}, {0x1a1e, 0x1a5e}, {0x1a60, 0x1a7c}, {0x1a7f, 0x1a89},
|
||||
{0x1a90, 0x1a99}, {0x1aa0, 0x1aad}, {0x1ab0, 0x1abe}, {0x1b00, 0x1b4b},
|
||||
{0x1b50, 0x1b7c}, {0x1b80, 0x1bf3}, {0x1bfc, 0x1c37}, {0x1c3b, 0x1c49},
|
||||
{0x1c4d, 0x1c88}, {0x1c90, 0x1cba}, {0x1cbd, 0x1cc7}, {0x1cd0, 0x1cfa},
|
||||
{0x1d00, 0x1df9}, {0x1dfb, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45},
|
||||
{0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4},
|
||||
{0x1fb6, 0x1fc4}, {0x1fc6, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fdd, 0x1fef},
|
||||
{0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffe}, {0x2010, 0x2027}, {0x2030, 0x205e},
|
||||
{0x2074, 0x208e}, {0x2090, 0x209c}, {0x20a0, 0x20bf}, {0x20d0, 0x20f0},
|
||||
{0x2100, 0x218b}, {0x2190, 0x2426}, {0x2440, 0x244a}, {0x2460, 0x2b73},
|
||||
{0x2b76, 0x2b95}, {0x2b98, 0x2c2e}, {0x2c30, 0x2c5e}, {0x2c60, 0x2cf3},
|
||||
{0xdf2, 0xdf4}, {0xe01, 0xe3a}, {0xe3f, 0xe5b}, {0xe94, 0xe97},
|
||||
{0xe99, 0xe9f}, {0xea1, 0xea3}, {0xead, 0xeb9}, {0xebb, 0xebd},
|
||||
{0xec0, 0xec4}, {0xec8, 0xecd}, {0xed0, 0xed9}, {0xedc, 0xedf},
|
||||
{0xf00, 0xf47}, {0xf49, 0xf6c}, {0xf71, 0xf97}, {0xf99, 0xfbc},
|
||||
{0xfbe, 0xfcc}, {0xfce, 0xfda}, {0x1000, 0x10c5}, {0x10d0, 0x1248},
|
||||
{0x124a, 0x124d}, {0x1250, 0x1256}, {0x125a, 0x125d}, {0x1260, 0x1288},
|
||||
{0x128a, 0x128d}, {0x1290, 0x12b0}, {0x12b2, 0x12b5}, {0x12b8, 0x12be},
|
||||
{0x12c2, 0x12c5}, {0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315},
|
||||
{0x1318, 0x135a}, {0x135d, 0x137c}, {0x1380, 0x1399}, {0x13a0, 0x13f5},
|
||||
{0x13f8, 0x13fd}, {0x1400, 0x167f}, {0x1681, 0x169c}, {0x16a0, 0x16f8},
|
||||
{0x1700, 0x170c}, {0x170e, 0x1714}, {0x1720, 0x1736}, {0x1740, 0x1753},
|
||||
{0x1760, 0x176c}, {0x176e, 0x1770}, {0x1780, 0x17dd}, {0x17e0, 0x17e9},
|
||||
{0x17f0, 0x17f9}, {0x1800, 0x180d}, {0x1810, 0x1819}, {0x1820, 0x1878},
|
||||
{0x1880, 0x18aa}, {0x18b0, 0x18f5}, {0x1900, 0x191e}, {0x1920, 0x192b},
|
||||
{0x1930, 0x193b}, {0x1944, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab},
|
||||
{0x19b0, 0x19c9}, {0x19d0, 0x19da}, {0x19de, 0x1a1b}, {0x1a1e, 0x1a5e},
|
||||
{0x1a60, 0x1a7c}, {0x1a7f, 0x1a89}, {0x1a90, 0x1a99}, {0x1aa0, 0x1aad},
|
||||
{0x1ab0, 0x1abe}, {0x1b00, 0x1b4b}, {0x1b50, 0x1b7c}, {0x1b80, 0x1bf3},
|
||||
{0x1bfc, 0x1c37}, {0x1c3b, 0x1c49}, {0x1c4d, 0x1c88}, {0x1c90, 0x1cba},
|
||||
{0x1cbd, 0x1cc7}, {0x1cd0, 0x1cf9}, {0x1d00, 0x1df9}, {0x1dfb, 0x1f15},
|
||||
{0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, {0x1f50, 0x1f57},
|
||||
{0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fc4}, {0x1fc6, 0x1fd3},
|
||||
{0x1fd6, 0x1fdb}, {0x1fdd, 0x1fef}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffe},
|
||||
{0x2010, 0x2027}, {0x2030, 0x205e}, {0x2074, 0x208e}, {0x2090, 0x209c},
|
||||
{0x20a0, 0x20bf}, {0x20d0, 0x20f0}, {0x2100, 0x218b}, {0x2190, 0x2426},
|
||||
{0x2440, 0x244a}, {0x2460, 0x2b73}, {0x2b76, 0x2b95}, {0x2b98, 0x2bc8},
|
||||
{0x2bca, 0x2bfe}, {0x2c00, 0x2c2e}, {0x2c30, 0x2c5e}, {0x2c60, 0x2cf3},
|
||||
{0x2cf9, 0x2d25}, {0x2d30, 0x2d67}, {0x2d7f, 0x2d96}, {0x2da0, 0x2da6},
|
||||
{0x2da8, 0x2dae}, {0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6},
|
||||
{0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x2de0, 0x2e4f},
|
||||
{0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x2de0, 0x2e4e},
|
||||
{0x2e80, 0x2e99}, {0x2e9b, 0x2ef3}, {0x2f00, 0x2fd5}, {0x2ff0, 0x2ffb},
|
||||
{0x3001, 0x303f}, {0x3041, 0x3096}, {0x3099, 0x30ff}, {0x3105, 0x312f},
|
||||
{0x3131, 0x318e}, {0x3190, 0x31ba}, {0x31c0, 0x31e3}, {0x31f0, 0x321e},
|
||||
{0x3220, 0x4db5}, {0x4dc0, 0x9fef}, {0xa000, 0xa48c}, {0xa490, 0xa4c6},
|
||||
{0xa4d0, 0xa62b}, {0xa640, 0xa6f7}, {0xa700, 0xa7bf}, {0xa7c2, 0xa7c6},
|
||||
{0x3220, 0x32fe}, {0x3300, 0x4db5}, {0x4dc0, 0x9fef}, {0xa000, 0xa48c},
|
||||
{0xa490, 0xa4c6}, {0xa4d0, 0xa62b}, {0xa640, 0xa6f7}, {0xa700, 0xa7b9},
|
||||
{0xa7f7, 0xa82b}, {0xa830, 0xa839}, {0xa840, 0xa877}, {0xa880, 0xa8c5},
|
||||
{0xa8ce, 0xa8d9}, {0xa8e0, 0xa953}, {0xa95f, 0xa97c}, {0xa980, 0xa9cd},
|
||||
{0xa9cf, 0xa9d9}, {0xa9de, 0xa9fe}, {0xaa00, 0xaa36}, {0xaa40, 0xaa4d},
|
||||
{0xaa50, 0xaa59}, {0xaa5c, 0xaac2}, {0xaadb, 0xaaf6}, {0xab01, 0xab06},
|
||||
{0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26}, {0xab28, 0xab2e},
|
||||
{0xab30, 0xab67}, {0xab70, 0xabed}, {0xabf0, 0xabf9}, {0xac00, 0xd7a3},
|
||||
{0xab30, 0xab65}, {0xab70, 0xabed}, {0xabf0, 0xabf9}, {0xac00, 0xd7a3},
|
||||
{0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xf900, 0xfa6d}, {0xfa70, 0xfad9},
|
||||
{0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1d, 0xfb36}, {0xfb38, 0xfb3c},
|
||||
{0xfb46, 0xfbc1}, {0xfbd3, 0xfd3f}, {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7},
|
||||
@@ -713,31 +711,29 @@ static const crange graphRangeTable[] = {
|
||||
{0x10aeb, 0x10af6}, {0x10b00, 0x10b35}, {0x10b39, 0x10b55}, {0x10b58, 0x10b72},
|
||||
{0x10b78, 0x10b91}, {0x10b99, 0x10b9c}, {0x10ba9, 0x10baf}, {0x10c00, 0x10c48},
|
||||
{0x10c80, 0x10cb2}, {0x10cc0, 0x10cf2}, {0x10cfa, 0x10d27}, {0x10d30, 0x10d39},
|
||||
{0x10e60, 0x10e7e}, {0x10f00, 0x10f27}, {0x10f30, 0x10f59}, {0x10fe0, 0x10ff6},
|
||||
{0x11000, 0x1104d}, {0x11052, 0x1106f}, {0x1107f, 0x110bc}, {0x110be, 0x110c1},
|
||||
{0x110d0, 0x110e8}, {0x110f0, 0x110f9}, {0x11100, 0x11134}, {0x11136, 0x11146},
|
||||
{0x11150, 0x11176}, {0x11180, 0x111cd}, {0x111d0, 0x111df}, {0x111e1, 0x111f4},
|
||||
{0x11200, 0x11211}, {0x11213, 0x1123e}, {0x11280, 0x11286}, {0x1128a, 0x1128d},
|
||||
{0x1128f, 0x1129d}, {0x1129f, 0x112a9}, {0x112b0, 0x112ea}, {0x112f0, 0x112f9},
|
||||
{0x11300, 0x11303}, {0x11305, 0x1130c}, {0x11313, 0x11328}, {0x1132a, 0x11330},
|
||||
{0x11335, 0x11339}, {0x1133b, 0x11344}, {0x1134b, 0x1134d}, {0x1135d, 0x11363},
|
||||
{0x11366, 0x1136c}, {0x11370, 0x11374}, {0x11400, 0x11459}, {0x1145d, 0x1145f},
|
||||
{0x11480, 0x114c7}, {0x114d0, 0x114d9}, {0x11580, 0x115b5}, {0x115b8, 0x115dd},
|
||||
{0x11600, 0x11644}, {0x11650, 0x11659}, {0x11660, 0x1166c}, {0x11680, 0x116b8},
|
||||
{0x116c0, 0x116c9}, {0x11700, 0x1171a}, {0x1171d, 0x1172b}, {0x11730, 0x1173f},
|
||||
{0x11800, 0x1183b}, {0x118a0, 0x118f2}, {0x119a0, 0x119a7}, {0x119aa, 0x119d7},
|
||||
{0x119da, 0x119e4}, {0x11a00, 0x11a47}, {0x11a50, 0x11aa2}, {0x11ac0, 0x11af8},
|
||||
{0x10e60, 0x10e7e}, {0x10f00, 0x10f27}, {0x10f30, 0x10f59}, {0x11000, 0x1104d},
|
||||
{0x11052, 0x1106f}, {0x1107f, 0x110bc}, {0x110be, 0x110c1}, {0x110d0, 0x110e8},
|
||||
{0x110f0, 0x110f9}, {0x11100, 0x11134}, {0x11136, 0x11146}, {0x11150, 0x11176},
|
||||
{0x11180, 0x111cd}, {0x111d0, 0x111df}, {0x111e1, 0x111f4}, {0x11200, 0x11211},
|
||||
{0x11213, 0x1123e}, {0x11280, 0x11286}, {0x1128a, 0x1128d}, {0x1128f, 0x1129d},
|
||||
{0x1129f, 0x112a9}, {0x112b0, 0x112ea}, {0x112f0, 0x112f9}, {0x11300, 0x11303},
|
||||
{0x11305, 0x1130c}, {0x11313, 0x11328}, {0x1132a, 0x11330}, {0x11335, 0x11339},
|
||||
{0x1133b, 0x11344}, {0x1134b, 0x1134d}, {0x1135d, 0x11363}, {0x11366, 0x1136c},
|
||||
{0x11370, 0x11374}, {0x11400, 0x11459}, {0x11480, 0x114c7}, {0x114d0, 0x114d9},
|
||||
{0x11580, 0x115b5}, {0x115b8, 0x115dd}, {0x11600, 0x11644}, {0x11650, 0x11659},
|
||||
{0x11660, 0x1166c}, {0x11680, 0x116b7}, {0x116c0, 0x116c9}, {0x11700, 0x1171a},
|
||||
{0x1171d, 0x1172b}, {0x11730, 0x1173f}, {0x11800, 0x1183b}, {0x118a0, 0x118f2},
|
||||
{0x11a00, 0x11a47}, {0x11a50, 0x11a83}, {0x11a86, 0x11aa2}, {0x11ac0, 0x11af8},
|
||||
{0x11c00, 0x11c08}, {0x11c0a, 0x11c36}, {0x11c38, 0x11c45}, {0x11c50, 0x11c6c},
|
||||
{0x11c70, 0x11c8f}, {0x11c92, 0x11ca7}, {0x11ca9, 0x11cb6}, {0x11d00, 0x11d06},
|
||||
{0x11d0b, 0x11d36}, {0x11d3f, 0x11d47}, {0x11d50, 0x11d59}, {0x11d60, 0x11d65},
|
||||
{0x11d6a, 0x11d8e}, {0x11d93, 0x11d98}, {0x11da0, 0x11da9}, {0x11ee0, 0x11ef8},
|
||||
{0x11fc0, 0x11ff1}, {0x11fff, 0x12399}, {0x12400, 0x1246e}, {0x12470, 0x12474},
|
||||
{0x12480, 0x12543}, {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38},
|
||||
{0x16a40, 0x16a5e}, {0x16a60, 0x16a69}, {0x16ad0, 0x16aed}, {0x16af0, 0x16af5},
|
||||
{0x16b00, 0x16b45}, {0x16b50, 0x16b59}, {0x16b5b, 0x16b61}, {0x16b63, 0x16b77},
|
||||
{0x16b7d, 0x16b8f}, {0x16e40, 0x16e9a}, {0x16f00, 0x16f4a}, {0x16f4f, 0x16f87},
|
||||
{0x16f8f, 0x16f9f}, {0x16fe0, 0x16fe3}, {0x17000, 0x187f7}, {0x18800, 0x18af2},
|
||||
{0x1b000, 0x1b11e}, {0x1b150, 0x1b152}, {0x1b164, 0x1b167}, {0x1b170, 0x1b2fb},
|
||||
{0x12000, 0x12399}, {0x12400, 0x1246e}, {0x12470, 0x12474}, {0x12480, 0x12543},
|
||||
{0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38}, {0x16a40, 0x16a5e},
|
||||
{0x16a60, 0x16a69}, {0x16ad0, 0x16aed}, {0x16af0, 0x16af5}, {0x16b00, 0x16b45},
|
||||
{0x16b50, 0x16b59}, {0x16b5b, 0x16b61}, {0x16b63, 0x16b77}, {0x16b7d, 0x16b8f},
|
||||
{0x16e40, 0x16e9a}, {0x16f00, 0x16f44}, {0x16f50, 0x16f7e}, {0x16f8f, 0x16f9f},
|
||||
{0x17000, 0x187f1}, {0x18800, 0x18af2}, {0x1b000, 0x1b11e}, {0x1b170, 0x1b2fb},
|
||||
{0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, {0x1bc90, 0x1bc99},
|
||||
{0x1bc9c, 0x1bc9f}, {0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, {0x1d129, 0x1d172},
|
||||
{0x1d17b, 0x1d1e8}, {0x1d200, 0x1d245}, {0x1d2e0, 0x1d2f3}, {0x1d300, 0x1d356},
|
||||
@@ -746,24 +742,22 @@ static const crange graphRangeTable[] = {
|
||||
{0x1d50d, 0x1d514}, {0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e},
|
||||
{0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d7cb},
|
||||
{0x1d7ce, 0x1da8b}, {0x1da9b, 0x1da9f}, {0x1daa1, 0x1daaf}, {0x1e000, 0x1e006},
|
||||
{0x1e008, 0x1e018}, {0x1e01b, 0x1e021}, {0x1e026, 0x1e02a}, {0x1e100, 0x1e12c},
|
||||
{0x1e130, 0x1e13d}, {0x1e140, 0x1e149}, {0x1e2c0, 0x1e2f9}, {0x1e800, 0x1e8c4},
|
||||
{0x1e8c7, 0x1e8d6}, {0x1e900, 0x1e94b}, {0x1e950, 0x1e959}, {0x1ec71, 0x1ecb4},
|
||||
{0x1ed01, 0x1ed3d}, {0x1ee00, 0x1ee03}, {0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32},
|
||||
{0x1ee34, 0x1ee37}, {0x1ee4d, 0x1ee4f}, {0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72},
|
||||
{0x1ee74, 0x1ee77}, {0x1ee79, 0x1ee7c}, {0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b},
|
||||
{0x1eea1, 0x1eea3}, {0x1eea5, 0x1eea9}, {0x1eeab, 0x1eebb}, {0x1f000, 0x1f02b},
|
||||
{0x1f030, 0x1f093}, {0x1f0a0, 0x1f0ae}, {0x1f0b1, 0x1f0bf}, {0x1f0c1, 0x1f0cf},
|
||||
{0x1f0d1, 0x1f0f5}, {0x1f100, 0x1f10c}, {0x1f110, 0x1f16c}, {0x1f170, 0x1f1ac},
|
||||
{0x1f1e6, 0x1f202}, {0x1f210, 0x1f23b}, {0x1f240, 0x1f248}, {0x1f260, 0x1f265},
|
||||
{0x1f300, 0x1f6d5}, {0x1f6e0, 0x1f6ec}, {0x1f6f0, 0x1f6fa}, {0x1f700, 0x1f773},
|
||||
{0x1f780, 0x1f7d8}, {0x1f7e0, 0x1f7eb}, {0x1f800, 0x1f80b}, {0x1f810, 0x1f847},
|
||||
{0x1f850, 0x1f859}, {0x1f860, 0x1f887}, {0x1f890, 0x1f8ad}, {0x1f900, 0x1f90b},
|
||||
{0x1f90d, 0x1f971}, {0x1f973, 0x1f976}, {0x1f97a, 0x1f9a2}, {0x1f9a5, 0x1f9aa},
|
||||
{0x1f9ae, 0x1f9ca}, {0x1f9cd, 0x1fa53}, {0x1fa60, 0x1fa6d}, {0x1fa70, 0x1fa73},
|
||||
{0x1fa78, 0x1fa7a}, {0x1fa80, 0x1fa82}, {0x1fa90, 0x1fa95}, {0x20000, 0x2a6d6},
|
||||
{0x2a700, 0x2b734}, {0x2b740, 0x2b81d}, {0x2b820, 0x2cea1}, {0x2ceb0, 0x2ebe0},
|
||||
{0x2f800, 0x2fa1d}, {0xe0100, 0xe01ef}
|
||||
{0x1e008, 0x1e018}, {0x1e01b, 0x1e021}, {0x1e026, 0x1e02a}, {0x1e800, 0x1e8c4},
|
||||
{0x1e8c7, 0x1e8d6}, {0x1e900, 0x1e94a}, {0x1e950, 0x1e959}, {0x1ec71, 0x1ecb4},
|
||||
{0x1ee00, 0x1ee03}, {0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37},
|
||||
{0x1ee4d, 0x1ee4f}, {0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77},
|
||||
{0x1ee79, 0x1ee7c}, {0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3},
|
||||
{0x1eea5, 0x1eea9}, {0x1eeab, 0x1eebb}, {0x1f000, 0x1f02b}, {0x1f030, 0x1f093},
|
||||
{0x1f0a0, 0x1f0ae}, {0x1f0b1, 0x1f0bf}, {0x1f0c1, 0x1f0cf}, {0x1f0d1, 0x1f0f5},
|
||||
{0x1f100, 0x1f10c}, {0x1f110, 0x1f16b}, {0x1f170, 0x1f1ac}, {0x1f1e6, 0x1f202},
|
||||
{0x1f210, 0x1f23b}, {0x1f240, 0x1f248}, {0x1f260, 0x1f265}, {0x1f300, 0x1f6d4},
|
||||
{0x1f6e0, 0x1f6ec}, {0x1f6f0, 0x1f6f9}, {0x1f700, 0x1f773}, {0x1f780, 0x1f7d8},
|
||||
{0x1f800, 0x1f80b}, {0x1f810, 0x1f847}, {0x1f850, 0x1f859}, {0x1f860, 0x1f887},
|
||||
{0x1f890, 0x1f8ad}, {0x1f900, 0x1f90b}, {0x1f910, 0x1f93e}, {0x1f940, 0x1f970},
|
||||
{0x1f973, 0x1f976}, {0x1f97c, 0x1f9a2}, {0x1f9b0, 0x1f9b9}, {0x1f9c0, 0x1f9c2},
|
||||
{0x1f9d0, 0x1f9ff}, {0x1fa60, 0x1fa6d}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734},
|
||||
{0x2b740, 0x2b81d}, {0x2b820, 0x2cea1}, {0x2ceb0, 0x2ebe0}, {0x2f800, 0x2fa1d},
|
||||
{0xe0100, 0xe01ef}
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -776,20 +770,21 @@ static const chr graphCharTable[] = {
|
||||
0xb10, 0xb32, 0xb33, 0xb47, 0xb48, 0xb56, 0xb57, 0xb5c, 0xb5d,
|
||||
0xb82, 0xb83, 0xb99, 0xb9a, 0xb9c, 0xb9e, 0xb9f, 0xba3, 0xba4,
|
||||
0xbd0, 0xbd7, 0xc55, 0xc56, 0xcd5, 0xcd6, 0xcde, 0xcf1, 0xcf2,
|
||||
0xd82, 0xd83, 0xdbd, 0xdca, 0xdd6, 0xe81, 0xe82, 0xe84, 0xea5,
|
||||
0xec6, 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x1772, 0x1773, 0x1940, 0x1f59,
|
||||
0x1f5b, 0x1f5d, 0x2070, 0x2071, 0x2d27, 0x2d2d, 0x2d6f, 0x2d70, 0xfb3e,
|
||||
0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfffc, 0xfffd
|
||||
0xd82, 0xd83, 0xdbd, 0xdca, 0xdd6, 0xe81, 0xe82, 0xe84, 0xe87,
|
||||
0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, 0xeab, 0xec6, 0x10c7,
|
||||
0x10cd, 0x1258, 0x12c0, 0x1772, 0x1773, 0x1940, 0x1f59, 0x1f5b, 0x1f5d,
|
||||
0x2070, 0x2071, 0x2d27, 0x2d2d, 0x2d6f, 0x2d70, 0xfb3e, 0xfb40, 0xfb41,
|
||||
0xfb43, 0xfb44, 0xfffc, 0xfffd
|
||||
#if CHRBITS > 16
|
||||
,0x1003c, 0x1003d, 0x101a0, 0x1056f, 0x10808, 0x10837, 0x10838, 0x1083c, 0x108f4,
|
||||
0x108f5, 0x1093f, 0x10a05, 0x10a06, 0x11288, 0x1130f, 0x11310, 0x11332, 0x11333,
|
||||
0x11347, 0x11348, 0x11350, 0x11357, 0x1145b, 0x118ff, 0x11d08, 0x11d09, 0x11d3a,
|
||||
0x11d3c, 0x11d3d, 0x11d67, 0x11d68, 0x11d90, 0x11d91, 0x16a6e, 0x16a6f, 0x1d49e,
|
||||
0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546, 0x1e023, 0x1e024, 0x1e14e,
|
||||
0x1e14f, 0x1e2ff, 0x1e95e, 0x1e95f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27, 0x1ee39,
|
||||
0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee57,
|
||||
0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e, 0x1eef0,
|
||||
0x1eef1, 0x1f250, 0x1f251
|
||||
0x11347, 0x11348, 0x11350, 0x11357, 0x1145b, 0x1145d, 0x1145e, 0x118ff, 0x11d08,
|
||||
0x11d09, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d67, 0x11d68, 0x11d90, 0x11d91, 0x16a6e,
|
||||
0x16a6f, 0x16fe0, 0x16fe1, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb,
|
||||
0x1d546, 0x1e023, 0x1e024, 0x1e95e, 0x1e95f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27,
|
||||
0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54,
|
||||
0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e,
|
||||
0x1eef0, 0x1eef1, 0x1f250, 0x1f251, 0x1f97a
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -2978,9 +2978,6 @@ dumpnfa(
|
||||
dumpcolors(nfa->cm, f);
|
||||
}
|
||||
fflush(f);
|
||||
#else
|
||||
(void)nfa;
|
||||
(void)f;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -3160,9 +3157,6 @@ dumpcnfa(
|
||||
dumpcstate(st, cnfa, f);
|
||||
}
|
||||
fflush(f);
|
||||
#else
|
||||
(void)cnfa;
|
||||
(void)f;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+22
-5
@@ -59,6 +59,7 @@ static void wordchrs(struct vars *);
|
||||
static struct subre *subre(struct vars *, int, int, struct state *, struct state *);
|
||||
static void freesubre(struct vars *, struct subre *);
|
||||
static void freesrnode(struct vars *, struct subre *);
|
||||
static void optst(struct vars *, struct subre *);
|
||||
static int numst(struct subre *, int);
|
||||
static void markst(struct subre *);
|
||||
static void cleanst(struct vars *);
|
||||
@@ -243,7 +244,6 @@ struct vars {
|
||||
#define EMPTYARC(x, y) newarc(v->nfa, EMPTY, 0, x, y)
|
||||
|
||||
/* token type codes, some also used as NFA arc types */
|
||||
#undef DIGIT /* prevent conflict with libtommath */
|
||||
#define EMPTY 'n' /* no token present */
|
||||
#define EOS 'e' /* end of string */
|
||||
#define PLAIN 'p' /* ordinary character */
|
||||
@@ -395,6 +395,7 @@ compile(
|
||||
dumpnfa(v->nfa, debug);
|
||||
dumpst(v->tree, debug, 1);
|
||||
}
|
||||
optst(v, v->tree);
|
||||
v->ntree = numst(v->tree, 1);
|
||||
markst(v->tree);
|
||||
cleanst(v);
|
||||
@@ -922,7 +923,7 @@ parseqatom(
|
||||
*/
|
||||
|
||||
NOTE(REG_UPBOTCH);
|
||||
/* FALLTHRU */
|
||||
/* fallthrough into case PLAIN */
|
||||
case PLAIN:
|
||||
onechr(v, v->nextvalue, lp, rp);
|
||||
okcolors(v->nfa, v->cm);
|
||||
@@ -1810,6 +1811,25 @@ freesrnode(
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
- optst - optimize a subRE subtree
|
||||
^ static void optst(struct vars *, struct subre *);
|
||||
*/
|
||||
static void
|
||||
optst(
|
||||
struct vars *v,
|
||||
struct subre *t)
|
||||
{
|
||||
/*
|
||||
* DGP (2007-11-13): I assume it was the programmer's intent to eventually
|
||||
* come back and add code to optimize subRE trees, but the routine coded
|
||||
* just spends effort traversing the tree and doing nothing. We can do
|
||||
* nothing with less effort.
|
||||
*/
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
- numst - number tree nodes (assigning "id" indexes)
|
||||
^ static int numst(struct subre *, int);
|
||||
@@ -2081,9 +2101,6 @@ dump(
|
||||
}
|
||||
fprintf(f, "\n");
|
||||
dumpst(g->tree, f, 0);
|
||||
#else
|
||||
(void)re;
|
||||
(void)f;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -132,7 +132,7 @@ typedef int celt; /* Type to hold chr, or NOCELT */
|
||||
#if 1
|
||||
#define AllocVars(vPtr) \
|
||||
static Tcl_ThreadDataKey varsKey; \
|
||||
struct vars *vPtr = (struct vars *) \
|
||||
register struct vars *vPtr = (struct vars *) \
|
||||
Tcl_GetThreadData(&varsKey, sizeof(struct vars))
|
||||
#else
|
||||
/*
|
||||
@@ -141,7 +141,7 @@ typedef int celt; /* Type to hold chr, or NOCELT */
|
||||
* faster in practice (measured!)
|
||||
*/
|
||||
#define AllocVars(vPtr) \
|
||||
struct vars *vPtr = (struct vars *) MALLOC(sizeof(struct vars))
|
||||
register struct vars *vPtr = (struct vars *) MALLOC(sizeof(struct vars))
|
||||
#define FreeVars(vPtr) \
|
||||
FREE(vPtr)
|
||||
#endif
|
||||
|
||||
@@ -58,6 +58,7 @@ static const struct rerr {
|
||||
size_t /* Actual space needed (including NUL) */
|
||||
regerror(
|
||||
int code, /* Error code, or REG_ATOI or REG_ITOA */
|
||||
const regex_t *preg, /* Associated regex_t (unused at present) */
|
||||
char *errbuf, /* Result buffer (unless errbuf_size==0) */
|
||||
size_t errbuf_size) /* Available space in errbuf, can be 0 */
|
||||
{
|
||||
|
||||
+2
-2
@@ -232,7 +232,7 @@ typedef struct {
|
||||
* of character is used for error reports is independent of what kind is used
|
||||
* in matching.
|
||||
*
|
||||
^ extern size_t regerror(int, char *, size_t);
|
||||
^ extern size_t regerror(int, const regex_t *, char *, size_t);
|
||||
*/
|
||||
#define REG_OKAY 0 /* no errors detected */
|
||||
#define REG_NOMATCH 1 /* failed to match */
|
||||
@@ -283,7 +283,7 @@ int regexec(regex_t *, const char *, size_t, regmatch_t [], int);
|
||||
MODULE_SCOPE int __REG_WIDE_EXEC(regex_t *, const __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
|
||||
#endif
|
||||
MODULE_SCOPE void regfree(regex_t *);
|
||||
MODULE_SCOPE size_t regerror(int, char *, size_t);
|
||||
MODULE_SCOPE size_t regerror(int, const regex_t *, char *, size_t);
|
||||
/* automatically gathered by fwd; do not hand-edit */
|
||||
/* =====^!^===== end forwards =====^!^===== */
|
||||
|
||||
|
||||
+5
-3
@@ -129,7 +129,7 @@ int exec(regex_t *, const chr *, size_t, rm_detail_t *, size_t, regmatch_t [], i
|
||||
static struct dfa *getsubdfa(struct vars *, struct subre *);
|
||||
static int simpleFind(struct vars *const, struct cnfa *const, struct colormap *const);
|
||||
static int complicatedFind(struct vars *const, struct cnfa *const, struct colormap *const);
|
||||
static int complicatedFindLoop(struct vars *const, struct dfa *const, struct dfa *const, chr **const);
|
||||
static int complicatedFindLoop(struct vars *const, struct cnfa *const, struct colormap *const, struct dfa *const, struct dfa *const, chr **const);
|
||||
static void zapallsubs(regmatch_t *const, const size_t);
|
||||
static void zaptreesubs(struct vars *const, struct subre *const);
|
||||
static void subset(struct vars *const, struct subre *const, chr *const, chr *const);
|
||||
@@ -434,7 +434,7 @@ complicatedFind(
|
||||
return v->err;
|
||||
}
|
||||
|
||||
ret = complicatedFindLoop(v, d, s, &cold);
|
||||
ret = complicatedFindLoop(v, cnfa, cm, d, s, &cold);
|
||||
|
||||
freeDFA(d);
|
||||
freeDFA(s);
|
||||
@@ -453,12 +453,14 @@ complicatedFind(
|
||||
|
||||
/*
|
||||
- complicatedFindLoop - the heart of complicatedFind
|
||||
^ static int complicatedFindLoop(struct vars *,
|
||||
^ static int complicatedFindLoop(struct vars *, struct cnfa *, struct colormap *,
|
||||
^ struct dfa *, struct dfa *, chr **);
|
||||
*/
|
||||
static int
|
||||
complicatedFindLoop(
|
||||
struct vars *const v,
|
||||
struct cnfa *const cnfa,
|
||||
struct colormap *const cm,
|
||||
struct dfa *const d,
|
||||
struct dfa *const s,
|
||||
chr **const coldp) /* where to put coldstart pointer */
|
||||
|
||||
+1
-1
@@ -438,7 +438,7 @@ struct guts {
|
||||
#ifndef AllocVars
|
||||
#define AllocVars(vPtr) \
|
||||
struct vars var; \
|
||||
struct vars *vPtr = &var
|
||||
register struct vars *vPtr = &var
|
||||
#endif
|
||||
#ifndef FreeVars
|
||||
#define FreeVars(vPtr) ((void) 0)
|
||||
|
||||
@@ -2323,10 +2323,6 @@ declare 630 {
|
||||
Tcl_Obj *compressionDictionaryObj)
|
||||
}
|
||||
|
||||
declare 648 {
|
||||
void TclUnusedStubEntry(void)
|
||||
}
|
||||
|
||||
# ----- BASELINE -- FOR -- 8.6.0 ----- #
|
||||
|
||||
##############################################################################
|
||||
|
||||
+7
-3
@@ -42,6 +42,10 @@ extern "C" {
|
||||
* win/configure.in (as above)
|
||||
* win/tcl.m4 (not patchlevel)
|
||||
* README (sections 0 and 2, with and without separator)
|
||||
* macosx/Tcl.pbproj/project.pbxproj (not patchlevel) 1 LOC
|
||||
* macosx/Tcl.pbproj/default.pbxuser (not patchlevel) 1 LOC
|
||||
* macosx/Tcl.xcode/project.pbxproj (not patchlevel) 2 LOC
|
||||
* macosx/Tcl.xcode/default.pbxuser (not patchlevel) 1 LOC
|
||||
* macosx/Tcl-Common.xcconfig (not patchlevel) 1 LOC
|
||||
* win/README (not patchlevel) (sections 0 and 2)
|
||||
* unix/tcl.spec (1 LOC patch)
|
||||
@@ -51,10 +55,10 @@ extern "C" {
|
||||
#define TCL_MAJOR_VERSION 8
|
||||
#define TCL_MINOR_VERSION 6
|
||||
#define TCL_RELEASE_LEVEL TCL_FINAL_RELEASE
|
||||
#define TCL_RELEASE_SERIAL 10
|
||||
#define TCL_RELEASE_SERIAL 8
|
||||
|
||||
#define TCL_VERSION "8.6"
|
||||
#define TCL_PATCH_LEVEL "8.6.10"
|
||||
#define TCL_PATCH_LEVEL "8.6.8"
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
@@ -440,7 +444,7 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt;
|
||||
#if defined(_WIN32)
|
||||
# ifdef __BORLANDC__
|
||||
typedef struct stati64 Tcl_StatBuf;
|
||||
# elif defined(_WIN64) || defined(_USE_64BIT_TIME_T)
|
||||
# elif defined(_WIN64)
|
||||
typedef struct __stat64 Tcl_StatBuf;
|
||||
# elif (defined(_MSC_VER) && (_MSC_VER < 1400)) || defined(_USE_32BIT_TIME_T)
|
||||
typedef struct _stati64 Tcl_StatBuf;
|
||||
|
||||
@@ -287,7 +287,8 @@ static int GetIntegerOperand(AssemblyEnv*, Tcl_Token**, int*);
|
||||
static int GetNextOperand(AssemblyEnv*, Tcl_Token**, Tcl_Obj**);
|
||||
static void LookForFreshCatches(BasicBlock*, BasicBlock**);
|
||||
static void MoveCodeForJumps(AssemblyEnv*, int);
|
||||
static void MoveExceptionRangesToBasicBlock(AssemblyEnv*, int);
|
||||
static void MoveExceptionRangesToBasicBlock(AssemblyEnv*, int,
|
||||
int);
|
||||
static AssemblyEnv* NewAssemblyEnv(CompileEnv*, int);
|
||||
static int ProcessCatches(AssemblyEnv*);
|
||||
static int ProcessCatchesInBasicBlock(AssemblyEnv*, BasicBlock*,
|
||||
@@ -512,7 +513,6 @@ static const unsigned char NonThrowingByteCodes[] = {
|
||||
INST_PUSH1, INST_PUSH4, INST_POP, INST_DUP, /* 1-4 */
|
||||
INST_JUMP1, INST_JUMP4, /* 34-35 */
|
||||
INST_END_CATCH, INST_PUSH_RESULT, INST_PUSH_RETURN_CODE, /* 70-72 */
|
||||
INST_STR_EQ, INST_STR_NEQ, INST_STR_CMP, INST_STR_LEN, /* 73-76 */
|
||||
INST_LIST, /* 79 */
|
||||
INST_OVER, /* 95 */
|
||||
INST_PUSH_RETURN_OPTIONS, /* 108 */
|
||||
@@ -783,7 +783,6 @@ TclNRAssembleObjCmd(
|
||||
Tcl_Obj* backtrace; /* Object where extra error information is
|
||||
* constructed. */
|
||||
|
||||
(void)dummy;
|
||||
if (objc != 2) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "bytecodeList");
|
||||
return TCL_ERROR;
|
||||
@@ -959,7 +958,7 @@ TclCompileAssembleCmd(
|
||||
int numCommands = envPtr->numCommands;
|
||||
int offset = envPtr->codeNext - envPtr->codeStart;
|
||||
int depth = envPtr->currStackDepth;
|
||||
(void)cmdPtr;
|
||||
|
||||
/*
|
||||
* Make sure that the command has a single arg that is a simple word.
|
||||
*/
|
||||
@@ -1808,6 +1807,7 @@ CompileEmbeddedScript(
|
||||
|
||||
int savedStackDepth = envPtr->currStackDepth;
|
||||
int savedMaxStackDepth = envPtr->maxStackDepth;
|
||||
int savedCodeIndex = envPtr->codeNext - envPtr->codeStart;
|
||||
int savedExceptArrayNext = envPtr->exceptArrayNext;
|
||||
|
||||
envPtr->currStackDepth = 0;
|
||||
@@ -1840,7 +1840,8 @@ CompileEmbeddedScript(
|
||||
* need to be fixed up once the stack depth is known.
|
||||
*/
|
||||
|
||||
MoveExceptionRangesToBasicBlock(assemEnvPtr, savedExceptArrayNext);
|
||||
MoveExceptionRangesToBasicBlock(assemEnvPtr, savedCodeIndex,
|
||||
savedExceptArrayNext);
|
||||
|
||||
/*
|
||||
* Flush the current basic block.
|
||||
@@ -1899,6 +1900,7 @@ SyncStackDepth(
|
||||
static void
|
||||
MoveExceptionRangesToBasicBlock(
|
||||
AssemblyEnv* assemEnvPtr, /* Assembly environment */
|
||||
int savedCodeIndex, /* Start of the embedded code */
|
||||
int savedExceptArrayNext) /* Saved index of the end of the exception
|
||||
* range array */
|
||||
{
|
||||
@@ -2253,7 +2255,7 @@ GetListIndexOperand(
|
||||
if (GetNextOperand(assemEnvPtr, tokenPtrPtr, &value) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* Convert to an integer, advance to the next token and return. */
|
||||
/*
|
||||
* NOTE: Indexing a list with an index before it yields the
|
||||
@@ -4307,8 +4309,6 @@ DupAssembleCodeInternalRep(
|
||||
Tcl_Obj *srcPtr,
|
||||
Tcl_Obj *copyPtr)
|
||||
{
|
||||
(void)srcPtr;
|
||||
(void)copyPtr;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+61
-177
@@ -158,7 +158,6 @@ static Tcl_NRPostProc Dispatch;
|
||||
|
||||
static Tcl_ObjCmdProc NRCoroInjectObjCmd;
|
||||
static Tcl_NRPostProc NRPostInvoke;
|
||||
static Tcl_ObjCmdProc CoroTypeObjCmd;
|
||||
|
||||
MODULE_SCOPE const TclStubs tclStubs;
|
||||
|
||||
@@ -286,9 +285,6 @@ static const CmdInfo builtInCmds[] = {
|
||||
{"source", Tcl_SourceObjCmd, NULL, TclNRSourceObjCmd, 0},
|
||||
{"tell", Tcl_TellObjCmd, NULL, NULL, CMD_IS_SAFE},
|
||||
{"time", Tcl_TimeObjCmd, NULL, NULL, CMD_IS_SAFE},
|
||||
#ifdef TCL_TIMERATE
|
||||
{"timerate", Tcl_TimeRateObjCmd, NULL, NULL, CMD_IS_SAFE},
|
||||
#endif
|
||||
{"unload", Tcl_UnloadObjCmd, NULL, NULL, 0},
|
||||
{"update", Tcl_UpdateObjCmd, NULL, NULL, CMD_IS_SAFE},
|
||||
{"vwait", Tcl_VwaitObjCmd, NULL, NULL, CMD_IS_SAFE},
|
||||
@@ -458,7 +454,7 @@ Tcl_CreateInterp(void)
|
||||
const BuiltinFuncDef *builtinFuncPtr;
|
||||
const OpCmdInfo *opcmdInfoPtr;
|
||||
const CmdInfo *cmdInfoPtr;
|
||||
Tcl_Namespace *nsPtr;
|
||||
Tcl_Namespace *mathfuncNSPtr, *mathopNSPtr;
|
||||
Tcl_HashEntry *hPtr;
|
||||
int isNew;
|
||||
CancelInfo *cancelInfo;
|
||||
@@ -484,13 +480,11 @@ Tcl_CreateInterp(void)
|
||||
Tcl_Panic("Tcl_CallFrame must not be smaller than CallFrame");
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64) && !defined(_USE_64BIT_TIME_T)
|
||||
/* If Tcl is compiled on Win32 using -D_USE_64BIT_TIME_T
|
||||
* the result is a binary incompatible with the 'standard' build of
|
||||
* Tcl: All extensions using Tcl_StatBuf need to be recompiled in
|
||||
* the same way. Therefore, this is not officially supported.
|
||||
* In stead, it is recommended to use Win64 or Tcl 9.0 (not released yet)
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
if (sizeof(time_t) != 4) {
|
||||
/*NOTREACHED*/
|
||||
Tcl_Panic("<time.h> is not compatible with MSVC");
|
||||
}
|
||||
if ((TclOffset(Tcl_StatBuf,st_atime) != 32)
|
||||
|| (TclOffset(Tcl_StatBuf,st_ctime) != 40)) {
|
||||
/*NOTREACHED*/
|
||||
@@ -848,22 +842,8 @@ Tcl_CreateInterp(void)
|
||||
TclNRAssembleObjCmd, NULL, NULL);
|
||||
cmdPtr->compileProc = &TclCompileAssembleCmd;
|
||||
|
||||
/* Coroutine monkeybusiness */
|
||||
Tcl_NRCreateCommand(interp, "::tcl::unsupported::inject", NULL,
|
||||
NRCoroInjectObjCmd, NULL, NULL);
|
||||
Tcl_CreateObjCommand(interp, "::tcl::unsupported::corotype",
|
||||
CoroTypeObjCmd, NULL, NULL);
|
||||
|
||||
/* Create an unsupported command for timerate */
|
||||
Tcl_CreateObjCommand(interp, "::tcl::unsupported::timerate",
|
||||
Tcl_TimeRateObjCmd, NULL, NULL);
|
||||
|
||||
/* Export unsupported commands */
|
||||
nsPtr = Tcl_FindNamespace(interp, "::tcl::unsupported", NULL, 0);
|
||||
if (nsPtr) {
|
||||
Tcl_Export(interp, nsPtr, "*", 1);
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_DTRACE
|
||||
/*
|
||||
@@ -877,8 +857,8 @@ Tcl_CreateInterp(void)
|
||||
* Register the builtin math functions.
|
||||
*/
|
||||
|
||||
nsPtr = Tcl_CreateNamespace(interp, "::tcl::mathfunc", NULL,NULL);
|
||||
if (nsPtr == NULL) {
|
||||
mathfuncNSPtr = Tcl_CreateNamespace(interp, "::tcl::mathfunc", NULL,NULL);
|
||||
if (mathfuncNSPtr == NULL) {
|
||||
Tcl_Panic("Can't create math function namespace");
|
||||
}
|
||||
#define MATH_FUNC_PREFIX_LEN 17 /* == strlen("::tcl::mathfunc::") */
|
||||
@@ -888,18 +868,18 @@ Tcl_CreateInterp(void)
|
||||
strcpy(mathFuncName+MATH_FUNC_PREFIX_LEN, builtinFuncPtr->name);
|
||||
Tcl_CreateObjCommand(interp, mathFuncName,
|
||||
builtinFuncPtr->objCmdProc, builtinFuncPtr->clientData, NULL);
|
||||
Tcl_Export(interp, nsPtr, builtinFuncPtr->name, 0);
|
||||
Tcl_Export(interp, mathfuncNSPtr, builtinFuncPtr->name, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Register the mathematical "operator" commands. [TIP #174]
|
||||
*/
|
||||
|
||||
nsPtr = Tcl_CreateNamespace(interp, "::tcl::mathop", NULL, NULL);
|
||||
if (nsPtr == NULL) {
|
||||
mathopNSPtr = Tcl_CreateNamespace(interp, "::tcl::mathop", NULL, NULL);
|
||||
if (mathopNSPtr == NULL) {
|
||||
Tcl_Panic("can't create math operator namespace");
|
||||
}
|
||||
Tcl_Export(interp, nsPtr, "*", 1);
|
||||
Tcl_Export(interp, mathopNSPtr, "*", 1);
|
||||
#define MATH_OP_PREFIX_LEN 15 /* == strlen("::tcl::mathop::") */
|
||||
memcpy(mathFuncName, "::tcl::mathop::", MATH_OP_PREFIX_LEN);
|
||||
for (opcmdInfoPtr=mathOpCmds ; opcmdInfoPtr->name!=NULL ; opcmdInfoPtr++){
|
||||
@@ -2115,16 +2095,14 @@ Tcl_CreateCommand(
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* An existing command conflicts. Try to delete it...
|
||||
*/
|
||||
|
||||
/* An existing command conflicts. Try to delete it.. */
|
||||
cmdPtr = Tcl_GetHashValue(hPtr);
|
||||
|
||||
/*
|
||||
* Be careful to preserve any existing import links so we can restore
|
||||
* them down below. That way, you can redefine a command and its
|
||||
* import status will remain intact.
|
||||
* Be careful to preserve
|
||||
* any existing import links so we can restore them down below. That
|
||||
* way, you can redefine a command and its import status will remain
|
||||
* intact.
|
||||
*/
|
||||
|
||||
cmdPtr->refCount++;
|
||||
@@ -2144,15 +2122,16 @@ Tcl_CreateCommand(
|
||||
|
||||
if (!isNew) {
|
||||
/*
|
||||
* If the deletion callback recreated the command, just throw away the
|
||||
* new command (if we try to delete it again, we could get stuck in an
|
||||
* infinite loop).
|
||||
* If the deletion callback recreated the command, just throw away
|
||||
* the new command (if we try to delete it again, we could get
|
||||
* stuck in an infinite loop).
|
||||
*/
|
||||
|
||||
ckfree(Tcl_GetHashValue(hPtr));
|
||||
}
|
||||
|
||||
if (!deleted) {
|
||||
|
||||
/*
|
||||
* Command resolvers (per-interp, per-namespace) might have resolved
|
||||
* to a command for the given namespace scope with this command not
|
||||
@@ -2331,18 +2310,16 @@ TclCreateObjCommandInNs (
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* An existing command conflicts. Try to delete it...
|
||||
*/
|
||||
|
||||
/* An existing command conflicts. Try to delete it.. */
|
||||
cmdPtr = Tcl_GetHashValue(hPtr);
|
||||
|
||||
/*
|
||||
* [***] This is wrong. See Tcl Bug a16752c252.
|
||||
* However, this buggy behavior is kept under particular circumstances
|
||||
* to accommodate deployed binaries of the "tclcompiler" program
|
||||
* <http://sourceforge.net/projects/tclpro/> that crash if the bug is
|
||||
* fixed.
|
||||
* However, this buggy behavior is kept under particular
|
||||
* circumstances to accommodate deployed binaries of the
|
||||
* "tclcompiler" program. http://sourceforge.net/projects/tclpro/
|
||||
* that crash if the bug is fixed.
|
||||
*/
|
||||
|
||||
if (cmdPtr->objProc == TclInvokeStringCommand
|
||||
@@ -2366,10 +2343,7 @@ TclCreateObjCommandInNs (
|
||||
cmdPtr->flags |= CMD_REDEF_IN_PROGRESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure namespace doesn't get deallocated.
|
||||
*/
|
||||
|
||||
/* Make sure namespace doesn't get deallocated. */
|
||||
cmdPtr->nsPtr->refCount++;
|
||||
|
||||
Tcl_DeleteCommandFromToken(interp, (Tcl_Command) cmdPtr);
|
||||
@@ -4327,22 +4301,15 @@ EvalObjvCore(
|
||||
reresolve:
|
||||
assert(cmdPtr == NULL);
|
||||
if (preCmdPtr) {
|
||||
/*
|
||||
* Caller gave it to us.
|
||||
*/
|
||||
|
||||
/* Caller gave it to us */
|
||||
if (!(preCmdPtr->flags & CMD_IS_DELETED)) {
|
||||
/*
|
||||
* So long as it exists, use it.
|
||||
*/
|
||||
|
||||
/* So long as it exists, use it. */
|
||||
cmdPtr = preCmdPtr;
|
||||
} else if (flags & TCL_EVAL_NORESOLVE) {
|
||||
/*
|
||||
* When it's been deleted, and we're told not to attempt resolving
|
||||
* it ourselves, all we can do is raise an error.
|
||||
* When it's been deleted, and we're told not to attempt
|
||||
* resolving it ourselves, all we can do is raise an error.
|
||||
*/
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"attempt to invoke a deleted command"));
|
||||
Tcl_SetErrorCode(interp, "TCL", "EVAL", "DELETEDCOMMAND", NULL);
|
||||
@@ -4358,12 +4325,14 @@ EvalObjvCore(
|
||||
|
||||
if (enterTracesDone || iPtr->tracePtr
|
||||
|| (cmdPtr->flags & CMD_HAS_EXEC_TRACES)) {
|
||||
|
||||
Tcl_Obj *commandPtr = TclGetSourceFromFrame(
|
||||
flags & TCL_EVAL_SOURCE_IN_FRAME ? iPtr->cmdFramePtr : NULL,
|
||||
objc, objv);
|
||||
|
||||
Tcl_IncrRefCount(commandPtr);
|
||||
|
||||
if (!enterTracesDone) {
|
||||
|
||||
int code = TEOV_RunEnterTraces(interp, &cmdPtr, commandPtr,
|
||||
objc, objv);
|
||||
|
||||
@@ -4371,10 +4340,10 @@ EvalObjvCore(
|
||||
* Send any exception from enter traces back as an exception
|
||||
* raised by the traced command.
|
||||
* TODO: Is this a bug? Letting an execution trace BREAK or
|
||||
* CONTINUE or RETURN in the place of the traced command? Would
|
||||
* either converting all exceptions to TCL_ERROR, or just
|
||||
* swallowing them be better? (Swallowing them has the problem of
|
||||
* permanently hiding program errors.)
|
||||
* CONTINUE or RETURN in the place of the traced command?
|
||||
* Would either converting all exceptions to TCL_ERROR, or
|
||||
* just swallowing them be better? (Swallowing them has the
|
||||
* problem of permanently hiding program errors.)
|
||||
*/
|
||||
|
||||
if (code != TCL_OK) {
|
||||
@@ -4383,8 +4352,9 @@ EvalObjvCore(
|
||||
}
|
||||
|
||||
/*
|
||||
* If the enter traces made the resolved cmdPtr unusable, go back
|
||||
* and resolve again, but next time don't run enter traces again.
|
||||
* If the enter traces made the resolved cmdPtr unusable, go
|
||||
* back and resolve again, but next time don't run enter
|
||||
* traces again.
|
||||
*/
|
||||
|
||||
if (cmdPtr == NULL) {
|
||||
@@ -4395,9 +4365,9 @@ EvalObjvCore(
|
||||
}
|
||||
|
||||
/*
|
||||
* Schedule leave traces. Raise the refCount on the resolved cmdPtr,
|
||||
* so that when it passes to the leave traces we know it's still
|
||||
* valid.
|
||||
* Schedule leave traces. Raise the refCount on the resolved
|
||||
* cmdPtr, so that when it passes to the leave traces we know
|
||||
* it's still valid.
|
||||
*/
|
||||
|
||||
cmdPtr->refCount++;
|
||||
@@ -4465,6 +4435,8 @@ TclNRRunCallbacks(
|
||||
* are to be run. */
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
NRE_callback *callbackPtr;
|
||||
Tcl_NRPostProc *procPtr;
|
||||
|
||||
/*
|
||||
* If the interpreter has a non-empty string result, the result object is
|
||||
@@ -4480,14 +4452,11 @@ TclNRRunCallbacks(
|
||||
(void) Tcl_GetObjResult(interp);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the trampoline.
|
||||
*/
|
||||
/* This is the trampoline. */
|
||||
|
||||
while (TOP_CB(interp) != rootPtr) {
|
||||
NRE_callback *callbackPtr = TOP_CB(interp);
|
||||
Tcl_NRPostProc *procPtr = callbackPtr->procPtr;
|
||||
|
||||
callbackPtr = TOP_CB(interp);
|
||||
procPtr = callbackPtr->procPtr;
|
||||
TOP_CB(interp) = callbackPtr->nextPtr;
|
||||
result = procPtr(callbackPtr->data, interp, result);
|
||||
TCLNR_FREE(interp, callbackPtr);
|
||||
@@ -6504,8 +6473,8 @@ Tcl_ExprLongObj(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
resultPtr = Tcl_NewBignumObj(&big);
|
||||
/* FALLTHROUGH */
|
||||
}
|
||||
/* FALLTHRU */
|
||||
case TCL_NUMBER_LONG:
|
||||
case TCL_NUMBER_WIDE:
|
||||
case TCL_NUMBER_BIG:
|
||||
@@ -6693,17 +6662,14 @@ TclNRInvoke(
|
||||
}
|
||||
cmdPtr = Tcl_GetHashValue(hPtr);
|
||||
|
||||
/*
|
||||
* Avoid the exception-handling brain damage when numLevels == 0
|
||||
*/
|
||||
|
||||
/* Avoid the exception-handling brain damage when numLevels == 0 . */
|
||||
iPtr->numLevels++;
|
||||
Tcl_NRAddCallback(interp, NRPostInvoke, NULL, NULL, NULL, NULL);
|
||||
|
||||
/*
|
||||
* Normal command resolution of objv[0] isn't going to find cmdPtr.
|
||||
* That's the whole point of **hidden** commands. So tell the Eval core
|
||||
* machinery not to even try (and risk finding something wrong).
|
||||
* That's the whole point of **hidden** commands. So tell the
|
||||
* Eval core machinery not to even try (and risk finding something wrong).
|
||||
*/
|
||||
|
||||
return TclNREvalObjv(interp, objc, objv, TCL_EVAL_NORESOLVE, cmdPtr);
|
||||
@@ -7272,7 +7238,7 @@ ExprIsqrtFunc(
|
||||
if (Tcl_GetBignumFromObj(interp, objv[1], &big) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (big.sign) {
|
||||
if (SIGN(&big) == MP_NEG) {
|
||||
mp_clear(&big);
|
||||
goto negarg;
|
||||
}
|
||||
@@ -7769,7 +7735,7 @@ ExprRandFunc(
|
||||
iPtr->flags |= RAND_SEED_INITIALIZED;
|
||||
|
||||
/*
|
||||
* To ensure different seeds in different threads (bug #416643),
|
||||
* To ensure different seeds in different threads (bug #416643),
|
||||
* take into consideration the thread this interp is running in.
|
||||
*/
|
||||
|
||||
@@ -8085,21 +8051,13 @@ TclDTraceInfo(
|
||||
Tcl_DictObjGet(NULL, info, *k++, &val);
|
||||
args[i] = val ? TclGetString(val) : NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* no "proc" -> use "lambda"
|
||||
*/
|
||||
|
||||
/* no "proc" -> use "lambda" */
|
||||
if (!args[2]) {
|
||||
Tcl_DictObjGet(NULL, info, *k, &val);
|
||||
args[2] = val ? TclGetString(val) : NULL;
|
||||
}
|
||||
k++;
|
||||
|
||||
/*
|
||||
* no "class" -> use "object"
|
||||
*/
|
||||
|
||||
/* no "class" -> use "object" */
|
||||
if (!args[5]) {
|
||||
Tcl_DictObjGet(NULL, info, *k, &val);
|
||||
args[5] = val ? TclGetString(val) : NULL;
|
||||
@@ -8452,10 +8410,8 @@ TclNRTailcallObjCmd(
|
||||
Tcl_Obj *listPtr, *nsObjPtr;
|
||||
Tcl_Namespace *nsPtr = (Tcl_Namespace *) iPtr->varFramePtr->nsPtr;
|
||||
|
||||
/*
|
||||
* The tailcall data is in a Tcl list: the first element is the
|
||||
* namespace, the rest the command to be tailcalled.
|
||||
*/
|
||||
/* The tailcall data is in a Tcl list: the first element is the
|
||||
* namespace, the rest the command to be tailcalled. */
|
||||
|
||||
nsObjPtr = Tcl_NewStringObj(nsPtr->fullName, -1);
|
||||
listPtr = Tcl_NewListObj(objc, objv);
|
||||
@@ -8905,75 +8861,6 @@ TclNREvalList(
|
||||
return TclNREvalObjv(interp, objc, objv, 0, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* CoroTypeObjCmd --
|
||||
*
|
||||
* Implementation of [::tcl::unsupported::corotype] command.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
CoroTypeObjCmd(
|
||||
ClientData clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Command *cmdPtr;
|
||||
CoroutineData *corPtr;
|
||||
|
||||
if (objc != 2) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "coroName");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Look up the coroutine.
|
||||
*/
|
||||
|
||||
cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, objv[1]);
|
||||
if ((!cmdPtr) || (cmdPtr->nreProc != TclNRInterpCoroutine)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"can only get coroutine type of a coroutine", -1));
|
||||
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "COROUTINE",
|
||||
TclGetString(objv[1]), NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* An active coroutine is "active". Can't tell what it might do in the
|
||||
* future.
|
||||
*/
|
||||
|
||||
corPtr = cmdPtr->objClientData;
|
||||
if (!COR_IS_SUSPENDED(corPtr)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("active", -1));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Inactive coroutines are classified by the (effective) command used to
|
||||
* suspend them, which matters when you're injecting a probe.
|
||||
*/
|
||||
|
||||
switch (corPtr->nargs) {
|
||||
case COROUTINE_ARGUMENTS_SINGLE_OPTIONAL:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("yield", -1));
|
||||
return TCL_OK;
|
||||
case COROUTINE_ARGUMENTS_ARBITRARY:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("yieldto", -1));
|
||||
return TCL_OK;
|
||||
default:
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"unknown coroutine type", -1));
|
||||
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "BAD_TYPE", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -9207,12 +9094,9 @@ TclNRCoroutineObjCmd(
|
||||
TclNRAddCallback(interp, NRCoroutineExitCallback, corPtr,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
/*
|
||||
* Ensure that the command is looked up in the correct namespace.
|
||||
*/
|
||||
|
||||
/* ensure that the command is looked up in the correct namespace */
|
||||
iPtr->lookupNsPtr = lookupNsPtr;
|
||||
Tcl_NREvalObj(interp, Tcl_NewListObj(objc - 2, objv + 2), 0);
|
||||
Tcl_NREvalObj(interp, Tcl_NewListObj(objc-2, objv+2), 0);
|
||||
iPtr->numLevels--;
|
||||
|
||||
SAVE_CONTEXT(corPtr->running);
|
||||
|
||||
+67
-94
@@ -318,10 +318,10 @@ Tcl_DbNewByteArrayObj(
|
||||
void
|
||||
Tcl_SetByteArrayObj(
|
||||
Tcl_Obj *objPtr, /* Object to initialize as a ByteArray. */
|
||||
const unsigned char *bytes, /* The array of bytes to use as the new value.
|
||||
* May be NULL even if length > 0. */
|
||||
const unsigned char *bytes, /* The array of bytes to use as the new
|
||||
value. May be NULL even if length > 0. */
|
||||
int length) /* Length of the array of bytes, which must
|
||||
* be >= 0. */
|
||||
be >= 0. */
|
||||
{
|
||||
ByteArray *byteArrayPtr;
|
||||
|
||||
@@ -639,10 +639,7 @@ TclAppendBytesToByteArray(
|
||||
"TclAppendBytesToByteArray");
|
||||
}
|
||||
if (len == 0) {
|
||||
/*
|
||||
* Append zero bytes is a no-op.
|
||||
*/
|
||||
|
||||
/* Append zero bytes is a no-op. */
|
||||
return;
|
||||
}
|
||||
if (objPtr->typePtr != &tclByteArrayType) {
|
||||
@@ -664,18 +661,12 @@ TclAppendBytesToByteArray(
|
||||
int attempt;
|
||||
|
||||
if (needed <= INT_MAX/2) {
|
||||
/*
|
||||
* Try to allocate double the total space that is needed.
|
||||
*/
|
||||
|
||||
/* Try to allocate double the total space that is needed. */
|
||||
attempt = 2 * needed;
|
||||
ptr = attemptckrealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
|
||||
}
|
||||
if (ptr == NULL) {
|
||||
/*
|
||||
* Try to allocate double the increment that is needed (plus).
|
||||
*/
|
||||
|
||||
/* Try to allocate double the increment that is needed (plus). */
|
||||
unsigned int limit = INT_MAX - needed;
|
||||
unsigned int extra = len + TCL_MIN_GROWTH;
|
||||
int growth = (int) ((extra > limit) ? limit : extra);
|
||||
@@ -684,10 +675,7 @@ TclAppendBytesToByteArray(
|
||||
ptr = attemptckrealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
|
||||
}
|
||||
if (ptr == NULL) {
|
||||
/*
|
||||
* Last chance: Try to allocate exactly what is needed.
|
||||
*/
|
||||
|
||||
/* Last chance: Try to allocate exactly what is needed. */
|
||||
attempt = needed;
|
||||
ptr = ckrealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
|
||||
}
|
||||
@@ -762,7 +750,7 @@ BinaryFormatCmd(
|
||||
int count; /* Count associated with current format
|
||||
* character. */
|
||||
int flags; /* Format field flags */
|
||||
const char *format; /* Pointer to current position in format
|
||||
const char *format; /* Pointer to current position in format
|
||||
* string. */
|
||||
Tcl_Obj *resultPtr = NULL; /* Object holding result buffer. */
|
||||
unsigned char *buffer; /* Start of result buffer. */
|
||||
@@ -948,9 +936,9 @@ BinaryFormatCmd(
|
||||
memset(buffer, 0, (size_t) length);
|
||||
|
||||
/*
|
||||
* Pack the data into the result object. Note that we can skip the error
|
||||
* checking during this pass, since we have already parsed the string
|
||||
* once.
|
||||
* Pack the data into the result object. Note that we can skip the
|
||||
* error checking during this pass, since we have already parsed the
|
||||
* string once.
|
||||
*/
|
||||
|
||||
arg = 2;
|
||||
@@ -1163,7 +1151,7 @@ BinaryFormatCmd(
|
||||
}
|
||||
arg++;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (FormatNumber(interp, cmd, listv[i], &cursor) != TCL_OK) {
|
||||
if (FormatNumber(interp, cmd, listv[i], &cursor)!=TCL_OK) {
|
||||
Tcl_DecrRefCount(resultPtr);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1223,7 +1211,7 @@ BinaryFormatCmd(
|
||||
badField:
|
||||
{
|
||||
Tcl_UniChar ch = 0;
|
||||
char buf[TCL_UTF_MAX + 1] = "";
|
||||
char buf[TCL_UTF_MAX + 1];
|
||||
|
||||
TclUtfToUniChar(errorString, &ch);
|
||||
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
|
||||
@@ -1267,7 +1255,7 @@ BinaryScanCmd(
|
||||
int count; /* Count associated with current format
|
||||
* character. */
|
||||
int flags; /* Format field flags */
|
||||
const char *format; /* Pointer to current position in format
|
||||
const char *format; /* Pointer to current position in format
|
||||
* string. */
|
||||
Tcl_Obj *resultPtr = NULL; /* Object holding result buffer. */
|
||||
unsigned char *buffer; /* Start of result buffer. */
|
||||
@@ -1326,7 +1314,7 @@ BinaryScanCmd(
|
||||
|
||||
if (cmd == 'A') {
|
||||
while (size > 0) {
|
||||
if (src[size - 1] != '\0' && src[size - 1] != ' ') {
|
||||
if (src[size-1] != '\0' && src[size-1] != ' ') {
|
||||
break;
|
||||
}
|
||||
size--;
|
||||
@@ -1593,7 +1581,7 @@ BinaryScanCmd(
|
||||
badField:
|
||||
{
|
||||
Tcl_UniChar ch = 0;
|
||||
char buf[TCL_UTF_MAX + 1] = "";
|
||||
char buf[TCL_UTF_MAX + 1];
|
||||
|
||||
TclUtfToUniChar(errorString, &ch);
|
||||
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
|
||||
@@ -1932,7 +1920,7 @@ FormatNumber(
|
||||
* valid range for float.
|
||||
*/
|
||||
|
||||
if (fabs(dvalue) > (double) FLT_MAX) {
|
||||
if (fabs(dvalue) > (double)FLT_MAX) {
|
||||
fvalue = (dvalue >= 0.0) ? FLT_MAX : -FLT_MAX;
|
||||
} else {
|
||||
fvalue = (float) dvalue;
|
||||
@@ -2053,9 +2041,9 @@ ScanNumber(
|
||||
int type, /* Format character from "binary scan" */
|
||||
int flags, /* Format field flags */
|
||||
Tcl_HashTable **numberCachePtrPtr)
|
||||
/* Place to look for cache of scanned value
|
||||
* objects, or NULL if too many different
|
||||
* numbers have been scanned. */
|
||||
/* Place to look for cache of scanned
|
||||
* value objects, or NULL if too many
|
||||
* different numbers have been scanned. */
|
||||
{
|
||||
long value;
|
||||
float fvalue;
|
||||
@@ -2129,7 +2117,6 @@ ScanNumber(
|
||||
/*
|
||||
* Check to see if the value was sign extended properly on systems
|
||||
* where an int is more than 32-bits.
|
||||
*
|
||||
* We avoid caching unsigned integers as we cannot distinguish between
|
||||
* 32bit signed and unsigned in the hash (short and char are ok).
|
||||
*/
|
||||
@@ -2137,9 +2124,9 @@ ScanNumber(
|
||||
if (flags & BINARY_UNSIGNED) {
|
||||
return Tcl_NewWideIntObj((Tcl_WideInt)(unsigned long)value);
|
||||
}
|
||||
if ((value & (((unsigned) 1) << 31)) && (value > 0)) {
|
||||
value -= (((unsigned) 1) << 31);
|
||||
value -= (((unsigned) 1) << 31);
|
||||
if ((value & (((unsigned) 1)<<31)) && (value > 0)) {
|
||||
value -= (((unsigned) 1)<<31);
|
||||
value -= (((unsigned) 1)<<31);
|
||||
}
|
||||
|
||||
returnNumericObject:
|
||||
@@ -2339,8 +2326,8 @@ BinaryEncodeHex(
|
||||
data = Tcl_GetByteArrayFromObj(objv[1], &count);
|
||||
cursor = Tcl_SetByteArrayLength(resultObj, count * 2);
|
||||
for (offset = 0; offset < count; ++offset) {
|
||||
*cursor++ = HexDigits[(data[offset] >> 4) & 0x0f];
|
||||
*cursor++ = HexDigits[data[offset] & 0x0f];
|
||||
*cursor++ = HexDigits[((data[offset] >> 4) & 0x0f)];
|
||||
*cursor++ = HexDigits[(data[offset] & 0x0f)];
|
||||
}
|
||||
Tcl_SetObjResult(interp, resultObj);
|
||||
return TCL_OK;
|
||||
@@ -2380,7 +2367,7 @@ BinaryDecodeHex(
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "?options? data");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
for (i = 1; i < objc - 1; ++i) {
|
||||
for (i = 1; i < objc-1; ++i) {
|
||||
if (Tcl_GetIndexFromObj(interp, objv[i], optStrings, "option",
|
||||
TCL_EXACT, &index) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
@@ -2394,13 +2381,13 @@ BinaryDecodeHex(
|
||||
|
||||
TclNewObj(resultObj);
|
||||
datastart = data = (unsigned char *)
|
||||
TclGetStringFromObj(objv[objc - 1], &count);
|
||||
TclGetStringFromObj(objv[objc-1], &count);
|
||||
dataend = data + count;
|
||||
size = (count + 1) / 2;
|
||||
begin = cursor = Tcl_SetByteArrayLength(resultObj, size);
|
||||
while (data < dataend) {
|
||||
value = 0;
|
||||
for (i = 0 ; i < 2 ; i++) {
|
||||
for (i=0 ; i<2 ; i++) {
|
||||
if (data >= dataend) {
|
||||
value <<= 4;
|
||||
break;
|
||||
@@ -2408,7 +2395,7 @@ BinaryDecodeHex(
|
||||
|
||||
c = *data++;
|
||||
if (!isxdigit((int) c)) {
|
||||
if (strict || !TclIsSpaceProc(c)) {
|
||||
if (strict || !isspace(c)) {
|
||||
goto badChar;
|
||||
}
|
||||
i--;
|
||||
@@ -2423,7 +2410,7 @@ BinaryDecodeHex(
|
||||
if (c > 16) {
|
||||
c += ('A' - 'a');
|
||||
}
|
||||
value |= c & 0xf;
|
||||
value |= (c & 0xf);
|
||||
}
|
||||
if (i < 2) {
|
||||
cut++;
|
||||
@@ -2494,22 +2481,22 @@ BinaryEncode64(
|
||||
const char *wrapchar = "\n";
|
||||
int wrapcharlen = 1;
|
||||
int offset, i, index, size, outindex = 0, count = 0;
|
||||
enum { OPT_MAXLEN, OPT_WRAPCHAR };
|
||||
enum {OPT_MAXLEN, OPT_WRAPCHAR };
|
||||
static const char *const optStrings[] = { "-maxlen", "-wrapchar", NULL };
|
||||
|
||||
if (objc < 2 || objc % 2 != 0) {
|
||||
if (objc < 2 || objc%2 != 0) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv,
|
||||
"?-maxlen len? ?-wrapchar char? data");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
for (i = 1; i < objc - 1; i += 2) {
|
||||
for (i = 1; i < objc-1; i += 2) {
|
||||
if (Tcl_GetIndexFromObj(interp, objv[i], optStrings, "option",
|
||||
TCL_EXACT, &index) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
switch (index) {
|
||||
case OPT_MAXLEN:
|
||||
if (Tcl_GetIntFromObj(interp, objv[i + 1], &maxlen) != TCL_OK) {
|
||||
if (Tcl_GetIntFromObj(interp, objv[i+1], &maxlen) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (maxlen < 0) {
|
||||
@@ -2521,7 +2508,7 @@ BinaryEncode64(
|
||||
}
|
||||
break;
|
||||
case OPT_WRAPCHAR:
|
||||
wrapchar = Tcl_GetStringFromObj(objv[i + 1], &wrapcharlen);
|
||||
wrapchar = Tcl_GetStringFromObj(objv[i+1], &wrapcharlen);
|
||||
if (wrapcharlen == 0) {
|
||||
maxlen = 0;
|
||||
}
|
||||
@@ -2530,9 +2517,9 @@ BinaryEncode64(
|
||||
}
|
||||
|
||||
resultObj = Tcl_NewObj();
|
||||
data = Tcl_GetByteArrayFromObj(objv[objc - 1], &count);
|
||||
data = Tcl_GetByteArrayFromObj(objv[objc-1], &count);
|
||||
if (count > 0) {
|
||||
size = (((count * 4) / 3) + 3) & ~3; /* ensure 4 byte chunks */
|
||||
size = (((count * 4) / 3) + 3) & ~3; /* ensure 4 byte chunks */
|
||||
if (maxlen > 0 && size > maxlen) {
|
||||
int adjusted = size + (wrapcharlen * (size / maxlen));
|
||||
|
||||
@@ -2543,15 +2530,15 @@ BinaryEncode64(
|
||||
}
|
||||
cursor = Tcl_SetByteArrayLength(resultObj, size);
|
||||
limit = cursor + size;
|
||||
for (offset = 0; offset < count; offset += 3) {
|
||||
for (offset = 0; offset < count; offset+=3) {
|
||||
unsigned char d[3] = {0, 0, 0};
|
||||
|
||||
for (i = 0; i < 3 && offset + i < count; ++i) {
|
||||
for (i = 0; i < 3 && offset+i < count; ++i) {
|
||||
d[i] = data[offset + i];
|
||||
}
|
||||
OUTPUT(B64Digits[d[0] >> 2]);
|
||||
OUTPUT(B64Digits[((d[0] & 0x03) << 4) | (d[1] >> 4)]);
|
||||
if (offset + 1 < count) {
|
||||
if (offset+1 < count) {
|
||||
OUTPUT(B64Digits[((d[1] & 0x0f) << 2) | (d[2] >> 6)]);
|
||||
} else {
|
||||
OUTPUT(B64Digits[64]);
|
||||
@@ -2604,20 +2591,19 @@ BinaryEncodeUu(
|
||||
enum { OPT_MAXLEN, OPT_WRAPCHAR };
|
||||
static const char *const optStrings[] = { "-maxlen", "-wrapchar", NULL };
|
||||
|
||||
if (objc < 2 || objc % 2 != 0) {
|
||||
if (objc < 2 || objc%2 != 0) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv,
|
||||
"?-maxlen len? ?-wrapchar char? data");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
for (i = 1; i < objc - 1; i += 2) {
|
||||
for (i = 1; i < objc-1; i += 2) {
|
||||
if (Tcl_GetIndexFromObj(interp, objv[i], optStrings, "option",
|
||||
TCL_EXACT, &index) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
switch (index) {
|
||||
case OPT_MAXLEN:
|
||||
if (Tcl_GetIntFromObj(interp, objv[i + 1],
|
||||
&lineLength) != TCL_OK) {
|
||||
if (Tcl_GetIntFromObj(interp, objv[i+1], &lineLength) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (lineLength < 3 || lineLength > 85) {
|
||||
@@ -2629,7 +2615,7 @@ BinaryEncodeUu(
|
||||
}
|
||||
break;
|
||||
case OPT_WRAPCHAR:
|
||||
wrapchar = Tcl_GetByteArrayFromObj(objv[i + 1], &wrapcharlen);
|
||||
wrapchar = Tcl_GetByteArrayFromObj(objv[i+1], &wrapcharlen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2641,7 +2627,7 @@ BinaryEncodeUu(
|
||||
|
||||
resultObj = Tcl_NewObj();
|
||||
offset = 0;
|
||||
data = Tcl_GetByteArrayFromObj(objv[objc - 1], &count);
|
||||
data = Tcl_GetByteArrayFromObj(objv[objc-1], &count);
|
||||
rawLength = (lineLength - 1) * 3 / 4;
|
||||
start = cursor = Tcl_SetByteArrayLength(resultObj,
|
||||
(lineLength + wrapcharlen) *
|
||||
@@ -2662,11 +2648,11 @@ BinaryEncodeUu(
|
||||
lineLen = rawLength;
|
||||
}
|
||||
*cursor++ = UueDigits[lineLen];
|
||||
for (i = 0 ; i < lineLen ; i++) {
|
||||
for (i=0 ; i<lineLen ; i++) {
|
||||
n <<= 8;
|
||||
n |= data[offset++];
|
||||
for (bits += 8; bits > 6 ; bits -= 6) {
|
||||
*cursor++ = UueDigits[(n >> (bits - 6)) & 0x3f];
|
||||
*cursor++ = UueDigits[(n >> (bits-6)) & 0x3f];
|
||||
}
|
||||
}
|
||||
if (bits > 0) {
|
||||
@@ -2674,7 +2660,7 @@ BinaryEncodeUu(
|
||||
*cursor++ = UueDigits[(n >> (bits + 2)) & 0x3f];
|
||||
bits = 0;
|
||||
}
|
||||
for (j = 0 ; j < wrapcharlen ; ++j) {
|
||||
for (j=0 ; j<wrapcharlen ; ++j) {
|
||||
*cursor++ = wrapchar[j];
|
||||
}
|
||||
}
|
||||
@@ -2683,7 +2669,7 @@ BinaryEncodeUu(
|
||||
* Fix the length of the output bytearray.
|
||||
*/
|
||||
|
||||
Tcl_SetByteArrayLength(resultObj, cursor - start);
|
||||
Tcl_SetByteArrayLength(resultObj, cursor-start);
|
||||
Tcl_SetObjResult(interp, resultObj);
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -2716,14 +2702,14 @@ BinaryDecodeUu(
|
||||
unsigned char *begin, *cursor;
|
||||
int i, index, size, count = 0, strict = 0, lineLen;
|
||||
unsigned char c;
|
||||
enum { OPT_STRICT };
|
||||
enum {OPT_STRICT };
|
||||
static const char *const optStrings[] = { "-strict", NULL };
|
||||
|
||||
if (objc < 2 || objc > 3) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "?options? data");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
for (i = 1; i < objc - 1; ++i) {
|
||||
for (i = 1; i < objc-1; ++i) {
|
||||
if (Tcl_GetIndexFromObj(interp, objv[i], optStrings, "option",
|
||||
TCL_EXACT, &index) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
@@ -2737,7 +2723,7 @@ BinaryDecodeUu(
|
||||
|
||||
TclNewObj(resultObj);
|
||||
datastart = data = (unsigned char *)
|
||||
TclGetStringFromObj(objv[objc - 1], &count);
|
||||
TclGetStringFromObj(objv[objc-1], &count);
|
||||
dataend = data + count;
|
||||
size = ((count + 3) & ~3) * 3 / 4;
|
||||
begin = cursor = Tcl_SetByteArrayLength(resultObj, size);
|
||||
@@ -2756,7 +2742,7 @@ BinaryDecodeUu(
|
||||
if (lineLen < 0) {
|
||||
c = *data++;
|
||||
if (c < 32 || c > 96) {
|
||||
if (strict || !TclIsSpaceProc(c)) {
|
||||
if (strict || !isspace(c)) {
|
||||
goto badUu;
|
||||
}
|
||||
i--;
|
||||
@@ -2769,12 +2755,12 @@ BinaryDecodeUu(
|
||||
* Now we read a four-character grouping.
|
||||
*/
|
||||
|
||||
for (i = 0 ; i < 4 ; i++) {
|
||||
for (i=0 ; i<4 ; i++) {
|
||||
if (data < dataend) {
|
||||
d[i] = c = *data++;
|
||||
if (c < 32 || c > 96) {
|
||||
if (strict) {
|
||||
if (!TclIsSpaceProc(c)) {
|
||||
if (!isspace(c)) {
|
||||
goto badUu;
|
||||
} else if (c == '\n') {
|
||||
goto shortUu;
|
||||
@@ -2818,7 +2804,7 @@ BinaryDecodeUu(
|
||||
} else if (c >= 32 && c <= 96) {
|
||||
data--;
|
||||
break;
|
||||
} else if (strict || !TclIsSpaceProc(c)) {
|
||||
} else if (strict || !isspace(c)) {
|
||||
goto badUu;
|
||||
}
|
||||
} while (data < dataend);
|
||||
@@ -2887,7 +2873,7 @@ BinaryDecode64(
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "?options? data");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
for (i = 1; i < objc - 1; ++i) {
|
||||
for (i = 1; i < objc-1; ++i) {
|
||||
if (Tcl_GetIndexFromObj(interp, objv[i], optStrings, "option",
|
||||
TCL_EXACT, &index) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
@@ -2901,7 +2887,7 @@ BinaryDecode64(
|
||||
|
||||
TclNewObj(resultObj);
|
||||
datastart = data = (unsigned char *)
|
||||
TclGetStringFromObj(objv[objc - 1], &count);
|
||||
TclGetStringFromObj(objv[objc-1], &count);
|
||||
dataend = data + count;
|
||||
size = ((count + 3) & ~3) * 3 / 4;
|
||||
begin = cursor = Tcl_SetByteArrayLength(resultObj, size);
|
||||
@@ -2928,14 +2914,6 @@ BinaryDecode64(
|
||||
} else if (i > 1) {
|
||||
c = '=';
|
||||
} else {
|
||||
if (strict && i <= 1) {
|
||||
/*
|
||||
* Single resp. unfulfilled char (each 4th next single
|
||||
* char) is rather bad64 error case in strict mode.
|
||||
*/
|
||||
|
||||
goto bad64;
|
||||
}
|
||||
cut += 3;
|
||||
break;
|
||||
}
|
||||
@@ -2949,10 +2927,10 @@ BinaryDecode64(
|
||||
|
||||
if (cut) {
|
||||
if (c == '=' && i > 1) {
|
||||
value <<= 6;
|
||||
cut++;
|
||||
} else if (!strict && TclIsSpaceProc(c)) {
|
||||
i--;
|
||||
value <<= 6;
|
||||
cut++;
|
||||
} else if (!strict && isspace(c)) {
|
||||
i--;
|
||||
} else {
|
||||
goto bad64;
|
||||
}
|
||||
@@ -2966,16 +2944,10 @@ BinaryDecode64(
|
||||
value = (value << 6) | 0x3e;
|
||||
} else if (c == '/') {
|
||||
value = (value << 6) | 0x3f;
|
||||
} else if (c == '=' && (!strict || i > 1)) {
|
||||
/*
|
||||
* "=" and "a=" is rather bad64 error case in strict mode.
|
||||
*/
|
||||
|
||||
} else if (c == '=') {
|
||||
value <<= 6;
|
||||
if (i) {
|
||||
cut++;
|
||||
}
|
||||
} else if (strict || !TclIsSpaceProc(c)) {
|
||||
cut++;
|
||||
} else if (strict || !isspace(c)) {
|
||||
goto bad64;
|
||||
} else {
|
||||
i--;
|
||||
@@ -2996,7 +2968,7 @@ BinaryDecode64(
|
||||
goto bad64;
|
||||
}
|
||||
for (; data < dataend; data++) {
|
||||
if (!TclIsSpaceProc(*data)) {
|
||||
if (!isspace(*data)) {
|
||||
goto bad64;
|
||||
}
|
||||
}
|
||||
@@ -3021,3 +2993,4 @@ BinaryDecode64(
|
||||
* fill-column: 78
|
||||
* End:
|
||||
*/
|
||||
|
||||
|
||||
@@ -1119,8 +1119,6 @@ Tcl_AttemptDbCkalloc(
|
||||
int line)
|
||||
{
|
||||
char *result;
|
||||
(void)file;
|
||||
(void)line;
|
||||
|
||||
result = (char *) TclpAlloc(size);
|
||||
return result;
|
||||
@@ -1200,8 +1198,6 @@ Tcl_AttemptDbCkrealloc(
|
||||
int line)
|
||||
{
|
||||
char *result;
|
||||
(void)file;
|
||||
(void)line;
|
||||
|
||||
result = (char *) TclpRealloc(ptr, size);
|
||||
return result;
|
||||
@@ -1232,8 +1228,6 @@ Tcl_DbCkfree(
|
||||
const char *file,
|
||||
int line)
|
||||
{
|
||||
(void)file;
|
||||
(void)line;
|
||||
TclpFree(ptr);
|
||||
}
|
||||
|
||||
@@ -1252,14 +1246,12 @@ void
|
||||
Tcl_InitMemory(
|
||||
Tcl_Interp *interp)
|
||||
{
|
||||
(void)interp;
|
||||
}
|
||||
|
||||
int
|
||||
Tcl_DumpActiveMemory(
|
||||
const char *fileName)
|
||||
{
|
||||
(void)fileName;
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -1268,8 +1260,6 @@ Tcl_ValidateAllMemory(
|
||||
const char *file,
|
||||
int line)
|
||||
{
|
||||
(void)file;
|
||||
(void)line;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -1277,8 +1267,6 @@ TclDumpMemoryInfo(
|
||||
ClientData clientData,
|
||||
int flags)
|
||||
{
|
||||
(void)clientData;
|
||||
(void)flags;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -1513,7 +1513,7 @@ GetJulianDayFromEraYearMonthDay(
|
||||
* Try an initial conversion in the Gregorian calendar.
|
||||
*/
|
||||
|
||||
#if 0 /* BUG https://core.tcl-lang.org/tcl/tktview?name=da340d4f32 */
|
||||
#if 0 /* BUG http://core.tcl.tk/tcl/tktview?name=da340d4f32 */
|
||||
ym1o4 = ym1 / 4;
|
||||
#else
|
||||
/*
|
||||
@@ -1652,7 +1652,6 @@ ClockGetenvObjCmd(
|
||||
{
|
||||
const char *varName;
|
||||
const char *varValue;
|
||||
(void)clientData;
|
||||
|
||||
if (objc != 2) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "name");
|
||||
@@ -1745,7 +1744,6 @@ ClockClicksObjCmd(
|
||||
int index = CLICKS_NATIVE;
|
||||
Tcl_Time now;
|
||||
Tcl_WideInt clicks = 0;
|
||||
(void)clientData;
|
||||
|
||||
switch (objc) {
|
||||
case 1:
|
||||
@@ -1774,7 +1772,8 @@ ClockClicksObjCmd(
|
||||
#endif
|
||||
break;
|
||||
case CLICKS_MICROS:
|
||||
clicks = TclpGetMicroseconds();
|
||||
Tcl_GetTime(&now);
|
||||
clicks = ((Tcl_WideInt) now.sec * 1000000) + now.usec;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1808,7 +1807,6 @@ ClockMillisecondsObjCmd(
|
||||
Tcl_Obj *const *objv) /* Parameter values */
|
||||
{
|
||||
Tcl_Time now;
|
||||
(void)clientData;
|
||||
|
||||
if (objc != 1) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, NULL);
|
||||
@@ -1845,12 +1843,15 @@ ClockMicrosecondsObjCmd(
|
||||
int objc, /* Parameter count */
|
||||
Tcl_Obj *const *objv) /* Parameter values */
|
||||
{
|
||||
(void)clientData;
|
||||
Tcl_Time now;
|
||||
|
||||
if (objc != 1) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(TclpGetMicroseconds()));
|
||||
Tcl_GetTime(&now);
|
||||
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(
|
||||
((Tcl_WideInt) now.sec * 1000000) + now.usec));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -1998,7 +1999,6 @@ ClockSecondsObjCmd(
|
||||
Tcl_Obj *const *objv) /* Parameter values */
|
||||
{
|
||||
Tcl_Time now;
|
||||
(void)clientData;
|
||||
|
||||
if (objc != 1) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, NULL);
|
||||
|
||||
+19
-14
@@ -1383,7 +1383,7 @@ FileAttrAccessTimeCmd(
|
||||
}
|
||||
#if defined(_WIN32)
|
||||
/* We use a value of 0 to indicate the access time not available */
|
||||
if (Tcl_GetAccessTimeFromStat(&buf) == 0) {
|
||||
if (buf.st_atime == 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"could not get access time for file \"%s\"",
|
||||
TclGetString(objv[1])));
|
||||
@@ -1392,14 +1392,19 @@ FileAttrAccessTimeCmd(
|
||||
#endif
|
||||
|
||||
if (objc == 3) {
|
||||
Tcl_WideInt newTime;
|
||||
/*
|
||||
* Need separate variable for reading longs from an object on 64-bit
|
||||
* platforms. [Bug 698146]
|
||||
*/
|
||||
|
||||
if (Tcl_GetWideIntFromObj(interp, objv[2], &newTime) != TCL_OK) {
|
||||
long newTime;
|
||||
|
||||
if (TclGetLongFromObj(interp, objv[2], &newTime) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
tval.actime = newTime;
|
||||
tval.modtime = Tcl_GetModificationTimeFromStat(&buf);
|
||||
tval.modtime = buf.st_mtime;
|
||||
|
||||
if (Tcl_FSUtime(objv[1], &tval) != 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
@@ -1419,7 +1424,7 @@ FileAttrAccessTimeCmd(
|
||||
}
|
||||
}
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tcl_GetAccessTimeFromStat(&buf)));
|
||||
Tcl_SetObjResult(interp, Tcl_NewLongObj((long) buf.st_atime));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -1460,7 +1465,7 @@ FileAttrModifyTimeCmd(
|
||||
}
|
||||
#if defined(_WIN32)
|
||||
/* We use a value of 0 to indicate the modification time not available */
|
||||
if (Tcl_GetModificationTimeFromStat(&buf) == 0) {
|
||||
if (buf.st_mtime == 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"could not get modification time for file \"%s\"",
|
||||
TclGetString(objv[1])));
|
||||
@@ -1473,13 +1478,13 @@ FileAttrModifyTimeCmd(
|
||||
* platforms. [Bug 698146]
|
||||
*/
|
||||
|
||||
Tcl_WideInt newTime;
|
||||
long newTime;
|
||||
|
||||
if (Tcl_GetWideIntFromObj(interp, objv[2], &newTime) != TCL_OK) {
|
||||
if (TclGetLongFromObj(interp, objv[2], &newTime) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
tval.actime = Tcl_GetAccessTimeFromStat(&buf);
|
||||
tval.actime = buf.st_atime;
|
||||
tval.modtime = newTime;
|
||||
|
||||
if (Tcl_FSUtime(objv[1], &tval) != 0) {
|
||||
@@ -1499,7 +1504,7 @@ FileAttrModifyTimeCmd(
|
||||
}
|
||||
}
|
||||
|
||||
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tcl_GetModificationTimeFromStat(&buf)));
|
||||
Tcl_SetObjResult(interp, Tcl_NewLongObj((long) buf.st_mtime));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -2122,7 +2127,7 @@ PathJoinCmd(
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "name ?name ...?");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_SetObjResult(interp, TclJoinPath(objc - 1, objv + 1, 0));
|
||||
Tcl_SetObjResult(interp, TclJoinPath(objc - 1, objv + 1));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -2530,9 +2535,9 @@ StoreStatData(
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||
STORE_ARY("blksize", Tcl_NewLongObj((long)statPtr->st_blksize));
|
||||
#endif
|
||||
STORE_ARY("atime", Tcl_NewWideIntObj(Tcl_GetAccessTimeFromStat(statPtr)));
|
||||
STORE_ARY("mtime", Tcl_NewWideIntObj(Tcl_GetModificationTimeFromStat(statPtr)));
|
||||
STORE_ARY("ctime", Tcl_NewWideIntObj(Tcl_GetChangeTimeFromStat(statPtr)));
|
||||
STORE_ARY("atime", Tcl_NewLongObj((long)statPtr->st_atime));
|
||||
STORE_ARY("mtime", Tcl_NewLongObj((long)statPtr->st_mtime));
|
||||
STORE_ARY("ctime", Tcl_NewLongObj((long)statPtr->st_ctime));
|
||||
mode = (unsigned short) statPtr->st_mode;
|
||||
STORE_ARY("mode", Tcl_NewIntObj(mode));
|
||||
STORE_ARY("type", Tcl_NewStringObj(GetTypeFromMode(mode), -1));
|
||||
|
||||
+2
-2
@@ -1960,7 +1960,7 @@ InfoProcsCmd(
|
||||
/*
|
||||
* If "info procs" worked like "info commands", returning the commands
|
||||
* also seen in the global namespace, then you would include this
|
||||
* code. As this could break backwards compatibility with 8.0-8.2, we
|
||||
* code. As this could break backwards compatibilty with 8.0-8.2, we
|
||||
* decided not to "fix" it in 8.3, leaving the behavior slightly
|
||||
* different.
|
||||
*/
|
||||
@@ -3937,7 +3937,7 @@ Tcl_LsortObjCmd(
|
||||
/*
|
||||
* Do not shrink the actual memory block used; that doesn't
|
||||
* work with TclStackAlloc-allocated memory. [Bug 2918962]
|
||||
*
|
||||
*
|
||||
* TODO: Consider a pointer increment to replace this
|
||||
* array shift.
|
||||
*/
|
||||
|
||||
+160
-730
File diff suppressed because it is too large
Load Diff
+28
-32
@@ -3408,10 +3408,10 @@ TclPushVarName(
|
||||
int *isScalarPtr) /* Must not be NULL. */
|
||||
{
|
||||
register const char *p;
|
||||
const char *last, *name, *elName;
|
||||
register int n;
|
||||
const char *name, *elName;
|
||||
register int i, n;
|
||||
Tcl_Token *elemTokenPtr = NULL;
|
||||
int nameLen, elNameLen, simpleVarName, localIndex;
|
||||
int nameChars, elNameChars, simpleVarName, localIndex;
|
||||
int elemTokenCount = 0, allocedTokens = 0, removedParen = 0;
|
||||
|
||||
/*
|
||||
@@ -3424,7 +3424,7 @@ TclPushVarName(
|
||||
|
||||
simpleVarName = 0;
|
||||
name = elName = NULL;
|
||||
nameLen = elNameLen = 0;
|
||||
nameChars = elNameChars = 0;
|
||||
localIndex = -1;
|
||||
|
||||
if (varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) {
|
||||
@@ -3436,25 +3436,22 @@ TclPushVarName(
|
||||
simpleVarName = 1;
|
||||
|
||||
name = varTokenPtr[1].start;
|
||||
nameLen = varTokenPtr[1].size;
|
||||
if (name[nameLen-1] == ')') {
|
||||
nameChars = varTokenPtr[1].size;
|
||||
if (name[nameChars-1] == ')') {
|
||||
/*
|
||||
* last char is ')' => potential array reference.
|
||||
*/
|
||||
last = Tcl_UtfPrev(name + nameLen, name);
|
||||
|
||||
if (*last == ')') {
|
||||
for (p = name; p < last; p = Tcl_UtfNext(p)) {
|
||||
if (*p == '(') {
|
||||
elName = p + 1;
|
||||
elNameLen = last - elName;
|
||||
nameLen = p - name;
|
||||
break;
|
||||
}
|
||||
for (i=0,p=name ; i<nameChars ; i++,p++) {
|
||||
if (*p == '(') {
|
||||
elName = p + 1;
|
||||
elNameChars = nameChars - i - 2;
|
||||
nameChars = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(flags & TCL_NO_ELEMENT) && elNameLen) {
|
||||
if (!(flags & TCL_NO_ELEMENT) && (elName != NULL) && elNameChars) {
|
||||
/*
|
||||
* An array element, the element name is a simple string:
|
||||
* assemble the corresponding token.
|
||||
@@ -3464,7 +3461,7 @@ TclPushVarName(
|
||||
allocedTokens = 1;
|
||||
elemTokenPtr->type = TCL_TOKEN_TEXT;
|
||||
elemTokenPtr->start = elName;
|
||||
elemTokenPtr->size = elNameLen;
|
||||
elemTokenPtr->size = elNameChars;
|
||||
elemTokenPtr->numComponents = 0;
|
||||
elemTokenCount = 1;
|
||||
}
|
||||
@@ -3472,22 +3469,21 @@ TclPushVarName(
|
||||
} else if (interp && ((n = varTokenPtr->numComponents) > 1)
|
||||
&& (varTokenPtr[1].type == TCL_TOKEN_TEXT)
|
||||
&& (varTokenPtr[n].type == TCL_TOKEN_TEXT)
|
||||
&& (*((p = varTokenPtr[n].start + varTokenPtr[n].size)-1) == ')')
|
||||
&& (*Tcl_UtfPrev(p, varTokenPtr[n].start) == ')')) {
|
||||
&& (varTokenPtr[n].start[varTokenPtr[n].size - 1] == ')')) {
|
||||
/*
|
||||
* Check for parentheses inside first token.
|
||||
*/
|
||||
|
||||
simpleVarName = 0;
|
||||
for (p = varTokenPtr[1].start,
|
||||
last = p + varTokenPtr[1].size; p < last; p = Tcl_UtfNext(p)) {
|
||||
for (i = 0, p = varTokenPtr[1].start;
|
||||
i < varTokenPtr[1].size; i++, p++) {
|
||||
if (*p == '(') {
|
||||
simpleVarName = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (simpleVarName) {
|
||||
int remainingLen;
|
||||
int remainingChars;
|
||||
|
||||
/*
|
||||
* Check the last token: if it is just ')', do not count it.
|
||||
@@ -3503,13 +3499,13 @@ TclPushVarName(
|
||||
}
|
||||
|
||||
name = varTokenPtr[1].start;
|
||||
nameLen = p - varTokenPtr[1].start;
|
||||
nameChars = p - varTokenPtr[1].start;
|
||||
elName = p + 1;
|
||||
remainingLen = (varTokenPtr[2].start - p) - 1;
|
||||
elNameLen = (varTokenPtr[n].start-p) + varTokenPtr[n].size - 1;
|
||||
remainingChars = (varTokenPtr[2].start - p) - 1;
|
||||
elNameChars = (varTokenPtr[n].start-p) + varTokenPtr[n].size - 1;
|
||||
|
||||
if (!(flags & TCL_NO_ELEMENT)) {
|
||||
if (remainingLen) {
|
||||
if (remainingChars) {
|
||||
/*
|
||||
* Make a first token with the extra characters in the first
|
||||
* token.
|
||||
@@ -3519,7 +3515,7 @@ TclPushVarName(
|
||||
allocedTokens = 1;
|
||||
elemTokenPtr->type = TCL_TOKEN_TEXT;
|
||||
elemTokenPtr->start = elName;
|
||||
elemTokenPtr->size = remainingLen;
|
||||
elemTokenPtr->size = remainingChars;
|
||||
elemTokenPtr->numComponents = 0;
|
||||
elemTokenCount = n;
|
||||
|
||||
@@ -3548,8 +3544,8 @@ TclPushVarName(
|
||||
|
||||
int hasNsQualifiers = 0;
|
||||
|
||||
for (p = name, last = p + nameLen-1; p < last; p = Tcl_UtfNext(p)) {
|
||||
if ((*p == ':') && (*(p+1) == ':')) {
|
||||
for (i = 0, p = name; i < nameChars; i++, p++) {
|
||||
if ((*p == ':') && ((i+1) < nameChars) && (*(p+1) == ':')) {
|
||||
hasNsQualifiers = 1;
|
||||
break;
|
||||
}
|
||||
@@ -3562,7 +3558,7 @@ TclPushVarName(
|
||||
*/
|
||||
|
||||
if (!hasNsQualifiers) {
|
||||
localIndex = TclFindCompiledLocal(name, nameLen, 1, envPtr);
|
||||
localIndex = TclFindCompiledLocal(name, nameChars, 1, envPtr);
|
||||
if ((flags & TCL_NO_LARGE_INDEX) && (localIndex > 255)) {
|
||||
/*
|
||||
* We'll push the name.
|
||||
@@ -3572,7 +3568,7 @@ TclPushVarName(
|
||||
}
|
||||
}
|
||||
if (interp && localIndex < 0) {
|
||||
PushLiteral(envPtr, name, nameLen);
|
||||
PushLiteral(envPtr, name, nameChars);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3581,7 +3577,7 @@ TclPushVarName(
|
||||
*/
|
||||
|
||||
if (elName != NULL && !(flags & TCL_NO_ELEMENT)) {
|
||||
if (elNameLen) {
|
||||
if (elNameChars) {
|
||||
TclCompileTokens(interp, elemTokenPtr, elemTokenCount,
|
||||
envPtr);
|
||||
} else {
|
||||
|
||||
@@ -35,7 +35,7 @@ static int IndexTailVarIfKnown(Tcl_Interp *interp,
|
||||
* TclGetIndexFromToken --
|
||||
*
|
||||
* Parse a token to determine if an index value is known at
|
||||
* compile time.
|
||||
* compile time.
|
||||
*
|
||||
* Returns:
|
||||
* TCL_OK if parsing succeeded, and TCL_ERROR if it failed.
|
||||
@@ -1536,7 +1536,7 @@ TclCompileLreplaceCmd(
|
||||
|
||||
emptyPrefix = 0;
|
||||
}
|
||||
|
||||
|
||||
if ((idx1 == suffixStart) && (parsePtr->numWords == 4)) {
|
||||
/*
|
||||
* This is a "no-op". Example: [lreplace {a b c} 2 0]
|
||||
|
||||
@@ -1002,13 +1002,13 @@ TclCompileStringReplaceCmd(
|
||||
if (parsePtr->numWords < 4 || parsePtr->numWords > 5) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* Bytecode to compute/push string argument being replaced */
|
||||
valueTokenPtr = TokenAfter(parsePtr->tokenPtr);
|
||||
CompileWord(envPtr, valueTokenPtr, interp, 1);
|
||||
|
||||
/*
|
||||
* Check for first index known and useful at compile time.
|
||||
* Check for first index known and useful at compile time.
|
||||
*/
|
||||
tokenPtr = TokenAfter(valueTokenPtr);
|
||||
if (TclGetIndexFromToken(tokenPtr, TCL_INDEX_BEFORE, TCL_INDEX_AFTER,
|
||||
@@ -1017,7 +1017,7 @@ TclCompileStringReplaceCmd(
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for last index known and useful at compile time.
|
||||
* Check for last index known and useful at compile time.
|
||||
*/
|
||||
tokenPtr = TokenAfter(tokenPtr);
|
||||
if (TclGetIndexFromToken(tokenPtr, TCL_INDEX_BEFORE, TCL_INDEX_AFTER,
|
||||
@@ -1025,7 +1025,7 @@ TclCompileStringReplaceCmd(
|
||||
goto genericReplace;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* [string replace] is an odd bird. For many arguments it is
|
||||
* a conventional substring replacer. However it also goes out
|
||||
* of its way to become a no-op for many cases where it would be
|
||||
@@ -1108,12 +1108,12 @@ TclCompileStringReplaceCmd(
|
||||
* Finally we need, third:
|
||||
*
|
||||
* (first <= last)
|
||||
*
|
||||
*
|
||||
* Considered in combination with the constraints we already have,
|
||||
* we see that we can proceed when (first == TCL_INDEX_BEFORE)
|
||||
* or (last == TCL_INDEX_AFTER). These also permit simplification
|
||||
* of the prefix|replace|suffix construction. The other constraints,
|
||||
* though, interfere with getting a guarantee that first <= last.
|
||||
* though, interfere with getting a guarantee that first <= last.
|
||||
*/
|
||||
|
||||
if ((first == TCL_INDEX_BEFORE) && (last >= TCL_INDEX_START)) {
|
||||
@@ -1141,7 +1141,7 @@ TclCompileStringReplaceCmd(
|
||||
/* FLOW THROUGH TO genericReplace */
|
||||
|
||||
} else {
|
||||
/*
|
||||
/*
|
||||
* When we have no replacement string to worry about, we may
|
||||
* have more luck, because the forbidden empty string replacements
|
||||
* are harmless when they are replaced by another empty string.
|
||||
@@ -1496,7 +1496,7 @@ TclSubstCompile(
|
||||
for (endTokenPtr = tokenPtr + parse.numTokens;
|
||||
tokenPtr < endTokenPtr; tokenPtr = TokenAfter(tokenPtr)) {
|
||||
int length, literal, catchRange, breakJump;
|
||||
char buf[TCL_UTF_MAX] = "";
|
||||
char buf[TCL_UTF_MAX];
|
||||
JumpFixup startFixup, okFixup, returnFixup, breakFixup;
|
||||
JumpFixup continueFixup, otherFixup, endFixup;
|
||||
|
||||
|
||||
+20
-54
@@ -1723,7 +1723,7 @@ TclWordKnownAtCompileTime(
|
||||
|
||||
case TCL_TOKEN_BS:
|
||||
if (tempPtr != NULL) {
|
||||
char utfBuf[TCL_UTF_MAX] = "";
|
||||
char utfBuf[TCL_UTF_MAX];
|
||||
int length = TclParseBackslash(tokenPtr->start,
|
||||
tokenPtr->size, NULL, utfBuf);
|
||||
|
||||
@@ -2121,48 +2121,25 @@ TclCompileScript(
|
||||
* has not yet generated any bytecode. */
|
||||
const char *p = script; /* Where we are in our compile. */
|
||||
int depth = TclGetStackDepth(envPtr);
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
|
||||
if (envPtr->iPtr == NULL) {
|
||||
Tcl_Panic("TclCompileScript() called on uninitialized CompileEnv");
|
||||
}
|
||||
/*
|
||||
* Check depth to avoid overflow of the C execution stack by too many
|
||||
* nested calls of TclCompileScript (considering interp recursionlimit).
|
||||
* Factor 5/4 (1.25) is used to avoid too mistaken limit recognition
|
||||
* during "mixed" evaluation and compilation process (nested eval+compile)
|
||||
* and is good enough for default recursionlimit (1000).
|
||||
*/
|
||||
if (iPtr->numLevels / 5 > iPtr->maxNestingDepth / 4) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"too many nested compilations (infinite loop?)", -1));
|
||||
Tcl_SetErrorCode(interp, "TCL", "LIMIT", "STACK", NULL);
|
||||
TclCompileSyntaxError(interp, envPtr);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Each iteration compiles one command from the script. */
|
||||
|
||||
if (numBytes > 0) {
|
||||
/*
|
||||
* Don't use system stack (size of Tcl_Parse is ca. 400 bytes), so
|
||||
* many nested compilations (body enclosed in body) can cause abnormal
|
||||
* program termination with a stack overflow exception, bug [fec0c17d39].
|
||||
*/
|
||||
Tcl_Parse *parsePtr = ckalloc(sizeof(Tcl_Parse));
|
||||
|
||||
do {
|
||||
while (numBytes > 0) {
|
||||
Tcl_Parse parse;
|
||||
const char *next;
|
||||
|
||||
if (TCL_OK != Tcl_ParseCommand(interp, p, numBytes, 0, parsePtr)) {
|
||||
if (TCL_OK != Tcl_ParseCommand(interp, p, numBytes, 0, &parse)) {
|
||||
/*
|
||||
* Compile bytecodes to report the parsePtr error at runtime.
|
||||
* Compile bytecodes to report the parse error at runtime.
|
||||
*/
|
||||
|
||||
Tcl_LogCommandInfo(interp, script, parsePtr->commandStart,
|
||||
parsePtr->term + 1 - parsePtr->commandStart);
|
||||
Tcl_LogCommandInfo(interp, script, parse.commandStart,
|
||||
parse.term + 1 - parse.commandStart);
|
||||
TclCompileSyntaxError(interp, envPtr);
|
||||
ckfree(parsePtr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2173,9 +2150,9 @@ TclCompileScript(
|
||||
*/
|
||||
|
||||
if ((tclTraceCompile >= 1) && (envPtr->procPtr == NULL)) {
|
||||
int commandLength = parsePtr->term - parsePtr->commandStart;
|
||||
int commandLength = parse.term - parse.commandStart;
|
||||
fprintf(stdout, " Compiling: ");
|
||||
TclPrintSource(stdout, parsePtr->commandStart,
|
||||
TclPrintSource(stdout, parse.commandStart,
|
||||
TclMin(commandLength, 55));
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
@@ -2186,59 +2163,48 @@ TclCompileScript(
|
||||
* (See test info-30.33).
|
||||
*/
|
||||
|
||||
TclAdvanceLines(&envPtr->line, p, parsePtr->commandStart);
|
||||
TclAdvanceLines(&envPtr->line, p, parse.commandStart);
|
||||
TclAdvanceContinuations(&envPtr->line, &envPtr->clNext,
|
||||
parsePtr->commandStart - envPtr->source);
|
||||
parse.commandStart - envPtr->source);
|
||||
|
||||
/*
|
||||
* Advance parser to the next command in the script.
|
||||
*/
|
||||
|
||||
next = parsePtr->commandStart + parsePtr->commandSize;
|
||||
next = parse.commandStart + parse.commandSize;
|
||||
numBytes -= next - p;
|
||||
p = next;
|
||||
|
||||
if (parsePtr->numWords == 0) {
|
||||
if (parse.numWords == 0) {
|
||||
/*
|
||||
* The "command" parsed has no words. In this case we can skip
|
||||
* the rest of the loop body. With no words, clearly
|
||||
* CompileCommandTokens() has nothing to do. Since the parser
|
||||
* aggressively sucks up leading comment and white space,
|
||||
* including newlines, parsePtr->commandStart must be pointing at
|
||||
* including newlines, parse.commandStart must be pointing at
|
||||
* either the end of script, or a command-terminating semi-colon.
|
||||
* In either case, the TclAdvance*() calls have nothing to do.
|
||||
* Finally, when no words are parsed, no tokens have been
|
||||
* allocated at parsePtr->tokenPtr so there's also nothing for
|
||||
* allocated at parse.tokenPtr so there's also nothing for
|
||||
* Tcl_FreeParse() to do.
|
||||
*
|
||||
* The advantage of this shortcut is that CompileCommandTokens()
|
||||
* can be written with an assumption that parsePtr->numWords > 0, with
|
||||
* can be written with an assumption that parse.numWords > 0, with
|
||||
* the implication the CCT() always generates bytecode.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Avoid stack exhaustion by too many nested calls of TclCompileScript
|
||||
* (considering interp recursionlimit).
|
||||
*/
|
||||
iPtr->numLevels++;
|
||||
|
||||
lastCmdIdx = CompileCommandTokens(interp, parsePtr, envPtr);
|
||||
|
||||
iPtr->numLevels--;
|
||||
lastCmdIdx = CompileCommandTokens(interp, &parse, envPtr);
|
||||
|
||||
/*
|
||||
* TIP #280: Track lines in the just compiled command.
|
||||
*/
|
||||
|
||||
TclAdvanceLines(&envPtr->line, parsePtr->commandStart, p);
|
||||
TclAdvanceLines(&envPtr->line, parse.commandStart, p);
|
||||
TclAdvanceContinuations(&envPtr->line, &envPtr->clNext,
|
||||
p - envPtr->source);
|
||||
Tcl_FreeParse(parsePtr);
|
||||
} while (numBytes > 0);
|
||||
|
||||
ckfree(parsePtr);
|
||||
Tcl_FreeParse(&parse);
|
||||
}
|
||||
|
||||
if (lastCmdIdx == -1) {
|
||||
@@ -2371,7 +2337,7 @@ TclCompileTokens(
|
||||
{
|
||||
Tcl_DString textBuffer; /* Holds concatenated chars from adjacent
|
||||
* TCL_TOKEN_TEXT, TCL_TOKEN_BS tokens. */
|
||||
char buffer[TCL_UTF_MAX] = "";
|
||||
char buffer[TCL_UTF_MAX];
|
||||
int i, numObjsToConcat, length, adjust;
|
||||
unsigned char *entryCodeNext = envPtr->codeNext;
|
||||
#define NUM_STATIC_POS 20
|
||||
|
||||
+2
-21
@@ -1161,25 +1161,6 @@ MODULE_SCOPE void TclPushVarName(Tcl_Interp *interp,
|
||||
Tcl_Token *varTokenPtr, CompileEnv *envPtr,
|
||||
int flags, int *localIndexPtr,
|
||||
int *isScalarPtr);
|
||||
|
||||
static inline void
|
||||
TclPreserveByteCode(
|
||||
ByteCode *codePtr)
|
||||
{
|
||||
codePtr->refCount++;
|
||||
}
|
||||
|
||||
static inline void
|
||||
TclReleaseByteCode(
|
||||
ByteCode *codePtr)
|
||||
{
|
||||
if (codePtr->refCount-- > 1) {
|
||||
return;
|
||||
}
|
||||
/* Just dropped to refcount==0. Clean up. */
|
||||
TclCleanupByteCode(codePtr);
|
||||
}
|
||||
|
||||
MODULE_SCOPE void TclReleaseLiteral(Tcl_Interp *interp, Tcl_Obj *objPtr);
|
||||
MODULE_SCOPE void TclInvalidateCmdLiteral(Tcl_Interp *interp,
|
||||
const char *name, Namespace *nsPtr);
|
||||
@@ -1209,7 +1190,7 @@ MODULE_SCOPE Tcl_Obj *TclGetInnerContext(Tcl_Interp *interp,
|
||||
const unsigned char *pc, Tcl_Obj **tosPtr);
|
||||
MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst);
|
||||
MODULE_SCOPE int TclPushProcCallFrame(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc,
|
||||
register Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const objv[], int isLambda);
|
||||
|
||||
|
||||
@@ -1420,7 +1401,7 @@ MODULE_SCOPE int TclPushProcCallFrame(ClientData clientData,
|
||||
|
||||
#define TclEmitPush(objIndex, envPtr) \
|
||||
do { \
|
||||
int _objIndexCopy = (objIndex); \
|
||||
register int _objIndexCopy = (objIndex); \
|
||||
if (_objIndexCopy <= 255) { \
|
||||
TclEmitInstInt1(INST_PUSH1, _objIndexCopy, (envPtr)); \
|
||||
} else { \
|
||||
|
||||
+29
-28
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
typedef struct Tcl_Obj Tcl_Obj;
|
||||
typedef const char* TclDTraceStr;
|
||||
|
||||
/*
|
||||
* Tcl DTrace probes
|
||||
@@ -24,14 +25,14 @@ provider tcl {
|
||||
* arg1: number of arguments (int)
|
||||
* arg2: array of proc argument objects (Tcl_Obj**)
|
||||
*/
|
||||
probe proc__entry(const char *name, int objc, struct Tcl_Obj **objv);
|
||||
probe proc__entry(TclDTraceStr name, int objc, struct Tcl_Obj **objv);
|
||||
/*
|
||||
* tcl*:::proc-return probe
|
||||
* triggered immediately after proc bytecode execution
|
||||
* arg0: proc name (string)
|
||||
* arg1: return code (int)
|
||||
*/
|
||||
probe proc__return(const char *name, int code);
|
||||
probe proc__return(TclDTraceStr name, int code);
|
||||
/*
|
||||
* tcl*:::proc-result probe
|
||||
* triggered after proc-return probe and result processing
|
||||
@@ -40,7 +41,7 @@ provider tcl {
|
||||
* arg2: proc result (string)
|
||||
* arg3: proc result object (Tcl_Obj*)
|
||||
*/
|
||||
probe proc__result(const char *name, int code, const char *result,
|
||||
probe proc__result(TclDTraceStr name, int code, TclDTraceStr result,
|
||||
struct Tcl_Obj *resultobj);
|
||||
/*
|
||||
* tcl*:::proc-args probe
|
||||
@@ -49,10 +50,10 @@ provider tcl {
|
||||
* arg0: proc name (string)
|
||||
* arg1-arg9: proc arguments or NULL (strings)
|
||||
*/
|
||||
probe proc__args(const char *name, const char *arg1, const char *arg2,
|
||||
const char *arg3, const char *arg4, const char *arg5,
|
||||
const char *arg6, const char *arg7, const char *arg8,
|
||||
const char *arg9);
|
||||
probe proc__args(TclDTraceStr name, TclDTraceStr arg1, TclDTraceStr arg2,
|
||||
TclDTraceStr arg3, TclDTraceStr arg4, TclDTraceStr arg5,
|
||||
TclDTraceStr arg6, TclDTraceStr arg7, TclDTraceStr arg8,
|
||||
TclDTraceStr arg9);
|
||||
/*
|
||||
* tcl*:::proc-info probe
|
||||
* triggered before proc-entry probe, gives access to TIP 280
|
||||
@@ -66,9 +67,9 @@ provider tcl {
|
||||
* arg6: TclOO method (string)
|
||||
* arg7: TclOO class/object (string)
|
||||
*/
|
||||
probe proc__info(const char *cmd, const char *type, const char *proc,
|
||||
const char *file, int line, int level, const char *method,
|
||||
const char *class);
|
||||
probe proc__info(TclDTraceStr cmd, TclDTraceStr type, TclDTraceStr proc,
|
||||
TclDTraceStr file, int line, int level, TclDTraceStr method,
|
||||
TclDTraceStr class);
|
||||
|
||||
/***************************** cmd probes ******************************/
|
||||
/*
|
||||
@@ -78,14 +79,14 @@ provider tcl {
|
||||
* arg1: number of arguments (int)
|
||||
* arg2: array of command argument objects (Tcl_Obj**)
|
||||
*/
|
||||
probe cmd__entry(const char *name, int objc, struct Tcl_Obj **objv);
|
||||
probe cmd__entry(TclDTraceStr name, int objc, struct Tcl_Obj **objv);
|
||||
/*
|
||||
* tcl*:::cmd-return probe
|
||||
* triggered immediately after commmand execution
|
||||
* arg0: command name (string)
|
||||
* arg1: return code (int)
|
||||
*/
|
||||
probe cmd__return(const char *name, int code);
|
||||
probe cmd__return(TclDTraceStr name, int code);
|
||||
/*
|
||||
* tcl*:::cmd-result probe
|
||||
* triggered after cmd-return probe and result processing
|
||||
@@ -94,7 +95,7 @@ provider tcl {
|
||||
* arg2: command result (string)
|
||||
* arg3: command result object (Tcl_Obj*)
|
||||
*/
|
||||
probe cmd__result(const char *name, int code, const char *result,
|
||||
probe cmd__result(TclDTraceStr name, int code, TclDTraceStr result,
|
||||
struct Tcl_Obj *resultobj);
|
||||
/*
|
||||
* tcl*:::cmd-args probe
|
||||
@@ -103,10 +104,10 @@ provider tcl {
|
||||
* arg0: command name (string)
|
||||
* arg1-arg9: command arguments or NULL (strings)
|
||||
*/
|
||||
probe cmd__args(const char *name, const char *arg1, const char *arg2,
|
||||
const char *arg3, const char *arg4, const char *arg5,
|
||||
const char *arg6, const char *arg7, const char *arg8,
|
||||
const char *arg9);
|
||||
probe cmd__args(TclDTraceStr name, TclDTraceStr arg1, TclDTraceStr arg2,
|
||||
TclDTraceStr arg3, TclDTraceStr arg4, TclDTraceStr arg5,
|
||||
TclDTraceStr arg6, TclDTraceStr arg7, TclDTraceStr arg8,
|
||||
TclDTraceStr arg9);
|
||||
/*
|
||||
* tcl*:::cmd-info probe
|
||||
* triggered before cmd-entry probe, gives access to TIP 280
|
||||
@@ -120,9 +121,9 @@ provider tcl {
|
||||
* arg6: TclOO method (string)
|
||||
* arg7: TclOO class/object (string)
|
||||
*/
|
||||
probe cmd__info(const char *cmd, const char *type, const char *proc,
|
||||
const char *file, int line, int level, const char *method,
|
||||
const char *class);
|
||||
probe cmd__info(TclDTraceStr cmd, TclDTraceStr type, TclDTraceStr proc,
|
||||
TclDTraceStr file, int line, int level, TclDTraceStr method,
|
||||
TclDTraceStr class);
|
||||
|
||||
/***************************** inst probes *****************************/
|
||||
/*
|
||||
@@ -132,7 +133,7 @@ provider tcl {
|
||||
* arg1: depth of stack (int)
|
||||
* arg2: top of stack (Tcl_Obj**)
|
||||
*/
|
||||
probe inst__start(const char *name, int depth, struct Tcl_Obj **stack);
|
||||
probe inst__start(TclDTraceStr name, int depth, struct Tcl_Obj **stack);
|
||||
/*
|
||||
* tcl*:::inst-done probe
|
||||
* triggered immediately after execution of a bytecode
|
||||
@@ -140,7 +141,7 @@ provider tcl {
|
||||
* arg1: depth of stack (int)
|
||||
* arg2: top of stack (Tcl_Obj**)
|
||||
*/
|
||||
probe inst__done(const char *name, int depth, struct Tcl_Obj **stack);
|
||||
probe inst__done(TclDTraceStr name, int depth, struct Tcl_Obj **stack);
|
||||
|
||||
/***************************** obj probes ******************************/
|
||||
/*
|
||||
@@ -162,10 +163,10 @@ provider tcl {
|
||||
* triggered when the ::tcl::dtrace command is called
|
||||
* arg0-arg9: command arguments (strings)
|
||||
*/
|
||||
probe tcl__probe(const char *arg0, const char *arg1, const char *arg2,
|
||||
const char *arg3, const char *arg4, const char *arg5,
|
||||
const char *arg6, const char *arg7, const char *arg8,
|
||||
const char *arg9);
|
||||
probe tcl__probe(TclDTraceStr arg0, TclDTraceStr arg1, TclDTraceStr arg2,
|
||||
TclDTraceStr arg3, TclDTraceStr arg4, TclDTraceStr arg5,
|
||||
TclDTraceStr arg6, TclDTraceStr arg7, TclDTraceStr arg8,
|
||||
TclDTraceStr arg9);
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -173,7 +174,7 @@ provider tcl {
|
||||
*/
|
||||
|
||||
typedef struct Tcl_ObjType {
|
||||
const char *name;
|
||||
char *name;
|
||||
void *freeIntRepProc;
|
||||
void *dupIntRepProc;
|
||||
void *updateStringProc;
|
||||
@@ -184,7 +185,7 @@ struct Tcl_Obj {
|
||||
int refCount;
|
||||
char *bytes;
|
||||
int length;
|
||||
const Tcl_ObjType *typePtr;
|
||||
Tcl_ObjType *typePtr;
|
||||
union {
|
||||
long longValue;
|
||||
double doubleValue;
|
||||
|
||||
@@ -1816,25 +1816,6 @@ EXTERN int Tcl_FSUnloadFile(Tcl_Interp *interp,
|
||||
EXTERN void Tcl_ZlibStreamSetCompressionDictionary(
|
||||
Tcl_ZlibStream zhandle,
|
||||
Tcl_Obj *compressionDictionaryObj);
|
||||
/* Slot 631 is reserved */
|
||||
/* Slot 632 is reserved */
|
||||
/* Slot 633 is reserved */
|
||||
/* Slot 634 is reserved */
|
||||
/* Slot 635 is reserved */
|
||||
/* Slot 636 is reserved */
|
||||
/* Slot 637 is reserved */
|
||||
/* Slot 638 is reserved */
|
||||
/* Slot 639 is reserved */
|
||||
/* Slot 640 is reserved */
|
||||
/* Slot 641 is reserved */
|
||||
/* Slot 642 is reserved */
|
||||
/* Slot 643 is reserved */
|
||||
/* Slot 644 is reserved */
|
||||
/* Slot 645 is reserved */
|
||||
/* Slot 646 is reserved */
|
||||
/* Slot 647 is reserved */
|
||||
/* 648 */
|
||||
EXTERN void TclUnusedStubEntry(void);
|
||||
|
||||
typedef struct {
|
||||
const struct TclPlatStubs *tclPlatStubs;
|
||||
@@ -2501,24 +2482,6 @@ typedef struct TclStubs {
|
||||
void * (*tcl_FindSymbol) (Tcl_Interp *interp, Tcl_LoadHandle handle, const char *symbol); /* 628 */
|
||||
int (*tcl_FSUnloadFile) (Tcl_Interp *interp, Tcl_LoadHandle handlePtr); /* 629 */
|
||||
void (*tcl_ZlibStreamSetCompressionDictionary) (Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); /* 630 */
|
||||
void (*reserved631)(void);
|
||||
void (*reserved632)(void);
|
||||
void (*reserved633)(void);
|
||||
void (*reserved634)(void);
|
||||
void (*reserved635)(void);
|
||||
void (*reserved636)(void);
|
||||
void (*reserved637)(void);
|
||||
void (*reserved638)(void);
|
||||
void (*reserved639)(void);
|
||||
void (*reserved640)(void);
|
||||
void (*reserved641)(void);
|
||||
void (*reserved642)(void);
|
||||
void (*reserved643)(void);
|
||||
void (*reserved644)(void);
|
||||
void (*reserved645)(void);
|
||||
void (*reserved646)(void);
|
||||
void (*reserved647)(void);
|
||||
void (*tclUnusedStubEntry) (void); /* 648 */
|
||||
} TclStubs;
|
||||
|
||||
extern const TclStubs *tclStubsPtr;
|
||||
@@ -3811,32 +3774,11 @@ extern const TclStubs *tclStubsPtr;
|
||||
(tclStubsPtr->tcl_FSUnloadFile) /* 629 */
|
||||
#define Tcl_ZlibStreamSetCompressionDictionary \
|
||||
(tclStubsPtr->tcl_ZlibStreamSetCompressionDictionary) /* 630 */
|
||||
/* Slot 631 is reserved */
|
||||
/* Slot 632 is reserved */
|
||||
/* Slot 633 is reserved */
|
||||
/* Slot 634 is reserved */
|
||||
/* Slot 635 is reserved */
|
||||
/* Slot 636 is reserved */
|
||||
/* Slot 637 is reserved */
|
||||
/* Slot 638 is reserved */
|
||||
/* Slot 639 is reserved */
|
||||
/* Slot 640 is reserved */
|
||||
/* Slot 641 is reserved */
|
||||
/* Slot 642 is reserved */
|
||||
/* Slot 643 is reserved */
|
||||
/* Slot 644 is reserved */
|
||||
/* Slot 645 is reserved */
|
||||
/* Slot 646 is reserved */
|
||||
/* Slot 647 is reserved */
|
||||
#define TclUnusedStubEntry \
|
||||
(tclStubsPtr->tclUnusedStubEntry) /* 648 */
|
||||
|
||||
#endif /* defined(USE_TCL_STUBS) */
|
||||
|
||||
/* !END!: Do not edit above this line. */
|
||||
|
||||
#undef TclUnusedStubEntry
|
||||
|
||||
#if defined(USE_TCL_STUBS)
|
||||
# undef Tcl_CreateInterp
|
||||
# undef Tcl_FindExecutable
|
||||
|
||||
@@ -3083,7 +3083,6 @@ DictFilterCmd(
|
||||
|
||||
Tcl_ResetResult(interp);
|
||||
Tcl_DictObjDone(&search);
|
||||
/* FALLTHRU */
|
||||
case TCL_CONTINUE:
|
||||
result = TCL_OK;
|
||||
break;
|
||||
|
||||
+39
-54
@@ -305,7 +305,7 @@ Tcl_GetEncodingFromObj(
|
||||
Tcl_Obj *objPtr,
|
||||
Tcl_Encoding *encodingPtr)
|
||||
{
|
||||
const char *name = TclGetString(objPtr);
|
||||
const char *name = Tcl_GetString(objPtr);
|
||||
|
||||
if (objPtr->typePtr != &encodingType) {
|
||||
Tcl_Encoding encoding = Tcl_GetEncoding(interp, name);
|
||||
@@ -704,7 +704,7 @@ Tcl_GetDefaultEncodingDir(void)
|
||||
}
|
||||
Tcl_ListObjIndex(NULL, searchPath, 0, &first);
|
||||
|
||||
return TclGetString(first);
|
||||
return Tcl_GetString(first);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1260,7 +1260,7 @@ Tcl_ExternalToUtf(
|
||||
if (*dstCharsPtr <= maxChars) {
|
||||
break;
|
||||
}
|
||||
dstLen = Tcl_UtfAtIndex(dst, maxChars) - dst + (TCL_UTF_MAX - 1);
|
||||
dstLen = Tcl_UtfAtIndex(dst, maxChars) - 1 - dst + TCL_UTF_MAX;
|
||||
flags = savedFlags;
|
||||
*statePtr = savedState;
|
||||
} while (1);
|
||||
@@ -1518,10 +1518,10 @@ OpenEncodingFileChannel(
|
||||
}
|
||||
}
|
||||
if (!verified) {
|
||||
const char *dirString = TclGetString(directory);
|
||||
const char *dirString = Tcl_GetString(directory);
|
||||
|
||||
for (i=0; i<numDirs && !verified; i++) {
|
||||
if (strcmp(dirString, TclGetString(dir[i])) == 0) {
|
||||
if (strcmp(dirString, Tcl_GetString(dir[i])) == 0) {
|
||||
verified = 1;
|
||||
}
|
||||
}
|
||||
@@ -1720,9 +1720,7 @@ LoadTableEncoding(
|
||||
};
|
||||
|
||||
Tcl_DStringInit(&lineString);
|
||||
if (Tcl_Gets(chan, &lineString) == -1) {
|
||||
return NULL;
|
||||
}
|
||||
Tcl_Gets(chan, &lineString);
|
||||
line = Tcl_DStringValue(&lineString);
|
||||
|
||||
fallback = (int) strtol(line, &line, 16);
|
||||
@@ -1762,12 +1760,9 @@ LoadTableEncoding(
|
||||
for (i = 0; i < numPages; i++) {
|
||||
int ch;
|
||||
const char *p;
|
||||
int expected = 3 + 16 * (16 * 4 + 1);
|
||||
|
||||
if (Tcl_ReadChars(chan, objPtr, expected, 0) != expected) {
|
||||
return NULL;
|
||||
}
|
||||
p = TclGetString(objPtr);
|
||||
Tcl_ReadChars(chan, objPtr, 3 + 16 * (16 * 4 + 1), 0);
|
||||
p = Tcl_GetString(objPtr);
|
||||
hi = (staticHex[UCHAR(p[0])] << 4) + staticHex[UCHAR(p[1])];
|
||||
dataPtr->toUnicode[hi] = pageMemPtr;
|
||||
p += 2;
|
||||
@@ -2054,13 +2049,13 @@ LoadEscapeEncoding(
|
||||
+ Tcl_DStringLength(&escapeData);
|
||||
dataPtr = ckalloc(size);
|
||||
dataPtr->initLen = strlen(init);
|
||||
memcpy(dataPtr->init, init, dataPtr->initLen + 1);
|
||||
memcpy(dataPtr->init, init, (unsigned) dataPtr->initLen + 1);
|
||||
dataPtr->finalLen = strlen(final);
|
||||
memcpy(dataPtr->final, final, dataPtr->finalLen + 1);
|
||||
memcpy(dataPtr->final, final, (unsigned) dataPtr->finalLen + 1);
|
||||
dataPtr->numSubTables =
|
||||
Tcl_DStringLength(&escapeData) / sizeof(EscapeSubTable);
|
||||
memcpy(dataPtr->subTables, Tcl_DStringValue(&escapeData),
|
||||
Tcl_DStringLength(&escapeData));
|
||||
(size_t) Tcl_DStringLength(&escapeData));
|
||||
Tcl_DStringFree(&escapeData);
|
||||
|
||||
memset(dataPtr->prefixBytes, 0, sizeof(dataPtr->prefixBytes));
|
||||
@@ -2148,14 +2143,14 @@ BinaryProc(
|
||||
*srcReadPtr = srcLen;
|
||||
*dstWrotePtr = srcLen;
|
||||
*dstCharsPtr = srcLen;
|
||||
memcpy(dst, src, srcLen);
|
||||
memcpy(dst, src, (size_t) srcLen);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
*-------------------------------------------------------------------------
|
||||
*
|
||||
* UtfIntToUtfExtProc --
|
||||
* UtfExtToUtfIntProc --
|
||||
*
|
||||
* Convert from UTF-8 to UTF-8. While converting null-bytes from the
|
||||
* Tcl's internal representation (0xc0, 0x80) to the official
|
||||
@@ -2296,7 +2291,7 @@ UtfToUtfProc(
|
||||
* output buffer. */
|
||||
int pureNullMode) /* Convert embedded nulls from internal
|
||||
* representation to real null-bytes or vice
|
||||
* versa. Also combine or separate surrogate pairs */
|
||||
* versa. */
|
||||
{
|
||||
const char *srcStart, *srcEnd, *srcClose;
|
||||
const char *dstStart, *dstEnd;
|
||||
@@ -2312,14 +2307,14 @@ UtfToUtfProc(
|
||||
srcEnd = src + srcLen;
|
||||
srcClose = srcEnd;
|
||||
if ((flags & TCL_ENCODING_END) == 0) {
|
||||
srcClose -= 6;
|
||||
srcClose -= TCL_UTF_MAX;
|
||||
}
|
||||
if (flags & TCL_ENCODING_CHAR_LIMIT) {
|
||||
charLimit = *dstCharsPtr;
|
||||
}
|
||||
|
||||
dstStart = dst;
|
||||
dstEnd = dst + dstLen - ((pureNullMode == 1) ? 4 : TCL_UTF_MAX);
|
||||
dstEnd = dst + dstLen - TCL_UTF_MAX;
|
||||
|
||||
for (numChars = 0; src < srcEnd && numChars <= charLimit; numChars++) {
|
||||
if ((src > srcClose) && (!Tcl_UtfCharComplete(src, srcEnd - src))) {
|
||||
@@ -2361,28 +2356,15 @@ UtfToUtfProc(
|
||||
src += 1;
|
||||
dst += Tcl_UniCharToUtf(*chPtr, dst);
|
||||
} else {
|
||||
src += TclUtfToUniChar(src, chPtr);
|
||||
if ((*chPtr & 0xFC00) == 0xD800) {
|
||||
/* A high surrogate character is detected, handle especially */
|
||||
Tcl_UniChar low = *chPtr;
|
||||
size_t len = (src <= srcEnd-3) ? Tcl_UtfToUniChar(src, &low) : 0;
|
||||
if ((low & 0xFC00) != 0xDC00) {
|
||||
*dst++ = (char) (((*chPtr >> 12) | 0xE0) & 0xEF);
|
||||
*dst++ = (char) (((*chPtr >> 6) | 0x80) & 0xBF);
|
||||
*dst++ = (char) ((*chPtr | 0x80) & 0xBF);
|
||||
continue;
|
||||
} else if (pureNullMode == 1) {
|
||||
int full = (((*chPtr & 0x3FF) << 10) | (low & 0x3FF)) + 0x10000;
|
||||
*dst++ = (char) (((full >> 18) | 0xF0) & 0xF7);
|
||||
*dst++ = (char) (((full >> 12) | 0x80) & 0xBF);
|
||||
*dst++ = (char) (((full >> 6) | 0x80) & 0xBF);
|
||||
*dst++ = (char) ((full | 0x80) & 0xBF);
|
||||
*chPtr = 0;
|
||||
src += len;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
int len = TclUtfToUniChar(src, chPtr);
|
||||
src += len;
|
||||
dst += Tcl_UniCharToUtf(*chPtr, dst);
|
||||
#if TCL_UTF_MAX == 4
|
||||
if (!len) {
|
||||
src += TclUtfToUniChar(src, chPtr);
|
||||
dst += Tcl_UniCharToUtf(*chPtr, dst);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2438,8 +2420,11 @@ UnicodeToUtfProc(
|
||||
const char *srcStart, *srcEnd;
|
||||
const char *dstEnd, *dstStart;
|
||||
int result, numChars, charLimit = INT_MAX;
|
||||
Tcl_UniChar ch;
|
||||
Tcl_UniChar *chPtr = (Tcl_UniChar *) statePtr;
|
||||
|
||||
if (flags & TCL_ENCODING_START) {
|
||||
*statePtr = 0;
|
||||
}
|
||||
if (flags & TCL_ENCODING_CHAR_LIMIT) {
|
||||
charLimit = *dstCharsPtr;
|
||||
}
|
||||
@@ -2467,11 +2452,11 @@ UnicodeToUtfProc(
|
||||
* Tcl_UniChar-size data.
|
||||
*/
|
||||
|
||||
ch = *(Tcl_UniChar *)src;
|
||||
if (ch && ch < 0x80) {
|
||||
*dst++ = (ch & 0xFF);
|
||||
*chPtr = *(Tcl_UniChar *)src;
|
||||
if (*chPtr && *chPtr < 0x80) {
|
||||
*dst++ = (*chPtr & 0xFF);
|
||||
} else {
|
||||
dst += Tcl_UniCharToUtf(ch, dst);
|
||||
dst += Tcl_UniCharToUtf(*chPtr, dst);
|
||||
}
|
||||
src += sizeof(Tcl_UniChar);
|
||||
}
|
||||
@@ -2963,7 +2948,6 @@ Iso88591FromUtfProc(
|
||||
const char *srcStart, *srcEnd, *srcClose;
|
||||
const char *dstStart, *dstEnd;
|
||||
int result, numChars;
|
||||
Tcl_UniChar ch = 0;
|
||||
|
||||
result = TCL_OK;
|
||||
|
||||
@@ -2978,6 +2962,7 @@ Iso88591FromUtfProc(
|
||||
dstEnd = dst + dstLen - 1;
|
||||
|
||||
for (numChars = 0; src < srcEnd; numChars++) {
|
||||
Tcl_UniChar ch = 0;
|
||||
int len;
|
||||
|
||||
if ((src > srcClose) && (!Tcl_UtfCharComplete(src, srcEnd - src))) {
|
||||
@@ -2997,7 +2982,7 @@ Iso88591FromUtfProc(
|
||||
|
||||
if (ch > 0xff
|
||||
#if TCL_UTF_MAX == 4
|
||||
|| ((ch >= 0xD800) && (len < 3))
|
||||
|| !len
|
||||
#endif
|
||||
) {
|
||||
if (flags & TCL_ENCODING_STOPONERROR) {
|
||||
@@ -3005,7 +2990,7 @@ Iso88591FromUtfProc(
|
||||
break;
|
||||
}
|
||||
#if TCL_UTF_MAX == 4
|
||||
if ((ch >= 0xD800) && (len < 3)) len = 4;
|
||||
if (!len) len = 4;
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -3331,7 +3316,6 @@ EscapeFromUtfProc(
|
||||
const TableEncodingData *tableDataPtr;
|
||||
const char *tablePrefixBytes;
|
||||
const unsigned short *const *tableFromUnicode;
|
||||
Tcl_UniChar ch = 0;
|
||||
|
||||
result = TCL_OK;
|
||||
|
||||
@@ -3357,7 +3341,7 @@ EscapeFromUtfProc(
|
||||
*dstWrotePtr = 0;
|
||||
return TCL_CONVERT_NOSPACE;
|
||||
}
|
||||
memcpy(dst, dataPtr->init, dataPtr->initLen);
|
||||
memcpy(dst, dataPtr->init, (size_t)dataPtr->initLen);
|
||||
dst += dataPtr->initLen;
|
||||
} else {
|
||||
state = PTR2INT(*statePtr);
|
||||
@@ -3372,6 +3356,7 @@ EscapeFromUtfProc(
|
||||
for (numChars = 0; src < srcEnd; numChars++) {
|
||||
unsigned len;
|
||||
int word;
|
||||
Tcl_UniChar ch = 0;
|
||||
|
||||
if ((src > srcClose) && (!Tcl_UtfCharComplete(src, srcEnd - src))) {
|
||||
/*
|
||||
@@ -3435,7 +3420,7 @@ EscapeFromUtfProc(
|
||||
break;
|
||||
}
|
||||
memcpy(dst, subTablePtr->sequence,
|
||||
subTablePtr->sequenceLen);
|
||||
(size_t) subTablePtr->sequenceLen);
|
||||
dst += subTablePtr->sequenceLen;
|
||||
}
|
||||
}
|
||||
@@ -3478,7 +3463,7 @@ EscapeFromUtfProc(
|
||||
memcpy(dst, dataPtr->subTables[0].sequence, len);
|
||||
dst += len;
|
||||
}
|
||||
memcpy(dst, dataPtr->final, dataPtr->finalLen);
|
||||
memcpy(dst, dataPtr->final, (size_t) dataPtr->finalLen);
|
||||
dst += dataPtr->finalLen;
|
||||
state &= ~TCL_ENCODING_END;
|
||||
}
|
||||
|
||||
+21
-44
@@ -649,12 +649,12 @@ TclNamespaceEnsembleCmd(
|
||||
|
||||
Tcl_Command
|
||||
TclCreateEnsembleInNs(
|
||||
Tcl_Interp *interp,
|
||||
|
||||
Tcl_Interp *interp,
|
||||
|
||||
const char *name, /* Simple name of command to create (no */
|
||||
/* namespace components). */
|
||||
Tcl_Namespace /* Name of namespace to create the command in. */
|
||||
*nameNsPtr,
|
||||
Tcl_Namespace /* Name of namespace to create the command in. */
|
||||
*nameNsPtr,
|
||||
Tcl_Namespace
|
||||
*ensembleNsPtr, /* Name of the namespace for the ensemble. */
|
||||
int flags
|
||||
@@ -2071,8 +2071,8 @@ TclResetRewriteEnsemble(
|
||||
*
|
||||
* TclSpellFix --
|
||||
*
|
||||
* Record a spelling correction that needs making in the generation of
|
||||
* the WrongNumArgs usage message.
|
||||
* Record a spelling correction that needs making in the
|
||||
* generation of the WrongNumArgs usage message.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
@@ -2089,10 +2089,9 @@ FreeER(
|
||||
Tcl_Interp *interp,
|
||||
int result)
|
||||
{
|
||||
Tcl_Obj **tmp = (Tcl_Obj **) data[0];
|
||||
Tcl_Obj **store = (Tcl_Obj **) data[1];
|
||||
Tcl_Obj **tmp = (Tcl_Obj **)data[0];
|
||||
|
||||
ckfree(store);
|
||||
ckfree(tmp[2]);
|
||||
ckfree(tmp);
|
||||
return result;
|
||||
}
|
||||
@@ -2118,28 +2117,22 @@ TclSpellFix(
|
||||
iPtr->ensembleRewrite.numInsertedObjs = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the valid length of the ensemble root.
|
||||
*/
|
||||
/* Compute the valid length of the ensemble root */
|
||||
|
||||
size = iPtr->ensembleRewrite.numRemovedObjs + objc
|
||||
- iPtr->ensembleRewrite.numInsertedObjs;
|
||||
|
||||
search = iPtr->ensembleRewrite.sourceObjs;
|
||||
if (search[0] == NULL) {
|
||||
/*
|
||||
* Awful casting abuse here!
|
||||
*/
|
||||
|
||||
/* Awful casting abuse here */
|
||||
search = (Tcl_Obj *const *) search[1];
|
||||
}
|
||||
|
||||
if (badIdx < iPtr->ensembleRewrite.numInsertedObjs) {
|
||||
/*
|
||||
* Misspelled value was inserted. We cannot directly jump to the bad
|
||||
* value, but have to search.
|
||||
* Misspelled value was inserted. We cannot directly jump
|
||||
* to the bad value, but have to search.
|
||||
*/
|
||||
|
||||
idx = 1;
|
||||
while (idx < size) {
|
||||
if (search[idx] == bad) {
|
||||
@@ -2151,10 +2144,7 @@ TclSpellFix(
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Jump to the misspelled value.
|
||||
*/
|
||||
|
||||
/* Jump to the misspelled value. */
|
||||
idx = iPtr->ensembleRewrite.numRemovedObjs + badIdx
|
||||
- iPtr->ensembleRewrite.numInsertedObjs;
|
||||
|
||||
@@ -2166,26 +2156,17 @@ TclSpellFix(
|
||||
|
||||
search = iPtr->ensembleRewrite.sourceObjs;
|
||||
if (search[0] == NULL) {
|
||||
store = (Tcl_Obj **) search[2];
|
||||
store = (Tcl_Obj **)search[2];
|
||||
} else {
|
||||
Tcl_Obj **tmp = ckalloc(3 * sizeof(Tcl_Obj *));
|
||||
|
||||
store = ckalloc(size * sizeof(Tcl_Obj *));
|
||||
memcpy(store, iPtr->ensembleRewrite.sourceObjs,
|
||||
size * sizeof(Tcl_Obj *));
|
||||
|
||||
/*
|
||||
* Awful casting abuse here! Note that the NULL in the first element
|
||||
* indicates that the initial objects are a raw array in the second
|
||||
* element and the rewritten ones are a raw array in the third.
|
||||
*/
|
||||
|
||||
tmp[0] = NULL;
|
||||
tmp[1] = (Tcl_Obj *) iPtr->ensembleRewrite.sourceObjs;
|
||||
tmp[2] = (Tcl_Obj *) store;
|
||||
iPtr->ensembleRewrite.sourceObjs = (Tcl_Obj *const *) tmp;
|
||||
tmp[1] = (Tcl_Obj *)iPtr->ensembleRewrite.sourceObjs;
|
||||
tmp[2] = (Tcl_Obj *)ckalloc(size * sizeof(Tcl_Obj *));
|
||||
memcpy(tmp[2], tmp[1], size*sizeof(Tcl_Obj *));
|
||||
|
||||
TclNRAddCallback(interp, FreeER, tmp, store, NULL, NULL);
|
||||
iPtr->ensembleRewrite.sourceObjs = (Tcl_Obj *const *) tmp;
|
||||
TclNRAddCallback(interp, FreeER, tmp, NULL, NULL, NULL);
|
||||
store = (Tcl_Obj **)tmp[2];
|
||||
}
|
||||
|
||||
store[idx] = fix;
|
||||
@@ -2694,11 +2675,7 @@ BuildEnsembleConfig(
|
||||
if (isNew) {
|
||||
Tcl_Obj *cmdObj, *cmdPrefixObj;
|
||||
|
||||
TclNewObj(cmdObj);
|
||||
Tcl_AppendStringsToObj(cmdObj,
|
||||
ensemblePtr->nsPtr->fullName,
|
||||
(ensemblePtr->nsPtr->parentPtr ? "::" : ""),
|
||||
nsCmdName, NULL);
|
||||
cmdObj = Tcl_NewStringObj(nsCmdName, -1);
|
||||
cmdPrefixObj = Tcl_NewListObj(1, &cmdObj);
|
||||
Tcl_SetHashValue(hPtr, cmdPrefixObj);
|
||||
Tcl_IncrRefCount(cmdPrefixObj);
|
||||
|
||||
+1
-14
@@ -119,8 +119,7 @@ TclSetupEnv(
|
||||
Tcl_MutexLock(&envMutex);
|
||||
for (i = 0; environ[i] != NULL; i++) {
|
||||
Tcl_Obj *obj1, *obj2;
|
||||
const char *p1;
|
||||
char *p2;
|
||||
char *p1, *p2;
|
||||
|
||||
p1 = Tcl_ExternalToUtfDString(NULL, environ[i], -1, &envString);
|
||||
p2 = strchr(p1, '=');
|
||||
@@ -136,18 +135,6 @@ TclSetupEnv(
|
||||
}
|
||||
p2++;
|
||||
p2[-1] = '\0';
|
||||
#if defined(_WIN32)
|
||||
/*
|
||||
* Enforce PATH and COMSPEC to be all uppercase. This eliminates
|
||||
* additional trace logic otherwise required in init.tcl.
|
||||
*/
|
||||
|
||||
if (strcasecmp(p1, "PATH") == 0) {
|
||||
p1 = "PATH";
|
||||
} else if (strcasecmp(p1, "COMSPEC") == 0) {
|
||||
p1 = "COMSPEC";
|
||||
}
|
||||
#endif
|
||||
obj1 = Tcl_NewStringObj(p1, -1);
|
||||
obj2 = Tcl_NewStringObj(p2, -1);
|
||||
Tcl_DStringFree(&envString);
|
||||
|
||||
+9
-14
@@ -944,20 +944,16 @@ Tcl_Exit(
|
||||
currentAppExitPtr = appExitPtr;
|
||||
Tcl_MutexUnlock(&exitMutex);
|
||||
|
||||
/*
|
||||
* Warning: this function SHOULD NOT return, as there is code that depends
|
||||
* on Tcl_Exit never returning. In fact, we will Tcl_Panic if anyone
|
||||
* returns, so critical is this dependcy.
|
||||
*
|
||||
* If subsystems are not (yet) initialized, proper Tcl-finalization is
|
||||
* impossible, so fallback to system exit, see bug-[f8a33ce3db5d8cc2].
|
||||
*/
|
||||
|
||||
if (currentAppExitPtr) {
|
||||
/*
|
||||
* Warning: this code SHOULD NOT return, as there is code that depends
|
||||
* on Tcl_Exit never returning. In fact, we will Tcl_Panic if anyone
|
||||
* returns, so critical is this dependcy.
|
||||
*/
|
||||
|
||||
currentAppExitPtr(INT2PTR(status));
|
||||
|
||||
} else if (subsystemsInitialized) {
|
||||
Tcl_Panic("AppExitProc returned unexpectedly");
|
||||
} else {
|
||||
|
||||
if (TclFullFinalizationRequested()) {
|
||||
|
||||
@@ -990,10 +986,9 @@ Tcl_Exit(
|
||||
|
||||
FinalizeThread(/* quick */ 1);
|
||||
}
|
||||
TclpExit(status);
|
||||
Tcl_Panic("OS exit failed!");
|
||||
}
|
||||
|
||||
TclpExit(status);
|
||||
Tcl_Panic("OS exit failed!");
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+328
-275
@@ -2014,7 +2014,7 @@ ArgumentBCEnter(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
#define bcFramePtr (&TD->cmdFrame)
|
||||
#define initCatchTop ((ptrdiff_t *) (TD->stack-1))
|
||||
#define initCatchTop ((ptrdiff_t *) (&TD->stack[-1]))
|
||||
#define initTosPtr ((Tcl_Obj **) (initCatchTop+codePtr->maxExceptDepth))
|
||||
#define esPtr (iPtr->execEnvPtr->execStackPtr)
|
||||
|
||||
@@ -2086,14 +2086,7 @@ TclNRExecuteByteCode(
|
||||
*/
|
||||
|
||||
TclNRAddCallback(interp, TEBCresume, TD, /* pc */ NULL,
|
||||
/* cleanup */ INT2PTR(0), INT2PTR(iPtr->evalFlags));
|
||||
|
||||
/*
|
||||
* Reset discard result flag - because it is applicable for this call only,
|
||||
* and should not affect all the nested invocations may return result.
|
||||
*/
|
||||
iPtr->evalFlags &= ~TCL_EVAL_DISCARD_RESULT;
|
||||
|
||||
/* cleanup */ INT2PTR(0), NULL);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -2149,7 +2142,6 @@ TEBCresume(
|
||||
#define auxObjList (TD->auxObjList)
|
||||
#define catchTop (TD->catchTop)
|
||||
#define codePtr (TD->codePtr)
|
||||
#define curEvalFlags PTR2INT(data[3]) /* calling iPtr->evalFlags */
|
||||
|
||||
/*
|
||||
* Globals: variables that store state, must remain valid at all times.
|
||||
@@ -2168,7 +2160,7 @@ TEBCresume(
|
||||
|
||||
int cleanup = PTR2INT(data[2]);
|
||||
Tcl_Obj *objResultPtr;
|
||||
int checkInterp = 0; /* Indicates when a check of interp readyness
|
||||
int checkInterp; /* Indicates when a check of interp readyness
|
||||
* is necessary. Set by CACHE_STACK_INFO() */
|
||||
|
||||
/*
|
||||
@@ -2178,7 +2170,7 @@ TEBCresume(
|
||||
*/
|
||||
|
||||
Tcl_Obj *objPtr, *valuePtr, *value2Ptr, *part1Ptr, *part2Ptr, *tmpPtr;
|
||||
Tcl_Obj **objv = NULL;
|
||||
Tcl_Obj **objv;
|
||||
int objc = 0;
|
||||
int opnd, length, pcAdjustment;
|
||||
Var *varPtr, *arrayPtr;
|
||||
@@ -2203,6 +2195,7 @@ TEBCresume(
|
||||
|
||||
if (!pc) {
|
||||
/* bytecode is starting from scratch */
|
||||
checkInterp = 0;
|
||||
pc = codePtr->codeStart;
|
||||
goto cleanup0;
|
||||
} else {
|
||||
@@ -2224,9 +2217,8 @@ TEBCresume(
|
||||
goto abnormalReturn;
|
||||
}
|
||||
if (codePtr->flags & TCL_BYTECODE_RECOMPILE) {
|
||||
codePtr->flags &= ~TCL_BYTECODE_RECOMPILE;
|
||||
checkInterp = 1;
|
||||
iPtr->flags |= ERR_ALREADY_LOGGED;
|
||||
codePtr->flags &= ~TCL_BYTECODE_RECOMPILE;
|
||||
}
|
||||
|
||||
if (result != TCL_OK) {
|
||||
@@ -2286,12 +2278,10 @@ TEBCresume(
|
||||
objPtr = POP_OBJECT();
|
||||
TclDecrRefCount(objPtr);
|
||||
}
|
||||
/* FALLTHRU */
|
||||
case 2:
|
||||
cleanup2_pushObjResultPtr:
|
||||
objPtr = POP_OBJECT();
|
||||
TclDecrRefCount(objPtr);
|
||||
/* FALLTHRU */
|
||||
case 1:
|
||||
cleanup1_pushObjResultPtr:
|
||||
objPtr = OBJ_AT_TOS;
|
||||
@@ -2308,17 +2298,14 @@ TEBCresume(
|
||||
objPtr = POP_OBJECT();
|
||||
TclDecrRefCount(objPtr);
|
||||
}
|
||||
/* FALLTHRU */
|
||||
case 2:
|
||||
cleanup2:
|
||||
objPtr = POP_OBJECT();
|
||||
TclDecrRefCount(objPtr);
|
||||
/* FALLTHRU */
|
||||
case 1:
|
||||
cleanup1:
|
||||
objPtr = POP_OBJECT();
|
||||
TclDecrRefCount(objPtr);
|
||||
/* FALLTHRU */
|
||||
case 0:
|
||||
/*
|
||||
* We really want to do nothing now, but this is needed for some
|
||||
@@ -2405,12 +2392,12 @@ TEBCresume(
|
||||
|
||||
iPtr->cmdCount += TclGetUInt4AtPtr(pc+5);
|
||||
if (checkInterp) {
|
||||
checkInterp = 0;
|
||||
if (((codePtr->compileEpoch != iPtr->compileEpoch) ||
|
||||
(codePtr->nsEpoch != iPtr->varFramePtr->nsPtr->resolverEpoch)) &&
|
||||
!(codePtr->flags & TCL_BYTECODE_PRECOMPILED)) {
|
||||
goto instStartCmdFailed;
|
||||
}
|
||||
checkInterp = 0;
|
||||
}
|
||||
inst = *(pc += 9);
|
||||
goto peepholeStart;
|
||||
@@ -2637,14 +2624,6 @@ TEBCresume(
|
||||
|
||||
case INST_DONE:
|
||||
if (tosPtr > initTosPtr) {
|
||||
|
||||
if ((curEvalFlags & TCL_EVAL_DISCARD_RESULT) && (result == TCL_OK)) {
|
||||
/* simulate pop & fast done (like it does continue in loop) */
|
||||
TRACE_WITH_OBJ(("=> discarding "), OBJ_AT_TOS);
|
||||
objPtr = POP_OBJECT();
|
||||
TclDecrRefCount(objPtr);
|
||||
goto abnormalReturn;
|
||||
}
|
||||
/*
|
||||
* Set the interpreter's object result to point to the topmost
|
||||
* object from the stack, and check for a possible [catch]. The
|
||||
@@ -2980,18 +2959,15 @@ TEBCresume(
|
||||
* INVOCATION BLOCK
|
||||
*/
|
||||
|
||||
case INST_EVAL_STK:
|
||||
instEvalStk:
|
||||
case INST_EVAL_STK:
|
||||
bcFramePtr->data.tebc.pc = (char *) pc;
|
||||
iPtr->cmdFramePtr = bcFramePtr;
|
||||
|
||||
cleanup = 1;
|
||||
pc += 1;
|
||||
/* yield next instruction */
|
||||
TEBC_YIELD();
|
||||
/* add TEBCResume for object at top of stack */
|
||||
return TclNRExecuteByteCode(interp,
|
||||
TclCompileObj(interp, OBJ_AT_TOS, NULL, 0));
|
||||
return TclNREvalObjEx(interp, OBJ_AT_TOS, 0, NULL, 0);
|
||||
|
||||
case INST_INVOKE_EXPANDED:
|
||||
CLANG_ASSERT(auxObjList);
|
||||
@@ -3740,36 +3716,31 @@ TEBCresume(
|
||||
|
||||
{
|
||||
int createdNewObj = 0;
|
||||
Tcl_Obj *valueToAssign;
|
||||
|
||||
if (!objResultPtr) {
|
||||
valueToAssign = valuePtr;
|
||||
objResultPtr = valuePtr;
|
||||
} else if (TclListObjLength(interp, objResultPtr, &len)!=TCL_OK) {
|
||||
TRACE_ERROR(interp);
|
||||
goto gotError;
|
||||
} else {
|
||||
if (Tcl_IsShared(objResultPtr)) {
|
||||
valueToAssign = Tcl_DuplicateObj(objResultPtr);
|
||||
objResultPtr = Tcl_DuplicateObj(objResultPtr);
|
||||
createdNewObj = 1;
|
||||
} else {
|
||||
valueToAssign = objResultPtr;
|
||||
}
|
||||
if (Tcl_ListObjReplace(interp, valueToAssign, len, 0,
|
||||
objc, objv) != TCL_OK) {
|
||||
if (createdNewObj) {
|
||||
TclDecrRefCount(valueToAssign);
|
||||
}
|
||||
if (Tcl_ListObjReplace(interp, objResultPtr, len,0, objc,objv)
|
||||
!= TCL_OK) {
|
||||
goto errorInLappendListPtr;
|
||||
}
|
||||
}
|
||||
DECACHE_STACK_INFO();
|
||||
Tcl_IncrRefCount(valueToAssign);
|
||||
objResultPtr = TclPtrSetVarIdx(interp, varPtr, arrayPtr, part1Ptr,
|
||||
part2Ptr, valueToAssign, TCL_LEAVE_ERR_MSG, opnd);
|
||||
TclDecrRefCount(valueToAssign);
|
||||
part2Ptr, objResultPtr, TCL_LEAVE_ERR_MSG, opnd);
|
||||
CACHE_STACK_INFO();
|
||||
if (!objResultPtr) {
|
||||
errorInLappendListPtr:
|
||||
if (createdNewObj) {
|
||||
TclDecrRefCount(objResultPtr);
|
||||
}
|
||||
TRACE_ERROR(interp);
|
||||
goto gotError;
|
||||
}
|
||||
@@ -5266,17 +5237,13 @@ TEBCresume(
|
||||
|
||||
/* Every range of an empty list is an empty list */
|
||||
if (objc == 0) {
|
||||
/* avoid return of not canonical list (e. g. spaces in string repr.) */
|
||||
if (!valuePtr->bytes || !valuePtr->length) {
|
||||
TRACE_APPEND(("\n"));
|
||||
NEXT_INST_F(9, 0, 0);
|
||||
}
|
||||
goto emptyList;
|
||||
TRACE_APPEND(("\n"));
|
||||
NEXT_INST_F(9, 0, 0);
|
||||
}
|
||||
|
||||
/* Decode index value operands. */
|
||||
|
||||
/*
|
||||
/*
|
||||
assert ( toIdx != TCL_INDEX_AFTER);
|
||||
*
|
||||
* Extra safety for legacy bytecodes:
|
||||
@@ -5544,7 +5511,7 @@ TEBCresume(
|
||||
objResultPtr = Tcl_NewStringObj((const char *)
|
||||
valuePtr->bytes+index, 1);
|
||||
} else {
|
||||
char buf[TCL_UTF_MAX] = "";
|
||||
char buf[TCL_UTF_MAX];
|
||||
Tcl_UniChar ch = Tcl_GetUniChar(valuePtr, index);
|
||||
|
||||
/*
|
||||
@@ -6061,7 +6028,7 @@ TEBCresume(
|
||||
/* [string is integer] is -UINT_MAX to UINT_MAX range */
|
||||
int i;
|
||||
|
||||
if (TclGetIntFromObj(NULL, OBJ_AT_TOS, &i) != TCL_OK) {
|
||||
if (Tcl_GetIntFromObj(NULL, OBJ_AT_TOS, &i) != TCL_OK) {
|
||||
type1 = TCL_NUMBER_WIDE;
|
||||
}
|
||||
#ifndef TCL_WIDE_INT_IS_LONG
|
||||
@@ -6069,7 +6036,7 @@ TEBCresume(
|
||||
/* value is between WIDE_MIN and WIDE_MAX */
|
||||
/* [string is wideinteger] is -UWIDE_MAX to UWIDE_MAX range */
|
||||
int i;
|
||||
if (TclGetIntFromObj(NULL, OBJ_AT_TOS, &i) == TCL_OK) {
|
||||
if (Tcl_GetIntFromObj(NULL, OBJ_AT_TOS, &i) == TCL_OK) {
|
||||
type1 = TCL_NUMBER_LONG;
|
||||
}
|
||||
#endif
|
||||
@@ -6078,7 +6045,7 @@ TEBCresume(
|
||||
/* [string is wideinteger] is -UWIDE_MAX to UWIDE_MAX range */
|
||||
Tcl_WideInt w;
|
||||
|
||||
if (TclGetWideIntFromObj(NULL, OBJ_AT_TOS, &w) == TCL_OK) {
|
||||
if (Tcl_GetWideIntFromObj(NULL, OBJ_AT_TOS, &w) == TCL_OK) {
|
||||
type1 = TCL_NUMBER_WIDE;
|
||||
}
|
||||
}
|
||||
@@ -8108,7 +8075,7 @@ TEBCresume(
|
||||
*/
|
||||
|
||||
/*
|
||||
* Done or abnormal return code. Restore the stack to state it had when
|
||||
* Abnormal return code. Restore the stack to state it had when
|
||||
* starting to execute the ByteCode. Panic if the stack is below the
|
||||
* initial level.
|
||||
*/
|
||||
@@ -8165,22 +8132,19 @@ TEBCresume(
|
||||
{
|
||||
const char *bytes;
|
||||
|
||||
checkInterp = 1;
|
||||
length = 0;
|
||||
|
||||
if (TclInterpReady(interp) == TCL_ERROR) {
|
||||
goto gotError;
|
||||
}
|
||||
|
||||
/*
|
||||
* We used to switch to direct eval; for NRE-awareness we now
|
||||
* compile and eval the command so that this evaluation does not
|
||||
* add a new TEBC instance. Bug [2910748], bug [fa6bf38d07]
|
||||
*
|
||||
* TODO: recompile, search this command and eval a code starting from,
|
||||
* so that this evaluation does not add a new TEBC instance without
|
||||
* NRE-trampoline.
|
||||
* add a new TEBC instance. [Bug 2910748]
|
||||
*/
|
||||
|
||||
if (TclInterpReady(interp) == TCL_ERROR) {
|
||||
goto gotError;
|
||||
}
|
||||
|
||||
codePtr->flags |= TCL_BYTECODE_RECOMPILE;
|
||||
bytes = GetSrcInfoForPc(pc, codePtr, &length, NULL, NULL);
|
||||
opnd = TclGetUInt4AtPtr(pc+1);
|
||||
@@ -8253,128 +8217,6 @@ FinalizeOONextFilter(
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* LongPwrSmallExpon -- , WidePwrSmallExpon --
|
||||
*
|
||||
* Helpers to calculate small powers of integers whose result is long or wide.
|
||||
*/
|
||||
#if (LONG_MAX == 0x7fffffff)
|
||||
static inline long
|
||||
LongPwrSmallExpon(long l1, long exponent) {
|
||||
|
||||
long lResult;
|
||||
|
||||
lResult = l1 * l1; /* b**2 */
|
||||
switch (exponent) {
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
lResult *= l1; /* b**3 */
|
||||
break;
|
||||
case 4:
|
||||
lResult *= lResult; /* b**4 */
|
||||
break;
|
||||
case 5:
|
||||
lResult *= lResult; /* b**4 */
|
||||
lResult *= l1; /* b**5 */
|
||||
break;
|
||||
case 6:
|
||||
lResult *= l1; /* b**3 */
|
||||
lResult *= lResult; /* b**6 */
|
||||
break;
|
||||
case 7:
|
||||
lResult *= l1; /* b**3 */
|
||||
lResult *= lResult; /* b**6 */
|
||||
lResult *= l1; /* b**7 */
|
||||
break;
|
||||
case 8:
|
||||
lResult *= lResult; /* b**4 */
|
||||
lResult *= lResult; /* b**8 */
|
||||
break;
|
||||
}
|
||||
return lResult;
|
||||
}
|
||||
#endif
|
||||
static inline Tcl_WideInt
|
||||
WidePwrSmallExpon(Tcl_WideInt w1, long exponent) {
|
||||
|
||||
Tcl_WideInt wResult;
|
||||
|
||||
wResult = w1 * w1; /* b**2 */
|
||||
switch (exponent) {
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
wResult *= w1; /* b**3 */
|
||||
break;
|
||||
case 4:
|
||||
wResult *= wResult; /* b**4 */
|
||||
break;
|
||||
case 5:
|
||||
wResult *= wResult; /* b**4 */
|
||||
wResult *= w1; /* b**5 */
|
||||
break;
|
||||
case 6:
|
||||
wResult *= w1; /* b**3 */
|
||||
wResult *= wResult; /* b**6 */
|
||||
break;
|
||||
case 7:
|
||||
wResult *= w1; /* b**3 */
|
||||
wResult *= wResult; /* b**6 */
|
||||
wResult *= w1; /* b**7 */
|
||||
break;
|
||||
case 8:
|
||||
wResult *= wResult; /* b**4 */
|
||||
wResult *= wResult; /* b**8 */
|
||||
break;
|
||||
case 9:
|
||||
wResult *= wResult; /* b**4 */
|
||||
wResult *= wResult; /* b**8 */
|
||||
wResult *= w1; /* b**9 */
|
||||
break;
|
||||
case 10:
|
||||
wResult *= wResult; /* b**4 */
|
||||
wResult *= w1; /* b**5 */
|
||||
wResult *= wResult; /* b**10 */
|
||||
break;
|
||||
case 11:
|
||||
wResult *= wResult; /* b**4 */
|
||||
wResult *= w1; /* b**5 */
|
||||
wResult *= wResult; /* b**10 */
|
||||
wResult *= w1; /* b**11 */
|
||||
break;
|
||||
case 12:
|
||||
wResult *= w1; /* b**3 */
|
||||
wResult *= wResult; /* b**6 */
|
||||
wResult *= wResult; /* b**12 */
|
||||
break;
|
||||
case 13:
|
||||
wResult *= w1; /* b**3 */
|
||||
wResult *= wResult; /* b**6 */
|
||||
wResult *= wResult; /* b**12 */
|
||||
wResult *= w1; /* b**13 */
|
||||
break;
|
||||
case 14:
|
||||
wResult *= w1; /* b**3 */
|
||||
wResult *= wResult; /* b**6 */
|
||||
wResult *= w1; /* b**7 */
|
||||
wResult *= wResult; /* b**14 */
|
||||
break;
|
||||
case 15:
|
||||
wResult *= w1; /* b**3 */
|
||||
wResult *= wResult; /* b**6 */
|
||||
wResult *= w1; /* b**7 */
|
||||
wResult *= wResult; /* b**14 */
|
||||
wResult *= w1; /* b**15 */
|
||||
break;
|
||||
case 16:
|
||||
wResult *= wResult; /* b**4 */
|
||||
wResult *= wResult; /* b**8 */
|
||||
wResult *= wResult; /* b**16 */
|
||||
break;
|
||||
}
|
||||
return wResult;
|
||||
}
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -8446,7 +8288,7 @@ ExecuteExtendedBinaryMathOp(
|
||||
Tcl_WideInt w1, w2, wResult;
|
||||
mp_int big1, big2, bigResult, bigRemainder;
|
||||
Tcl_Obj *objResultPtr;
|
||||
int invalid, zero;
|
||||
int invalid, numPos, zero;
|
||||
long shift;
|
||||
|
||||
(void) GetNumberFromObj(NULL, valuePtr, &ptr1, &type1);
|
||||
@@ -8475,7 +8317,7 @@ ExecuteExtendedBinaryMathOp(
|
||||
w1 = *((const Tcl_WideInt *)ptr1);
|
||||
if (type2 != TCL_NUMBER_BIG) {
|
||||
Tcl_WideInt wQuotient, wRemainder;
|
||||
TclGetWideIntFromObj(NULL, value2Ptr, &w2);
|
||||
Tcl_GetWideIntFromObj(NULL, value2Ptr, &w2);
|
||||
wQuotient = w1 / w2;
|
||||
|
||||
/*
|
||||
@@ -8497,7 +8339,7 @@ ExecuteExtendedBinaryMathOp(
|
||||
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
|
||||
|
||||
/* TODO: internals intrusion */
|
||||
if ((w1 > ((Tcl_WideInt) 0)) ^ !mp_isneg(&big2)) {
|
||||
if ((w1 > ((Tcl_WideInt) 0)) ^ (big2.sign == MP_ZPOS)) {
|
||||
/*
|
||||
* Arguments are opposite sign; remainder is sum.
|
||||
*/
|
||||
@@ -8521,7 +8363,7 @@ ExecuteExtendedBinaryMathOp(
|
||||
mp_init(&bigResult);
|
||||
mp_init(&bigRemainder);
|
||||
mp_div(&big1, &big2, &bigResult, &bigRemainder);
|
||||
if ((bigRemainder.used) != 0 && (bigRemainder.sign != big2.sign)) {
|
||||
if (!mp_iszero(&bigRemainder) && (bigRemainder.sign != big2.sign)) {
|
||||
/*
|
||||
* Convert to Tcl's integer division rules.
|
||||
*/
|
||||
@@ -8674,7 +8516,16 @@ ExecuteExtendedBinaryMathOp(
|
||||
if (opcode == INST_LSHIFT) {
|
||||
mp_mul_2d(&big1, shift, &bigResult);
|
||||
} else {
|
||||
mp_signed_rsh(&big1, shift, &bigResult);
|
||||
mp_init(&bigRemainder);
|
||||
mp_div_2d(&big1, shift, &bigResult, &bigRemainder);
|
||||
if (mp_cmp_d(&bigRemainder, 0) == MP_LT) {
|
||||
/*
|
||||
* Convert to Tcl's integer division rules.
|
||||
*/
|
||||
|
||||
mp_sub_d(&bigResult, 1, &bigResult);
|
||||
}
|
||||
mp_clear(&bigRemainder);
|
||||
}
|
||||
mp_clear(&big1);
|
||||
BIG_RESULT(&bigResult);
|
||||
@@ -8684,22 +8535,138 @@ ExecuteExtendedBinaryMathOp(
|
||||
case INST_BITXOR:
|
||||
case INST_BITAND:
|
||||
if ((type1 == TCL_NUMBER_BIG) || (type2 == TCL_NUMBER_BIG)) {
|
||||
mp_int *First, *Second;
|
||||
|
||||
Tcl_TakeBignumFromObj(NULL, valuePtr, &big1);
|
||||
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
|
||||
|
||||
/*
|
||||
* Count how many positive arguments we have. If only one of the
|
||||
* arguments is negative, store it in 'Second'.
|
||||
*/
|
||||
|
||||
if (mp_cmp_d(&big1, 0) != MP_LT) {
|
||||
numPos = 1 + (mp_cmp_d(&big2, 0) != MP_LT);
|
||||
First = &big1;
|
||||
Second = &big2;
|
||||
} else {
|
||||
First = &big2;
|
||||
Second = &big1;
|
||||
numPos = (mp_cmp_d(First, 0) != MP_LT);
|
||||
}
|
||||
mp_init(&bigResult);
|
||||
|
||||
switch (opcode) {
|
||||
case INST_BITAND:
|
||||
mp_and(&big1, &big2, &bigResult);
|
||||
switch (numPos) {
|
||||
case 2:
|
||||
/*
|
||||
* Both arguments positive, base case.
|
||||
*/
|
||||
|
||||
mp_and(First, Second, &bigResult);
|
||||
break;
|
||||
case 1:
|
||||
/*
|
||||
* First is positive; second negative:
|
||||
* P & N = P & ~~N = P&~(-N-1) = P & (P ^ (-N-1))
|
||||
*/
|
||||
|
||||
mp_neg(Second, Second);
|
||||
mp_sub_d(Second, 1, Second);
|
||||
mp_xor(First, Second, &bigResult);
|
||||
mp_and(First, &bigResult, &bigResult);
|
||||
break;
|
||||
case 0:
|
||||
/*
|
||||
* Both arguments negative:
|
||||
* a & b = ~ (~a | ~b) = -(-a-1|-b-1)-1
|
||||
*/
|
||||
|
||||
mp_neg(First, First);
|
||||
mp_sub_d(First, 1, First);
|
||||
mp_neg(Second, Second);
|
||||
mp_sub_d(Second, 1, Second);
|
||||
mp_or(First, Second, &bigResult);
|
||||
mp_neg(&bigResult, &bigResult);
|
||||
mp_sub_d(&bigResult, 1, &bigResult);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case INST_BITOR:
|
||||
mp_or(&big1, &big2, &bigResult);
|
||||
switch (numPos) {
|
||||
case 2:
|
||||
/*
|
||||
* Both arguments positive, base case.
|
||||
*/
|
||||
|
||||
mp_or(First, Second, &bigResult);
|
||||
break;
|
||||
case 1:
|
||||
/*
|
||||
* First is positive; second negative:
|
||||
* N|P = ~(~N&~P) = ~((-N-1)&~P) = -((-N-1)&((-N-1)^P))-1
|
||||
*/
|
||||
|
||||
mp_neg(Second, Second);
|
||||
mp_sub_d(Second, 1, Second);
|
||||
mp_xor(First, Second, &bigResult);
|
||||
mp_and(Second, &bigResult, &bigResult);
|
||||
mp_neg(&bigResult, &bigResult);
|
||||
mp_sub_d(&bigResult, 1, &bigResult);
|
||||
break;
|
||||
case 0:
|
||||
/*
|
||||
* Both arguments negative:
|
||||
* a | b = ~ (~a & ~b) = -(-a-1&-b-1)-1
|
||||
*/
|
||||
|
||||
mp_neg(First, First);
|
||||
mp_sub_d(First, 1, First);
|
||||
mp_neg(Second, Second);
|
||||
mp_sub_d(Second, 1, Second);
|
||||
mp_and(First, Second, &bigResult);
|
||||
mp_neg(&bigResult, &bigResult);
|
||||
mp_sub_d(&bigResult, 1, &bigResult);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case INST_BITXOR:
|
||||
mp_xor(&big1, &big2, &bigResult);
|
||||
switch (numPos) {
|
||||
case 2:
|
||||
/*
|
||||
* Both arguments positive, base case.
|
||||
*/
|
||||
|
||||
mp_xor(First, Second, &bigResult);
|
||||
break;
|
||||
case 1:
|
||||
/*
|
||||
* First is positive; second negative:
|
||||
* P^N = ~(P^~N) = -(P^(-N-1))-1
|
||||
*/
|
||||
|
||||
mp_neg(Second, Second);
|
||||
mp_sub_d(Second, 1, Second);
|
||||
mp_xor(First, Second, &bigResult);
|
||||
mp_neg(&bigResult, &bigResult);
|
||||
mp_sub_d(&bigResult, 1, &bigResult);
|
||||
break;
|
||||
case 0:
|
||||
/*
|
||||
* Both arguments negative:
|
||||
* a ^ b = (~a ^ ~b) = (-a-1^-b-1)
|
||||
*/
|
||||
|
||||
mp_neg(First, First);
|
||||
mp_sub_d(First, 1, First);
|
||||
mp_neg(Second, Second);
|
||||
mp_sub_d(Second, 1, Second);
|
||||
mp_xor(First, Second, &bigResult);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -8764,13 +8731,8 @@ ExecuteExtendedBinaryMathOp(
|
||||
goto doubleResult;
|
||||
}
|
||||
l1 = l2 = 0;
|
||||
w1 = w2 = 0; /* to silence compiler warning (maybe-uninitialized) */
|
||||
switch (type2) {
|
||||
case TCL_NUMBER_LONG:
|
||||
if (type2 == TCL_NUMBER_LONG) {
|
||||
l2 = *((const long *) ptr2);
|
||||
#ifndef TCL_WIDE_INT_IS_LONG
|
||||
pwrLongExpon:
|
||||
#endif
|
||||
if (l2 == 0) {
|
||||
/*
|
||||
* Anything to the zero power is 1.
|
||||
@@ -8784,18 +8746,16 @@ ExecuteExtendedBinaryMathOp(
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
switch (type2) {
|
||||
case TCL_NUMBER_LONG:
|
||||
negativeExponent = (l2 < 0);
|
||||
oddExponent = (int) (l2 & 1);
|
||||
break;
|
||||
#ifndef TCL_WIDE_INT_IS_LONG
|
||||
case TCL_NUMBER_WIDE:
|
||||
w2 = *((const Tcl_WideInt *)ptr2);
|
||||
/* check it fits in long */
|
||||
l2 = (long)w2;
|
||||
if (w2 == l2) {
|
||||
type2 = TCL_NUMBER_LONG;
|
||||
goto pwrLongExpon;
|
||||
}
|
||||
negativeExponent = (w2 < 0);
|
||||
oddExponent = (int) (w2 & (Tcl_WideInt)1);
|
||||
break;
|
||||
@@ -8804,58 +8764,36 @@ ExecuteExtendedBinaryMathOp(
|
||||
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
|
||||
negativeExponent = (mp_cmp_d(&big2, 0) == MP_LT);
|
||||
mp_mod_2d(&big2, 1, &big2);
|
||||
oddExponent = big2.used != 0;
|
||||
oddExponent = !mp_iszero(&big2);
|
||||
mp_clear(&big2);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (type1) {
|
||||
case TCL_NUMBER_LONG:
|
||||
if (type1 == TCL_NUMBER_LONG) {
|
||||
l1 = *((const long *)ptr1);
|
||||
#ifndef TCL_WIDE_INT_IS_LONG
|
||||
pwrLongBase:
|
||||
#endif
|
||||
switch (l1) {
|
||||
case 0:
|
||||
/*
|
||||
* Zero to a positive power is zero.
|
||||
* Zero to a negative power is div by zero error.
|
||||
*/
|
||||
|
||||
return (!negativeExponent) ? constants[0] : EXPONENT_OF_ZERO;
|
||||
case 1:
|
||||
/*
|
||||
* 1 to any power is 1.
|
||||
*/
|
||||
|
||||
return constants[1];
|
||||
case -1:
|
||||
if (!negativeExponent) {
|
||||
if (!oddExponent) {
|
||||
return constants[1];
|
||||
}
|
||||
LONG_RESULT(-1);
|
||||
}
|
||||
/* negativeExponent */
|
||||
if (oddExponent) {
|
||||
LONG_RESULT(-1);
|
||||
}
|
||||
return constants[1];
|
||||
}
|
||||
break;
|
||||
#ifndef TCL_WIDE_INT_IS_LONG
|
||||
case TCL_NUMBER_WIDE:
|
||||
w1 = *((const Tcl_WideInt *) ptr1);
|
||||
/* check it fits in long */
|
||||
l1 = (long)w1;
|
||||
if (w1 == l1) {
|
||||
type1 = TCL_NUMBER_LONG;
|
||||
goto pwrLongBase;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
if (negativeExponent) {
|
||||
if (type1 == TCL_NUMBER_LONG) {
|
||||
switch (l1) {
|
||||
case 0:
|
||||
/*
|
||||
* Zero to a negative power is div by zero error.
|
||||
*/
|
||||
|
||||
return EXPONENT_OF_ZERO;
|
||||
case -1:
|
||||
if (oddExponent) {
|
||||
LONG_RESULT(-1);
|
||||
}
|
||||
/* fallthrough */
|
||||
case 1:
|
||||
/*
|
||||
* 1 to any power is 1.
|
||||
*/
|
||||
|
||||
return constants[1];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Integers with magnitude greater than 1 raise to a negative
|
||||
@@ -8865,9 +8803,26 @@ ExecuteExtendedBinaryMathOp(
|
||||
return constants[0];
|
||||
}
|
||||
|
||||
if (type1 == TCL_NUMBER_LONG) {
|
||||
switch (l1) {
|
||||
case 0:
|
||||
/*
|
||||
* Zero to a positive power is zero.
|
||||
*/
|
||||
|
||||
if (type1 == TCL_NUMBER_BIG) {
|
||||
goto overflowExpon;
|
||||
return constants[0];
|
||||
case 1:
|
||||
/*
|
||||
* 1 to any power is 1.
|
||||
*/
|
||||
|
||||
return constants[1];
|
||||
case -1:
|
||||
if (!oddExponent) {
|
||||
return constants[1];
|
||||
}
|
||||
LONG_RESULT(-1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -8885,8 +8840,6 @@ ExecuteExtendedBinaryMathOp(
|
||||
return GENERAL_ARITHMETIC_ERROR;
|
||||
}
|
||||
|
||||
/* From here (up to overflowExpon) exponent is long (l2). */
|
||||
|
||||
if (type1 == TCL_NUMBER_LONG) {
|
||||
if (l1 == 2) {
|
||||
/*
|
||||
@@ -8927,8 +8880,35 @@ ExecuteExtendedBinaryMathOp(
|
||||
/*
|
||||
* Small powers of 32-bit integers.
|
||||
*/
|
||||
lResult = LongPwrSmallExpon(l1, l2);
|
||||
|
||||
lResult = l1 * l1; /* b**2 */
|
||||
switch (l2) {
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
lResult *= l1; /* b**3 */
|
||||
break;
|
||||
case 4:
|
||||
lResult *= lResult; /* b**4 */
|
||||
break;
|
||||
case 5:
|
||||
lResult *= lResult; /* b**4 */
|
||||
lResult *= l1; /* b**5 */
|
||||
break;
|
||||
case 6:
|
||||
lResult *= l1; /* b**3 */
|
||||
lResult *= lResult; /* b**6 */
|
||||
break;
|
||||
case 7:
|
||||
lResult *= l1; /* b**3 */
|
||||
lResult *= lResult; /* b**6 */
|
||||
lResult *= l1; /* b**7 */
|
||||
break;
|
||||
case 8:
|
||||
lResult *= lResult; /* b**4 */
|
||||
lResult *= lResult; /* b**8 */
|
||||
break;
|
||||
}
|
||||
LONG_RESULT(lResult);
|
||||
}
|
||||
|
||||
@@ -8960,25 +8940,98 @@ ExecuteExtendedBinaryMathOp(
|
||||
LONG_RESULT(lResult);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if (LONG_MAX > 0x7fffffff) || !defined(TCL_WIDE_INT_IS_LONG)
|
||||
/* Code below (up to overflowExpon) works with wide-int base */
|
||||
w1 = l1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (LONG_MAX > 0x7fffffff) || !defined(TCL_WIDE_INT_IS_LONG)
|
||||
|
||||
/* From here (up to overflowExpon) base is wide-int (w1). */
|
||||
|
||||
if (type1 == TCL_NUMBER_LONG) {
|
||||
w1 = l1;
|
||||
#ifndef TCL_WIDE_INT_IS_LONG
|
||||
} else if (type1 == TCL_NUMBER_WIDE) {
|
||||
w1 = *((const Tcl_WideInt *) ptr1);
|
||||
#endif
|
||||
} else {
|
||||
goto overflowExpon;
|
||||
}
|
||||
if (l2 - 2 < (long)MaxBase64Size
|
||||
&& w1 <= MaxBase64[l2 - 2]
|
||||
&& w1 >= -MaxBase64[l2 - 2]) {
|
||||
/*
|
||||
* Small powers of integers whose result is wide.
|
||||
*/
|
||||
wResult = WidePwrSmallExpon(w1, l2);
|
||||
|
||||
wResult = w1 * w1; /* b**2 */
|
||||
switch (l2) {
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
wResult *= l1; /* b**3 */
|
||||
break;
|
||||
case 4:
|
||||
wResult *= wResult; /* b**4 */
|
||||
break;
|
||||
case 5:
|
||||
wResult *= wResult; /* b**4 */
|
||||
wResult *= w1; /* b**5 */
|
||||
break;
|
||||
case 6:
|
||||
wResult *= w1; /* b**3 */
|
||||
wResult *= wResult; /* b**6 */
|
||||
break;
|
||||
case 7:
|
||||
wResult *= w1; /* b**3 */
|
||||
wResult *= wResult; /* b**6 */
|
||||
wResult *= w1; /* b**7 */
|
||||
break;
|
||||
case 8:
|
||||
wResult *= wResult; /* b**4 */
|
||||
wResult *= wResult; /* b**8 */
|
||||
break;
|
||||
case 9:
|
||||
wResult *= wResult; /* b**4 */
|
||||
wResult *= wResult; /* b**8 */
|
||||
wResult *= w1; /* b**9 */
|
||||
break;
|
||||
case 10:
|
||||
wResult *= wResult; /* b**4 */
|
||||
wResult *= w1; /* b**5 */
|
||||
wResult *= wResult; /* b**10 */
|
||||
break;
|
||||
case 11:
|
||||
wResult *= wResult; /* b**4 */
|
||||
wResult *= w1; /* b**5 */
|
||||
wResult *= wResult; /* b**10 */
|
||||
wResult *= w1; /* b**11 */
|
||||
break;
|
||||
case 12:
|
||||
wResult *= w1; /* b**3 */
|
||||
wResult *= wResult; /* b**6 */
|
||||
wResult *= wResult; /* b**12 */
|
||||
break;
|
||||
case 13:
|
||||
wResult *= w1; /* b**3 */
|
||||
wResult *= wResult; /* b**6 */
|
||||
wResult *= wResult; /* b**12 */
|
||||
wResult *= w1; /* b**13 */
|
||||
break;
|
||||
case 14:
|
||||
wResult *= w1; /* b**3 */
|
||||
wResult *= wResult; /* b**6 */
|
||||
wResult *= w1; /* b**7 */
|
||||
wResult *= wResult; /* b**14 */
|
||||
break;
|
||||
case 15:
|
||||
wResult *= w1; /* b**3 */
|
||||
wResult *= wResult; /* b**6 */
|
||||
wResult *= w1; /* b**7 */
|
||||
wResult *= wResult; /* b**14 */
|
||||
wResult *= w1; /* b**15 */
|
||||
break;
|
||||
case 16:
|
||||
wResult *= wResult; /* b**4 */
|
||||
wResult *= wResult; /* b**8 */
|
||||
wResult *= wResult; /* b**16 */
|
||||
break;
|
||||
}
|
||||
WIDE_RESULT(wResult);
|
||||
}
|
||||
|
||||
@@ -9018,18 +9071,18 @@ ExecuteExtendedBinaryMathOp(
|
||||
#endif
|
||||
|
||||
overflowExpon:
|
||||
|
||||
if ((TclGetWideIntFromObj(NULL, value2Ptr, &w2) != TCL_OK)
|
||||
|| (value2Ptr->typePtr != &tclIntType)
|
||||
|| (Tcl_WideUInt)w2 >= (1<<28)) {
|
||||
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
|
||||
if (big2.used > 1) {
|
||||
mp_clear(&big2);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"exponent too large", -1));
|
||||
return GENERAL_ARITHMETIC_ERROR;
|
||||
}
|
||||
Tcl_TakeBignumFromObj(NULL, valuePtr, &big1);
|
||||
mp_init(&bigResult);
|
||||
mp_expt_u32(&big1, (unsigned int)w2, &bigResult);
|
||||
mp_expt_d(&big1, big2.dp[0], &bigResult);
|
||||
mp_clear(&big1);
|
||||
mp_clear(&big2);
|
||||
BIG_RESULT(&bigResult);
|
||||
}
|
||||
|
||||
@@ -9192,7 +9245,7 @@ ExecuteExtendedBinaryMathOp(
|
||||
mp_mul(&big1, &big2, &bigResult);
|
||||
break;
|
||||
case INST_DIV:
|
||||
if (big2.used == 0) {
|
||||
if (mp_iszero(&big2)) {
|
||||
mp_clear(&big1);
|
||||
mp_clear(&big2);
|
||||
mp_clear(&bigResult);
|
||||
@@ -9201,7 +9254,7 @@ ExecuteExtendedBinaryMathOp(
|
||||
mp_init(&bigRemainder);
|
||||
mp_div(&big1, &big2, &bigResult, &bigRemainder);
|
||||
/* TODO: internals intrusion */
|
||||
if (bigRemainder.used != 0
|
||||
if (!mp_iszero(&bigRemainder)
|
||||
&& (bigRemainder.sign != big2.sign)) {
|
||||
/*
|
||||
* Convert to Tcl's integer division rules.
|
||||
|
||||
+1
-1
@@ -180,7 +180,7 @@ FileCopyRename(
|
||||
}
|
||||
jargv[0] = objv[objc - 1];
|
||||
jargv[1] = source;
|
||||
newFileName = TclJoinPath(2, jargv, 1);
|
||||
newFileName = TclJoinPath(2, jargv);
|
||||
Tcl_IncrRefCount(newFileName);
|
||||
result = CopyRenameOneFile(interp, objv[i], newFileName, copyFlag,
|
||||
force);
|
||||
|
||||
@@ -808,24 +808,24 @@ Tcl_FSJoinToPath(
|
||||
Tcl_Obj *const objv[]) /* Path elements to join. */
|
||||
{
|
||||
if (pathPtr == NULL) {
|
||||
return TclJoinPath(objc, objv, 0);
|
||||
return TclJoinPath(objc, objv);
|
||||
}
|
||||
if (objc == 0) {
|
||||
return TclJoinPath(1, &pathPtr, 0);
|
||||
return TclJoinPath(1, &pathPtr);
|
||||
}
|
||||
if (objc == 1) {
|
||||
Tcl_Obj *pair[2];
|
||||
|
||||
pair[0] = pathPtr;
|
||||
pair[1] = objv[0];
|
||||
return TclJoinPath(2, pair, 0);
|
||||
return TclJoinPath(2, pair);
|
||||
} else {
|
||||
int elemc = objc + 1;
|
||||
Tcl_Obj *ret, **elemv = ckalloc(elemc*sizeof(Tcl_Obj *));
|
||||
|
||||
elemv[0] = pathPtr;
|
||||
memcpy(elemv+1, objv, objc*sizeof(Tcl_Obj *));
|
||||
ret = TclJoinPath(elemc, elemv, 0);
|
||||
ret = TclJoinPath(elemc, elemv);
|
||||
ckfree(elemv);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -897,7 +897,7 @@ TclDatelex(
|
||||
|
||||
location->first_column = yyInput - info->dateStart;
|
||||
for ( ; ; ) {
|
||||
while (TclIsSpaceProc(*yyInput)) {
|
||||
while (isspace(UCHAR(*yyInput))) {
|
||||
yyInput++;
|
||||
}
|
||||
|
||||
|
||||
+1
-5
@@ -326,10 +326,7 @@ CreateHashEntry(
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
/* if keys pointers or values are equal */
|
||||
if ((key == hPtr->key.oneWordValue)
|
||||
|| compareKeysProc((void *) key, hPtr)
|
||||
) {
|
||||
if (((void *) key == hPtr) || compareKeysProc((void *) key, hPtr)) {
|
||||
if (newPtr) {
|
||||
*newPtr = 0;
|
||||
}
|
||||
@@ -839,7 +836,6 @@ AllocStringEntry(
|
||||
allocsize = sizeof(hPtr->key);
|
||||
}
|
||||
hPtr = ckalloc(TclOffset(Tcl_HashEntry, key) + allocsize);
|
||||
memset(hPtr, 0, sizeof(Tcl_HashEntry) + allocsize - sizeof(hPtr->key));
|
||||
memcpy(hPtr->key.string, string, size);
|
||||
hPtr->clientData = 0;
|
||||
return hPtr;
|
||||
|
||||
+1
-1
@@ -2897,7 +2897,7 @@ FlushChannel(
|
||||
* there is some kind failure in the writable event machinery.
|
||||
*
|
||||
* The tls extension indeed suffers from flaws in its channel
|
||||
* event mgmt. See https://core.tcl-lang.org/tcl/info/c31ca233ca.
|
||||
* event mgmt. See http://core.tcl.tk/tcl/info/c31ca233ca.
|
||||
* Until that patch is broadly distributed, disable the
|
||||
* assertion checking here, so that programs using Tcl and
|
||||
* tls can be debugged.
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ static const char *gai_strerror(int code) {
|
||||
} else {
|
||||
tsdPtr->initialized = 1;
|
||||
}
|
||||
Tcl_WinTCharToUtf((TCHAR *)gai_strerrorW(code), -1, &tsdPtr->errorMsg);
|
||||
Tcl_WinTCharToUtf(gai_strerrorW(code), -1, &tsdPtr->errorMsg);
|
||||
return Tcl_DStringValue(&tsdPtr->errorMsg);
|
||||
}
|
||||
#endif
|
||||
|
||||
+6
-6
@@ -327,9 +327,9 @@ Tcl_Stat(
|
||||
oldStyleBuf->st_uid = buf.st_uid;
|
||||
oldStyleBuf->st_gid = buf.st_gid;
|
||||
oldStyleBuf->st_size = (off_t) buf.st_size;
|
||||
oldStyleBuf->st_atime = Tcl_GetAccessTimeFromStat(&buf);
|
||||
oldStyleBuf->st_mtime = Tcl_GetModificationTimeFromStat(&buf);
|
||||
oldStyleBuf->st_ctime = Tcl_GetChangeTimeFromStat(&buf);
|
||||
oldStyleBuf->st_atime = buf.st_atime;
|
||||
oldStyleBuf->st_mtime = buf.st_mtime;
|
||||
oldStyleBuf->st_ctime = buf.st_ctime;
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||
oldStyleBuf->st_blksize = buf.st_blksize;
|
||||
#endif
|
||||
@@ -4392,8 +4392,8 @@ TclCrossFilesystemCopy(
|
||||
*/
|
||||
|
||||
if (Tcl_FSLstat(source, &sourceStatBuf) == 0) {
|
||||
tval.actime = Tcl_GetAccessTimeFromStat(&sourceStatBuf);
|
||||
tval.modtime = Tcl_GetModificationTimeFromStat(&sourceStatBuf);
|
||||
tval.actime = sourceStatBuf.st_atime;
|
||||
tval.modtime = sourceStatBuf.st_mtime;
|
||||
Tcl_FSUtime(target, &tval);
|
||||
}
|
||||
|
||||
@@ -4669,7 +4669,7 @@ Tcl_FSGetFileSystemForPath(
|
||||
* Tcl_FSGetNativePath --
|
||||
*
|
||||
* This function is for use by the Win/Unix native filesystems, so that
|
||||
* they can easily retrieve the native (char* or WCHAR*) representation
|
||||
* they can easily retrieve the native (char* or TCHAR*) representation
|
||||
* of a path. Other filesystems will probably want to implement similar
|
||||
* functions. They basically act as a safety net around
|
||||
* Tcl_FSGetInternalRep. Normally your file-system functions will always
|
||||
|
||||
@@ -1037,9 +1037,6 @@ declare 256 {
|
||||
int TclPtrUnsetVar(Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr,
|
||||
Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, const int flags)
|
||||
}
|
||||
declare 258 {
|
||||
void TclUnusedStubEntry(void)
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
|
||||
|
||||
+27
-35
@@ -49,7 +49,7 @@
|
||||
#include <string.h>
|
||||
#endif
|
||||
#if defined(STDC_HEADERS) || defined(__STDC__) || defined(__C99__FUNC__) \
|
||||
|| defined(__cplusplus) || defined(_MSC_VER) || defined(__ICC)
|
||||
|| defined(__cplusplus) || defined(_MSC_VER)
|
||||
#include <stddef.h>
|
||||
#else
|
||||
typedef int ptrdiff_t;
|
||||
@@ -902,8 +902,9 @@ typedef struct CompiledLocal {
|
||||
/* Next compiler-recognized local variable for
|
||||
* this procedure, or NULL if this is the last
|
||||
* local. */
|
||||
int nameLength; /* The number of bytes in local variable's name.
|
||||
* Among others used to speed up var lookups. */
|
||||
int nameLength; /* The number of characters in local
|
||||
* variable's name. Used to speed up variable
|
||||
* lookups. */
|
||||
int frameIndex; /* Index in the array of compiler-assigned
|
||||
* variables in the procedure call frame. */
|
||||
int flags; /* Flag bits for the local variable. Same as
|
||||
@@ -2206,7 +2207,6 @@ typedef struct Interp {
|
||||
#define TCL_EVAL_FILE 0x02
|
||||
#define TCL_EVAL_SOURCE_IN_FRAME 0x10
|
||||
#define TCL_EVAL_NORESOLVE 0x20
|
||||
#define TCL_EVAL_DISCARD_RESULT 0x40
|
||||
|
||||
/*
|
||||
* Flag bits for Interp structures:
|
||||
@@ -3025,10 +3025,9 @@ MODULE_SCOPE void TclInitNotifier(void);
|
||||
MODULE_SCOPE void TclInitObjSubsystem(void);
|
||||
MODULE_SCOPE void TclInitSubsystems(void);
|
||||
MODULE_SCOPE int TclInterpReady(Tcl_Interp *interp);
|
||||
MODULE_SCOPE int TclIsSpaceProc(int byte);
|
||||
MODULE_SCOPE int TclIsBareword(int byte);
|
||||
MODULE_SCOPE Tcl_Obj * TclJoinPath(int elements, Tcl_Obj * const objv[],
|
||||
int forceRelative);
|
||||
MODULE_SCOPE int TclIsSpaceProc(char byte);
|
||||
MODULE_SCOPE int TclIsBareword(char byte);
|
||||
MODULE_SCOPE Tcl_Obj * TclJoinPath(int elements, Tcl_Obj * const objv[]);
|
||||
MODULE_SCOPE int TclJoinThread(Tcl_ThreadId id, int *result);
|
||||
MODULE_SCOPE void TclLimitRemoveAllHandlers(Tcl_Interp *interp);
|
||||
MODULE_SCOPE Tcl_Obj * TclLindexList(Tcl_Interp *interp,
|
||||
@@ -3054,8 +3053,6 @@ MODULE_SCOPE int TclMergeReturnOptions(Tcl_Interp *interp, int objc,
|
||||
MODULE_SCOPE Tcl_Obj * TclNoErrorStack(Tcl_Interp *interp, Tcl_Obj *options);
|
||||
MODULE_SCOPE int TclNokia770Doubles(void);
|
||||
MODULE_SCOPE void TclNsDecrRefCount(Namespace *nsPtr);
|
||||
MODULE_SCOPE void TclNsDecrRefCount(Namespace *nsPtr);
|
||||
MODULE_SCOPE int TclNamespaceDeleted(Namespace *nsPtr);
|
||||
MODULE_SCOPE void TclObjVarErrMsg(Tcl_Interp *interp, Tcl_Obj *part1Ptr,
|
||||
Tcl_Obj *part2Ptr, const char *operation,
|
||||
const char *reason, int index);
|
||||
@@ -3202,29 +3199,10 @@ MODULE_SCOPE int TclpLoadMemory(Tcl_Interp *interp, void *buffer,
|
||||
MODULE_SCOPE void TclInitThreadStorage(void);
|
||||
MODULE_SCOPE void TclFinalizeThreadDataThread(void);
|
||||
MODULE_SCOPE void TclFinalizeThreadStorage(void);
|
||||
|
||||
/* TclWideMUInt -- wide integer used for measurement calculations: */
|
||||
#if (!defined(_WIN32) || !defined(_MSC_VER) || (_MSC_VER >= 1400))
|
||||
# define TclWideMUInt Tcl_WideUInt
|
||||
#else
|
||||
/* older MSVS may not allow conversions between unsigned __int64 and double) */
|
||||
# define TclWideMUInt Tcl_WideInt
|
||||
#endif
|
||||
#ifdef TCL_WIDE_CLICKS
|
||||
MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void);
|
||||
MODULE_SCOPE double TclpWideClicksToNanoseconds(Tcl_WideInt clicks);
|
||||
MODULE_SCOPE double TclpWideClickInMicrosec(void);
|
||||
#else
|
||||
# ifdef _WIN32
|
||||
# define TCL_WIDE_CLICKS 1
|
||||
MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void);
|
||||
MODULE_SCOPE double TclpWideClickInMicrosec(void);
|
||||
# define TclpWideClicksToNanoseconds(clicks) \
|
||||
((double)(clicks) * TclpWideClickInMicrosec() * 1000)
|
||||
# endif
|
||||
#endif
|
||||
MODULE_SCOPE Tcl_WideInt TclpGetMicroseconds(void);
|
||||
|
||||
MODULE_SCOPE int TclZlibInit(Tcl_Interp *interp);
|
||||
MODULE_SCOPE void * TclpThreadCreateKey(void);
|
||||
MODULE_SCOPE void TclpThreadDeleteKey(void *keyPtr);
|
||||
@@ -3494,9 +3472,6 @@ MODULE_SCOPE int Tcl_ThrowObjCmd(ClientData dummy, Tcl_Interp *interp,
|
||||
MODULE_SCOPE int Tcl_TimeObjCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const objv[]);
|
||||
MODULE_SCOPE int Tcl_TimeRateObjCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const objv[]);
|
||||
MODULE_SCOPE int Tcl_TraceObjCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const objv[]);
|
||||
@@ -3952,21 +3927,39 @@ MODULE_SCOPE int TclDivOpCmd(ClientData clientData,
|
||||
MODULE_SCOPE int TclCompileDivOpCmd(Tcl_Interp *interp,
|
||||
Tcl_Parse *parsePtr, Command *cmdPtr,
|
||||
struct CompileEnv *envPtr);
|
||||
MODULE_SCOPE int TclLessOpCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const objv[]);
|
||||
MODULE_SCOPE int TclCompileLessOpCmd(Tcl_Interp *interp,
|
||||
Tcl_Parse *parsePtr, Command *cmdPtr,
|
||||
struct CompileEnv *envPtr);
|
||||
MODULE_SCOPE int TclLeqOpCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const objv[]);
|
||||
MODULE_SCOPE int TclCompileLeqOpCmd(Tcl_Interp *interp,
|
||||
Tcl_Parse *parsePtr, Command *cmdPtr,
|
||||
struct CompileEnv *envPtr);
|
||||
MODULE_SCOPE int TclGreaterOpCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const objv[]);
|
||||
MODULE_SCOPE int TclCompileGreaterOpCmd(Tcl_Interp *interp,
|
||||
Tcl_Parse *parsePtr, Command *cmdPtr,
|
||||
struct CompileEnv *envPtr);
|
||||
MODULE_SCOPE int TclGeqOpCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const objv[]);
|
||||
MODULE_SCOPE int TclCompileGeqOpCmd(Tcl_Interp *interp,
|
||||
Tcl_Parse *parsePtr, Command *cmdPtr,
|
||||
struct CompileEnv *envPtr);
|
||||
MODULE_SCOPE int TclEqOpCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const objv[]);
|
||||
MODULE_SCOPE int TclCompileEqOpCmd(Tcl_Interp *interp,
|
||||
Tcl_Parse *parsePtr, Command *cmdPtr,
|
||||
struct CompileEnv *envPtr);
|
||||
MODULE_SCOPE int TclStreqOpCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const objv[]);
|
||||
MODULE_SCOPE int TclCompileStreqOpCmd(Tcl_Interp *interp,
|
||||
Tcl_Parse *parsePtr, Command *cmdPtr,
|
||||
struct CompileEnv *envPtr);
|
||||
@@ -4039,8 +4032,6 @@ MODULE_SCOPE int TclIndexEncode(Tcl_Interp *interp, Tcl_Obj *objPtr,
|
||||
int before, int after, int *indexPtr);
|
||||
MODULE_SCOPE int TclIndexDecode(int encoded, int endValue);
|
||||
|
||||
MODULE_SCOPE void TclBN_s_mp_reverse(unsigned char *s, size_t len);
|
||||
|
||||
/* Constants used in index value encoding routines. */
|
||||
#define TCL_INDEX_END (-2)
|
||||
#define TCL_INDEX_BEFORE (-1)
|
||||
@@ -4074,6 +4065,7 @@ MODULE_SCOPE void TclBN_s_mp_reverse(unsigned char *s, size_t len);
|
||||
|
||||
#ifdef USE_DTRACE
|
||||
#ifndef _TCLDTRACE_H
|
||||
typedef const char *TclDTraceStr;
|
||||
#include "tclDTrace.h"
|
||||
#endif
|
||||
#define TCL_DTRACE_OBJ_CREATE(objPtr) TCL_OBJ_CREATE(objPtr)
|
||||
@@ -4429,7 +4421,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file,
|
||||
*/
|
||||
|
||||
#define TclUtfToUniChar(str, chPtr) \
|
||||
((((unsigned char) *(str)) < 0x80) ? \
|
||||
((((unsigned char) *(str)) < 0xC0) ? \
|
||||
((*(chPtr) = (unsigned char) *(str)), 1) \
|
||||
: Tcl_UtfToUniChar(str, chPtr))
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#ifndef _TCLINTDECLS
|
||||
#define _TCLINTDECLS
|
||||
|
||||
#include "tclPort.h"
|
||||
|
||||
#undef TCL_STORAGE_CLASS
|
||||
#ifdef BUILD_tcl
|
||||
@@ -638,9 +639,6 @@ EXTERN int TclPtrObjMakeUpvar(Tcl_Interp *interp,
|
||||
EXTERN int TclPtrUnsetVar(Tcl_Interp *interp, Tcl_Var varPtr,
|
||||
Tcl_Var arrayPtr, Tcl_Obj *part1Ptr,
|
||||
Tcl_Obj *part2Ptr, const int flags);
|
||||
/* Slot 257 is reserved */
|
||||
/* 258 */
|
||||
EXTERN void TclUnusedStubEntry(void);
|
||||
|
||||
typedef struct TclIntStubs {
|
||||
int magic;
|
||||
@@ -903,8 +901,6 @@ typedef struct TclIntStubs {
|
||||
Tcl_Obj * (*tclPtrIncrObjVar) (Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, Tcl_Obj *incrPtr, const int flags); /* 254 */
|
||||
int (*tclPtrObjMakeUpvar) (Tcl_Interp *interp, Tcl_Var otherPtr, Tcl_Obj *myNamePtr, int myFlags); /* 255 */
|
||||
int (*tclPtrUnsetVar) (Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, const int flags); /* 256 */
|
||||
void (*reserved257)(void);
|
||||
void (*tclUnusedStubEntry) (void); /* 258 */
|
||||
} TclIntStubs;
|
||||
|
||||
extern const TclIntStubs *tclIntStubsPtr;
|
||||
@@ -1346,9 +1342,6 @@ extern const TclIntStubs *tclIntStubsPtr;
|
||||
(tclIntStubsPtr->tclPtrObjMakeUpvar) /* 255 */
|
||||
#define TclPtrUnsetVar \
|
||||
(tclIntStubsPtr->tclPtrUnsetVar) /* 256 */
|
||||
/* Slot 257 is reserved */
|
||||
#define TclUnusedStubEntry \
|
||||
(tclIntStubsPtr->tclUnusedStubEntry) /* 258 */
|
||||
|
||||
#endif /* defined(USE_TCL_STUBS) */
|
||||
|
||||
|
||||
+1
-17
@@ -23,7 +23,6 @@
|
||||
|
||||
typedef struct Link {
|
||||
Tcl_Interp *interp; /* Interpreter containing Tcl variable. */
|
||||
Namespace *nsPtr; /* Namespace containing Tcl variable */
|
||||
Tcl_Obj *varName; /* Name of variable (must be global). This is
|
||||
* needed during trace callbacks, since the
|
||||
* actual variable may be aliased at that time
|
||||
@@ -114,8 +113,6 @@ Tcl_LinkVar(
|
||||
{
|
||||
Tcl_Obj *objPtr;
|
||||
Link *linkPtr;
|
||||
Namespace *dummy;
|
||||
const char *name;
|
||||
int code;
|
||||
|
||||
linkPtr = (Link *) Tcl_VarTraceInfo2(interp, varName, NULL,
|
||||
@@ -128,7 +125,6 @@ Tcl_LinkVar(
|
||||
|
||||
linkPtr = ckalloc(sizeof(Link));
|
||||
linkPtr->interp = interp;
|
||||
linkPtr->nsPtr = NULL;
|
||||
linkPtr->varName = Tcl_NewStringObj(varName, -1);
|
||||
Tcl_IncrRefCount(linkPtr->varName);
|
||||
linkPtr->addr = addr;
|
||||
@@ -145,17 +141,11 @@ Tcl_LinkVar(
|
||||
ckfree(linkPtr);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
TclGetNamespaceForQualName(interp, varName, NULL, TCL_GLOBAL_ONLY,
|
||||
&(linkPtr->nsPtr), &dummy, &dummy, &name);
|
||||
linkPtr->nsPtr->refCount++;
|
||||
|
||||
code = Tcl_TraceVar2(interp, varName, NULL,
|
||||
TCL_GLOBAL_ONLY|TCL_TRACE_READS|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
|
||||
LinkTraceProc, linkPtr);
|
||||
if (code != TCL_OK) {
|
||||
Tcl_DecrRefCount(linkPtr->varName);
|
||||
TclNsDecrRefCount(linkPtr->nsPtr);
|
||||
ckfree(linkPtr);
|
||||
}
|
||||
return code;
|
||||
@@ -194,9 +184,6 @@ Tcl_UnlinkVar(
|
||||
TCL_GLOBAL_ONLY|TCL_TRACE_READS|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
|
||||
LinkTraceProc, linkPtr);
|
||||
Tcl_DecrRefCount(linkPtr->varName);
|
||||
if (linkPtr->nsPtr) {
|
||||
TclNsDecrRefCount(linkPtr->nsPtr);
|
||||
}
|
||||
ckfree(linkPtr);
|
||||
}
|
||||
|
||||
@@ -290,11 +277,8 @@ LinkTraceProc(
|
||||
*/
|
||||
|
||||
if (flags & TCL_TRACE_UNSETS) {
|
||||
if (Tcl_InterpDeleted(interp) || TclNamespaceDeleted(linkPtr->nsPtr)) {
|
||||
if (Tcl_InterpDeleted(interp)) {
|
||||
Tcl_DecrRefCount(linkPtr->varName);
|
||||
if (linkPtr->nsPtr) {
|
||||
TclNsDecrRefCount(linkPtr->nsPtr);
|
||||
}
|
||||
ckfree(linkPtr);
|
||||
} else if (flags & TCL_TRACE_DESTROYED) {
|
||||
Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr),
|
||||
|
||||
+8
-25
@@ -136,8 +136,8 @@ NewListIntRep(
|
||||
*
|
||||
* AttemptNewList --
|
||||
*
|
||||
* Like NewListIntRep, but additionally sets an error message on failure.
|
||||
*
|
||||
* Like NewListIntRep, but additionally sets an error message on failure.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@@ -234,12 +234,12 @@ Tcl_NewListObj(
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_DbNewListObj --
|
||||
*
|
||||
*
|
||||
* Like 'Tcl_NewListObj', but it calls Tcl_DbCkalloc directly with the
|
||||
* file name and line number from its caller. This simplifies debugging
|
||||
* since the [memory active] command will report the correct file
|
||||
* name and line number when reporting objects that haven't been freed.
|
||||
*
|
||||
*
|
||||
* When TCL_MEM_DEBUG is not defined, 'Tcl_NewListObj' is called instead.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
@@ -695,7 +695,7 @@ Tcl_ListObjAppendElement(
|
||||
* object should be treated as readonly and its 'refCount' is _not_
|
||||
* incremented. The caller must do that if it holds on to the
|
||||
* reference.
|
||||
*
|
||||
*
|
||||
* TCL_ERROR
|
||||
*
|
||||
* 'listPtr' is not a valid list. An an error message is left in the
|
||||
@@ -1331,9 +1331,9 @@ TclLsetList(
|
||||
* reference. The caller is expected to store the result in the
|
||||
* variable and decrement its reference count. (INST_STORE_* does
|
||||
* exactly this.)
|
||||
*
|
||||
*
|
||||
* NULL
|
||||
*
|
||||
*
|
||||
* An error occurred. If 'listPtr' was duplicated, the reference
|
||||
* count on the duplicate is decremented so that it is 0, causing any
|
||||
* memory allocated by this function to be freed.
|
||||
@@ -1990,21 +1990,7 @@ UpdateStringOfList(
|
||||
* Pass 2: copy into string rep buffer.
|
||||
*/
|
||||
|
||||
/*
|
||||
* We used to set the string length here, relying on a presumed
|
||||
* guarantee that the number of bytes TclScanElement() calls reported
|
||||
* to be needed was a precise count and not an over-estimate, so long
|
||||
* as the same flag values were passed to TclConvertElement().
|
||||
*
|
||||
* Then we saw [35a8f1c04a], where a bug in TclScanElement() caused
|
||||
* that guarantee to fail. Rather than trust there are no more bugs,
|
||||
* we set the length after the loop based on what was actually written,
|
||||
* an not on what was predicted.
|
||||
*
|
||||
listPtr->length = bytesNeeded - 1;
|
||||
*
|
||||
*/
|
||||
|
||||
listPtr->bytes = ckalloc(bytesNeeded);
|
||||
dst = listPtr->bytes;
|
||||
for (i = 0; i < numElems; i++) {
|
||||
@@ -2013,10 +1999,7 @@ UpdateStringOfList(
|
||||
dst += TclConvertElement(elem, length, dst, flagPtr[i]);
|
||||
*dst++ = ' ';
|
||||
}
|
||||
dst[-1] = '\0';
|
||||
|
||||
/* Here is the safe setting of the string length. */
|
||||
listPtr->length = dst - 1 - listPtr->bytes;
|
||||
listPtr->bytes[listPtr->length] = '\0';
|
||||
|
||||
if (flagPtr != localFlags) {
|
||||
ckfree(flagPtr);
|
||||
|
||||
+15
-26
@@ -200,36 +200,25 @@ TclCreateLiteral(
|
||||
for (globalPtr=globalTablePtr->buckets[globalHash] ; globalPtr!=NULL;
|
||||
globalPtr = globalPtr->nextPtr) {
|
||||
objPtr = globalPtr->objPtr;
|
||||
if (globalPtr->nsPtr == nsPtr) {
|
||||
if ((globalPtr->nsPtr == nsPtr)
|
||||
&& (objPtr->length == length) && ((length == 0)
|
||||
|| ((objPtr->bytes[0] == bytes[0])
|
||||
&& (memcmp(objPtr->bytes, bytes, (unsigned) length) == 0)))) {
|
||||
/*
|
||||
* Literals should always have UTF-8 representations... but this
|
||||
* is not guaranteed so we need to be careful anyway.
|
||||
*
|
||||
* https://stackoverflow.com/q/54337750/301832
|
||||
* A literal was found: return it
|
||||
*/
|
||||
|
||||
int objLength;
|
||||
char *objBytes = TclGetStringFromObj(objPtr, &objLength);
|
||||
|
||||
if ((objLength == length) && ((length == 0)
|
||||
|| ((objBytes[0] == bytes[0])
|
||||
&& (memcmp(objBytes, bytes, (unsigned) length) == 0)))) {
|
||||
/*
|
||||
* A literal was found: return it
|
||||
*/
|
||||
|
||||
if (newPtr) {
|
||||
*newPtr = 0;
|
||||
}
|
||||
if (globalPtrPtr) {
|
||||
*globalPtrPtr = globalPtr;
|
||||
}
|
||||
if (flags & LITERAL_ON_HEAP) {
|
||||
ckfree(bytes);
|
||||
}
|
||||
globalPtr->refCount++;
|
||||
return objPtr;
|
||||
if (newPtr) {
|
||||
*newPtr = 0;
|
||||
}
|
||||
if (globalPtrPtr) {
|
||||
*globalPtrPtr = globalPtr;
|
||||
}
|
||||
if ((flags & LITERAL_ON_HEAP)) {
|
||||
ckfree(bytes);
|
||||
}
|
||||
globalPtr->refCount++;
|
||||
return objPtr;
|
||||
}
|
||||
}
|
||||
if (!newPtr) {
|
||||
|
||||
+35
-18
@@ -17,11 +17,21 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* On Windows, this file needs to be compiled twice, once with UNICODE and
|
||||
* _UNICODE defined. This way both Tcl_Main and Tcl_MainExW can be
|
||||
* implemented, sharing the same source code.
|
||||
* On Windows, this file needs to be compiled twice, once with TCL_ASCII_MAIN
|
||||
* defined. This way both Tcl_Main and Tcl_MainExW can be implemented, sharing
|
||||
* the same source code.
|
||||
*/
|
||||
|
||||
#if defined(TCL_ASCII_MAIN)
|
||||
# ifdef UNICODE
|
||||
# undef UNICODE
|
||||
# undef _UNICODE
|
||||
# else
|
||||
# define UNICODE
|
||||
# define _UNICODE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "tclInt.h"
|
||||
|
||||
/*
|
||||
@@ -43,19 +53,26 @@
|
||||
# define _tcscmp strcmp
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Further on, in UNICODE mode we just use Tcl_NewUnicodeObj, otherwise
|
||||
* NewNativeObj is needed (which provides proper conversion from native
|
||||
* encoding to UTF-8).
|
||||
*/
|
||||
|
||||
#ifdef UNICODE
|
||||
# define NewNativeObj Tcl_NewUnicodeObj
|
||||
#else /* !UNICODE */
|
||||
static inline Tcl_Obj *
|
||||
NewNativeObj(
|
||||
TCHAR *string)
|
||||
char *string,
|
||||
int length)
|
||||
{
|
||||
Tcl_DString ds;
|
||||
|
||||
#ifdef UNICODE
|
||||
Tcl_WinTCharToUtf(string, -1, &ds);
|
||||
#else
|
||||
Tcl_ExternalToUtfDString(NULL, (char *) string, -1, &ds);
|
||||
#endif
|
||||
Tcl_ExternalToUtfDString(NULL, string, length, &ds);
|
||||
return TclDStringToObj(&ds);
|
||||
}
|
||||
#endif /* !UNICODE */
|
||||
|
||||
/*
|
||||
* Declarations for various library functions and variables (don't want to
|
||||
@@ -117,7 +134,7 @@ static void Prompt(Tcl_Interp *interp, InteractiveState *isPtr);
|
||||
static void StdinProc(ClientData clientData, int mask);
|
||||
static void FreeMainInterp(ClientData clientData);
|
||||
|
||||
#if !defined(_WIN32) || defined(UNICODE)
|
||||
#ifndef TCL_ASCII_MAIN
|
||||
static Tcl_ThreadDataKey dataKey;
|
||||
|
||||
/*
|
||||
@@ -262,7 +279,7 @@ Tcl_SourceRCFile(
|
||||
Tcl_DStringFree(&temp);
|
||||
}
|
||||
}
|
||||
#endif /* !UNICODE */
|
||||
#endif /* !TCL_ASCII_MAIN */
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -324,14 +341,14 @@ Tcl_MainEx(
|
||||
|
||||
if ((argc > 3) && (0 == _tcscmp(TEXT("-encoding"), argv[1]))
|
||||
&& ('-' != argv[3][0])) {
|
||||
Tcl_Obj *value = NewNativeObj(argv[2]);
|
||||
Tcl_SetStartupScript(NewNativeObj(argv[3]),
|
||||
Tcl_Obj *value = NewNativeObj(argv[2], -1);
|
||||
Tcl_SetStartupScript(NewNativeObj(argv[3], -1),
|
||||
Tcl_GetString(value));
|
||||
Tcl_DecrRefCount(value);
|
||||
argc -= 3;
|
||||
argv += 3;
|
||||
} else if ((argc > 1) && ('-' != argv[1][0])) {
|
||||
Tcl_SetStartupScript(NewNativeObj(argv[1]), NULL);
|
||||
Tcl_SetStartupScript(NewNativeObj(argv[1], -1), NULL);
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
@@ -339,7 +356,7 @@ Tcl_MainEx(
|
||||
|
||||
path = Tcl_GetStartupScript(&encodingName);
|
||||
if (path == NULL) {
|
||||
appName = NewNativeObj(argv[0]);
|
||||
appName = NewNativeObj(argv[0], -1);
|
||||
} else {
|
||||
appName = path;
|
||||
}
|
||||
@@ -351,7 +368,7 @@ Tcl_MainEx(
|
||||
|
||||
argvPtr = Tcl_NewListObj(0, NULL);
|
||||
while (argc--) {
|
||||
Tcl_ListObjAppendElement(NULL, argvPtr, NewNativeObj(*argv++));
|
||||
Tcl_ListObjAppendElement(NULL, argvPtr, NewNativeObj(*argv++, -1));
|
||||
}
|
||||
Tcl_SetVar2Ex(interp, "argv", NULL, argvPtr, TCL_GLOBAL_ONLY);
|
||||
|
||||
@@ -633,7 +650,7 @@ Tcl_Main(
|
||||
}
|
||||
#endif /* TCL_MAJOR_VERSION == 8 && !UNICODE */
|
||||
|
||||
#if !defined(_WIN32) || defined(UNICODE)
|
||||
#ifndef TCL_ASCII_MAIN
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
@@ -724,7 +741,7 @@ TclFullFinalizationRequested(void)
|
||||
return finalize;
|
||||
#endif /* PURIFY */
|
||||
}
|
||||
#endif /* UNICODE */
|
||||
#endif /* !TCL_ASCII_MAIN */
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
|
||||
@@ -1071,13 +1071,6 @@ Tcl_DeleteNamespace(
|
||||
}
|
||||
TclNsDecrRefCount(nsPtr);
|
||||
}
|
||||
|
||||
int
|
||||
TclNamespaceDeleted(
|
||||
Namespace *nsPtr)
|
||||
{
|
||||
return (nsPtr->flags & NS_DYING) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
|
||||
+73
-145
@@ -226,7 +226,7 @@ MODULE_SCOPE const TclOOStubs tclOOStubs;
|
||||
* ROOT_CLASS respectively.
|
||||
*/
|
||||
|
||||
#define Destructing(oPtr) ((oPtr)->flags & OBJECT_DESTRUCTING)
|
||||
#define Deleted(oPtr) ((oPtr)->flags & OBJECT_DELETED)
|
||||
#define IsRootObject(ocPtr) ((ocPtr)->flags & ROOT_OBJECT)
|
||||
#define IsRootClass(ocPtr) ((ocPtr)->flags & ROOT_CLASS)
|
||||
#define IsRoot(ocPtr) ((ocPtr)->flags & (ROOT_OBJECT|ROOT_CLASS))
|
||||
@@ -365,14 +365,14 @@ InitFoundation(
|
||||
*/
|
||||
|
||||
Tcl_DStringInit(&buffer);
|
||||
for (i = 0 ; defineCmds[i].name ; i++) {
|
||||
for (i=0 ; defineCmds[i].name ; i++) {
|
||||
TclDStringAppendLiteral(&buffer, "::oo::define::");
|
||||
Tcl_DStringAppend(&buffer, defineCmds[i].name, -1);
|
||||
Tcl_CreateObjCommand(interp, Tcl_DStringValue(&buffer),
|
||||
defineCmds[i].objProc, INT2PTR(defineCmds[i].flag), NULL);
|
||||
Tcl_DStringFree(&buffer);
|
||||
}
|
||||
for (i = 0 ; objdefCmds[i].name ; i++) {
|
||||
for (i=0 ; objdefCmds[i].name ; i++) {
|
||||
TclDStringAppendLiteral(&buffer, "::oo::objdefine::");
|
||||
Tcl_DStringAppend(&buffer, objdefCmds[i].name, -1);
|
||||
Tcl_CreateObjCommand(interp, Tcl_DStringValue(&buffer),
|
||||
@@ -387,50 +387,30 @@ InitFoundation(
|
||||
* spliced manually.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Stand up a phony class for bootstrapping.
|
||||
*/
|
||||
|
||||
/* Stand up a phony class for bootstrapping. */
|
||||
fPtr->objectCls = &fakeCls;
|
||||
|
||||
/*
|
||||
* Referenced in TclOOAllocClass to increment the refCount.
|
||||
*/
|
||||
|
||||
/* referenced in TclOOAllocClass to increment the refCount. */
|
||||
fakeCls.thisPtr = &fakeObject;
|
||||
|
||||
fPtr->objectCls = TclOOAllocClass(interp,
|
||||
AllocObject(interp, "object", (Namespace *)fPtr->ooNs, NULL));
|
||||
/*
|
||||
* Corresponding TclOODecrRefCount in KillFoudation.
|
||||
*/
|
||||
|
||||
/* Corresponding TclOODecrRefCount in KillFoudation */
|
||||
AddRef(fPtr->objectCls->thisPtr);
|
||||
|
||||
/*
|
||||
* This is why it is unnecessary in this routine to replace the
|
||||
/* This is why it is unnecessary in this routine to replace the
|
||||
* incremented reference count of fPtr->objectCls that was swallowed by
|
||||
* fakeObject.
|
||||
*/
|
||||
|
||||
* fakeObject. */
|
||||
fPtr->objectCls->superclasses.num = 0;
|
||||
ckfree(fPtr->objectCls->superclasses.list);
|
||||
fPtr->objectCls->superclasses.list = NULL;
|
||||
|
||||
/*
|
||||
* Special initialization for the primordial objects.
|
||||
*/
|
||||
|
||||
/* special initialization for the primordial objects */
|
||||
fPtr->objectCls->thisPtr->flags |= ROOT_OBJECT;
|
||||
fPtr->objectCls->flags |= ROOT_OBJECT;
|
||||
|
||||
fPtr->classCls = TclOOAllocClass(interp,
|
||||
AllocObject(interp, "class", (Namespace *)fPtr->ooNs, NULL));
|
||||
|
||||
/*
|
||||
* Corresponding TclOODecrRefCount in KillFoudation.
|
||||
*/
|
||||
|
||||
/* Corresponding TclOODecrRefCount in KillFoudation */
|
||||
AddRef(fPtr->classCls->thisPtr);
|
||||
|
||||
/*
|
||||
@@ -441,10 +421,7 @@ InitFoundation(
|
||||
* KillFoundation.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Rewire bootstrapped objects.
|
||||
*/
|
||||
|
||||
/* Rewire bootstrapped objects. */
|
||||
fPtr->objectCls->thisPtr->selfCls = fPtr->classCls;
|
||||
AddRef(fPtr->classCls->thisPtr);
|
||||
TclOOAddToInstances(fPtr->objectCls->thisPtr, fPtr->classCls);
|
||||
@@ -456,20 +433,17 @@ InitFoundation(
|
||||
fPtr->classCls->thisPtr->flags |= ROOT_CLASS;
|
||||
fPtr->classCls->flags |= ROOT_CLASS;
|
||||
|
||||
/*
|
||||
* Standard initialization for new Objects.
|
||||
*/
|
||||
|
||||
/* Standard initialization for new Objects */
|
||||
TclOOAddToSubclasses(fPtr->classCls, fPtr->objectCls);
|
||||
|
||||
/*
|
||||
* Basic method declarations for the core classes.
|
||||
*/
|
||||
|
||||
for (i = 0 ; objMethods[i].name ; i++) {
|
||||
for (i=0 ; objMethods[i].name ; i++) {
|
||||
TclOONewBasicMethod(interp, fPtr->objectCls, &objMethods[i]);
|
||||
}
|
||||
for (i = 0 ; clsMethods[i].name ; i++) {
|
||||
for (i=0 ; clsMethods[i].name ; i++) {
|
||||
TclOONewBasicMethod(interp, fPtr->classCls, &clsMethods[i]);
|
||||
}
|
||||
|
||||
@@ -493,7 +467,7 @@ InitFoundation(
|
||||
|
||||
TclNewLiteralStringObj(namePtr, "new");
|
||||
Tcl_NewInstanceMethod(interp, (Tcl_Object) fPtr->classCls->thisPtr,
|
||||
namePtr /* keeps ref */, 0 /* private */, NULL, NULL);
|
||||
namePtr /* keeps ref */, 0 /* ==private */, NULL, NULL);
|
||||
fPtr->classCls->constructorPtr = (Method *) Tcl_NewMethod(interp,
|
||||
(Tcl_Class) fPtr->classCls, NULL, 0, &classConstructor, NULL);
|
||||
|
||||
@@ -677,8 +651,10 @@ AllocObject(
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
|
||||
|
||||
configNamespace:
|
||||
((Namespace *) oPtr->namespacePtr)->refCount++;
|
||||
|
||||
((Namespace *)oPtr->namespacePtr)->refCount++;
|
||||
|
||||
/*
|
||||
* Make the namespace know about the helper commands. This grants access
|
||||
@@ -716,7 +692,7 @@ AllocObject(
|
||||
/*
|
||||
* An object starts life with a refCount of 2 to mark the two stages of
|
||||
* destruction it occur: A call to ObjectRenamedTrace(), and a call to
|
||||
* ObjectNamespaceDeleted().
|
||||
* ObjectNamespaceDeleted().
|
||||
*/
|
||||
oPtr->refCount = 2;
|
||||
|
||||
@@ -839,7 +815,7 @@ ObjectRenamedTrace(
|
||||
* 2950259].
|
||||
*/
|
||||
|
||||
if (!Destructing(oPtr)) {
|
||||
if (!Deleted(oPtr)) {
|
||||
Tcl_DeleteNamespace(oPtr->namespacePtr);
|
||||
}
|
||||
oPtr->command = NULL;
|
||||
@@ -871,15 +847,11 @@ TclOODeleteDescendants(
|
||||
|
||||
if (clsPtr->mixinSubs.num > 0) {
|
||||
while (clsPtr->mixinSubs.num > 0) {
|
||||
mixinSubclassPtr =
|
||||
clsPtr->mixinSubs.list[clsPtr->mixinSubs.num - 1];
|
||||
|
||||
/*
|
||||
* This condition also covers the case where mixinSubclassPtr ==
|
||||
mixinSubclassPtr = clsPtr->mixinSubs.list[clsPtr->mixinSubs.num-1];
|
||||
/* This condition also covers the case where mixinSubclassPtr ==
|
||||
* clsPtr
|
||||
*/
|
||||
|
||||
if (!Destructing(mixinSubclassPtr->thisPtr)
|
||||
if (!Deleted(mixinSubclassPtr->thisPtr)
|
||||
&& !(mixinSubclassPtr->thisPtr->flags & DONT_DELETE)) {
|
||||
Tcl_DeleteCommandFromToken(interp,
|
||||
mixinSubclassPtr->thisPtr->command);
|
||||
@@ -897,8 +869,8 @@ TclOODeleteDescendants(
|
||||
|
||||
if (clsPtr->subclasses.num > 0) {
|
||||
while (clsPtr->subclasses.num > 0) {
|
||||
subclassPtr = clsPtr->subclasses.list[clsPtr->subclasses.num - 1];
|
||||
if (!Destructing(subclassPtr->thisPtr) && !IsRoot(subclassPtr)
|
||||
subclassPtr = clsPtr->subclasses.list[clsPtr->subclasses.num-1];
|
||||
if (!Deleted(subclassPtr->thisPtr) && !IsRoot(subclassPtr)
|
||||
&& !(subclassPtr->thisPtr->flags & DONT_DELETE)) {
|
||||
Tcl_DeleteCommandFromToken(interp,
|
||||
subclassPtr->thisPtr->command);
|
||||
@@ -918,13 +890,9 @@ TclOODeleteDescendants(
|
||||
|
||||
if (clsPtr->instances.num > 0) {
|
||||
while (clsPtr->instances.num > 0) {
|
||||
instancePtr = clsPtr->instances.list[clsPtr->instances.num - 1];
|
||||
|
||||
/*
|
||||
* This condition also covers the case where instancePtr == oPtr
|
||||
*/
|
||||
|
||||
if (!Destructing(instancePtr) && !IsRoot(instancePtr) &&
|
||||
instancePtr = clsPtr->instances.list[clsPtr->instances.num-1];
|
||||
/* This condition also covers the case where instancePtr == oPtr */
|
||||
if (!Deleted(instancePtr) && !IsRoot(instancePtr) &&
|
||||
!(instancePtr->flags & DONT_DELETE)) {
|
||||
Tcl_DeleteCommandFromToken(interp, instancePtr->command);
|
||||
}
|
||||
@@ -937,6 +905,7 @@ TclOODeleteDescendants(
|
||||
clsPtr->instances.size = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------
|
||||
@@ -955,7 +924,7 @@ TclOOReleaseClassContents(
|
||||
Object *oPtr) /* The object representing the class. */
|
||||
{
|
||||
FOREACH_HASH_DECLS;
|
||||
int i;
|
||||
int i;
|
||||
Class *clsPtr = oPtr->classPtr, *tmpClsPtr;
|
||||
Method *mPtr;
|
||||
Foundation *fPtr = oPtr->fPtr;
|
||||
@@ -965,7 +934,7 @@ TclOOReleaseClassContents(
|
||||
* Sanity check!
|
||||
*/
|
||||
|
||||
if (!Destructing(oPtr)) {
|
||||
if (!Deleted(oPtr)) {
|
||||
if (IsRootClass(oPtr)) {
|
||||
Tcl_Panic("deleting class structure for non-deleted %s",
|
||||
"::oo::class");
|
||||
@@ -1063,9 +1032,10 @@ TclOOReleaseClassContents(
|
||||
ckfree(clsPtr->variables.list);
|
||||
}
|
||||
|
||||
if (IsRootClass(oPtr) && !Destructing(fPtr->objectCls->thisPtr)) {
|
||||
if (IsRootClass(oPtr) && !Deleted(fPtr->objectCls->thisPtr)) {
|
||||
Tcl_DeleteCommandFromToken(interp, fPtr->objectCls->thisPtr->command);
|
||||
}
|
||||
oPtr->classPtr = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1095,9 +1065,8 @@ ObjectNamespaceDeleted(
|
||||
Tcl_Interp *interp = oPtr->fPtr->interp;
|
||||
int i;
|
||||
|
||||
if (Destructing(oPtr)) {
|
||||
/*
|
||||
* TODO: Can ObjectNamespaceDeleted ever be called twice? If not,
|
||||
if (Deleted(oPtr)) {
|
||||
/* To do: Can ObjectNamespaceDeleted ever be called twice? If not,
|
||||
* this guard could be removed.
|
||||
*/
|
||||
return;
|
||||
@@ -1108,12 +1077,9 @@ ObjectNamespaceDeleted(
|
||||
* process of being deleted, nothing else may modify its bookeeping
|
||||
* records. This is the flag that
|
||||
*/
|
||||
oPtr->flags |= OBJECT_DESTRUCTING;
|
||||
|
||||
/*
|
||||
* Let the dominoes fall!
|
||||
*/
|
||||
oPtr->flags |= OBJECT_DELETED;
|
||||
|
||||
/* Let the dominoes fall */
|
||||
if (oPtr->classPtr) {
|
||||
TclOODeleteDescendants(interp, oPtr);
|
||||
}
|
||||
@@ -1124,13 +1090,12 @@ ObjectNamespaceDeleted(
|
||||
* in that case when the destructor is partially deleted before the uses
|
||||
* of it have gone. [Bug 2949397]
|
||||
*/
|
||||
|
||||
if (!Tcl_InterpDeleted(interp) && !(oPtr->flags & DESTRUCTOR_CALLED)) {
|
||||
CallContext *contextPtr =
|
||||
TclOOGetCallContext(oPtr, NULL, DESTRUCTOR, NULL);
|
||||
int result;
|
||||
Tcl_InterpState state;
|
||||
|
||||
Tcl_InterpState state;
|
||||
oPtr->flags |= DESTRUCTOR_CALLED;
|
||||
|
||||
if (contextPtr != NULL) {
|
||||
@@ -1149,12 +1114,12 @@ ObjectNamespaceDeleted(
|
||||
|
||||
/*
|
||||
* Instruct everyone to no longer use any allocated fields of the object.
|
||||
* Also delete the command that refers to the object at this point (if it
|
||||
* still exists) because otherwise its pointer to the object points into
|
||||
* freed memory.
|
||||
* Also delete the command that refers to the object at this point (if
|
||||
* it still exists) because otherwise its pointer to the object
|
||||
* points into freed memory.
|
||||
*/
|
||||
|
||||
if (((Command *) oPtr->command)->flags && CMD_IS_DELETED) {
|
||||
if (((Command *)oPtr->command)->flags && CMD_IS_DELETED) {
|
||||
/*
|
||||
* Something has already started the command deletion process. We can
|
||||
* go ahead and clean up the the namespace,
|
||||
@@ -1164,7 +1129,6 @@ ObjectNamespaceDeleted(
|
||||
* The namespace must have been deleted directly. Delete the command
|
||||
* as well.
|
||||
*/
|
||||
|
||||
Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->command);
|
||||
}
|
||||
|
||||
@@ -1177,7 +1141,7 @@ ObjectNamespaceDeleted(
|
||||
* methods on the object.
|
||||
*/
|
||||
|
||||
/* TODO: Should this be protected with a !IsRoot() condition? */
|
||||
/* To do: Should this be protected with a * !IsRoot() condition? */
|
||||
TclOORemoveFromInstances(oPtr, oPtr->selfCls);
|
||||
|
||||
if (oPtr->mixins.num > 0) {
|
||||
@@ -1185,9 +1149,7 @@ ObjectNamespaceDeleted(
|
||||
TclOORemoveFromInstances(oPtr, mixinPtr);
|
||||
TclOODecrRefCount(mixinPtr->thisPtr);
|
||||
}
|
||||
if (oPtr->mixins.list != NULL) {
|
||||
ckfree(oPtr->mixins.list);
|
||||
}
|
||||
ckfree(oPtr->mixins.list);
|
||||
}
|
||||
|
||||
FOREACH(filterObj, oPtr->filters) {
|
||||
@@ -1233,7 +1195,7 @@ ObjectNamespaceDeleted(
|
||||
/*
|
||||
* Because an object can be a class that is an instance of itself, the
|
||||
* class object's class structure should only be cleaned after most of
|
||||
* the cleanup on the object is done.
|
||||
* the cleanup on the object is done.
|
||||
*
|
||||
* The class of objects needs some special care; if it is deleted (and
|
||||
* we're not killing the whole interpreter) we force the delete of the
|
||||
@@ -1242,7 +1204,7 @@ ObjectNamespaceDeleted(
|
||||
* sometimes not go away automatically; we force it here. [Bug 2962664]
|
||||
*/
|
||||
|
||||
if (IsRootObject(oPtr) && !Destructing(fPtr->classCls->thisPtr)
|
||||
if (IsRootObject(oPtr) && !Deleted(fPtr->classCls->thisPtr)
|
||||
&& !Tcl_InterpDeleted(interp)) {
|
||||
|
||||
Tcl_DeleteCommandFromToken(interp, fPtr->classCls->thisPtr->command);
|
||||
@@ -1286,27 +1248,10 @@ int TclOODecrRefCount(Object *oPtr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------
|
||||
*
|
||||
* TclOOObjectDestroyed --
|
||||
*
|
||||
* Returns TCL_OK if an object is entirely deleted, i.e. the destruction
|
||||
* sequence has completed.
|
||||
*
|
||||
* ----------------------------------------------------------------------
|
||||
*/
|
||||
int TclOOObjectDestroyed(Object *oPtr) {
|
||||
return (oPtr->namespacePtr == NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Setting the "empty" location to NULL makes debugging a little easier.
|
||||
*/
|
||||
|
||||
#define REMOVEBODY { \
|
||||
/* setting the "empty" location to NULL makes debugging a little easier */
|
||||
#define REMOVEBODY { \
|
||||
for (; idx < num - 1; idx++) { \
|
||||
list[idx] = list[idx + 1]; \
|
||||
list[idx] = list[idx+1]; \
|
||||
} \
|
||||
list[idx] = NULL; \
|
||||
return; \
|
||||
@@ -1405,10 +1350,6 @@ TclOORemoveFromMixins(
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (oPtr->mixins.num == 0) {
|
||||
ckfree(oPtr->mixins.list);
|
||||
oPtr->mixins.list = NULL;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -1460,7 +1401,7 @@ TclOOAddToSubclasses(
|
||||
* is assumed that the class is not already
|
||||
* present as a subclass in the superclass. */
|
||||
{
|
||||
if (Destructing(superPtr->thisPtr)) {
|
||||
if (Deleted(superPtr->thisPtr)) {
|
||||
return;
|
||||
}
|
||||
if (superPtr->subclasses.num >= superPtr->subclasses.size) {
|
||||
@@ -1525,7 +1466,7 @@ TclOOAddToMixinSubs(
|
||||
* is assumed that the class is not already
|
||||
* present as a subclass in the superclass. */
|
||||
{
|
||||
if (Destructing(superPtr->thisPtr)) {
|
||||
if (Deleted(superPtr->thisPtr)) {
|
||||
return;
|
||||
}
|
||||
if (superPtr->mixinSubs.num >= superPtr->mixinSubs.size) {
|
||||
@@ -1744,6 +1685,7 @@ TclNRNewObjectInstance(
|
||||
TclPushTailcallPoint(interp);
|
||||
return TclOOInvokeContext(contextPtr, interp, objc, objv);
|
||||
}
|
||||
|
||||
|
||||
Object *
|
||||
TclNewObjectInstanceCommon(
|
||||
@@ -1758,17 +1700,21 @@ TclNewObjectInstanceCommon(
|
||||
const char *simpleName = NULL;
|
||||
Namespace *nsPtr = NULL, *dummy,
|
||||
*inNsPtr = (Namespace *)TclGetCurrentNamespace(interp);
|
||||
int isNew;
|
||||
|
||||
if (nameStr) {
|
||||
TclGetNamespaceForQualName(interp, nameStr, inNsPtr,
|
||||
TCL_CREATE_NS_IF_UNKNOWN, &nsPtr, &dummy, &dummy, &simpleName);
|
||||
TclGetNamespaceForQualName(interp, nameStr, inNsPtr, TCL_CREATE_NS_IF_UNKNOWN,
|
||||
&nsPtr, &dummy, &dummy, &simpleName);
|
||||
|
||||
/*
|
||||
* Disallow creation of an object over an existing command.
|
||||
*/
|
||||
|
||||
hPtr = Tcl_FindHashEntry(&nsPtr->cmdTable, simpleName);
|
||||
if (hPtr) {
|
||||
hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, simpleName, &isNew);
|
||||
if (isNew) {
|
||||
/* Just kidding */
|
||||
Tcl_DeleteHashEntry(hPtr);
|
||||
} else {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"can't create object \"%s\": command already exists with"
|
||||
" that name", nameStr));
|
||||
@@ -1785,7 +1731,6 @@ TclNewObjectInstanceCommon(
|
||||
oPtr->selfCls = classPtr;
|
||||
AddRef(classPtr->thisPtr);
|
||||
TclOOAddToInstances(oPtr, classPtr);
|
||||
|
||||
/*
|
||||
* Check to see if we're really creating a class. If so, allocate the
|
||||
* class structure as well.
|
||||
@@ -1807,6 +1752,8 @@ TclNewObjectInstanceCommon(
|
||||
return oPtr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
FinalizeAlloc(
|
||||
ClientData data[],
|
||||
@@ -1823,7 +1770,7 @@ FinalizeAlloc(
|
||||
* Don't want to lose errors by accident. [Bug 2903011]
|
||||
*/
|
||||
|
||||
if (result != TCL_ERROR && Destructing(oPtr)) {
|
||||
if (result != TCL_ERROR && Deleted(oPtr)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"object deleted in constructor", -1));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "STILLBORN", NULL);
|
||||
@@ -1838,25 +1785,17 @@ FinalizeAlloc(
|
||||
* command before we delete it. [Bug 9dd1bd7a74]
|
||||
*/
|
||||
|
||||
if (!Destructing(oPtr)) {
|
||||
if (!Deleted(oPtr)) {
|
||||
(void) TclOOObjectName(interp, oPtr);
|
||||
Tcl_DeleteCommandFromToken(interp, oPtr->command);
|
||||
}
|
||||
|
||||
/*
|
||||
* This decrements the refcount of oPtr.
|
||||
*/
|
||||
|
||||
/* This decrements the refcount of oPtr */
|
||||
TclOODeleteContext(contextPtr);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_RestoreInterpState(interp, state);
|
||||
*objectPtr = (Tcl_Object) oPtr;
|
||||
|
||||
/*
|
||||
* This decrements the refcount of oPtr.
|
||||
*/
|
||||
|
||||
/* This decrements the refcount of oPtr */
|
||||
TclOODeleteContext(contextPtr);
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -1941,11 +1880,7 @@ Tcl_CopyObjectInstance(
|
||||
if (mixinPtr && mixinPtr != o2Ptr->selfCls) {
|
||||
TclOOAddToInstances(o2Ptr, mixinPtr);
|
||||
}
|
||||
|
||||
/*
|
||||
* For the reference just created in DUPLICATE.
|
||||
*/
|
||||
|
||||
/* For the reference just created in DUPLICATE */
|
||||
AddRef(mixinPtr->thisPtr);
|
||||
}
|
||||
|
||||
@@ -1975,8 +1910,7 @@ Tcl_CopyObjectInstance(
|
||||
*/
|
||||
|
||||
o2Ptr->flags = oPtr->flags & ~(
|
||||
OBJECT_DESTRUCTING | ROOT_OBJECT | ROOT_CLASS | FILTER_HANDLING);
|
||||
|
||||
OBJECT_DELETED | ROOT_OBJECT | ROOT_CLASS | FILTER_HANDLING);
|
||||
/*
|
||||
* Copy the object's metadata.
|
||||
*/
|
||||
@@ -2040,11 +1974,9 @@ Tcl_CopyObjectInstance(
|
||||
FOREACH(superPtr, cls2Ptr->superclasses) {
|
||||
TclOOAddToSubclasses(cls2Ptr, superPtr);
|
||||
|
||||
/*
|
||||
* For the new item in cls2Ptr->superclasses that memcpy just
|
||||
* created.
|
||||
/* For the new item in cls2Ptr->superclasses that memcpy just
|
||||
* created
|
||||
*/
|
||||
|
||||
AddRef(superPtr->thisPtr);
|
||||
}
|
||||
|
||||
@@ -2081,11 +2013,7 @@ Tcl_CopyObjectInstance(
|
||||
DUPLICATE(cls2Ptr->mixins, clsPtr->mixins, Class *);
|
||||
FOREACH(mixinPtr, cls2Ptr->mixins) {
|
||||
TclOOAddToMixinSubs(cls2Ptr, mixinPtr);
|
||||
|
||||
/*
|
||||
* For the copy just created in DUPLICATE.
|
||||
*/
|
||||
|
||||
/* For the copy just created in DUPLICATE */
|
||||
AddRef(mixinPtr->thisPtr);
|
||||
}
|
||||
|
||||
@@ -2686,7 +2614,7 @@ Tcl_ObjectContextInvokeNext(
|
||||
int savedSkip = contextPtr->skip;
|
||||
int result;
|
||||
|
||||
if (contextPtr->index + 1 >= contextPtr->callPtr->numChain) {
|
||||
if (contextPtr->index+1 >= contextPtr->callPtr->numChain) {
|
||||
/*
|
||||
* We're at the end of the chain; generate an error message unless the
|
||||
* interpreter is being torn down, in which case we might be getting
|
||||
@@ -2755,7 +2683,7 @@ TclNRObjectContextInvokeNext(
|
||||
{
|
||||
register CallContext *contextPtr = (CallContext *) context;
|
||||
|
||||
if (contextPtr->index + 1 >= contextPtr->callPtr->numChain) {
|
||||
if (contextPtr->index+1 >= contextPtr->callPtr->numChain) {
|
||||
/*
|
||||
* We're at the end of the chain; generate an error message unless the
|
||||
* interpreter is being torn down, in which case we might be getting
|
||||
|
||||
+11
-22
@@ -110,11 +110,7 @@ TclOODeleteContext(
|
||||
TclOODeleteChain(contextPtr->callPtr);
|
||||
if (oPtr != NULL) {
|
||||
TclStackFree(oPtr->fPtr->interp, contextPtr);
|
||||
|
||||
/*
|
||||
* Corresponding AddRef() in TclOO.c/TclOOObjectCmdCore
|
||||
*/
|
||||
|
||||
/* Corresponding AddRef() in TclOO.c/TclOOObjectCmdCore */
|
||||
TclOODecrRefCount(oPtr);
|
||||
}
|
||||
}
|
||||
@@ -269,7 +265,7 @@ TclOOInvokeContext(
|
||||
if (contextPtr->index == 0) {
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < contextPtr->callPtr->numChain ; i++) {
|
||||
for (i=0 ; i<contextPtr->callPtr->numChain ; i++) {
|
||||
AddRef(contextPtr->callPtr->chain[i].mPtr);
|
||||
}
|
||||
|
||||
@@ -347,7 +343,7 @@ FinalizeMethodRefs(
|
||||
CallContext *contextPtr = data[0];
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < contextPtr->callPtr->numChain ; i++) {
|
||||
for (i=0 ; i<contextPtr->callPtr->numChain ; i++) {
|
||||
TclOODelMethodRef(contextPtr->callPtr->chain[i].mPtr);
|
||||
}
|
||||
return result;
|
||||
@@ -572,10 +568,7 @@ TclOOGetSortedClassMethodList(
|
||||
return i;
|
||||
}
|
||||
|
||||
/*
|
||||
* Comparator for GetSortedMethodList
|
||||
*/
|
||||
|
||||
/* Comparator for GetSortedMethodList */
|
||||
static int
|
||||
CmpStr(
|
||||
const void *ptr1,
|
||||
@@ -584,7 +577,7 @@ CmpStr(
|
||||
const char **strPtr1 = (const char **) ptr1;
|
||||
const char **strPtr2 = (const char **) ptr2;
|
||||
|
||||
return TclpUtfNcmp2(*strPtr1, *strPtr2, strlen(*strPtr1) + 1);
|
||||
return TclpUtfNcmp2(*strPtr1, *strPtr2, strlen(*strPtr1)+1);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -831,7 +824,7 @@ AddMethodToCallChain(
|
||||
* any leading filters.
|
||||
*/
|
||||
|
||||
for (i = cbPtr->filterLength ; i < callPtr->numChain ; i++) {
|
||||
for (i=cbPtr->filterLength ; i<callPtr->numChain ; i++) {
|
||||
if (callPtr->chain[i].mPtr == mPtr &&
|
||||
callPtr->chain[i].isFilter == (doneFilters != NULL)) {
|
||||
/*
|
||||
@@ -843,8 +836,8 @@ AddMethodToCallChain(
|
||||
|
||||
Class *declCls = callPtr->chain[i].filterDeclarer;
|
||||
|
||||
for (; i + 1 < callPtr->numChain ; i++) {
|
||||
callPtr->chain[i] = callPtr->chain[i + 1];
|
||||
for (; i+1<callPtr->numChain ; i++) {
|
||||
callPtr->chain[i] = callPtr->chain[i+1];
|
||||
}
|
||||
callPtr->chain[i].mPtr = mPtr;
|
||||
callPtr->chain[i].isFilter = (doneFilters != NULL);
|
||||
@@ -861,7 +854,7 @@ AddMethodToCallChain(
|
||||
|
||||
if (callPtr->numChain == CALL_CHAIN_STATIC_SIZE) {
|
||||
callPtr->chain =
|
||||
ckalloc(sizeof(struct MInvoke) * (callPtr->numChain + 1));
|
||||
ckalloc(sizeof(struct MInvoke) * (callPtr->numChain+1));
|
||||
memcpy(callPtr->chain, callPtr->staticChain,
|
||||
sizeof(struct MInvoke) * callPtr->numChain);
|
||||
} else if (callPtr->numChain > CALL_CHAIN_STATIC_SIZE) {
|
||||
@@ -1179,11 +1172,7 @@ TclOOGetCallContext(
|
||||
returnContext:
|
||||
contextPtr = TclStackAlloc(oPtr->fPtr->interp, sizeof(CallContext));
|
||||
contextPtr->oPtr = oPtr;
|
||||
|
||||
/*
|
||||
* Corresponding TclOODecrRefCount() in TclOODeleteContext
|
||||
*/
|
||||
|
||||
/* Corresponding TclOODecrRefCount() in TclOODeleteContext */
|
||||
AddRef(oPtr);
|
||||
contextPtr->callPtr = callPtr;
|
||||
contextPtr->skip = 2;
|
||||
@@ -1539,7 +1528,7 @@ TclOORenderCallChain(
|
||||
*/
|
||||
|
||||
objv = TclStackAlloc(interp, callPtr->numChain * sizeof(Tcl_Obj *));
|
||||
for (i = 0 ; i < callPtr->numChain ; i++) {
|
||||
for (i=0 ; i<callPtr->numChain ; i++) {
|
||||
struct MInvoke *miPtr = &callPtr->chain[i];
|
||||
|
||||
descObjs[0] = miPtr->isFilter
|
||||
|
||||
+37
-63
@@ -40,12 +40,6 @@ struct DeclaredSlot {
|
||||
{TCL_OO_METHOD_VERSION_CURRENT, "core method: " name " Setter", \
|
||||
setter, NULL, NULL}}
|
||||
|
||||
/*
|
||||
* A [string match] pattern used to determine if a method should be exported.
|
||||
*/
|
||||
|
||||
#define PUBLIC_PATTERN "[a-z]*"
|
||||
|
||||
/*
|
||||
* Forward declarations.
|
||||
*/
|
||||
@@ -238,7 +232,7 @@ TclOOObjectSetFilters(
|
||||
} else {
|
||||
filtersList = ckrealloc(oPtr->filters.list, size);
|
||||
}
|
||||
for (i = 0 ; i < numFilters ; i++) {
|
||||
for (i=0 ; i<numFilters ; i++) {
|
||||
filtersList[i] = filters[i];
|
||||
Tcl_IncrRefCount(filters[i]);
|
||||
}
|
||||
@@ -296,7 +290,7 @@ TclOOClassSetFilters(
|
||||
} else {
|
||||
filtersList = ckrealloc(classPtr->filters.list, size);
|
||||
}
|
||||
for (i = 0 ; i < numFilters ; i++) {
|
||||
for (i=0 ; i<numFilters ; i++) {
|
||||
filtersList[i] = filters[i];
|
||||
Tcl_IncrRefCount(filters[i]);
|
||||
}
|
||||
@@ -358,11 +352,7 @@ TclOOObjectSetMixins(
|
||||
FOREACH(mixinPtr, oPtr->mixins) {
|
||||
if (mixinPtr != oPtr->selfCls) {
|
||||
TclOOAddToInstances(oPtr, mixinPtr);
|
||||
|
||||
/*
|
||||
* For the new copy created by memcpy().
|
||||
*/
|
||||
|
||||
/* For the new copy created by memcpy */
|
||||
AddRef(mixinPtr->thisPtr);
|
||||
}
|
||||
}
|
||||
@@ -413,11 +403,7 @@ TclOOClassSetMixins(
|
||||
memcpy(classPtr->mixins.list, mixins, sizeof(Class *) * numMixins);
|
||||
FOREACH(mixinPtr, classPtr->mixins) {
|
||||
TclOOAddToMixinSubs(classPtr, mixinPtr);
|
||||
|
||||
/*
|
||||
* For the new copy created by memcpy.
|
||||
*/
|
||||
|
||||
/* For the new copy created by memcpy */
|
||||
AddRef(mixinPtr->thisPtr);
|
||||
}
|
||||
}
|
||||
@@ -570,16 +556,15 @@ TclOOUnknownDefinition(
|
||||
* Got one match, and only one match!
|
||||
*/
|
||||
|
||||
Tcl_Obj **newObjv =
|
||||
TclStackAlloc(interp, sizeof(Tcl_Obj*) * (objc - 1));
|
||||
Tcl_Obj **newObjv = TclStackAlloc(interp, sizeof(Tcl_Obj*)*(objc-1));
|
||||
int result;
|
||||
|
||||
newObjv[0] = Tcl_NewStringObj(matchedStr, -1);
|
||||
Tcl_IncrRefCount(newObjv[0]);
|
||||
if (objc > 2) {
|
||||
memcpy(newObjv + 1, objv + 2, sizeof(Tcl_Obj *) * (objc - 2));
|
||||
memcpy(newObjv+1, objv+2, sizeof(Tcl_Obj *) * (objc-2));
|
||||
}
|
||||
result = Tcl_EvalObjv(interp, objc - 1, newObjv, 0);
|
||||
result = Tcl_EvalObjv(interp, objc-1, newObjv, 0);
|
||||
Tcl_DecrRefCount(newObjv[0]);
|
||||
TclStackFree(interp, newObjv);
|
||||
return result;
|
||||
@@ -681,9 +666,7 @@ InitDefineContext(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* framePtrPtr is needed to satisfy GCC 3.3's strict aliasing rules.
|
||||
*/
|
||||
/* framePtrPtr is needed to satisfy GCC 3.3's strict aliasing rules */
|
||||
|
||||
(void) TclPushStackFrame(interp, (Tcl_CallFrame **) framePtrPtr,
|
||||
namespacePtr, FRAME_IS_OO_DEFINE);
|
||||
@@ -854,20 +837,17 @@ MagicDefinitionInvoke(
|
||||
obj2Ptr = Tcl_NewObj();
|
||||
cmd = FindCommand(interp, objv[cmdIndex], nsPtr);
|
||||
if (cmd == NULL) {
|
||||
/*
|
||||
* Punt this case!
|
||||
*/
|
||||
|
||||
/* punt this case! */
|
||||
Tcl_AppendObjToObj(obj2Ptr, objv[cmdIndex]);
|
||||
} else {
|
||||
Tcl_GetCommandFullName(interp, cmd, obj2Ptr);
|
||||
}
|
||||
Tcl_ListObjAppendElement(NULL, objPtr, obj2Ptr);
|
||||
/* TODO: overflow? */
|
||||
Tcl_ListObjReplace(NULL, objPtr, 1, 0, objc - offset, objv + offset);
|
||||
Tcl_ListObjReplace(NULL, objPtr, 1, 0, objc-offset, objv+offset);
|
||||
Tcl_ListObjGetElements(NULL, objPtr, &dummy, &objs);
|
||||
|
||||
result = Tcl_EvalObjv(interp, objc - cmdIndex, objs, TCL_EVAL_INVOKE);
|
||||
result = Tcl_EvalObjv(interp, objc-cmdIndex, objs, TCL_EVAL_INVOKE);
|
||||
if (isRoot) {
|
||||
TclResetRewriteEnsemble(interp, 1);
|
||||
}
|
||||
@@ -1177,8 +1157,6 @@ TclOODefineClassObjCmd(
|
||||
TclOODeleteDescendants(interp, oPtr);
|
||||
oPtr->flags &= ~DONT_DELETE;
|
||||
TclOOReleaseClassContents(interp, oPtr);
|
||||
ckfree(oPtr->classPtr);
|
||||
oPtr->classPtr = NULL;
|
||||
} else if (!wasClass && willBeClass) {
|
||||
TclOOAllocClass(interp, oPtr);
|
||||
}
|
||||
@@ -1297,7 +1275,7 @@ TclOODefineDeleteMethodObjCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
for (i = 1; i < objc; i++) {
|
||||
for (i=1 ; i<objc ; i++) {
|
||||
/*
|
||||
* Delete the method structure from the appropriate hash table.
|
||||
*/
|
||||
@@ -1421,7 +1399,7 @@ TclOODefineExportObjCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
for (i = 1; i < objc; i++) {
|
||||
for (i=1 ; i<objc ; i++) {
|
||||
/*
|
||||
* Exporting is done by adding the PUBLIC_METHOD flag to the method
|
||||
* record. If there is no such method in this object or class (i.e.
|
||||
@@ -1512,14 +1490,14 @@ TclOODefineForwardObjCmd(
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
isPublic = Tcl_StringMatch(TclGetString(objv[1]), PUBLIC_PATTERN)
|
||||
isPublic = Tcl_StringMatch(TclGetString(objv[1]), "[a-z]*")
|
||||
? PUBLIC_METHOD : 0;
|
||||
|
||||
/*
|
||||
* Create the method structure.
|
||||
*/
|
||||
|
||||
prefixObj = Tcl_NewListObj(objc - 2, objv + 2);
|
||||
prefixObj = Tcl_NewListObj(objc-2, objv+2);
|
||||
if (isInstanceForward) {
|
||||
mPtr = TclOONewForwardInstanceMethod(interp, oPtr, isPublic, objv[1],
|
||||
prefixObj);
|
||||
@@ -1570,7 +1548,7 @@ TclOODefineMethodObjCmd(
|
||||
Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
isPublic = Tcl_StringMatch(TclGetString(objv[1]), PUBLIC_PATTERN)
|
||||
isPublic = Tcl_StringMatch(TclGetString(objv[1]), "[a-z]*")
|
||||
? PUBLIC_METHOD : 0;
|
||||
|
||||
/*
|
||||
@@ -1688,7 +1666,7 @@ TclOODefineUnexportObjCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
for (i = 1; i < objc; i++) {
|
||||
for (i=1 ; i<objc ; i++) {
|
||||
/*
|
||||
* Unexporting is done by removing the PUBLIC_METHOD flag from the
|
||||
* method record. If there is no such method in this object or class
|
||||
@@ -1823,7 +1801,7 @@ TclOODefineSlots(
|
||||
Tcl_IncrRefCount(setName);
|
||||
for (slotInfoPtr = slots ; slotInfoPtr->name ; slotInfoPtr++) {
|
||||
Tcl_Object slotObject = Tcl_NewObjectInstance(fPtr->interp,
|
||||
(Tcl_Class) slotCls, slotInfoPtr->name, NULL, -1, NULL, 0);
|
||||
(Tcl_Class) slotCls, slotInfoPtr->name, NULL,-1,NULL,0);
|
||||
|
||||
if (slotObject == NULL) {
|
||||
continue;
|
||||
@@ -1894,7 +1872,7 @@ ClassFilterSet(
|
||||
int filterc;
|
||||
Tcl_Obj **filterv;
|
||||
|
||||
if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) {
|
||||
if (Tcl_ObjectContextSkippedArgs(context)+1 != objc) {
|
||||
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
|
||||
"filterList");
|
||||
return TCL_ERROR;
|
||||
@@ -1977,7 +1955,7 @@ ClassMixinSet(
|
||||
Tcl_Obj **mixinv;
|
||||
Class **mixins;
|
||||
|
||||
if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) {
|
||||
if (Tcl_ObjectContextSkippedArgs(context)+1 != objc) {
|
||||
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
|
||||
"mixinList");
|
||||
return TCL_ERROR;
|
||||
@@ -1998,7 +1976,7 @@ ClassMixinSet(
|
||||
|
||||
mixins = TclStackAlloc(interp, sizeof(Class *) * mixinc);
|
||||
|
||||
for (i = 0; i < mixinc; i++) {
|
||||
for (i=0 ; i<mixinc ; i++) {
|
||||
mixins[i] = GetClassInOuterContext(interp, mixinv[i],
|
||||
"may only mix in classes");
|
||||
if (mixins[i] == NULL) {
|
||||
@@ -2081,7 +2059,7 @@ ClassSuperSet(
|
||||
Tcl_Obj **superv;
|
||||
Class **superclasses, *superPtr;
|
||||
|
||||
if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) {
|
||||
if (Tcl_ObjectContextSkippedArgs(context)+1 != objc) {
|
||||
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
|
||||
"superclassList");
|
||||
return TCL_ERROR;
|
||||
@@ -2128,14 +2106,14 @@ ClassSuperSet(
|
||||
superc = 1;
|
||||
AddRef(superclasses[0]->thisPtr);
|
||||
} else {
|
||||
for (i = 0; i < superc; i++) {
|
||||
for (i=0 ; i<superc ; i++) {
|
||||
superclasses[i] = GetClassInOuterContext(interp, superv[i],
|
||||
"only a class can be a superclass");
|
||||
if (superclasses[i] == NULL) {
|
||||
i--;
|
||||
goto failedAfterAlloc;
|
||||
}
|
||||
for (j = 0; j < i; j++) {
|
||||
for (j=0 ; j<i ; j++) {
|
||||
if (superclasses[j] == superclasses[i]) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"class should only be a direct superclass once",
|
||||
@@ -2155,12 +2133,8 @@ ClassSuperSet(
|
||||
ckfree(superclasses);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Corresponding TclOODecrRefCount() is near the end of this
|
||||
* function.
|
||||
*/
|
||||
|
||||
/* Corresponding TclOODecrRefCount() is near the end of this
|
||||
* function */
|
||||
AddRef(superclasses[i]->thisPtr);
|
||||
}
|
||||
}
|
||||
@@ -2246,7 +2220,7 @@ ClassVarsSet(
|
||||
Tcl_Obj **varv, *variableObj;
|
||||
int i;
|
||||
|
||||
if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) {
|
||||
if (Tcl_ObjectContextSkippedArgs(context)+1 != objc) {
|
||||
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
|
||||
"filterList");
|
||||
return TCL_ERROR;
|
||||
@@ -2265,7 +2239,7 @@ ClassVarsSet(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
for (i = 0; i < varc; i++) {
|
||||
for (i=0 ; i<varc ; i++) {
|
||||
const char *varName = Tcl_GetString(varv[i]);
|
||||
|
||||
if (strstr(varName, "::") != NULL) {
|
||||
@@ -2284,7 +2258,7 @@ ClassVarsSet(
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < varc; i++) {
|
||||
for (i=0 ; i<varc ; i++) {
|
||||
Tcl_IncrRefCount(varv[i]);
|
||||
}
|
||||
FOREACH(variableObj, oPtr->classPtr->variables) {
|
||||
@@ -2309,7 +2283,7 @@ ClassVarsSet(
|
||||
Tcl_HashTable uniqueTable;
|
||||
|
||||
Tcl_InitObjHashTable(&uniqueTable);
|
||||
for (i = n = 0; i < varc; i++) {
|
||||
for (i=n=0 ; i<varc ; i++) {
|
||||
Tcl_CreateHashEntry(&uniqueTable, varv[i], &created);
|
||||
if (created) {
|
||||
oPtr->classPtr->variables.list[n++] = varv[i];
|
||||
@@ -2381,7 +2355,7 @@ ObjFilterSet(
|
||||
int filterc;
|
||||
Tcl_Obj **filterv;
|
||||
|
||||
if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) {
|
||||
if (Tcl_ObjectContextSkippedArgs(context)+1 != objc) {
|
||||
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
|
||||
"filterList");
|
||||
return TCL_ERROR;
|
||||
@@ -2454,7 +2428,7 @@ ObjMixinSet(
|
||||
Class **mixins;
|
||||
int i;
|
||||
|
||||
if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) {
|
||||
if (Tcl_ObjectContextSkippedArgs(context)+1 != objc) {
|
||||
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
|
||||
"mixinList");
|
||||
return TCL_ERROR;
|
||||
@@ -2469,7 +2443,7 @@ ObjMixinSet(
|
||||
|
||||
mixins = TclStackAlloc(interp, sizeof(Class *) * mixinc);
|
||||
|
||||
for (i = 0; i < mixinc; i++) {
|
||||
for (i=0 ; i<mixinc ; i++) {
|
||||
mixins[i] = GetClassInOuterContext(interp, mixinv[i],
|
||||
"may only mix in classes");
|
||||
if (mixins[i] == NULL) {
|
||||
@@ -2533,7 +2507,7 @@ ObjVarsSet(
|
||||
int varc, i;
|
||||
Tcl_Obj **varv, *variableObj;
|
||||
|
||||
if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) {
|
||||
if (Tcl_ObjectContextSkippedArgs(context)+1 != objc) {
|
||||
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
|
||||
"variableList");
|
||||
return TCL_ERROR;
|
||||
@@ -2546,7 +2520,7 @@ ObjVarsSet(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
for (i = 0; i < varc; i++) {
|
||||
for (i=0 ; i<varc ; i++) {
|
||||
const char *varName = Tcl_GetString(varv[i]);
|
||||
|
||||
if (strstr(varName, "::") != NULL) {
|
||||
@@ -2564,7 +2538,7 @@ ObjVarsSet(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < varc; i++) {
|
||||
for (i=0 ; i<varc ; i++) {
|
||||
Tcl_IncrRefCount(varv[i]);
|
||||
}
|
||||
|
||||
@@ -2589,7 +2563,7 @@ ObjVarsSet(
|
||||
Tcl_HashTable uniqueTable;
|
||||
|
||||
Tcl_InitObjHashTable(&uniqueTable);
|
||||
for (i = n = 0; i < varc; i++) {
|
||||
for (i=n=0 ; i<varc ; i++) {
|
||||
Tcl_CreateHashEntry(&uniqueTable, varv[i], &created);
|
||||
if (created) {
|
||||
oPtr->variables.list[n++] = varv[i];
|
||||
|
||||
+6
-8
@@ -114,14 +114,12 @@ TclOOInitInfo(
|
||||
*/
|
||||
|
||||
infoCmd = Tcl_FindCommand(interp, "info", NULL, TCL_GLOBAL_ONLY);
|
||||
if (infoCmd) {
|
||||
Tcl_GetEnsembleMappingDict(NULL, infoCmd, &mapDict);
|
||||
Tcl_DictObjPut(NULL, mapDict, Tcl_NewStringObj("object", -1),
|
||||
Tcl_NewStringObj("::oo::InfoObject", -1));
|
||||
Tcl_DictObjPut(NULL, mapDict, Tcl_NewStringObj("class", -1),
|
||||
Tcl_NewStringObj("::oo::InfoClass", -1));
|
||||
Tcl_SetEnsembleMappingDict(interp, infoCmd, mapDict);
|
||||
}
|
||||
Tcl_GetEnsembleMappingDict(NULL, infoCmd, &mapDict);
|
||||
Tcl_DictObjPut(NULL, mapDict, Tcl_NewStringObj("object", -1),
|
||||
Tcl_NewStringObj("::oo::InfoObject", -1));
|
||||
Tcl_DictObjPut(NULL, mapDict, Tcl_NewStringObj("class", -1),
|
||||
Tcl_NewStringObj("::oo::InfoClass", -1));
|
||||
Tcl_SetEnsembleMappingDict(interp, infoCmd, mapDict);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+10
-8
@@ -189,11 +189,14 @@ typedef struct Object {
|
||||
LIST_STATIC(Tcl_Obj *) variables;
|
||||
} Object;
|
||||
|
||||
#define OBJECT_DESTRUCTING 1 /* Indicates that an object is being or has
|
||||
* been destroyed */
|
||||
#define DESTRUCTOR_CALLED 2 /* Indicates that evaluation of destructor script for the
|
||||
object has began */
|
||||
#define OO_UNUSED_4 4 /* No longer used. */
|
||||
#define OBJECT_DELETED 1 /* Flag to say that an object has been
|
||||
* destroyed. */
|
||||
#define DESTRUCTOR_CALLED 2 /* Flag to say that the destructor has been
|
||||
* called. */
|
||||
#define CLASS_GONE 4 /* Obsolete. Indicates that the class of this
|
||||
* object has been deleted, and so the object
|
||||
* should not attempt to remove itself from its
|
||||
* class. */
|
||||
#define ROOT_OBJECT 0x1000 /* Flag to say that this object is the root of
|
||||
* the class hierarchy and should be treated
|
||||
* specially during teardown. */
|
||||
@@ -494,7 +497,6 @@ MODULE_SCOPE Object * TclNewObjectInstanceCommon(Tcl_Interp *interp,
|
||||
const char *nameStr,
|
||||
const char *nsNameStr);
|
||||
MODULE_SCOPE int TclOODecrRefCount(Object *oPtr);
|
||||
MODULE_SCOPE int TclOOObjectDestroyed(Object *oPtr);
|
||||
MODULE_SCOPE int TclOODefineSlots(Foundation *fPtr);
|
||||
MODULE_SCOPE void TclOODeleteChain(CallChain *callPtr);
|
||||
MODULE_SCOPE void TclOODeleteChainCache(Tcl_HashTable *tablePtr);
|
||||
@@ -561,7 +563,7 @@ MODULE_SCOPE void TclOOSetupVariableResolver(Tcl_Namespace *nsPtr);
|
||||
#define FOREACH(var,ary) \
|
||||
for(i=0 ; i<(ary).num; i++) if ((ary).list[i] == NULL) { \
|
||||
continue; \
|
||||
} else if (var = (ary).list[i], 1)
|
||||
} else if (var = (ary).list[i], 1)
|
||||
|
||||
/*
|
||||
* Convenience macros for iterating through hash tables. FOREACH_HASH_DECLS
|
||||
@@ -588,7 +590,7 @@ MODULE_SCOPE void TclOOSetupVariableResolver(Tcl_Namespace *nsPtr);
|
||||
#undef DUPLICATE /* prevent possible conflict with definition in WINAPI nb30.h */
|
||||
#define DUPLICATE(target,source,type) \
|
||||
do { \
|
||||
size_t len = sizeof(type) * ((target).num=(source).num);\
|
||||
register unsigned len = sizeof(type) * ((target).num=(source).num);\
|
||||
if (len != 0) { \
|
||||
memcpy(((target).list=(type*)ckalloc(len)), (source).list, len); \
|
||||
} else { \
|
||||
|
||||
@@ -671,13 +671,11 @@ InvokeProcedureMethod(
|
||||
* call frame's lifetime). */
|
||||
|
||||
/*
|
||||
* If the object namespace (or interpreter) were deleted, we just skip to
|
||||
* the next thing in the chain.
|
||||
* If the interpreter was deleted, we just skip to the next thing in the
|
||||
* chain.
|
||||
*/
|
||||
|
||||
if (TclOOObjectDestroyed(((CallContext *)context)->oPtr) ||
|
||||
Tcl_InterpDeleted(interp)
|
||||
) {
|
||||
if (Tcl_InterpDeleted(interp)) {
|
||||
return TclNRObjectContextInvokeNext(interp, context, objc, objv,
|
||||
Tcl_ObjectContextSkippedArgs(context));
|
||||
}
|
||||
@@ -972,8 +970,10 @@ ProcedureMethodVarResolver(
|
||||
* Must not retain reference to resolved information. [Bug 3105999]
|
||||
*/
|
||||
|
||||
rPtr->deleteProc(rPtr);
|
||||
return (*varPtr ? TCL_OK : TCL_CONTINUE);
|
||||
if (rPtr != NULL) {
|
||||
rPtr->deleteProc(rPtr);
|
||||
}
|
||||
return (*varPtr? TCL_OK : TCL_CONTINUE);
|
||||
}
|
||||
|
||||
static Tcl_Var
|
||||
|
||||
+15
-17
@@ -2476,7 +2476,7 @@ Tcl_SetIntObj(
|
||||
* Success.
|
||||
*
|
||||
* TCL_ERROR
|
||||
*
|
||||
*
|
||||
* An error occurred during conversion or the integral value can not
|
||||
* be represented as an integer (it might be too large). An error
|
||||
* message is left in the interpreter's result if 'interp' is not
|
||||
@@ -2804,14 +2804,13 @@ Tcl_GetLongFromObj(
|
||||
mp_int big;
|
||||
|
||||
UNPACK_BIGNUM(objPtr, big);
|
||||
if ((size_t) big.used <= (CHAR_BIT * sizeof(long) + MP_DIGIT_BIT - 1)
|
||||
/ MP_DIGIT_BIT) {
|
||||
unsigned long value = 0;
|
||||
size_t numBytes;
|
||||
if ((size_t) big.used <= (CHAR_BIT * sizeof(long) + DIGIT_BIT - 1)
|
||||
/ DIGIT_BIT) {
|
||||
unsigned long value = 0, numBytes = sizeof(long);
|
||||
long scratch;
|
||||
unsigned char *bytes = (unsigned char *) &scratch;
|
||||
|
||||
if (mp_to_ubin(&big, bytes, sizeof(long), &numBytes) == MP_OKAY) {
|
||||
if (mp_to_unsigned_bin_n(&big, bytes, &numBytes) == MP_OKAY) {
|
||||
while (numBytes-- > 0) {
|
||||
value = (value << CHAR_BIT) | *bytes++;
|
||||
}
|
||||
@@ -3105,13 +3104,13 @@ Tcl_GetWideIntFromObj(
|
||||
|
||||
UNPACK_BIGNUM(objPtr, big);
|
||||
if ((size_t) big.used <= (CHAR_BIT * sizeof(Tcl_WideInt)
|
||||
+ MP_DIGIT_BIT - 1) / MP_DIGIT_BIT) {
|
||||
+ DIGIT_BIT - 1) / DIGIT_BIT) {
|
||||
Tcl_WideUInt value = 0;
|
||||
size_t numBytes;
|
||||
unsigned long numBytes = sizeof(Tcl_WideInt);
|
||||
Tcl_WideInt scratch;
|
||||
unsigned char *bytes = (unsigned char *) &scratch;
|
||||
|
||||
if (mp_to_ubin(&big, bytes, sizeof(Tcl_WideInt), &numBytes) == MP_OKAY) {
|
||||
if (mp_to_unsigned_bin_n(&big, bytes, &numBytes) == MP_OKAY) {
|
||||
while (numBytes-- > 0) {
|
||||
value = (value << CHAR_BIT) | *bytes++;
|
||||
}
|
||||
@@ -3270,7 +3269,7 @@ UpdateStringOfBignum(
|
||||
Tcl_Panic("UpdateStringOfBignum: string length limit exceeded");
|
||||
}
|
||||
stringVal = ckalloc(size);
|
||||
status = mp_to_radix(&bignumVal, stringVal, size, NULL, 10);
|
||||
status = mp_toradix_n(&bignumVal, stringVal, 10, size);
|
||||
if (status != MP_OKAY) {
|
||||
Tcl_Panic("conversion failure in UpdateStringOfBignum");
|
||||
}
|
||||
@@ -3524,13 +3523,12 @@ Tcl_SetBignumObj(
|
||||
Tcl_Panic("%s called with shared object", "Tcl_SetBignumObj");
|
||||
}
|
||||
if ((size_t) bignumValue->used
|
||||
<= (CHAR_BIT * sizeof(long) + MP_DIGIT_BIT - 1) / MP_DIGIT_BIT) {
|
||||
unsigned long value = 0;
|
||||
size_t numBytes;
|
||||
<= (CHAR_BIT * sizeof(long) + DIGIT_BIT - 1) / DIGIT_BIT) {
|
||||
unsigned long value = 0, numBytes = sizeof(long);
|
||||
long scratch;
|
||||
unsigned char *bytes = (unsigned char *) &scratch;
|
||||
|
||||
if (mp_to_ubin(bignumValue, bytes, sizeof(long), &numBytes) != MP_OKAY) {
|
||||
if (mp_to_unsigned_bin_n(bignumValue, bytes, &numBytes) != MP_OKAY) {
|
||||
goto tooLargeForLong;
|
||||
}
|
||||
while (numBytes-- > 0) {
|
||||
@@ -3550,13 +3548,13 @@ Tcl_SetBignumObj(
|
||||
tooLargeForLong:
|
||||
#ifndef TCL_WIDE_INT_IS_LONG
|
||||
if ((size_t) bignumValue->used
|
||||
<= (CHAR_BIT * sizeof(Tcl_WideInt) + MP_DIGIT_BIT - 1) / MP_DIGIT_BIT) {
|
||||
<= (CHAR_BIT * sizeof(Tcl_WideInt) + DIGIT_BIT - 1) / DIGIT_BIT) {
|
||||
Tcl_WideUInt value = 0;
|
||||
size_t numBytes;
|
||||
unsigned long numBytes = sizeof(Tcl_WideInt);
|
||||
Tcl_WideInt scratch;
|
||||
unsigned char *bytes = (unsigned char *)&scratch;
|
||||
|
||||
if (mp_to_ubin(bignumValue, bytes, sizeof(Tcl_WideInt), &numBytes) != MP_OKAY) {
|
||||
if (mp_to_unsigned_bin_n(bignumValue, bytes, &numBytes) != MP_OKAY) {
|
||||
goto tooLargeForWide;
|
||||
}
|
||||
while (numBytes-- > 0) {
|
||||
|
||||
+6
-6
@@ -613,7 +613,7 @@ Tcl_ParseCommand(
|
||||
|
||||
int
|
||||
TclIsSpaceProc(
|
||||
int byte)
|
||||
char byte)
|
||||
{
|
||||
return CHAR_TYPE(byte) & (TYPE_SPACE) || byte == '\n';
|
||||
}
|
||||
@@ -642,7 +642,7 @@ TclIsSpaceProc(
|
||||
|
||||
int
|
||||
TclIsBareword(
|
||||
int byte)
|
||||
char byte)
|
||||
{
|
||||
if (byte < '0' || byte > 'z') {
|
||||
return 0;
|
||||
@@ -844,7 +844,7 @@ TclParseBackslash(
|
||||
Tcl_UniChar unichar = 0;
|
||||
int result;
|
||||
int count;
|
||||
char buf[TCL_UTF_MAX] = "";
|
||||
char buf[TCL_UTF_MAX];
|
||||
|
||||
if (numBytes == 0) {
|
||||
if (readPtr != NULL) {
|
||||
@@ -993,8 +993,8 @@ TclParseBackslash(
|
||||
}
|
||||
count = Tcl_UniCharToUtf(result, dst);
|
||||
#if TCL_UTF_MAX > 3
|
||||
if ((result >= 0xD800) && (count < 3)) {
|
||||
count += Tcl_UniCharToUtf(-1, dst + count);
|
||||
if (!count) {
|
||||
count = Tcl_UniCharToUtf(-1, dst);
|
||||
}
|
||||
#endif
|
||||
return count;
|
||||
@@ -2217,7 +2217,7 @@ TclSubstTokens(
|
||||
Tcl_Obj *appendObj = NULL;
|
||||
const char *append = NULL;
|
||||
int appendByteLength = 0;
|
||||
char utfCharBytes[TCL_UTF_MAX] = "";
|
||||
char utfCharBytes[TCL_UTF_MAX];
|
||||
|
||||
switch (tokenPtr->type) {
|
||||
case TCL_TOKEN_TEXT:
|
||||
|
||||
+1
-1
@@ -12,6 +12,6 @@
|
||||
#define TYPE_CLOSE_BRACK 0x20
|
||||
#define TYPE_BRACE 0x40
|
||||
|
||||
#define CHAR_TYPE(c) (tclCharTypeTable+128)[(unsigned char)(c)]
|
||||
#define CHAR_TYPE(c) (tclCharTypeTable+128)[(int)(c)]
|
||||
|
||||
MODULE_SCOPE const char tclCharTypeTable[];
|
||||
|
||||
+36
-43
@@ -829,7 +829,7 @@ Tcl_FSJoinPath(
|
||||
* reference count. */
|
||||
int elements) /* Number of elements to use (-1 = all) */
|
||||
{
|
||||
Tcl_Obj *res;
|
||||
Tcl_Obj *copy, *res;
|
||||
int objc;
|
||||
Tcl_Obj **objv;
|
||||
|
||||
@@ -838,17 +838,17 @@ Tcl_FSJoinPath(
|
||||
}
|
||||
|
||||
elements = ((elements >= 0) && (elements <= objc)) ? elements : objc;
|
||||
copy = TclListObjCopy(NULL, listObj);
|
||||
Tcl_ListObjGetElements(NULL, listObj, &objc, &objv);
|
||||
res = TclJoinPath(elements, objv, 0);
|
||||
res = TclJoinPath(elements, objv);
|
||||
Tcl_DecrRefCount(copy);
|
||||
return res;
|
||||
}
|
||||
|
||||
Tcl_Obj *
|
||||
TclJoinPath(
|
||||
int elements, /* Number of elements to use (-1 = all) */
|
||||
Tcl_Obj * const objv[], /* Path elements to join */
|
||||
int forceRelative) /* If non-zero, assume all more paths are
|
||||
* relative (e. g. simple normalization) */
|
||||
int elements,
|
||||
Tcl_Obj * const objv[])
|
||||
{
|
||||
Tcl_Obj *res = NULL;
|
||||
int i;
|
||||
@@ -879,13 +879,10 @@ TclJoinPath(
|
||||
|
||||
if ((elt->typePtr == &tclFsPathType)
|
||||
&& !((elt->bytes != NULL) && (elt->bytes[0] == '\0'))
|
||||
&& TclGetPathType(elt, NULL, NULL, NULL) == TCL_PATH_ABSOLUTE) {
|
||||
Tcl_Obj *tailObj = objv[1];
|
||||
Tcl_PathType type;
|
||||
&& TclGetPathType(elt, NULL, NULL, NULL) == TCL_PATH_ABSOLUTE) {
|
||||
Tcl_Obj *tailObj = objv[1];
|
||||
Tcl_PathType type = TclGetPathType(tailObj, NULL, NULL, NULL);
|
||||
|
||||
/* if forceRelative - second path is relative */
|
||||
type = forceRelative ? TCL_PATH_RELATIVE :
|
||||
TclGetPathType(tailObj, NULL, NULL, NULL);
|
||||
if (type == TCL_PATH_RELATIVE) {
|
||||
const char *str;
|
||||
int len;
|
||||
@@ -963,9 +960,7 @@ TclJoinPath(
|
||||
|
||||
strElt = Tcl_GetStringFromObj(elt, &strEltLen);
|
||||
driveNameLength = 0;
|
||||
/* if forceRelative - all paths excepting first one are relative */
|
||||
type = (forceRelative && (i > 0)) ? TCL_PATH_RELATIVE :
|
||||
TclGetPathType(elt, &fsPtr, &driveNameLength, &driveName);
|
||||
type = TclGetPathType(elt, &fsPtr, &driveNameLength, &driveName);
|
||||
if (type != TCL_PATH_RELATIVE) {
|
||||
/*
|
||||
* Zero out the current result.
|
||||
@@ -1364,7 +1359,6 @@ TclNewFSPathObj(
|
||||
count = 0;
|
||||
state = 1;
|
||||
}
|
||||
break;
|
||||
case 1: /* Scanning for next dirsep */
|
||||
switch (*p) {
|
||||
case '/':
|
||||
@@ -2148,7 +2142,6 @@ Tcl_FSGetInternalRep(
|
||||
nativePathPtr = proc(pathPtr);
|
||||
srcFsPathPtr = PATHOBJ(pathPtr);
|
||||
srcFsPathPtr->nativePathPtr = nativePathPtr;
|
||||
srcFsPathPtr->filesystemEpoch = TclFSEpoch();
|
||||
}
|
||||
|
||||
return srcFsPathPtr->nativePathPtr;
|
||||
@@ -2366,29 +2359,36 @@ SetFsPathFromAny(
|
||||
* Handle tilde substitutions, if needed.
|
||||
*/
|
||||
|
||||
if (len && name[0] == '~') {
|
||||
if (name[0] == '~') {
|
||||
Tcl_DString temp;
|
||||
int split;
|
||||
char separator = '/';
|
||||
|
||||
/*
|
||||
* We have multiple cases '~/foo/bar...', '~user/foo/bar...', etc.
|
||||
* split becomes value 1 for '~/...' as well as for '~'.
|
||||
*/
|
||||
split = FindSplitPos(name, separator);
|
||||
if (split != len) {
|
||||
/*
|
||||
* We have multiple pieces '~user/foo/bar...'
|
||||
*/
|
||||
|
||||
name[split] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* Do some tilde substitution.
|
||||
*/
|
||||
|
||||
if (split == 1) {
|
||||
if (name[1] == '\0') {
|
||||
/*
|
||||
* We have just '~' (or '~/...')
|
||||
* We have just '~'
|
||||
*/
|
||||
|
||||
const char *dir;
|
||||
Tcl_DString dirString;
|
||||
|
||||
if (split != len) {
|
||||
name[split] = separator;
|
||||
}
|
||||
|
||||
dir = TclGetEnv("HOME", &dirString);
|
||||
if (dir == NULL) {
|
||||
if (interp) {
|
||||
@@ -2408,26 +2408,23 @@ SetFsPathFromAny(
|
||||
* We have a user name '~user'
|
||||
*/
|
||||
|
||||
const char *expandedUser;
|
||||
Tcl_DString userName;
|
||||
|
||||
Tcl_DStringInit(&userName);
|
||||
Tcl_DStringAppend(&userName, name+1, split-1);
|
||||
expandedUser = Tcl_DStringValue(&userName);
|
||||
|
||||
Tcl_DStringInit(&temp);
|
||||
if (TclpGetUserHome(expandedUser, &temp) == NULL) {
|
||||
if (TclpGetUserHome(name+1, &temp) == NULL) {
|
||||
if (interp != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"user \"%s\" doesn't exist", expandedUser));
|
||||
"user \"%s\" doesn't exist", name+1));
|
||||
Tcl_SetErrorCode(interp, "TCL", "VALUE", "PATH", "NOUSER",
|
||||
NULL);
|
||||
}
|
||||
Tcl_DStringFree(&userName);
|
||||
Tcl_DStringFree(&temp);
|
||||
if (split != len) {
|
||||
name[split] = separator;
|
||||
}
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_DStringFree(&userName);
|
||||
if (split != len) {
|
||||
name[split] = separator;
|
||||
}
|
||||
}
|
||||
|
||||
transPtr = TclDStringToObj(&temp);
|
||||
@@ -2464,17 +2461,13 @@ SetFsPathFromAny(
|
||||
|
||||
pair[0] = transPtr;
|
||||
pair[1] = Tcl_NewStringObj(name+split+1, -1);
|
||||
transPtr = TclJoinPath(2, pair, 1);
|
||||
if (transPtr != pair[0]) {
|
||||
Tcl_DecrRefCount(pair[0]);
|
||||
}
|
||||
if (transPtr != pair[1]) {
|
||||
Tcl_DecrRefCount(pair[1]);
|
||||
}
|
||||
transPtr = TclJoinPath(2, pair);
|
||||
Tcl_DecrRefCount(pair[0]);
|
||||
Tcl_DecrRefCount(pair[1]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
transPtr = TclJoinPath(1, &pathPtr, 1);
|
||||
transPtr = TclJoinPath(1, &pathPtr);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -450,7 +450,7 @@ TclCreatePipeline(
|
||||
* at *inPipePtr. NULL means command specified
|
||||
* its own input source. */
|
||||
TclFile *outPipePtr, /* If non-NULL, output to the pipeline goes to
|
||||
* a pipe, unless overridden by redirection in
|
||||
* a pipe, unless overriden by redirection in
|
||||
* the command. The file id with which to read
|
||||
* frome this pipe is stored at *outPipePtr.
|
||||
* NULL means command specified its own output
|
||||
|
||||
+21
-19
@@ -40,7 +40,10 @@ typedef struct PkgAvail {
|
||||
*/
|
||||
|
||||
typedef struct Package {
|
||||
Tcl_Obj *version;
|
||||
char *version; /* Version that has been supplied in this
|
||||
* interpreter via "package provide"
|
||||
* (malloc'ed). NULL means the package doesn't
|
||||
* exist in this interpreter yet. */
|
||||
PkgAvail *availPtr; /* First in list of all available versions of
|
||||
* this package. */
|
||||
const void *clientData; /* Client data. */
|
||||
@@ -147,13 +150,12 @@ Tcl_PkgProvideEx(
|
||||
|
||||
pkgPtr = FindPackage(interp, name);
|
||||
if (pkgPtr->version == NULL) {
|
||||
pkgPtr->version = Tcl_NewStringObj(version, -1);
|
||||
Tcl_IncrRefCount(pkgPtr->version);
|
||||
DupString(pkgPtr->version, version);
|
||||
pkgPtr->clientData = clientData;
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
if (CheckVersionAndConvert(interp, Tcl_GetString(pkgPtr->version), &pvi,
|
||||
if (CheckVersionAndConvert(interp, pkgPtr->version, &pvi,
|
||||
NULL) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
} else if (CheckVersionAndConvert(interp, version, &vi, NULL) != TCL_OK) {
|
||||
@@ -173,7 +175,7 @@ Tcl_PkgProvideEx(
|
||||
}
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"conflicting versions provided for package \"%s\": %s, then %s",
|
||||
name, Tcl_GetString(pkgPtr->version), version));
|
||||
name, pkgPtr->version, version));
|
||||
Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "VERSIONCONFLICT", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -316,7 +318,7 @@ Tcl_PkgRequireEx(
|
||||
|
||||
if (version == NULL) {
|
||||
if (Tcl_PkgRequireProc(interp, name, 0, NULL, clientDataPtr) == TCL_OK) {
|
||||
result = Tcl_GetString(Tcl_GetObjResult(interp));
|
||||
result = Tcl_GetStringResult(interp);
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
} else {
|
||||
@@ -330,7 +332,7 @@ Tcl_PkgRequireEx(
|
||||
}
|
||||
Tcl_IncrRefCount(ov);
|
||||
if (Tcl_PkgRequireProc(interp, name, 1, &ov, clientDataPtr) == TCL_OK) {
|
||||
result = Tcl_GetString(Tcl_GetObjResult(interp));
|
||||
result = Tcl_GetStringResult(interp);
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
TclDecrRefCount(ov);
|
||||
@@ -472,8 +474,7 @@ PkgRequireCoreFinal(ClientData data[], Tcl_Interp *interp, int result) {
|
||||
*/
|
||||
|
||||
if (reqc != 0) {
|
||||
CheckVersionAndConvert(interp, Tcl_GetString(reqPtr->pkgPtr->version),
|
||||
&pkgVersionI, NULL);
|
||||
CheckVersionAndConvert(interp, reqPtr->pkgPtr->version, &pkgVersionI, NULL);
|
||||
satisfies = SomeRequirementSatisfied(pkgVersionI, reqc, reqv);
|
||||
|
||||
ckfree(pkgVersionI);
|
||||
@@ -481,7 +482,7 @@ PkgRequireCoreFinal(ClientData data[], Tcl_Interp *interp, int result) {
|
||||
if (!satisfies) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"version conflict for package \"%s\": have %s, need",
|
||||
name, Tcl_GetString(reqPtr->pkgPtr->version)));
|
||||
name, reqPtr->pkgPtr->version));
|
||||
Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "VERSIONCONFLICT",
|
||||
NULL);
|
||||
AddRequirementsToResult(interp, reqc, reqv);
|
||||
@@ -494,7 +495,7 @@ PkgRequireCoreFinal(ClientData data[], Tcl_Interp *interp, int result) {
|
||||
|
||||
*ptr = reqPtr->pkgPtr->clientData;
|
||||
}
|
||||
Tcl_SetObjResult(interp, reqPtr->pkgPtr->version);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(reqPtr->pkgPtr->version, -1));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -510,7 +511,7 @@ SelectPackage(ClientData data[], Tcl_Interp *interp, int result) {
|
||||
PkgAvail *availPtr, *bestPtr, *bestStablePtr;
|
||||
char *availVersion, *bestVersion, *bestStableVersion;
|
||||
/* Internal rep. of versions */
|
||||
int availStable, satisfies;
|
||||
int availStable, satisfies;
|
||||
Require *reqPtr = data[0];
|
||||
int reqc = PTR2INT(data[1]);
|
||||
Tcl_Obj **const reqv = data[2];
|
||||
@@ -693,8 +694,8 @@ SelectPackageFinal(ClientData data[], Tcl_Interp *interp, int result) {
|
||||
} else {
|
||||
char *pvi, *vi;
|
||||
|
||||
if (TCL_OK != CheckVersionAndConvert(interp,
|
||||
Tcl_GetString(reqPtr->pkgPtr->version), &pvi, NULL)) {
|
||||
if (CheckVersionAndConvert(interp, reqPtr->pkgPtr->version, &pvi,
|
||||
NULL) != TCL_OK) {
|
||||
result = TCL_ERROR;
|
||||
} else if (CheckVersionAndConvert(interp,
|
||||
versionToProvide, &vi, NULL) != TCL_OK) {
|
||||
@@ -711,7 +712,7 @@ SelectPackageFinal(ClientData data[], Tcl_Interp *interp, int result) {
|
||||
"attempt to provide package %s %s failed:"
|
||||
" package %s %s provided instead",
|
||||
name, versionToProvide,
|
||||
name, Tcl_GetString(reqPtr->pkgPtr->version)));
|
||||
name, reqPtr->pkgPtr->version));
|
||||
Tcl_SetErrorCode(interp, "TCL", "PACKAGE",
|
||||
"WRONGPROVIDE", NULL);
|
||||
}
|
||||
@@ -749,7 +750,7 @@ SelectPackageFinal(ClientData data[], Tcl_Interp *interp, int result) {
|
||||
*/
|
||||
|
||||
if (reqPtr->pkgPtr->version != NULL) {
|
||||
Tcl_DecrRefCount(reqPtr->pkgPtr->version);
|
||||
ckfree(reqPtr->pkgPtr->version);
|
||||
reqPtr->pkgPtr->version = NULL;
|
||||
}
|
||||
reqPtr->pkgPtr->clientData = NULL;
|
||||
@@ -925,7 +926,7 @@ TclNRPackageObjCmd(
|
||||
pkgPtr = Tcl_GetHashValue(hPtr);
|
||||
Tcl_DeleteHashEntry(hPtr);
|
||||
if (pkgPtr->version != NULL) {
|
||||
Tcl_DecrRefCount(pkgPtr->version);
|
||||
ckfree(pkgPtr->version);
|
||||
}
|
||||
while (pkgPtr->availPtr != NULL) {
|
||||
availPtr = pkgPtr->availPtr;
|
||||
@@ -1083,7 +1084,8 @@ TclNRPackageObjCmd(
|
||||
if (hPtr != NULL) {
|
||||
pkgPtr = Tcl_GetHashValue(hPtr);
|
||||
if (pkgPtr->version != NULL) {
|
||||
Tcl_SetObjResult(interp, pkgPtr->version);
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewStringObj(pkgPtr->version, -1));
|
||||
}
|
||||
}
|
||||
return TCL_OK;
|
||||
@@ -1376,7 +1378,7 @@ TclFreePackageInfo(
|
||||
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
|
||||
pkgPtr = Tcl_GetHashValue(hPtr);
|
||||
if (pkgPtr->version != NULL) {
|
||||
Tcl_DecrRefCount(pkgPtr->version);
|
||||
ckfree(pkgPtr->version);
|
||||
}
|
||||
while (pkgPtr->availPtr != NULL) {
|
||||
availPtr = pkgPtr->availPtr;
|
||||
|
||||
@@ -39,8 +39,5 @@
|
||||
# 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 */
|
||||
|
||||
+35
-34
@@ -371,9 +371,11 @@ TclCreateProc(
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
|
||||
register Proc *procPtr;
|
||||
int i, result, numArgs;
|
||||
int i, result, numArgs, plen;
|
||||
const char *bytes, *argname, *argnamei;
|
||||
char argnamelast;
|
||||
register CompiledLocal *localPtr = NULL;
|
||||
Tcl_Obj **argArray;
|
||||
Tcl_Obj *defPtr, *errorObj, **argArray;
|
||||
int precompiled = 0;
|
||||
|
||||
if (bodyPtr->typePtr == &tclProcBodyType) {
|
||||
@@ -410,7 +412,6 @@ TclCreateProc(
|
||||
*/
|
||||
|
||||
if (Tcl_IsShared(bodyPtr)) {
|
||||
const char *bytes;
|
||||
int length;
|
||||
Tcl_Obj *sharedBodyPtr = bodyPtr;
|
||||
|
||||
@@ -473,8 +474,7 @@ TclCreateProc(
|
||||
}
|
||||
|
||||
for (i = 0; i < numArgs; i++) {
|
||||
const char *argname, *argnamei, *argnamelast;
|
||||
int fieldCount, nameLength;
|
||||
int fieldCount, nameLength, valueLength;
|
||||
Tcl_Obj **fieldValues;
|
||||
|
||||
/*
|
||||
@@ -487,7 +487,7 @@ TclCreateProc(
|
||||
goto procError;
|
||||
}
|
||||
if (fieldCount > 2) {
|
||||
Tcl_Obj *errorObj = Tcl_NewStringObj(
|
||||
errorObj = Tcl_NewStringObj(
|
||||
"too many fields in argument specifier \"", -1);
|
||||
Tcl_AppendObjToObj(errorObj, argArray[i]);
|
||||
Tcl_AppendToObj(errorObj, "\"", -1);
|
||||
@@ -504,17 +504,24 @@ TclCreateProc(
|
||||
goto procError;
|
||||
}
|
||||
|
||||
argname = Tcl_GetStringFromObj(fieldValues[0], &nameLength);
|
||||
argname = Tcl_GetStringFromObj(fieldValues[0], &plen);
|
||||
nameLength = Tcl_NumUtfChars(argname, plen);
|
||||
if (fieldCount == 2) {
|
||||
const char * value = TclGetString(fieldValues[1]);
|
||||
valueLength = Tcl_NumUtfChars(value, fieldValues[1]->length);
|
||||
} else {
|
||||
valueLength = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check that the formal parameter name is a scalar.
|
||||
*/
|
||||
|
||||
argnamei = argname;
|
||||
argnamelast = Tcl_UtfPrev(argname + nameLength, argname);
|
||||
while (argnamei < argnamelast) {
|
||||
if (*argnamei == '(') {
|
||||
if (*argnamelast == ')') { /* We have an array element. */
|
||||
argnamelast = argname[plen-1];
|
||||
while (plen--) {
|
||||
if (argnamei[0] == '(') {
|
||||
if (argnamelast == ')') { /* We have an array element. */
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"formal parameter \"%s\" is an array element",
|
||||
Tcl_GetString(fieldValues[0])));
|
||||
@@ -522,9 +529,8 @@ TclCreateProc(
|
||||
"FORMALARGUMENTFORMAT", NULL);
|
||||
goto procError;
|
||||
}
|
||||
} else if (*argnamei == ':' && *(argnamei+1) == ':') {
|
||||
Tcl_Obj *errorObj = Tcl_NewStringObj(
|
||||
"formal parameter \"", -1);
|
||||
} else if ((argnamei[0] == ':') && (argnamei[1] == ':')) {
|
||||
errorObj = Tcl_NewStringObj("formal parameter \"", -1);
|
||||
Tcl_AppendObjToObj(errorObj, fieldValues[0]);
|
||||
Tcl_AppendToObj(errorObj, "\" is not a simple name", -1);
|
||||
Tcl_SetObjResult(interp, errorObj);
|
||||
@@ -548,7 +554,7 @@ TclCreateProc(
|
||||
*/
|
||||
|
||||
if ((localPtr->nameLength != nameLength)
|
||||
|| (memcmp(localPtr->name, argname, nameLength) != 0)
|
||||
|| (Tcl_UtfNcmp(localPtr->name, argname, nameLength))
|
||||
|| (localPtr->frameIndex != i)
|
||||
|| !(localPtr->flags & VAR_ARGUMENT)
|
||||
|| (localPtr->defValuePtr == NULL && fieldCount == 2)
|
||||
@@ -566,17 +572,14 @@ TclCreateProc(
|
||||
*/
|
||||
|
||||
if (localPtr->defValuePtr != NULL) {
|
||||
int tmpLength, valueLength;
|
||||
int tmpLength;
|
||||
const char *tmpPtr = TclGetStringFromObj(localPtr->defValuePtr,
|
||||
&tmpLength);
|
||||
const char *value = TclGetStringFromObj(fieldValues[1],
|
||||
&valueLength);
|
||||
|
||||
if ((valueLength != tmpLength)
|
||||
|| memcmp(value, tmpPtr, tmpLength) != 0
|
||||
) {
|
||||
Tcl_Obj *errorObj = Tcl_ObjPrintf(
|
||||
"procedure \"%s\": formal parameter \"", procName);
|
||||
if ((valueLength != tmpLength) ||
|
||||
Tcl_UtfNcmp(Tcl_GetString(fieldValues[1]), tmpPtr, tmpLength)) {
|
||||
errorObj = Tcl_ObjPrintf(
|
||||
"procedure \"%s\": formal parameter \"" ,procName);
|
||||
Tcl_AppendObjToObj(errorObj, fieldValues[0]);
|
||||
Tcl_AppendToObj(errorObj, "\" has "
|
||||
"default value inconsistent with precompiled body", -1);
|
||||
@@ -623,7 +626,7 @@ TclCreateProc(
|
||||
if ((i == numArgs - 1)
|
||||
&& (localPtr->nameLength == 4)
|
||||
&& (localPtr->name[0] == 'a')
|
||||
&& (memcmp(localPtr->name, "args", 4) == 0)) {
|
||||
&& (strcmp(localPtr->name, "args") == 0)) {
|
||||
localPtr->flags |= VAR_IS_ARGS;
|
||||
}
|
||||
}
|
||||
@@ -641,8 +644,9 @@ TclCreateProc(
|
||||
localPtr = procPtr->firstLocalPtr;
|
||||
procPtr->firstLocalPtr = localPtr->nextPtr;
|
||||
|
||||
if (localPtr->defValuePtr != NULL) {
|
||||
Tcl_DecrRefCount(localPtr->defValuePtr);
|
||||
defPtr = localPtr->defValuePtr;
|
||||
if (defPtr != NULL) {
|
||||
Tcl_DecrRefCount(defPtr);
|
||||
}
|
||||
|
||||
ckfree(localPtr);
|
||||
@@ -695,22 +699,17 @@ TclGetFrame(
|
||||
result = 1;
|
||||
curLevel = iPtr->varFramePtr->level;
|
||||
if (*name== '#') {
|
||||
if (Tcl_GetInt(NULL, name+1, &level) != TCL_OK || level < 0) {
|
||||
if (Tcl_GetInt(interp, name+1, &level) != TCL_OK || level < 0) {
|
||||
goto levelError;
|
||||
}
|
||||
} else if (isdigit(UCHAR(*name))) { /* INTL: digit */
|
||||
if (Tcl_GetInt(NULL, name, &level) != TCL_OK) {
|
||||
if (Tcl_GetInt(interp, name, &level) != TCL_OK) {
|
||||
goto levelError;
|
||||
}
|
||||
level = curLevel - level;
|
||||
} else {
|
||||
/*
|
||||
* (historical, TODO) If name does not contain a level (#0 or 1),
|
||||
* TclGetFrame and Tcl_UpVar2 uses current level - 1
|
||||
*/
|
||||
level = curLevel - 1;
|
||||
result = 0;
|
||||
name = "1"; /* be more consistent with TclObjGetFrame (error at top - 1) */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1840,7 +1839,9 @@ InterpProcNR2(
|
||||
Tcl_SetErrorCode(interp, "TCL", "RESULT", "UNEXPECTED", NULL);
|
||||
result = TCL_ERROR;
|
||||
|
||||
/* FALLTHRU */
|
||||
/*
|
||||
* Fall through to the TCL_ERROR handling code.
|
||||
*/
|
||||
|
||||
case TCL_ERROR:
|
||||
/*
|
||||
|
||||
+2
-2
@@ -726,12 +726,12 @@ TclRegError(
|
||||
const char *p;
|
||||
|
||||
Tcl_ResetResult(interp);
|
||||
n = TclReError(status, buf, sizeof(buf));
|
||||
n = TclReError(status, NULL, buf, sizeof(buf));
|
||||
p = (n > sizeof(buf)) ? "..." : "";
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s%s%s", msg, buf, p));
|
||||
|
||||
sprintf(cbuf, "%d", status);
|
||||
(void) TclReError(REG_ITOA, cbuf, sizeof(cbuf));
|
||||
(void) TclReError(REG_ITOA, NULL, cbuf, sizeof(cbuf));
|
||||
Tcl_SetErrorCode(interp, "REGEXP", cbuf, buf, NULL);
|
||||
}
|
||||
|
||||
|
||||
+18
-19
@@ -134,7 +134,7 @@ BuildCharSet(
|
||||
* as well as the dash.
|
||||
*/
|
||||
|
||||
if (*format == ']' || !cset->ranges) {
|
||||
if (*format == ']') {
|
||||
cset->chars[cset->nchars++] = start;
|
||||
cset->chars[cset->nchars++] = ch;
|
||||
} else {
|
||||
@@ -260,7 +260,7 @@ ValidateFormat(
|
||||
Tcl_UniChar ch = 0;
|
||||
int objIndex, xpgSize, nspace = numVars;
|
||||
int *nassign = TclStackAlloc(interp, nspace * sizeof(int));
|
||||
char buf[TCL_UTF_MAX+1] = "";
|
||||
char buf[TCL_UTF_MAX+1];
|
||||
Tcl_Obj *errorMsg; /* Place to build an error messages. Note that
|
||||
* these are messy operations because we do
|
||||
* not want to use the formatting engine;
|
||||
@@ -362,10 +362,8 @@ ValidateFormat(
|
||||
format += TclUtfToUniChar(format, &ch);
|
||||
break;
|
||||
}
|
||||
/* FALLTHRU */
|
||||
case 'L':
|
||||
flags |= SCAN_LONGER;
|
||||
/* FALLTHRU */
|
||||
case 'h':
|
||||
format += TclUtfToUniChar(format, &ch);
|
||||
}
|
||||
@@ -387,7 +385,9 @@ ValidateFormat(
|
||||
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADWIDTH", NULL);
|
||||
goto error;
|
||||
}
|
||||
/* FALLTHRU */
|
||||
/*
|
||||
* Fall through!
|
||||
*/
|
||||
case 'n':
|
||||
case 's':
|
||||
if (flags & (SCAN_LONGER|SCAN_BIG)) {
|
||||
@@ -585,6 +585,9 @@ Tcl_ScanObjCmd(
|
||||
Tcl_UniChar ch = 0, sch = 0;
|
||||
Tcl_Obj **objs = NULL, *objPtr = NULL;
|
||||
int flags;
|
||||
char buf[513]; /* Temporary buffer to hold scanned number
|
||||
* strings before they are passed to
|
||||
* strtoul. */
|
||||
|
||||
if (objc < 3) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv,
|
||||
@@ -706,10 +709,11 @@ Tcl_ScanObjCmd(
|
||||
format += TclUtfToUniChar(format, &ch);
|
||||
break;
|
||||
}
|
||||
/* FALLTHRU */
|
||||
case 'L':
|
||||
flags |= SCAN_LONGER;
|
||||
/* FALLTHRU */
|
||||
/*
|
||||
* Fall through so we skip to the next character.
|
||||
*/
|
||||
case 'h':
|
||||
format += TclUtfToUniChar(format, &ch);
|
||||
}
|
||||
@@ -884,8 +888,8 @@ Tcl_ScanObjCmd(
|
||||
offset = TclUtfToUniChar(string, &sch);
|
||||
i = (int)sch;
|
||||
#if TCL_UTF_MAX == 4
|
||||
if ((sch >= 0xD800) && (offset < 3)) {
|
||||
offset += TclUtfToUniChar(string+offset, &sch);
|
||||
if (!offset) {
|
||||
offset = Tcl_UtfToUniChar(string, &sch);
|
||||
i = (((i<<10) & 0x0FFC00) + 0x10000) + (sch & 0x3FF);
|
||||
}
|
||||
#endif
|
||||
@@ -934,9 +938,9 @@ Tcl_ScanObjCmd(
|
||||
}
|
||||
}
|
||||
if ((flags & SCAN_UNSIGNED) && (wideValue < 0)) {
|
||||
mp_int big;
|
||||
TclBNInitBignumFromWideUInt(&big, (Tcl_WideUInt)wideValue);
|
||||
Tcl_SetBignumObj(objPtr, &big);
|
||||
sprintf(buf, "%" TCL_LL_MODIFIER "u",
|
||||
(Tcl_WideUInt)wideValue);
|
||||
Tcl_SetStringObj(objPtr, buf, -1);
|
||||
} else {
|
||||
Tcl_SetWideIntObj(objPtr, wideValue);
|
||||
}
|
||||
@@ -949,13 +953,8 @@ Tcl_ScanObjCmd(
|
||||
}
|
||||
}
|
||||
if ((flags & SCAN_UNSIGNED) && (value < 0)) {
|
||||
#ifdef TCL_WIDE_INT_IS_LONG
|
||||
mp_int big;
|
||||
TclBNInitBignumFromWideUInt(&big, (unsigned long)value);
|
||||
Tcl_SetBignumObj(objPtr, &big);
|
||||
#else
|
||||
Tcl_SetWideIntObj(objPtr, (unsigned long)value);
|
||||
#endif
|
||||
sprintf(buf, "%lu", value); /* INTL: ISO digit */
|
||||
Tcl_SetStringObj(objPtr, buf, -1);
|
||||
} else {
|
||||
Tcl_SetLongObj(objPtr, value);
|
||||
}
|
||||
|
||||
+46
-46
@@ -152,7 +152,7 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
|
||||
#define QUICK_MAX 14 /* floor((FP_PRECISION-1)*log(2)/log(10))-1 */
|
||||
#define BLETCH 0x10 /* Highest power of two that is greater than
|
||||
* DBL_MAX_10_EXP, divided by 16. */
|
||||
#define DIGIT_GROUP 8 /* floor(MP_DIGIT_BIT*log(2)/log(10)) */
|
||||
#define DIGIT_GROUP 8 /* floor(DIGIT_BIT*log(2)/log(10)) */
|
||||
|
||||
/*
|
||||
* Union used to dismantle floating point numbers.
|
||||
@@ -1491,9 +1491,9 @@ AccumulateDecimalDigit(
|
||||
* More than single digit multiplication. Multiply by the appropriate
|
||||
* small powers of 5, and then shift. Large strings of zeroes are
|
||||
* eaten 256 at a time; this is less efficient than it could be, but
|
||||
* seems implausible. We presume that MP_DIGIT_BIT is at least 27. The
|
||||
* seems implausible. We presume that DIGIT_BIT is at least 27. The
|
||||
* first multiplication, by up to 10**7, is done with a one-DIGIT
|
||||
* multiply (this presumes that MP_DIGIT_BIT >= 24).
|
||||
* multiply (this presumes that DIGIT_BIT >= 24).
|
||||
*/
|
||||
|
||||
n = numZeros + 1;
|
||||
@@ -1855,15 +1855,15 @@ RefineApproximation(
|
||||
*/
|
||||
|
||||
msb = binExponent + M2; /* 1008 */
|
||||
nDigits = msb / MP_DIGIT_BIT + 1;
|
||||
nDigits = msb / DIGIT_BIT + 1;
|
||||
mp_init_size(&twoMv, nDigits);
|
||||
i = (msb % MP_DIGIT_BIT + 1);
|
||||
i = (msb % DIGIT_BIT + 1);
|
||||
twoMv.used = nDigits;
|
||||
significand *= SafeLdExp(1.0, i);
|
||||
while (--nDigits >= 0) {
|
||||
twoMv.dp[nDigits] = (mp_digit) significand;
|
||||
significand -= (mp_digit) significand;
|
||||
significand = SafeLdExp(significand, MP_DIGIT_BIT);
|
||||
significand = SafeLdExp(significand, DIGIT_BIT);
|
||||
}
|
||||
for (i = 0; i <= 8; ++i) {
|
||||
if (M5 & (1 << i)) {
|
||||
@@ -3146,7 +3146,7 @@ StrictInt64Conversion(
|
||||
*
|
||||
* Test whether bankers' rounding should round a digit up. Assumption is
|
||||
* made that the denominator of the fraction being tested is a power of
|
||||
* 2**MP_DIGIT_BIT.
|
||||
* 2**DIGIT_BIT.
|
||||
*
|
||||
* Results:
|
||||
* Returns 1 iff the fraction is more than 1/2, or if the fraction is
|
||||
@@ -3158,11 +3158,11 @@ StrictInt64Conversion(
|
||||
static inline int
|
||||
ShouldBankerRoundUpPowD(
|
||||
mp_int *b, /* Numerator of the fraction. */
|
||||
int sd, /* Denominator is 2**(sd*MP_DIGIT_BIT). */
|
||||
int sd, /* Denominator is 2**(sd*DIGIT_BIT). */
|
||||
int isodd) /* 1 if the digit is odd, 0 if even. */
|
||||
{
|
||||
int i;
|
||||
static const mp_digit topbit = ((mp_digit)1) << (MP_DIGIT_BIT - 1);
|
||||
static const mp_digit topbit = 1 << (DIGIT_BIT - 1);
|
||||
|
||||
if (b->used < sd || (b->dp[sd-1] & topbit) == 0) {
|
||||
return 0;
|
||||
@@ -3197,7 +3197,7 @@ static inline int
|
||||
ShouldBankerRoundUpToNextPowD(
|
||||
mp_int *b, /* Numerator of the fraction. */
|
||||
mp_int *m, /* Numerator of the rounding tolerance. */
|
||||
int sd, /* Common denominator is 2**(sd*MP_DIGIT_BIT). */
|
||||
int sd, /* Common denominator is 2**(sd*DIGIT_BIT). */
|
||||
int convType, /* Conversion type: STEELE defeats
|
||||
* round-to-even (not sure why one wants to do
|
||||
* this; I copied it from Gay). FIXME */
|
||||
@@ -3209,7 +3209,7 @@ ShouldBankerRoundUpToNextPowD(
|
||||
/*
|
||||
* Compare B and S-m - which is the same as comparing B+m and S - which we
|
||||
* do by computing b+m and doing a bitwhack compare against
|
||||
* 2**(MP_DIGIT_BIT*sd)
|
||||
* 2**(DIGIT_BIT*sd)
|
||||
*/
|
||||
|
||||
mp_add(b, m, temp);
|
||||
@@ -3241,7 +3241,7 @@ ShouldBankerRoundUpToNextPowD(
|
||||
* Converts a double-precision number to the shortest string of digits
|
||||
* that reconverts exactly to the given number, or to 'ilim' digits if
|
||||
* that will yield a shorter result. The denominator in David Gay's
|
||||
* conversion algorithm is known to be a power of 2**MP_DIGIT_BIT, and hence
|
||||
* conversion algorithm is known to be a power of 2**DIGIT_BIT, and hence
|
||||
* the division in the main loop may be replaced by a digit shift and
|
||||
* mask.
|
||||
*
|
||||
@@ -3294,7 +3294,7 @@ ShorteningBignumConversionPowD(
|
||||
*/
|
||||
|
||||
TclBNInitBignumFromWideUInt(&b, bw);
|
||||
mp_init_set(&mminus, 1);
|
||||
mp_init_set_int(&mminus, 1);
|
||||
MulPow5(&b, b5, &b);
|
||||
mp_mul_2d(&b, b2, &b);
|
||||
|
||||
@@ -3323,7 +3323,7 @@ ShorteningBignumConversionPowD(
|
||||
mp_init(&temp);
|
||||
|
||||
/*
|
||||
* Loop through the digits. Do division and mod by s == 2**(sd*MP_DIGIT_BIT)
|
||||
* Loop through the digits. Do division and mod by s == 2**(sd*DIGIT_BIT)
|
||||
* by mp_digit extraction.
|
||||
*/
|
||||
|
||||
@@ -3435,7 +3435,7 @@ ShorteningBignumConversionPowD(
|
||||
* Converts a double-precision number to a fixed-lengt string of 'ilim'
|
||||
* digits (or 'ilim1' if log10(d) has been overestimated). The
|
||||
* denominator in David Gay's conversion algorithm is known to be a power
|
||||
* of 2**MP_DIGIT_BIT, and hence the division in the main loop may be
|
||||
* of 2**DIGIT_BIT, and hence the division in the main loop may be
|
||||
* replaced by a digit shift and mask.
|
||||
*
|
||||
* Results:
|
||||
@@ -3496,7 +3496,7 @@ StrictBignumConversionPowD(
|
||||
mp_init(&temp);
|
||||
|
||||
/*
|
||||
* Loop through the digits. Do division and mod by s == 2**(sd*MP_DIGIT_BIT)
|
||||
* Loop through the digits. Do division and mod by s == 2**(sd*DIGIT_BIT)
|
||||
* by mp_digit extraction.
|
||||
*/
|
||||
|
||||
@@ -3690,7 +3690,7 @@ ShorteningBignumConversion(
|
||||
|
||||
TclBNInitBignumFromWideUInt(&b, bw);
|
||||
mp_mul_2d(&b, b2, &b);
|
||||
mp_init_set(&S, 1);
|
||||
mp_init_set_int(&S, 1);
|
||||
MulPow5(&S, s5, &S); mp_mul_2d(&S, s2, &S);
|
||||
|
||||
/*
|
||||
@@ -3708,7 +3708,7 @@ ShorteningBignumConversion(
|
||||
* mminus = 2**m2minus * 5**m5
|
||||
*/
|
||||
|
||||
mp_init_set(&mminus, minit);
|
||||
mp_init_set_int(&mminus, minit);
|
||||
mp_mul_2d(&mminus, m2minus, &mminus);
|
||||
if (m2plus > m2minus) {
|
||||
mp_init_copy(&mplus, &mminus);
|
||||
@@ -3903,7 +3903,7 @@ StrictBignumConversion(
|
||||
mp_init_multi(&temp, &dig, NULL);
|
||||
TclBNInitBignumFromWideUInt(&b, bw);
|
||||
mp_mul_2d(&b, b2, &b);
|
||||
mp_init_set(&S, 1);
|
||||
mp_init_set_int(&S, 1);
|
||||
MulPow5(&S, s5, &S); mp_mul_2d(&S, s2, &S);
|
||||
|
||||
/*
|
||||
@@ -4262,14 +4262,14 @@ TclDoubleDigits(
|
||||
} else if (s5 == 0) {
|
||||
/*
|
||||
* The denominator is a power of 2, so we can replace division by
|
||||
* digit shifts. First we round up s2 to a multiple of MP_DIGIT_BIT,
|
||||
* digit shifts. First we round up s2 to a multiple of DIGIT_BIT,
|
||||
* and adjust m2 and b2 accordingly. Then we launch into a version
|
||||
* of the comparison that's specialized for the 'power of mp_digit
|
||||
* in the denominator' case.
|
||||
*/
|
||||
|
||||
if (s2 % MP_DIGIT_BIT != 0) {
|
||||
int delta = MP_DIGIT_BIT - (s2 % MP_DIGIT_BIT);
|
||||
if (s2 % DIGIT_BIT != 0) {
|
||||
int delta = DIGIT_BIT - (s2 % DIGIT_BIT);
|
||||
|
||||
b2 += delta;
|
||||
m2plus += delta;
|
||||
@@ -4277,7 +4277,7 @@ TclDoubleDigits(
|
||||
s2 += delta;
|
||||
}
|
||||
return ShorteningBignumConversionPowD(&d, convType, bw, b2, b5,
|
||||
m2plus, m2minus, m5, s2/MP_DIGIT_BIT, k, len, ilim, ilim1,
|
||||
m2plus, m2minus, m5, s2/DIGIT_BIT, k, len, ilim, ilim1,
|
||||
decpt, endPtr);
|
||||
} else {
|
||||
/*
|
||||
@@ -4318,20 +4318,20 @@ TclDoubleDigits(
|
||||
} else if (s5 == 0) {
|
||||
/*
|
||||
* The denominator is a power of 2, so we can replace division by
|
||||
* digit shifts. First we round up s2 to a multiple of MP_DIGIT_BIT,
|
||||
* digit shifts. First we round up s2 to a multiple of DIGIT_BIT,
|
||||
* and adjust m2 and b2 accordingly. Then we launch into a version
|
||||
* of the comparison that's specialized for the 'power of mp_digit
|
||||
* in the denominator' case.
|
||||
*/
|
||||
|
||||
if (s2 % MP_DIGIT_BIT != 0) {
|
||||
int delta = MP_DIGIT_BIT - (s2 % MP_DIGIT_BIT);
|
||||
if (s2 % DIGIT_BIT != 0) {
|
||||
int delta = DIGIT_BIT - (s2 % DIGIT_BIT);
|
||||
|
||||
b2 += delta;
|
||||
s2 += delta;
|
||||
}
|
||||
return StrictBignumConversionPowD(&d, convType, bw, b2, b5,
|
||||
s2/MP_DIGIT_BIT, k, len, ilim, ilim1, decpt, endPtr);
|
||||
s2/DIGIT_BIT, k, len, ilim, ilim1, decpt, endPtr);
|
||||
} else {
|
||||
/*
|
||||
* There are no helpful special cases, but at least we know in
|
||||
@@ -4456,7 +4456,7 @@ TclInitDoubleConversion(void)
|
||||
+ 0.5 * log(10.)) / log(10.));
|
||||
minDigits = (int) floor((DBL_MIN_EXP - DBL_MANT_DIG)
|
||||
* log((double) FLT_RADIX) / log(10.));
|
||||
log10_DIGIT_MAX = (int) floor(MP_DIGIT_BIT * log(2.) / log(10.));
|
||||
log10_DIGIT_MAX = (int) floor(DIGIT_BIT * log(2.) / log(10.));
|
||||
|
||||
/*
|
||||
* Nokia 770's software-emulated floating point is "middle endian": the
|
||||
@@ -4599,10 +4599,10 @@ TclBignumToDouble(
|
||||
bits = mp_count_bits(a);
|
||||
if (bits > DBL_MAX_EXP*log2FLT_RADIX) {
|
||||
errno = ERANGE;
|
||||
if (mp_isneg(a)) {
|
||||
return -HUGE_VAL;
|
||||
} else {
|
||||
if (a->sign == MP_ZPOS) {
|
||||
return HUGE_VAL;
|
||||
} else {
|
||||
return -HUGE_VAL;
|
||||
}
|
||||
}
|
||||
shift = mantBits - bits;
|
||||
@@ -4632,10 +4632,10 @@ TclBignumToDouble(
|
||||
|
||||
mp_div_2d(a, -shift, &b, NULL);
|
||||
if (mp_isodd(&b)) {
|
||||
if (mp_isneg(&b)) {
|
||||
mp_sub_d(&b, 1, &b);
|
||||
} else {
|
||||
if (b.sign == MP_ZPOS) {
|
||||
mp_add_d(&b, 1, &b);
|
||||
} else {
|
||||
mp_sub_d(&b, 1, &b);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -4645,10 +4645,10 @@ TclBignumToDouble(
|
||||
*/
|
||||
|
||||
mp_div_2d(a, -1-shift, &b, NULL);
|
||||
if (mp_isneg(&b)) {
|
||||
mp_sub_d(&b, 1, &b);
|
||||
} else {
|
||||
if (b.sign == MP_ZPOS) {
|
||||
mp_add_d(&b, 1, &b);
|
||||
} else {
|
||||
mp_sub_d(&b, 1, &b);
|
||||
}
|
||||
mp_div_2d(&b, 1, &b, NULL);
|
||||
}
|
||||
@@ -4660,7 +4660,7 @@ TclBignumToDouble(
|
||||
|
||||
r = 0.0;
|
||||
for (i=b.used-1 ; i>=0 ; --i) {
|
||||
r = ldexp(r, MP_DIGIT_BIT) + b.dp[i];
|
||||
r = ldexp(r, DIGIT_BIT) + b.dp[i];
|
||||
}
|
||||
mp_clear(&b);
|
||||
|
||||
@@ -4674,10 +4674,10 @@ TclBignumToDouble(
|
||||
* Return the result with the appropriate sign.
|
||||
*/
|
||||
|
||||
if (mp_isneg(a)) {
|
||||
return -r;
|
||||
} else {
|
||||
if (a->sign == MP_ZPOS) {
|
||||
return r;
|
||||
} else {
|
||||
return -r;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4720,7 +4720,7 @@ TclCeil(
|
||||
mp_int d;
|
||||
mp_init(&d);
|
||||
mp_div_2d(a, -shift, &b, &d);
|
||||
exact = d.used == 0;
|
||||
exact = mp_iszero(&d);
|
||||
mp_clear(&d);
|
||||
} else {
|
||||
mp_copy(a, &b);
|
||||
@@ -4729,7 +4729,7 @@ TclCeil(
|
||||
mp_add_d(&b, 1, &b);
|
||||
}
|
||||
for (i=b.used-1 ; i>=0 ; --i) {
|
||||
r = ldexp(r, MP_DIGIT_BIT) + b.dp[i];
|
||||
r = ldexp(r, DIGIT_BIT) + b.dp[i];
|
||||
}
|
||||
r = ldexp(r, bits - mantBits);
|
||||
}
|
||||
@@ -4779,7 +4779,7 @@ TclFloor(
|
||||
mp_copy(a, &b);
|
||||
}
|
||||
for (i=b.used-1 ; i>=0 ; --i) {
|
||||
r = ldexp(r, MP_DIGIT_BIT) + b.dp[i];
|
||||
r = ldexp(r, DIGIT_BIT) + b.dp[i];
|
||||
}
|
||||
r = ldexp(r, bits - mantBits);
|
||||
}
|
||||
@@ -4841,7 +4841,7 @@ BignumToBiasedFrExp(
|
||||
|
||||
r = 0.0;
|
||||
for (i=b.used-1; i>=0; --i) {
|
||||
r = ldexp(r, MP_DIGIT_BIT) + b.dp[i];
|
||||
r = ldexp(r, DIGIT_BIT) + b.dp[i];
|
||||
}
|
||||
mp_clear(&b);
|
||||
|
||||
@@ -4850,7 +4850,7 @@ BignumToBiasedFrExp(
|
||||
*/
|
||||
|
||||
*machexp = bits - mantBits + 2;
|
||||
return (mp_isneg(a) ? -r : r);
|
||||
return ((a->sign == MP_ZPOS) ? r : -r);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+12
-14
@@ -503,7 +503,7 @@ TclCheckEmptyString (
|
||||
Tcl_DictObjSize(NULL, objPtr, &length);
|
||||
return length == 0;
|
||||
}
|
||||
|
||||
|
||||
if (objPtr->bytes == NULL) {
|
||||
return TCL_EMPTYSTRING_UNKNOWN;
|
||||
}
|
||||
@@ -2002,9 +2002,9 @@ Tcl_AppendFormatToObj(
|
||||
}
|
||||
length = Tcl_UniCharToUtf(code, buf);
|
||||
#if TCL_UTF_MAX > 3
|
||||
if ((code >= 0xD800) && (length < 3)) {
|
||||
/* Special case for handling high surrogates. */
|
||||
length += Tcl_UniCharToUtf(-1, buf + length);
|
||||
if (!length) {
|
||||
/* Special case for handling upper surrogates. */
|
||||
length = Tcl_UniCharToUtf(-1, buf);
|
||||
}
|
||||
#endif
|
||||
segment = Tcl_NewStringObj(buf, length);
|
||||
@@ -2019,7 +2019,6 @@ Tcl_AppendFormatToObj(
|
||||
errCode = "BADUNSIGNED";
|
||||
goto errorMsg;
|
||||
}
|
||||
/* FALLTHRU */
|
||||
case 'd':
|
||||
case 'o':
|
||||
case 'x':
|
||||
@@ -2045,7 +2044,7 @@ Tcl_AppendFormatToObj(
|
||||
if (Tcl_GetBignumFromObj(interp,segment,&big) != TCL_OK) {
|
||||
goto error;
|
||||
}
|
||||
mp_mod_2d(&big, CHAR_BIT*sizeof(Tcl_WideInt), &big);
|
||||
mp_mod_2d(&big, (int) CHAR_BIT*sizeof(Tcl_WideInt), &big);
|
||||
objPtr = Tcl_NewBignumObj(&big);
|
||||
Tcl_IncrRefCount(objPtr);
|
||||
Tcl_GetWideIntFromObj(NULL, objPtr, &w);
|
||||
@@ -2060,7 +2059,7 @@ Tcl_AppendFormatToObj(
|
||||
if (Tcl_GetBignumFromObj(interp,segment,&big) != TCL_OK) {
|
||||
goto error;
|
||||
}
|
||||
mp_mod_2d(&big, CHAR_BIT * sizeof(long), &big);
|
||||
mp_mod_2d(&big, (int) CHAR_BIT * sizeof(long), &big);
|
||||
objPtr = Tcl_NewBignumObj(&big);
|
||||
Tcl_IncrRefCount(objPtr);
|
||||
TclGetLongFromObj(NULL, objPtr, &l);
|
||||
@@ -2219,11 +2218,11 @@ Tcl_AppendFormatToObj(
|
||||
}
|
||||
#endif
|
||||
} else if (useBig && big.used) {
|
||||
int leftover = (big.used * MP_DIGIT_BIT) % numBits;
|
||||
mp_digit mask = (~(mp_digit)0) << (MP_DIGIT_BIT-leftover);
|
||||
int leftover = (big.used * DIGIT_BIT) % numBits;
|
||||
mp_digit mask = (~(mp_digit)0) << (DIGIT_BIT-leftover);
|
||||
|
||||
numDigits = 1 +
|
||||
(((Tcl_WideInt) big.used * MP_DIGIT_BIT) / numBits);
|
||||
(((Tcl_WideInt) big.used * DIGIT_BIT) / numBits);
|
||||
while ((mask & big.dp[big.used-1]) == 0) {
|
||||
numDigits--;
|
||||
mask >>= numBits;
|
||||
@@ -2259,9 +2258,9 @@ Tcl_AppendFormatToObj(
|
||||
|
||||
if (useBig && big.used) {
|
||||
if (index < big.used && (size_t) shift <
|
||||
CHAR_BIT*sizeof(Tcl_WideUInt) - MP_DIGIT_BIT) {
|
||||
CHAR_BIT*sizeof(Tcl_WideUInt) - DIGIT_BIT) {
|
||||
bits |= ((Tcl_WideUInt) big.dp[index++]) << shift;
|
||||
shift += MP_DIGIT_BIT;
|
||||
shift += DIGIT_BIT;
|
||||
}
|
||||
shift -= numBits;
|
||||
}
|
||||
@@ -2617,7 +2616,6 @@ AppendPrintfToObjVA(
|
||||
break;
|
||||
case 'h':
|
||||
size = -1;
|
||||
/* FALLTHRU */
|
||||
default:
|
||||
p++;
|
||||
}
|
||||
@@ -3178,7 +3176,7 @@ ExtendStringRepWithUnicode(
|
||||
copyBytes:
|
||||
dst = objPtr->bytes + origLength;
|
||||
for (i = 0; i < numChars; i++) {
|
||||
dst += Tcl_UniCharToUtf(unicode[i], dst);
|
||||
dst += Tcl_UniCharToUtf((int) unicode[i], dst);
|
||||
}
|
||||
*dst = '\0';
|
||||
objPtr->length = dst - objPtr->bytes;
|
||||
|
||||
+1
-187
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
#include "tclInt.h"
|
||||
#include "tommath_private.h"
|
||||
#include "tommath.h"
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# include <wchar.h>
|
||||
@@ -51,13 +51,6 @@
|
||||
#undef TclWinGetServByName
|
||||
#undef TclWinGetSockOpt
|
||||
#undef TclWinSetSockOpt
|
||||
#undef TclBN_mp_tc_and
|
||||
#undef TclBN_mp_tc_or
|
||||
#undef TclBN_mp_tc_xor
|
||||
#define TclBN_mp_tc_and TclBN_mp_and
|
||||
#define TclBN_mp_tc_or TclBN_mp_or
|
||||
#define TclBN_mp_tc_xor TclBN_mp_xor
|
||||
#define TclUnusedStubEntry NULL
|
||||
|
||||
/* See bug 510001: TclSockMinimumBuffers needs plat imp */
|
||||
#ifdef _WIN64
|
||||
@@ -70,29 +63,6 @@ static int TclSockMinimumBuffersOld(int sock, int size)
|
||||
}
|
||||
#endif
|
||||
|
||||
MP_SET_UNSIGNED(mp_set_ull, Tcl_WideUInt)
|
||||
|
||||
|
||||
mp_err TclBN_mp_set_int(mp_int *a, unsigned long i)
|
||||
{
|
||||
mp_set_ull(a, i);
|
||||
return MP_OKAY;
|
||||
}
|
||||
|
||||
mp_err TclBN_mp_init_set_int(mp_int *a, unsigned long i)
|
||||
{
|
||||
mp_err result = mp_init(a);
|
||||
if (result == MP_OKAY) {
|
||||
mp_set_ull(a, i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast)
|
||||
{
|
||||
return mp_expt_u32(a, b, c);
|
||||
}
|
||||
|
||||
#define TclSetStartupScriptPath setStartupScriptPath
|
||||
static void TclSetStartupScriptPath(Tcl_Obj *path)
|
||||
{
|
||||
@@ -218,68 +188,11 @@ Tcl_WinUtfToTChar(
|
||||
int len,
|
||||
Tcl_DString *dsPtr)
|
||||
{
|
||||
#if TCL_UTF_MAX > 4
|
||||
Tcl_UniChar ch = 0;
|
||||
wchar_t *w, *wString;
|
||||
const char *p, *end;
|
||||
int oldLength;
|
||||
#endif
|
||||
|
||||
Tcl_DStringInit(dsPtr);
|
||||
if (!string) {
|
||||
return NULL;
|
||||
}
|
||||
#if TCL_UTF_MAX > 4
|
||||
|
||||
if (len < 0) {
|
||||
len = strlen(string);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unicode string length in Tcl_UniChars will be <= UTF-8 string length in
|
||||
* bytes.
|
||||
*/
|
||||
|
||||
oldLength = Tcl_DStringLength(dsPtr);
|
||||
|
||||
Tcl_DStringSetLength(dsPtr,
|
||||
oldLength + (int) ((len + 1) * sizeof(wchar_t)));
|
||||
wString = (wchar_t *) (Tcl_DStringValue(dsPtr) + oldLength);
|
||||
|
||||
w = wString;
|
||||
p = string;
|
||||
end = string + len - 4;
|
||||
while (p < end) {
|
||||
p += TclUtfToUniChar(p, &ch);
|
||||
if (ch > 0xFFFF) {
|
||||
*w++ = (wchar_t) (0xD800 + ((ch -= 0x10000) >> 10));
|
||||
*w++ = (wchar_t) (0xDC00 | (ch & 0x3FF));
|
||||
} else {
|
||||
*w++ = ch;
|
||||
}
|
||||
}
|
||||
end += 4;
|
||||
while (p < end) {
|
||||
if (Tcl_UtfCharComplete(p, end-p)) {
|
||||
p += TclUtfToUniChar(p, &ch);
|
||||
} else {
|
||||
ch = UCHAR(*p++);
|
||||
}
|
||||
if (ch > 0xFFFF) {
|
||||
*w++ = (wchar_t) (0xD800 + ((ch -= 0x10000) >> 10));
|
||||
*w++ = (wchar_t) (0xDC00 | (ch & 0x3FF));
|
||||
} else {
|
||||
*w++ = ch;
|
||||
}
|
||||
}
|
||||
*w = '\0';
|
||||
Tcl_DStringSetLength(dsPtr,
|
||||
oldLength + ((char *) w - (char *) wString));
|
||||
|
||||
return (char *)wString;
|
||||
#else
|
||||
return (char *)Tcl_UtfToUniCharDString(string, len, dsPtr);
|
||||
#endif
|
||||
}
|
||||
|
||||
char *
|
||||
@@ -288,12 +201,6 @@ Tcl_WinTCharToUtf(
|
||||
int len,
|
||||
Tcl_DString *dsPtr)
|
||||
{
|
||||
#if TCL_UTF_MAX > 4
|
||||
const wchar_t *w, *wEnd;
|
||||
char *p, *result;
|
||||
int oldLength, blen = 1;
|
||||
#endif
|
||||
|
||||
Tcl_DStringInit(dsPtr);
|
||||
if (!string) {
|
||||
return NULL;
|
||||
@@ -303,36 +210,7 @@ Tcl_WinTCharToUtf(
|
||||
} else {
|
||||
len /= 2;
|
||||
}
|
||||
#if TCL_UTF_MAX > 4
|
||||
oldLength = Tcl_DStringLength(dsPtr);
|
||||
Tcl_DStringSetLength(dsPtr, oldLength + (len + 1) * 4);
|
||||
result = Tcl_DStringValue(dsPtr) + oldLength;
|
||||
|
||||
p = result;
|
||||
wEnd = (wchar_t *)string + len;
|
||||
for (w = (wchar_t *)string; w < wEnd; ) {
|
||||
if (!blen && ((*w & 0xFC00) != 0xDC00)) {
|
||||
/* Special case for handling high surrogates. */
|
||||
p += Tcl_UniCharToUtf(-1, p);
|
||||
}
|
||||
blen = Tcl_UniCharToUtf(*w, p);
|
||||
p += blen;
|
||||
if ((*w >= 0xD800) && (blen < 3)) {
|
||||
/* Indication that high surrogate is handled */
|
||||
blen = 0;
|
||||
}
|
||||
w++;
|
||||
}
|
||||
if (!blen) {
|
||||
/* Special case for handling high surrogates. */
|
||||
p += Tcl_UniCharToUtf(-1, p);
|
||||
}
|
||||
Tcl_DStringSetLength(dsPtr, oldLength + (p - result));
|
||||
|
||||
return result;
|
||||
#else
|
||||
return Tcl_UniCharToUtfDString((Tcl_UniChar *)string, len, dsPtr);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(TCL_WIDE_INT_IS_LONG)
|
||||
@@ -423,36 +301,6 @@ static int formatInt(char *buffer, int n){
|
||||
# define TclpGmtime_unix TclpGmtime
|
||||
#endif
|
||||
|
||||
mp_err mp_to_unsigned_bin(const mp_int *a, unsigned char *b)
|
||||
{
|
||||
return mp_to_ubin(a, b, INT_MAX, NULL);
|
||||
}
|
||||
|
||||
mp_err mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen)
|
||||
{
|
||||
size_t n = mp_ubin_size(a);
|
||||
if (*outlen < (unsigned long)n) {
|
||||
return MP_VAL;
|
||||
}
|
||||
*outlen = (unsigned long)n;
|
||||
return mp_to_ubin(a, b, n, NULL);
|
||||
}
|
||||
|
||||
mp_err mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen)
|
||||
{
|
||||
if (maxlen < 0) {
|
||||
return MP_VAL;
|
||||
}
|
||||
return mp_to_radix(a, str, (size_t)maxlen, NULL, radix);
|
||||
}
|
||||
|
||||
void bn_reverse(unsigned char *s, int len)
|
||||
{
|
||||
if (len > 0) {
|
||||
s_mp_reverse(s, (size_t)len);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING: The contents of this file is automatically generated by the
|
||||
* tools/genStubs.tcl script. Any modifications to the function declarations
|
||||
@@ -724,8 +572,6 @@ static const TclIntStubs tclIntStubs = {
|
||||
TclPtrIncrObjVar, /* 254 */
|
||||
TclPtrObjMakeUpvar, /* 255 */
|
||||
TclPtrUnsetVar, /* 256 */
|
||||
0, /* 257 */
|
||||
TclUnusedStubEntry, /* 258 */
|
||||
};
|
||||
|
||||
static const TclIntPlatStubs tclIntPlatStubs = {
|
||||
@@ -915,20 +761,6 @@ const TclTomMathStubs tclTomMathStubs = {
|
||||
TclBNInitBignumFromLong, /* 64 */
|
||||
TclBNInitBignumFromWideInt, /* 65 */
|
||||
TclBNInitBignumFromWideUInt, /* 66 */
|
||||
TclBN_mp_expt_d_ex, /* 67 */
|
||||
TclBN_mp_set_ull, /* 68 */
|
||||
0, /* 69 */
|
||||
0, /* 70 */
|
||||
0, /* 71 */
|
||||
0, /* 72 */
|
||||
TclBN_mp_tc_and, /* 73 */
|
||||
TclBN_mp_tc_or, /* 74 */
|
||||
TclBN_mp_tc_xor, /* 75 */
|
||||
TclBN_mp_signed_rsh, /* 76 */
|
||||
0, /* 77 */
|
||||
TclBN_mp_to_ubin, /* 78 */
|
||||
0, /* 79 */
|
||||
TclBN_mp_to_radix, /* 80 */
|
||||
};
|
||||
|
||||
static const TclStubHooks tclStubHooks = {
|
||||
@@ -1595,24 +1427,6 @@ const TclStubs tclStubs = {
|
||||
Tcl_FindSymbol, /* 628 */
|
||||
Tcl_FSUnloadFile, /* 629 */
|
||||
Tcl_ZlibStreamSetCompressionDictionary, /* 630 */
|
||||
0, /* 631 */
|
||||
0, /* 632 */
|
||||
0, /* 633 */
|
||||
0, /* 634 */
|
||||
0, /* 635 */
|
||||
0, /* 636 */
|
||||
0, /* 637 */
|
||||
0, /* 638 */
|
||||
0, /* 639 */
|
||||
0, /* 640 */
|
||||
0, /* 641 */
|
||||
0, /* 642 */
|
||||
0, /* 643 */
|
||||
0, /* 644 */
|
||||
0, /* 645 */
|
||||
0, /* 646 */
|
||||
0, /* 647 */
|
||||
TclUnusedStubEntry, /* 648 */
|
||||
};
|
||||
|
||||
/* !END!: Do not edit above this line. */
|
||||
|
||||
@@ -68,7 +68,7 @@ Tcl_InitStubs(
|
||||
*/
|
||||
|
||||
if (!stubsPtr || (stubsPtr->magic != TCL_STUB_MAGIC)) {
|
||||
iPtr->result = (char *)"interpreter uses an incompatible stubs mechanism";
|
||||
iPtr->result = "interpreter uses an incompatible stubs mechanism";
|
||||
iPtr->freeProc = TCL_STATIC;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+10
-88
@@ -220,12 +220,6 @@ static void SpecialFree(char *blockPtr);
|
||||
static int StaticInitProc(Tcl_Interp *interp);
|
||||
static int TestasyncCmd(ClientData dummy,
|
||||
Tcl_Interp *interp, int argc, const char **argv);
|
||||
static int TestbumpinterpepochObjCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const objv[]);
|
||||
static int TestpurebytesobjObjCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const objv[]);
|
||||
static int TestbytestringObjCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc,
|
||||
Tcl_Obj *const objv[]);
|
||||
@@ -576,7 +570,6 @@ Tcltest_Init(
|
||||
Tcl_CreateObjCommand(interp, "gettimes", GetTimesObjCmd, NULL, NULL);
|
||||
Tcl_CreateCommand(interp, "noop", NoopCmd, NULL, NULL);
|
||||
Tcl_CreateObjCommand(interp, "noop", NoopObjCmd, NULL, NULL);
|
||||
Tcl_CreateObjCommand(interp, "testpurebytesobj", TestpurebytesobjObjCmd, NULL, NULL);
|
||||
Tcl_CreateObjCommand(interp, "testbytestring", TestbytestringObjCmd, NULL, NULL);
|
||||
Tcl_CreateObjCommand(interp, "testwrongnumargs", TestWrongNumArgsObjCmd,
|
||||
NULL, NULL);
|
||||
@@ -587,8 +580,6 @@ Tcltest_Init(
|
||||
Tcl_CreateObjCommand(interp, "testgetindexfromobjstruct",
|
||||
TestGetIndexFromObjStructObjCmd, NULL, NULL);
|
||||
Tcl_CreateCommand(interp, "testasync", TestasyncCmd, NULL, NULL);
|
||||
Tcl_CreateObjCommand(interp, "testbumpinterpepoch",
|
||||
TestbumpinterpepochObjCmd, NULL, NULL);
|
||||
Tcl_CreateCommand(interp, "testchannel", TestChannelCmd,
|
||||
NULL, NULL);
|
||||
Tcl_CreateCommand(interp, "testchannelevent", TestChannelEventCmd,
|
||||
@@ -957,10 +948,8 @@ AsyncHandlerProc(
|
||||
|
||||
Tcl_MutexLock(&asyncTestMutex);
|
||||
for (asyncPtr = firstHandler; asyncPtr != NULL;
|
||||
asyncPtr = asyncPtr->nextPtr) {
|
||||
if (asyncPtr->id == id) {
|
||||
break;
|
||||
}
|
||||
asyncPtr = asyncPtr->nextPtr) {
|
||||
if (asyncPtr->id == id) break;
|
||||
}
|
||||
Tcl_MutexUnlock(&asyncTestMutex);
|
||||
|
||||
@@ -1027,22 +1016,6 @@ AsyncThreadProc(
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
TestbumpinterpepochObjCmd(
|
||||
ClientData dummy, /* Not used. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Interp *iPtr = (Interp *)interp;
|
||||
if (objc != 1) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
iPtr->compileEpoch++;
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -2108,7 +2081,7 @@ TestevalexObjCmd(
|
||||
|
||||
flags = 0;
|
||||
if (objc == 3) {
|
||||
const char *global = Tcl_GetString(objv[2]);
|
||||
const char *global = Tcl_GetStringFromObj(objv[2], &length);
|
||||
if (strcmp(global, "global") != 0) {
|
||||
Tcl_AppendResult(interp, "bad value \"", global,
|
||||
"\": must be global", NULL);
|
||||
@@ -2405,11 +2378,11 @@ ExitProcOdd(
|
||||
ClientData clientData) /* Integer value to print. */
|
||||
{
|
||||
char buf[16 + TCL_INTEGER_SPACE];
|
||||
int len;
|
||||
size_t len;
|
||||
|
||||
sprintf(buf, "odd %d\n", (int)PTR2INT(clientData));
|
||||
sprintf(buf, "odd %d\n", PTR2INT(clientData));
|
||||
len = strlen(buf);
|
||||
if (len != (int) write(1, buf, len)) {
|
||||
if (len != (size_t) write(1, buf, len)) {
|
||||
Tcl_Panic("ExitProcOdd: unable to write to stdout");
|
||||
}
|
||||
}
|
||||
@@ -2419,11 +2392,11 @@ ExitProcEven(
|
||||
ClientData clientData) /* Integer value to print. */
|
||||
{
|
||||
char buf[16 + TCL_INTEGER_SPACE];
|
||||
int len;
|
||||
size_t len;
|
||||
|
||||
sprintf(buf, "even %d\n", (int)PTR2INT(clientData));
|
||||
sprintf(buf, "even %d\n", PTR2INT(clientData));
|
||||
len = strlen(buf);
|
||||
if (len != (int) write(1, buf, len)) {
|
||||
if (len != (size_t) write(1, buf, len)) {
|
||||
Tcl_Panic("ExitProcEven: unable to write to stdout");
|
||||
}
|
||||
}
|
||||
@@ -4370,7 +4343,7 @@ TesttranslatefilenameCmd(
|
||||
*
|
||||
* TestupvarCmd --
|
||||
*
|
||||
* This procedure implements the "testupvar" command. It is used
|
||||
* This procedure implements the "testupvar2" command. It is used
|
||||
* to test Tcl_UpVar and Tcl_UpVar2.
|
||||
*
|
||||
* Results:
|
||||
@@ -4983,57 +4956,6 @@ NoopObjCmd(
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TestpurebytesobjObjCmd --
|
||||
*
|
||||
* This object-based procedure constructs a pure bytes object
|
||||
* without type and with internal representation containing NULL's.
|
||||
*
|
||||
* If no argument supplied it returns empty object with tclEmptyStringRep,
|
||||
* otherwise it returns this as pure bytes object with bytes value equal
|
||||
* string.
|
||||
*
|
||||
* Results:
|
||||
* Returns the TCL_OK result code.
|
||||
*
|
||||
* Side effects:
|
||||
* None.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
TestpurebytesobjObjCmd(
|
||||
ClientData unused, /* Not used. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* The argument objects. */
|
||||
{
|
||||
Tcl_Obj *objPtr;
|
||||
|
||||
if (objc > 2) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "?string?");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
objPtr = Tcl_NewObj();
|
||||
/*
|
||||
objPtr->internalRep.twoPtrValue.ptr1 = NULL;
|
||||
objPtr->internalRep.twoPtrValue.ptr2 = NULL;
|
||||
*/
|
||||
memset(&objPtr->internalRep, 0, sizeof(objPtr->internalRep));
|
||||
if (objc == 2) {
|
||||
const char *s = Tcl_GetString(objv[1]);
|
||||
objPtr->length = objv[1]->length;
|
||||
objPtr->bytes = ckalloc(objPtr->length + 1);
|
||||
memcpy(objPtr->bytes, s, objPtr->length);
|
||||
objPtr->bytes[objPtr->length] = 0;
|
||||
}
|
||||
Tcl_SetObjResult(interp, objPtr);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
|
||||
@@ -131,7 +131,7 @@ TclObjTest_Init(
|
||||
*
|
||||
* TestbignumobjCmd --
|
||||
*
|
||||
* This function implements the "testbignumobj" command. It is used
|
||||
* This function implmenets the "testbignumobj" command. It is used
|
||||
* to exercise the bignum Tcl object type implementation.
|
||||
*
|
||||
* Results:
|
||||
@@ -290,9 +290,9 @@ TestbignumobjCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (!Tcl_IsShared(varPtr[varIndex])) {
|
||||
Tcl_SetIntObj(varPtr[varIndex], !mp_isodd(&bignumValue));
|
||||
Tcl_SetIntObj(varPtr[varIndex], mp_iseven(&bignumValue));
|
||||
} else {
|
||||
SetVarToObj(varPtr, varIndex, Tcl_NewIntObj(!mp_isodd(&bignumValue)));
|
||||
SetVarToObj(varPtr, varIndex, Tcl_NewIntObj(mp_iseven(&bignumValue)));
|
||||
}
|
||||
mp_clear(&bignumValue);
|
||||
break;
|
||||
|
||||
@@ -21,14 +21,13 @@
|
||||
*/
|
||||
|
||||
static const char packageName[] = "procbodytest";
|
||||
static const char packageVersion[] = "1.1";
|
||||
static const char packageVersion[] = "1.0";
|
||||
|
||||
/*
|
||||
* Name of the commands exported by this package
|
||||
*/
|
||||
|
||||
static const char procCommand[] = "proc";
|
||||
static const char checkCommand[] = "check";
|
||||
|
||||
/*
|
||||
* this struct describes an entry in the table of command names and command
|
||||
@@ -47,8 +46,6 @@ typedef struct CmdTable {
|
||||
|
||||
static int ProcBodyTestProcObjCmd(ClientData dummy,
|
||||
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
|
||||
static int ProcBodyTestCheckObjCmd(ClientData dummy,
|
||||
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
|
||||
static int ProcBodyTestInitInternal(Tcl_Interp *interp, int isSafe);
|
||||
static int RegisterCommand(Tcl_Interp* interp,
|
||||
const char *namespace, const CmdTable *cmdTablePtr);
|
||||
@@ -60,13 +57,11 @@ static int RegisterCommand(Tcl_Interp* interp,
|
||||
|
||||
static const CmdTable commands[] = {
|
||||
{ procCommand, ProcBodyTestProcObjCmd, 1 },
|
||||
{ checkCommand, ProcBodyTestCheckObjCmd, 1 },
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const CmdTable safeCommands[] = {
|
||||
{ procCommand, ProcBodyTestProcObjCmd, 1 },
|
||||
{ checkCommand, ProcBodyTestCheckObjCmd, 1 },
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
@@ -305,46 +300,6 @@ ProcBodyTestProcObjCmd(
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* ProcBodyTestCheckObjCmd --
|
||||
*
|
||||
* Implements the "procbodytest::check" command. Here is the command
|
||||
* description:
|
||||
* procbodytest::check
|
||||
*
|
||||
* Performs an internal check that the Tcl_PkgPresent() command returns
|
||||
* the same version number as was registered when the procbodytest package
|
||||
* was provided. Places a boolean in the interp result indicating the
|
||||
* test outcome.
|
||||
*
|
||||
* Results:
|
||||
* Returns a standard Tcl code.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
ProcBodyTestCheckObjCmd(
|
||||
ClientData dummy, /* context; not used */
|
||||
Tcl_Interp *interp, /* the current interpreter */
|
||||
int objc, /* argument count */
|
||||
Tcl_Obj *const objv[]) /* arguments */
|
||||
{
|
||||
const char *version;
|
||||
|
||||
if (objc != 1) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
version = Tcl_PkgPresent(interp, packageName, packageVersion, 1);
|
||||
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
|
||||
strcmp(version, packageVersion) == 0));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: c
|
||||
|
||||
+7
-13
@@ -310,8 +310,8 @@ TclCreateAbsoluteTimerHandler(
|
||||
timerHandlerPtr->token = (Tcl_TimerToken) INT2PTR(tsdPtr->lastTimerId);
|
||||
|
||||
/*
|
||||
* Add the event to the queue in the correct position (ordered by event
|
||||
* firing time).
|
||||
* Add the event to the queue in the correct position
|
||||
* (ordered by event firing time).
|
||||
*/
|
||||
|
||||
for (tPtr2 = tsdPtr->firstTimerHandlerPtr, prevPtr = NULL; tPtr2 != NULL;
|
||||
@@ -1019,8 +1019,8 @@ AfterDelay(
|
||||
|
||||
Tcl_GetTime(&now);
|
||||
endTime = now;
|
||||
endTime.sec += (long)(ms / 1000);
|
||||
endTime.usec += ((int)(ms % 1000)) * 1000;
|
||||
endTime.sec += (long)(ms/1000);
|
||||
endTime.usec += ((int)(ms%1000))*1000;
|
||||
if (endTime.usec >= 1000000) {
|
||||
endTime.sec++;
|
||||
endTime.usec -= 1000000;
|
||||
@@ -1053,17 +1053,11 @@ AfterDelay(
|
||||
if (diff > TCL_TIME_MAXIMUM_SLICE) {
|
||||
diff = TCL_TIME_MAXIMUM_SLICE;
|
||||
}
|
||||
if (diff == 0 && TCL_TIME_BEFORE(now, endTime)) {
|
||||
diff = 1;
|
||||
}
|
||||
if (diff == 0 && TCL_TIME_BEFORE(now, endTime)) diff = 1;
|
||||
if (diff > 0) {
|
||||
Tcl_Sleep((long) diff);
|
||||
if (diff < SLEEP_OFFLOAD_GETTIMEOFDAY) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
if (diff < SLEEP_OFFLOAD_GETTIMEOFDAY) break;
|
||||
} else break;
|
||||
} else {
|
||||
diff = TCL_TIME_DIFF_MS(iPtr->limit.time, now);
|
||||
#ifndef TCL_WIDE_INT_IS_LONG
|
||||
|
||||
+55
-86
@@ -30,13 +30,13 @@ declare 1 {
|
||||
}
|
||||
|
||||
declare 2 {
|
||||
mp_err TclBN_mp_add(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
int TclBN_mp_add(mp_int *a, mp_int *b, mp_int *c)
|
||||
}
|
||||
declare 3 {
|
||||
mp_err TclBN_mp_add_d(const mp_int *a, mp_digit b, mp_int *c)
|
||||
int TclBN_mp_add_d(mp_int *a, mp_digit b, mp_int *c)
|
||||
}
|
||||
declare 4 {
|
||||
mp_err TclBN_mp_and(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
int TclBN_mp_and(mp_int *a, mp_int *b, mp_int *c)
|
||||
}
|
||||
declare 5 {
|
||||
void TclBN_mp_clamp(mp_int *a)
|
||||
@@ -48,128 +48,128 @@ declare 7 {
|
||||
void TclBN_mp_clear_multi(mp_int *a, ...)
|
||||
}
|
||||
declare 8 {
|
||||
mp_ord TclBN_mp_cmp(const mp_int *a, const mp_int *b)
|
||||
int TclBN_mp_cmp(const mp_int *a, const mp_int *b)
|
||||
}
|
||||
declare 9 {
|
||||
mp_ord TclBN_mp_cmp_d(const mp_int *a, mp_digit b)
|
||||
int TclBN_mp_cmp_d(const mp_int *a, mp_digit b)
|
||||
}
|
||||
declare 10 {
|
||||
mp_ord TclBN_mp_cmp_mag(const mp_int *a, const mp_int *b)
|
||||
int TclBN_mp_cmp_mag(const mp_int *a, const mp_int *b)
|
||||
}
|
||||
declare 11 {
|
||||
mp_err TclBN_mp_copy(const mp_int *a, mp_int *b)
|
||||
int TclBN_mp_copy(const mp_int *a, mp_int *b)
|
||||
}
|
||||
declare 12 {
|
||||
int TclBN_mp_count_bits(const mp_int *a)
|
||||
}
|
||||
declare 13 {
|
||||
mp_err TclBN_mp_div(const mp_int *a, const mp_int *b, mp_int *q, mp_int *r)
|
||||
int TclBN_mp_div(mp_int *a, mp_int *b, mp_int *q, mp_int *r)
|
||||
}
|
||||
declare 14 {
|
||||
mp_err TclBN_mp_div_d(const mp_int *a, mp_digit b, mp_int *q, mp_digit *r)
|
||||
int TclBN_mp_div_d(mp_int *a, mp_digit b, mp_int *q, mp_digit *r)
|
||||
}
|
||||
declare 15 {
|
||||
mp_err TclBN_mp_div_2(const mp_int *a, mp_int *q)
|
||||
int TclBN_mp_div_2(mp_int *a, mp_int *q)
|
||||
}
|
||||
declare 16 {
|
||||
mp_err TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r)
|
||||
int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r)
|
||||
}
|
||||
declare 17 {
|
||||
mp_err TclBN_mp_div_3(const mp_int *a, mp_int *q, mp_digit *r)
|
||||
int TclBN_mp_div_3(mp_int *a, mp_int *q, mp_digit *r)
|
||||
}
|
||||
declare 18 {
|
||||
void TclBN_mp_exch(mp_int *a, mp_int *b)
|
||||
}
|
||||
declare 19 {
|
||||
mp_err TclBN_mp_expt_d(const mp_int *a, unsigned int b, mp_int *c)
|
||||
int TclBN_mp_expt_d(mp_int *a, mp_digit b, mp_int *c)
|
||||
}
|
||||
declare 20 {
|
||||
mp_err TclBN_mp_grow(mp_int *a, int size)
|
||||
int TclBN_mp_grow(mp_int *a, int size)
|
||||
}
|
||||
declare 21 {
|
||||
mp_err TclBN_mp_init(mp_int *a)
|
||||
int TclBN_mp_init(mp_int *a)
|
||||
}
|
||||
declare 22 {
|
||||
mp_err TclBN_mp_init_copy(mp_int *a, const mp_int *b)
|
||||
int TclBN_mp_init_copy(mp_int *a, mp_int *b)
|
||||
}
|
||||
declare 23 {
|
||||
mp_err TclBN_mp_init_multi(mp_int *a, ...)
|
||||
int TclBN_mp_init_multi(mp_int *a, ...)
|
||||
}
|
||||
declare 24 {
|
||||
mp_err TclBN_mp_init_set(mp_int *a, mp_digit b)
|
||||
int TclBN_mp_init_set(mp_int *a, mp_digit b)
|
||||
}
|
||||
declare 25 {
|
||||
mp_err TclBN_mp_init_size(mp_int *a, int size)
|
||||
int TclBN_mp_init_size(mp_int *a, int size)
|
||||
}
|
||||
declare 26 {
|
||||
mp_err TclBN_mp_lshd(mp_int *a, int shift)
|
||||
int TclBN_mp_lshd(mp_int *a, int shift)
|
||||
}
|
||||
declare 27 {
|
||||
mp_err TclBN_mp_mod(const mp_int *a, const mp_int *b, mp_int *r)
|
||||
int TclBN_mp_mod(mp_int *a, mp_int *b, mp_int *r)
|
||||
}
|
||||
declare 28 {
|
||||
mp_err TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r)
|
||||
int TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r)
|
||||
}
|
||||
declare 29 {
|
||||
mp_err TclBN_mp_mul(const mp_int *a, const mp_int *b, mp_int *p)
|
||||
int TclBN_mp_mul(mp_int *a, mp_int *b, mp_int *p)
|
||||
}
|
||||
declare 30 {
|
||||
mp_err TclBN_mp_mul_d(const mp_int *a, mp_digit b, mp_int *p)
|
||||
int TclBN_mp_mul_d(mp_int *a, mp_digit b, mp_int *p)
|
||||
}
|
||||
declare 31 {
|
||||
mp_err TclBN_mp_mul_2(const mp_int *a, mp_int *p)
|
||||
int TclBN_mp_mul_2(mp_int *a, mp_int *p)
|
||||
}
|
||||
declare 32 {
|
||||
mp_err TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p)
|
||||
int TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p)
|
||||
}
|
||||
declare 33 {
|
||||
mp_err TclBN_mp_neg(const mp_int *a, mp_int *b)
|
||||
int TclBN_mp_neg(const mp_int *a, mp_int *b)
|
||||
}
|
||||
declare 34 {
|
||||
mp_err TclBN_mp_or(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
int TclBN_mp_or(mp_int *a, mp_int *b, mp_int *c)
|
||||
}
|
||||
declare 35 {
|
||||
mp_err TclBN_mp_radix_size(const mp_int *a, int radix, int *size)
|
||||
int TclBN_mp_radix_size(mp_int *a, int radix, int *size)
|
||||
}
|
||||
declare 36 {
|
||||
mp_err TclBN_mp_read_radix(mp_int *a, const char *str, int radix)
|
||||
int TclBN_mp_read_radix(mp_int *a, const char *str, int radix)
|
||||
}
|
||||
declare 37 {
|
||||
void TclBN_mp_rshd(mp_int *a, int shift)
|
||||
}
|
||||
declare 38 {
|
||||
mp_err TclBN_mp_shrink(mp_int *a)
|
||||
int TclBN_mp_shrink(mp_int *a)
|
||||
}
|
||||
declare 39 {
|
||||
void TclBN_mp_set(mp_int *a, mp_digit b)
|
||||
}
|
||||
declare 40 {
|
||||
mp_err TclBN_mp_sqr(const mp_int *a, mp_int *b)
|
||||
int TclBN_mp_sqr(mp_int *a, mp_int *b)
|
||||
}
|
||||
declare 41 {
|
||||
mp_err TclBN_mp_sqrt(const mp_int *a, mp_int *b)
|
||||
int TclBN_mp_sqrt(mp_int *a, mp_int *b)
|
||||
}
|
||||
declare 42 {
|
||||
mp_err TclBN_mp_sub(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
int TclBN_mp_sub(mp_int *a, mp_int *b, mp_int *c)
|
||||
}
|
||||
declare 43 {
|
||||
mp_err TclBN_mp_sub_d(const mp_int *a, mp_digit b, mp_int *c)
|
||||
int TclBN_mp_sub_d(mp_int *a, mp_digit b, mp_int *c)
|
||||
}
|
||||
declare 44 {
|
||||
mp_err TclBN_mp_to_unsigned_bin(const mp_int *a, unsigned char *b)
|
||||
int TclBN_mp_to_unsigned_bin(mp_int *a, unsigned char *b)
|
||||
}
|
||||
declare 45 {
|
||||
mp_err TclBN_mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b,
|
||||
int TclBN_mp_to_unsigned_bin_n(mp_int *a, unsigned char *b,
|
||||
unsigned long *outlen)
|
||||
}
|
||||
declare 46 {
|
||||
mp_err TclBN_mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen)
|
||||
int TclBN_mp_toradix_n(mp_int *a, char *str, int radix, int maxlen)
|
||||
}
|
||||
declare 47 {
|
||||
size_t TclBN_mp_unsigned_bin_size(const mp_int *a)
|
||||
int TclBN_mp_unsigned_bin_size(mp_int *a)
|
||||
}
|
||||
declare 48 {
|
||||
mp_err TclBN_mp_xor(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
int TclBN_mp_xor(mp_int *a, mp_int *b, mp_int *c)
|
||||
}
|
||||
declare 49 {
|
||||
void TclBN_mp_zero(mp_int *a)
|
||||
@@ -182,40 +182,40 @@ declare 50 {
|
||||
void TclBN_reverse(unsigned char *s, int len)
|
||||
}
|
||||
declare 51 {
|
||||
mp_err TclBN_fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs)
|
||||
int TclBN_fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs)
|
||||
}
|
||||
declare 52 {
|
||||
mp_err TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b)
|
||||
int TclBN_fast_s_mp_sqr(mp_int *a, mp_int *b)
|
||||
}
|
||||
declare 53 {
|
||||
mp_err TclBN_mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
int TclBN_mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c)
|
||||
}
|
||||
declare 54 {
|
||||
mp_err TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b)
|
||||
int TclBN_mp_karatsuba_sqr(mp_int *a, mp_int *b)
|
||||
}
|
||||
declare 55 {
|
||||
mp_err TclBN_mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
int TclBN_mp_toom_mul(mp_int *a, mp_int *b, mp_int *c)
|
||||
}
|
||||
declare 56 {
|
||||
mp_err TclBN_mp_toom_sqr(const mp_int *a, mp_int *b)
|
||||
int TclBN_mp_toom_sqr(mp_int *a, mp_int *b)
|
||||
}
|
||||
declare 57 {
|
||||
mp_err TclBN_s_mp_add(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
int TclBN_s_mp_add(mp_int *a, mp_int *b, mp_int *c)
|
||||
}
|
||||
declare 58 {
|
||||
mp_err TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs)
|
||||
int TclBN_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs)
|
||||
}
|
||||
declare 59 {
|
||||
mp_err TclBN_s_mp_sqr(const mp_int *a, mp_int *b)
|
||||
int TclBN_s_mp_sqr(mp_int *a, mp_int *b)
|
||||
}
|
||||
declare 60 {
|
||||
mp_err TclBN_s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
int TclBN_s_mp_sub(mp_int *a, mp_int *b, mp_int *c)
|
||||
}
|
||||
declare 61 {
|
||||
mp_err TclBN_mp_init_set_int(mp_int *a, unsigned long i)
|
||||
int TclBN_mp_init_set_int(mp_int *a, unsigned long i)
|
||||
}
|
||||
declare 62 {
|
||||
mp_err TclBN_mp_set_int(mp_int *a, unsigned long i)
|
||||
int TclBN_mp_set_int(mp_int *a, unsigned long i)
|
||||
}
|
||||
declare 63 {
|
||||
int TclBN_mp_cnt_lsb(const mp_int *a)
|
||||
@@ -224,46 +224,15 @@ declare 63 {
|
||||
# Formerly internal API to allow initialisation of bignums without knowing the
|
||||
# typedefs of how a bignum works internally.
|
||||
declare 64 {
|
||||
int TclBNInitBignumFromLong(mp_int *bignum, long initVal)
|
||||
void TclBNInitBignumFromLong(mp_int *bignum, long initVal)
|
||||
}
|
||||
declare 65 {
|
||||
int TclBNInitBignumFromWideInt(mp_int *bignum, Tcl_WideInt initVal)
|
||||
void TclBNInitBignumFromWideInt(mp_int *bignum, Tcl_WideInt initVal)
|
||||
}
|
||||
declare 66 {
|
||||
int TclBNInitBignumFromWideUInt(mp_int *bignum, Tcl_WideUInt initVal)
|
||||
void TclBNInitBignumFromWideUInt(mp_int *bignum, Tcl_WideUInt initVal)
|
||||
}
|
||||
|
||||
# Added in libtommath 1.0
|
||||
declare 67 {
|
||||
mp_err TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast)
|
||||
}
|
||||
# Added in libtommath 1.0.1
|
||||
declare 68 {
|
||||
void TclBN_mp_set_ull(mp_int *a, Tcl_WideUInt i)
|
||||
}
|
||||
# Added in libtommath 1.1.0
|
||||
declare 73 {
|
||||
mp_err TclBN_mp_tc_and(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
}
|
||||
declare 74 {
|
||||
mp_err TclBN_mp_tc_or(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
}
|
||||
declare 75 {
|
||||
mp_err TclBN_mp_tc_xor(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
}
|
||||
declare 76 {
|
||||
mp_err TclBN_mp_signed_rsh(const mp_int *a, int b, mp_int *c)
|
||||
}
|
||||
|
||||
# Added in libtommath 1.2.0
|
||||
declare 78 {
|
||||
int TclBN_mp_to_ubin(const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written)
|
||||
}
|
||||
declare 80 {
|
||||
int TclBN_mp_to_radix(const mp_int *a, char *str, size_t maxlen, size_t *written, int radix)
|
||||
}
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: tcl
|
||||
# End:
|
||||
|
||||
+340
-630
File diff suppressed because it is too large
Load Diff
+143
-285
@@ -16,9 +16,6 @@
|
||||
#define _TCLTOMMATHDECLS
|
||||
|
||||
#include "tcl.h"
|
||||
#ifndef BN_H_
|
||||
#include "tclTomMath.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define the version of the Stubs table that's exported for tommath
|
||||
@@ -35,22 +32,28 @@
|
||||
|
||||
/* MODULE_SCOPE void* TclBNAlloc( size_t ); */
|
||||
#define TclBNAlloc(s) ((void*)ckalloc((size_t)(s)))
|
||||
/* MODULE_SCOPE void* TclBNCalloc( size_t, size_t ); */
|
||||
#define TclBNCalloc(m,s) memset(ckalloc((size_t)(m)*(size_t)(s)),0,(size_t)(m)*(size_t)(s))
|
||||
/* MODULE_SCOPE void* TclBNRealloc( void*, size_t ); */
|
||||
#define TclBNRealloc(x,s) ((void*)ckrealloc((char*)(x),(size_t)(s)))
|
||||
/* MODULE_SCOPE void TclBNFree( void* ); */
|
||||
#define TclBNFree(x) (ckfree((char*)(x)))
|
||||
/* MODULE_SCOPE void* TclBNCalloc( size_t, size_t ); */
|
||||
/* unused - no macro */
|
||||
|
||||
#define MP_MALLOC(size) TclBNAlloc(size)
|
||||
#define MP_CALLOC(nmemb, size) TclBNCalloc(nmemb, size)
|
||||
#define MP_REALLOC(mem, oldsize, newsize) TclBNRealloc(mem, newsize)
|
||||
#define MP_FREE(mem, size) TclBNFree(mem)
|
||||
|
||||
#define XMALLOC(x) TclBNAlloc(x)
|
||||
#define XFREE(x) TclBNFree(x)
|
||||
#define XREALLOC(x,n) TclBNRealloc(x,n)
|
||||
#define XCALLOC(n,x) TclBNCalloc(n,x)
|
||||
|
||||
/* Rename the global symbols in libtommath to avoid linkage conflicts */
|
||||
|
||||
#define KARATSUBA_MUL_CUTOFF TclBNKaratsubaMulCutoff
|
||||
#define KARATSUBA_SQR_CUTOFF TclBNKaratsubaSqrCutoff
|
||||
#define TOOM_MUL_CUTOFF TclBNToomMulCutoff
|
||||
#define TOOM_SQR_CUTOFF TclBNToomSqrCutoff
|
||||
|
||||
#define bn_reverse TclBN_reverse
|
||||
#define fast_s_mp_mul_digs TclBN_fast_s_mp_mul_digs
|
||||
#define fast_s_mp_sqr TclBN_fast_s_mp_sqr
|
||||
#define mp_add TclBN_mp_add
|
||||
#define mp_add_d TclBN_mp_add_d
|
||||
#define mp_and TclBN_mp_and
|
||||
@@ -70,8 +73,6 @@
|
||||
#define mp_div_d TclBN_mp_div_d
|
||||
#define mp_exch TclBN_mp_exch
|
||||
#define mp_expt_d TclBN_mp_expt_d
|
||||
#define mp_expt_d_ex TclBN_mp_expt_d_ex
|
||||
#define mp_expt_u32 TclBN_mp_expt_d
|
||||
#define mp_grow TclBN_mp_grow
|
||||
#define mp_init TclBN_mp_init
|
||||
#define mp_init_copy TclBN_mp_init_copy
|
||||
@@ -79,6 +80,8 @@
|
||||
#define mp_init_set TclBN_mp_init_set
|
||||
#define mp_init_set_int TclBN_mp_init_set_int
|
||||
#define mp_init_size TclBN_mp_init_size
|
||||
#define mp_karatsuba_mul TclBN_mp_karatsuba_mul
|
||||
#define mp_karatsuba_sqr TclBN_mp_karatsuba_sqr
|
||||
#define mp_lshd TclBN_mp_lshd
|
||||
#define mp_mod TclBN_mp_mod
|
||||
#define mp_mod_2d TclBN_mp_mod_2d
|
||||
@@ -91,43 +94,26 @@
|
||||
#define mp_radix_size TclBN_mp_radix_size
|
||||
#define mp_read_radix TclBN_mp_read_radix
|
||||
#define mp_rshd TclBN_mp_rshd
|
||||
#define mp_s_rmap TclBNMpSRmap
|
||||
#define mp_set TclBN_mp_set
|
||||
#define mp_set_int(a,b) (TclBN_mp_set_int(a,(unsigned int)(b)),MP_OKAY)
|
||||
#define mp_set_long(a,b) (TclBN_mp_set_int(a,b),MP_OKAY)
|
||||
#define mp_set_ul(a,b) (void)TclBN_mp_set_int(a,b)
|
||||
#define mp_set_ull TclBN_mp_set_ull
|
||||
#define mp_set_u64 TclBN_mp_set_ull
|
||||
#define mp_set_int TclBN_mp_set_int
|
||||
#define mp_shrink TclBN_mp_shrink
|
||||
#define mp_sqr TclBN_mp_sqr
|
||||
#define mp_sqrt TclBN_mp_sqrt
|
||||
#define mp_sub TclBN_mp_sub
|
||||
#define mp_sub_d TclBN_mp_sub_d
|
||||
#define mp_signed_rsh TclBN_mp_signed_rsh
|
||||
#define mp_tc_and TclBN_mp_and
|
||||
#define mp_tc_div_2d TclBN_mp_signed_rsh
|
||||
#define mp_tc_or TclBN_mp_or
|
||||
#define mp_tc_xor TclBN_mp_xor
|
||||
#define mp_to_unsigned_bin TclBN_mp_to_unsigned_bin
|
||||
#define mp_to_unsigned_bin_n TclBN_mp_to_unsigned_bin_n
|
||||
#define mp_toom_mul TclBN_mp_toom_mul
|
||||
#define mp_toom_sqr TclBN_mp_toom_sqr
|
||||
#define mp_toradix_n TclBN_mp_toradix_n
|
||||
#define mp_to_radix TclBN_mp_to_radix
|
||||
#define mp_to_ubin TclBN_mp_to_ubin
|
||||
#define mp_ubin_size TclBN_mp_unsigned_bin_size
|
||||
#define mp_unsigned_bin_size(a) ((int)TclBN_mp_unsigned_bin_size(a))
|
||||
#define mp_unsigned_bin_size TclBN_mp_unsigned_bin_size
|
||||
#define mp_xor TclBN_mp_xor
|
||||
#define mp_zero TclBN_mp_zero
|
||||
#define s_mp_add TclBN_s_mp_add
|
||||
#define s_mp_balance_mul TclBN_mp_balance_mul
|
||||
#define s_mp_karatsuba_mul TclBN_mp_karatsuba_mul
|
||||
#define s_mp_karatsuba_sqr TclBN_mp_karatsuba_sqr
|
||||
#define s_mp_mul_digs TclBN_s_mp_mul_digs
|
||||
#define s_mp_mul_digs_fast TclBN_fast_s_mp_mul_digs
|
||||
#define s_mp_reverse TclBN_s_mp_reverse
|
||||
#define s_mp_sqr TclBN_s_mp_sqr
|
||||
#define s_mp_sqr_fast TclBN_fast_s_mp_sqr
|
||||
#define s_mp_sub TclBN_s_mp_sub
|
||||
#define s_mp_toom_mul TclBN_mp_toom_mul
|
||||
#define s_mp_toom_sqr TclBN_mp_toom_sqr
|
||||
|
||||
#undef TCL_STORAGE_CLASS
|
||||
#ifdef BUILD_tcl
|
||||
@@ -161,14 +147,11 @@ EXTERN int TclBN_epoch(void);
|
||||
/* 1 */
|
||||
EXTERN int TclBN_revision(void);
|
||||
/* 2 */
|
||||
EXTERN mp_err TclBN_mp_add(const mp_int *a, const mp_int *b,
|
||||
mp_int *c);
|
||||
EXTERN int TclBN_mp_add(mp_int *a, mp_int *b, mp_int *c);
|
||||
/* 3 */
|
||||
EXTERN mp_err TclBN_mp_add_d(const mp_int *a, mp_digit b,
|
||||
mp_int *c);
|
||||
EXTERN int TclBN_mp_add_d(mp_int *a, mp_digit b, mp_int *c);
|
||||
/* 4 */
|
||||
EXTERN mp_err TclBN_mp_and(const mp_int *a, const mp_int *b,
|
||||
mp_int *c);
|
||||
EXTERN int TclBN_mp_and(mp_int *a, mp_int *b, mp_int *c);
|
||||
/* 5 */
|
||||
EXTERN void TclBN_mp_clamp(mp_int *a);
|
||||
/* 6 */
|
||||
@@ -176,177 +159,134 @@ EXTERN void TclBN_mp_clear(mp_int *a);
|
||||
/* 7 */
|
||||
EXTERN void TclBN_mp_clear_multi(mp_int *a, ...);
|
||||
/* 8 */
|
||||
EXTERN mp_ord TclBN_mp_cmp(const mp_int *a, const mp_int *b);
|
||||
EXTERN int TclBN_mp_cmp(const mp_int *a, const mp_int *b);
|
||||
/* 9 */
|
||||
EXTERN mp_ord TclBN_mp_cmp_d(const mp_int *a, mp_digit b);
|
||||
EXTERN int TclBN_mp_cmp_d(const mp_int *a, mp_digit b);
|
||||
/* 10 */
|
||||
EXTERN mp_ord TclBN_mp_cmp_mag(const mp_int *a, const mp_int *b);
|
||||
EXTERN int TclBN_mp_cmp_mag(const mp_int *a, const mp_int *b);
|
||||
/* 11 */
|
||||
EXTERN mp_err TclBN_mp_copy(const mp_int *a, mp_int *b);
|
||||
EXTERN int TclBN_mp_copy(const mp_int *a, mp_int *b);
|
||||
/* 12 */
|
||||
EXTERN int TclBN_mp_count_bits(const mp_int *a);
|
||||
/* 13 */
|
||||
EXTERN mp_err TclBN_mp_div(const mp_int *a, const mp_int *b,
|
||||
mp_int *q, mp_int *r);
|
||||
EXTERN int TclBN_mp_div(mp_int *a, mp_int *b, mp_int *q,
|
||||
mp_int *r);
|
||||
/* 14 */
|
||||
EXTERN mp_err TclBN_mp_div_d(const mp_int *a, mp_digit b,
|
||||
mp_int *q, mp_digit *r);
|
||||
EXTERN int TclBN_mp_div_d(mp_int *a, mp_digit b, mp_int *q,
|
||||
mp_digit *r);
|
||||
/* 15 */
|
||||
EXTERN mp_err TclBN_mp_div_2(const mp_int *a, mp_int *q);
|
||||
EXTERN int TclBN_mp_div_2(mp_int *a, mp_int *q);
|
||||
/* 16 */
|
||||
EXTERN mp_err TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q,
|
||||
EXTERN int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q,
|
||||
mp_int *r);
|
||||
/* 17 */
|
||||
EXTERN mp_err TclBN_mp_div_3(const mp_int *a, mp_int *q,
|
||||
mp_digit *r);
|
||||
EXTERN int TclBN_mp_div_3(mp_int *a, mp_int *q, mp_digit *r);
|
||||
/* 18 */
|
||||
EXTERN void TclBN_mp_exch(mp_int *a, mp_int *b);
|
||||
/* 19 */
|
||||
EXTERN mp_err TclBN_mp_expt_d(const mp_int *a, unsigned int b,
|
||||
mp_int *c);
|
||||
EXTERN int TclBN_mp_expt_d(mp_int *a, mp_digit b, mp_int *c);
|
||||
/* 20 */
|
||||
EXTERN mp_err TclBN_mp_grow(mp_int *a, int size);
|
||||
EXTERN int TclBN_mp_grow(mp_int *a, int size);
|
||||
/* 21 */
|
||||
EXTERN mp_err TclBN_mp_init(mp_int *a);
|
||||
EXTERN int TclBN_mp_init(mp_int *a);
|
||||
/* 22 */
|
||||
EXTERN mp_err TclBN_mp_init_copy(mp_int *a, const mp_int *b);
|
||||
EXTERN int TclBN_mp_init_copy(mp_int *a, mp_int *b);
|
||||
/* 23 */
|
||||
EXTERN mp_err TclBN_mp_init_multi(mp_int *a, ...);
|
||||
EXTERN int TclBN_mp_init_multi(mp_int *a, ...);
|
||||
/* 24 */
|
||||
EXTERN mp_err TclBN_mp_init_set(mp_int *a, mp_digit b);
|
||||
EXTERN int TclBN_mp_init_set(mp_int *a, mp_digit b);
|
||||
/* 25 */
|
||||
EXTERN mp_err TclBN_mp_init_size(mp_int *a, int size);
|
||||
EXTERN int TclBN_mp_init_size(mp_int *a, int size);
|
||||
/* 26 */
|
||||
EXTERN mp_err TclBN_mp_lshd(mp_int *a, int shift);
|
||||
EXTERN int TclBN_mp_lshd(mp_int *a, int shift);
|
||||
/* 27 */
|
||||
EXTERN mp_err TclBN_mp_mod(const mp_int *a, const mp_int *b,
|
||||
mp_int *r);
|
||||
EXTERN int TclBN_mp_mod(mp_int *a, mp_int *b, mp_int *r);
|
||||
/* 28 */
|
||||
EXTERN mp_err TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r);
|
||||
EXTERN int TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r);
|
||||
/* 29 */
|
||||
EXTERN mp_err TclBN_mp_mul(const mp_int *a, const mp_int *b,
|
||||
mp_int *p);
|
||||
EXTERN int TclBN_mp_mul(mp_int *a, mp_int *b, mp_int *p);
|
||||
/* 30 */
|
||||
EXTERN mp_err TclBN_mp_mul_d(const mp_int *a, mp_digit b,
|
||||
mp_int *p);
|
||||
EXTERN int TclBN_mp_mul_d(mp_int *a, mp_digit b, mp_int *p);
|
||||
/* 31 */
|
||||
EXTERN mp_err TclBN_mp_mul_2(const mp_int *a, mp_int *p);
|
||||
EXTERN int TclBN_mp_mul_2(mp_int *a, mp_int *p);
|
||||
/* 32 */
|
||||
EXTERN mp_err TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p);
|
||||
EXTERN int TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p);
|
||||
/* 33 */
|
||||
EXTERN mp_err TclBN_mp_neg(const mp_int *a, mp_int *b);
|
||||
EXTERN int TclBN_mp_neg(const mp_int *a, mp_int *b);
|
||||
/* 34 */
|
||||
EXTERN mp_err TclBN_mp_or(const mp_int *a, const mp_int *b,
|
||||
mp_int *c);
|
||||
EXTERN int TclBN_mp_or(mp_int *a, mp_int *b, mp_int *c);
|
||||
/* 35 */
|
||||
EXTERN mp_err TclBN_mp_radix_size(const mp_int *a, int radix,
|
||||
int *size);
|
||||
EXTERN int TclBN_mp_radix_size(mp_int *a, int radix, int *size);
|
||||
/* 36 */
|
||||
EXTERN mp_err TclBN_mp_read_radix(mp_int *a, const char *str,
|
||||
EXTERN int TclBN_mp_read_radix(mp_int *a, const char *str,
|
||||
int radix);
|
||||
/* 37 */
|
||||
EXTERN void TclBN_mp_rshd(mp_int *a, int shift);
|
||||
/* 38 */
|
||||
EXTERN mp_err TclBN_mp_shrink(mp_int *a);
|
||||
EXTERN int TclBN_mp_shrink(mp_int *a);
|
||||
/* 39 */
|
||||
EXTERN void TclBN_mp_set(mp_int *a, mp_digit b);
|
||||
/* 40 */
|
||||
EXTERN mp_err TclBN_mp_sqr(const mp_int *a, mp_int *b);
|
||||
EXTERN int TclBN_mp_sqr(mp_int *a, mp_int *b);
|
||||
/* 41 */
|
||||
EXTERN mp_err TclBN_mp_sqrt(const mp_int *a, mp_int *b);
|
||||
EXTERN int TclBN_mp_sqrt(mp_int *a, mp_int *b);
|
||||
/* 42 */
|
||||
EXTERN mp_err TclBN_mp_sub(const mp_int *a, const mp_int *b,
|
||||
mp_int *c);
|
||||
EXTERN int TclBN_mp_sub(mp_int *a, mp_int *b, mp_int *c);
|
||||
/* 43 */
|
||||
EXTERN mp_err TclBN_mp_sub_d(const mp_int *a, mp_digit b,
|
||||
mp_int *c);
|
||||
EXTERN int TclBN_mp_sub_d(mp_int *a, mp_digit b, mp_int *c);
|
||||
/* 44 */
|
||||
EXTERN mp_err TclBN_mp_to_unsigned_bin(const mp_int *a,
|
||||
unsigned char *b);
|
||||
EXTERN int TclBN_mp_to_unsigned_bin(mp_int *a, unsigned char *b);
|
||||
/* 45 */
|
||||
EXTERN mp_err TclBN_mp_to_unsigned_bin_n(const mp_int *a,
|
||||
EXTERN int TclBN_mp_to_unsigned_bin_n(mp_int *a,
|
||||
unsigned char *b, unsigned long *outlen);
|
||||
/* 46 */
|
||||
EXTERN mp_err TclBN_mp_toradix_n(const mp_int *a, char *str,
|
||||
int radix, int maxlen);
|
||||
EXTERN int TclBN_mp_toradix_n(mp_int *a, char *str, int radix,
|
||||
int maxlen);
|
||||
/* 47 */
|
||||
EXTERN size_t TclBN_mp_unsigned_bin_size(const mp_int *a);
|
||||
EXTERN int TclBN_mp_unsigned_bin_size(mp_int *a);
|
||||
/* 48 */
|
||||
EXTERN mp_err TclBN_mp_xor(const mp_int *a, const mp_int *b,
|
||||
mp_int *c);
|
||||
EXTERN int TclBN_mp_xor(mp_int *a, mp_int *b, mp_int *c);
|
||||
/* 49 */
|
||||
EXTERN void TclBN_mp_zero(mp_int *a);
|
||||
/* 50 */
|
||||
EXTERN void TclBN_reverse(unsigned char *s, int len);
|
||||
/* 51 */
|
||||
EXTERN mp_err TclBN_fast_s_mp_mul_digs(const mp_int *a,
|
||||
const mp_int *b, mp_int *c, int digs);
|
||||
/* 52 */
|
||||
EXTERN mp_err TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b);
|
||||
/* 53 */
|
||||
EXTERN mp_err TclBN_mp_karatsuba_mul(const mp_int *a,
|
||||
const mp_int *b, mp_int *c);
|
||||
/* 54 */
|
||||
EXTERN mp_err TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b);
|
||||
/* 55 */
|
||||
EXTERN mp_err TclBN_mp_toom_mul(const mp_int *a, const mp_int *b,
|
||||
mp_int *c);
|
||||
/* 56 */
|
||||
EXTERN mp_err TclBN_mp_toom_sqr(const mp_int *a, mp_int *b);
|
||||
/* 57 */
|
||||
EXTERN mp_err TclBN_s_mp_add(const mp_int *a, const mp_int *b,
|
||||
mp_int *c);
|
||||
/* 58 */
|
||||
EXTERN mp_err TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b,
|
||||
EXTERN int TclBN_fast_s_mp_mul_digs(mp_int *a, mp_int *b,
|
||||
mp_int *c, int digs);
|
||||
/* 59 */
|
||||
EXTERN mp_err TclBN_s_mp_sqr(const mp_int *a, mp_int *b);
|
||||
/* 60 */
|
||||
EXTERN mp_err TclBN_s_mp_sub(const mp_int *a, const mp_int *b,
|
||||
/* 52 */
|
||||
EXTERN int TclBN_fast_s_mp_sqr(mp_int *a, mp_int *b);
|
||||
/* 53 */
|
||||
EXTERN int TclBN_mp_karatsuba_mul(mp_int *a, mp_int *b,
|
||||
mp_int *c);
|
||||
/* 54 */
|
||||
EXTERN int TclBN_mp_karatsuba_sqr(mp_int *a, mp_int *b);
|
||||
/* 55 */
|
||||
EXTERN int TclBN_mp_toom_mul(mp_int *a, mp_int *b, mp_int *c);
|
||||
/* 56 */
|
||||
EXTERN int TclBN_mp_toom_sqr(mp_int *a, mp_int *b);
|
||||
/* 57 */
|
||||
EXTERN int TclBN_s_mp_add(mp_int *a, mp_int *b, mp_int *c);
|
||||
/* 58 */
|
||||
EXTERN int TclBN_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c,
|
||||
int digs);
|
||||
/* 59 */
|
||||
EXTERN int TclBN_s_mp_sqr(mp_int *a, mp_int *b);
|
||||
/* 60 */
|
||||
EXTERN int TclBN_s_mp_sub(mp_int *a, mp_int *b, mp_int *c);
|
||||
/* 61 */
|
||||
EXTERN mp_err TclBN_mp_init_set_int(mp_int *a, unsigned long i);
|
||||
EXTERN int TclBN_mp_init_set_int(mp_int *a, unsigned long i);
|
||||
/* 62 */
|
||||
EXTERN mp_err TclBN_mp_set_int(mp_int *a, unsigned long i);
|
||||
EXTERN int TclBN_mp_set_int(mp_int *a, unsigned long i);
|
||||
/* 63 */
|
||||
EXTERN int TclBN_mp_cnt_lsb(const mp_int *a);
|
||||
/* 64 */
|
||||
EXTERN int TclBNInitBignumFromLong(mp_int *bignum, long initVal);
|
||||
EXTERN void TclBNInitBignumFromLong(mp_int *bignum, long initVal);
|
||||
/* 65 */
|
||||
EXTERN int TclBNInitBignumFromWideInt(mp_int *bignum,
|
||||
EXTERN void TclBNInitBignumFromWideInt(mp_int *bignum,
|
||||
Tcl_WideInt initVal);
|
||||
/* 66 */
|
||||
EXTERN int TclBNInitBignumFromWideUInt(mp_int *bignum,
|
||||
EXTERN void TclBNInitBignumFromWideUInt(mp_int *bignum,
|
||||
Tcl_WideUInt initVal);
|
||||
/* 67 */
|
||||
EXTERN mp_err TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b,
|
||||
mp_int *c, int fast);
|
||||
/* 68 */
|
||||
EXTERN void TclBN_mp_set_ull(mp_int *a, Tcl_WideUInt i);
|
||||
/* Slot 69 is reserved */
|
||||
/* Slot 70 is reserved */
|
||||
/* Slot 71 is reserved */
|
||||
/* Slot 72 is reserved */
|
||||
/* 73 */
|
||||
EXTERN mp_err TclBN_mp_tc_and(const mp_int *a, const mp_int *b,
|
||||
mp_int *c);
|
||||
/* 74 */
|
||||
EXTERN mp_err TclBN_mp_tc_or(const mp_int *a, const mp_int *b,
|
||||
mp_int *c);
|
||||
/* 75 */
|
||||
EXTERN mp_err TclBN_mp_tc_xor(const mp_int *a, const mp_int *b,
|
||||
mp_int *c);
|
||||
/* 76 */
|
||||
EXTERN mp_err TclBN_mp_signed_rsh(const mp_int *a, int b,
|
||||
mp_int *c);
|
||||
/* Slot 77 is reserved */
|
||||
/* 78 */
|
||||
EXTERN int TclBN_mp_to_ubin(const mp_int *a, unsigned char *buf,
|
||||
size_t maxlen, size_t *written);
|
||||
/* Slot 79 is reserved */
|
||||
/* 80 */
|
||||
EXTERN int TclBN_mp_to_radix(const mp_int *a, char *str,
|
||||
size_t maxlen, size_t *written, int radix);
|
||||
|
||||
typedef struct TclTomMathStubs {
|
||||
int magic;
|
||||
@@ -354,85 +294,71 @@ typedef struct TclTomMathStubs {
|
||||
|
||||
int (*tclBN_epoch) (void); /* 0 */
|
||||
int (*tclBN_revision) (void); /* 1 */
|
||||
mp_err (*tclBN_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 2 */
|
||||
mp_err (*tclBN_mp_add_d) (const mp_int *a, mp_digit b, mp_int *c); /* 3 */
|
||||
mp_err (*tclBN_mp_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 4 */
|
||||
int (*tclBN_mp_add) (mp_int *a, mp_int *b, mp_int *c); /* 2 */
|
||||
int (*tclBN_mp_add_d) (mp_int *a, mp_digit b, mp_int *c); /* 3 */
|
||||
int (*tclBN_mp_and) (mp_int *a, mp_int *b, mp_int *c); /* 4 */
|
||||
void (*tclBN_mp_clamp) (mp_int *a); /* 5 */
|
||||
void (*tclBN_mp_clear) (mp_int *a); /* 6 */
|
||||
void (*tclBN_mp_clear_multi) (mp_int *a, ...); /* 7 */
|
||||
mp_ord (*tclBN_mp_cmp) (const mp_int *a, const mp_int *b); /* 8 */
|
||||
mp_ord (*tclBN_mp_cmp_d) (const mp_int *a, mp_digit b); /* 9 */
|
||||
mp_ord (*tclBN_mp_cmp_mag) (const mp_int *a, const mp_int *b); /* 10 */
|
||||
mp_err (*tclBN_mp_copy) (const mp_int *a, mp_int *b); /* 11 */
|
||||
int (*tclBN_mp_cmp) (const mp_int *a, const mp_int *b); /* 8 */
|
||||
int (*tclBN_mp_cmp_d) (const mp_int *a, mp_digit b); /* 9 */
|
||||
int (*tclBN_mp_cmp_mag) (const mp_int *a, const mp_int *b); /* 10 */
|
||||
int (*tclBN_mp_copy) (const mp_int *a, mp_int *b); /* 11 */
|
||||
int (*tclBN_mp_count_bits) (const mp_int *a); /* 12 */
|
||||
mp_err (*tclBN_mp_div) (const mp_int *a, const mp_int *b, mp_int *q, mp_int *r); /* 13 */
|
||||
mp_err (*tclBN_mp_div_d) (const mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 14 */
|
||||
mp_err (*tclBN_mp_div_2) (const mp_int *a, mp_int *q); /* 15 */
|
||||
mp_err (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r); /* 16 */
|
||||
mp_err (*tclBN_mp_div_3) (const mp_int *a, mp_int *q, mp_digit *r); /* 17 */
|
||||
int (*tclBN_mp_div) (mp_int *a, mp_int *b, mp_int *q, mp_int *r); /* 13 */
|
||||
int (*tclBN_mp_div_d) (mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 14 */
|
||||
int (*tclBN_mp_div_2) (mp_int *a, mp_int *q); /* 15 */
|
||||
int (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r); /* 16 */
|
||||
int (*tclBN_mp_div_3) (mp_int *a, mp_int *q, mp_digit *r); /* 17 */
|
||||
void (*tclBN_mp_exch) (mp_int *a, mp_int *b); /* 18 */
|
||||
mp_err (*tclBN_mp_expt_d) (const mp_int *a, unsigned int b, mp_int *c); /* 19 */
|
||||
mp_err (*tclBN_mp_grow) (mp_int *a, int size); /* 20 */
|
||||
mp_err (*tclBN_mp_init) (mp_int *a); /* 21 */
|
||||
mp_err (*tclBN_mp_init_copy) (mp_int *a, const mp_int *b); /* 22 */
|
||||
mp_err (*tclBN_mp_init_multi) (mp_int *a, ...); /* 23 */
|
||||
mp_err (*tclBN_mp_init_set) (mp_int *a, mp_digit b); /* 24 */
|
||||
mp_err (*tclBN_mp_init_size) (mp_int *a, int size); /* 25 */
|
||||
mp_err (*tclBN_mp_lshd) (mp_int *a, int shift); /* 26 */
|
||||
mp_err (*tclBN_mp_mod) (const mp_int *a, const mp_int *b, mp_int *r); /* 27 */
|
||||
mp_err (*tclBN_mp_mod_2d) (const mp_int *a, int b, mp_int *r); /* 28 */
|
||||
mp_err (*tclBN_mp_mul) (const mp_int *a, const mp_int *b, mp_int *p); /* 29 */
|
||||
mp_err (*tclBN_mp_mul_d) (const mp_int *a, mp_digit b, mp_int *p); /* 30 */
|
||||
mp_err (*tclBN_mp_mul_2) (const mp_int *a, mp_int *p); /* 31 */
|
||||
mp_err (*tclBN_mp_mul_2d) (const mp_int *a, int d, mp_int *p); /* 32 */
|
||||
mp_err (*tclBN_mp_neg) (const mp_int *a, mp_int *b); /* 33 */
|
||||
mp_err (*tclBN_mp_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 34 */
|
||||
mp_err (*tclBN_mp_radix_size) (const mp_int *a, int radix, int *size); /* 35 */
|
||||
mp_err (*tclBN_mp_read_radix) (mp_int *a, const char *str, int radix); /* 36 */
|
||||
int (*tclBN_mp_expt_d) (mp_int *a, mp_digit b, mp_int *c); /* 19 */
|
||||
int (*tclBN_mp_grow) (mp_int *a, int size); /* 20 */
|
||||
int (*tclBN_mp_init) (mp_int *a); /* 21 */
|
||||
int (*tclBN_mp_init_copy) (mp_int *a, mp_int *b); /* 22 */
|
||||
int (*tclBN_mp_init_multi) (mp_int *a, ...); /* 23 */
|
||||
int (*tclBN_mp_init_set) (mp_int *a, mp_digit b); /* 24 */
|
||||
int (*tclBN_mp_init_size) (mp_int *a, int size); /* 25 */
|
||||
int (*tclBN_mp_lshd) (mp_int *a, int shift); /* 26 */
|
||||
int (*tclBN_mp_mod) (mp_int *a, mp_int *b, mp_int *r); /* 27 */
|
||||
int (*tclBN_mp_mod_2d) (const mp_int *a, int b, mp_int *r); /* 28 */
|
||||
int (*tclBN_mp_mul) (mp_int *a, mp_int *b, mp_int *p); /* 29 */
|
||||
int (*tclBN_mp_mul_d) (mp_int *a, mp_digit b, mp_int *p); /* 30 */
|
||||
int (*tclBN_mp_mul_2) (mp_int *a, mp_int *p); /* 31 */
|
||||
int (*tclBN_mp_mul_2d) (const mp_int *a, int d, mp_int *p); /* 32 */
|
||||
int (*tclBN_mp_neg) (const mp_int *a, mp_int *b); /* 33 */
|
||||
int (*tclBN_mp_or) (mp_int *a, mp_int *b, mp_int *c); /* 34 */
|
||||
int (*tclBN_mp_radix_size) (mp_int *a, int radix, int *size); /* 35 */
|
||||
int (*tclBN_mp_read_radix) (mp_int *a, const char *str, int radix); /* 36 */
|
||||
void (*tclBN_mp_rshd) (mp_int *a, int shift); /* 37 */
|
||||
mp_err (*tclBN_mp_shrink) (mp_int *a); /* 38 */
|
||||
int (*tclBN_mp_shrink) (mp_int *a); /* 38 */
|
||||
void (*tclBN_mp_set) (mp_int *a, mp_digit b); /* 39 */
|
||||
mp_err (*tclBN_mp_sqr) (const mp_int *a, mp_int *b); /* 40 */
|
||||
mp_err (*tclBN_mp_sqrt) (const mp_int *a, mp_int *b); /* 41 */
|
||||
mp_err (*tclBN_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 42 */
|
||||
mp_err (*tclBN_mp_sub_d) (const mp_int *a, mp_digit b, mp_int *c); /* 43 */
|
||||
mp_err (*tclBN_mp_to_unsigned_bin) (const mp_int *a, unsigned char *b); /* 44 */
|
||||
mp_err (*tclBN_mp_to_unsigned_bin_n) (const mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */
|
||||
mp_err (*tclBN_mp_toradix_n) (const mp_int *a, char *str, int radix, int maxlen); /* 46 */
|
||||
size_t (*tclBN_mp_unsigned_bin_size) (const mp_int *a); /* 47 */
|
||||
mp_err (*tclBN_mp_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 48 */
|
||||
int (*tclBN_mp_sqr) (mp_int *a, mp_int *b); /* 40 */
|
||||
int (*tclBN_mp_sqrt) (mp_int *a, mp_int *b); /* 41 */
|
||||
int (*tclBN_mp_sub) (mp_int *a, mp_int *b, mp_int *c); /* 42 */
|
||||
int (*tclBN_mp_sub_d) (mp_int *a, mp_digit b, mp_int *c); /* 43 */
|
||||
int (*tclBN_mp_to_unsigned_bin) (mp_int *a, unsigned char *b); /* 44 */
|
||||
int (*tclBN_mp_to_unsigned_bin_n) (mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */
|
||||
int (*tclBN_mp_toradix_n) (mp_int *a, char *str, int radix, int maxlen); /* 46 */
|
||||
int (*tclBN_mp_unsigned_bin_size) (mp_int *a); /* 47 */
|
||||
int (*tclBN_mp_xor) (mp_int *a, mp_int *b, mp_int *c); /* 48 */
|
||||
void (*tclBN_mp_zero) (mp_int *a); /* 49 */
|
||||
void (*tclBN_reverse) (unsigned char *s, int len); /* 50 */
|
||||
mp_err (*tclBN_fast_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 51 */
|
||||
mp_err (*tclBN_fast_s_mp_sqr) (const mp_int *a, mp_int *b); /* 52 */
|
||||
mp_err (*tclBN_mp_karatsuba_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 53 */
|
||||
mp_err (*tclBN_mp_karatsuba_sqr) (const mp_int *a, mp_int *b); /* 54 */
|
||||
mp_err (*tclBN_mp_toom_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 55 */
|
||||
mp_err (*tclBN_mp_toom_sqr) (const mp_int *a, mp_int *b); /* 56 */
|
||||
mp_err (*tclBN_s_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 57 */
|
||||
mp_err (*tclBN_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 58 */
|
||||
mp_err (*tclBN_s_mp_sqr) (const mp_int *a, mp_int *b); /* 59 */
|
||||
mp_err (*tclBN_s_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 60 */
|
||||
mp_err (*tclBN_mp_init_set_int) (mp_int *a, unsigned long i); /* 61 */
|
||||
mp_err (*tclBN_mp_set_int) (mp_int *a, unsigned long i); /* 62 */
|
||||
int (*tclBN_fast_s_mp_mul_digs) (mp_int *a, mp_int *b, mp_int *c, int digs); /* 51 */
|
||||
int (*tclBN_fast_s_mp_sqr) (mp_int *a, mp_int *b); /* 52 */
|
||||
int (*tclBN_mp_karatsuba_mul) (mp_int *a, mp_int *b, mp_int *c); /* 53 */
|
||||
int (*tclBN_mp_karatsuba_sqr) (mp_int *a, mp_int *b); /* 54 */
|
||||
int (*tclBN_mp_toom_mul) (mp_int *a, mp_int *b, mp_int *c); /* 55 */
|
||||
int (*tclBN_mp_toom_sqr) (mp_int *a, mp_int *b); /* 56 */
|
||||
int (*tclBN_s_mp_add) (mp_int *a, mp_int *b, mp_int *c); /* 57 */
|
||||
int (*tclBN_s_mp_mul_digs) (mp_int *a, mp_int *b, mp_int *c, int digs); /* 58 */
|
||||
int (*tclBN_s_mp_sqr) (mp_int *a, mp_int *b); /* 59 */
|
||||
int (*tclBN_s_mp_sub) (mp_int *a, mp_int *b, mp_int *c); /* 60 */
|
||||
int (*tclBN_mp_init_set_int) (mp_int *a, unsigned long i); /* 61 */
|
||||
int (*tclBN_mp_set_int) (mp_int *a, unsigned long i); /* 62 */
|
||||
int (*tclBN_mp_cnt_lsb) (const mp_int *a); /* 63 */
|
||||
int (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */
|
||||
int (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */
|
||||
int (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */
|
||||
mp_err (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */
|
||||
void (*tclBN_mp_set_ull) (mp_int *a, Tcl_WideUInt i); /* 68 */
|
||||
void (*reserved69)(void);
|
||||
void (*reserved70)(void);
|
||||
void (*reserved71)(void);
|
||||
void (*reserved72)(void);
|
||||
mp_err (*tclBN_mp_tc_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 73 */
|
||||
mp_err (*tclBN_mp_tc_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 74 */
|
||||
mp_err (*tclBN_mp_tc_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 75 */
|
||||
mp_err (*tclBN_mp_signed_rsh) (const mp_int *a, int b, mp_int *c); /* 76 */
|
||||
void (*reserved77)(void);
|
||||
int (*tclBN_mp_to_ubin) (const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written); /* 78 */
|
||||
void (*reserved79)(void);
|
||||
int (*tclBN_mp_to_radix) (const mp_int *a, char *str, size_t maxlen, size_t *written, int radix); /* 80 */
|
||||
void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */
|
||||
void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */
|
||||
void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */
|
||||
} TclTomMathStubs;
|
||||
|
||||
extern const TclTomMathStubs *tclTomMathStubsPtr;
|
||||
@@ -581,28 +507,6 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
|
||||
(tclTomMathStubsPtr->tclBNInitBignumFromWideInt) /* 65 */
|
||||
#define TclBNInitBignumFromWideUInt \
|
||||
(tclTomMathStubsPtr->tclBNInitBignumFromWideUInt) /* 66 */
|
||||
#define TclBN_mp_expt_d_ex \
|
||||
(tclTomMathStubsPtr->tclBN_mp_expt_d_ex) /* 67 */
|
||||
#define TclBN_mp_set_ull \
|
||||
(tclTomMathStubsPtr->tclBN_mp_set_ull) /* 68 */
|
||||
/* Slot 69 is reserved */
|
||||
/* Slot 70 is reserved */
|
||||
/* Slot 71 is reserved */
|
||||
/* Slot 72 is reserved */
|
||||
#define TclBN_mp_tc_and \
|
||||
(tclTomMathStubsPtr->tclBN_mp_tc_and) /* 73 */
|
||||
#define TclBN_mp_tc_or \
|
||||
(tclTomMathStubsPtr->tclBN_mp_tc_or) /* 74 */
|
||||
#define TclBN_mp_tc_xor \
|
||||
(tclTomMathStubsPtr->tclBN_mp_tc_xor) /* 75 */
|
||||
#define TclBN_mp_signed_rsh \
|
||||
(tclTomMathStubsPtr->tclBN_mp_signed_rsh) /* 76 */
|
||||
/* Slot 77 is reserved */
|
||||
#define TclBN_mp_to_ubin \
|
||||
(tclTomMathStubsPtr->tclBN_mp_to_ubin) /* 78 */
|
||||
/* Slot 79 is reserved */
|
||||
#define TclBN_mp_to_radix \
|
||||
(tclTomMathStubsPtr->tclBN_mp_to_radix) /* 80 */
|
||||
|
||||
#endif /* defined(USE_TCL_STUBS) */
|
||||
|
||||
@@ -611,50 +515,4 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
|
||||
#undef TCL_STORAGE_CLASS
|
||||
#define TCL_STORAGE_CLASS DLLIMPORT
|
||||
|
||||
#ifdef USE_TCL_STUBS
|
||||
#undef TclBNInitBignumFromLong
|
||||
#define TclBNInitBignumFromLong(a,b) \
|
||||
do { \
|
||||
(a)->dp = NULL; \
|
||||
(void)tclTomMathStubsPtr->tclBNInitBignumFromLong((a),(b)); \
|
||||
if ((a)->dp == NULL) { \
|
||||
Tcl_Panic("initialization failure in TclBNInitBignumFromLong"); \
|
||||
} \
|
||||
} while (0)
|
||||
#undef TclBNInitBignumFromWideInt
|
||||
#define TclBNInitBignumFromWideInt(a,b) \
|
||||
do { \
|
||||
(a)->dp = NULL; \
|
||||
(void)tclTomMathStubsPtr->tclBNInitBignumFromWideInt((a),(b)); \
|
||||
if ((a)->dp == NULL) { \
|
||||
Tcl_Panic("initialization failure in TclBNInitBignumFromWideInt"); \
|
||||
} \
|
||||
} while (0)
|
||||
#undef TclBNInitBignumFromWideUInt
|
||||
#define TclBNInitBignumFromWideUInt(a,b) \
|
||||
do { \
|
||||
(a)->dp = NULL; \
|
||||
(void)tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(b)); \
|
||||
if ((a)->dp == NULL) { \
|
||||
Tcl_Panic("initialization failure in TclBNInitBignumFromWideUInt"); \
|
||||
} \
|
||||
} while (0)
|
||||
#define mp_init_i32(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromLong((a),(int32_t)(b)),(a)->dp)?MP_OKAY:MP_ERR)
|
||||
#define mp_init_l(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromLong((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
|
||||
#define mp_init_ll(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideInt((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
|
||||
#define mp_init_i64(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideInt((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
|
||||
#define mp_init_u32(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(uint32_t)(b)),(a)->dp)?MP_OKAY:MP_ERR)
|
||||
#define mp_init_ul(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(unsigned long)(b)),(a)->dp)?MP_OKAY:MP_ERR)
|
||||
#define mp_init_ull(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
|
||||
#define mp_init_u64(a,b) (((a)->dp=NULL,tclTomMathStubsPtr->tclBNInitBignumFromWideUInt((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
|
||||
#else
|
||||
#define mp_init_i32(a,b) (((a)->dp=NULL,(TclBNInitBignumFromLong)((a),(int32_t)(b)),(a)->dp)?MP_OKAY:MP_ERR)
|
||||
#define mp_init_l(a,b) (((a)->dp=NULL,(TclBNInitBignumFromLong)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
|
||||
#define mp_init_ll(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideInt)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
|
||||
#define mp_init_i64(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideInt)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
|
||||
#define mp_init_u32(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideUInt)((a),(uint32_t)(b)),(a)->dp)?MP_OKAY:MP_ERR)
|
||||
#define mp_init_ul(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideUInt)((a),(unsigned long)(b)),(a)->dp)?MP_OKAY:MP_ERR)
|
||||
#define mp_init_ull(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideUInt)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
|
||||
#define mp_init_u64(a,b) (((a)->dp=NULL,(TclBNInitBignumFromWideUInt)((a),(b)),(a)->dp)?MP_OKAY:MP_ERR)
|
||||
#endif /* USE_TCL_STUBS */
|
||||
#endif /* _TCLINTDECLS */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user