Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8841ba90ee | ||
|
|
8f67ae04ad | ||
|
|
baa813085d | ||
|
|
e06feb86b1 | ||
|
|
3ec8472d74 | ||
|
|
8a0a2779c2 | ||
|
|
1c6fae0193 | ||
|
|
871fc208e1 | ||
|
|
374f5c6e1a | ||
|
|
fc702f65d2 | ||
|
|
60169c7187 | ||
|
|
9cb33ddcc5 | ||
|
|
c942ef369b | ||
|
|
bf055cc0d8 | ||
|
|
32a76688f6 | ||
|
|
ccfe3f47fd | ||
|
|
c993263332 | ||
|
|
28ddee7d18 | ||
|
|
0b6db319f0 | ||
|
|
845442b102 | ||
|
|
c89d776dce | ||
|
|
09b6123a09 | ||
|
|
06464aa3be | ||
|
|
f23820c00b | ||
|
|
87508b74e0 | ||
|
|
16ddac314c | ||
|
|
9f61e10cf9 | ||
|
|
a396843006 | ||
|
|
c614920819 | ||
|
|
051a1473cb | ||
|
|
571eeda5cf | ||
|
|
cf9fc355f8 | ||
|
|
7deb6f2082 | ||
|
|
b1e4f0fa23 | ||
|
|
c318d73bd3 | ||
|
|
459073607d | ||
|
|
0d7132ebb2 | ||
|
|
2e06c053b4 | ||
|
|
4f93205802 | ||
|
|
023286a7fd | ||
|
|
7bb103b64e | ||
|
|
3ed1f7b055 | ||
|
|
67e4ed2290 | ||
|
|
e287e35105 | ||
|
|
0b8bd54063 | ||
|
|
a463bf5525 | ||
|
|
6c72d33ef1 | ||
|
|
ee577ebd90 | ||
|
|
2b508d7964 | ||
|
|
0dcddf9cf0 | ||
|
|
79fd04384a | ||
|
|
6792b8a53c | ||
|
|
06813163a8 | ||
|
|
a1ab68d1ea | ||
|
|
83025a44e0 | ||
|
|
85d1500c50 | ||
|
|
15b5f31caf | ||
|
|
226bb13f4e | ||
|
|
7f4cc308f3 | ||
|
|
42c960506d | ||
|
|
970479b4ee | ||
|
|
55f8e3ac01 | ||
|
|
c494f8045e | ||
|
|
756e0c234a | ||
|
|
1c4c352fe9 | ||
|
|
743881d3ce | ||
|
|
3628bed3ba | ||
|
|
d1bd0f28ef | ||
|
|
e5991250e0 | ||
|
|
55bb44b8be | ||
|
|
5ca6887e66 | ||
|
|
4c25696376 | ||
|
|
9406745440 | ||
|
|
9b5af56932 | ||
|
|
107f7173d2 | ||
|
|
73953be8b1 | ||
|
|
63f4be3aa2 | ||
|
|
2dab8fa488 | ||
|
|
1f1f43fcd2 | ||
|
|
c8617b374b | ||
|
|
9eb5b14a3c | ||
|
|
79b9ab1039 | ||
|
|
6c6a470c2b | ||
|
|
3b6d7d6119 | ||
|
|
0f632bd1c5 | ||
|
|
d63f456a83 | ||
|
|
9e6945739a | ||
|
|
c49b98fa6b | ||
|
|
8a9eba41a2 | ||
|
|
dd9f3c1246 | ||
|
|
4e90ccc6db | ||
|
|
d5479489aa | ||
|
|
c39345b47a | ||
|
|
fff5060d94 | ||
|
|
f2cb38dda9 | ||
|
|
e6d6e2962d | ||
|
|
80af639d39 | ||
|
|
8390478dbf | ||
|
|
2b7eb65f53 | ||
|
|
260c7e595a | ||
|
|
a3ae9d7e57 | ||
|
|
8df980fc3e | ||
|
|
3aa4b20ea8 | ||
|
|
6da553ec22 | ||
|
|
c84e03a7a8 | ||
|
|
4b3814f752 | ||
|
|
15849c859a | ||
|
|
90040e0573 | ||
|
|
0013597b33 | ||
|
|
c54d29df06 | ||
|
|
6e657cfb83 | ||
|
|
57bf9fe12f | ||
|
|
1f2858fefd | ||
|
|
2d6586915f | ||
|
|
a132514652 | ||
|
|
b0e0d4b618 | ||
|
|
58fb98d8a9 | ||
|
|
be3426d527 | ||
|
|
2ea2ef0609 | ||
|
|
d0443e229f | ||
|
|
f223db50fd | ||
|
|
07c6dc0d49 | ||
|
|
0834bb4547 | ||
|
|
50b24193de | ||
|
|
a2b56f4c74 | ||
|
|
0255b9c343 | ||
|
|
764ef9b409 | ||
|
|
8aca3246ab | ||
|
|
c197ddb3b2 | ||
|
|
3b584dd13f | ||
|
|
25bbbbf3ee | ||
|
|
b9bc37e2b8 | ||
|
|
a1d8e47ea7 | ||
|
|
dd7f073e8b | ||
|
|
a085ffdd43 | ||
|
|
063e006111 | ||
|
|
19bfe564de | ||
|
|
3f89004e37 | ||
|
|
bebf0454f6 | ||
|
|
4355668c80 | ||
|
|
5a2a021cd4 | ||
|
|
6433d6a30b | ||
|
|
ae9d23eae8 | ||
|
|
773a30a541 | ||
|
|
895a4597bc | ||
|
|
b697c844ad | ||
|
|
7c54d7ca1d | ||
|
|
1ac55b7d3f | ||
|
|
6293939296 | ||
|
|
a97e3eef6d | ||
|
|
d134d35fef | ||
|
|
e5153a8d0c | ||
|
|
5c8ce61f79 | ||
|
|
4723df2a35 | ||
|
|
c0f6db4b81 | ||
|
|
06ea55d820 | ||
|
|
eb9f949b2c | ||
|
|
8242d1a544 | ||
|
|
e3afa12420 | ||
|
|
7bfe776283 | ||
|
|
bdd6e3f4df | ||
|
|
185b0d1493 | ||
|
|
345894cae9 | ||
|
|
f4032799de | ||
|
|
957890bf54 | ||
|
|
f2c4a32d7f | ||
|
|
cf0af45b5a | ||
|
|
042e9a4f8a | ||
|
|
28d58d74b0 | ||
|
|
6067ce5573 | ||
|
|
39a8b9813a | ||
|
|
467337387f | ||
|
|
6ee6cd1ae4 | ||
|
|
b3d34ad317 | ||
|
|
499e962572 | ||
|
|
0b9b440ce0 | ||
|
|
8844e2789a | ||
|
|
532506ea20 | ||
|
|
5fd34b8806 | ||
|
|
bb836a3071 | ||
|
|
999decddb3 | ||
|
|
3001f87063 | ||
|
|
94c40f8b71 | ||
|
|
635b0327a6 | ||
|
|
4b639c1ec5 | ||
|
|
5dc64243f3 | ||
|
|
d97e25b2ad | ||
|
|
3eb07e538c | ||
|
|
cb794e731c | ||
|
|
c6e348a28b | ||
|
|
b4660a7ff9 | ||
|
|
3bbf07a495 | ||
|
|
13b1a0635f | ||
|
|
90565904aa | ||
|
|
73745cbfbf | ||
|
|
ab91723185 | ||
|
|
5eba4fa4d7 | ||
|
|
0d7614dd81 | ||
|
|
6fcd32ac08 | ||
|
|
73277b178e | ||
|
|
21d34a1956 | ||
|
|
7b662b613d | ||
|
|
42e3415106 | ||
|
|
840ba03059 | ||
|
|
89fa1f862f | ||
|
|
c1a56eb2d1 | ||
|
|
a4bf99fa2c | ||
|
|
dfd4a2e5c1 | ||
|
|
c0cb466a86 | ||
|
|
24128f43df | ||
|
|
ea4e2c5432 | ||
|
|
d12eee4a39 | ||
|
|
2ba1ef3db1 | ||
|
|
6e603480b3 | ||
|
|
aeeb808b30 | ||
|
|
0043160893 | ||
|
|
af4a77f3e3 | ||
|
|
5740a9e3d2 | ||
|
|
ebf4c78ed8 | ||
|
|
8395974e1b | ||
|
|
6f3b0bd108 | ||
|
|
b142586b21 | ||
|
|
32dc9b67a9 | ||
|
|
6efc470726 | ||
|
|
fa2bb177eb | ||
|
|
7104004d57 | ||
|
|
fed1ff66dc | ||
|
|
d9e28af5f3 | ||
|
|
392c7ad8eb | ||
|
|
3a18a03f3d | ||
|
|
c09ddd48e3 | ||
|
|
0d69fc832e | ||
|
|
6e97fd01b0 | ||
|
|
e2c482312c | ||
|
|
00e0788723 | ||
|
|
3aab127556 | ||
|
|
58625c6ba9 | ||
|
|
2cf339ce3b | ||
|
|
57f9c7dae5 | ||
|
|
f6c86d7972 | ||
|
|
1fb596128b | ||
|
|
2cb77a221b | ||
|
|
33b2c94323 | ||
|
|
8d49123e73 | ||
|
|
9c024d9d3b | ||
|
|
82f2bed5fe | ||
|
|
6b29884385 | ||
|
|
06f42e40b2 | ||
|
|
2ff8145561 | ||
|
|
581d7fccf5 | ||
|
|
05b6284310 | ||
|
|
2ee9e74ac6 | ||
|
|
ba3f00d403 | ||
|
|
f837b2ca92 | ||
|
|
6724e74377 | ||
|
|
29c768d6c9 | ||
|
|
458c3e9cc5 | ||
|
|
31e49b4c7c | ||
|
|
298c9aa866 | ||
|
|
4612b57a1e | ||
|
|
b02ecd46ec | ||
|
|
f050bae793 | ||
|
|
b2cabbf79c | ||
|
|
14ab9ebc55 | ||
|
|
298a0ffc19 | ||
|
|
ea1fdc511d | ||
|
|
207a4b3122 | ||
|
|
2b394dc55d | ||
|
|
ab2df51726 | ||
|
|
e9dfa3ed3c | ||
|
|
ca8cef9587 | ||
|
|
0befd21328 | ||
|
|
f0e85a15a0 | ||
|
|
80c04f15f3 | ||
|
|
b633ee636f | ||
|
|
cbe4ab7b6a | ||
|
|
f6f8bdc72d | ||
|
|
a096c64c32 | ||
|
|
a9f031fc1a | ||
|
|
2e5746d60c | ||
|
|
850c978dcc | ||
|
|
5a3587a3ad | ||
|
|
3345a310b6 | ||
|
|
9038dae6fe | ||
|
|
817e391ddb | ||
|
|
011e7c1e5f | ||
|
|
040818e1db | ||
|
|
7a3766376f | ||
|
|
f387d58e76 | ||
|
|
afe025dc93 | ||
|
|
81e7dac314 | ||
|
|
dbd3f823aa | ||
|
|
78d6e8f34c | ||
|
|
a7bc79bffb | ||
|
|
0cd0d2191b | ||
|
|
071381e984 | ||
|
|
5f79368eaf | ||
|
|
aa7bf1b2e1 | ||
|
|
370b557389 | ||
|
|
711adf15f9 | ||
|
|
a14063d19a | ||
|
|
7ff4e84af2 | ||
|
|
60ca614740 | ||
|
|
473d9adddc | ||
|
|
089b997044 | ||
|
|
b61dbff448 | ||
|
|
4e3cd053db | ||
|
|
70da19ccf0 | ||
|
|
4206bf2818 | ||
|
|
a9c9e46669 | ||
|
|
3edc49c702 | ||
|
|
0872562c80 | ||
|
|
f09dcac785 | ||
|
|
6b7dec8d6a | ||
|
|
ad4c7a03b7 | ||
|
|
76fd53b302 | ||
|
|
7a36f11216 | ||
|
|
fed0f920e1 | ||
|
|
4f237d732e | ||
|
|
1227eed18e | ||
|
|
a21daf36ae | ||
|
|
2a2321bf6a | ||
|
|
5c3f6b06b7 | ||
|
|
3005927df1 | ||
|
|
0a38e523d3 | ||
|
|
f39dee95d7 | ||
|
|
124e36102e | ||
|
|
fb6da59e2f | ||
|
|
279c0829fc | ||
|
|
3b7c040233 | ||
|
|
c040d037ef | ||
|
|
2f9727a745 | ||
|
|
b24275a7c4 | ||
|
|
9f96f3816e | ||
|
|
edb8fe7c9b | ||
|
|
ab6f3aa7a8 | ||
|
|
f8e1773f67 | ||
|
|
89dbd5cedd | ||
|
|
21e01ee4e5 | ||
|
|
cc3b85771e | ||
|
|
fd512f5f94 | ||
|
|
67639babd5 | ||
|
|
1a457f040a | ||
|
|
906b33b772 | ||
|
|
a27098cb71 | ||
|
|
dd56627191 | ||
|
|
29b5516f5f | ||
|
|
ab7b060df7 | ||
|
|
4789e8e063 | ||
|
|
a29e5ccac3 | ||
|
|
dcebb038ed | ||
|
|
89653c15cf | ||
|
|
b91eaa4a75 | ||
|
|
63426886f5 | ||
|
|
075e333cc2 | ||
|
|
c5500b6035 | ||
|
|
0e05734542 | ||
|
|
4855172d08 | ||
|
|
ee2c8b324f | ||
|
|
4ea5470891 | ||
|
|
d06a5c4c22 | ||
|
|
0c788cde5c | ||
|
|
29be47f451 | ||
|
|
58bf5b79b7 | ||
|
|
8adc51759b | ||
|
|
cccc07aa28 | ||
|
|
263312727f | ||
|
|
021af90722 | ||
|
|
d970d6f3f6 | ||
|
|
cfc633e793 | ||
|
|
a09671a0a0 | ||
|
|
494d65beb1 | ||
|
|
0fce9600ee | ||
|
|
52819473a2 | ||
|
|
2d7e36f006 | ||
|
|
2b1daf9bb2 | ||
|
|
017257e0ef | ||
|
|
1075137cfc | ||
|
|
0a2c1e30b1 | ||
|
|
d6deb4d6d9 | ||
|
|
bc13dc596e | ||
|
|
8c514a6101 | ||
|
|
9402bad3f4 | ||
|
|
648162204d | ||
|
|
e4c1bf052f | ||
|
|
b616f99ca6 | ||
|
|
6546b1dd3d |
@@ -38,6 +38,8 @@ jobs:
|
||||
- name: Run Tests
|
||||
run: |
|
||||
make test
|
||||
env:
|
||||
ERROR_ON_FAILURES: 1
|
||||
- name: Test-Drive Installation
|
||||
run: |
|
||||
make install
|
||||
|
||||
@@ -16,6 +16,8 @@ jobs:
|
||||
working-directory: generic
|
||||
- name: Build
|
||||
run: make all
|
||||
env:
|
||||
CFLAGS: -arch x86_64 -arch arm64e
|
||||
- name: Run Tests
|
||||
run: make test styles=develop
|
||||
env:
|
||||
@@ -46,10 +48,13 @@ jobs:
|
||||
# Note that macOS is always a 64 bit platform
|
||||
run: ./configure --enable-64bit --enable-dtrace --enable-framework ${CFGOPT} "--prefix=$HOME/install" || (cat config.log && exit 1)
|
||||
env:
|
||||
CFLAGS: -arch x86_64 -arch arm64e
|
||||
CFGOPT: ${{ matrix.cfgopt }}
|
||||
- name: Build
|
||||
run: |
|
||||
make all tcltest
|
||||
env:
|
||||
CFLAGS: -arch x86_64 -arch arm64e
|
||||
- name: Run Tests
|
||||
run: |
|
||||
make test
|
||||
|
||||
@@ -21,13 +21,13 @@ jobs:
|
||||
working-directory: unix
|
||||
- name: Build
|
||||
run: |
|
||||
make tclsh tclzipfile
|
||||
make tclsh
|
||||
make shell SCRIPT="$VER_PATH $GITHUB_ENV"
|
||||
echo "TCL_ZIP=`pwd`/`echo libtcl*.zip`" >> $GITHUB_ENV
|
||||
working-directory: unix
|
||||
- name: Package
|
||||
run: |
|
||||
cat ../unix/tclsh $TCL_ZIP > tclsh${TCL_PATCHLEVEL}_unofficial
|
||||
cp ../unix/tclsh tclsh${TCL_PATCHLEVEL}_unofficial
|
||||
chmod +x tclsh${TCL_PATCHLEVEL}_unofficial
|
||||
tar -cf tclsh${TCL_PATCHLEVEL}_unofficial.tar tclsh${TCL_PATCHLEVEL}_unofficial
|
||||
working-directory: 1dist
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
path: 1dist/*.tar
|
||||
macos:
|
||||
name: macOS
|
||||
runs-on: macos-latest
|
||||
runs-on: macos-11.0
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
@@ -55,14 +55,18 @@ jobs:
|
||||
run: |
|
||||
mkdir 1dist
|
||||
touch generic/tclStubInit.c generic/tclOOStubInit.c || true
|
||||
wget https://github.com/culler/macher/releases/download/v1.3/macher
|
||||
sudo cp macher /usr/local/bin
|
||||
sudo chmod a+x /usr/local/bin/macher
|
||||
echo "VER_PATH=$(cd tools; pwd)/addVerToFile.tcl" >> $GITHUB_ENV
|
||||
echo "CREATE_DMG=$(cd create-dmg;pwd)/create-dmg" >> $GITHUB_ENV
|
||||
echo "CFLAGS=-arch x86_64 -arch arm64e" >> $GITHUB_ENV
|
||||
- name: Configure
|
||||
run: ./configure --disable-symbols --disable-shared --enable-zipfs
|
||||
working-directory: unix
|
||||
- name: Build
|
||||
run: |
|
||||
make tclsh tclzipfile
|
||||
make tclsh
|
||||
make shell SCRIPT="$VER_PATH $GITHUB_ENV"
|
||||
echo "TCL_BIN=`pwd`/tclsh" >> $GITHUB_ENV
|
||||
echo "TCL_ZIP=`pwd`/`echo libtcl*.zip`" >> $GITHUB_ENV
|
||||
@@ -70,7 +74,7 @@ jobs:
|
||||
- name: Package
|
||||
run: |
|
||||
mkdir contents
|
||||
cat $TCL_BIN $TCL_ZIP > contents/tclsh${TCL_PATCHLEVEL}_unofficial
|
||||
cp $TCL_BIN contents/tclsh${TCL_PATCHLEVEL}_unofficial
|
||||
chmod +x contents/tclsh${TCL_PATCHLEVEL}_unofficial
|
||||
cat > contents/README.txt <<EOF
|
||||
This is a single-file executable developer preview of Tcl $TCL_PATCHLEVEL
|
||||
@@ -116,20 +120,16 @@ jobs:
|
||||
working-directory: win
|
||||
- name: Build
|
||||
run: |
|
||||
make binaries libraries tclzipfile
|
||||
make binaries libraries
|
||||
echo "TCL_ZIP=`pwd`/`echo libtcl*.zip`" >> $GITHUB_ENV
|
||||
working-directory: win
|
||||
- name: Package
|
||||
run: |
|
||||
cat ../win/tclsh*.exe $TCL_ZIP > combined.exe
|
||||
working-directory: 1dist
|
||||
- name: Get Exact Version
|
||||
run: |
|
||||
./combined.exe $VER_PATH $GITHUB_ENV
|
||||
working-directory: 1dist
|
||||
./tclsh*.exe $VER_PATH $GITHUB_ENV
|
||||
working-directory: win
|
||||
- name: Set Executable Name
|
||||
run: |
|
||||
mv combined.exe tclsh${TCL_PATCHLEVEL}_unofficial.exe
|
||||
cp ../win/tclsh*.exe tclsh${TCL_PATCHLEVEL}_unofficial.exe
|
||||
working-directory: 1dist
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v2
|
||||
|
||||
@@ -9018,8 +9018,8 @@ in this changeset (new minor version) rather than bug fixes:
|
||||
2020-02-25 (bug) release refs when setting class's superclasses fails (dkf)
|
||||
|
||||
2020-02-26 (bug) C++ compiler compatibility for registry and dde (nijtmans)
|
||||
=> registry 1.4.3
|
||||
=> dde 1.3.5
|
||||
=> registry 1.3.5
|
||||
=> dde 1.4.3
|
||||
|
||||
2020-03-05 (new) Update to Unicode-13 (nijtmans)
|
||||
|
||||
|
||||
+10
-1
@@ -8,7 +8,7 @@
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_Alloc, Tcl_Free, Tcl_Realloc, Tcl_AttemptAlloc, Tcl_AttemptRealloc, ckalloc, ckfree, ckrealloc, attemptckalloc, attemptckrealloc \- allocate or free heap memory
|
||||
Tcl_Alloc, Tcl_Free, Tcl_Realloc, Tcl_AttemptAlloc, Tcl_AttemptRealloc, Tcl_GetMemoryInfo, ckalloc, ckfree, ckrealloc, attemptckalloc, attemptckrealloc \- allocate or free heap memory
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
@@ -28,6 +28,9 @@ char *
|
||||
char *
|
||||
\fBTcl_AttemptRealloc\fR(\fIptr, size\fR)
|
||||
.sp
|
||||
void
|
||||
\fBTcl_GetMemoryInfo\fR(\fIdsPtr\fR)
|
||||
.sp
|
||||
char *
|
||||
\fBckalloc\fR(\fIsize\fR)
|
||||
.sp
|
||||
@@ -48,6 +51,8 @@ char *
|
||||
Size in bytes of the memory block to allocate.
|
||||
.AP char *ptr in
|
||||
Pointer to memory block to free or realloc.
|
||||
.AP Tcl_DString *dsPtr in
|
||||
Initialized DString pointer.
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
@@ -88,5 +93,9 @@ these macros are redefined to be special debugging versions
|
||||
of these procedures. To support Tcl's memory debugging within a
|
||||
module, use the macros rather than direct calls to \fBTcl_Alloc\fR, etc.
|
||||
|
||||
\fBTcl_GetMemoryInfo\fR appends a list-of-lists of memory stats to the
|
||||
provided DString. This function cannot be used in stub-enabled extensions,
|
||||
and it is only available if Tcl is compiled with the threaded memory allocator.
|
||||
|
||||
.SH KEYWORDS
|
||||
alloc, allocation, free, malloc, memory, realloc, TCL_MEM_DEBUG
|
||||
|
||||
+3
-2
@@ -37,8 +37,9 @@ byte-array type. For \fBTcl_GetByteArrayFromObj\fR and
|
||||
\fBTcl_SetByteArrayLength\fR, this points to the value from which to get
|
||||
the byte-array value; if \fIobjPtr\fR does not already point to a byte-array
|
||||
value, it will be converted to one.
|
||||
.AP int *lengthPtr out
|
||||
If non-NULL, filled with the length of the array of bytes in the value.
|
||||
.AP size_t | int *lengthPtr out
|
||||
Filled with the length of the array of bytes in the value.
|
||||
May be (int *)NULL when not used.
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
+3
-3
@@ -600,9 +600,9 @@ in preference to the \fIseekProc\fR, but both must be defined if the
|
||||
following prototype:
|
||||
.PP
|
||||
.CS
|
||||
typedef Tcl_WideInt \fBTcl_DriverWideSeekProc\fR(
|
||||
typedef long long \fBTcl_DriverWideSeekProc\fR(
|
||||
ClientData \fIinstanceData\fR,
|
||||
Tcl_WideInt \fIoffset\fR,
|
||||
long long \fIoffset\fR,
|
||||
int \fIseekMode\fR,
|
||||
int *\fIerrorCodePtr\fR);
|
||||
.CE
|
||||
@@ -824,7 +824,7 @@ length. It can be NULL.
|
||||
.CS
|
||||
typedef int \fBTcl_DriverTruncateProc\fR(
|
||||
ClientData \fIinstanceData\fR,
|
||||
Tcl_WideInt \fIlength\fR);
|
||||
long long \fIlength\fR);
|
||||
.CE
|
||||
.PP
|
||||
\fIInstanceData\fR is the same as the value passed to
|
||||
|
||||
+7
-7
@@ -144,16 +144,16 @@ Tcl_Obj *
|
||||
Tcl_StatBuf *
|
||||
\fBTcl_AllocStatBuf\fR()
|
||||
.sp
|
||||
Tcl_WideInt
|
||||
long long
|
||||
\fBTcl_GetAccessTimeFromStat\fR(\fIstatPtr\fR)
|
||||
.sp
|
||||
unsigned
|
||||
\fBTcl_GetBlockSizeFromStat\fR(\fIstatPtr\fR)
|
||||
.sp
|
||||
Tcl_WideUInt
|
||||
unsigned long long
|
||||
\fBTcl_GetBlocksFromStat\fR(\fIstatPtr\fR)
|
||||
.sp
|
||||
Tcl_WideInt
|
||||
long long
|
||||
\fBTcl_GetChangeTimeFromStat\fR(\fIstatPtr\fR)
|
||||
.sp
|
||||
int
|
||||
@@ -174,10 +174,10 @@ int
|
||||
unsigned
|
||||
\fBTcl_GetModeFromStat\fR(\fIstatPtr\fR)
|
||||
.sp
|
||||
Tcl_WideInt
|
||||
long long
|
||||
\fBTcl_GetModificationTimeFromStat\fR(\fIstatPtr\fR)
|
||||
.sp
|
||||
Tcl_WideUInt
|
||||
unsigned long long
|
||||
\fBTcl_GetSizeFromStat\fR(\fIstatPtr\fR)
|
||||
.sp
|
||||
int
|
||||
@@ -241,9 +241,9 @@ The structure that contains the result of a stat or lstat operation.
|
||||
Name of a procedure to look up in the file's symbol table
|
||||
.AP "const char" *sym2 in
|
||||
Name of a procedure to look up in the file's symbol table
|
||||
.AP Tcl_PackageInitProc **proc1Ptr out
|
||||
.AP Tcl_LibraryInitProc **proc1Ptr out
|
||||
Filled with the init function for this code.
|
||||
.AP Tcl_PackageInitProc **proc2Ptr out
|
||||
.AP Tcl_LibraryInitProc **proc2Ptr out
|
||||
Filled with the safe-init function for this code.
|
||||
.AP ClientData *clientDataPtr out
|
||||
Filled with the clientData value to pass to this code's unload
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ are provided by the C language standard. The \fBTcl_WideInt\fR type is a
|
||||
typedef defined to be whatever signed integral type covers at least the
|
||||
64-bit integer range (-9223372036854775808 to 9223372036854775807). Depending
|
||||
on the platform and the C compiler, the actual type might be
|
||||
\fBlong long int\fR, \fB__int64\fR, or something else.
|
||||
\fBlong long int\fR, or something else.
|
||||
The \fBmp_int\fR type is a multiple-precision integer type defined
|
||||
by the LibTomMath multiple-precision integer library.
|
||||
.PP
|
||||
|
||||
+4
-4
@@ -92,10 +92,10 @@ int
|
||||
int
|
||||
\fBTcl_OutputBuffered\fR(\fIchannel\fR)
|
||||
.sp
|
||||
Tcl_WideInt
|
||||
long long
|
||||
\fBTcl_Seek\fR(\fIchannel, offset, seekMode\fR)
|
||||
.sp
|
||||
Tcl_WideInt
|
||||
long long
|
||||
\fBTcl_Tell\fR(\fIchannel\fR)
|
||||
.sp
|
||||
int
|
||||
@@ -190,7 +190,7 @@ A buffer containing the bytes to output to the channel.
|
||||
.AP int bytesToWrite in
|
||||
The number of bytes to consume from \fIcharBuf\fR or \fIbyteBuf\fR and
|
||||
output to the channel.
|
||||
.AP Tcl_WideInt offset in
|
||||
.AP "long long" offset in
|
||||
How far to move the access point in the channel at which the next input or
|
||||
output operation will be applied, measured in bytes from the position
|
||||
given by \fIseekMode\fR. May be either positive or negative.
|
||||
@@ -198,7 +198,7 @@ given by \fIseekMode\fR. May be either positive or negative.
|
||||
Relative to which point to seek; used with \fIoffset\fR to calculate the new
|
||||
access point for the channel. Legal values are \fBSEEK_SET\fR,
|
||||
\fBSEEK_CUR\fR, and \fBSEEK_END\fR.
|
||||
.AP Tcl_WideInt length in
|
||||
.AP "long long" length in
|
||||
The (non-negative) length to truncate the channel the channel to.
|
||||
.AP "const char" *optionName in
|
||||
The name of an option applicable to this channel, such as \fB\-blocking\fR.
|
||||
|
||||
+1
-1
@@ -94,4 +94,4 @@ compatibility and translate their invocations to this form.
|
||||
.SH KEYWORDS
|
||||
package, present, provide, require, version
|
||||
.SH "SEE ALSO"
|
||||
package(n), Tcl_StaticPackage(3)
|
||||
package(n), Tcl_StaticLibrary(3)
|
||||
|
||||
+4
-4
@@ -28,7 +28,7 @@ configuration as ASCII string. This means that this information is in
|
||||
UTF-8 too. Must not be NULL.
|
||||
.AP "const Tcl_Config" *configuration in
|
||||
Refers to an array of Tcl_Config entries containing the information
|
||||
embedded in the binary library. Must not be NULL. The end of the array
|
||||
embedded in the library. Must not be NULL. The end of the array
|
||||
is signaled by either a key identical to NULL, or a key referring to
|
||||
the empty string.
|
||||
.AP "const char" *valEncoding in
|
||||
@@ -40,10 +40,10 @@ too. Must not be NULL.
|
||||
.PP
|
||||
The function described here has its base in TIP 59 and provides
|
||||
extensions with support for the embedding of configuration
|
||||
information into their binary library and the generation of a
|
||||
information into their library and the generation of a
|
||||
Tcl-level interface for querying this information.
|
||||
.PP
|
||||
To embed configuration information into their binary library an
|
||||
To embed configuration information into their library an
|
||||
extension has to define a non-volatile array of Tcl_Config entries in
|
||||
one if its source files and then call \fBTcl_RegisterConfig\fR to
|
||||
register that information.
|
||||
@@ -108,4 +108,4 @@ typedef struct Tcl_Config {
|
||||
.\" No cross references yet.
|
||||
.\" .SH "SEE ALSO"
|
||||
.SH KEYWORDS
|
||||
embedding, configuration, binary library
|
||||
embedding, configuration, library
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1995-1996 Sun Microsystems, Inc.
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH Tcl_StaticLibrary 3 7.5 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_StaticLibrary, Tcl_StaticPackage \- make a statically linked library available via the 'load' command
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
.sp
|
||||
\fBTcl_StaticLibrary\fR(\fIinterp, prefix, initProc, safeInitProc\fR)
|
||||
.sp
|
||||
\fBTcl_StaticPackage\fR(\fIinterp, prefix, initProc, safeInitProc\fR)
|
||||
.SH ARGUMENTS
|
||||
.AS Tcl_LibraryInitProc *safeInitProc
|
||||
.AP Tcl_Interp *interp in
|
||||
If not NULL, points to an interpreter into which the library has
|
||||
already been incorporated (i.e., the caller has already invoked the
|
||||
appropriate initialization procedure). NULL means the library
|
||||
has not yet been incorporated into any interpreter.
|
||||
.AP "const char" *prefix in
|
||||
Prefix for library initialization function; should be properly
|
||||
capitalized (first letter upper-case, all others lower-case).
|
||||
.AP Tcl_LibraryInitProc *initProc in
|
||||
Procedure to invoke to incorporate this library into a trusted
|
||||
interpreter.
|
||||
.AP Tcl_LibraryInitProc *safeInitProc in
|
||||
Procedure to call to incorporate this library into a safe interpreter
|
||||
(one that will execute untrusted scripts). NULL means the library
|
||||
cannot be used in safe interpreters.
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This procedure may be invoked to announce that a library has been
|
||||
linked statically with a Tcl application and, optionally, that it
|
||||
has already been incorporated into an interpreter.
|
||||
Once \fBTcl_StaticLibrary\fR has been invoked for a library, it
|
||||
may be incorporated into interpreters using the \fBload\fR command.
|
||||
\fBTcl_StaticLibrary\fR is normally invoked only by the \fBTcl_AppInit\fR
|
||||
procedure for the application, not by libraries for themselves
|
||||
(\fBTcl_StaticLibrary\fR should only be invoked for statically
|
||||
linked libraries, and code in the library itself should not need
|
||||
to know whether the library is dynamically loaded or statically linked).
|
||||
.PP
|
||||
When the \fBload\fR command is used later to incorporate the library into
|
||||
an interpreter, one of \fIinitProc\fR and \fIsafeInitProc\fR will
|
||||
be invoked, depending on whether the target interpreter is safe
|
||||
or not.
|
||||
\fIinitProc\fR and \fIsafeInitProc\fR must both match the
|
||||
following prototype:
|
||||
.PP
|
||||
.CS
|
||||
typedef int \fBTcl_LibraryInitProc\fR(
|
||||
Tcl_Interp *\fIinterp\fR);
|
||||
.CE
|
||||
.PP
|
||||
The \fIinterp\fR argument identifies the interpreter in which the library
|
||||
is to be incorporated. The initialization procedure must return \fBTCL_OK\fR or
|
||||
\fBTCL_ERROR\fR to indicate whether or not it completed successfully; in
|
||||
the event of an error it should set the interpreter's result to point to an
|
||||
error message. The result or error from the initialization procedure will
|
||||
be returned as the result of the \fBload\fR command that caused the
|
||||
initialization procedure to be invoked.
|
||||
.PP
|
||||
\fBTcl_StaticLibrary\fR was named \fBTcl_StaticPackage\fR in Tcl 8.6 and
|
||||
earlier, but the old name is deprecated now.
|
||||
.PP
|
||||
\fBTcl_StaticLibrary\fR can not be used in stub-enabled extensions. Its symbol
|
||||
entry in the stub table is deprecated and it will be removed in Tcl 9.0.
|
||||
.SH KEYWORDS
|
||||
initialization procedure, package, static linking
|
||||
.SH "SEE ALSO"
|
||||
load(n), package(n), Tcl_PkgRequire(3)
|
||||
@@ -1,73 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1995-1996 Sun Microsystems, Inc.
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH Tcl_StaticPackage 3 7.5 Tcl "Tcl Library Procedures"
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_StaticPackage \- make a statically linked package available via the 'load' command
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
.sp
|
||||
\fBTcl_StaticPackage\fR(\fIinterp, pkgName, initProc, safeInitProc\fR)
|
||||
.SH ARGUMENTS
|
||||
.AS Tcl_PackageInitProc *safeInitProc
|
||||
.AP Tcl_Interp *interp in
|
||||
If not NULL, points to an interpreter into which the package has
|
||||
already been loaded (i.e., the caller has already invoked the
|
||||
appropriate initialization procedure). NULL means the package
|
||||
has not yet been incorporated into any interpreter.
|
||||
.AP "const char" *pkgName in
|
||||
Name of the package; should be properly capitalized (first letter
|
||||
upper-case, all others lower-case).
|
||||
.AP Tcl_PackageInitProc *initProc in
|
||||
Procedure to invoke to incorporate this package into a trusted
|
||||
interpreter.
|
||||
.AP Tcl_PackageInitProc *safeInitProc in
|
||||
Procedure to call to incorporate this package into a safe interpreter
|
||||
(one that will execute untrusted scripts). NULL means the package
|
||||
cannot be used in safe interpreters.
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This procedure may be invoked to announce that a package has been
|
||||
linked statically with a Tcl application and, optionally, that it
|
||||
has already been loaded into an interpreter.
|
||||
Once \fBTcl_StaticPackage\fR has been invoked for a package, it
|
||||
may be loaded into interpreters using the \fBload\fR command.
|
||||
\fBTcl_StaticPackage\fR is normally invoked only by the \fBTcl_AppInit\fR
|
||||
procedure for the application, not by packages for themselves
|
||||
(\fBTcl_StaticPackage\fR should only be invoked for statically
|
||||
loaded packages, and code in the package itself should not need
|
||||
to know whether the package is dynamically or statically loaded).
|
||||
.PP
|
||||
When the \fBload\fR command is used later to load the package into
|
||||
an interpreter, one of \fIinitProc\fR and \fIsafeInitProc\fR will
|
||||
be invoked, depending on whether the target interpreter is safe
|
||||
or not.
|
||||
\fIinitProc\fR and \fIsafeInitProc\fR must both match the
|
||||
following prototype:
|
||||
.PP
|
||||
.CS
|
||||
typedef int \fBTcl_PackageInitProc\fR(
|
||||
Tcl_Interp *\fIinterp\fR);
|
||||
.CE
|
||||
.PP
|
||||
The \fIinterp\fR argument identifies the interpreter in which the package
|
||||
is to be loaded. The initialization procedure must return \fBTCL_OK\fR or
|
||||
\fBTCL_ERROR\fR to indicate whether or not it completed successfully; in
|
||||
the event of an error it should set the interpreter's result to point to an
|
||||
error message. The result or error from the initialization procedure will
|
||||
be returned as the result of the \fBload\fR command that caused the
|
||||
initialization procedure to be invoked.
|
||||
.PP
|
||||
\fBTcl_StaticPackage\fR can not be used in stub-enabled extensions. Its symbol
|
||||
entry in the stub table is deprecated and it will be removed in Tcl 9.0.
|
||||
.SH KEYWORDS
|
||||
initialization procedure, package, static linking
|
||||
.SH "SEE ALSO"
|
||||
load(n), package(n), Tcl_PkgRequire(3)
|
||||
+2
-2
@@ -120,8 +120,8 @@ Points to a value to manipulate.
|
||||
.AP Tcl_Obj *appendObjPtr in
|
||||
The value to append to \fIobjPtr\fR in \fBTcl_AppendObjToObj\fR.
|
||||
.AP size_t | int *lengthPtr out
|
||||
If non-NULL, the location where \fBTcl_GetStringFromObj\fR will store
|
||||
the length of a value's string representation.
|
||||
The location where \fBTcl_GetStringFromObj\fR will store the length
|
||||
of a value's string representation. May be (int *)NULL when not used.
|
||||
.AP "const char" *string in
|
||||
Null-terminated string value to append to \fIobjPtr\fR.
|
||||
.AP va_list argList in
|
||||
|
||||
+11
-1
@@ -10,13 +10,17 @@
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_Main, Tcl_SetStartupScript, Tcl_GetStartupScript, Tcl_SetMainLoop \- main program, startup script, and event loop definition for Tcl-based applications
|
||||
Tcl_Main, Tcl_MainEx, Tcl_MainExW, Tcl_SetStartupScript, Tcl_GetStartupScript, Tcl_SetMainLoop \- main program, startup script, and event loop definition for Tcl-based applications
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
.sp
|
||||
\fBTcl_Main\fR(\fIargc, argv, appInitProc\fR)
|
||||
.sp
|
||||
\fBTcl_MainEx\fR(\fIargc, charargv, appInitProc, interp\fR)
|
||||
.sp
|
||||
\fBTcl_MainExW\fR(\fIargc, wideargv, appInitProc, interp\fR)
|
||||
.sp
|
||||
\fBTcl_SetStartupScript\fR(\fIpath, encoding\fR)
|
||||
.sp
|
||||
Tcl_Obj *
|
||||
@@ -30,6 +34,10 @@ Number of elements in \fIargv\fR.
|
||||
.AP char *argv[] in
|
||||
Array of strings containing command-line arguments. On Windows, when
|
||||
using -DUNICODE, the parameter type changes to wchar_t *.
|
||||
.AP char *charargv[] in
|
||||
As argv, but does not change type to wchar_t.
|
||||
.AP char *wideargv[] in
|
||||
As argv, but type is always wchar_t.
|
||||
.AP Tcl_AppInitProc *appInitProc in
|
||||
Address of an application-specific initialization procedure.
|
||||
The value for this argument is usually \fBTcl_AppInit\fR.
|
||||
@@ -42,6 +50,8 @@ If non-NULL, location to write a copy of the (const char *)
|
||||
pointing to the encoding name.
|
||||
.AP Tcl_MainLoopProc *mainLoopProc in
|
||||
Address of an application-specific event loop procedure.
|
||||
.AP Tcl_Interp *interp in
|
||||
Already created Tcl Interpreter.
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
|
||||
@@ -233,10 +233,10 @@ characters.
|
||||
.PP
|
||||
\fBTcl_UtfCharComplete\fR returns 1 if the source UTF-8 string \fIsrc\fR
|
||||
of \fIlength\fR bytes is long enough to be decoded by
|
||||
\fBTcl_UtfToUniChar\fR, or 0 otherwise. This function does not guarantee
|
||||
that the UTF-8 string is properly formed. This routine is used by
|
||||
procedures that are operating on a byte at a time and need to know if a
|
||||
full Unicode character has been seen.
|
||||
\fBTcl_UtfToUniChar\fR/\fBTcl_UtfNext\fR, or 0 otherwise. This function
|
||||
does not guarantee that the UTF-8 string is properly formed. This routine
|
||||
is used by procedures that are operating on a byte at a time and need to
|
||||
know if a full Unicode character has been seen.
|
||||
.PP
|
||||
\fBTcl_NumUtfChars\fR corresponds to \fBstrlen\fR for UTF-8 strings. It
|
||||
returns the number of Tcl_UniChars that are represented by the UTF-8 string
|
||||
@@ -257,7 +257,8 @@ Given \fIsrc\fR, a pointer to some location in a UTF-8 string,
|
||||
\fBTcl_UtfNext\fR returns a pointer to the next UTF-8 character in the
|
||||
string. The caller must not ask for the next character after the last
|
||||
character in the string if the string is not terminated by a null
|
||||
character.
|
||||
character. \fBTcl_UtfCharComplete\fR can be used in that case to
|
||||
make sure enough bytes are available before calling \fBTcl_UtfNext\fR.
|
||||
.PP
|
||||
\fBTcl_UtfPrev\fR is used to step backward through but not beyond the
|
||||
UTF-8 string that begins at \fIstart\fR. If the UTF-8 string is made
|
||||
@@ -274,12 +275,12 @@ always a pointer to a location in the string. It always returns a pointer to
|
||||
a byte that begins a character when scanning for characters beginning
|
||||
from \fIstart\fR. When \fIsrc\fR is greater than \fIstart\fR, it
|
||||
always returns a pointer less than \fIsrc\fR and greater than or
|
||||
equal to (\fIsrc\fR - \fBTCL_UTF_MAX\fR). The character that begins
|
||||
equal to (\fIsrc\fR - 4). The character that begins
|
||||
at the returned pointer is the first one that either includes the
|
||||
byte \fIsrc[-1]\fR, or might include it if the right trail bytes are
|
||||
present at \fIsrc\fR and greater. \fBTcl_UtfPrev\fR never reads the
|
||||
byte \fIsrc[0]\fR nor the byte \fIstart[-1]\fR nor the byte
|
||||
\fIsrc[-\fBTCL_UTF_MAX\fI-1]\fR.
|
||||
\fIsrc[-5]\fR.
|
||||
.PP
|
||||
\fBTcl_UniCharAtIndex\fR corresponds to a C string array dereference or the
|
||||
Pascal Ord() function. It returns the Unicode character represented at the
|
||||
|
||||
@@ -22,6 +22,10 @@ of one or more subprocesses to execute.
|
||||
The arguments take the form of a standard shell pipeline
|
||||
where each \fIarg\fR becomes one word of a command, and
|
||||
each distinct command becomes a subprocess.
|
||||
The result of the command is the standard output of the final subprocess in
|
||||
the pipeline, interpreted using the system \fBencoding\fR; to use any other
|
||||
encoding (especially including binary data), the pipeline must be
|
||||
\fBopen\fRed, configured and read explicitly.
|
||||
.PP
|
||||
If the initial arguments to \fBexec\fR start with \fB\-\fR then
|
||||
they are treated as command-line switches and are not part
|
||||
@@ -411,7 +415,9 @@ With the file \fIcmp.bat\fR looking something like:
|
||||
.CS
|
||||
@gcc %*
|
||||
.CE
|
||||
.PP
|
||||
or like another variant using single parameters:
|
||||
.PP
|
||||
.CS
|
||||
@gcc %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
.CE
|
||||
|
||||
+23
-20
@@ -38,28 +38,31 @@ generated. On Windows, FAT file systems do not support access time.
|
||||
.TP
|
||||
\fBfile attributes \fIname\fR ?\fIoption value option value...\fR?
|
||||
.
|
||||
This subcommand returns or sets platform specific values associated
|
||||
with a file. The first form returns a list of the platform specific
|
||||
flags and their values. The second form returns the value for the
|
||||
specific option. The third form sets one or more of the values. The
|
||||
values are as follows:
|
||||
This subcommand returns or sets platform-specific values associated
|
||||
with a file. The first form returns a list of the platform-specific
|
||||
options and their values. The second form returns the value for the
|
||||
given option. The third form sets one or more of the values. The values
|
||||
are as follows:
|
||||
.RS
|
||||
.PP
|
||||
On Unix, \fB\-group\fR gets or sets the group name for the file. A group id
|
||||
can be given to the command, but it returns a group name. \fB\-owner\fR gets
|
||||
or sets the user name of the owner of the file. The command returns the
|
||||
owner name, but the numerical id can be passed when setting the
|
||||
owner. \fB\-permissions\fR sets or retrieves the octal code that chmod(1)
|
||||
uses. This command does also has limited support for setting using the
|
||||
symbolic attributes for chmod(1), of the form [ugo]?[[+\-=][rwxst],[...]],
|
||||
where multiple symbolic attributes can be separated by commas (example:
|
||||
\fBu+s,go\-rw\fR add sticky bit for user, remove read and write
|
||||
permissions for group and other). A simplified \fBls\fR style string,
|
||||
of the form rwxrwxrwx (must be 9 characters), is also supported
|
||||
(example: \fBrwxr\-xr\-t\fR is equivalent to 01755).
|
||||
On versions of Unix supporting file flags, \fB\-readonly\fR gives the
|
||||
value or sets or clears the readonly attribute of the file,
|
||||
i.e. the user immutable flag \fBuchg\fR to chflags(1).
|
||||
On Unix, \fB\-group\fR gets or sets the group name for the file. A
|
||||
group id can be given to the command, but it returns a group name.
|
||||
\fB\-owner\fR gets or sets the user name of the owner of the file. The
|
||||
command returns the owner name, but the numerical id can be passed when
|
||||
setting the owner. \fB\-permissions\fR retrieves or sets a file's
|
||||
access permissions, using octal notation by default. This option also
|
||||
provides limited support for setting permissions using the symbolic
|
||||
notation accepted by the \fBchmod\fR command, following the form
|
||||
[\fBugo\fR]?[[\fB+-=\fR][\fBrwxst\fR]\fB,\fR[...]]. Multiple permission
|
||||
specifications may be given, separated by commas. E.g., \fBu+s,go-rw\fR
|
||||
would set the setuid bit for a file's owner as well as remove read and
|
||||
write permission for the file's group and other users. An
|
||||
\fBls\fR-style string of the form \fBrwxrwxrwx\fR is also accepted but
|
||||
must always be 9 characters long. E.g., \fBrwxr-xr-t\fR is equivalent
|
||||
to \fB01755\fR. On versions of Unix supporting file flags,
|
||||
\fB-readonly\fR returns the value of, or sets, or clears the readonly
|
||||
attribute of a file, i.e., the user immutable flag (\fBuchg\fR) to the
|
||||
\fBchflags\fR command.
|
||||
.PP
|
||||
On Windows, \fB\-archive\fR gives the value or sets or clears the
|
||||
archive attribute of the file. \fB\-hidden\fR gives the value or sets
|
||||
|
||||
+1
-3
@@ -150,9 +150,7 @@ The safest approach is to use names consisting of
|
||||
alphanumeric characters only. Care should be taken with filenames
|
||||
which contain spaces (common on Windows systems) and
|
||||
filenames where the backslash is the directory separator (Windows
|
||||
native path names). Also Windows 3.1 only supports file
|
||||
names with a root of no more than 8 characters and an extension of no
|
||||
more than 3 characters.
|
||||
native path names).
|
||||
.PP
|
||||
On Windows platforms there are file and path length restrictions.
|
||||
Complete paths or filenames longer than about 260 characters will lead
|
||||
|
||||
+39
-40
@@ -13,22 +13,21 @@ load \- Load machine code and initialize new commands
|
||||
.SH SYNOPSIS
|
||||
\fBload\fR ?\fB\-global\fR? ?\fB\-lazy\fR? ?\fB\-\-\fR? \fIfileName\fR
|
||||
.br
|
||||
\fBload\fR ?\fB\-global\fR? ?\fB\-lazy\fR? ?\fB\-\-\fR? \fIfileName packageName\fR
|
||||
\fBload\fR ?\fB\-global\fR? ?\fB\-lazy\fR? ?\fB\-\-\fR? \fIfileName prefix\fR
|
||||
.br
|
||||
\fBload\fR ?\fB\-global\fR? ?\fB\-lazy\fR? ?\fB\-\-\fR? \fIfileName packageName interp\fR
|
||||
\fBload\fR ?\fB\-global\fR? ?\fB\-lazy\fR? ?\fB\-\-\fR? \fIfileName prefix interp\fR
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This command loads binary code from a file into the
|
||||
application's address space and calls an initialization procedure
|
||||
in the package to incorporate it into an interpreter. \fIfileName\fR
|
||||
in the library to incorporate it into an interpreter. \fIfileName\fR
|
||||
is the name of the file containing the code; its exact form varies
|
||||
from system to system but on most systems it is a shared library,
|
||||
such as a \fB.so\fR file under Solaris or a DLL under Windows.
|
||||
\fIpackageName\fR is the name of the package, and is used to
|
||||
compute the name of an initialization procedure.
|
||||
\fIprefix\fR is used to compute the name of an initialization procedure.
|
||||
\fIinterp\fR is the path name of the interpreter into which to load
|
||||
the package (see the \fBinterp\fR manual entry for details);
|
||||
the library (see the \fBinterp\fR manual entry for details);
|
||||
if \fIinterp\fR is omitted, it defaults to the
|
||||
interpreter in which the \fBload\fR command was invoked.
|
||||
.PP
|
||||
@@ -37,32 +36,32 @@ one of two initialization procedures will be invoked in the new code.
|
||||
Typically the initialization procedure will add new commands to a
|
||||
Tcl interpreter.
|
||||
The name of the initialization procedure is determined by
|
||||
\fIpackageName\fR and whether or not the target interpreter
|
||||
\fIprefix\fR and whether or not the target interpreter
|
||||
is a safe one. For normal interpreters the name of the initialization
|
||||
procedure will have the form \fIpkg\fB_Init\fR, where \fIpkg\fR
|
||||
is the same as \fIpackageName\fR except that the first letter is
|
||||
procedure will have the form \fIpfx\fB_Init\fR, where \fIpfx\fR
|
||||
is the same as \fIprefix\fR except that the first letter is
|
||||
converted to upper case and all other letters
|
||||
are converted to lower case. For example, if \fIpackageName\fR is
|
||||
are converted to lower case. For example, if \fIprefix\fR is
|
||||
\fBfoo\fR or \fBFOo\fR, the initialization procedure's name will
|
||||
be \fBFoo_Init\fR.
|
||||
.PP
|
||||
If the target interpreter is a safe interpreter, then the name
|
||||
of the initialization procedure will be \fIpkg\fB_SafeInit\fR
|
||||
instead of \fIpkg\fB_Init\fR.
|
||||
The \fIpkg\fB_SafeInit\fR function should be written carefully, so that it
|
||||
of the initialization procedure will be \fIpfx\fB_SafeInit\fR
|
||||
instead of \fIpfx\fB_Init\fR.
|
||||
The \fIpfx\fB_SafeInit\fR function should be written carefully, so that it
|
||||
initializes the safe interpreter only with partial functionality provided
|
||||
by the package that is safe for use by untrusted code. For more information
|
||||
by the library that is safe for use by untrusted code. For more information
|
||||
on Safe\-Tcl, see the \fBsafe\fR manual entry.
|
||||
.PP
|
||||
The initialization procedure must match the following prototype:
|
||||
.PP
|
||||
.CS
|
||||
typedef int \fBTcl_PackageInitProc\fR(
|
||||
typedef int \fBTcl_LibraryInitProc\fR(
|
||||
Tcl_Interp *\fIinterp\fR);
|
||||
.CE
|
||||
.PP
|
||||
The \fIinterp\fR argument identifies the interpreter in which the
|
||||
package is to be loaded. The initialization procedure must return
|
||||
library is to be loaded. The initialization procedure must return
|
||||
\fBTCL_OK\fR or \fBTCL_ERROR\fR to indicate whether or not it completed
|
||||
successfully; in the event of an error it should set the interpreter's result
|
||||
to point to an error message. The result of the \fBload\fR command
|
||||
@@ -74,37 +73,37 @@ interpreters, then the first \fBload\fR will load the code and
|
||||
call the initialization procedure; subsequent \fBload\fRs will
|
||||
call the initialization procedure without loading the code again.
|
||||
For Tcl versions lower than 8.5, it is not possible to unload or reload a
|
||||
package. From version 8.5 however, the \fBunload\fR command allows the unloading
|
||||
library. From version 8.5 however, the \fBunload\fR command allows the unloading
|
||||
of libraries loaded with \fBload\fR, for libraries that are aware of the
|
||||
Tcl's unloading mechanism.
|
||||
.PP
|
||||
The \fBload\fR command also supports packages that are statically
|
||||
linked with the application, if those packages have been registered
|
||||
by calling the \fBTcl_StaticPackage\fR procedure.
|
||||
If \fIfileName\fR is an empty string, then \fIpackageName\fR must
|
||||
The \fBload\fR command also supports libraries that are statically
|
||||
linked with the application, if those libraries have been registered
|
||||
by calling the \fBTcl_StaticLibrary\fR procedure.
|
||||
If \fIfileName\fR is an empty string, then \fIprefix\fR must
|
||||
be specified.
|
||||
.PP
|
||||
If \fIpackageName\fR is omitted or specified as an empty string,
|
||||
Tcl tries to guess the name of the package.
|
||||
This may be done differently on different platforms.
|
||||
The default guess, which is used on most UNIX platforms, is to
|
||||
take the last element of \fIfileName\fR, strip off the first
|
||||
three characters if they are \fBlib\fR, then strip off the next
|
||||
three characters if they are \fBtcl\fR, and use any following
|
||||
alphabetic and underline characters as the module name.
|
||||
For example, the command \fBload libtclxyz4.2.so\fR uses the module
|
||||
name \fBxyz\fR and the command \fBload bin/last.so {}\fR uses the
|
||||
module name \fBlast\fR.
|
||||
If \fIprefix\fR is omitted or specified as an empty string,
|
||||
Tcl tries to guess the prefix. This may be done differently on
|
||||
different platforms. The default guess, which is used on most
|
||||
UNIX platforms, is to take the last element of
|
||||
\fIfileName\fR, strip off the first three characters if they
|
||||
are \fBlib\fR, then strip off the next three characters if they
|
||||
are \fBtcl\fR, and use any following alphabetic and
|
||||
underline characters, converted to titlecase as the prefix.
|
||||
For example, the command \fBload libxyz4.2.so\fR uses the prefix
|
||||
\fBXyz\fR and the command \fBload bin/last.so {}\fR uses the
|
||||
prefix \fBLast\fR.
|
||||
.PP
|
||||
If \fIfileName\fR is an empty string, then \fIpackageName\fR must
|
||||
If \fIfileName\fR is an empty string, then \fIprefix\fR must
|
||||
be specified.
|
||||
The \fBload\fR command first searches for a statically loaded package
|
||||
(one that has been registered by calling the \fBTcl_StaticPackage\fR
|
||||
The \fBload\fR command first searches for a statically loaded library
|
||||
(one that has been registered by calling the \fBTcl_StaticLibrary\fR
|
||||
procedure) by that name; if one is found, it is used.
|
||||
Otherwise, the \fBload\fR command searches for a dynamically loaded
|
||||
package by that name, and uses it if it is found. If several
|
||||
library by that name, and uses it if it is found. If several
|
||||
different files have been \fBload\fRed with different versions of
|
||||
the package, Tcl picks the file that was loaded first.
|
||||
the library, Tcl picks the file that was loaded first.
|
||||
.PP
|
||||
If \fB\-global\fR is specified preceding the filename, all symbols
|
||||
found in the shared library are exported for global use by other
|
||||
@@ -112,7 +111,7 @@ libraries. The option \fB\-lazy\fR delays the actual loading of
|
||||
symbols until their first actual use. The options may be abbreviated.
|
||||
The option \fB\-\-\fR indicates the end of the options, and should
|
||||
be used if you wish to use a filename which starts with \fB\-\fR
|
||||
and you provide a packageName to the \fBload\fR command.
|
||||
and you provide a prefix to the \fBload\fR command.
|
||||
.PP
|
||||
On platforms which do not support the \fB\-global\fR or \fB\-lazy\fR
|
||||
options, the options still exist but have no effect. Note that use
|
||||
@@ -155,7 +154,7 @@ The following is a minimal extension:
|
||||
.CS
|
||||
#include <tcl.h>
|
||||
#include <stdio.h>
|
||||
static int fooCmd(ClientData clientData,
|
||||
static int fooCmd(void *clientData,
|
||||
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
|
||||
printf("called with %d arguments\en", objc);
|
||||
return TCL_OK;
|
||||
@@ -189,7 +188,7 @@ switch $tcl_platform(platform) {
|
||||
foo
|
||||
.CE
|
||||
.SH "SEE ALSO"
|
||||
info sharedlibextension, package(n), Tcl_StaticPackage(3), safe(n)
|
||||
info sharedlibextension, package(n), Tcl_StaticLibrary(3), safe(n)
|
||||
.SH KEYWORDS
|
||||
binary code, dynamic library, load, safe interpreter, shared library
|
||||
'\"Local Variables:
|
||||
|
||||
+1
-1
@@ -219,7 +219,7 @@ As an example, the user may prefer French or English text. This may be configure
|
||||
.PP
|
||||
.VS "TIP 499"
|
||||
.TP
|
||||
\fB::msgcat:mcloadedlocales subcommand\fR ?\fIlocale\fR?
|
||||
\fB::msgcat::mcloadedlocales subcommand\fR ?\fIlocale\fR?
|
||||
.
|
||||
This group of commands manage the list of loaded locales for packages not setting a package locale.
|
||||
.PP
|
||||
|
||||
+32
-1
@@ -72,7 +72,7 @@ indicate that the opened channel should be configured as if with the
|
||||
reading or writing of binary data.
|
||||
.PP
|
||||
In the second form, \fIaccess\fR consists of a list of any of the
|
||||
following flags, all of which have the standard POSIX meanings.
|
||||
following flags, most of which have the standard POSIX meanings.
|
||||
One of the flags must be either \fBRDONLY\fR, \fBWRONLY\fR or \fBRDWR\fR.
|
||||
.TP 15
|
||||
\fBRDONLY\fR
|
||||
@@ -453,6 +453,12 @@ application are competing for the console at the same time. If the command
|
||||
pipeline is started from a script, so that Tcl is not accessing the console,
|
||||
or if the command pipeline does not use standard input or output, but is
|
||||
redirected from or to a file, then the above problems do not occur.
|
||||
.PP
|
||||
Files opened in the
|
||||
.QW \fBa\fR
|
||||
mode or with the \fBAPPEND\fR flag set are implemented by seeking immediately
|
||||
before each write, which is not an atomic operation and does not carry the
|
||||
guarantee of strict appending that is present on POSIX platforms.
|
||||
.RE
|
||||
.TP
|
||||
\fBUnix\fR\0\0\0\0\0\0\0
|
||||
@@ -527,6 +533,19 @@ Note that the equivalent options exist on Unix, but are on the serial channel
|
||||
type.
|
||||
.VE "8.7, TIP 160"
|
||||
.SH "EXAMPLES"
|
||||
Open a file for writing, forcing it to be created and raising an error if it
|
||||
already exists.
|
||||
.PP
|
||||
.CS
|
||||
set myNewFile [\fBopen\fR filename.txt {WRONLY CREAT EXCL}]
|
||||
.CE
|
||||
.PP
|
||||
Open a file for writing as a log file.
|
||||
.PP
|
||||
.CS
|
||||
set myLogFile [\fBopen\fR filename.log "a"]
|
||||
fconfigure $myLogFile -buffering line
|
||||
.CE
|
||||
.PP
|
||||
Open a command pipeline and catch any errors:
|
||||
.PP
|
||||
@@ -538,6 +557,18 @@ if {[catch {close $fl} err]} {
|
||||
}
|
||||
.CE
|
||||
.PP
|
||||
Open a command pipeline and read binary data from it. Note the unusual form
|
||||
with
|
||||
.QW |[list
|
||||
that handles non-trivial edge cases with arguments that potentially have
|
||||
spaces in.
|
||||
.PP
|
||||
.CS
|
||||
set fl [\fBopen\fR |[list create_image_data $input] "rb"]
|
||||
set binData [read $fl]
|
||||
close $fl
|
||||
.CE
|
||||
.PP
|
||||
.VS "8.7, TIP 160"
|
||||
Read a password securely from the user (assuming that the script is being run
|
||||
interactively):
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ This parameter specifies the name of the package. It is required.
|
||||
This parameter specifies the version of the package. It is required.
|
||||
.TP
|
||||
\fB\-load \fIfilespec\fR
|
||||
This parameter specifies a binary library that must be loaded with the
|
||||
This parameter specifies a library that must be loaded with the
|
||||
\fBload\fR command. \fIfilespec\fR is a list with two elements. The
|
||||
first element is the name of the file to load. The second, optional
|
||||
element is a list of commands supplied by loading that file. If the
|
||||
|
||||
+19
-4
@@ -137,11 +137,26 @@ later, under \fBESCAPES\fR.
|
||||
.TP 8
|
||||
\fB^\fR
|
||||
.
|
||||
matches at the beginning of a line
|
||||
matches at the beginning of the string or a line (according to whether
|
||||
matching is newline-sensitive or not, as described in \fBMATCHING\fR,
|
||||
below).
|
||||
.TP
|
||||
\fB$\fR
|
||||
.
|
||||
matches at the end of a line
|
||||
matches at the end of the string or a line (according to whether
|
||||
matching is newline-sensitive or not, as described in \fBMATCHING\fR,
|
||||
below).
|
||||
.RS
|
||||
.PP
|
||||
The difference between string and line matching modes is immaterial
|
||||
when the string does not contain a newline character. The \fB\eA\fR
|
||||
and \fB\eZ\fR constraint escapes have a similar purpose but are
|
||||
always constraints for the overall string.
|
||||
.PP
|
||||
The default newline-sensitivity depends on the command that uses the
|
||||
regular expression, and can be overridden as described in
|
||||
\fBMETASYNTAX\fR, below.
|
||||
.RE
|
||||
.TP
|
||||
\fB(?=\fIre\fB)\fR
|
||||
.
|
||||
@@ -431,7 +446,7 @@ commonly-used character classes:
|
||||
.TP
|
||||
\fB\ew\fR
|
||||
.
|
||||
\fB[[:alnum:]_]\fR (note underscore)
|
||||
\fB[[:alnum:]_\eu203F\eu2040\eu2054\euFE33\euFE34\euFE4D\euFE4E\euFE4F\euFF3F]\fR (including punctuation connector characters)
|
||||
.TP
|
||||
\fB\eD\fR
|
||||
.
|
||||
@@ -443,7 +458,7 @@ commonly-used character classes:
|
||||
.TP
|
||||
\fB\eW\fR
|
||||
.
|
||||
\fB[^[:alnum:]_]\fR (note underscore)
|
||||
\fB[^[:alnum:]_\eu203F\eu2040\eu2054\euFE33\euFE34\euFE4D\euFE4E\euFE4F\euFF3F]\fR (including punctuation connector characters)
|
||||
.RE
|
||||
.PP
|
||||
Within bracket expressions,
|
||||
|
||||
@@ -322,6 +322,19 @@ invocation (usually \fBfconfigure\fR or \fBchan configure\fR) will appear to
|
||||
have thrown this error. Any exception beyond \fBerror\fR (e.g.,\ \fBbreak\fR,
|
||||
etc.) is treated as and converted to an error.
|
||||
.RE
|
||||
.TP
|
||||
\fIcmdPrefix \fBtruncate\fR \fIchannelId length\fR
|
||||
.
|
||||
This \fIoptional\fR subcommand handles changing the length of the
|
||||
underlying data stream for the channel \fIchannelId\fR. Its length
|
||||
gets set to \fIlength\fR.
|
||||
.RS
|
||||
.PP
|
||||
If the subcommand throws an error the command which caused its
|
||||
invocation (usually \fBchan truncate\fR) will appear to have thrown
|
||||
this error. Any exception beyond \fBerror\fR (e.g.,\ \fBbreak\fR,
|
||||
etc.) is treated as and converted to an error.
|
||||
.RE
|
||||
.SH NOTES
|
||||
Some of the functions supported in channels defined in Tcl's C
|
||||
interface are not available to channels reflected to the Tcl level.
|
||||
|
||||
+1
-1
@@ -404,7 +404,7 @@ Formally, the \fBstring bytelength\fR operation returns the content of
|
||||
the \fIlength\fR field of the \fBTcl_Obj\fR structure, after calling
|
||||
\fBTcl_GetString\fR to ensure that the \fIbytes\fR field is populated.
|
||||
This is highly unlikely to be useful to Tcl scripts, as Tcl's internal
|
||||
encoding is not strict UTF\-8, but rather a modified CESU\-8 with a
|
||||
encoding is not strict UTF\-8, but rather a modified WTF\-8 with a
|
||||
denormalized NUL (identical to that used in a number of places by
|
||||
Java's serialization mechanism) to enable basic processing with
|
||||
non-Unicode-aware C functions. As this representation should only
|
||||
|
||||
+20
-19
@@ -13,9 +13,9 @@ unload \- Unload machine code
|
||||
.SH SYNOPSIS
|
||||
\fBunload \fR?\fIswitches\fR? \fIfileName\fR
|
||||
.br
|
||||
\fBunload \fR?\fIswitches\fR? \fIfileName packageName\fR
|
||||
\fBunload \fR?\fIswitches\fR? \fIfileName prefix\fR
|
||||
.br
|
||||
\fBunload \fR?\fIswitches\fR? \fIfileName packageName interp\fR
|
||||
\fBunload \fR?\fIswitches\fR? \fIfileName prefix interp\fR
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
@@ -24,7 +24,7 @@ with \fBload\fR from the application's address space. \fIfileName\fR
|
||||
is the name of the file containing the library file to be unload; it
|
||||
must be the same as the filename provided to \fBload\fR for
|
||||
loading the library.
|
||||
The \fIpackageName\fR argument is the name of the package (as
|
||||
The \fIprefix\fR argument is the prefix (as
|
||||
determined by or passed to \fBload\fR), and is used to
|
||||
compute the name of the unload procedure; if not supplied, it is
|
||||
computed from \fIfileName\fR in the same manner as \fBload\fR.
|
||||
@@ -66,12 +66,12 @@ proper reference count.
|
||||
\fBunload\fR works in the opposite direction. As a first step, \fBunload\fR
|
||||
will check whether the library is unloadable: an unloadable library exports
|
||||
a special unload procedure. The name of the unload procedure is determined by
|
||||
\fIpackageName\fR and whether or not the target interpreter
|
||||
\fIprefix\fR and whether or not the target interpreter
|
||||
is a safe one. For normal interpreters the name of the initialization
|
||||
procedure will have the form \fIpkg\fB_Unload\fR, where \fIpkg\fR
|
||||
is the same as \fIpackageName\fR except that the first letter is
|
||||
procedure will have the form \fIpfx\fB_Unload\fR, where \fIpfx\fR
|
||||
is the same as \fIprefix\fR except that the first letter is
|
||||
converted to upper case and all other letters
|
||||
are converted to lower case. For example, if \fIpackageName\fR is
|
||||
are converted to lower case. For example, if \fIprefix\fR is
|
||||
\fBfoo\fR or \fBFOo\fR, the initialization procedure's name will
|
||||
be \fBFoo_Unload\fR.
|
||||
If the target interpreter is a safe interpreter, then the name
|
||||
@@ -90,7 +90,7 @@ detached from the process.
|
||||
The unload procedure must match the following prototype:
|
||||
.PP
|
||||
.CS
|
||||
typedef int \fBTcl_PackageUnloadProc\fR(
|
||||
typedef int \fBTcl_LibraryUnloadProc\fR(
|
||||
Tcl_Interp *\fIinterp\fR,
|
||||
int \fIflags\fR);
|
||||
.CE
|
||||
@@ -114,19 +114,20 @@ the \fIflags\fR argument will be set to \fBTCL_UNLOAD_DETACH_FROM_PROCESS\fR.
|
||||
.PP
|
||||
The \fBunload\fR command cannot unload libraries that are statically
|
||||
linked with the application.
|
||||
If \fIfileName\fR is an empty string, then the \fIpackageName\fR argument must
|
||||
If \fIfileName\fR is an empty string, then the \fIprefix\fR argument must
|
||||
be specified.
|
||||
.PP
|
||||
If \fIpackageName\fR is omitted or specified as an empty string,
|
||||
Tcl tries to guess the name of the package.
|
||||
This may be done differently on different platforms.
|
||||
The default guess, which is used on most UNIX platforms, is to
|
||||
take the last element of \fIfileName\fR, strip off the first
|
||||
three characters if they are \fBlib\fR, and use any following
|
||||
alphabetic and underline characters as the module name.
|
||||
For example, the command \fBunload libxyz4.2.so\fR uses the module
|
||||
name \fBxyz\fR and the command \fBunload bin/last.so {}\fR uses the
|
||||
module name \fBlast\fR.
|
||||
If \fIprefix\fR is omitted or specified as an empty string,
|
||||
Tcl tries to guess the prefix. This may be done differently on
|
||||
different platforms. The default guess, which is used on most
|
||||
UNIX platforms, is to take the last element of
|
||||
\fIfileName\fR, strip off the first three characters if they
|
||||
are \fBlib\fR, then strip off the next three characters if they
|
||||
are \fBtcl\fR, and use any following alphabetic and
|
||||
underline characters, converted to titlecase as the prefix.
|
||||
For example, the command \fBunload libxyz4.2.so\fR uses the prefix
|
||||
\fBXyz\fR and the command \fBunload bin/last.so {}\fR uses the
|
||||
prefix \fBLast\fR.
|
||||
.SH "PORTABILITY ISSUES"
|
||||
.TP
|
||||
\fBUnix\fR\0\0\0\0\0
|
||||
|
||||
+3
-1
@@ -84,7 +84,7 @@ Return a list of all files in the mounted zipfs, or just those matching
|
||||
\fIpattern\fR (optionally controlled by the option parameters). The order of
|
||||
the names in the list is arbitrary.
|
||||
.TP
|
||||
\fBzipfs mount ?\fImountpoint\fR? ?\fIzipfile\fR? ?\fIpassword\fR?
|
||||
\fBzipfs mount\fR ?\fImountpoint\fR? ?\fIzipfile\fR? ?\fIpassword\fR?
|
||||
.
|
||||
The \fBzipfs mount\fR command mounts a ZIP archive file as a Tcl virtual
|
||||
filesystem at \fImountpoint\fR. After this command executes, files contained
|
||||
@@ -146,6 +146,8 @@ the ZIP archive, otherwise the file returned by \fBinfo nameofexecutable\fR
|
||||
(see \fBzipfs mkkey\fR) is placed between the image and ZIP chunks of the
|
||||
output file and the contents of the ZIP chunk are protected with that
|
||||
password.
|
||||
If the starting image has a ZIP archive already attached to it, it is removed
|
||||
from the copy in \fIoutfile\fR before the new ZIP archive is added.
|
||||
.PP
|
||||
If there is a file, \fBmain.tcl\fR, in the root directory of the resulting
|
||||
archive and the image file that the archive is attached to is a \fBtclsh\fR
|
||||
|
||||
+2
-2
@@ -427,7 +427,7 @@ next(
|
||||
if (INCON(L_BBND) && NEXT1('}')) {
|
||||
v->now++;
|
||||
INTOCON(L_BRE);
|
||||
RET('}');
|
||||
RETV('}', 1);
|
||||
} else {
|
||||
FAILW(REG_BADBR);
|
||||
}
|
||||
@@ -1005,7 +1005,7 @@ brenext(
|
||||
if (LASTTYPE(EMPTY) || LASTTYPE('(') || LASTTYPE('^')) {
|
||||
RETV(PLAIN, c);
|
||||
}
|
||||
RET('*');
|
||||
RETV('*', 1);
|
||||
break;
|
||||
case CHR('['):
|
||||
if (HAVE(6) && *(v->now+0) == CHR('[') &&
|
||||
|
||||
+37
-17
@@ -860,8 +860,8 @@ declare 243 {
|
||||
void Tcl_SplitPath(const char *path, int *argcPtr, const char ***argvPtr)
|
||||
}
|
||||
declare 244 {nostub {Don't use this function in a stub-enabled extension}} {
|
||||
void Tcl_StaticPackage(Tcl_Interp *interp, const char *pkgName,
|
||||
Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc)
|
||||
void Tcl_StaticLibrary(Tcl_Interp *interp, const char *prefix,
|
||||
Tcl_LibraryInitProc *initProc, Tcl_LibraryInitProc *safeInitProc)
|
||||
}
|
||||
declare 245 {deprecated {No longer in use, changed to macro}} {
|
||||
int Tcl_StringMatch(const char *str, const char *pattern)
|
||||
@@ -1163,7 +1163,7 @@ declare 325 {
|
||||
const char *Tcl_UtfAtIndex(const char *src, int index)
|
||||
}
|
||||
declare 326 {
|
||||
int Tcl_UtfCharComplete(const char *src, int length)
|
||||
int TclUtfCharComplete(const char *src, int length)
|
||||
}
|
||||
declare 327 {
|
||||
int Tcl_UtfBackslash(const char *src, int *readPtr, char *dst)
|
||||
@@ -1175,10 +1175,10 @@ declare 329 {
|
||||
const char *Tcl_UtfFindLast(const char *src, int ch)
|
||||
}
|
||||
declare 330 {
|
||||
const char *Tcl_UtfNext(const char *src)
|
||||
const char *TclUtfNext(const char *src)
|
||||
}
|
||||
declare 331 {
|
||||
const char *Tcl_UtfPrev(const char *src, const char *start)
|
||||
const char *TclUtfPrev(const char *src, const char *start)
|
||||
}
|
||||
declare 332 {
|
||||
int Tcl_UtfToExternal(Tcl_Interp *interp, Tcl_Encoding encoding,
|
||||
@@ -1581,8 +1581,8 @@ declare 443 {
|
||||
}
|
||||
declare 444 {
|
||||
int Tcl_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *pathPtr, const char *sym1,
|
||||
const char *sym2, Tcl_PackageInitProc **proc1Ptr,
|
||||
Tcl_PackageInitProc **proc2Ptr, Tcl_LoadHandle *handlePtr,
|
||||
const char *sym2, Tcl_LibraryInitProc **proc1Ptr,
|
||||
Tcl_LibraryInitProc **proc2Ptr, Tcl_LoadHandle *handlePtr,
|
||||
Tcl_FSUnloadFileProc **unloadProcPtr)
|
||||
}
|
||||
declare 445 {
|
||||
@@ -1751,10 +1751,10 @@ declare 490 {
|
||||
Tcl_StatBuf *Tcl_AllocStatBuf(void)
|
||||
}
|
||||
declare 491 {
|
||||
Tcl_WideInt Tcl_Seek(Tcl_Channel chan, Tcl_WideInt offset, int mode)
|
||||
long long Tcl_Seek(Tcl_Channel chan, long long offset, int mode)
|
||||
}
|
||||
declare 492 {
|
||||
Tcl_WideInt Tcl_Tell(Tcl_Channel chan)
|
||||
long long Tcl_Tell(Tcl_Channel chan)
|
||||
}
|
||||
|
||||
# TIP#91 (back-compat enhancements for channels) dkf
|
||||
@@ -2026,7 +2026,7 @@ declare 559 {
|
||||
|
||||
# TIP #208 ('chan' command) jeffh
|
||||
declare 560 {
|
||||
int Tcl_TruncateChannel(Tcl_Channel chan, Tcl_WideInt length)
|
||||
int Tcl_TruncateChannel(Tcl_Channel chan, long long length)
|
||||
}
|
||||
declare 561 {
|
||||
Tcl_DriverTruncateProc *Tcl_ChannelTruncateProc(
|
||||
@@ -2177,19 +2177,19 @@ declare 595 {
|
||||
int Tcl_GetDeviceTypeFromStat(const Tcl_StatBuf *statPtr)
|
||||
}
|
||||
declare 596 {
|
||||
Tcl_WideInt Tcl_GetAccessTimeFromStat(const Tcl_StatBuf *statPtr)
|
||||
long long Tcl_GetAccessTimeFromStat(const Tcl_StatBuf *statPtr)
|
||||
}
|
||||
declare 597 {
|
||||
Tcl_WideInt Tcl_GetModificationTimeFromStat(const Tcl_StatBuf *statPtr)
|
||||
long long Tcl_GetModificationTimeFromStat(const Tcl_StatBuf *statPtr)
|
||||
}
|
||||
declare 598 {
|
||||
Tcl_WideInt Tcl_GetChangeTimeFromStat(const Tcl_StatBuf *statPtr)
|
||||
long long Tcl_GetChangeTimeFromStat(const Tcl_StatBuf *statPtr)
|
||||
}
|
||||
declare 599 {
|
||||
Tcl_WideUInt Tcl_GetSizeFromStat(const Tcl_StatBuf *statPtr)
|
||||
unsigned long long Tcl_GetSizeFromStat(const Tcl_StatBuf *statPtr)
|
||||
}
|
||||
declare 600 {
|
||||
Tcl_WideUInt Tcl_GetBlocksFromStat(const Tcl_StatBuf *statPtr)
|
||||
unsigned long long Tcl_GetBlocksFromStat(const Tcl_StatBuf *statPtr)
|
||||
}
|
||||
declare 601 {
|
||||
unsigned Tcl_GetBlockSizeFromStat(const Tcl_StatBuf *statPtr)
|
||||
@@ -2413,6 +2413,17 @@ declare 653 {
|
||||
unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, size_t *lengthPtr)
|
||||
}
|
||||
|
||||
# TIP #575
|
||||
declare 654 {
|
||||
int Tcl_UtfCharComplete(const char *src, int length)
|
||||
}
|
||||
declare 655 {
|
||||
const char *Tcl_UtfNext(const char *src)
|
||||
}
|
||||
declare 656 {
|
||||
const char *Tcl_UtfPrev(const char *src, const char *start)
|
||||
}
|
||||
|
||||
# ----- BASELINE -- FOR -- 8.7.0 ----- #
|
||||
|
||||
##############################################################################
|
||||
@@ -2437,6 +2448,9 @@ declare 0 win {
|
||||
declare 1 win {
|
||||
char *Tcl_WinTCharToUtf(const TCHAR *str, int len, Tcl_DString *dsPtr)
|
||||
}
|
||||
declare 3 win {
|
||||
void Tcl_WinConvertError(unsigned errCode)
|
||||
}
|
||||
|
||||
################################
|
||||
# Mac OS X specific functions
|
||||
@@ -2451,6 +2465,9 @@ declare 1 macosx {
|
||||
const char *bundleName, const char *bundleVersion,
|
||||
int hasResourceFile, int maxPathLen, char *libraryPath)
|
||||
}
|
||||
declare 2 macosx {
|
||||
void Tcl_MacOSXNotifierAddRunLoopMode(const void *runLoopMode)
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
|
||||
@@ -2464,8 +2481,8 @@ export {
|
||||
Tcl_Interp *interp)
|
||||
}
|
||||
export {
|
||||
void Tcl_StaticPackage(Tcl_Interp *interp, const char *pkgName,
|
||||
Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc)
|
||||
void Tcl_StaticLibrary(Tcl_Interp *interp, const char *prefix,
|
||||
Tcl_LibraryInitProc *initProc, Tcl_LibraryInitProc *safeInitProc)
|
||||
}
|
||||
export {
|
||||
void Tcl_SetPanicProc(TCL_NORETURN1 Tcl_PanicProc *panicProc)
|
||||
@@ -2494,6 +2511,9 @@ export {
|
||||
export {
|
||||
void Tcl_InitSubsystems(void)
|
||||
}
|
||||
export {
|
||||
int TclZipfs_AppHook(int *argc, char ***argv)
|
||||
}
|
||||
|
||||
# Local Variables:
|
||||
# mode: tcl
|
||||
|
||||
+433
-364
File diff suppressed because it is too large
Load Diff
+8
-6
@@ -31,7 +31,7 @@
|
||||
* until Tcl uses config.h properly.
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MSVCRT__) || defined(__BORLANDC__)
|
||||
#if defined(_MSC_VER) || defined(__MSVCRT__)
|
||||
typedef size_t caddr_t;
|
||||
#endif
|
||||
|
||||
@@ -94,7 +94,7 @@ union overhead {
|
||||
|
||||
#define MINBLOCK ((sizeof(union overhead) + (TCL_ALLOCALIGN-1)) & ~(TCL_ALLOCALIGN-1))
|
||||
#define NBUCKETS (13 - (MINBLOCK >> 4))
|
||||
#define MAXMALLOC (1<<(NBUCKETS+2))
|
||||
#define MAXMALLOC ((size_t)1 << (NBUCKETS+2))
|
||||
static union overhead *nextf[NBUCKETS];
|
||||
|
||||
/*
|
||||
@@ -583,7 +583,7 @@ TclpRealloc(
|
||||
Tcl_MutexUnlock(allocMutexPtr);
|
||||
return (void *)(overPtr+1);
|
||||
}
|
||||
maxSize = 1 << (i+3);
|
||||
maxSize = (size_t)1 << (i+3);
|
||||
expensive = 0;
|
||||
if (numBytes+OVERHEAD > maxSize) {
|
||||
expensive = 1;
|
||||
@@ -656,18 +656,18 @@ mstats(
|
||||
for (j=0, overPtr=nextf[i]; overPtr; overPtr=overPtr->next, j++) {
|
||||
fprintf(stderr, " %u", j);
|
||||
}
|
||||
totalFree += ((size_t)j) * (1 << (i + 3));
|
||||
totalFree += ((size_t)j) * ((size_t)1 << (i + 3));
|
||||
}
|
||||
|
||||
fprintf(stderr, "\nused:\t");
|
||||
for (i = 0; i < NBUCKETS; i++) {
|
||||
fprintf(stderr, " %" TCL_Z_MODIFIER "u", numMallocs[i]);
|
||||
totalUsed += numMallocs[i] * (1 << (i + 3));
|
||||
totalUsed += numMallocs[i] * ((size_t)1 << (i + 3));
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n\tTotal small in use: %" TCL_Z_MODIFIER "u, total free: %" TCL_Z_MODIFIER "u\n",
|
||||
totalUsed, totalFree);
|
||||
fprintf(stderr, "\n\tNumber of big (>%d) blocks in use: %" TCL_Z_MODIFIER "u\n",
|
||||
fprintf(stderr, "\n\tNumber of big (>%" TCL_Z_MODIFIER "u) blocks in use: %" TCL_Z_MODIFIER "u\n",
|
||||
MAXMALLOC, numMallocs[NBUCKETS]);
|
||||
|
||||
Tcl_MutexUnlock(allocMutexPtr);
|
||||
@@ -748,6 +748,8 @@ TclpRealloc(
|
||||
}
|
||||
|
||||
#endif /* !USE_TCLALLOC */
|
||||
#else
|
||||
TCL_MAC_EMPTY_FILE(generic_tclAlloc_c)
|
||||
#endif /* !TCL_THREADS */
|
||||
|
||||
/*
|
||||
|
||||
+16
-3
@@ -774,6 +774,10 @@ Tcl_CreateInterp(void)
|
||||
Tcl_InitHashTable(&iPtr->packageTable, TCL_STRING_KEYS);
|
||||
iPtr->packageUnknown = NULL;
|
||||
|
||||
#ifdef _WIN32
|
||||
# define getenv(x) _wgetenv(L##x) /* On Windows, use _wgetenv below */
|
||||
#endif
|
||||
|
||||
/* TIP #268 */
|
||||
#if (TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE)
|
||||
if (getenv("TCL_PKG_PREFER_LATEST") == NULL) {
|
||||
@@ -3509,6 +3513,8 @@ Tcl_DeleteCommandFromToken(
|
||||
|
||||
if (cmdPtr->tracePtr != NULL) {
|
||||
CommandTrace *tracePtr;
|
||||
/* Note that CallCommandTraces() never frees cmdPtr, that's
|
||||
* done just before Tcl_DeleteCommandFromToken() returns */
|
||||
CallCommandTraces(iPtr,cmdPtr,NULL,NULL,TCL_TRACE_DELETE);
|
||||
|
||||
/*
|
||||
@@ -3678,7 +3684,6 @@ CallCommandTraces(
|
||||
}
|
||||
}
|
||||
cmdPtr->flags |= CMD_TRACE_ACTIVE;
|
||||
cmdPtr->refCount++;
|
||||
|
||||
result = NULL;
|
||||
active.nextPtr = iPtr->activeCmdTracePtr;
|
||||
@@ -3736,7 +3741,6 @@ CallCommandTraces(
|
||||
*/
|
||||
|
||||
cmdPtr->flags &= ~CMD_TRACE_ACTIVE;
|
||||
cmdPtr->refCount--;
|
||||
iPtr->activeCmdTracePtr = active.nextPtr;
|
||||
Tcl_Release(iPtr);
|
||||
return result;
|
||||
@@ -7906,7 +7910,16 @@ ExprAbsFunc(
|
||||
}
|
||||
goto unChanged;
|
||||
} else if (l == WIDE_MIN) {
|
||||
if (mp_init_i64(&big, l) != MP_OKAY) {
|
||||
if (sizeof(Tcl_WideInt) > sizeof(int64_t)) {
|
||||
Tcl_WideUInt ul = -(Tcl_WideUInt)WIDE_MIN;
|
||||
if (mp_init(&big) != MP_OKAY || mp_unpack(&big, 1, 1,
|
||||
sizeof(Tcl_WideInt), 0, 0, &ul) != MP_OKAY) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (mp_neg(&big, &big) != MP_OKAY) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
} else if (mp_init_i64(&big, l) != MP_OKAY) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
goto tooLarge;
|
||||
|
||||
+56
-12
@@ -1650,19 +1650,37 @@ ClockGetenvObjCmd(
|
||||
int objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
#ifdef _WIN32
|
||||
const WCHAR *varName;
|
||||
const WCHAR *varValue;
|
||||
Tcl_DString ds;
|
||||
#else
|
||||
const char *varName;
|
||||
const char *varValue;
|
||||
#endif
|
||||
|
||||
if (objc != 2) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "name");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
Tcl_DStringInit(&ds);
|
||||
varName = Tcl_UtfToWCharDString(TclGetString(objv[1]), -1, &ds);
|
||||
varValue = _wgetenv(varName);
|
||||
if (varValue == NULL) {
|
||||
Tcl_DStringFree(&ds);
|
||||
} else {
|
||||
Tcl_DStringSetLength(&ds, 0);
|
||||
Tcl_WCharToUtfDString(varValue, -1, &ds);
|
||||
Tcl_DStringResult(interp, &ds);
|
||||
}
|
||||
#else
|
||||
varName = TclGetString(objv[1]);
|
||||
varValue = getenv(varName);
|
||||
if (varValue == NULL) {
|
||||
varValue = "";
|
||||
if (varValue != NULL) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(varValue, -1));
|
||||
}
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(varValue, -1));
|
||||
#endif
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -2021,26 +2039,52 @@ ClockSecondsObjCmd(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#define getenv(x) _wgetenv(L##x)
|
||||
#else
|
||||
#define WCHAR char
|
||||
#define wcslen strlen
|
||||
#define wcscmp strcmp
|
||||
#define wcscpy strcpy
|
||||
#endif
|
||||
|
||||
static void
|
||||
TzsetIfNecessary(void)
|
||||
{
|
||||
static char* tzWas = (char *)INT2PTR(-1); /* Previous value of TZ, protected by
|
||||
* clockMutex. */
|
||||
const char *tzIsNow; /* Current value of TZ */
|
||||
static WCHAR* tzWas = (WCHAR *)INT2PTR(-1); /* Previous value of TZ, protected by
|
||||
* clockMutex. */
|
||||
static long tzLastRefresh = 0; /* Used for latency before next refresh */
|
||||
static size_t tzEnvEpoch = 0; /* Last env epoch, for faster signaling,
|
||||
that TZ changed via TCL */
|
||||
const WCHAR *tzIsNow; /* Current value of TZ */
|
||||
|
||||
/*
|
||||
* Prevent performance regression on some platforms by resolving of system time zone:
|
||||
* small latency for check whether environment was changed (once per second)
|
||||
* no latency if environment was changed with tcl-env (compare both epoch values)
|
||||
*/
|
||||
Tcl_Time now;
|
||||
Tcl_GetTime(&now);
|
||||
if (now.sec == tzLastRefresh && tzEnvEpoch == TclEnvEpoch) {
|
||||
return;
|
||||
}
|
||||
|
||||
tzEnvEpoch = TclEnvEpoch;
|
||||
tzLastRefresh = now.sec;
|
||||
|
||||
Tcl_MutexLock(&clockMutex);
|
||||
tzIsNow = getenv("TZ");
|
||||
if (tzIsNow != NULL && (tzWas == NULL || tzWas == INT2PTR(-1)
|
||||
|| strcmp(tzIsNow, tzWas) != 0)) {
|
||||
if (tzIsNow != NULL && (tzWas == NULL || tzWas == (WCHAR *)INT2PTR(-1)
|
||||
|| wcscmp(tzIsNow, tzWas) != 0)) {
|
||||
tzset();
|
||||
if (tzWas != NULL && tzWas != INT2PTR(-1)) {
|
||||
if (tzWas != NULL && tzWas != (WCHAR *)INT2PTR(-1)) {
|
||||
ckfree(tzWas);
|
||||
}
|
||||
tzWas = (char *)ckalloc(strlen(tzIsNow) + 1);
|
||||
strcpy(tzWas, tzIsNow);
|
||||
tzWas = (WCHAR *)ckalloc(sizeof(WCHAR) * (wcslen(tzIsNow) + 1));
|
||||
wcscpy(tzWas, tzIsNow);
|
||||
} else if (tzIsNow == NULL && tzWas != NULL) {
|
||||
tzset();
|
||||
if (tzWas != INT2PTR(-1)) ckfree(tzWas);
|
||||
if (tzWas != (WCHAR *)INT2PTR(-1)) ckfree(tzWas);
|
||||
tzWas = NULL;
|
||||
}
|
||||
Tcl_MutexUnlock(&clockMutex);
|
||||
|
||||
+9
-7
@@ -86,12 +86,14 @@ typedef struct {
|
||||
* following values.
|
||||
*/
|
||||
|
||||
#define SORTMODE_ASCII 0
|
||||
#define SORTMODE_INTEGER 1
|
||||
#define SORTMODE_REAL 2
|
||||
#define SORTMODE_COMMAND 3
|
||||
#define SORTMODE_DICTIONARY 4
|
||||
#define SORTMODE_ASCII_NC 8
|
||||
enum SortModeFlags {
|
||||
SORTMODE_ASCII = 0,
|
||||
SORTMODE_INTEGER = 1,
|
||||
SORTMODE_REAL = 2,
|
||||
SORTMODE_COMMAND = 3,
|
||||
SORTMODE_DICTIONARY = 4,
|
||||
SORTMODE_ASCII_NC = 8
|
||||
};
|
||||
|
||||
/*
|
||||
* Forward declarations for procedures defined in this file:
|
||||
@@ -1700,7 +1702,7 @@ InfoLoadedCmd(
|
||||
} else { /* Get pkgs just in specified interp. */
|
||||
packageName = TclGetString(objv[2]);
|
||||
}
|
||||
return TclGetLoadedPackagesEx(interp, interpName, packageName);
|
||||
return TclGetLoadedLibraries(interp, interpName, packageName);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+7
-7
@@ -4148,14 +4148,14 @@ Tcl_TimeRateObjCmd(
|
||||
Tcl_Obj *objPtr;
|
||||
int result, i;
|
||||
Tcl_Obj *calibrate = NULL, *direct = NULL;
|
||||
TclWideMUInt count = 0; /* Holds repetition count */
|
||||
Tcl_WideUInt count = 0; /* Holds repetition count */
|
||||
Tcl_WideInt maxms = WIDE_MIN;
|
||||
/* Maximal running time (in milliseconds) */
|
||||
TclWideMUInt maxcnt = WIDE_MAX;
|
||||
Tcl_WideUInt maxcnt = WIDE_MAX;
|
||||
/* Maximal count of iterations. */
|
||||
TclWideMUInt threshold = 1; /* Current threshold for check time (faster
|
||||
Tcl_WideUInt threshold = 1; /* Current threshold for check time (faster
|
||||
* repeat count without time check) */
|
||||
TclWideMUInt maxIterTm = 1; /* Max time of some iteration as max
|
||||
Tcl_WideUInt maxIterTm = 1; /* Max time of some iteration as max
|
||||
* threshold, additionally avoiding divide to
|
||||
* zero (i.e., never < 1) */
|
||||
unsigned short factor = 50; /* Factor (4..50) limiting threshold to avoid
|
||||
@@ -4529,13 +4529,13 @@ Tcl_TimeRateObjCmd(
|
||||
|
||||
{
|
||||
Tcl_Obj *objarr[8], **objs = objarr;
|
||||
TclWideMUInt usec, val;
|
||||
Tcl_WideUInt usec, val;
|
||||
int digits;
|
||||
|
||||
/*
|
||||
* Absolute execution time in microseconds or in wide clicks.
|
||||
*/
|
||||
usec = (TclWideMUInt)(middle - start);
|
||||
usec = (Tcl_WideUInt)(middle - start);
|
||||
|
||||
#ifdef TCL_WIDE_CLICKS
|
||||
/*
|
||||
@@ -4565,7 +4565,7 @@ Tcl_TimeRateObjCmd(
|
||||
* Estimate the time of overhead (microsecs).
|
||||
*/
|
||||
|
||||
TclWideMUInt curOverhead = overhead * count;
|
||||
Tcl_WideUInt curOverhead = overhead * count;
|
||||
|
||||
if (usec > curOverhead) {
|
||||
usec -= curOverhead;
|
||||
|
||||
+74
-85
@@ -123,26 +123,27 @@ enum Marks {
|
||||
* store a NODE_TYPE code.
|
||||
*/
|
||||
|
||||
#define NODE_TYPE 0xC0
|
||||
enum NodeTypeFlags {
|
||||
NODE_TYPE = 0xC0,
|
||||
|
||||
/*
|
||||
* The four category values are LEAF, UNARY, and BINARY, explained below, and
|
||||
* "uncategorized", which is used either temporarily, until context determines
|
||||
* which of the other three categories is correct, or for lexemes like
|
||||
* INVALID, which aren't really lexemes at all, but indicators of a parsing
|
||||
* error. Note that the codes must be distinct to distinguish categories, but
|
||||
* need not take the form of a bit array.
|
||||
*/
|
||||
/*
|
||||
* The four category values are LEAF, UNARY, and BINARY, explained below,
|
||||
* and "uncategorized", which is used either temporarily, until context
|
||||
* determines which of the other three categories is correct, or for
|
||||
* lexemes like INVALID, which aren't really lexemes at all, but
|
||||
* indicators of a parsing error. Note that the codes must be distinct to
|
||||
* distinguish categories, but need not take the form of a bit array.
|
||||
*/
|
||||
|
||||
#define BINARY 0x40 /* This lexeme is a binary operator. An OpNode
|
||||
BINARY = 0x40, /* This lexeme is a binary operator. An OpNode
|
||||
* representing it should go into the parse
|
||||
* tree, and two operands should be parsed for
|
||||
* it in the expression. */
|
||||
#define UNARY 0x80 /* This lexeme is a unary operator. An OpNode
|
||||
UNARY = 0x80, /* This lexeme is a unary operator. An OpNode
|
||||
* representing it should go into the parse
|
||||
* tree, and one operand should be parsed for
|
||||
* it in the expression. */
|
||||
#define LEAF 0xC0 /* This lexeme is a leaf operand in the parse
|
||||
LEAF = 0xC0 /* This lexeme is a leaf operand in the parse
|
||||
* tree. No OpNode will be placed in the tree
|
||||
* for it. Either a literal value will be
|
||||
* appended to the list of literals in this
|
||||
@@ -150,47 +151,42 @@ enum Marks {
|
||||
* be appended in a Tcl_Parse struct to
|
||||
* represent those leaves that require some
|
||||
* form of substitution. */
|
||||
};
|
||||
|
||||
/* Uncategorized lexemes */
|
||||
enum LexemeTypes {
|
||||
/* Uncategorized lexemes */
|
||||
|
||||
#define PLUS 1 /* Ambiguous. Resolves to UNARY_PLUS or
|
||||
PLUS = 1, /* Ambiguous. Resolves to UNARY_PLUS or
|
||||
* BINARY_PLUS according to context. */
|
||||
#define MINUS 2 /* Ambiguous. Resolves to UNARY_MINUS or
|
||||
MINUS = 2, /* Ambiguous. Resolves to UNARY_MINUS or
|
||||
* BINARY_MINUS according to context. */
|
||||
#define BAREWORD 3 /* Ambigous. Resolves to BOOLEAN or to
|
||||
BAREWORD = 3, /* Ambigous. Resolves to BOOLEAN or to
|
||||
* FUNCTION or a parse error according to
|
||||
* context and value. */
|
||||
#define INCOMPLETE 4 /* A parse error. Used only when the single
|
||||
INCOMPLETE = 4, /* A parse error. Used only when the single
|
||||
* "=" is encountered. */
|
||||
#define INVALID 5 /* A parse error. Used when any punctuation
|
||||
INVALID = 5, /* A parse error. Used when any punctuation
|
||||
* appears that's not a supported operator. */
|
||||
#define COMMENT 6 /* Comment. Lasts to end of line or end of
|
||||
COMMENT = 6, /* Comment. Lasts to end of line or end of
|
||||
* expression, whichever comes first. */
|
||||
|
||||
/* Leaf lexemes */
|
||||
/* Leaf lexemes */
|
||||
|
||||
#define NUMBER (LEAF | 1)
|
||||
/* For literal numbers */
|
||||
#define SCRIPT (LEAF | 2)
|
||||
/* Script substitution; [foo] */
|
||||
#define BOOLEAN (LEAF | BAREWORD)
|
||||
/* For literal booleans */
|
||||
#define BRACED (LEAF | 4)
|
||||
/* Braced string; {foo bar} */
|
||||
#define VARIABLE (LEAF | 5)
|
||||
/* Variable substitution; $x */
|
||||
#define QUOTED (LEAF | 6)
|
||||
/* Quoted string; "foo $bar [soom]" */
|
||||
#define EMPTY (LEAF | 7)
|
||||
/* Used only for an empty argument list to a
|
||||
NUMBER = (LEAF | 1), /* For literal numbers */
|
||||
SCRIPT = (LEAF | 2), /* Script substitution; [foo] */
|
||||
BOOLEAN = (LEAF | BAREWORD),/* For literal booleans */
|
||||
BRACED = (LEAF | 4), /* Braced string; {foo bar} */
|
||||
VARIABLE = (LEAF | 5), /* Variable substitution; $x */
|
||||
QUOTED = (LEAF | 6), /* Quoted string; "foo $bar [soom]" */
|
||||
EMPTY = (LEAF | 7), /* Used only for an empty argument list to a
|
||||
* function. Represents the empty string
|
||||
* within parens in the expression: rand() */
|
||||
|
||||
/* Unary operator lexemes */
|
||||
/* Unary operator lexemes */
|
||||
|
||||
#define UNARY_PLUS (UNARY | PLUS)
|
||||
#define UNARY_MINUS (UNARY | MINUS)
|
||||
#define FUNCTION (UNARY | BAREWORD)
|
||||
UNARY_PLUS = (UNARY | PLUS),
|
||||
UNARY_MINUS = (UNARY | MINUS),
|
||||
FUNCTION = (UNARY | BAREWORD),
|
||||
/* This is a bit of "creative interpretation"
|
||||
* on the part of the parser. A function call
|
||||
* is parsed into the parse tree according to
|
||||
@@ -206,69 +202,62 @@ enum Marks {
|
||||
* include such exceptional handling in the
|
||||
* code against the need we would otherwise
|
||||
* have for more lexeme categories. */
|
||||
#define START (UNARY | 4)
|
||||
/* This lexeme isn't parsed from the
|
||||
START = (UNARY | 4), /* This lexeme isn't parsed from the
|
||||
* expression text at all. It represents the
|
||||
* start of the expression and sits at the
|
||||
* root of the parse tree where it serves as
|
||||
* the start/end point of traversals. */
|
||||
#define OPEN_PAREN (UNARY | 5)
|
||||
/* Another bit of creative interpretation,
|
||||
OPEN_PAREN = (UNARY | 5), /* Another bit of creative interpretation,
|
||||
* where we treat "(" as a unary operator with
|
||||
* the sub-expression between it and its
|
||||
* matching ")" as its operand. See
|
||||
* CLOSE_PAREN below. */
|
||||
#define NOT (UNARY | 6)
|
||||
#define BIT_NOT (UNARY | 7)
|
||||
NOT = (UNARY | 6),
|
||||
BIT_NOT = (UNARY | 7),
|
||||
|
||||
/* Binary operator lexemes */
|
||||
/* Binary operator lexemes */
|
||||
|
||||
#define BINARY_PLUS (BINARY | PLUS)
|
||||
#define BINARY_MINUS (BINARY | MINUS)
|
||||
#define COMMA (BINARY | 3)
|
||||
/* The "," operator is a low precedence binary
|
||||
BINARY_PLUS = (BINARY | PLUS),
|
||||
BINARY_MINUS = (BINARY | MINUS),
|
||||
COMMA = (BINARY | 3), /* The "," operator is a low precedence binary
|
||||
* operator that separates the arguments in a
|
||||
* function call. The additional constraint
|
||||
* that this operator can only legally appear
|
||||
* at the right places within a function call
|
||||
* argument list are hard coded within
|
||||
* ParseExpr(). */
|
||||
#define MULT (BINARY | 4)
|
||||
#define DIVIDE (BINARY | 5)
|
||||
#define MOD (BINARY | 6)
|
||||
#define LESS (BINARY | 7)
|
||||
#define GREATER (BINARY | 8)
|
||||
#define BIT_AND (BINARY | 9)
|
||||
#define BIT_XOR (BINARY | 10)
|
||||
#define BIT_OR (BINARY | 11)
|
||||
#define QUESTION (BINARY | 12)
|
||||
/* These two lexemes make up the */
|
||||
#define COLON (BINARY | 13)
|
||||
/* ternary conditional operator, $x ? $y : $z.
|
||||
* ParseExpr(). */
|
||||
MULT = (BINARY | 4),
|
||||
DIVIDE = (BINARY | 5),
|
||||
MOD = (BINARY | 6),
|
||||
LESS = (BINARY | 7),
|
||||
GREATER = (BINARY | 8),
|
||||
BIT_AND = (BINARY | 9),
|
||||
BIT_XOR = (BINARY | 10),
|
||||
BIT_OR = (BINARY | 11),
|
||||
QUESTION = (BINARY | 12), /* These two lexemes make up the */
|
||||
COLON = (BINARY | 13), /* ternary conditional operator, $x ? $y : $z.
|
||||
* We treat them as two binary operators to
|
||||
* avoid another lexeme category, and code the
|
||||
* additional constraints directly in
|
||||
* ParseExpr(). For instance, the right
|
||||
* operand of a "?" operator must be a ":"
|
||||
* operator. */
|
||||
#define LEFT_SHIFT (BINARY | 14)
|
||||
#define RIGHT_SHIFT (BINARY | 15)
|
||||
#define LEQ (BINARY | 16)
|
||||
#define GEQ (BINARY | 17)
|
||||
#define EQUAL (BINARY | 18)
|
||||
#define NEQ (BINARY | 19)
|
||||
#define AND (BINARY | 20)
|
||||
#define OR (BINARY | 21)
|
||||
#define STREQ (BINARY | 22)
|
||||
#define STRNEQ (BINARY | 23)
|
||||
#define EXPON (BINARY | 24)
|
||||
/* Unlike the other binary operators, EXPON is
|
||||
LEFT_SHIFT = (BINARY | 14),
|
||||
RIGHT_SHIFT = (BINARY | 15),
|
||||
LEQ = (BINARY | 16),
|
||||
GEQ = (BINARY | 17),
|
||||
EQUAL = (BINARY | 18),
|
||||
NEQ = (BINARY | 19),
|
||||
AND = (BINARY | 20),
|
||||
OR = (BINARY | 21),
|
||||
STREQ = (BINARY | 22),
|
||||
STRNEQ = (BINARY | 23),
|
||||
EXPON = (BINARY | 24), /* Unlike the other binary operators, EXPON is
|
||||
* right associative and this distinction is
|
||||
* coded directly in ParseExpr(). */
|
||||
#define IN_LIST (BINARY | 25)
|
||||
#define NOT_IN_LIST (BINARY | 26)
|
||||
#define CLOSE_PAREN (BINARY | 27)
|
||||
/* By categorizing the CLOSE_PAREN lexeme as a
|
||||
IN_LIST = (BINARY | 25),
|
||||
NOT_IN_LIST = (BINARY | 26),
|
||||
CLOSE_PAREN = (BINARY | 27),/* By categorizing the CLOSE_PAREN lexeme as a
|
||||
* BINARY operator, the normal parsing rules
|
||||
* for binary operators assure that a close
|
||||
* paren will not directly follow another
|
||||
@@ -283,17 +272,17 @@ enum Marks {
|
||||
* parse tree. The sub-expression between
|
||||
* parens becomes the single argument of the
|
||||
* matching OPEN_PAREN unary operator. */
|
||||
#define STR_LT (BINARY | 28)
|
||||
#define STR_GT (BINARY | 29)
|
||||
#define STR_LEQ (BINARY | 30)
|
||||
#define STR_GEQ (BINARY | 31)
|
||||
#define END (BINARY | 32)
|
||||
/* This lexeme represents the end of the
|
||||
STR_LT = (BINARY | 28),
|
||||
STR_GT = (BINARY | 29),
|
||||
STR_LEQ = (BINARY | 30),
|
||||
STR_GEQ = (BINARY | 31),
|
||||
END = (BINARY | 32), /* This lexeme represents the end of the
|
||||
* string being parsed. Treating it as a
|
||||
* binary operator follows the same logic as
|
||||
* the CLOSE_PAREN lexeme and END pairs with
|
||||
* START, in the same way that CLOSE_PAREN
|
||||
* pairs with OPEN_PAREN. */
|
||||
};
|
||||
|
||||
/*
|
||||
* When ParseExpr() builds the parse tree it must choose which operands to
|
||||
@@ -2145,7 +2134,7 @@ ParseLexeme(
|
||||
*/
|
||||
|
||||
if (!TclIsBareword(*start) || *start == '_') {
|
||||
if (TclUCS4Complete(start, numBytes)) {
|
||||
if (Tcl_UtfCharComplete(start, numBytes)) {
|
||||
scanned = TclUtfToUCS4(start, &ch);
|
||||
} else {
|
||||
char utfBytes[8];
|
||||
|
||||
+264
-276
@@ -395,21 +395,17 @@ typedef struct CompileEnv {
|
||||
* CmdLocation map, and the compilation AuxData array.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A PRECOMPILED bytecode struct is one that was generated from a compiled
|
||||
* image rather than implicitly compiled from source
|
||||
*/
|
||||
|
||||
#define TCL_BYTECODE_PRECOMPILED 0x0001
|
||||
|
||||
/*
|
||||
* When a bytecode is compiled, interp or namespace resolvers have not been
|
||||
* applied yet: this is indicated by the TCL_BYTECODE_RESOLVE_VARS flag.
|
||||
*/
|
||||
|
||||
#define TCL_BYTECODE_RESOLVE_VARS 0x0002
|
||||
|
||||
#define TCL_BYTECODE_RECOMPILE 0x0004
|
||||
enum BytecodeFlags {
|
||||
TCL_BYTECODE_PRECOMPILED = 0x0001,
|
||||
/* A PRECOMPILED bytecode struct is one that
|
||||
* was generated from a compiled image rather
|
||||
* than implicitly compiled from source. */
|
||||
TCL_BYTECODE_RESOLVE_VARS = 0x0002,
|
||||
/* When a bytecode is compiled, interp or
|
||||
* namespace resolvers have not been applied
|
||||
* yet: this is indicated by the this flag. */
|
||||
TCL_BYTECODE_RECOMPILE = 0x0004
|
||||
};
|
||||
|
||||
typedef struct ByteCode {
|
||||
TclHandle interpHandle; /* Handle for interpreter containing the
|
||||
@@ -540,316 +536,306 @@ typedef struct ByteCode {
|
||||
* tclExecute.c.
|
||||
*/
|
||||
|
||||
/* Opcodes 0 to 9 */
|
||||
#define INST_DONE 0
|
||||
#define INST_PUSH1 1
|
||||
#define INST_PUSH4 2
|
||||
#define INST_POP 3
|
||||
#define INST_DUP 4
|
||||
#define INST_STR_CONCAT1 5
|
||||
#define INST_INVOKE_STK1 6
|
||||
#define INST_INVOKE_STK4 7
|
||||
#define INST_EVAL_STK 8
|
||||
#define INST_EXPR_STK 9
|
||||
#ifdef _BUILD_TCL_EXECUTE
|
||||
#define IS_DEPRECATED /* nothing */
|
||||
#else
|
||||
#define IS_DEPRECATED TCL_DEPRECATED_API("no longer used")
|
||||
#endif /* _BUILD_TCL_EXECUTE*/
|
||||
|
||||
/* Opcodes 10 to 23 */
|
||||
#define INST_LOAD_SCALAR1 10
|
||||
#define INST_LOAD_SCALAR4 11
|
||||
#define INST_LOAD_SCALAR_STK 12
|
||||
#define INST_LOAD_ARRAY1 13
|
||||
#define INST_LOAD_ARRAY4 14
|
||||
#define INST_LOAD_ARRAY_STK 15
|
||||
#define INST_LOAD_STK 16
|
||||
#define INST_STORE_SCALAR1 17
|
||||
#define INST_STORE_SCALAR4 18
|
||||
#define INST_STORE_SCALAR_STK 19
|
||||
#define INST_STORE_ARRAY1 20
|
||||
#define INST_STORE_ARRAY4 21
|
||||
#define INST_STORE_ARRAY_STK 22
|
||||
#define INST_STORE_STK 23
|
||||
enum TclBytecodeOpcodes {
|
||||
/* Opcodes 0 to 9: Basic operations */
|
||||
INST_DONE = 0,
|
||||
INST_PUSH1 = 1,
|
||||
INST_PUSH4 = 2,
|
||||
INST_POP = 3,
|
||||
INST_DUP = 4,
|
||||
INST_STR_CONCAT1 = 5,
|
||||
INST_INVOKE_STK1 = 6,
|
||||
INST_INVOKE_STK4 = 7,
|
||||
INST_EVAL_STK = 8,
|
||||
INST_EXPR_STK = 9,
|
||||
|
||||
/* Opcodes 24 to 33 */
|
||||
#define INST_INCR_SCALAR1 24
|
||||
#define INST_INCR_SCALAR_STK 25
|
||||
#define INST_INCR_ARRAY1 26
|
||||
#define INST_INCR_ARRAY_STK 27
|
||||
#define INST_INCR_STK 28
|
||||
#define INST_INCR_SCALAR1_IMM 29
|
||||
#define INST_INCR_SCALAR_STK_IMM 30
|
||||
#define INST_INCR_ARRAY1_IMM 31
|
||||
#define INST_INCR_ARRAY_STK_IMM 32
|
||||
#define INST_INCR_STK_IMM 33
|
||||
/* Opcodes 10 to 23: LOAD and STORE */
|
||||
INST_LOAD_SCALAR1 = 10,
|
||||
INST_LOAD_SCALAR4 = 11,
|
||||
INST_LOAD_SCALAR_STK = 12,
|
||||
INST_LOAD_ARRAY1 = 13,
|
||||
INST_LOAD_ARRAY4 = 14,
|
||||
INST_LOAD_ARRAY_STK = 15,
|
||||
INST_LOAD_STK = 16,
|
||||
INST_STORE_SCALAR1 = 17,
|
||||
INST_STORE_SCALAR4 = 18,
|
||||
INST_STORE_SCALAR_STK = 19,
|
||||
INST_STORE_ARRAY1 = 20,
|
||||
INST_STORE_ARRAY4 = 21,
|
||||
INST_STORE_ARRAY_STK = 22,
|
||||
INST_STORE_STK = 23,
|
||||
|
||||
/* Opcodes 34 to 39 */
|
||||
#define INST_JUMP1 34
|
||||
#define INST_JUMP4 35
|
||||
#define INST_JUMP_TRUE1 36
|
||||
#define INST_JUMP_TRUE4 37
|
||||
#define INST_JUMP_FALSE1 38
|
||||
#define INST_JUMP_FALSE4 39
|
||||
/* Opcodes 24 to 33: INCR */
|
||||
INST_INCR_SCALAR1 = 24,
|
||||
INST_INCR_SCALAR_STK = 25,
|
||||
INST_INCR_ARRAY1 = 26,
|
||||
INST_INCR_ARRAY_STK = 27,
|
||||
INST_INCR_STK = 28,
|
||||
INST_INCR_SCALAR1_IMM = 29,
|
||||
INST_INCR_SCALAR_STK_IMM = 30,
|
||||
INST_INCR_ARRAY1_IMM = 31,
|
||||
INST_INCR_ARRAY_STK_IMM = 32,
|
||||
INST_INCR_STK_IMM = 33,
|
||||
|
||||
/* Opcodes 40 to 64 */
|
||||
#define INST_LOR 40
|
||||
#define INST_LAND 41
|
||||
#define INST_BITOR 42
|
||||
#define INST_BITXOR 43
|
||||
#define INST_BITAND 44
|
||||
#define INST_EQ 45
|
||||
#define INST_NEQ 46
|
||||
#define INST_LT 47
|
||||
#define INST_GT 48
|
||||
#define INST_LE 49
|
||||
#define INST_GE 50
|
||||
#define INST_LSHIFT 51
|
||||
#define INST_RSHIFT 52
|
||||
#define INST_ADD 53
|
||||
#define INST_SUB 54
|
||||
#define INST_MULT 55
|
||||
#define INST_DIV 56
|
||||
#define INST_MOD 57
|
||||
#define INST_UPLUS 58
|
||||
#define INST_UMINUS 59
|
||||
#define INST_BITNOT 60
|
||||
#define INST_LNOT 61
|
||||
#define INST_CALL_BUILTIN_FUNC1 62
|
||||
#define INST_CALL_FUNC1 63
|
||||
#define INST_TRY_CVT_TO_NUMERIC 64
|
||||
/* Opcodes 34 to 39: JUMP */
|
||||
INST_JUMP1 = 34,
|
||||
INST_JUMP4 = 35,
|
||||
INST_JUMP_TRUE1 = 36,
|
||||
INST_JUMP_TRUE4 = 37,
|
||||
INST_JUMP_FALSE1 = 38,
|
||||
INST_JUMP_FALSE4 = 39,
|
||||
|
||||
/* Opcodes 65 to 66 */
|
||||
#define INST_BREAK 65
|
||||
#define INST_CONTINUE 66
|
||||
/* Opcodes 40 to 64: Expression implementation */
|
||||
INST_LOR = 40,
|
||||
INST_LAND = 41,
|
||||
INST_BITOR = 42,
|
||||
INST_BITXOR = 43,
|
||||
INST_BITAND = 44,
|
||||
INST_EQ = 45,
|
||||
INST_NEQ = 46,
|
||||
INST_LT = 47,
|
||||
INST_GT = 48,
|
||||
INST_LE = 49,
|
||||
INST_GE = 50,
|
||||
INST_LSHIFT = 51,
|
||||
INST_RSHIFT = 52,
|
||||
INST_ADD = 53,
|
||||
INST_SUB = 54,
|
||||
INST_MULT = 55,
|
||||
INST_DIV = 56,
|
||||
INST_MOD = 57,
|
||||
INST_UPLUS = 58,
|
||||
INST_UMINUS = 59,
|
||||
INST_BITNOT = 60,
|
||||
INST_LNOT = 61,
|
||||
#ifndef NO_DEPRECATED_BYTECODES
|
||||
INST_CALL_BUILTIN_FUNC1 IS_DEPRECATED = 62,
|
||||
INST_CALL_FUNC1 IS_DEPRECATED = 63,
|
||||
#endif
|
||||
INST_TRY_CVT_TO_NUMERIC = 64,
|
||||
|
||||
/* Opcodes 67 to 68 */
|
||||
#define INST_FOREACH_START4 67 /* DEPRECATED */
|
||||
#define INST_FOREACH_STEP4 68 /* DEPRECATED */
|
||||
/* Opcodes 65 to 66: Local exceptions */
|
||||
INST_BREAK = 65,
|
||||
INST_CONTINUE = 66,
|
||||
|
||||
/* Opcodes 69 to 72 */
|
||||
#define INST_BEGIN_CATCH4 69
|
||||
#define INST_END_CATCH 70
|
||||
#define INST_PUSH_RESULT 71
|
||||
#define INST_PUSH_RETURN_CODE 72
|
||||
#ifndef NO_DEPRECATED_BYTECODES
|
||||
/* Opcodes 67 to 68: Old Foreach */
|
||||
INST_FOREACH_START4 IS_DEPRECATED = 67,
|
||||
INST_FOREACH_STEP4 IS_DEPRECATED = 68,
|
||||
#endif
|
||||
|
||||
/* Opcodes 73 to 78 */
|
||||
#define INST_STR_EQ 73
|
||||
#define INST_STR_NEQ 74
|
||||
#define INST_STR_CMP 75
|
||||
#define INST_STR_LEN 76
|
||||
#define INST_STR_INDEX 77
|
||||
#define INST_STR_MATCH 78
|
||||
/* Opcodes 69 to 72: Catch */
|
||||
INST_BEGIN_CATCH4 = 69,
|
||||
INST_END_CATCH = 70,
|
||||
INST_PUSH_RESULT = 71,
|
||||
INST_PUSH_RETURN_CODE = 72,
|
||||
|
||||
/* Opcodes 78 to 81 */
|
||||
#define INST_LIST 79
|
||||
#define INST_LIST_INDEX 80
|
||||
#define INST_LIST_LENGTH 81
|
||||
/* Opcodes 73 to 78: misc string ops */
|
||||
INST_STR_EQ = 73,
|
||||
INST_STR_NEQ = 74,
|
||||
INST_STR_CMP = 75,
|
||||
INST_STR_LEN = 76,
|
||||
INST_STR_INDEX = 77,
|
||||
INST_STR_MATCH = 78,
|
||||
|
||||
/* Opcodes 82 to 87 */
|
||||
#define INST_APPEND_SCALAR1 82
|
||||
#define INST_APPEND_SCALAR4 83
|
||||
#define INST_APPEND_ARRAY1 84
|
||||
#define INST_APPEND_ARRAY4 85
|
||||
#define INST_APPEND_ARRAY_STK 86
|
||||
#define INST_APPEND_STK 87
|
||||
/* Opcodes 78 to 81: misc list ops */
|
||||
INST_LIST = 79,
|
||||
INST_LIST_INDEX = 80,
|
||||
INST_LIST_LENGTH = 81,
|
||||
|
||||
/* Opcodes 88 to 93 */
|
||||
#define INST_LAPPEND_SCALAR1 88
|
||||
#define INST_LAPPEND_SCALAR4 89
|
||||
#define INST_LAPPEND_ARRAY1 90
|
||||
#define INST_LAPPEND_ARRAY4 91
|
||||
#define INST_LAPPEND_ARRAY_STK 92
|
||||
#define INST_LAPPEND_STK 93
|
||||
/* Opcodes 82 to 87: APPEND */
|
||||
INST_APPEND_SCALAR1 = 82,
|
||||
INST_APPEND_SCALAR4 = 83,
|
||||
INST_APPEND_ARRAY1 = 84,
|
||||
INST_APPEND_ARRAY4 = 85,
|
||||
INST_APPEND_ARRAY_STK = 86,
|
||||
INST_APPEND_STK = 87,
|
||||
|
||||
/* TIP #22 - LINDEX operator with flat arg list */
|
||||
/* Opcodes 88 to 93: LAPPEND */
|
||||
INST_LAPPEND_SCALAR1 = 88,
|
||||
INST_LAPPEND_SCALAR4 = 89,
|
||||
INST_LAPPEND_ARRAY1 = 90,
|
||||
INST_LAPPEND_ARRAY4 = 91,
|
||||
INST_LAPPEND_ARRAY_STK = 92,
|
||||
INST_LAPPEND_STK = 93,
|
||||
|
||||
#define INST_LIST_INDEX_MULTI 94
|
||||
/* TIP #22 - LINDEX operator with flat arg list */
|
||||
INST_LIST_INDEX_MULTI = 94,
|
||||
|
||||
/*
|
||||
* TIP #33 - 'lset' command. Code gen also required a Forth-like
|
||||
* OVER operation.
|
||||
*/
|
||||
/* TIP #33 - 'lset' command. Code gen also required a Forth-like OVER
|
||||
* operation. */
|
||||
INST_OVER = 95,
|
||||
INST_LSET_LIST = 96,
|
||||
INST_LSET_FLAT = 97,
|
||||
|
||||
#define INST_OVER 95
|
||||
#define INST_LSET_LIST 96
|
||||
#define INST_LSET_FLAT 97
|
||||
/* TIP#90 - 'return' command. */
|
||||
INST_RETURN_IMM = 98,
|
||||
|
||||
/* TIP#90 - 'return' command. */
|
||||
/* TIP#123 - exponentiation operator. */
|
||||
INST_EXPON = 99,
|
||||
|
||||
#define INST_RETURN_IMM 98
|
||||
/* TIP #157 - {*}... (word expansion) language syntax support. */
|
||||
INST_EXPAND_START = 100,
|
||||
INST_EXPAND_STKTOP = 101,
|
||||
INST_INVOKE_EXPANDED = 102,
|
||||
|
||||
/* TIP#123 - exponentiation operator. */
|
||||
/* TIP #57 - 'lassign' command. Code generation requires immediate LINDEX
|
||||
* and LRANGE operators. */
|
||||
INST_LIST_INDEX_IMM = 103,
|
||||
INST_LIST_RANGE_IMM = 104,
|
||||
|
||||
#define INST_EXPON 99
|
||||
INST_START_CMD = 105,
|
||||
|
||||
/* TIP #157 - {*}... (word expansion) language syntax support. */
|
||||
INST_LIST_IN = 106,
|
||||
INST_LIST_NOT_IN = 107,
|
||||
|
||||
#define INST_EXPAND_START 100
|
||||
#define INST_EXPAND_STKTOP 101
|
||||
#define INST_INVOKE_EXPANDED 102
|
||||
INST_PUSH_RETURN_OPTIONS = 108,
|
||||
INST_RETURN_STK = 109,
|
||||
|
||||
/*
|
||||
* TIP #57 - 'lassign' command. Code generation requires immediate
|
||||
* LINDEX and LRANGE operators.
|
||||
*/
|
||||
/* Dictionary (TIP#111) related commands. */
|
||||
INST_DICT_GET = 110,
|
||||
INST_DICT_SET = 111,
|
||||
INST_DICT_UNSET = 112,
|
||||
INST_DICT_INCR_IMM = 113,
|
||||
INST_DICT_APPEND = 114,
|
||||
INST_DICT_LAPPEND = 115,
|
||||
INST_DICT_FIRST = 116,
|
||||
INST_DICT_NEXT = 117,
|
||||
INST_DICT_DONE = 118,
|
||||
INST_DICT_UPDATE_START = 119,
|
||||
INST_DICT_UPDATE_END = 120,
|
||||
|
||||
#define INST_LIST_INDEX_IMM 103
|
||||
#define INST_LIST_RANGE_IMM 104
|
||||
/* Instruction to support jumps defined by tables (instead of the classic
|
||||
* [switch] technique of chained comparisons). */
|
||||
INST_JUMP_TABLE = 121,
|
||||
|
||||
#define INST_START_CMD 105
|
||||
/* Instructions to support compilation of global, variable, upvar and
|
||||
* [namespace upvar]. */
|
||||
INST_UPVAR = 122,
|
||||
INST_NSUPVAR = 123,
|
||||
INST_VARIABLE = 124,
|
||||
|
||||
#define INST_LIST_IN 106
|
||||
#define INST_LIST_NOT_IN 107
|
||||
/* Instruction to support compiling syntax error to bytecode */
|
||||
INST_SYNTAX = 125,
|
||||
|
||||
#define INST_PUSH_RETURN_OPTIONS 108
|
||||
#define INST_RETURN_STK 109
|
||||
/* Instruction to reverse N items on top of stack */
|
||||
INST_REVERSE = 126,
|
||||
|
||||
/*
|
||||
* Dictionary (TIP#111) related commands.
|
||||
*/
|
||||
/* regexp instruction */
|
||||
INST_REGEXP = 127,
|
||||
|
||||
#define INST_DICT_GET 110
|
||||
#define INST_DICT_SET 111
|
||||
#define INST_DICT_UNSET 112
|
||||
#define INST_DICT_INCR_IMM 113
|
||||
#define INST_DICT_APPEND 114
|
||||
#define INST_DICT_LAPPEND 115
|
||||
#define INST_DICT_FIRST 116
|
||||
#define INST_DICT_NEXT 117
|
||||
#define INST_DICT_DONE 118
|
||||
#define INST_DICT_UPDATE_START 119
|
||||
#define INST_DICT_UPDATE_END 120
|
||||
/* For [info exists] compilation */
|
||||
INST_EXIST_SCALAR = 128,
|
||||
INST_EXIST_ARRAY = 129,
|
||||
INST_EXIST_ARRAY_STK = 130,
|
||||
INST_EXIST_STK = 131,
|
||||
|
||||
/*
|
||||
* Instruction to support jumps defined by tables (instead of the classic
|
||||
* [switch] technique of chained comparisons).
|
||||
*/
|
||||
/* For [subst] compilation */
|
||||
INST_NOP = 132,
|
||||
INST_RETURN_CODE_BRANCH = 133,
|
||||
|
||||
#define INST_JUMP_TABLE 121
|
||||
/* For [unset] compilation */
|
||||
INST_UNSET_SCALAR = 134,
|
||||
INST_UNSET_ARRAY = 135,
|
||||
INST_UNSET_ARRAY_STK = 136,
|
||||
INST_UNSET_STK = 137,
|
||||
|
||||
/*
|
||||
* Instructions to support compilation of global, variable, upvar and
|
||||
* [namespace upvar].
|
||||
*/
|
||||
/* For [dict with], [dict exists], [dict create] and [dict merge] */
|
||||
INST_DICT_EXPAND = 138,
|
||||
INST_DICT_RECOMBINE_STK = 139,
|
||||
INST_DICT_RECOMBINE_IMM = 140,
|
||||
INST_DICT_EXISTS = 141,
|
||||
INST_DICT_VERIFY = 142,
|
||||
|
||||
#define INST_UPVAR 122
|
||||
#define INST_NSUPVAR 123
|
||||
#define INST_VARIABLE 124
|
||||
/* For [string map] and [regsub] compilation */
|
||||
INST_STR_MAP = 143,
|
||||
INST_STR_FIND = 144,
|
||||
INST_STR_FIND_LAST = 145,
|
||||
INST_STR_RANGE_IMM = 146,
|
||||
INST_STR_RANGE = 147,
|
||||
|
||||
/* Instruction to support compiling syntax error to bytecode */
|
||||
/* For operations to do with coroutines and other NRE-manipulators */
|
||||
INST_YIELD = 148,
|
||||
INST_COROUTINE_NAME = 149,
|
||||
INST_TAILCALL = 150,
|
||||
|
||||
#define INST_SYNTAX 125
|
||||
/* For compilation of basic information operations */
|
||||
INST_NS_CURRENT = 151,
|
||||
INST_INFO_LEVEL_NUM = 152,
|
||||
INST_INFO_LEVEL_ARGS = 153,
|
||||
INST_RESOLVE_COMMAND = 154,
|
||||
|
||||
/* Instruction to reverse N items on top of stack */
|
||||
/* For compilation relating to TclOO */
|
||||
INST_TCLOO_SELF = 155,
|
||||
INST_TCLOO_CLASS = 156,
|
||||
INST_TCLOO_NS = 157,
|
||||
INST_TCLOO_IS_OBJECT = 158,
|
||||
|
||||
#define INST_REVERSE 126
|
||||
/* For compilation of [array] subcommands */
|
||||
INST_ARRAY_EXISTS_STK = 159,
|
||||
INST_ARRAY_EXISTS_IMM = 160,
|
||||
INST_ARRAY_MAKE_STK = 161,
|
||||
INST_ARRAY_MAKE_IMM = 162,
|
||||
|
||||
/* regexp instruction */
|
||||
INST_INVOKE_REPLACE = 163,
|
||||
|
||||
#define INST_REGEXP 127
|
||||
INST_LIST_CONCAT = 164,
|
||||
|
||||
/* For [info exists] compilation */
|
||||
#define INST_EXIST_SCALAR 128
|
||||
#define INST_EXIST_ARRAY 129
|
||||
#define INST_EXIST_ARRAY_STK 130
|
||||
#define INST_EXIST_STK 131
|
||||
INST_EXPAND_DROP = 165,
|
||||
|
||||
/* For [subst] compilation */
|
||||
#define INST_NOP 132
|
||||
#define INST_RETURN_CODE_BRANCH 133
|
||||
/* New foreach implementation */
|
||||
INST_FOREACH_START = 166,
|
||||
INST_FOREACH_STEP = 167,
|
||||
INST_FOREACH_END = 168,
|
||||
INST_LMAP_COLLECT = 169,
|
||||
|
||||
/* For [unset] compilation */
|
||||
#define INST_UNSET_SCALAR 134
|
||||
#define INST_UNSET_ARRAY 135
|
||||
#define INST_UNSET_ARRAY_STK 136
|
||||
#define INST_UNSET_STK 137
|
||||
/* For compilation of [string trim] and related */
|
||||
INST_STR_TRIM = 170,
|
||||
INST_STR_TRIM_LEFT = 171,
|
||||
INST_STR_TRIM_RIGHT = 172,
|
||||
|
||||
/* For [dict with], [dict exists], [dict create] and [dict merge] */
|
||||
#define INST_DICT_EXPAND 138
|
||||
#define INST_DICT_RECOMBINE_STK 139
|
||||
#define INST_DICT_RECOMBINE_IMM 140
|
||||
#define INST_DICT_EXISTS 141
|
||||
#define INST_DICT_VERIFY 142
|
||||
INST_CONCAT_STK = 173,
|
||||
|
||||
/* For [string map] and [regsub] compilation */
|
||||
#define INST_STR_MAP 143
|
||||
#define INST_STR_FIND 144
|
||||
#define INST_STR_FIND_LAST 145
|
||||
#define INST_STR_RANGE_IMM 146
|
||||
#define INST_STR_RANGE 147
|
||||
INST_STR_UPPER = 174,
|
||||
INST_STR_LOWER = 175,
|
||||
INST_STR_TITLE = 176,
|
||||
INST_STR_REPLACE = 177,
|
||||
|
||||
/* For operations to do with coroutines and other NRE-manipulators */
|
||||
#define INST_YIELD 148
|
||||
#define INST_COROUTINE_NAME 149
|
||||
#define INST_TAILCALL 150
|
||||
INST_ORIGIN_COMMAND = 178,
|
||||
|
||||
/* For compilation of basic information operations */
|
||||
#define INST_NS_CURRENT 151
|
||||
#define INST_INFO_LEVEL_NUM 152
|
||||
#define INST_INFO_LEVEL_ARGS 153
|
||||
#define INST_RESOLVE_COMMAND 154
|
||||
INST_TCLOO_NEXT = 179,
|
||||
INST_TCLOO_NEXT_CLASS = 180,
|
||||
|
||||
/* For compilation relating to TclOO */
|
||||
#define INST_TCLOO_SELF 155
|
||||
#define INST_TCLOO_CLASS 156
|
||||
#define INST_TCLOO_NS 157
|
||||
#define INST_TCLOO_IS_OBJECT 158
|
||||
INST_YIELD_TO_INVOKE = 181,
|
||||
|
||||
/* For compilation of [array] subcommands */
|
||||
#define INST_ARRAY_EXISTS_STK 159
|
||||
#define INST_ARRAY_EXISTS_IMM 160
|
||||
#define INST_ARRAY_MAKE_STK 161
|
||||
#define INST_ARRAY_MAKE_IMM 162
|
||||
INST_NUM_TYPE = 182,
|
||||
INST_TRY_CVT_TO_BOOLEAN = 183,
|
||||
INST_STR_CLASS = 184,
|
||||
|
||||
#define INST_INVOKE_REPLACE 163
|
||||
INST_LAPPEND_LIST = 185,
|
||||
INST_LAPPEND_LIST_ARRAY = 186,
|
||||
INST_LAPPEND_LIST_ARRAY_STK = 187,
|
||||
INST_LAPPEND_LIST_STK = 188,
|
||||
|
||||
#define INST_LIST_CONCAT 164
|
||||
INST_CLOCK_READ = 189,
|
||||
|
||||
#define INST_EXPAND_DROP 165
|
||||
INST_DICT_GET_DEF = 190,
|
||||
|
||||
/* New foreach implementation */
|
||||
#define INST_FOREACH_START 166
|
||||
#define INST_FOREACH_STEP 167
|
||||
#define INST_FOREACH_END 168
|
||||
#define INST_LMAP_COLLECT 169
|
||||
/* TIP 461 */
|
||||
INST_STR_LT = 191,
|
||||
INST_STR_GT = 192,
|
||||
INST_STR_LE = 193,
|
||||
INST_STR_GE = 194,
|
||||
|
||||
/* For compilation of [string trim] and related */
|
||||
#define INST_STR_TRIM 170
|
||||
#define INST_STR_TRIM_LEFT 171
|
||||
#define INST_STR_TRIM_RIGHT 172
|
||||
|
||||
#define INST_CONCAT_STK 173
|
||||
|
||||
#define INST_STR_UPPER 174
|
||||
#define INST_STR_LOWER 175
|
||||
#define INST_STR_TITLE 176
|
||||
#define INST_STR_REPLACE 177
|
||||
|
||||
#define INST_ORIGIN_COMMAND 178
|
||||
|
||||
#define INST_TCLOO_NEXT 179
|
||||
#define INST_TCLOO_NEXT_CLASS 180
|
||||
|
||||
#define INST_YIELD_TO_INVOKE 181
|
||||
|
||||
#define INST_NUM_TYPE 182
|
||||
#define INST_TRY_CVT_TO_BOOLEAN 183
|
||||
#define INST_STR_CLASS 184
|
||||
|
||||
#define INST_LAPPEND_LIST 185
|
||||
#define INST_LAPPEND_LIST_ARRAY 186
|
||||
#define INST_LAPPEND_LIST_ARRAY_STK 187
|
||||
#define INST_LAPPEND_LIST_STK 188
|
||||
|
||||
#define INST_CLOCK_READ 189
|
||||
|
||||
#define INST_DICT_GET_DEF 190
|
||||
|
||||
/* TIP 461 */
|
||||
#define INST_STR_LT 191
|
||||
#define INST_STR_GT 192
|
||||
#define INST_STR_LE 193
|
||||
#define INST_STR_GE 194
|
||||
|
||||
/* The last opcode */
|
||||
#define LAST_INST_OPCODE 194
|
||||
/* The last opcode */
|
||||
LAST_INST_OPCODE = 194
|
||||
};
|
||||
|
||||
/*
|
||||
* Table describing the Tcl bytecode instructions: their name (for displaying
|
||||
@@ -1237,9 +1223,11 @@ MODULE_SCOPE int TclPushProcCallFrame(ClientData clientData,
|
||||
#define TclFetchAuxData(envPtr, index) \
|
||||
(envPtr)->auxDataArrayPtr[(index)].clientData
|
||||
|
||||
#define LITERAL_ON_HEAP 0x01
|
||||
#define LITERAL_CMD_NAME 0x02
|
||||
#define LITERAL_UNSHARED 0x04
|
||||
enum LiteralFlags {
|
||||
LITERAL_ON_HEAP = 0x01,
|
||||
LITERAL_CMD_NAME = 0x02,
|
||||
LITERAL_UNSHARED = 0x04
|
||||
};
|
||||
|
||||
/*
|
||||
* Macro used to manually adjust the stack requirements; used in cases where
|
||||
|
||||
+1
-1
@@ -178,7 +178,7 @@ Tcl_RegisterConfig(
|
||||
* QueryConfigObjCmd --
|
||||
*
|
||||
* Implementation of "::<package>::pkgconfig", the command to query
|
||||
* configuration information embedded into a binary library.
|
||||
* configuration information embedded into a library.
|
||||
*
|
||||
* Results:
|
||||
* A standard tcl result.
|
||||
|
||||
+76
-47
@@ -749,10 +749,10 @@ EXTERN int Tcl_SplitList(Tcl_Interp *interp,
|
||||
EXTERN void Tcl_SplitPath(const char *path, int *argcPtr,
|
||||
const char ***argvPtr);
|
||||
/* 244 */
|
||||
EXTERN void Tcl_StaticPackage(Tcl_Interp *interp,
|
||||
const char *pkgName,
|
||||
Tcl_PackageInitProc *initProc,
|
||||
Tcl_PackageInitProc *safeInitProc);
|
||||
EXTERN void Tcl_StaticLibrary(Tcl_Interp *interp,
|
||||
const char *prefix,
|
||||
Tcl_LibraryInitProc *initProc,
|
||||
Tcl_LibraryInitProc *safeInitProc);
|
||||
/* 245 */
|
||||
TCL_DEPRECATED("No longer in use, changed to macro")
|
||||
int Tcl_StringMatch(const char *str, const char *pattern);
|
||||
@@ -999,7 +999,7 @@ EXTERN int Tcl_UniCharToUtf(int ch, char *buf);
|
||||
/* 325 */
|
||||
EXTERN const char * Tcl_UtfAtIndex(const char *src, int index);
|
||||
/* 326 */
|
||||
EXTERN int Tcl_UtfCharComplete(const char *src, int length);
|
||||
EXTERN int TclUtfCharComplete(const char *src, int length);
|
||||
/* 327 */
|
||||
EXTERN int Tcl_UtfBackslash(const char *src, int *readPtr,
|
||||
char *dst);
|
||||
@@ -1008,9 +1008,9 @@ EXTERN const char * Tcl_UtfFindFirst(const char *src, int ch);
|
||||
/* 329 */
|
||||
EXTERN const char * Tcl_UtfFindLast(const char *src, int ch);
|
||||
/* 330 */
|
||||
EXTERN const char * Tcl_UtfNext(const char *src);
|
||||
EXTERN const char * TclUtfNext(const char *src);
|
||||
/* 331 */
|
||||
EXTERN const char * Tcl_UtfPrev(const char *src, const char *start);
|
||||
EXTERN const char * TclUtfPrev(const char *src, const char *start);
|
||||
/* 332 */
|
||||
EXTERN int Tcl_UtfToExternal(Tcl_Interp *interp,
|
||||
Tcl_Encoding encoding, const char *src,
|
||||
@@ -1338,8 +1338,8 @@ EXTERN int Tcl_FSDeleteFile(Tcl_Obj *pathPtr);
|
||||
/* 444 */
|
||||
EXTERN int Tcl_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *pathPtr,
|
||||
const char *sym1, const char *sym2,
|
||||
Tcl_PackageInitProc **proc1Ptr,
|
||||
Tcl_PackageInitProc **proc2Ptr,
|
||||
Tcl_LibraryInitProc **proc1Ptr,
|
||||
Tcl_LibraryInitProc **proc2Ptr,
|
||||
Tcl_LoadHandle *handlePtr,
|
||||
Tcl_FSUnloadFileProc **unloadProcPtr);
|
||||
/* 445 */
|
||||
@@ -1464,10 +1464,10 @@ EXTERN void Tcl_SetWideIntObj(Tcl_Obj *objPtr,
|
||||
/* 490 */
|
||||
EXTERN Tcl_StatBuf * Tcl_AllocStatBuf(void);
|
||||
/* 491 */
|
||||
EXTERN Tcl_WideInt Tcl_Seek(Tcl_Channel chan, Tcl_WideInt offset,
|
||||
EXTERN long long Tcl_Seek(Tcl_Channel chan, long long offset,
|
||||
int mode);
|
||||
/* 492 */
|
||||
EXTERN Tcl_WideInt Tcl_Tell(Tcl_Channel chan);
|
||||
EXTERN long long Tcl_Tell(Tcl_Channel chan);
|
||||
/* 493 */
|
||||
EXTERN Tcl_DriverWideSeekProc * Tcl_ChannelWideSeekProc(
|
||||
const Tcl_ChannelType *chanTypePtr);
|
||||
@@ -1665,7 +1665,7 @@ EXTERN int Tcl_TakeBignumFromObj(Tcl_Interp *interp,
|
||||
Tcl_Obj *obj, void *value);
|
||||
/* 560 */
|
||||
EXTERN int Tcl_TruncateChannel(Tcl_Channel chan,
|
||||
Tcl_WideInt length);
|
||||
long long length);
|
||||
/* 561 */
|
||||
EXTERN Tcl_DriverTruncateProc * Tcl_ChannelTruncateProc(
|
||||
const Tcl_ChannelType *chanTypePtr);
|
||||
@@ -1771,16 +1771,16 @@ EXTERN int Tcl_GetGroupIdFromStat(const Tcl_StatBuf *statPtr);
|
||||
/* 595 */
|
||||
EXTERN int Tcl_GetDeviceTypeFromStat(const Tcl_StatBuf *statPtr);
|
||||
/* 596 */
|
||||
EXTERN Tcl_WideInt Tcl_GetAccessTimeFromStat(const Tcl_StatBuf *statPtr);
|
||||
EXTERN long long Tcl_GetAccessTimeFromStat(const Tcl_StatBuf *statPtr);
|
||||
/* 597 */
|
||||
EXTERN Tcl_WideInt Tcl_GetModificationTimeFromStat(
|
||||
EXTERN long long Tcl_GetModificationTimeFromStat(
|
||||
const Tcl_StatBuf *statPtr);
|
||||
/* 598 */
|
||||
EXTERN Tcl_WideInt Tcl_GetChangeTimeFromStat(const Tcl_StatBuf *statPtr);
|
||||
EXTERN long long Tcl_GetChangeTimeFromStat(const Tcl_StatBuf *statPtr);
|
||||
/* 599 */
|
||||
EXTERN Tcl_WideUInt Tcl_GetSizeFromStat(const Tcl_StatBuf *statPtr);
|
||||
EXTERN unsigned long long Tcl_GetSizeFromStat(const Tcl_StatBuf *statPtr);
|
||||
/* 600 */
|
||||
EXTERN Tcl_WideUInt Tcl_GetBlocksFromStat(const Tcl_StatBuf *statPtr);
|
||||
EXTERN unsigned long long Tcl_GetBlocksFromStat(const Tcl_StatBuf *statPtr);
|
||||
/* 601 */
|
||||
EXTERN unsigned Tcl_GetBlockSizeFromStat(const Tcl_StatBuf *statPtr);
|
||||
/* 602 */
|
||||
@@ -1931,6 +1931,12 @@ EXTERN Tcl_UniChar * TclGetUnicodeFromObj(Tcl_Obj *objPtr,
|
||||
/* 653 */
|
||||
EXTERN unsigned char * TclGetByteArrayFromObj(Tcl_Obj *objPtr,
|
||||
size_t *lengthPtr);
|
||||
/* 654 */
|
||||
EXTERN int Tcl_UtfCharComplete(const char *src, int length);
|
||||
/* 655 */
|
||||
EXTERN const char * Tcl_UtfNext(const char *src);
|
||||
/* 656 */
|
||||
EXTERN const char * Tcl_UtfPrev(const char *src, const char *start);
|
||||
|
||||
typedef struct {
|
||||
const struct TclPlatStubs *tclPlatStubs;
|
||||
@@ -2210,7 +2216,7 @@ typedef struct TclStubs {
|
||||
void (*tcl_SourceRCFile) (Tcl_Interp *interp); /* 241 */
|
||||
int (*tcl_SplitList) (Tcl_Interp *interp, const char *listStr, int *argcPtr, const char ***argvPtr); /* 242 */
|
||||
void (*tcl_SplitPath) (const char *path, int *argcPtr, const char ***argvPtr); /* 243 */
|
||||
TCL_DEPRECATED_API("Don't use this function in a stub-enabled extension") void (*tcl_StaticPackage) (Tcl_Interp *interp, const char *pkgName, Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc); /* 244 */
|
||||
TCL_DEPRECATED_API("Don't use this function in a stub-enabled extension") void (*tcl_StaticLibrary) (Tcl_Interp *interp, const char *prefix, Tcl_LibraryInitProc *initProc, Tcl_LibraryInitProc *safeInitProc); /* 244 */
|
||||
TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_StringMatch) (const char *str, const char *pattern); /* 245 */
|
||||
TCL_DEPRECATED_API("") int (*tcl_TellOld) (Tcl_Channel chan); /* 246 */
|
||||
TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_TraceVar) (Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 247 */
|
||||
@@ -2292,12 +2298,12 @@ typedef struct TclStubs {
|
||||
int (*tcl_UniCharToUpper) (int ch); /* 323 */
|
||||
int (*tcl_UniCharToUtf) (int ch, char *buf); /* 324 */
|
||||
const char * (*tcl_UtfAtIndex) (const char *src, int index); /* 325 */
|
||||
int (*tcl_UtfCharComplete) (const char *src, int length); /* 326 */
|
||||
int (*tclUtfCharComplete) (const char *src, int length); /* 326 */
|
||||
int (*tcl_UtfBackslash) (const char *src, int *readPtr, char *dst); /* 327 */
|
||||
const char * (*tcl_UtfFindFirst) (const char *src, int ch); /* 328 */
|
||||
const char * (*tcl_UtfFindLast) (const char *src, int ch); /* 329 */
|
||||
const char * (*tcl_UtfNext) (const char *src); /* 330 */
|
||||
const char * (*tcl_UtfPrev) (const char *src, const char *start); /* 331 */
|
||||
const char * (*tclUtfNext) (const char *src); /* 330 */
|
||||
const char * (*tclUtfPrev) (const char *src, const char *start); /* 331 */
|
||||
int (*tcl_UtfToExternal) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); /* 332 */
|
||||
char * (*tcl_UtfToExternalDString) (Tcl_Encoding encoding, const char *src, int srcLen, Tcl_DString *dsPtr); /* 333 */
|
||||
int (*tcl_UtfToLower) (char *src); /* 334 */
|
||||
@@ -2410,7 +2416,7 @@ typedef struct TclStubs {
|
||||
int (*tcl_FSCopyDirectory) (Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr, Tcl_Obj **errorPtr); /* 441 */
|
||||
int (*tcl_FSCreateDirectory) (Tcl_Obj *pathPtr); /* 442 */
|
||||
int (*tcl_FSDeleteFile) (Tcl_Obj *pathPtr); /* 443 */
|
||||
int (*tcl_FSLoadFile) (Tcl_Interp *interp, Tcl_Obj *pathPtr, const char *sym1, const char *sym2, Tcl_PackageInitProc **proc1Ptr, Tcl_PackageInitProc **proc2Ptr, Tcl_LoadHandle *handlePtr, Tcl_FSUnloadFileProc **unloadProcPtr); /* 444 */
|
||||
int (*tcl_FSLoadFile) (Tcl_Interp *interp, Tcl_Obj *pathPtr, const char *sym1, const char *sym2, Tcl_LibraryInitProc **proc1Ptr, Tcl_LibraryInitProc **proc2Ptr, Tcl_LoadHandle *handlePtr, Tcl_FSUnloadFileProc **unloadProcPtr); /* 444 */
|
||||
int (*tcl_FSMatchInDirectory) (Tcl_Interp *interp, Tcl_Obj *result, Tcl_Obj *pathPtr, const char *pattern, Tcl_GlobTypeData *types); /* 445 */
|
||||
Tcl_Obj * (*tcl_FSLink) (Tcl_Obj *pathPtr, Tcl_Obj *toPtr, int linkAction); /* 446 */
|
||||
int (*tcl_FSRemoveDirectory) (Tcl_Obj *pathPtr, int recursive, Tcl_Obj **errorPtr); /* 447 */
|
||||
@@ -2457,8 +2463,8 @@ typedef struct TclStubs {
|
||||
Tcl_Obj * (*tcl_NewWideIntObj) (Tcl_WideInt wideValue); /* 488 */
|
||||
void (*tcl_SetWideIntObj) (Tcl_Obj *objPtr, Tcl_WideInt wideValue); /* 489 */
|
||||
Tcl_StatBuf * (*tcl_AllocStatBuf) (void); /* 490 */
|
||||
Tcl_WideInt (*tcl_Seek) (Tcl_Channel chan, Tcl_WideInt offset, int mode); /* 491 */
|
||||
Tcl_WideInt (*tcl_Tell) (Tcl_Channel chan); /* 492 */
|
||||
long long (*tcl_Seek) (Tcl_Channel chan, long long offset, int mode); /* 491 */
|
||||
long long (*tcl_Tell) (Tcl_Channel chan); /* 492 */
|
||||
Tcl_DriverWideSeekProc * (*tcl_ChannelWideSeekProc) (const Tcl_ChannelType *chanTypePtr); /* 493 */
|
||||
int (*tcl_DictObjPut) (Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Obj *keyPtr, Tcl_Obj *valuePtr); /* 494 */
|
||||
int (*tcl_DictObjGet) (Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Obj *keyPtr, Tcl_Obj **valuePtrPtr); /* 495 */
|
||||
@@ -2526,7 +2532,7 @@ typedef struct TclStubs {
|
||||
void (*tcl_SetBignumObj) (Tcl_Obj *obj, void *value); /* 557 */
|
||||
int (*tcl_GetBignumFromObj) (Tcl_Interp *interp, Tcl_Obj *obj, void *value); /* 558 */
|
||||
int (*tcl_TakeBignumFromObj) (Tcl_Interp *interp, Tcl_Obj *obj, void *value); /* 559 */
|
||||
int (*tcl_TruncateChannel) (Tcl_Channel chan, Tcl_WideInt length); /* 560 */
|
||||
int (*tcl_TruncateChannel) (Tcl_Channel chan, long long length); /* 560 */
|
||||
Tcl_DriverTruncateProc * (*tcl_ChannelTruncateProc) (const Tcl_ChannelType *chanTypePtr); /* 561 */
|
||||
void (*tcl_SetChannelErrorInterp) (Tcl_Interp *interp, Tcl_Obj *msg); /* 562 */
|
||||
void (*tcl_GetChannelErrorInterp) (Tcl_Interp *interp, Tcl_Obj **msg); /* 563 */
|
||||
@@ -2562,11 +2568,11 @@ typedef struct TclStubs {
|
||||
int (*tcl_GetUserIdFromStat) (const Tcl_StatBuf *statPtr); /* 593 */
|
||||
int (*tcl_GetGroupIdFromStat) (const Tcl_StatBuf *statPtr); /* 594 */
|
||||
int (*tcl_GetDeviceTypeFromStat) (const Tcl_StatBuf *statPtr); /* 595 */
|
||||
Tcl_WideInt (*tcl_GetAccessTimeFromStat) (const Tcl_StatBuf *statPtr); /* 596 */
|
||||
Tcl_WideInt (*tcl_GetModificationTimeFromStat) (const Tcl_StatBuf *statPtr); /* 597 */
|
||||
Tcl_WideInt (*tcl_GetChangeTimeFromStat) (const Tcl_StatBuf *statPtr); /* 598 */
|
||||
Tcl_WideUInt (*tcl_GetSizeFromStat) (const Tcl_StatBuf *statPtr); /* 599 */
|
||||
Tcl_WideUInt (*tcl_GetBlocksFromStat) (const Tcl_StatBuf *statPtr); /* 600 */
|
||||
long long (*tcl_GetAccessTimeFromStat) (const Tcl_StatBuf *statPtr); /* 596 */
|
||||
long long (*tcl_GetModificationTimeFromStat) (const Tcl_StatBuf *statPtr); /* 597 */
|
||||
long long (*tcl_GetChangeTimeFromStat) (const Tcl_StatBuf *statPtr); /* 598 */
|
||||
unsigned long long (*tcl_GetSizeFromStat) (const Tcl_StatBuf *statPtr); /* 599 */
|
||||
unsigned long long (*tcl_GetBlocksFromStat) (const Tcl_StatBuf *statPtr); /* 600 */
|
||||
unsigned (*tcl_GetBlockSizeFromStat) (const Tcl_StatBuf *statPtr); /* 601 */
|
||||
int (*tcl_SetEnsembleParameterList) (Tcl_Interp *interp, Tcl_Command token, Tcl_Obj *paramList); /* 602 */
|
||||
int (*tcl_GetEnsembleParameterList) (Tcl_Interp *interp, Tcl_Command token, Tcl_Obj **paramListPtr); /* 603 */
|
||||
@@ -2620,6 +2626,9 @@ typedef struct TclStubs {
|
||||
char * (*tclGetStringFromObj) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 651 */
|
||||
Tcl_UniChar * (*tclGetUnicodeFromObj) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 652 */
|
||||
unsigned char * (*tclGetByteArrayFromObj) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 653 */
|
||||
int (*tcl_UtfCharComplete) (const char *src, int length); /* 654 */
|
||||
const char * (*tcl_UtfNext) (const char *src); /* 655 */
|
||||
const char * (*tcl_UtfPrev) (const char *src, const char *start); /* 656 */
|
||||
} TclStubs;
|
||||
|
||||
extern const TclStubs *tclStubsPtr;
|
||||
@@ -3139,8 +3148,8 @@ extern const TclStubs *tclStubsPtr;
|
||||
(tclStubsPtr->tcl_SplitList) /* 242 */
|
||||
#define Tcl_SplitPath \
|
||||
(tclStubsPtr->tcl_SplitPath) /* 243 */
|
||||
#define Tcl_StaticPackage \
|
||||
(tclStubsPtr->tcl_StaticPackage) /* 244 */
|
||||
#define Tcl_StaticLibrary \
|
||||
(tclStubsPtr->tcl_StaticLibrary) /* 244 */
|
||||
#define Tcl_StringMatch \
|
||||
(tclStubsPtr->tcl_StringMatch) /* 245 */
|
||||
#define Tcl_TellOld \
|
||||
@@ -3302,18 +3311,18 @@ extern const TclStubs *tclStubsPtr;
|
||||
(tclStubsPtr->tcl_UniCharToUtf) /* 324 */
|
||||
#define Tcl_UtfAtIndex \
|
||||
(tclStubsPtr->tcl_UtfAtIndex) /* 325 */
|
||||
#define Tcl_UtfCharComplete \
|
||||
(tclStubsPtr->tcl_UtfCharComplete) /* 326 */
|
||||
#define TclUtfCharComplete \
|
||||
(tclStubsPtr->tclUtfCharComplete) /* 326 */
|
||||
#define Tcl_UtfBackslash \
|
||||
(tclStubsPtr->tcl_UtfBackslash) /* 327 */
|
||||
#define Tcl_UtfFindFirst \
|
||||
(tclStubsPtr->tcl_UtfFindFirst) /* 328 */
|
||||
#define Tcl_UtfFindLast \
|
||||
(tclStubsPtr->tcl_UtfFindLast) /* 329 */
|
||||
#define Tcl_UtfNext \
|
||||
(tclStubsPtr->tcl_UtfNext) /* 330 */
|
||||
#define Tcl_UtfPrev \
|
||||
(tclStubsPtr->tcl_UtfPrev) /* 331 */
|
||||
#define TclUtfNext \
|
||||
(tclStubsPtr->tclUtfNext) /* 330 */
|
||||
#define TclUtfPrev \
|
||||
(tclStubsPtr->tclUtfPrev) /* 331 */
|
||||
#define Tcl_UtfToExternal \
|
||||
(tclStubsPtr->tcl_UtfToExternal) /* 332 */
|
||||
#define Tcl_UtfToExternalDString \
|
||||
@@ -3956,11 +3965,18 @@ extern const TclStubs *tclStubsPtr;
|
||||
(tclStubsPtr->tclGetUnicodeFromObj) /* 652 */
|
||||
#define TclGetByteArrayFromObj \
|
||||
(tclStubsPtr->tclGetByteArrayFromObj) /* 653 */
|
||||
#define Tcl_UtfCharComplete \
|
||||
(tclStubsPtr->tcl_UtfCharComplete) /* 654 */
|
||||
#define Tcl_UtfNext \
|
||||
(tclStubsPtr->tcl_UtfNext) /* 655 */
|
||||
#define Tcl_UtfPrev \
|
||||
(tclStubsPtr->tcl_UtfPrev) /* 656 */
|
||||
|
||||
#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
|
||||
@@ -3969,7 +3985,7 @@ extern const TclStubs *tclStubsPtr;
|
||||
# undef Tcl_SetPanicProc
|
||||
# undef Tcl_SetExitProc
|
||||
# undef Tcl_ObjSetVar2
|
||||
# undef Tcl_StaticPackage
|
||||
# undef Tcl_StaticLibrary
|
||||
# define Tcl_CreateInterp() (tclStubsPtr->tcl_CreateInterp())
|
||||
# define Tcl_GetStringResult(interp) (tclStubsPtr->tcl_GetStringResult(interp))
|
||||
# define Tcl_Init(interp) (tclStubsPtr->tcl_Init(interp))
|
||||
@@ -4138,28 +4154,35 @@ extern const TclStubs *tclStubsPtr;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#undef Tcl_GetString
|
||||
#undef Tcl_GetUnicode
|
||||
#define Tcl_GetString(objPtr) \
|
||||
Tcl_GetStringFromObj(objPtr, (int *)NULL)
|
||||
#define Tcl_GetUnicode(objPtr) \
|
||||
Tcl_GetUnicodeFromObj(objPtr, (int *)NULL)
|
||||
#ifdef TCL_NO_DEPRECATED
|
||||
#undef Tcl_GetStringFromObj
|
||||
#undef Tcl_GetUnicodeFromObj
|
||||
#undef Tcl_GetByteArrayFromObj
|
||||
#undef Tcl_GetUnicode
|
||||
#endif
|
||||
#if defined(USE_TCL_STUBS)
|
||||
#ifdef TCL_NO_DEPRECATED
|
||||
#define Tcl_GetStringFromObj(objPtr, sizePtr) \
|
||||
(sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tcl_GetStringFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tclGetStringFromObj(objPtr, (size_t *)sizePtr))
|
||||
#define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \
|
||||
(sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tcl_GetByteArrayFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tclGetByteArrayFromObj(objPtr, (size_t *)sizePtr))
|
||||
#define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \
|
||||
(sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tclGetUnicodeFromObj(objPtr, (size_t *)sizePtr))
|
||||
#define Tcl_GetUnicode(objPtr) \
|
||||
tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, NULL)
|
||||
#endif
|
||||
#else
|
||||
#ifdef TCL_NO_DEPRECATED
|
||||
#define Tcl_GetStringFromObj(objPtr, sizePtr) \
|
||||
(sizeof(*sizePtr) <= sizeof(int) ? (Tcl_GetStringFromObj)(objPtr, (int *)sizePtr) : (TclGetStringFromObj)(objPtr, (size_t *)sizePtr))
|
||||
#define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \
|
||||
(sizeof(*sizePtr) <= sizeof(int) ? (Tcl_GetByteArrayFromObj)(objPtr, (int *)sizePtr) : TclGetByteArrayFromObj(objPtr, (size_t *)sizePtr))
|
||||
#define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \
|
||||
(sizeof(*sizePtr) <= sizeof(int) ? (Tcl_GetUnicodeFromObj)(objPtr, (int *)sizePtr) : TclGetUnicodeFromObj(objPtr, (size_t *)sizePtr))
|
||||
#define Tcl_GetUnicode(objPtr) \
|
||||
(Tcl_GetUnicodeFromObj)(objPtr, NULL)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#undef Tcl_NewLongObj
|
||||
@@ -4223,10 +4246,16 @@ extern const TclStubs *tclStubsPtr;
|
||||
#define Tcl_Close(interp, chan) Tcl_CloseEx(interp, chan, 0)
|
||||
#endif
|
||||
|
||||
#if defined(USE_TCL_STUBS) && (TCL_UTF_MAX > 3)
|
||||
#undef TclUtfCharComplete
|
||||
#undef TclUtfNext
|
||||
#undef TclUtfPrev
|
||||
#if defined(USE_TCL_STUBS) && (TCL_UTF_MAX < 4) && !defined(TCL_NO_DEPRECATED)
|
||||
# undef Tcl_UtfCharComplete
|
||||
# define Tcl_UtfCharComplete(src, length) (((unsigned)((unsigned char)*(src) - 0xF0) < 5) \
|
||||
? ((length) >= 4) : tclStubsPtr->tcl_UtfCharComplete((src), (length)))
|
||||
# undef Tcl_UtfNext
|
||||
# undef Tcl_UtfPrev
|
||||
# define Tcl_UtfCharComplete (tclStubsPtr->tclUtfCharComplete)
|
||||
# define Tcl_UtfNext (tclStubsPtr->tclUtfNext)
|
||||
# define Tcl_UtfPrev (tclStubsPtr->tclUtfPrev)
|
||||
#endif
|
||||
#define Tcl_CreateSlave Tcl_CreateChild
|
||||
#define Tcl_GetSlave Tcl_GetChild
|
||||
|
||||
@@ -950,7 +950,7 @@ Tcl_DictObjPut(
|
||||
TclInvalidateStringRep(dictPtr);
|
||||
hPtr = CreateChainEntry(dict, keyPtr, &isNew);
|
||||
dict->refCount++;
|
||||
TclFreeIntRep(dictPtr)
|
||||
TclFreeIntRep(dictPtr);
|
||||
DictSetIntRep(dictPtr, dict);
|
||||
Tcl_IncrRefCount(valuePtr);
|
||||
if (!isNew) {
|
||||
|
||||
+128
-209
@@ -127,10 +127,12 @@ typedef struct {
|
||||
* file.
|
||||
*/
|
||||
|
||||
#define ENCODING_SINGLEBYTE 0
|
||||
#define ENCODING_DOUBLEBYTE 1
|
||||
#define ENCODING_MULTIBYTE 2
|
||||
#define ENCODING_ESCAPE 3
|
||||
enum EncodingTypes {
|
||||
ENCODING_SINGLEBYTE = 0,
|
||||
ENCODING_DOUBLEBYTE = 1,
|
||||
ENCODING_MULTIBYTE = 2,
|
||||
ENCODING_ESCAPE = 3
|
||||
};
|
||||
|
||||
/*
|
||||
* A list of directories in which Tcl should look for *.enc files. This list
|
||||
@@ -220,14 +222,7 @@ static size_t unilen(const char *src);
|
||||
static Tcl_EncodingConvertProc Utf16ToUtfProc;
|
||||
static Tcl_EncodingConvertProc UtfToUtf16Proc;
|
||||
static Tcl_EncodingConvertProc UtfToUcs2Proc;
|
||||
static int UtfToUtfProc(ClientData clientData,
|
||||
const char *src, int srcLen, int flags,
|
||||
Tcl_EncodingState *statePtr, char *dst,
|
||||
int dstLen, int *srcReadPtr,
|
||||
int *dstWrotePtr, int *dstCharsPtr,
|
||||
int pureNullMode);
|
||||
static Tcl_EncodingConvertProc UtfIntToUtfExtProc;
|
||||
static Tcl_EncodingConvertProc UtfExtToUtfIntProc;
|
||||
static Tcl_EncodingConvertProc UtfToUtfProc;
|
||||
static Tcl_EncodingConvertProc Iso88591FromUtfProc;
|
||||
static Tcl_EncodingConvertProc Iso88591ToUtfProc;
|
||||
|
||||
@@ -517,6 +512,18 @@ FillEncodingFileMap(void)
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* These flags must not conflict with other TCL_ENCODING_* flags in tcl.h */
|
||||
enum EncodingFlags {
|
||||
TCL_ENCODING_MODIFIED = 0x20,
|
||||
/* Converting NULL bytes to 0xC0 0x80 */
|
||||
/*
|
||||
* Since TCL_ENCODING_MODIFIED is only used for utf-8 and TCL_ENCODING_LE
|
||||
* is only used for utf-16/ucs-2, re-use the same value.
|
||||
*/
|
||||
TCL_ENCODING_LE = TCL_ENCODING_MODIFIED
|
||||
/* Little-endian encoding */
|
||||
};
|
||||
|
||||
void
|
||||
TclInitEncodingSubsystem(void)
|
||||
{
|
||||
@@ -533,7 +540,7 @@ TclInitEncodingSubsystem(void)
|
||||
return;
|
||||
}
|
||||
|
||||
isLe.s = 1;
|
||||
isLe.s = TCL_ENCODING_LE;
|
||||
Tcl_MutexLock(&encodingMutex);
|
||||
Tcl_InitHashTable(&encodingTable, TCL_STRING_KEYS);
|
||||
Tcl_MutexUnlock(&encodingMutex);
|
||||
@@ -553,8 +560,8 @@ TclInitEncodingSubsystem(void)
|
||||
tclIdentityEncoding = Tcl_CreateEncoding(&type);
|
||||
|
||||
type.encodingName = "utf-8";
|
||||
type.toUtfProc = UtfExtToUtfIntProc;
|
||||
type.fromUtfProc = UtfIntToUtfExtProc;
|
||||
type.toUtfProc = UtfToUtfProc;
|
||||
type.fromUtfProc = UtfToUtfProc;
|
||||
type.freeProc = NULL;
|
||||
type.nullSize = 1;
|
||||
type.clientData = NULL;
|
||||
@@ -565,7 +572,7 @@ TclInitEncodingSubsystem(void)
|
||||
type.freeProc = NULL;
|
||||
type.nullSize = 2;
|
||||
type.encodingName = "ucs-2le";
|
||||
type.clientData = INT2PTR(1);
|
||||
type.clientData = INT2PTR(TCL_ENCODING_LE);
|
||||
Tcl_CreateEncoding(&type);
|
||||
type.encodingName = "ucs-2be";
|
||||
type.clientData = INT2PTR(0);
|
||||
@@ -579,7 +586,7 @@ TclInitEncodingSubsystem(void)
|
||||
type.freeProc = NULL;
|
||||
type.nullSize = 2;
|
||||
type.encodingName = "utf-16le";
|
||||
type.clientData = INT2PTR(1);
|
||||
type.clientData = INT2PTR(TCL_ENCODING_LE);
|
||||
Tcl_CreateEncoding(&type);
|
||||
type.encodingName = "utf-16be";
|
||||
type.clientData = INT2PTR(0);
|
||||
@@ -1141,19 +1148,21 @@ Tcl_ExternalToUtfDString(
|
||||
}
|
||||
|
||||
flags = TCL_ENCODING_START | TCL_ENCODING_END;
|
||||
if (encodingPtr->toUtfProc == UtfToUtfProc) {
|
||||
flags |= TCL_ENCODING_MODIFIED;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
result = encodingPtr->toUtfProc(encodingPtr->clientData, src, srcLen,
|
||||
flags, &state, dst, dstLen, &srcRead, &dstWrote, &dstChars);
|
||||
soFar = dst + dstWrote - Tcl_DStringValue(dstPtr);
|
||||
|
||||
src += srcRead;
|
||||
if (result != TCL_CONVERT_NOSPACE) {
|
||||
Tcl_DStringSetLength(dstPtr, soFar);
|
||||
return Tcl_DStringValue(dstPtr);
|
||||
}
|
||||
|
||||
flags &= ~TCL_ENCODING_START;
|
||||
src += srcRead;
|
||||
srcLen -= srcRead;
|
||||
if (Tcl_DStringLength(dstPtr) == 0) {
|
||||
Tcl_DStringSetLength(dstPtr, dstLen);
|
||||
@@ -1249,15 +1258,17 @@ Tcl_ExternalToUtf(
|
||||
if (!noTerminate) {
|
||||
/*
|
||||
* If there are any null characters in the middle of the buffer,
|
||||
* they will converted to the UTF-8 null character (\xC080). To get
|
||||
* they will converted to the UTF-8 null character (\xC0\x80). To get
|
||||
* the actual \0 at the end of the destination buffer, we need to
|
||||
* append it manually. First make room for it...
|
||||
*/
|
||||
|
||||
dstLen--;
|
||||
}
|
||||
if (encodingPtr->toUtfProc == UtfToUtfProc) {
|
||||
flags |= TCL_ENCODING_MODIFIED;
|
||||
}
|
||||
do {
|
||||
int savedFlags = flags;
|
||||
Tcl_EncodingState savedState = *statePtr;
|
||||
|
||||
result = encodingPtr->toUtfProc(encodingPtr->clientData, src, srcLen,
|
||||
@@ -1267,7 +1278,6 @@ Tcl_ExternalToUtf(
|
||||
break;
|
||||
}
|
||||
dstLen = Tcl_UtfAtIndex(dst, maxChars) - dst + (TCL_UTF_MAX - 1);
|
||||
flags = savedFlags;
|
||||
*statePtr = savedState;
|
||||
} while (1);
|
||||
if (!noTerminate) {
|
||||
@@ -1331,8 +1341,8 @@ Tcl_UtfToExternalDString(
|
||||
flags = TCL_ENCODING_START | TCL_ENCODING_END;
|
||||
while (1) {
|
||||
result = encodingPtr->fromUtfProc(encodingPtr->clientData, src,
|
||||
srcLen, flags, &state, dst, dstLen, &srcRead, &dstWrote,
|
||||
&dstChars);
|
||||
srcLen, flags, &state, dst, dstLen,
|
||||
&srcRead, &dstWrote, &dstChars);
|
||||
soFar = dst + dstWrote - Tcl_DStringValue(dstPtr);
|
||||
|
||||
if (result != TCL_CONVERT_NOSPACE) {
|
||||
@@ -1433,8 +1443,8 @@ Tcl_UtfToExternal(
|
||||
|
||||
dstLen -= encodingPtr->nullSize;
|
||||
result = encodingPtr->fromUtfProc(encodingPtr->clientData, src, srcLen,
|
||||
flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr,
|
||||
dstCharsPtr);
|
||||
flags, statePtr, dst, dstLen, srcReadPtr,
|
||||
dstWrotePtr, dstCharsPtr);
|
||||
if (encodingPtr->nullSize == 2) {
|
||||
dst[*dstWrotePtr + 1] = '\0';
|
||||
}
|
||||
@@ -2153,104 +2163,6 @@ BinaryProc(
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
*-------------------------------------------------------------------------
|
||||
*
|
||||
* UtfIntToUtfExtProc --
|
||||
*
|
||||
* Convert from UTF-8 to UTF-8. While converting null-bytes from the
|
||||
* Tcl's internal representation (0xC0, 0x80) to the official
|
||||
* representation (0x00). See UtfToUtfProc for details.
|
||||
*
|
||||
* Results:
|
||||
* Returns TCL_OK if conversion was successful.
|
||||
*
|
||||
* Side effects:
|
||||
* None.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
UtfIntToUtfExtProc(
|
||||
ClientData clientData,
|
||||
const char *src, /* Source string in UTF-8. */
|
||||
int srcLen, /* Source string length in bytes. */
|
||||
int flags, /* Conversion control flags. */
|
||||
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
|
||||
* information used during a piecewise
|
||||
* conversion. Contents of statePtr are
|
||||
* initialized and/or reset by conversion
|
||||
* routine under control of flags argument. */
|
||||
char *dst, /* Output buffer in which converted string
|
||||
* is stored. */
|
||||
int dstLen, /* The maximum length of output buffer in
|
||||
* bytes. */
|
||||
int *srcReadPtr, /* Filled with the number of bytes from the
|
||||
* source string that were converted. This may
|
||||
* be less than the original source length if
|
||||
* there was a problem converting some source
|
||||
* characters. */
|
||||
int *dstWrotePtr, /* Filled with the number of bytes that were
|
||||
* stored in the output buffer as a result of
|
||||
* the conversion. */
|
||||
int *dstCharsPtr) /* Filled with the number of characters that
|
||||
* correspond to the bytes stored in the
|
||||
* output buffer. */
|
||||
{
|
||||
return UtfToUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
|
||||
srcReadPtr, dstWrotePtr, dstCharsPtr, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
*-------------------------------------------------------------------------
|
||||
*
|
||||
* UtfExtToUtfIntProc --
|
||||
*
|
||||
* Convert from UTF-8 to UTF-8 while converting null-bytes from the
|
||||
* official representation (0x00) to Tcl's internal representation (0xC0,
|
||||
* 0x80). See UtfToUtfProc for details.
|
||||
*
|
||||
* Results:
|
||||
* Returns TCL_OK if conversion was successful.
|
||||
*
|
||||
* Side effects:
|
||||
* None.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
UtfExtToUtfIntProc(
|
||||
ClientData clientData,
|
||||
const char *src, /* Source string in UTF-8. */
|
||||
int srcLen, /* Source string length in bytes. */
|
||||
int flags, /* Conversion control flags. */
|
||||
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
|
||||
* information used during a piecewise
|
||||
* conversion. Contents of statePtr are
|
||||
* initialized and/or reset by conversion
|
||||
* routine under control of flags argument. */
|
||||
char *dst, /* Output buffer in which converted string is
|
||||
* stored. */
|
||||
int dstLen, /* The maximum length of output buffer in
|
||||
* bytes. */
|
||||
int *srcReadPtr, /* Filled with the number of bytes from the
|
||||
* source string that were converted. This may
|
||||
* be less than the original source length if
|
||||
* there was a problem converting some source
|
||||
* characters. */
|
||||
int *dstWrotePtr, /* Filled with the number of bytes that were
|
||||
* stored in the output buffer as a result of
|
||||
* the conversion. */
|
||||
int *dstCharsPtr) /* Filled with the number of characters that
|
||||
* correspond to the bytes stored in the
|
||||
* output buffer. */
|
||||
{
|
||||
return UtfToUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
|
||||
srcReadPtr, dstWrotePtr, dstCharsPtr, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
*-------------------------------------------------------------------------
|
||||
*
|
||||
@@ -2271,15 +2183,11 @@ UtfExtToUtfIntProc(
|
||||
|
||||
static int
|
||||
UtfToUtfProc(
|
||||
TCL_UNUSED(ClientData),
|
||||
ClientData clientData, /* additional flags, e.g. TCL_ENCODING_MODIFIED */
|
||||
const char *src, /* Source string in UTF-8. */
|
||||
int srcLen, /* Source string length in bytes. */
|
||||
int flags, /* Conversion control flags. */
|
||||
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
|
||||
* information used during a piecewise
|
||||
* conversion. Contents of statePtr are
|
||||
* initialized and/or reset by conversion
|
||||
* routine under control of flags argument. */
|
||||
TCL_UNUSED(Tcl_EncodingState *),
|
||||
char *dst, /* Output buffer in which converted string is
|
||||
* stored. */
|
||||
int dstLen, /* The maximum length of output buffer in
|
||||
@@ -2292,21 +2200,15 @@ UtfToUtfProc(
|
||||
int *dstWrotePtr, /* Filled with the number of bytes that were
|
||||
* stored in the output buffer as a result of
|
||||
* the conversion. */
|
||||
int *dstCharsPtr, /* Filled with the number of characters that
|
||||
int *dstCharsPtr) /* Filled with the number of characters that
|
||||
* correspond to the bytes stored in the
|
||||
* output buffer. */
|
||||
int pureNullMode) /* Convert embedded nulls from internal
|
||||
* representation to real null-bytes or vice
|
||||
* versa. Also combine or separate surrogate pairs */
|
||||
{
|
||||
const char *srcStart, *srcEnd, *srcClose;
|
||||
const char *dstStart, *dstEnd;
|
||||
int result, numChars, charLimit = INT_MAX;
|
||||
int *chPtr = (int *) statePtr;
|
||||
int ch;
|
||||
|
||||
if (flags & TCL_ENCODING_START) {
|
||||
*statePtr = 0;
|
||||
}
|
||||
result = TCL_OK;
|
||||
|
||||
srcStart = src;
|
||||
@@ -2320,10 +2222,11 @@ UtfToUtfProc(
|
||||
}
|
||||
|
||||
dstStart = dst;
|
||||
flags |= PTR2INT(clientData);
|
||||
dstEnd = dst + dstLen - TCL_UTF_MAX;
|
||||
|
||||
for (numChars = 0; src < srcEnd && numChars <= charLimit; numChars++) {
|
||||
if ((src > srcClose) && (!TclUCS4Complete(src, srcEnd - src))) {
|
||||
if ((src > srcClose) && (!Tcl_UtfCharComplete(src, srcEnd - src))) {
|
||||
/*
|
||||
* If there is more string to follow, this will ensure that the
|
||||
* last UTF-8 character in the source buffer hasn't been cut off.
|
||||
@@ -2336,50 +2239,69 @@ UtfToUtfProc(
|
||||
result = TCL_CONVERT_NOSPACE;
|
||||
break;
|
||||
}
|
||||
if (UCHAR(*src) < 0x80 && !(UCHAR(*src) == 0 && pureNullMode == 0)) {
|
||||
if (UCHAR(*src) < 0x80 && !(UCHAR(*src) == 0 && (flags & TCL_ENCODING_MODIFIED))) {
|
||||
/*
|
||||
* Copy 7bit characters, but skip null-bytes when we are in input
|
||||
* mode, so that they get converted to 0xC080.
|
||||
*/
|
||||
|
||||
*dst++ = *src++;
|
||||
*chPtr = 0; /* reset surrogate handling */
|
||||
} else if (pureNullMode == 1 && UCHAR(*src) == 0xC0 &&
|
||||
(src + 1 < srcEnd) && UCHAR(*(src+1)) == 0x80) {
|
||||
} else if (UCHAR(*src) == 0xC0 && (src + 1 < srcEnd)
|
||||
&& UCHAR(src[1]) == 0x80 && !(flags & TCL_ENCODING_MODIFIED)) {
|
||||
/*
|
||||
* Convert 0xC080 to real nulls when we are in output mode.
|
||||
*/
|
||||
|
||||
*dst++ = 0;
|
||||
*chPtr = 0; /* reset surrogate handling */
|
||||
src += 2;
|
||||
} else if (!TclUCS4Complete(src, srcEnd - src)) {
|
||||
} else if (!Tcl_UtfCharComplete(src, srcEnd - src)) {
|
||||
/*
|
||||
* Always check before using TclUtfToUCS4. Not doing can so
|
||||
* cause it run beyond the end of the buffer! If we happen such an
|
||||
* incomplete char its bytes are made to represent themselves.
|
||||
* incomplete char its bytes are made to represent themselves
|
||||
* unless the user has explicitly asked to be told.
|
||||
*/
|
||||
|
||||
*chPtr = UCHAR(*src);
|
||||
src += 1;
|
||||
dst += Tcl_UniCharToUtf(*chPtr, dst);
|
||||
if (flags & TCL_ENCODING_MODIFIED) {
|
||||
if (flags & TCL_ENCODING_STOPONERROR) {
|
||||
result = TCL_CONVERT_MULTIBYTE;
|
||||
break;
|
||||
}
|
||||
ch = UCHAR(*src++);
|
||||
} else {
|
||||
char chbuf[2];
|
||||
chbuf[0] = UCHAR(*src++); chbuf[1] = 0;
|
||||
TclUtfToUCS4(chbuf, &ch);
|
||||
}
|
||||
dst += Tcl_UniCharToUtf(ch, dst);
|
||||
} else {
|
||||
src += TclUtfToUCS4(src, chPtr);
|
||||
if ((*chPtr | 0x7FF) == 0xDFFF) {
|
||||
/* A surrogate character is detected, handle especially */
|
||||
int low = *chPtr;
|
||||
size_t len = (src <= srcEnd-3) ? TclUtfToUCS4(src, &low) : 0;
|
||||
if (((low & ~0x3FF) != 0xDC00) || (*chPtr & 0x400)) {
|
||||
*dst++ = (char) (((*chPtr >> 12) | 0xE0) & 0xEF);
|
||||
*dst++ = (char) (((*chPtr >> 6) | 0x80) & 0xBF);
|
||||
*dst++ = (char) ((*chPtr | 0x80) & 0xBF);
|
||||
continue;
|
||||
int low;
|
||||
size_t len = TclUtfToUCS4(src, &ch);
|
||||
if ((len < 2) && (ch != 0) && (flags & TCL_ENCODING_STOPONERROR)
|
||||
&& (flags & TCL_ENCODING_MODIFIED)) {
|
||||
result = TCL_CONVERT_SYNTAX;
|
||||
break;
|
||||
}
|
||||
src += len;
|
||||
if ((ch | 0x7FF) == 0xDFFF) {
|
||||
/*
|
||||
* A surrogate character is detected, handle especially.
|
||||
*/
|
||||
|
||||
low = ch;
|
||||
len = (src <= srcEnd-3) ? TclUtfToUCS4(src, &low) : 0;
|
||||
|
||||
if (((low & ~0x3FF) != 0xDC00) || (ch & 0x400)) {
|
||||
*dst++ = (char) (((ch >> 12) | 0xE0) & 0xEF);
|
||||
*dst++ = (char) (((ch >> 6) | 0x80) & 0xBF);
|
||||
*dst++ = (char) ((ch | 0x80) & 0xBF);
|
||||
continue;
|
||||
}
|
||||
src += len;
|
||||
dst += Tcl_UniCharToUtf(*chPtr, dst);
|
||||
*chPtr = low;
|
||||
dst += Tcl_UniCharToUtf(ch, dst);
|
||||
ch = low;
|
||||
}
|
||||
dst += Tcl_UniCharToUtf(*chPtr, dst);
|
||||
dst += Tcl_UniCharToUtf(ch, dst);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2407,7 +2329,7 @@ UtfToUtfProc(
|
||||
|
||||
static int
|
||||
Utf16ToUtfProc(
|
||||
ClientData clientData, /* != NULL means LE, == NUL means BE */
|
||||
ClientData clientData, /* additional flags, e.g. TCL_ENCODING_LE */
|
||||
const char *src, /* Source string in Unicode. */
|
||||
int srcLen, /* Source string length in bytes. */
|
||||
int flags, /* Conversion control flags. */
|
||||
@@ -2433,18 +2355,27 @@ Utf16ToUtfProc(
|
||||
int result, numChars, charLimit = INT_MAX;
|
||||
unsigned short ch;
|
||||
|
||||
flags |= PTR2INT(clientData);
|
||||
if (flags & TCL_ENCODING_CHAR_LIMIT) {
|
||||
charLimit = *dstCharsPtr;
|
||||
}
|
||||
result = TCL_OK;
|
||||
|
||||
/* check alignment with utf-16 (2 == sizeof(UTF-16)) */
|
||||
/*
|
||||
* Check alignment with utf-16 (2 == sizeof(UTF-16))
|
||||
*/
|
||||
|
||||
if ((srcLen % 2) != 0) {
|
||||
result = TCL_CONVERT_MULTIBYTE;
|
||||
srcLen--;
|
||||
}
|
||||
/* If last code point is a high surrogate, we cannot handle that yet */
|
||||
if ((srcLen >= 2) && ((src[srcLen - (clientData?1:2)] & 0xFC) == 0xD8)) {
|
||||
|
||||
/*
|
||||
* If last code point is a high surrogate, we cannot handle that yet.
|
||||
*/
|
||||
|
||||
if ((srcLen >= 2) &&
|
||||
((src[srcLen - ((flags & TCL_ENCODING_LE)?1:2)] & 0xFC) == 0xD8)) {
|
||||
result = TCL_CONVERT_MULTIBYTE;
|
||||
srcLen-= 2;
|
||||
}
|
||||
@@ -2461,15 +2392,17 @@ Utf16ToUtfProc(
|
||||
break;
|
||||
}
|
||||
|
||||
if (clientData) {
|
||||
if (flags & TCL_ENCODING_LE) {
|
||||
ch = (src[1] & 0xFF) << 8 | (src[0] & 0xFF);
|
||||
} else {
|
||||
ch = (src[0] & 0xFF) << 8 | (src[1] & 0xFF);
|
||||
}
|
||||
|
||||
/*
|
||||
* Special case for 1-byte utf chars for speed. Make sure we work with
|
||||
* unsigned short-size data.
|
||||
*/
|
||||
|
||||
if (ch && ch < 0x80) {
|
||||
*dst++ = (ch & 0xFF);
|
||||
} else {
|
||||
@@ -2502,15 +2435,11 @@ Utf16ToUtfProc(
|
||||
|
||||
static int
|
||||
UtfToUtf16Proc(
|
||||
ClientData clientData, /* != NULL means LE, == NUL means BE */
|
||||
ClientData clientData, /* additional flags, e.g. TCL_ENCODING_LE */
|
||||
const char *src, /* Source string in UTF-8. */
|
||||
int srcLen, /* Source string length in bytes. */
|
||||
int flags, /* Conversion control flags. */
|
||||
Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
|
||||
* information used during a piecewise
|
||||
* conversion. Contents of statePtr are
|
||||
* initialized and/or reset by conversion
|
||||
* routine under control of flags argument. */
|
||||
TCL_UNUSED(Tcl_EncodingState *),
|
||||
char *dst, /* Output buffer in which converted string is
|
||||
* stored. */
|
||||
int dstLen, /* The maximum length of output buffer in
|
||||
@@ -2529,11 +2458,8 @@ UtfToUtf16Proc(
|
||||
{
|
||||
const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd;
|
||||
int result, numChars;
|
||||
Tcl_UniChar *chPtr = (Tcl_UniChar *) statePtr;
|
||||
int ch;
|
||||
|
||||
if (flags & TCL_ENCODING_START) {
|
||||
*statePtr = 0;
|
||||
}
|
||||
srcStart = src;
|
||||
srcEnd = src + srcLen;
|
||||
srcClose = srcEnd;
|
||||
@@ -2543,6 +2469,7 @@ UtfToUtf16Proc(
|
||||
|
||||
dstStart = dst;
|
||||
dstEnd = dst + dstLen - sizeof(Tcl_UniChar);
|
||||
flags |= PTR2INT(clientData);
|
||||
|
||||
result = TCL_OK;
|
||||
for (numChars = 0; src < srcEnd; numChars++) {
|
||||
@@ -2559,38 +2486,27 @@ UtfToUtf16Proc(
|
||||
result = TCL_CONVERT_NOSPACE;
|
||||
break;
|
||||
}
|
||||
src += TclUtfToUniChar(src, chPtr);
|
||||
|
||||
if (clientData) {
|
||||
#if TCL_UTF_MAX > 3
|
||||
if (*chPtr <= 0xFFFF) {
|
||||
*dst++ = (*chPtr & 0xFF);
|
||||
*dst++ = (*chPtr >> 8);
|
||||
src += TclUtfToUCS4(src, &ch);
|
||||
if (flags & TCL_ENCODING_LE) {
|
||||
if (ch <= 0xFFFF) {
|
||||
*dst++ = (ch & 0xFF);
|
||||
*dst++ = (ch >> 8);
|
||||
} else {
|
||||
*dst++ = (((*chPtr - 0x10000) >> 10) & 0xFF);
|
||||
*dst++ = (((*chPtr - 0x10000) >> 18) & 0x3) | 0xD8;
|
||||
*dst++ = (*chPtr & 0xFF);
|
||||
*dst++ = ((*chPtr >> 8) & 0x3) | 0xDC;
|
||||
*dst++ = (((ch - 0x10000) >> 10) & 0xFF);
|
||||
*dst++ = (((ch - 0x10000) >> 18) & 0x3) | 0xD8;
|
||||
*dst++ = (ch & 0xFF);
|
||||
*dst++ = ((ch >> 8) & 0x3) | 0xDC;
|
||||
}
|
||||
#else
|
||||
*dst++ = (*chPtr & 0xFF);
|
||||
*dst++ = (*chPtr >> 8);
|
||||
#endif
|
||||
} else {
|
||||
#if TCL_UTF_MAX > 3
|
||||
if (*chPtr <= 0xFFFF) {
|
||||
*dst++ = (*chPtr >> 8);
|
||||
*dst++ = (*chPtr & 0xFF);
|
||||
if (ch <= 0xFFFF) {
|
||||
*dst++ = (ch >> 8);
|
||||
*dst++ = (ch & 0xFF);
|
||||
} else {
|
||||
*dst++ = (((*chPtr - 0x10000) >> 18) & 0x3) | 0xD8;
|
||||
*dst++ = (((*chPtr - 0x10000) >> 10) & 0xFF);
|
||||
*dst++ = ((*chPtr >> 8) & 0x3) | 0xDC;
|
||||
*dst++ = (*chPtr & 0xFF);
|
||||
*dst++ = (((ch - 0x10000) >> 18) & 0x3) | 0xD8;
|
||||
*dst++ = (((ch - 0x10000) >> 10) & 0xFF);
|
||||
*dst++ = ((ch >> 8) & 0x3) | 0xDC;
|
||||
*dst++ = (ch & 0xFF);
|
||||
}
|
||||
#else
|
||||
*dst++ = (*chPtr >> 8);
|
||||
*dst++ = (*chPtr & 0xFF);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
*srcReadPtr = src - srcStart;
|
||||
@@ -2617,7 +2533,7 @@ UtfToUtf16Proc(
|
||||
|
||||
static int
|
||||
UtfToUcs2Proc(
|
||||
ClientData clientData, /* != NULL means LE, == NUL means BE */
|
||||
ClientData clientData, /* additional flags, e.g. TCL_ENCODING_LE */
|
||||
const char *src, /* Source string in UTF-8. */
|
||||
int srcLen, /* Source string length in bytes. */
|
||||
int flags, /* Conversion control flags. */
|
||||
@@ -2645,6 +2561,7 @@ UtfToUcs2Proc(
|
||||
#endif
|
||||
Tcl_UniChar ch = 0;
|
||||
|
||||
flags |= PTR2INT(clientData);
|
||||
srcStart = src;
|
||||
srcEnd = src + srcLen;
|
||||
srcClose = srcEnd;
|
||||
@@ -2688,7 +2605,7 @@ UtfToUcs2Proc(
|
||||
* casting dst to a Tcl_UniChar. [Bug 1122671]
|
||||
*/
|
||||
|
||||
if (clientData) {
|
||||
if (flags & TCL_ENCODING_LE) {
|
||||
*dst++ = (ch & 0xFF);
|
||||
*dst++ = (ch >> 8);
|
||||
} else {
|
||||
@@ -3096,7 +3013,9 @@ Iso88591FromUtfProc(
|
||||
break;
|
||||
}
|
||||
#if TCL_UTF_MAX <= 3
|
||||
if ((ch >= 0xD800) && (len < 3)) len = 4;
|
||||
if ((ch >= 0xD800) && (len < 3)) {
|
||||
len = 4;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Plunge on, using '?' as a fallback character.
|
||||
@@ -3141,7 +3060,7 @@ TableFreeProc(
|
||||
ClientData clientData) /* TableEncodingData that specifies
|
||||
* encoding. */
|
||||
{
|
||||
TableEncodingData *dataPtr = (TableEncodingData *)clientData;
|
||||
TableEncodingData *dataPtr = (TableEncodingData *) clientData;
|
||||
|
||||
/*
|
||||
* Make sure we aren't freeing twice on shutdown. [Bug 219314]
|
||||
@@ -3199,7 +3118,7 @@ EscapeToUtfProc(
|
||||
* correspond to the bytes stored in the
|
||||
* output buffer. */
|
||||
{
|
||||
EscapeEncodingData *dataPtr = (EscapeEncodingData *)clientData;
|
||||
EscapeEncodingData *dataPtr = (EscapeEncodingData *) clientData;
|
||||
const char *prefixBytes, *tablePrefixBytes, *srcStart, *srcEnd;
|
||||
const unsigned short *const *tableToUnicode;
|
||||
const Encoding *encodingPtr;
|
||||
|
||||
@@ -36,6 +36,11 @@ TCL_DECLARE_MUTEX(envMutex) /* To serialize access to environ. */
|
||||
# define techar char
|
||||
#endif
|
||||
|
||||
|
||||
/* MODULE_SCOPE */
|
||||
size_t TclEnvEpoch = 0; /* Epoch of the tcl environment
|
||||
* (if changed with tcl-env). */
|
||||
|
||||
static struct {
|
||||
int cacheSize; /* Number of env strings in cache. */
|
||||
char **cache; /* Array containing all of the environment
|
||||
@@ -417,6 +422,7 @@ Tcl_PutEnv(
|
||||
value[0] = '\0';
|
||||
TclSetEnv(name, value+1);
|
||||
}
|
||||
TclEnvEpoch++;
|
||||
|
||||
Tcl_DStringFree(&nameString);
|
||||
return 0;
|
||||
@@ -624,6 +630,7 @@ EnvTraceProc(
|
||||
|
||||
if (flags & TCL_TRACE_ARRAY) {
|
||||
TclSetupEnv(interp);
|
||||
TclEnvEpoch++;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -644,6 +651,7 @@ EnvTraceProc(
|
||||
|
||||
value = Tcl_GetVar2(interp, "env", name2, TCL_GLOBAL_ONLY);
|
||||
TclSetEnv(name2, value);
|
||||
TclEnvEpoch++;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -667,6 +675,7 @@ EnvTraceProc(
|
||||
|
||||
if (flags & TCL_TRACE_UNSETS) {
|
||||
TclUnsetEnv(name2);
|
||||
TclEnvEpoch++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1513,7 +1513,7 @@ Tcl_UpdateObjCmd(
|
||||
}
|
||||
switch ((enum updateOptionsEnum) optionIndex) {
|
||||
case OPT_IDLETASKS:
|
||||
flags = TCL_WINDOW_EVENTS|TCL_IDLE_EVENTS|TCL_DONT_WAIT;
|
||||
flags = TCL_IDLE_EVENTS|TCL_DONT_WAIT;
|
||||
break;
|
||||
default:
|
||||
Tcl_Panic("Tcl_UpdateObjCmd: bad option index to UpdateOptions");
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*/
|
||||
|
||||
#define _BUILD_TCL_EXECUTE 1 /* Disable some warnings */
|
||||
|
||||
#include "tclInt.h"
|
||||
#include "tclCompile.h"
|
||||
#include "tclOOInt.h"
|
||||
@@ -9991,7 +9993,7 @@ EvalStatsCmd(
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 31; i >= 0; i--) {
|
||||
for (i = 31; i != (size_t)-1; i--) {
|
||||
if (statsPtr->srcCount[i] > 0) {
|
||||
maxSizeDecade = i;
|
||||
break;
|
||||
@@ -10014,7 +10016,7 @@ EvalStatsCmd(
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 31; i >= 0; i--) {
|
||||
for (i = 31; i != (size_t)-1; i--) {
|
||||
if (statsPtr->byteCodeCount[i] > 0) {
|
||||
maxSizeDecade = i;
|
||||
break;
|
||||
@@ -10037,7 +10039,7 @@ EvalStatsCmd(
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 31; i >= 0; i--) {
|
||||
for (i = 31; i != (size_t)-1; i--) {
|
||||
if (statsPtr->lifetimeCount[i] > 0) {
|
||||
maxSizeDecade = i;
|
||||
break;
|
||||
|
||||
+11
-11
@@ -2600,44 +2600,44 @@ Tcl_GetDeviceTypeFromStat(
|
||||
return (int) statPtr->st_rdev;
|
||||
}
|
||||
|
||||
Tcl_WideInt
|
||||
long long
|
||||
Tcl_GetAccessTimeFromStat(
|
||||
const Tcl_StatBuf *statPtr)
|
||||
{
|
||||
return (Tcl_WideInt) statPtr->st_atime;
|
||||
return (long long) statPtr->st_atime;
|
||||
}
|
||||
|
||||
Tcl_WideInt
|
||||
long long
|
||||
Tcl_GetModificationTimeFromStat(
|
||||
const Tcl_StatBuf *statPtr)
|
||||
{
|
||||
return (Tcl_WideInt) statPtr->st_mtime;
|
||||
return (long long) statPtr->st_mtime;
|
||||
}
|
||||
|
||||
Tcl_WideInt
|
||||
long long
|
||||
Tcl_GetChangeTimeFromStat(
|
||||
const Tcl_StatBuf *statPtr)
|
||||
{
|
||||
return (Tcl_WideInt) statPtr->st_ctime;
|
||||
return (long long) statPtr->st_ctime;
|
||||
}
|
||||
|
||||
Tcl_WideUInt
|
||||
unsigned long long
|
||||
Tcl_GetSizeFromStat(
|
||||
const Tcl_StatBuf *statPtr)
|
||||
{
|
||||
return (Tcl_WideUInt) statPtr->st_size;
|
||||
return (unsigned long long) statPtr->st_size;
|
||||
}
|
||||
|
||||
Tcl_WideUInt
|
||||
unsigned long long
|
||||
Tcl_GetBlocksFromStat(
|
||||
const Tcl_StatBuf *statPtr)
|
||||
{
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
|
||||
return (Tcl_WideUInt) statPtr->st_blocks;
|
||||
return (unsigned long long) statPtr->st_blocks;
|
||||
#else
|
||||
unsigned blksize = Tcl_GetBlockSizeFromStat(statPtr);
|
||||
|
||||
return ((Tcl_WideUInt) statPtr->st_size + blksize - 1) / blksize;
|
||||
return ((unsigned long long) statPtr->st_size + blksize - 1) / blksize;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+9
-8
@@ -3387,7 +3387,8 @@ int
|
||||
Tcl_Close(
|
||||
Tcl_Interp *interp, /* Interpreter for errors. */
|
||||
Tcl_Channel chan) /* The channel being closed. Must not be
|
||||
* referenced in any interpreter. */
|
||||
* referenced in any interpreter. May be NULL,
|
||||
* in which case this is a no-op. */
|
||||
{
|
||||
CloseCallback *cbPtr; /* Iterate over close callbacks for this
|
||||
* channel. */
|
||||
@@ -6989,10 +6990,10 @@ GetInput(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
Tcl_WideInt
|
||||
long long
|
||||
Tcl_Seek(
|
||||
Tcl_Channel chan, /* The channel on which to seek. */
|
||||
Tcl_WideInt offset, /* Offset to seek to. */
|
||||
long long offset, /* Offset to seek to. */
|
||||
int mode) /* Relative to which location to seek? */
|
||||
{
|
||||
Channel *chanPtr = (Channel *) chan;
|
||||
@@ -7002,7 +7003,7 @@ Tcl_Seek(
|
||||
int inputBuffered, outputBuffered;
|
||||
/* # bytes held in buffers. */
|
||||
int result; /* Of device driver operations. */
|
||||
Tcl_WideInt curPos; /* Position on the device. */
|
||||
long long curPos; /* Position on the device. */
|
||||
int wasAsync; /* Was the channel nonblocking before the seek
|
||||
* operation? If so, must restore to
|
||||
* non-blocking mode after the seek. */
|
||||
@@ -7162,7 +7163,7 @@ Tcl_Seek(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
Tcl_WideInt
|
||||
long long
|
||||
Tcl_Tell(
|
||||
Tcl_Channel chan) /* The channel to return pos for. */
|
||||
{
|
||||
@@ -7173,7 +7174,7 @@ Tcl_Tell(
|
||||
int inputBuffered, outputBuffered;
|
||||
/* # bytes held in buffers. */
|
||||
int result; /* Of calling device driver. */
|
||||
Tcl_WideInt curPos; /* Position on device. */
|
||||
long long curPos; /* Position on device. */
|
||||
|
||||
if (CheckChannelErrors(statePtr, TCL_WRITABLE | TCL_READABLE) != 0) {
|
||||
return -1;
|
||||
@@ -7257,7 +7258,7 @@ Tcl_Tell(
|
||||
int
|
||||
Tcl_TruncateChannel(
|
||||
Tcl_Channel chan, /* Channel to truncate. */
|
||||
Tcl_WideInt length) /* Length to truncate it to. */
|
||||
long long length) /* Length to truncate it to. */
|
||||
{
|
||||
Channel *chanPtr = (Channel *) chan;
|
||||
Tcl_DriverTruncateProc *truncateProc =
|
||||
@@ -9159,7 +9160,7 @@ TclCopyChannel(
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
Tcl_Channel inChan, /* Channel to read from. */
|
||||
Tcl_Channel outChan, /* Channel to write to. */
|
||||
Tcl_WideInt toRead, /* Amount of data to copy, or -1 for all. */
|
||||
long long toRead, /* Amount of data to copy, or -1 for all. */
|
||||
Tcl_Obj *cmdPtr) /* Pointer to script to execute or NULL. */
|
||||
{
|
||||
Channel *inPtr = (Channel *) inChan;
|
||||
|
||||
+16
-12
@@ -41,8 +41,8 @@ static void TransformWatchProc(ClientData instanceData, int mask);
|
||||
static int TransformGetFileHandleProc(ClientData instanceData,
|
||||
int direction, ClientData *handlePtr);
|
||||
static int TransformNotifyProc(ClientData instanceData, int mask);
|
||||
static Tcl_WideInt TransformWideSeekProc(ClientData instanceData,
|
||||
Tcl_WideInt offset, int mode, int *errorCodePtr);
|
||||
static long long TransformWideSeekProc(ClientData instanceData,
|
||||
long long offset, int mode, int *errorCodePtr);
|
||||
|
||||
/*
|
||||
* Forward declarations of internal procedures. Secondly the procedures for
|
||||
@@ -68,18 +68,22 @@ static int ExecuteCallback(TransformChannelData *ctrl,
|
||||
* the procedure what to do with the result of the script it calls.
|
||||
*/
|
||||
|
||||
#define TRANSMIT_DONT 0 /* No transfer to do. */
|
||||
#define TRANSMIT_DOWN 1 /* Transfer to the underlying channel. */
|
||||
#define TRANSMIT_SELF 2 /* Transfer into our channel. */
|
||||
#define TRANSMIT_IBUF 3 /* Transfer to internal input buffer. */
|
||||
#define TRANSMIT_NUM 4 /* Transfer number to 'maxRead'. */
|
||||
enum TransmitAction {
|
||||
TRANSMIT_DONT = 0, /* No transfer to do. */
|
||||
TRANSMIT_DOWN = 1, /* Transfer to the underlying channel. */
|
||||
TRANSMIT_SELF = 2, /* Transfer into our channel. */
|
||||
TRANSMIT_IBUF = 3, /* Transfer to internal input buffer. */
|
||||
TRANSMIT_NUM = 4 /* Transfer number to 'maxRead'. */
|
||||
};
|
||||
|
||||
/*
|
||||
* Codes for 'preserve' of 'ExecuteCallback'.
|
||||
*/
|
||||
|
||||
#define P_PRESERVE 1
|
||||
#define P_NO_PRESERVE 0
|
||||
enum PreserveFlags {
|
||||
P_PRESERVE = 1,
|
||||
P_NO_PRESERVE = 0
|
||||
};
|
||||
|
||||
/*
|
||||
* Strings for the action codes delivered to the script implementing a
|
||||
@@ -907,10 +911,10 @@ TransformSeekProc(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static Tcl_WideInt
|
||||
static long long
|
||||
TransformWideSeekProc(
|
||||
ClientData instanceData, /* The channel to manipulate. */
|
||||
Tcl_WideInt offset, /* Size of movement. */
|
||||
long long offset, /* Size of movement. */
|
||||
int mode, /* How to move. */
|
||||
int *errorCodePtr) /* Location of error flag. */
|
||||
{
|
||||
@@ -922,7 +926,7 @@ TransformWideSeekProc(
|
||||
#endif
|
||||
Tcl_DriverWideSeekProc *parentWideSeekProc =
|
||||
Tcl_ChannelWideSeekProc(parentType);
|
||||
ClientData parentData = Tcl_GetChannelInstanceData(parent);
|
||||
void *parentData = Tcl_GetChannelInstanceData(parent);
|
||||
|
||||
if ((offset == 0) && (mode == SEEK_CUR)) {
|
||||
/*
|
||||
|
||||
+115
-28
@@ -44,8 +44,8 @@ static void ReflectThread(ClientData clientData, int action);
|
||||
static int ReflectEventRun(Tcl_Event *ev, int flags);
|
||||
static int ReflectEventDelete(Tcl_Event *ev, ClientData cd);
|
||||
#endif
|
||||
static Tcl_WideInt ReflectSeekWide(ClientData clientData,
|
||||
Tcl_WideInt offset, int mode, int *errorCodePtr);
|
||||
static long long ReflectSeekWide(ClientData clientData,
|
||||
long long offset, int mode, int *errorCodePtr);
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
static int ReflectSeek(ClientData clientData, long offset,
|
||||
int mode, int *errorCodePtr);
|
||||
@@ -56,12 +56,13 @@ static int ReflectGetOption(ClientData clientData,
|
||||
static int ReflectSetOption(ClientData clientData,
|
||||
Tcl_Interp *interp, const char *optionName,
|
||||
const char *newValue);
|
||||
static void TimerRunRead(ClientData clientData);
|
||||
static void TimerRunWrite(ClientData clientData);
|
||||
static int ReflectTruncate(ClientData clientData,
|
||||
long long length);
|
||||
static void TimerRunRead(ClientData clientData);
|
||||
static void TimerRunWrite(ClientData clientData);
|
||||
|
||||
/*
|
||||
* The C layer channel type/driver definition used by the reflection. This is
|
||||
* a version 3 structure.
|
||||
* The C layer channel type/driver definition used by the reflection.
|
||||
*/
|
||||
|
||||
static const Tcl_ChannelType tclRChannelType = {
|
||||
@@ -89,7 +90,7 @@ static const Tcl_ChannelType tclRChannelType = {
|
||||
#else
|
||||
NULL, /* thread action */
|
||||
#endif
|
||||
NULL /* truncate */
|
||||
ReflectTruncate /* Truncate. NULL'able */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -103,33 +104,27 @@ typedef struct {
|
||||
* Tcl level part of the channel. NULL here
|
||||
* signals the channel is dead because the
|
||||
* interpreter/thread containing its Tcl
|
||||
* command is gone.
|
||||
*/
|
||||
* command is gone. */
|
||||
#if TCL_THREADS
|
||||
Tcl_ThreadId thread; /* Thread the 'interp' belongs to. == Handler thread */
|
||||
Tcl_ThreadId owner; /* Thread owning the structure. == Channel thread */
|
||||
Tcl_ThreadId thread; /* Thread the 'interp' belongs to. == Handler
|
||||
* thread */
|
||||
Tcl_ThreadId owner; /* Thread owning the structure. == Channel
|
||||
* thread */
|
||||
#endif
|
||||
Tcl_Obj *cmd; /* Callback command prefix */
|
||||
Tcl_Obj *methods; /* Methods to append to command prefix */
|
||||
Tcl_Obj *name; /* Name of the channel as created */
|
||||
|
||||
int mode; /* Mask of R/W mode */
|
||||
int interest; /* Mask of events the channel is interested
|
||||
* in. */
|
||||
|
||||
int dead; /* Boolean signal that some operations
|
||||
* should no longer be attempted. */
|
||||
|
||||
Tcl_TimerToken readTimer; /*
|
||||
A token for the timer that is scheduled in
|
||||
order to call Tcl_NotifyChannel when the
|
||||
channel is readable
|
||||
*/
|
||||
Tcl_TimerToken writeTimer; /*
|
||||
A token for the timer that is scheduled in
|
||||
order to call Tcl_NotifyChannel when the
|
||||
channel is writable
|
||||
*/
|
||||
Tcl_TimerToken readTimer; /* A token for the timer that is scheduled in
|
||||
* order to call Tcl_NotifyChannel when the
|
||||
* channel is readable */
|
||||
Tcl_TimerToken writeTimer; /* A token for the timer that is scheduled in
|
||||
* order to call Tcl_NotifyChannel when the
|
||||
* channel is writable */
|
||||
|
||||
/*
|
||||
* Note regarding the usage of timers.
|
||||
@@ -187,6 +182,7 @@ static const char *const methodNames[] = {
|
||||
"initialize", /* */
|
||||
"read", /* OPT */
|
||||
"seek", /* OPT */
|
||||
"truncate", /* OPT */
|
||||
"watch", /* */
|
||||
"write", /* OPT */
|
||||
NULL
|
||||
@@ -200,6 +196,7 @@ typedef enum {
|
||||
METH_INIT,
|
||||
METH_READ,
|
||||
METH_SEEK,
|
||||
METH_TRUNCATE,
|
||||
METH_WATCH,
|
||||
METH_WRITE
|
||||
} MethodName;
|
||||
@@ -209,7 +206,8 @@ typedef enum {
|
||||
(FLAG(METH_INIT) | FLAG(METH_FINAL) | FLAG(METH_WATCH))
|
||||
#define NULLABLE_METHODS \
|
||||
(FLAG(METH_BLOCKING) | FLAG(METH_SEEK) | \
|
||||
FLAG(METH_CONFIGURE) | FLAG(METH_CGET) | FLAG(METH_CGETALL))
|
||||
FLAG(METH_CONFIGURE) | FLAG(METH_CGET) | \
|
||||
FLAG(METH_CGETALL) | FLAG(METH_TRUNCATE))
|
||||
|
||||
#define RANDW \
|
||||
(TCL_READABLE | TCL_WRITABLE)
|
||||
@@ -239,7 +237,8 @@ typedef enum {
|
||||
ForwardedBlock,
|
||||
ForwardedSetOpt,
|
||||
ForwardedGetOpt,
|
||||
ForwardedGetOptAll
|
||||
ForwardedGetOptAll,
|
||||
ForwardedTruncate
|
||||
} ForwardedOperation;
|
||||
|
||||
/*
|
||||
@@ -302,6 +301,10 @@ struct ForwardParamGetOpt {
|
||||
const char *name; /* Name of option to get, maybe NULL */
|
||||
Tcl_DString *value; /* Result */
|
||||
};
|
||||
struct ForwardParamTruncate {
|
||||
ForwardParamBase base; /* "Supertype". MUST COME FIRST. */
|
||||
Tcl_WideInt length; /* I: Length of file. */
|
||||
};
|
||||
|
||||
/*
|
||||
* Now join all these together in a single union for convenience.
|
||||
@@ -316,6 +319,7 @@ typedef union ForwardParam {
|
||||
struct ForwardParamBlock block;
|
||||
struct ForwardParamSetOpt setOpt;
|
||||
struct ForwardParamGetOpt getOpt;
|
||||
struct ForwardParamTruncate truncate;
|
||||
} ForwardParam;
|
||||
|
||||
/*
|
||||
@@ -706,6 +710,9 @@ TclChanCreateObjCmd(
|
||||
#endif
|
||||
clonePtr->wideSeekProc = NULL;
|
||||
}
|
||||
if (!(methods & FLAG(METH_TRUNCATE))) {
|
||||
clonePtr->truncateProc = NULL;
|
||||
}
|
||||
|
||||
chanPtr->typePtr = clonePtr;
|
||||
}
|
||||
@@ -1550,10 +1557,10 @@ ReflectOutput(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static Tcl_WideInt
|
||||
static long long
|
||||
ReflectSeekWide(
|
||||
ClientData clientData,
|
||||
Tcl_WideInt offset,
|
||||
long long offset,
|
||||
int seekMode,
|
||||
int *errorCodePtr)
|
||||
{
|
||||
@@ -2047,6 +2054,73 @@ ReflectGetOption(
|
||||
goto stop;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* ReflectTruncate --
|
||||
*
|
||||
* This function is invoked to truncate a channel's file size.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result code.
|
||||
*
|
||||
* Side effects:
|
||||
* Arbitrary, as it calls upon a Tcl script.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
ReflectTruncate(
|
||||
ClientData clientData, /* Channel to query */
|
||||
long long length) /* Length to truncate to. */
|
||||
{
|
||||
ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
|
||||
Tcl_Obj *lenObj;
|
||||
int errorNum; /* EINVAL or EOK (success). */
|
||||
Tcl_Obj *resObj; /* Result for 'truncate' */
|
||||
|
||||
/*
|
||||
* Are we in the correct thread?
|
||||
*/
|
||||
|
||||
#ifdef TCL_THREADS
|
||||
if (rcPtr->thread != Tcl_GetCurrentThread()) {
|
||||
ForwardParam p;
|
||||
|
||||
p.truncate.length = length;
|
||||
|
||||
ForwardOpToHandlerThread(rcPtr, ForwardedTruncate, &p);
|
||||
|
||||
if (p.base.code != TCL_OK) {
|
||||
PassReceivedError(rcPtr->chan, &p);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
return EOK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ASSERT: rcPtr->method & FLAG(METH_TRUNCATE) */
|
||||
|
||||
Tcl_Preserve(rcPtr);
|
||||
|
||||
lenObj = Tcl_NewIntObj(length);
|
||||
Tcl_IncrRefCount(lenObj);
|
||||
|
||||
if (InvokeTclMethod(rcPtr,METH_TRUNCATE,lenObj,NULL,&resObj)!=TCL_OK) {
|
||||
Tcl_SetChannelError(rcPtr->chan, resObj);
|
||||
errorNum = EINVAL;
|
||||
} else {
|
||||
errorNum = EOK;
|
||||
}
|
||||
|
||||
Tcl_DecrRefCount(lenObj);
|
||||
Tcl_DecrRefCount(resObj); /* Remove reference held from invoke */
|
||||
Tcl_Release(rcPtr);
|
||||
return errorNum;
|
||||
}
|
||||
|
||||
/*
|
||||
* Helpers. =========================================================
|
||||
*/
|
||||
@@ -3278,6 +3352,19 @@ ForwardProc(
|
||||
Tcl_Release(rcPtr);
|
||||
break;
|
||||
|
||||
case ForwardedTruncate: {
|
||||
Tcl_Obj *lenObj = Tcl_NewIntObj(paramPtr->truncate.length);
|
||||
|
||||
Tcl_IncrRefCount(lenObj);
|
||||
Tcl_Preserve(rcPtr);
|
||||
if (InvokeTclMethod(rcPtr,METH_TRUNCATE,lenObj,NULL,&resObj)!=TCL_OK) {
|
||||
ForwardSetObjError(paramPtr, resObj);
|
||||
}
|
||||
Tcl_Release(rcPtr);
|
||||
Tcl_DecrRefCount(lenObj);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
/*
|
||||
* Bad operation code.
|
||||
|
||||
+34
-39
@@ -39,8 +39,8 @@ static int ReflectOutput(ClientData clientData, const char *buf,
|
||||
int toWrite, int *errorCodePtr);
|
||||
static void ReflectWatch(ClientData clientData, int mask);
|
||||
static int ReflectBlock(ClientData clientData, int mode);
|
||||
static Tcl_WideInt ReflectSeekWide(ClientData clientData,
|
||||
Tcl_WideInt offset, int mode, int *errorCodePtr);
|
||||
static long long ReflectSeekWide(ClientData clientData,
|
||||
long long offset, int mode, int *errorCodePtr);
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
static int ReflectSeek(ClientData clientData, long offset,
|
||||
int mode, int *errorCodePtr);
|
||||
@@ -476,8 +476,10 @@ static int TransformLimit(ReflectedTransform *rtPtr,
|
||||
* Operation codes for TransformFlush().
|
||||
*/
|
||||
|
||||
#define FLUSH_WRITE 1
|
||||
#define FLUSH_DISCARD 0
|
||||
enum FlushOperations {
|
||||
FLUSH_WRITE = 1,
|
||||
FLUSH_DISCARD = 0
|
||||
};
|
||||
|
||||
/*
|
||||
* Main methods to plug into the 'chan' ensemble'. ==================
|
||||
@@ -1113,7 +1115,6 @@ ReflectInput(
|
||||
goto stop;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The buffer is exhausted, but the caller wants even more. We now
|
||||
* have to go to the underlying channel, get more bytes and then
|
||||
@@ -1149,12 +1150,10 @@ ReflectInput(
|
||||
goto stop;
|
||||
}
|
||||
|
||||
|
||||
readBytes = Tcl_ReadRaw(rtPtr->parent,
|
||||
(char *) Tcl_SetByteArrayLength(bufObj, toRead), toRead);
|
||||
if (readBytes < 0) {
|
||||
if (Tcl_InputBlocked(rtPtr->parent) && (gotBytes > 0)) {
|
||||
|
||||
/*
|
||||
* Down channel is blocked and offers zero additional bytes.
|
||||
* The nonzero gotBytes already returned makes the total
|
||||
@@ -1165,11 +1164,10 @@ ReflectInput(
|
||||
}
|
||||
|
||||
/*
|
||||
* Either the down channel is not blocked (a real error)
|
||||
* or it is and there are gotBytes==0 byte copied so far.
|
||||
* In either case, pass up the error, so we either report
|
||||
* any real error, or do not mistakenly signal EOF by
|
||||
* returning 0 to the caller.
|
||||
* Either the down channel is not blocked (a real error) or it is
|
||||
* and there are gotBytes==0 byte copied so far. In either case,
|
||||
* pass up the error, so we either report any real error, or do
|
||||
* not mistakenly signal EOF by returning 0 to the caller.
|
||||
*/
|
||||
|
||||
*errorCodePtr = Tcl_GetErrno();
|
||||
@@ -1177,34 +1175,33 @@ ReflectInput(
|
||||
}
|
||||
|
||||
if (readBytes == 0) {
|
||||
|
||||
/*
|
||||
* Zero returned from Tcl_ReadRaw() always indicates EOF
|
||||
* on the down channel.
|
||||
* Zero returned from Tcl_ReadRaw() always indicates EOF on the
|
||||
* down channel.
|
||||
*/
|
||||
|
||||
rtPtr->eofPending = 1;
|
||||
|
||||
/*
|
||||
* Now this is a bit different. The partial data waiting is
|
||||
* converted and returned.
|
||||
*/
|
||||
|
||||
if (HAS(rtPtr->methods, METH_DRAIN)) {
|
||||
if (!TransformDrain(rtPtr, errorCodePtr)) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
if (ResultLength(&rtPtr->result) == 0) {
|
||||
/*
|
||||
* Now this is a bit different. The partial data waiting is
|
||||
* converted and returned.
|
||||
* The drain delivered nothing.
|
||||
*/
|
||||
|
||||
if (HAS(rtPtr->methods, METH_DRAIN)) {
|
||||
if (!TransformDrain(rtPtr, errorCodePtr)) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
goto stop;
|
||||
}
|
||||
|
||||
if (ResultLength(&rtPtr->result) == 0) {
|
||||
/*
|
||||
* The drain delivered nothing.
|
||||
*/
|
||||
|
||||
goto stop;
|
||||
}
|
||||
|
||||
continue; /* at: while (toRead > 0) */
|
||||
continue; /* at: while (toRead > 0) */
|
||||
} /* readBytes == 0 */
|
||||
|
||||
/*
|
||||
@@ -1327,10 +1324,10 @@ ReflectOutput(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static Tcl_WideInt
|
||||
static long long
|
||||
ReflectSeekWide(
|
||||
ClientData clientData,
|
||||
Tcl_WideInt offset,
|
||||
long long offset,
|
||||
int seekMode,
|
||||
int *errorCodePtr)
|
||||
{
|
||||
@@ -1388,16 +1385,15 @@ ReflectSeekWide(
|
||||
curPos = -1;
|
||||
} else {
|
||||
curPos = Tcl_ChannelSeekProc(parent->typePtr)(
|
||||
parent->instanceData, offset, seekMode,
|
||||
errorCodePtr);
|
||||
parent->instanceData, offset, seekMode, errorCodePtr);
|
||||
}
|
||||
#else
|
||||
*errorCodePtr = EINVAL;
|
||||
curPos = -1;
|
||||
#endif
|
||||
} else {
|
||||
curPos = Tcl_ChannelWideSeekProc(parent->typePtr)(parent->instanceData, offset,
|
||||
seekMode, errorCodePtr);
|
||||
curPos = Tcl_ChannelWideSeekProc(parent->typePtr)(parent->instanceData,
|
||||
offset, seekMode, errorCodePtr);
|
||||
}
|
||||
if (curPos == -1) {
|
||||
Tcl_SetErrno(*errorCodePtr);
|
||||
@@ -1423,8 +1419,7 @@ ReflectSeek(
|
||||
* routine.
|
||||
*/
|
||||
|
||||
return ReflectSeekWide(clientData, offset, seekMode,
|
||||
errorCodePtr);
|
||||
return ReflectSeekWide(clientData, offset, seekMode, errorCodePtr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+11
-4
@@ -3009,7 +3009,7 @@ Tcl_FSLoadFile(
|
||||
const char *sym1, const char *sym2,
|
||||
/* Names of two functions to find in the
|
||||
* dynamic shared object. */
|
||||
Tcl_PackageInitProc **proc1Ptr, Tcl_PackageInitProc **proc2Ptr,
|
||||
Tcl_LibraryInitProc **proc1Ptr, Tcl_LibraryInitProc **proc2Ptr,
|
||||
/* Places to store pointers to the functions
|
||||
* named by sym1 and sym2. */
|
||||
Tcl_LoadHandle *handlePtr, /* A place to store the token for the loaded
|
||||
@@ -3027,8 +3027,8 @@ Tcl_FSLoadFile(
|
||||
|
||||
res = Tcl_LoadFile(interp, pathPtr, symbols, 0, procPtrs, handlePtr);
|
||||
if (res == TCL_OK) {
|
||||
*proc1Ptr = (Tcl_PackageInitProc *) procPtrs[0];
|
||||
*proc2Ptr = (Tcl_PackageInitProc *) procPtrs[1];
|
||||
*proc1Ptr = (Tcl_LibraryInitProc *) procPtrs[0];
|
||||
*proc2Ptr = (Tcl_LibraryInitProc *) procPtrs[1];
|
||||
} else {
|
||||
*proc1Ptr = *proc2Ptr = NULL;
|
||||
}
|
||||
@@ -3077,6 +3077,13 @@ Tcl_FSLoadFile(
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#define getenv(x) _wgetenv(L##x)
|
||||
#define atoi(x) _wtoi(x)
|
||||
#else
|
||||
#define WCHAR char
|
||||
#endif
|
||||
|
||||
static int
|
||||
skipUnlink(
|
||||
Tcl_Obj *shlibFile)
|
||||
@@ -3098,7 +3105,7 @@ skipUnlink(
|
||||
(void)shlibFile;
|
||||
return 1;
|
||||
#else
|
||||
char *skipstr = getenv("TCL_TEMPLOAD_NO_UNLINK");
|
||||
WCHAR *skipstr = getenv("TCL_TEMPLOAD_NO_UNLINK");
|
||||
|
||||
if (skipstr && (skipstr[0] != '\0')) {
|
||||
return atoi(skipstr);
|
||||
|
||||
@@ -785,7 +785,7 @@ PrefixLongestObjCmd(
|
||||
* Adjust in case we stopped in the middle of a UTF char.
|
||||
*/
|
||||
|
||||
resultLength = TclUtfPrev(&resultString[i+1],
|
||||
resultLength = Tcl_UtfPrev(&resultString[i+1],
|
||||
resultString) - resultString;
|
||||
break;
|
||||
}
|
||||
@@ -1332,7 +1332,6 @@ PrintUsage(
|
||||
int width, numSpaces;
|
||||
#define NUM_SPACES 20
|
||||
static const char spaces[] = " ";
|
||||
char tmp[TCL_DOUBLE_SPACE];
|
||||
Tcl_Obj *msg;
|
||||
|
||||
/*
|
||||
@@ -1382,7 +1381,6 @@ PrintUsage(
|
||||
case TCL_ARGV_FLOAT:
|
||||
Tcl_AppendPrintfToObj(msg, "\n\t\tDefault value: %g",
|
||||
*((double *) infoPtr->dstPtr));
|
||||
sprintf(tmp, "%g", *((double *) infoPtr->dstPtr));
|
||||
break;
|
||||
case TCL_ARGV_STRING: {
|
||||
char *string = *((char **) infoPtr->dstPtr);
|
||||
|
||||
@@ -17,6 +17,7 @@ library tcl
|
||||
# Define the unsupported generic interfaces.
|
||||
|
||||
interface tclInt
|
||||
scspec EXTERN
|
||||
|
||||
# Declare each of the functions in the unsupported internal Tcl
|
||||
# interface. These interfaces are allowed to changed between versions.
|
||||
@@ -239,8 +240,8 @@ declare 55 {
|
||||
# Replaced with TclpLoadFile in 8.1:
|
||||
# declare 56 {
|
||||
# int TclLoadFile(Tcl_Interp *interp, char *fileName, char *sym1,
|
||||
# char *sym2, Tcl_PackageInitProc **proc1Ptr,
|
||||
# Tcl_PackageInitProc **proc2Ptr)
|
||||
# char *sym2, Tcl_LibraryInitProc **proc1Ptr,
|
||||
# Tcl_LibraryInitProc **proc2Ptr)
|
||||
# }
|
||||
# Signature changed to take a length in 8.1:
|
||||
# declare 57 {
|
||||
@@ -552,8 +553,8 @@ declare 138 {
|
||||
}
|
||||
#declare 139 {
|
||||
# int TclpLoadFile(Tcl_Interp *interp, char *fileName, char *sym1,
|
||||
# char *sym2, Tcl_PackageInitProc **proc1Ptr,
|
||||
# Tcl_PackageInitProc **proc2Ptr, void **clientDataPtr)
|
||||
# char *sym2, Tcl_LibraryInitProc **proc1Ptr,
|
||||
# Tcl_LibraryInitProc **proc2Ptr, void **clientDataPtr)
|
||||
#}
|
||||
#declare 140 {
|
||||
# int TclLooksLikeInt(const char *bytes, int length)
|
||||
@@ -981,7 +982,7 @@ declare 247 {
|
||||
|
||||
declare 248 {
|
||||
int TclCopyChannel(Tcl_Interp *interp, Tcl_Channel inChan,
|
||||
Tcl_Channel outChan, Tcl_WideInt toRead, Tcl_Obj *cmdPtr)
|
||||
Tcl_Channel outChan, long long toRead, Tcl_Obj *cmdPtr)
|
||||
}
|
||||
|
||||
declare 249 {
|
||||
@@ -1025,8 +1026,8 @@ declare 256 {
|
||||
Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, const int flags)
|
||||
}
|
||||
declare 257 {
|
||||
void TclStaticPackage(Tcl_Interp *interp, const char *pkgName,
|
||||
Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc)
|
||||
void TclStaticLibrary(Tcl_Interp *interp, const char *prefix,
|
||||
Tcl_LibraryInitProc *initProc, Tcl_LibraryInitProc *safeInitProc)
|
||||
}
|
||||
|
||||
# TIP 431: temporary directory creation function
|
||||
|
||||
+355
-281
@@ -230,7 +230,9 @@ typedef struct Tcl_ResolverInfo {
|
||||
* (Bug #835020)
|
||||
*/
|
||||
|
||||
#define TCL_AVOID_RESOLVERS 0x40000
|
||||
enum ResolutionFlags {
|
||||
TCL_AVOID_RESOLVERS = 0x40000
|
||||
};
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------
|
||||
@@ -283,7 +285,7 @@ typedef struct Namespace {
|
||||
* synonym. */
|
||||
char *fullName; /* The namespace's fully qualified name. This
|
||||
* starts with ::. */
|
||||
void *clientData; /* An arbitrary value associated with this
|
||||
void *clientData; /* An arbitrary value associated with this
|
||||
* namespace. */
|
||||
Tcl_NamespaceDeleteProc *deleteProc;
|
||||
/* Procedure invoked when deleting the
|
||||
@@ -366,7 +368,8 @@ typedef struct Namespace {
|
||||
* LookupCompiledLocal to resolve variable
|
||||
* references within the namespace at compile
|
||||
* time. */
|
||||
unsigned int exportLookupEpoch; /* Incremented whenever a command is added to
|
||||
unsigned int exportLookupEpoch;
|
||||
/* Incremented whenever a command is added to
|
||||
* a namespace, removed from a namespace or
|
||||
* the exports of a namespace are changed.
|
||||
* Allows TIP#112-driven command lists to be
|
||||
@@ -413,44 +416,50 @@ struct NamespacePathEntry {
|
||||
|
||||
/*
|
||||
* Flags used to represent the status of a namespace:
|
||||
*
|
||||
* NS_DYING - 1 means Tcl_DeleteNamespace has been called to delete the
|
||||
* namespace but there are still active call frames on the Tcl
|
||||
* stack that refer to the namespace. When the last call frame
|
||||
* referring to it has been popped, it's variables and command
|
||||
* will be destroyed and it will be marked "dead" (NS_DEAD). The
|
||||
* namespace can no longer be looked up by name.
|
||||
* NS_DEAD - 1 means Tcl_DeleteNamespace has been called to delete the
|
||||
* namespace and no call frames still refer to it. Its variables
|
||||
* and command have already been destroyed. This bit allows the
|
||||
* namespace resolution code to recognize that the namespace is
|
||||
* "deleted". When the last namespaceName object in any byte code
|
||||
* unit that refers to the namespace has been freed (i.e., when
|
||||
* the namespace's refCount is 0), the namespace's storage will
|
||||
* be freed.
|
||||
* NS_KILLED - 1 means that TclTeardownNamespace has already been called on
|
||||
* this namespace and it should not be called again [Bug 1355942]
|
||||
* NS_SUPPRESS_COMPILATION -
|
||||
* Marks the commands in this namespace for not being compiled,
|
||||
* forcing them to be looked up every time.
|
||||
*/
|
||||
|
||||
#define NS_DYING 0x01
|
||||
#define NS_DEAD 0x02
|
||||
#define NS_KILLED 0x04
|
||||
#define NS_SUPPRESS_COMPILATION 0x08
|
||||
enum NamespaceFlags {
|
||||
NS_DYING = 0x01, /* Tcl_DeleteNamespace has been called to
|
||||
* delete the namespace but there are still
|
||||
* active call frames on the Tcl stack that
|
||||
* refer to the namespace. When the last call
|
||||
* frame referring to it has been popped, it's
|
||||
* variables and command will be destroyed and
|
||||
* it will be marked "dead" (NS_DEAD). The
|
||||
* namespace can no longer be looked up by
|
||||
* name. */
|
||||
NS_DEAD = 0x02, /* Tcl_DeleteNamespace has been called to
|
||||
* delete the namespace and no call frames
|
||||
* still refer to it. Its variables and
|
||||
* command have already been destroyed. This
|
||||
* bit allows the namespace resolution code to
|
||||
* recognize that the namespace is "deleted".
|
||||
* When the last namespaceName object in any
|
||||
* byte code unit that refers to the namespace
|
||||
* has been freed (i.e., when the namespace's
|
||||
* refCount is 0), the namespace's storage
|
||||
* will be freed. */
|
||||
NS_KILLED = 0x04, /* TclTeardownNamespace has already been
|
||||
* called on this namespace and it should not
|
||||
* be called again. [Bug 1355942] */
|
||||
NS_SUPPRESS_COMPILATION = 0x08
|
||||
/* Marks the commands in this namespace for
|
||||
* not being compiled, forcing them to be
|
||||
* looked up every time. */
|
||||
};
|
||||
|
||||
/*
|
||||
* Flags passed to TclGetNamespaceForQualName:
|
||||
* Flags passed to TclGetNamespaceForQualName. Also:
|
||||
*
|
||||
* TCL_GLOBAL_ONLY - (see tcl.h) Look only in the global ns.
|
||||
* TCL_NAMESPACE_ONLY - (see tcl.h) Look only in the context ns.
|
||||
* TCL_CREATE_NS_IF_UNKNOWN - Create unknown namespaces.
|
||||
* TCL_FIND_ONLY_NS - The name sought is a namespace name.
|
||||
*/
|
||||
|
||||
#define TCL_CREATE_NS_IF_UNKNOWN 0x800
|
||||
#define TCL_FIND_ONLY_NS 0x1000
|
||||
enum GetNamespaceFlags {
|
||||
TCL_CREATE_NS_IF_UNKNOWN = 0x800,
|
||||
/* Create unknown namespaces. */
|
||||
TCL_FIND_ONLY_NS = 0x1000 /* The name sought is a namespace name. */
|
||||
};
|
||||
|
||||
/*
|
||||
* The client data for an ensemble command. This consists of the table of
|
||||
@@ -534,10 +543,13 @@ typedef struct EnsembleConfig {
|
||||
* Various bits for the EnsembleConfig.flags field.
|
||||
*/
|
||||
|
||||
#define ENSEMBLE_DEAD 0x1 /* Flag value to say that the ensemble is dead
|
||||
enum EnsembleFlags {
|
||||
ENSEMBLE_DEAD = 0x1, /* Flag value to say that the ensemble is dead
|
||||
* and on its way out. */
|
||||
#define ENSEMBLE_COMPILE 0x4 /* Flag to enable bytecode compilation of an
|
||||
* ensemble. */
|
||||
ENSEMBLE_COMPILE = 0x4 /* Flag to enable bytecode compilation of an
|
||||
* ensemble. Possible candidate for some sort
|
||||
* of exposure to the public interface? */
|
||||
};
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------
|
||||
@@ -554,7 +566,7 @@ typedef struct EnsembleConfig {
|
||||
typedef struct VarTrace {
|
||||
Tcl_VarTraceProc *traceProc;/* Procedure to call when operations given by
|
||||
* flags are performed on variable. */
|
||||
void *clientData; /* Argument to pass to proc. */
|
||||
void *clientData; /* Argument to pass to proc. */
|
||||
int flags; /* What events the trace procedure is
|
||||
* interested in: OR-ed combination of
|
||||
* TCL_TRACE_READS, TCL_TRACE_WRITES,
|
||||
@@ -573,14 +585,14 @@ typedef struct CommandTrace {
|
||||
Tcl_CommandTraceProc *traceProc;
|
||||
/* Procedure to call when operations given by
|
||||
* flags are performed on command. */
|
||||
void *clientData; /* Argument to pass to proc. */
|
||||
void *clientData; /* Argument to pass to proc. */
|
||||
int flags; /* What events the trace procedure is
|
||||
* interested in: OR-ed combination of
|
||||
* TCL_TRACE_RENAME, TCL_TRACE_DELETE. */
|
||||
struct CommandTrace *nextPtr;
|
||||
/* Next in list of traces associated with a
|
||||
* particular command. */
|
||||
unsigned int refCount; /* Used to ensure this structure is not
|
||||
unsigned int refCount; /* Used to ensure this structure is not
|
||||
* deleted too early. Keeps track of how many
|
||||
* pieces of code have a pointer to this
|
||||
* structure. */
|
||||
@@ -745,35 +757,38 @@ typedef struct VarInHash {
|
||||
* in precompiled scripts keep working.
|
||||
*/
|
||||
|
||||
/* Type of value (0 is scalar) */
|
||||
#define VAR_ARRAY 0x1
|
||||
#define VAR_LINK 0x2
|
||||
enum VariableFlags {
|
||||
/* Type of value (0 is scalar) */
|
||||
VAR_ARRAY = 0x1,
|
||||
VAR_LINK = 0x2,
|
||||
|
||||
/* Type of storage (0 is compiled local) */
|
||||
#define VAR_IN_HASHTABLE 0x4
|
||||
#define VAR_DEAD_HASH 0x8
|
||||
#define VAR_ARRAY_ELEMENT 0x1000
|
||||
#define VAR_NAMESPACE_VAR 0x80 /* KEEP OLD VALUE for Itcl */
|
||||
/* Type of storage (0 is compiled local) */
|
||||
VAR_IN_HASHTABLE = 0x4,
|
||||
VAR_DEAD_HASH = 0x8,
|
||||
VAR_ARRAY_ELEMENT = 0x1000,
|
||||
VAR_NAMESPACE_VAR = 0x80, /* KEEP OLD VALUE for Itcl */
|
||||
|
||||
#define VAR_ALL_HASH \
|
||||
(VAR_IN_HASHTABLE|VAR_DEAD_HASH|VAR_NAMESPACE_VAR|VAR_ARRAY_ELEMENT)
|
||||
VAR_ALL_HASH = (
|
||||
VAR_IN_HASHTABLE | VAR_DEAD_HASH | VAR_NAMESPACE_VAR |
|
||||
VAR_ARRAY_ELEMENT),
|
||||
|
||||
/* Trace and search state. */
|
||||
/* Trace and search state. */
|
||||
VAR_TRACED_READ = 0x10, /* TCL_TRACE_READS */
|
||||
VAR_TRACED_WRITE = 0x20, /* TCL_TRACE_WRITES */
|
||||
VAR_TRACED_UNSET = 0x40, /* TCL_TRACE_UNSETS */
|
||||
VAR_TRACED_ARRAY = 0x800, /* TCL_TRACE_ARRAY */
|
||||
VAR_TRACE_ACTIVE = 0x2000,
|
||||
VAR_SEARCH_ACTIVE = 0x4000,
|
||||
VAR_ALL_TRACES = (
|
||||
VAR_TRACED_READ | VAR_TRACED_WRITE | VAR_TRACED_ARRAY |
|
||||
VAR_TRACED_UNSET),
|
||||
|
||||
#define VAR_TRACED_READ 0x10 /* TCL_TRACE_READS */
|
||||
#define VAR_TRACED_WRITE 0x20 /* TCL_TRACE_WRITES */
|
||||
#define VAR_TRACED_UNSET 0x40 /* TCL_TRACE_UNSETS */
|
||||
#define VAR_TRACED_ARRAY 0x800 /* TCL_TRACE_ARRAY */
|
||||
#define VAR_TRACE_ACTIVE 0x2000
|
||||
#define VAR_SEARCH_ACTIVE 0x4000
|
||||
#define VAR_ALL_TRACES \
|
||||
(VAR_TRACED_READ|VAR_TRACED_WRITE|VAR_TRACED_ARRAY|VAR_TRACED_UNSET)
|
||||
|
||||
/* Special handling on initialisation (only CompiledLocal). */
|
||||
#define VAR_ARGUMENT 0x100 /* KEEP OLD VALUE! See tclProc.c */
|
||||
#define VAR_TEMPORARY 0x200 /* KEEP OLD VALUE! See tclProc.c */
|
||||
#define VAR_IS_ARGS 0x400
|
||||
#define VAR_RESOLVED 0x8000
|
||||
/* Special handling on initialisation (only CompiledLocal). */
|
||||
VAR_ARGUMENT = 0x100, /* KEEP OLD VALUE! See tclProc.c */
|
||||
VAR_TEMPORARY = 0x200, /* KEEP OLD VALUE! See tclProc.c */
|
||||
VAR_IS_ARGS = 0x400,
|
||||
VAR_RESOLVED = 0x8000
|
||||
};
|
||||
|
||||
/*
|
||||
* Macros to ensure that various flag bits are set properly for variables.
|
||||
@@ -974,7 +989,7 @@ typedef struct CompiledLocal {
|
||||
* is marked by a unique tag during
|
||||
* compilation, and that same tag is used to
|
||||
* find the variable at runtime. */
|
||||
char name[TCLFLEXARRAY]; /* Name of the local variable starts here. If
|
||||
char name[TCLFLEXARRAY]; /* Name of the local variable starts here. If
|
||||
* the name is NULL, this will just be '\0'.
|
||||
* The actual size of this field will be large
|
||||
* enough to hold the name. MUST BE THE LAST
|
||||
@@ -1032,7 +1047,7 @@ typedef struct Trace {
|
||||
int level; /* Only trace commands at nesting level less
|
||||
* than or equal to this. */
|
||||
Tcl_CmdObjTraceProc *proc; /* Procedure to call to trace command. */
|
||||
void *clientData; /* Arbitrary value to pass to proc. */
|
||||
void *clientData; /* Arbitrary value to pass to proc. */
|
||||
struct Trace *nextPtr; /* Next in list of traces for this interp. */
|
||||
int flags; /* Flags governing the trace - see
|
||||
* Tcl_CreateObjTrace for details. */
|
||||
@@ -1063,17 +1078,16 @@ typedef struct ActiveInterpTrace {
|
||||
/*
|
||||
* Flag values designating types of execution traces. See tclTrace.c for
|
||||
* related flag values.
|
||||
*
|
||||
* TCL_TRACE_ENTER_EXEC - triggers enter/enterstep traces.
|
||||
* - passed to Tcl_CreateObjTrace to set up
|
||||
* "enterstep" traces.
|
||||
* TCL_TRACE_LEAVE_EXEC - triggers leave/leavestep traces.
|
||||
* - passed to Tcl_CreateObjTrace to set up
|
||||
* "leavestep" traces.
|
||||
*/
|
||||
|
||||
#define TCL_TRACE_ENTER_EXEC 1
|
||||
#define TCL_TRACE_LEAVE_EXEC 2
|
||||
enum ExecutionTraceTypes {
|
||||
TCL_TRACE_ENTER_EXEC = 1, /* Triggers enter/enterstep traces. Passed to
|
||||
* Tcl_CreateObjTrace to set up "enterstep"
|
||||
* traces. */
|
||||
TCL_TRACE_LEAVE_EXEC = 2 /* Triggers leave/leavestep traces. Passed to
|
||||
* Tcl_CreateObjTrace to set up "leavestep"
|
||||
* traces. */
|
||||
};
|
||||
|
||||
/*
|
||||
* The structure below defines an entry in the assocData hash table which is
|
||||
@@ -1176,20 +1190,24 @@ typedef struct CallFrame {
|
||||
/* NULL if no tailcall is scheduled */
|
||||
} CallFrame;
|
||||
|
||||
#define FRAME_IS_PROC 0x1
|
||||
#define FRAME_IS_LAMBDA 0x2
|
||||
#define FRAME_IS_METHOD 0x4 /* The frame is a method body, and the frame's
|
||||
enum CallFrameFlags {
|
||||
/*FRAME_IS_NAMESPACE = 0,*/ /* The frame is a namespace. Not used except
|
||||
* by implication. */
|
||||
FRAME_IS_PROC = 0x1, /* The frame is a standard procedure. */
|
||||
FRAME_IS_LAMBDA = 0x2, /* The frame is a lambda term */
|
||||
FRAME_IS_METHOD = 0x4, /* The frame is a method body, and the frame's
|
||||
* clientData field contains a CallContext
|
||||
* reference. Part of TIP#257. */
|
||||
#define FRAME_IS_OO_DEFINE 0x8 /* The frame is part of the inside workings of
|
||||
FRAME_IS_OO_DEFINE = 0x8, /* The frame is part of the inside workings of
|
||||
* the [oo::define] command; the clientData
|
||||
* field contains an Object reference that has
|
||||
* been confirmed to refer to a class. Part of
|
||||
* TIP#257. */
|
||||
#define FRAME_IS_PRIVATE_DEFINE 0x10
|
||||
FRAME_IS_PRIVATE_DEFINE = 0x10
|
||||
/* Marks this frame as being used for private
|
||||
* declarations with [oo::define]. Usually
|
||||
* OR'd with FRAME_IS_OO_DEFINE. TIP#500. */
|
||||
};
|
||||
|
||||
/*
|
||||
* TIP #280
|
||||
@@ -1312,7 +1330,7 @@ typedef struct CFWordBC {
|
||||
typedef struct ContLineLoc {
|
||||
int num; /* Number of entries in loc, not counting the
|
||||
* final -1 marker entry. */
|
||||
int loc[TCLFLEXARRAY];/* Table of locations, as character offsets.
|
||||
int loc[TCLFLEXARRAY]; /* Table of locations, as character offsets.
|
||||
* The table is allocated as part of the
|
||||
* structure, extending behind the nominal end
|
||||
* of the structure. An entry containing the
|
||||
@@ -1336,13 +1354,15 @@ typedef struct ContLineLoc {
|
||||
* types, per the context of the byte code in execution.
|
||||
*/
|
||||
|
||||
#define TCL_LOCATION_EVAL (0) /* Location in a dynamic eval script. */
|
||||
#define TCL_LOCATION_BC (2) /* Location in byte code. */
|
||||
#define TCL_LOCATION_PREBC (3) /* Location in precompiled byte code, no
|
||||
* location. */
|
||||
#define TCL_LOCATION_SOURCE (4) /* Location in a file. */
|
||||
#define TCL_LOCATION_PROC (5) /* Location in a dynamic proc. */
|
||||
#define TCL_LOCATION_LAST (6) /* Number of values in the enum. */
|
||||
enum CmdFrameTypes {
|
||||
TCL_LOCATION_EVAL = 0, /* Location in a dynamic eval script. */
|
||||
TCL_LOCATION_BC = 2, /* Location in bytecode. */
|
||||
TCL_LOCATION_PREBC = 3, /* Location in precompiled bytecode, no
|
||||
* location. */
|
||||
TCL_LOCATION_SOURCE = 4, /* Location in a file. */
|
||||
TCL_LOCATION_PROC = 5, /* Location in a dynamic proc. */
|
||||
TCL_LOCATION_LAST = 6 /* Number of values in the enum. */
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure passed to describe procedure-like "procedures" that are not
|
||||
@@ -1353,10 +1373,10 @@ typedef struct ContLineLoc {
|
||||
typedef Tcl_Obj * (GetFrameInfoValueProc)(void *clientData);
|
||||
typedef struct {
|
||||
const char *name; /* Name of this field. */
|
||||
GetFrameInfoValueProc *proc; /* Function to generate a Tcl_Obj* from the
|
||||
GetFrameInfoValueProc *proc;/* Function to generate a Tcl_Obj* from the
|
||||
* clientData, or just use the clientData
|
||||
* directly (after casting) if NULL. */
|
||||
void *clientData; /* Context for above function, or Tcl_Obj* if
|
||||
void *clientData; /* Context for above function, or Tcl_Obj* if
|
||||
* proc field is NULL. */
|
||||
} ExtraFrameInfoField;
|
||||
typedef struct {
|
||||
@@ -1383,8 +1403,10 @@ typedef void **TclHandle;
|
||||
*----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define TCL_REG_BOSONLY 002000 /* Prepend \A to pattern so it only matches at
|
||||
enum TclRegexpFlags {
|
||||
TCL_REG_BOSONLY = 002000 /* Prepend \A to pattern so it only matches at
|
||||
* the beginning of the string. */
|
||||
};
|
||||
|
||||
/*
|
||||
* These are a thin layer over TclpThreadKeyDataGet and TclpThreadKeyDataSet
|
||||
@@ -1691,11 +1713,11 @@ typedef struct Command {
|
||||
Tcl_ObjCmdProc *objProc; /* Object-based command procedure. */
|
||||
void *objClientData; /* Arbitrary value passed to object proc. */
|
||||
Tcl_CmdProc *proc; /* String-based command procedure. */
|
||||
void *clientData; /* Arbitrary value passed to string proc. */
|
||||
void *clientData; /* Arbitrary value passed to string proc. */
|
||||
Tcl_CmdDeleteProc *deleteProc;
|
||||
/* Procedure invoked when deleting command to,
|
||||
* e.g., free all client data. */
|
||||
void *deleteData; /* Arbitrary value passed to deleteProc. */
|
||||
void *deleteData; /* Arbitrary value passed to deleteProc. */
|
||||
int flags; /* Miscellaneous bits of information about
|
||||
* command. See below for definitions. */
|
||||
ImportRef *importRefPtr; /* List of each imported Command created in
|
||||
@@ -1711,37 +1733,32 @@ typedef struct Command {
|
||||
} Command;
|
||||
|
||||
/*
|
||||
* Flag bits for commands.
|
||||
*
|
||||
* CMD_DYING - If 1 the command is in the process of
|
||||
* being deleted (its deleteProc is currently
|
||||
* executing). Other attempts to delete the
|
||||
* command should be ignored.
|
||||
* CMD_TRACE_ACTIVE - If 1 the trace processing is currently
|
||||
* underway for a rename/delete change. See the
|
||||
* two flags below for which is currently being
|
||||
* processed.
|
||||
* CMD_HAS_EXEC_TRACES - If 1 means that this command has at least one
|
||||
* execution trace (as opposed to simple
|
||||
* delete/rename traces) in its tracePtr list.
|
||||
* CMD_COMPILES_EXPANDED - If 1 this command has a compiler that
|
||||
* can handle expansion (provided it is not the
|
||||
* first word).
|
||||
* TCL_TRACE_RENAME - A rename trace is in progress. Further
|
||||
* Flag bits for commands. Also:
|
||||
* TCL_TRACE_RENAME - A rename trace is in progress. Further
|
||||
* recursive renames will not be traced.
|
||||
* TCL_TRACE_DELETE - A delete trace is in progress. Further
|
||||
* TCL_TRACE_DELETE - A delete trace is in progress. Further
|
||||
* recursive deletes will not be traced.
|
||||
* (these last two flags are defined in tcl.h)
|
||||
* (these two flags are defined in tcl.h)
|
||||
*/
|
||||
|
||||
#define CMD_DYING 0x01
|
||||
#define CMD_TRACE_ACTIVE 0x02
|
||||
#define CMD_HAS_EXEC_TRACES 0x04
|
||||
#define CMD_COMPILES_EXPANDED 0x08
|
||||
#define CMD_REDEF_IN_PROGRESS 0x10
|
||||
#define CMD_VIA_RESOLVER 0x20
|
||||
#define CMD_DEAD 0x40
|
||||
|
||||
enum CommandFlags {
|
||||
CMD_DYING = 0x01, /* The command is in the process of being
|
||||
* deleted (its deleteProc is currently
|
||||
* executing). Other attempts to delete the
|
||||
* command should be ignored. */
|
||||
CMD_TRACE_ACTIVE = 0x02, /* The trace processing is currently underway
|
||||
* for a rename/delete change. See the two
|
||||
* flags (TCL_TRACE_RENAME, TCL_TRACE_DELETE)
|
||||
* for which is currently being processed. */
|
||||
CMD_HAS_EXEC_TRACES = 0x04,
|
||||
CMD_COMPILES_EXPANDED = 0x08,
|
||||
/* This command has a compiler that can handle
|
||||
* expansion (provided it is not the first
|
||||
* word). */
|
||||
CMD_REDEF_IN_PROGRESS = 0x10,
|
||||
CMD_VIA_RESOLVER = 0x20,
|
||||
CMD_DEAD = 0x40
|
||||
};
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------
|
||||
@@ -1804,7 +1821,7 @@ typedef struct AllocCache {
|
||||
struct Cache *nextPtr; /* Linked list of cache entries. */
|
||||
Tcl_ThreadId owner; /* Which thread's cache is this? */
|
||||
Tcl_Obj *firstObjPtr; /* List of free objects for thread. */
|
||||
int numObjects; /* Number of objects for thread. */
|
||||
size_t numObjects; /* Number of objects for thread. */
|
||||
} AllocCache;
|
||||
|
||||
/*
|
||||
@@ -2267,75 +2284,81 @@ typedef struct Interp {
|
||||
|
||||
/*
|
||||
* EvalFlag bits for Interp structures:
|
||||
*
|
||||
* TCL_ALLOW_EXCEPTIONS 1 means it's OK for the script to terminate with a
|
||||
* code other than TCL_OK or TCL_ERROR; 0 means codes
|
||||
* other than these should be turned into errors.
|
||||
*/
|
||||
|
||||
#define TCL_ALLOW_EXCEPTIONS 0x04
|
||||
#define TCL_EVAL_FILE 0x02
|
||||
#define TCL_EVAL_SOURCE_IN_FRAME 0x10
|
||||
#define TCL_EVAL_NORESOLVE 0x20
|
||||
#define TCL_EVAL_DISCARD_RESULT 0x40
|
||||
enum TclInterpEvalFlags {
|
||||
TCL_ALLOW_EXCEPTIONS = 0x04,/* It's OK for the script to terminate with a
|
||||
* code other than TCL_OK or TCL_ERROR; not
|
||||
* set means codes other than these should be
|
||||
* turned into errors. */
|
||||
TCL_EVAL_FILE = 0x02,
|
||||
TCL_EVAL_SOURCE_IN_FRAME = 0x10,
|
||||
TCL_EVAL_NORESOLVE = 0x20,
|
||||
TCL_EVAL_DISCARD_RESULT = 0x40
|
||||
};
|
||||
|
||||
/*
|
||||
* Flag bits for Interp structures:
|
||||
*
|
||||
* DELETED: Non-zero means the interpreter has been deleted:
|
||||
* don't process any more commands for it, and destroy
|
||||
* the structure as soon as all nested invocations of
|
||||
* Tcl_Eval are done.
|
||||
* ERR_ALREADY_LOGGED: Non-zero means information has already been logged in
|
||||
* iPtr->errorInfo for the current Tcl_Eval instance, so
|
||||
* Tcl_Eval needn't log it (used to implement the "error
|
||||
* message log" command).
|
||||
* DONT_COMPILE_CMDS_INLINE: Non-zero means that the bytecode compiler should
|
||||
* not compile any commands into an inline sequence of
|
||||
* instructions. This is set 1, for example, when command
|
||||
* traces are requested.
|
||||
* RAND_SEED_INITIALIZED: Non-zero means that the randSeed value of the interp
|
||||
* has not be initialized. This is set 1 when we first
|
||||
* use the rand() or srand() functions.
|
||||
* SAFE_INTERP: Non zero means that the current interp is a safe
|
||||
* interp (i.e. it has only the safe commands installed,
|
||||
* less privilege than a regular interp).
|
||||
* INTERP_DEBUG_FRAME: Used for switching on various extra interpreter
|
||||
* debug/info mechanisms (e.g. info frame eval/uplevel
|
||||
* tracing) which are performance intensive.
|
||||
* INTERP_TRACE_IN_PROGRESS: Non-zero means that an interp trace is currently
|
||||
* active; so no further trace callbacks should be
|
||||
* invoked.
|
||||
* INTERP_ALTERNATE_WRONG_ARGS: Used for listing second and subsequent forms
|
||||
* of the wrong-num-args string in Tcl_WrongNumArgs.
|
||||
* Makes it append instead of replacing and uses
|
||||
* different intermediate text.
|
||||
* CANCELED: Non-zero means that the script in progress should be
|
||||
* canceled as soon as possible. This can be checked by
|
||||
* extensions (and the core itself) by calling
|
||||
* Tcl_Canceled and checking if TCL_ERROR is returned.
|
||||
* This is a one-shot flag that is reset immediately upon
|
||||
* being detected; however, if the TCL_CANCEL_UNWIND flag
|
||||
* is set Tcl_Canceled will continue to report that the
|
||||
* script in progress has been canceled thereby allowing
|
||||
* the evaluation stack for the interp to be fully
|
||||
* unwound.
|
||||
*
|
||||
* WARNING: For the sake of some extensions that have made use of former
|
||||
* internal values, do not re-use the flag values 2 (formerly ERR_IN_PROGRESS)
|
||||
* or 8 (formerly ERROR_CODE_SET).
|
||||
*/
|
||||
|
||||
#define DELETED 1
|
||||
#define ERR_ALREADY_LOGGED 4
|
||||
#define INTERP_DEBUG_FRAME 0x10
|
||||
#define DONT_COMPILE_CMDS_INLINE 0x20
|
||||
#define RAND_SEED_INITIALIZED 0x40
|
||||
#define SAFE_INTERP 0x80
|
||||
#define INTERP_TRACE_IN_PROGRESS 0x200
|
||||
#define INTERP_ALTERNATE_WRONG_ARGS 0x400
|
||||
#define ERR_LEGACY_COPY 0x800
|
||||
#define CANCELED 0x1000
|
||||
enum TclInterpFlags {
|
||||
DELETED = 1, /* If set, the interpreter has been deleted:
|
||||
* don't process any more commands for it, and
|
||||
* destroy the structure as soon as all nested
|
||||
* invocations of Tcl_Eval are done. */
|
||||
ERR_ALREADY_LOGGED = 4, /* If set, information has already been logged
|
||||
* in iPtr->errorInfo for the current Tcl_Eval
|
||||
* instance, so Tcl_Eval needn't log it (used
|
||||
* to implement the "error message log"
|
||||
* command). */
|
||||
INTERP_DEBUG_FRAME = 0x10, /* Used for switching on various extra
|
||||
* interpreter debug/info mechanisms (e.g.
|
||||
* info frame eval/uplevel tracing) which are
|
||||
* performance intensive. */
|
||||
DONT_COMPILE_CMDS_INLINE = 0x20,
|
||||
/* If set the bytecode compiler should not
|
||||
* compile any commands into an inline
|
||||
* sequence of instructions. This is set, for
|
||||
* example, when command traces are
|
||||
* requested. */
|
||||
RAND_SEED_INITIALIZED = 0x40,
|
||||
/* If set, the randSeed value of the interp
|
||||
* has been initialized. This is set when we
|
||||
* first use the rand() or srand()
|
||||
* functions. */
|
||||
SAFE_INTERP = 0x80, /* If set, the current interp is a safe interp
|
||||
* (i.e. it has only the safe commands
|
||||
* installed, less privilege than a regular
|
||||
* interp). */
|
||||
INTERP_TRACE_IN_PROGRESS = 0x200,
|
||||
/* An interp trace is currently active; so no
|
||||
* further trace callbacks should be
|
||||
* invoked. */
|
||||
INTERP_ALTERNATE_WRONG_ARGS = 0x400,
|
||||
/* Used for listing second and subsequent
|
||||
* forms of the wrong-num-args string in
|
||||
* Tcl_WrongNumArgs. Makes it append instead
|
||||
* of replacing and uses different
|
||||
* intermediate text. Used by a few commands
|
||||
* (notably [read]). */
|
||||
ERR_LEGACY_COPY = 0x800,
|
||||
CANCELED = 0x1000 /* If set, the script in progress should be
|
||||
* canceled as soon as possible. This can be
|
||||
* checked by extensions (and the core itself)
|
||||
* by calling Tcl_Canceled and checking if
|
||||
* TCL_ERROR is returned. This is a one-shot
|
||||
* flag that is reset immediately upon being
|
||||
* detected; however, if the TCL_CANCEL_UNWIND
|
||||
* flag is set Tcl_Canceled will continue to
|
||||
* report that the script in progress has been
|
||||
* canceled thereby allowing the evaluation
|
||||
* stack for the interp to be fully
|
||||
* unwound. */
|
||||
};
|
||||
|
||||
/*
|
||||
* Maximum number of levels of nesting permitted in Tcl commands (used to
|
||||
@@ -2413,22 +2436,21 @@ typedef enum TclEolTranslation {
|
||||
|
||||
/*
|
||||
* Flags for TclInvoke:
|
||||
*
|
||||
* TCL_INVOKE_HIDDEN Invoke a hidden command; if not set, invokes
|
||||
* an exposed command.
|
||||
* TCL_INVOKE_NO_UNKNOWN If set, "unknown" is not invoked if the
|
||||
* command to be invoked is not found. Only has
|
||||
* an effect if invoking an exposed command,
|
||||
* i.e. if TCL_INVOKE_HIDDEN is not also set.
|
||||
* TCL_INVOKE_NO_TRACEBACK Does not record traceback information if the
|
||||
* invoked command returns an error. Used if the
|
||||
* caller plans on recording its own traceback
|
||||
* information.
|
||||
*/
|
||||
|
||||
#define TCL_INVOKE_HIDDEN (1<<0)
|
||||
#define TCL_INVOKE_NO_UNKNOWN (1<<1)
|
||||
#define TCL_INVOKE_NO_TRACEBACK (1<<2)
|
||||
enum TclInvokeFlags {
|
||||
TCL_INVOKE_HIDDEN = 1, /* Invoke a hidden command; if not set,
|
||||
* invokes an exposed command. */
|
||||
TCL_INVOKE_NO_UNKNOWN = 2, /* If set, "unknown" is not invoked if the
|
||||
* command to be invoked is not found. Only
|
||||
* has an effect if invoking an exposed
|
||||
* command, i.e. if TCL_INVOKE_HIDDEN is not
|
||||
* also set. */
|
||||
TCL_INVOKE_NO_TRACEBACK = 4 /* Does not record traceback information if
|
||||
* the invoked command returns an error. Used
|
||||
* if the caller plans on recording its own
|
||||
* traceback information. */
|
||||
};
|
||||
|
||||
/*
|
||||
* The structure used as the internal representation of Tcl list objects. This
|
||||
@@ -2490,8 +2512,10 @@ typedef struct List {
|
||||
* TclNRLmapCmd and their compilations.
|
||||
*/
|
||||
|
||||
#define TCL_EACH_KEEP_NONE 0 /* Discard iteration result like [foreach] */
|
||||
#define TCL_EACH_COLLECT 1 /* Collect iteration result like [lmap] */
|
||||
enum ForeachFlags {
|
||||
TCL_EACH_KEEP_NONE = 0, /* Discard iteration result like [foreach] */
|
||||
TCL_EACH_COLLECT = 1 /* Collect iteration result like [lmap] */
|
||||
};
|
||||
|
||||
/*
|
||||
* Macros providing a faster path to booleans and integers:
|
||||
@@ -2550,27 +2574,24 @@ typedef struct List {
|
||||
|
||||
/*
|
||||
* Flag values for TclTraceDictPath().
|
||||
*
|
||||
* DICT_PATH_READ indicates that all entries on the path must exist but no
|
||||
* updates will be needed.
|
||||
*
|
||||
* DICT_PATH_UPDATE indicates that we are going to be doing an update at the
|
||||
* tip of the path, so duplication of shared objects should be done along the
|
||||
* way.
|
||||
*
|
||||
* DICT_PATH_EXISTS indicates that we are performing an existence test and a
|
||||
* lookup failure should therefore not be an error. If (and only if) this flag
|
||||
* is set, TclTraceDictPath() will return the special value
|
||||
* DICT_PATH_NON_EXISTENT if the path is not traceable.
|
||||
*
|
||||
* DICT_PATH_CREATE (which also requires the DICT_PATH_UPDATE bit to be set)
|
||||
* indicates that we are to create non-existent dictionaries on the path.
|
||||
*/
|
||||
|
||||
#define DICT_PATH_READ 0
|
||||
#define DICT_PATH_UPDATE 1
|
||||
#define DICT_PATH_EXISTS 2
|
||||
#define DICT_PATH_CREATE 5
|
||||
enum DictPathFlags {
|
||||
DICT_PATH_READ = 0, /* All entries on the path must exist but no
|
||||
* updates will be needed. */
|
||||
DICT_PATH_UPDATE = 1, /* We are going to be doing an update at the
|
||||
* tip of the path, so duplication of shared
|
||||
* objects should be done along the way. */
|
||||
DICT_PATH_EXISTS = 2, /* We are performing an existence test and a
|
||||
* lookup failure should therefore not be an
|
||||
* error. If (and only if) this flag is set,
|
||||
* TclTraceDictPath() will return the special
|
||||
* value DICT_PATH_NON_EXISTENT if the path is
|
||||
* not traceable. */
|
||||
DICT_PATH_CREATE = 5 /* We are to create non-existent dictionaries
|
||||
* on the path. (Also requires the
|
||||
* DICT_PATH_UPDATE bit to be set.) */
|
||||
};
|
||||
|
||||
#define DICT_PATH_NON_EXISTENT ((Tcl_Obj *) (void *) 1)
|
||||
|
||||
@@ -2623,10 +2644,12 @@ typedef struct TclFile_ *TclFile;
|
||||
* combination of the following values:
|
||||
*/
|
||||
|
||||
#define TCL_GLOBMODE_NO_COMPLAIN 1
|
||||
#define TCL_GLOBMODE_JOIN 2
|
||||
#define TCL_GLOBMODE_DIR 4
|
||||
#define TCL_GLOBMODE_TAILS 8
|
||||
enum GlobModeFlags {
|
||||
TCL_GLOBMODE_NO_COMPLAIN = 1,
|
||||
TCL_GLOBMODE_JOIN = 2,
|
||||
TCL_GLOBMODE_DIR = 4,
|
||||
TCL_GLOBMODE_TAILS = 8
|
||||
};
|
||||
|
||||
typedef enum Tcl_PathPart {
|
||||
TCL_PATH_DIRNAME,
|
||||
@@ -2695,24 +2718,22 @@ typedef struct ProcessGlobalValue {
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define TCL_PARSE_DECIMAL_ONLY 1
|
||||
/* Leading zero doesn't denote octal or
|
||||
enum TclParseNumberFlags {
|
||||
TCL_PARSE_DECIMAL_ONLY = 1, /* Leading zero doesn't denote octal or
|
||||
* hex. */
|
||||
#define TCL_PARSE_OCTAL_ONLY 2
|
||||
/* Parse octal even without prefix. */
|
||||
#define TCL_PARSE_HEXADECIMAL_ONLY 4
|
||||
TCL_PARSE_OCTAL_ONLY = 2, /* Parse octal even without prefix. */
|
||||
TCL_PARSE_HEXADECIMAL_ONLY = 4,
|
||||
/* Parse hexadecimal even without prefix. */
|
||||
#define TCL_PARSE_INTEGER_ONLY 8
|
||||
/* Disable floating point parsing. */
|
||||
#define TCL_PARSE_SCAN_PREFIXES 16
|
||||
TCL_PARSE_INTEGER_ONLY = 8, /* Disable floating point parsing. */
|
||||
TCL_PARSE_SCAN_PREFIXES = 16,
|
||||
/* Use [scan] rules dealing with 0?
|
||||
* prefixes. */
|
||||
#define TCL_PARSE_NO_WHITESPACE 32
|
||||
TCL_PARSE_NO_WHITESPACE = 32,
|
||||
/* Reject leading/trailing whitespace. */
|
||||
#define TCL_PARSE_BINARY_ONLY 64
|
||||
/* Parse binary even without prefix. */
|
||||
#define TCL_PARSE_NO_UNDERSCORE 128
|
||||
TCL_PARSE_BINARY_ONLY = 64, /* Parse binary even without prefix. */
|
||||
TCL_PARSE_NO_UNDERSCORE = 128
|
||||
/* Reject underscore digit separator */
|
||||
};
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
@@ -2720,14 +2741,16 @@ typedef struct ProcessGlobalValue {
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define TCL_NUMBER_INT 2
|
||||
enum TclNumberTypes {
|
||||
TCL_NUMBER_INT = 2,
|
||||
#if (TCL_MAJOR_VERSION < 9) && !defined(TCL_NO_DEPRECATED)
|
||||
# define TCL_NUMBER_LONG 1 /* deprecated, not used any more */
|
||||
# define TCL_NUMBER_WIDE TCL_NUMBER_INT /* deprecated */
|
||||
TCL_NUMBER_LONG = 1, /* deprecated, not used any more */
|
||||
TCL_NUMBER_WIDE = TCL_NUMBER_INT, /* deprecated */
|
||||
#endif
|
||||
#define TCL_NUMBER_BIG 3
|
||||
#define TCL_NUMBER_DOUBLE 4
|
||||
#define TCL_NUMBER_NAN 5
|
||||
TCL_NUMBER_BIG = 3,
|
||||
TCL_NUMBER_DOUBLE = 4,
|
||||
TCL_NUMBER_NAN = 5
|
||||
};
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------
|
||||
@@ -2739,7 +2762,6 @@ MODULE_SCOPE char *tclNativeExecutableName;
|
||||
MODULE_SCOPE int tclFindExecutableSearchDone;
|
||||
MODULE_SCOPE char *tclMemDumpFileName;
|
||||
MODULE_SCOPE TclPlatformType tclPlatform;
|
||||
MODULE_SCOPE Tcl_NotifierProcs tclNotifierHooks;
|
||||
|
||||
MODULE_SCOPE Tcl_Encoding tclIdentityEncoding;
|
||||
|
||||
@@ -2802,7 +2824,9 @@ MODULE_SCOPE size_t tclObjsShared[TCL_MAX_SHARED_OBJ_STATS];
|
||||
MODULE_SCOPE char tclEmptyString;
|
||||
|
||||
enum CheckEmptyStringResult {
|
||||
TCL_EMPTYSTRING_UNKNOWN = -1, TCL_EMPTYSTRING_NO, TCL_EMPTYSTRING_YES
|
||||
TCL_EMPTYSTRING_UNKNOWN = -1,
|
||||
TCL_EMPTYSTRING_NO,
|
||||
TCL_EMPTYSTRING_YES
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -2871,7 +2895,7 @@ typedef struct ForIterData {
|
||||
typedef void* TclFindSymbolProc(Tcl_Interp* interp, Tcl_LoadHandle loadHandle,
|
||||
const char* symbol);
|
||||
struct Tcl_LoadHandle_ {
|
||||
void *clientData; /* Client data is the load handle in the
|
||||
void *clientData; /* Client data is the load handle in the
|
||||
* native filesystem if a module was loaded
|
||||
* there, or an opaque pointer to a structure
|
||||
* for further bookkeeping on load-from-VFS
|
||||
@@ -2885,19 +2909,16 @@ struct Tcl_LoadHandle_ {
|
||||
|
||||
/* Flags for conversion of doubles to digit strings */
|
||||
|
||||
#define TCL_DD_E_FORMAT 0x2
|
||||
/* Use a fixed-length string of digits,
|
||||
enum DoubleFormatFlags {
|
||||
TCL_DD_E_FORMAT = 0x2, /* Use a fixed-length string of digits,
|
||||
* suitable for E format*/
|
||||
#define TCL_DD_F_FORMAT 0x3
|
||||
/* Use a fixed number of digits after the
|
||||
TCL_DD_F_FORMAT = 0x3, /* Use a fixed number of digits after the
|
||||
* decimal point, suitable for F format */
|
||||
#define TCL_DD_SHORTEST 0x4
|
||||
/* Use the shortest possible string */
|
||||
#define TCL_DD_NO_QUICK 0x8
|
||||
/* Debug flag: forbid quick FP conversion */
|
||||
|
||||
#define TCL_DD_CONVERSION_TYPE_MASK 0x3
|
||||
TCL_DD_SHORTEST = 0x4, /* Use the shortest possible string */
|
||||
TCL_DD_NO_QUICK = 0x8, /* Debug flag: forbid quick FP conversion */
|
||||
TCL_DD_CONVERSION_TYPE_MASK = 0x3
|
||||
/* Mask to isolate the conversion type */
|
||||
};
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------
|
||||
@@ -3044,7 +3065,7 @@ MODULE_SCOPE Tcl_Obj * TclGetSourceFromFrame(CmdFrame *cfPtr, int objc,
|
||||
Tcl_Obj *const objv[]);
|
||||
MODULE_SCOPE char * TclGetStringStorage(Tcl_Obj *objPtr,
|
||||
unsigned int *sizePtr);
|
||||
MODULE_SCOPE int TclGetLoadedPackagesEx(Tcl_Interp *interp,
|
||||
MODULE_SCOPE int TclGetLoadedLibraries(Tcl_Interp *interp,
|
||||
const char *targetName,
|
||||
const char *packageName);
|
||||
MODULE_SCOPE int TclGetWideBitsFromObj(Tcl_Interp *, Tcl_Obj *,
|
||||
@@ -3133,12 +3154,21 @@ MODULE_SCOPE int TclProcessReturn(Tcl_Interp *interp,
|
||||
int code, int level, Tcl_Obj *returnOpts);
|
||||
MODULE_SCOPE int TclpObjLstat(Tcl_Obj *pathPtr, Tcl_StatBuf *buf);
|
||||
MODULE_SCOPE Tcl_Obj * TclpTempFileName(void);
|
||||
MODULE_SCOPE Tcl_Obj * TclpTempFileNameForLibrary(Tcl_Interp *interp, Tcl_Obj* pathPtr);
|
||||
MODULE_SCOPE Tcl_Obj * TclpTempFileNameForLibrary(Tcl_Interp *interp,
|
||||
Tcl_Obj* pathPtr);
|
||||
MODULE_SCOPE Tcl_Obj * TclNewFSPathObj(Tcl_Obj *dirPtr, const char *addStrRep,
|
||||
int len);
|
||||
MODULE_SCOPE void TclpAlertNotifier(ClientData clientData);
|
||||
MODULE_SCOPE void TclpServiceModeHook(int mode);
|
||||
MODULE_SCOPE void TclpSetTimer(const Tcl_Time *timePtr);
|
||||
MODULE_SCOPE int TclpWaitForEvent(const Tcl_Time *timePtr);
|
||||
MODULE_SCOPE void TclpCreateFileHandler(int fd, int mask,
|
||||
Tcl_FileProc *proc, ClientData clientData);
|
||||
MODULE_SCOPE int TclpDeleteFile(const void *path);
|
||||
MODULE_SCOPE void TclpDeleteFileHandler(int fd);
|
||||
MODULE_SCOPE void TclpFinalizeCondition(Tcl_Condition *condPtr);
|
||||
MODULE_SCOPE void TclpFinalizeMutex(Tcl_Mutex *mutexPtr);
|
||||
MODULE_SCOPE void TclpFinalizeNotifier(ClientData clientData);
|
||||
MODULE_SCOPE void TclpFinalizePipes(void);
|
||||
MODULE_SCOPE void TclpFinalizeSockets(void);
|
||||
MODULE_SCOPE int TclCreateSocketAddress(Tcl_Interp *interp,
|
||||
@@ -3152,6 +3182,7 @@ MODULE_SCOPE int TclpFindVariable(const char *name, int *lengthPtr);
|
||||
MODULE_SCOPE void TclpInitLibraryPath(char **valuePtr,
|
||||
unsigned int *lengthPtr, Tcl_Encoding *encodingPtr);
|
||||
MODULE_SCOPE void TclpInitLock(void);
|
||||
MODULE_SCOPE ClientData TclpInitNotifier(void);
|
||||
MODULE_SCOPE void TclpInitPlatform(void);
|
||||
MODULE_SCOPE void TclpInitUnlock(void);
|
||||
MODULE_SCOPE Tcl_Obj * TclpObjListVolumes(void);
|
||||
@@ -3178,8 +3209,9 @@ MODULE_SCOPE int TclpObjChdir(Tcl_Obj *pathPtr);
|
||||
MODULE_SCOPE Tcl_Channel TclpOpenTemporaryFile(Tcl_Obj *dirObj,
|
||||
Tcl_Obj *basenameObj, Tcl_Obj *extensionObj,
|
||||
Tcl_Obj *resultingNameObj);
|
||||
MODULE_SCOPE void TclPkgFileSeen(Tcl_Interp *interp, const char *fileName);
|
||||
MODULE_SCOPE void *TclInitPkgFiles(Tcl_Interp *interp);
|
||||
MODULE_SCOPE void TclPkgFileSeen(Tcl_Interp *interp,
|
||||
const char *fileName);
|
||||
MODULE_SCOPE void * TclInitPkgFiles(Tcl_Interp *interp);
|
||||
MODULE_SCOPE Tcl_Obj * TclPathPart(Tcl_Interp *interp, Tcl_Obj *pathPtr,
|
||||
Tcl_PathPart portion);
|
||||
MODULE_SCOPE char * TclpReadlink(const char *fileName,
|
||||
@@ -3253,16 +3285,10 @@ MODULE_SCOPE int TclUtfCount(int ch);
|
||||
# define TclUtfToUCS4 Tcl_UtfToUniChar
|
||||
# define TclUniCharToUCS4(src, ptr) (*ptr = *(src),1)
|
||||
# define TclUCS4Prev(src, ptr) (((src) > (ptr)) ? ((src) - 1) : (src))
|
||||
# define TclUCS4Complete Tcl_UtfCharComplete
|
||||
# define TclChar16Complete(src, length) (((unsigned)((unsigned char)*(src) - 0xF0) < 5) \
|
||||
? ((length) >= 3) : Tcl_UtfCharComplete((src), (length)))
|
||||
#else
|
||||
MODULE_SCOPE int TclUtfToUCS4(const char *, int *);
|
||||
MODULE_SCOPE int TclUniCharToUCS4(const Tcl_UniChar *, int *);
|
||||
MODULE_SCOPE const Tcl_UniChar *TclUCS4Prev(const Tcl_UniChar *, const Tcl_UniChar *);
|
||||
# define TclUCS4Complete(src, length) (((unsigned)((unsigned char)*(src) - 0xF0) < 5) \
|
||||
? ((length) >= 4) : Tcl_UtfCharComplete((src), (length)))
|
||||
# define TclChar16Complete Tcl_UtfCharComplete
|
||||
#endif
|
||||
MODULE_SCOPE Tcl_Obj * TclpNativeToNormalized(ClientData clientData);
|
||||
MODULE_SCOPE Tcl_Obj * TclpFilesystemPathType(Tcl_Obj *pathPtr);
|
||||
@@ -3280,27 +3306,20 @@ 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 long long TclpGetWideClicks(void);
|
||||
MODULE_SCOPE double TclpWideClicksToNanoseconds(long long clicks);
|
||||
MODULE_SCOPE double TclpWideClickInMicrosec(void);
|
||||
#else
|
||||
# ifdef _WIN32
|
||||
# define TCL_WIDE_CLICKS 1
|
||||
MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void);
|
||||
MODULE_SCOPE long long TclpGetWideClicks(void);
|
||||
MODULE_SCOPE double TclpWideClickInMicrosec(void);
|
||||
# define TclpWideClicksToNanoseconds(clicks) \
|
||||
((double)(clicks) * TclpWideClickInMicrosec() * 1000)
|
||||
# endif
|
||||
#endif
|
||||
MODULE_SCOPE Tcl_WideInt TclpGetMicroseconds(void);
|
||||
MODULE_SCOPE long long TclpGetMicroseconds(void);
|
||||
|
||||
MODULE_SCOPE int TclZlibInit(Tcl_Interp *interp);
|
||||
MODULE_SCOPE void * TclpThreadCreateKey(void);
|
||||
@@ -4224,6 +4243,37 @@ MODULE_SCOPE int TclIndexDecode(int encoded, int endValue);
|
||||
#define TCL_INDEX_END (-2)
|
||||
#define TCL_INDEX_START (0)
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TclScaleTime --
|
||||
*
|
||||
* TIP #233 (Virtualized Time): Wrapper around the time virutalisation
|
||||
* rescale function to hide the binding of the clientData.
|
||||
*
|
||||
* This is static inline code; it's like a macro, but a function. It's
|
||||
* used because this is a piece of code that ends up in places that are a
|
||||
* bit performance sensitive.
|
||||
*
|
||||
* Results:
|
||||
* None
|
||||
*
|
||||
* Side effects:
|
||||
* Updates the time structure (given as an argument) with what the time
|
||||
* should be after virtualisation.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static inline void
|
||||
TclScaleTime(
|
||||
Tcl_Time *timePtr)
|
||||
{
|
||||
if (timePtr != NULL) {
|
||||
tclScaleTimeProcPtr(timePtr, tclTimeClientData);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------
|
||||
* Macros used by the Tcl core to create and release Tcl objects.
|
||||
@@ -4703,11 +4753,6 @@ MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[];
|
||||
(numChars) = _count; \
|
||||
} while (0);
|
||||
|
||||
#define TclUtfPrev(src, start) \
|
||||
(((src) < (start) + 2) ? (start) : \
|
||||
((unsigned char) *((src) - 1)) < 0x80 ? (src) - 1 : \
|
||||
Tcl_UtfPrev(src, start))
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------
|
||||
* Macro that encapsulates the logic that determines when it is safe to
|
||||
@@ -4744,7 +4789,7 @@ MODULE_SCOPE int TclIsPureByteArray(Tcl_Obj *objPtr);
|
||||
*----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#if defined(WORDS_BIGENDIAN) && (TCL_UTF_MAX > 3)
|
||||
# define TclUniCharNcmp(cs,ct,n) memcmp((cs),(ct),(n)*sizeof(Tcl_UniChar))
|
||||
#else /* !WORDS_BIGENDIAN */
|
||||
# define TclUniCharNcmp Tcl_UniCharNcmp
|
||||
@@ -4775,7 +4820,7 @@ MODULE_SCOPE int TclIsPureByteArray(Tcl_Obj *objPtr);
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
MODULE_SCOPE Tcl_PackageInitProc TclTommath_Init;
|
||||
MODULE_SCOPE Tcl_LibraryInitProc TclTommath_Init;
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
@@ -4787,11 +4832,11 @@ MODULE_SCOPE Tcl_PackageInitProc TclTommath_Init;
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
MODULE_SCOPE Tcl_PackageInitProc TclplatformtestInit;
|
||||
MODULE_SCOPE Tcl_PackageInitProc TclObjTest_Init;
|
||||
MODULE_SCOPE Tcl_PackageInitProc TclThread_Init;
|
||||
MODULE_SCOPE Tcl_PackageInitProc Procbodytest_Init;
|
||||
MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
|
||||
MODULE_SCOPE Tcl_LibraryInitProc TclplatformtestInit;
|
||||
MODULE_SCOPE Tcl_LibraryInitProc TclObjTest_Init;
|
||||
MODULE_SCOPE Tcl_LibraryInitProc TclThread_Init;
|
||||
MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_Init;
|
||||
MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------
|
||||
@@ -5162,6 +5207,35 @@ typedef struct NRE_callback {
|
||||
#define Tcl_Free(ptr) TclpFree(ptr)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Special hack for macOS, where the static linker (technically the 'ar'
|
||||
* command) hates empty object files, and accepts no flags to make it shut up.
|
||||
*
|
||||
* These symbols are otherwise completely useless.
|
||||
*
|
||||
* They can't be written to or written through. They can't be seen by any
|
||||
* other code. They use a separate attribute (supported by all macOS
|
||||
* compilers, which are derivatives of clang or gcc) to stop the compilation
|
||||
* from moaning. They will be excluded during the final linking stage.
|
||||
*
|
||||
* Other platforms get nothing at all. That's good.
|
||||
*/
|
||||
|
||||
#ifdef MAC_OSX_TCL
|
||||
#define TCL_MAC_EMPTY_FILE(name) \
|
||||
static __attribute__((used)) const void *const TclUnusedFile_ ## name; \
|
||||
static const void *const TclUnusedFile_ ## name = NULL;
|
||||
#else
|
||||
#define TCL_MAC_EMPTY_FILE(name)
|
||||
#endif /* MAC_OSX_TCL */
|
||||
|
||||
/*
|
||||
* Other externals.
|
||||
*/
|
||||
|
||||
MODULE_SCOPE size_t TclEnvEpoch; /* Epoch of the tcl environment
|
||||
* (if changed with tcl-env). */
|
||||
|
||||
#endif /* _TCLINT */
|
||||
|
||||
/*
|
||||
|
||||
+12
-11
@@ -618,7 +618,7 @@ EXTERN void TclResetRewriteEnsemble(Tcl_Interp *interp,
|
||||
/* 248 */
|
||||
EXTERN int TclCopyChannel(Tcl_Interp *interp,
|
||||
Tcl_Channel inChan, Tcl_Channel outChan,
|
||||
Tcl_WideInt toRead, Tcl_Obj *cmdPtr);
|
||||
long long toRead, Tcl_Obj *cmdPtr);
|
||||
/* 249 */
|
||||
EXTERN char * TclDoubleDigits(double dv, int ndigits, int flags,
|
||||
int *decpt, int *signum, char **endPtr);
|
||||
@@ -651,10 +651,10 @@ EXTERN int TclPtrUnsetVar(Tcl_Interp *interp, Tcl_Var varPtr,
|
||||
Tcl_Var arrayPtr, Tcl_Obj *part1Ptr,
|
||||
Tcl_Obj *part2Ptr, const int flags);
|
||||
/* 257 */
|
||||
EXTERN void TclStaticPackage(Tcl_Interp *interp,
|
||||
const char *pkgName,
|
||||
Tcl_PackageInitProc *initProc,
|
||||
Tcl_PackageInitProc *safeInitProc);
|
||||
EXTERN void TclStaticLibrary(Tcl_Interp *interp,
|
||||
const char *prefix,
|
||||
Tcl_LibraryInitProc *initProc,
|
||||
Tcl_LibraryInitProc *safeInitProc);
|
||||
/* 258 */
|
||||
EXTERN Tcl_Obj * TclpCreateTemporaryDirectory(Tcl_Obj *dirObj,
|
||||
Tcl_Obj *basenameObj);
|
||||
@@ -916,7 +916,7 @@ typedef struct TclIntStubs {
|
||||
Tcl_HashTable * (*tclGetNamespaceCommandTable) (Tcl_Namespace *nsPtr); /* 245 */
|
||||
int (*tclInitRewriteEnsemble) (Tcl_Interp *interp, int numRemoved, int numInserted, Tcl_Obj *const *objv); /* 246 */
|
||||
void (*tclResetRewriteEnsemble) (Tcl_Interp *interp, int isRootEnsemble); /* 247 */
|
||||
int (*tclCopyChannel) (Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, Tcl_WideInt toRead, Tcl_Obj *cmdPtr); /* 248 */
|
||||
int (*tclCopyChannel) (Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, long long toRead, Tcl_Obj *cmdPtr); /* 248 */
|
||||
char * (*tclDoubleDigits) (double dv, int ndigits, int flags, int *decpt, int *signum, char **endPtr); /* 249 */
|
||||
void (*tclSetChildCancelFlags) (Tcl_Interp *interp, int flags, int force); /* 250 */
|
||||
int (*tclRegisterLiteral) (void *envPtr, const char *bytes, int length, int flags); /* 251 */
|
||||
@@ -925,7 +925,7 @@ 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 (*tclStaticPackage) (Tcl_Interp *interp, const char *pkgName, Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc); /* 257 */
|
||||
void (*tclStaticLibrary) (Tcl_Interp *interp, const char *prefix, Tcl_LibraryInitProc *initProc, Tcl_LibraryInitProc *safeInitProc); /* 257 */
|
||||
Tcl_Obj * (*tclpCreateTemporaryDirectory) (Tcl_Obj *dirObj, Tcl_Obj *basenameObj); /* 258 */
|
||||
unsigned char * (*tclGetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *lengthPtr); /* 259 */
|
||||
void (*tclUnusedStubEntry) (void); /* 260 */
|
||||
@@ -1370,8 +1370,8 @@ extern const TclIntStubs *tclIntStubsPtr;
|
||||
(tclIntStubsPtr->tclPtrObjMakeUpvar) /* 255 */
|
||||
#define TclPtrUnsetVar \
|
||||
(tclIntStubsPtr->tclPtrUnsetVar) /* 256 */
|
||||
#define TclStaticPackage \
|
||||
(tclIntStubsPtr->tclStaticPackage) /* 257 */
|
||||
#define TclStaticLibrary \
|
||||
(tclIntStubsPtr->tclStaticLibrary) /* 257 */
|
||||
#define TclpCreateTemporaryDirectory \
|
||||
(tclIntStubsPtr->tclpCreateTemporaryDirectory) /* 258 */
|
||||
#define TclGetBytesFromObj \
|
||||
@@ -1409,11 +1409,12 @@ extern const TclIntStubs *tclIntStubsPtr;
|
||||
# undef TclGetCommandFullName
|
||||
# undef TclCopyChannelOld
|
||||
# undef TclSockMinimumBuffersOld
|
||||
# undef Tcl_StaticPackage
|
||||
# define Tcl_StaticPackage (tclIntStubsPtr->tclStaticPackage)
|
||||
# undef Tcl_StaticLibrary
|
||||
# define Tcl_StaticLibrary (tclIntStubsPtr->tclStaticLibrary)
|
||||
#endif
|
||||
|
||||
#undef TclGuessPackageName
|
||||
#undef TclUnusedStubEntry
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
# define TclGuessPackageName(fileName, pkgName) ((void)fileName,(void)pkgName,0)
|
||||
#endif
|
||||
|
||||
@@ -570,6 +570,11 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
|
||||
#undef TclpGmtime_unix
|
||||
#undef TclWinConvertWSAError
|
||||
#define TclWinConvertWSAError TclWinConvertError
|
||||
#if !defined(TCL_USE_STUBS) && !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
|
||||
# undef TclWinConvertError
|
||||
# define TclWinConvertError Tcl_WinConvertError
|
||||
#endif
|
||||
|
||||
#undef TclpInetNtoa
|
||||
#define TclpInetNtoa inet_ntoa
|
||||
|
||||
|
||||
+21
-22
@@ -196,18 +196,18 @@ struct LimitHandler {
|
||||
|
||||
/*
|
||||
* Values for the LimitHandler flags field.
|
||||
* LIMIT_HANDLER_ACTIVE - Whether the handler is currently being
|
||||
* processed; handlers are never to be entered reentrantly.
|
||||
* LIMIT_HANDLER_DELETED - Whether the handler has been deleted. This
|
||||
* should not normally be observed because when a handler is
|
||||
* deleted it is also spliced out of the list of handlers, but
|
||||
* even so we will be careful.
|
||||
*/
|
||||
|
||||
#define LIMIT_HANDLER_ACTIVE 0x01
|
||||
#define LIMIT_HANDLER_DELETED 0x02
|
||||
|
||||
|
||||
enum LimitHandlerFlags {
|
||||
LIMIT_HANDLER_ACTIVE = 0x01,/* Whether the handler is currently being
|
||||
* processed; handlers are never to be entered
|
||||
* reentrantly. */
|
||||
LIMIT_HANDLER_DELETED = 0x02/* Whether the handler has been deleted. This
|
||||
* should not normally be observed because
|
||||
* when a handler is deleted it is also
|
||||
* spliced out of the list of handlers, but
|
||||
* even so we will be careful. */
|
||||
};
|
||||
|
||||
/*
|
||||
* Prototypes for local static functions:
|
||||
@@ -276,7 +276,6 @@ static void TimeLimitCallback(ClientData clientData);
|
||||
static Tcl_NRPostProc NRPostInvokeHidden;
|
||||
static Tcl_ObjCmdProc NRInterpCmd;
|
||||
static Tcl_ObjCmdProc NRChildCmd;
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
@@ -4785,7 +4784,7 @@ ChildTimeLimitCmd(
|
||||
Tcl_Obj *milliObj = NULL, *secObj = NULL;
|
||||
int gran = 0;
|
||||
Tcl_Time limitMoment;
|
||||
int tmp;
|
||||
Tcl_WideInt tmp;
|
||||
|
||||
Tcl_LimitGetTime(childInterp, &limitMoment);
|
||||
for (i=consumedObjc ; i<objc ; i+=2) {
|
||||
@@ -4817,17 +4816,17 @@ ChildTimeLimitCmd(
|
||||
if (milliLen == 0) {
|
||||
break;
|
||||
}
|
||||
if (TclGetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
|
||||
if (TclGetWideIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (tmp < 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"milliseconds must be at least 0", -1));
|
||||
if (tmp < 0 || tmp > LONG_MAX) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"milliseconds must be between 0 and %ld", LONG_MAX));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
|
||||
"BADVALUE", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
limitMoment.usec = ((long) tmp)*1000;
|
||||
limitMoment.usec = ((long)tmp)*1000;
|
||||
break;
|
||||
case OPT_SEC:
|
||||
secObj = objv[i+1];
|
||||
@@ -4835,17 +4834,17 @@ ChildTimeLimitCmd(
|
||||
if (secLen == 0) {
|
||||
break;
|
||||
}
|
||||
if (TclGetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
|
||||
if (TclGetWideIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (tmp < 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"seconds must be at least 0", -1));
|
||||
if (tmp < 0 || tmp > LONG_MAX) {
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"seconds must be between 0 and %ld", LONG_MAX));
|
||||
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
|
||||
"BADVALUE", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
limitMoment.sec = tmp;
|
||||
limitMoment.sec = (long)tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+16
-18
@@ -75,21 +75,19 @@ typedef struct Link {
|
||||
|
||||
/*
|
||||
* Definitions for flag bits:
|
||||
* LINK_READ_ONLY - 1 means errors should be generated if Tcl
|
||||
* script attempts to write variable.
|
||||
* LINK_BEING_UPDATED - 1 means that a call to Tcl_UpdateLinkedVar is
|
||||
* in progress for this variable, so trace
|
||||
* callbacks on the variable should be ignored.
|
||||
* LINK_ALLOC_ADDR - 1 means linkPtr->addr was allocated on the
|
||||
* heap.
|
||||
* LINK_ALLOC_LAST - 1 means linkPtr->valueLast.p was allocated on
|
||||
* the heap.
|
||||
*/
|
||||
|
||||
#define LINK_READ_ONLY 1
|
||||
#define LINK_BEING_UPDATED 2
|
||||
#define LINK_ALLOC_ADDR 4
|
||||
#define LINK_ALLOC_LAST 8
|
||||
enum LinkFlags {
|
||||
LINK_READ_ONLY = 1, /* Errors should be generated if Tcl script
|
||||
* attempts to write variable. */
|
||||
LINK_BEING_UPDATED = 2, /* A call to Tcl_UpdateLinkedVar is in
|
||||
* progress for this variable, so trace
|
||||
* callbacks on the variable should be
|
||||
* ignored. */
|
||||
LINK_ALLOC_ADDR = 4, /* linkPtr->addr was allocated on the heap. */
|
||||
LINK_ALLOC_LAST = 8 /* linkPtr->valueLast.p was allocated on the
|
||||
* heap. */
|
||||
};
|
||||
|
||||
/*
|
||||
* Forward references to functions defined later in this file:
|
||||
@@ -110,11 +108,11 @@ static int SetInvalidRealFromAny(Tcl_Interp *interp,
|
||||
*/
|
||||
|
||||
static Tcl_ObjType invalidRealType = {
|
||||
"invalidReal", /* name */
|
||||
NULL, /* freeIntRepProc */
|
||||
NULL, /* dupIntRepProc */
|
||||
NULL, /* updateStringProc */
|
||||
NULL /* setFromAnyProc */
|
||||
"invalidReal", /* name */
|
||||
NULL, /* freeIntRepProc */
|
||||
NULL, /* dupIntRepProc */
|
||||
NULL, /* updateStringProc */
|
||||
NULL /* setFromAnyProc */
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
+301
-301
File diff suppressed because it is too large
Load Diff
@@ -64,11 +64,6 @@ NewNativeObj(
|
||||
* source directory to make their own modified versions).
|
||||
*/
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER < 1900
|
||||
/* isatty is always defined on MSVC 14.0, but not necessarily as CRTIMPORT. */
|
||||
extern CRTIMPORT int isatty(int fd);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The thread-local variables for this file's functions.
|
||||
*/
|
||||
|
||||
+293
-5
@@ -10,6 +10,7 @@
|
||||
* Copyright © 1995-1997 Sun Microsystems, Inc.
|
||||
* Copyright © 1998 Scriptics Corporation.
|
||||
* Copyright © 2003 Kevin B. Kenny. All rights reserved.
|
||||
* Copyright © 2021 Donal K. Fellows
|
||||
*
|
||||
* See the file "license.terms" for information on usage and redistribution of
|
||||
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
@@ -18,11 +19,11 @@
|
||||
#include "tclInt.h"
|
||||
|
||||
/*
|
||||
* Module-scope struct of notifier hooks that are checked in the default
|
||||
* Notifier hooks that are checked in the public wrappers for the default
|
||||
* notifier functions (for overriding via Tcl_SetNotifier).
|
||||
*/
|
||||
|
||||
Tcl_NotifierProcs tclNotifierHooks = {
|
||||
static Tcl_NotifierProcs tclNotifierHooks = {
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
@@ -174,7 +175,8 @@ TclFinalizeNotifier(void)
|
||||
Tcl_Event *evPtr, *hold;
|
||||
|
||||
if (!tsdPtr->initialized) {
|
||||
return; /* Notifier not initialized for the current thread */
|
||||
return; /* Notifier not initialized for the current
|
||||
* thread. */
|
||||
}
|
||||
|
||||
Tcl_MutexLock(&(tsdPtr->queueMutex));
|
||||
@@ -227,6 +229,38 @@ Tcl_SetNotifier(
|
||||
Tcl_NotifierProcs *notifierProcPtr)
|
||||
{
|
||||
tclNotifierHooks = *notifierProcPtr;
|
||||
|
||||
/*
|
||||
* Don't allow hooks to refer to the hook point functions; avoids infinite
|
||||
* loop.
|
||||
*/
|
||||
|
||||
if (tclNotifierHooks.setTimerProc == Tcl_SetTimer) {
|
||||
tclNotifierHooks.setTimerProc = NULL;
|
||||
}
|
||||
if (tclNotifierHooks.waitForEventProc == Tcl_WaitForEvent) {
|
||||
tclNotifierHooks.waitForEventProc = NULL;
|
||||
}
|
||||
if (tclNotifierHooks.initNotifierProc == Tcl_InitNotifier) {
|
||||
tclNotifierHooks.initNotifierProc = NULL;
|
||||
}
|
||||
if (tclNotifierHooks.finalizeNotifierProc == Tcl_FinalizeNotifier) {
|
||||
tclNotifierHooks.finalizeNotifierProc = NULL;
|
||||
}
|
||||
if (tclNotifierHooks.alertNotifierProc == Tcl_AlertNotifier) {
|
||||
tclNotifierHooks.alertNotifierProc = NULL;
|
||||
}
|
||||
if (tclNotifierHooks.serviceModeHookProc == Tcl_ServiceModeHook) {
|
||||
tclNotifierHooks.serviceModeHookProc = NULL;
|
||||
}
|
||||
#ifndef _WIN32
|
||||
if (tclNotifierHooks.createFileHandlerProc == Tcl_CreateFileHandler) {
|
||||
tclNotifierHooks.createFileHandlerProc = NULL;
|
||||
}
|
||||
if (tclNotifierHooks.deleteFileHandlerProc == Tcl_DeleteFileHandler) {
|
||||
tclNotifierHooks.deleteFileHandlerProc = NULL;
|
||||
}
|
||||
#endif /* !_WIN32 */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -276,7 +310,7 @@ Tcl_CreateEventSource(
|
||||
* checkProc. */
|
||||
{
|
||||
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
|
||||
EventSource *sourcePtr = (EventSource *)ckalloc(sizeof(EventSource));
|
||||
EventSource *sourcePtr = (EventSource *) ckalloc(sizeof(EventSource));
|
||||
|
||||
sourcePtr->setupProc = setupProc;
|
||||
sourcePtr->checkProc = checkProc;
|
||||
@@ -794,7 +828,7 @@ Tcl_SetServiceMode(
|
||||
|
||||
void
|
||||
Tcl_SetMaxBlockTime(
|
||||
const Tcl_Time *timePtr) /* Specifies a maximum elapsed time for the
|
||||
const Tcl_Time *timePtr) /* Specifies a maximum elapsed time for the
|
||||
* next blocking operation in the event
|
||||
* tsdPtr-> */
|
||||
{
|
||||
@@ -1132,6 +1166,260 @@ Tcl_ThreadAlert(
|
||||
Tcl_MutexUnlock(&listLock);
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_InitNotifier --
|
||||
*
|
||||
* Initializes the platform specific notifier state. Forwards to the
|
||||
* platform implementation when the hook is not enabled.
|
||||
*
|
||||
* Results:
|
||||
* Returns a handle to the notifier state for this thread..
|
||||
*
|
||||
* Side effects:
|
||||
* None.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
ClientData
|
||||
Tcl_InitNotifier(void)
|
||||
{
|
||||
if (tclNotifierHooks.initNotifierProc) {
|
||||
return tclNotifierHooks.initNotifierProc();
|
||||
} else {
|
||||
return TclpInitNotifier();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_FinalizeNotifier --
|
||||
*
|
||||
* This function is called to cleanup the notifier state before a thread
|
||||
* is terminated. Forwards to the platform implementation when the hook
|
||||
* is not enabled.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* If no finalizeNotifierProc notifier hook exists, TclpFinalizeNotifier
|
||||
* is called.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
Tcl_FinalizeNotifier(
|
||||
ClientData clientData)
|
||||
{
|
||||
if (tclNotifierHooks.finalizeNotifierProc) {
|
||||
tclNotifierHooks.finalizeNotifierProc(clientData);
|
||||
} else {
|
||||
TclpFinalizeNotifier(clientData);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_AlertNotifier --
|
||||
*
|
||||
* Wake up the specified notifier from any thread. This routine is called
|
||||
* by the platform independent notifier code whenever the Tcl_ThreadAlert
|
||||
* routine is called. This routine is guaranteed not to be called by Tcl
|
||||
* on a given notifier after Tcl_FinalizeNotifier is called for that
|
||||
* notifier. This routine is typically called from a thread other than
|
||||
* the notifier's thread. Forwards to the platform implementation when
|
||||
* the hook is not enabled.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* See the platform-specific implementations.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
Tcl_AlertNotifier(
|
||||
ClientData clientData) /* Pointer to thread data. */
|
||||
{
|
||||
if (tclNotifierHooks.alertNotifierProc) {
|
||||
tclNotifierHooks.alertNotifierProc(clientData);
|
||||
} else {
|
||||
TclpAlertNotifier(clientData);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_ServiceModeHook --
|
||||
*
|
||||
* This function is invoked whenever the service mode changes. Forwards
|
||||
* to the platform implementation when the hook is not enabled.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* See the platform-specific implementations.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
Tcl_ServiceModeHook(
|
||||
int mode) /* Either TCL_SERVICE_ALL, or
|
||||
* TCL_SERVICE_NONE. */
|
||||
{
|
||||
if (tclNotifierHooks.serviceModeHookProc) {
|
||||
tclNotifierHooks.serviceModeHookProc(mode);
|
||||
} else {
|
||||
TclpServiceModeHook(mode);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_SetTimer --
|
||||
*
|
||||
* This function sets the current notifier timer value. Forwards to the
|
||||
* platform implementation when the hook is not enabled.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* See the platform-specific implementations.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
Tcl_SetTimer(
|
||||
const Tcl_Time *timePtr) /* Timeout value, may be NULL. */
|
||||
{
|
||||
if (tclNotifierHooks.setTimerProc) {
|
||||
tclNotifierHooks.setTimerProc(timePtr);
|
||||
} else {
|
||||
TclpSetTimer(timePtr);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_WaitForEvent --
|
||||
*
|
||||
* This function is called by Tcl_DoOneEvent to wait for new events on
|
||||
* the notifier's message queue. If the block time is 0, then
|
||||
* Tcl_WaitForEvent just polls without blocking. Forwards to the
|
||||
* platform implementation when the hook is not enabled.
|
||||
*
|
||||
* Results:
|
||||
* Returns -1 if the wait would block forever, 1 if an out-of-loop source
|
||||
* was processed (see platform-specific notes) and otherwise returns 0.
|
||||
*
|
||||
* Side effects:
|
||||
* Queues file events that are detected by the notifier.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
Tcl_WaitForEvent(
|
||||
const Tcl_Time *timePtr) /* Maximum block time, or NULL. */
|
||||
{
|
||||
if (tclNotifierHooks.waitForEventProc) {
|
||||
return tclNotifierHooks.waitForEventProc(timePtr);
|
||||
} else {
|
||||
return TclpWaitForEvent(timePtr);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_CreateFileHandler --
|
||||
*
|
||||
* This function registers a file descriptor handler with the notifier.
|
||||
* Forwards to the platform implementation when the hook is not enabled.
|
||||
*
|
||||
* This function is not defined on Windows. The OS API there is too
|
||||
* different.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* Creates a new file handler structure.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef _WIN32
|
||||
void
|
||||
Tcl_CreateFileHandler(
|
||||
int fd, /* Handle of stream to watch. */
|
||||
int mask, /* OR'ed combination of TCL_READABLE,
|
||||
* TCL_WRITABLE, and TCL_EXCEPTION: indicates
|
||||
* conditions under which proc should be
|
||||
* called. */
|
||||
Tcl_FileProc *proc, /* Function to call for each selected
|
||||
* event. */
|
||||
ClientData clientData) /* Arbitrary data to pass to proc. */
|
||||
{
|
||||
if (tclNotifierHooks.createFileHandlerProc) {
|
||||
tclNotifierHooks.createFileHandlerProc(fd, mask, proc, clientData);
|
||||
} else {
|
||||
TclpCreateFileHandler(fd, mask, proc, clientData);
|
||||
}
|
||||
}
|
||||
#endif /* !_WIN32 */
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_DeleteFileHandler --
|
||||
*
|
||||
* Cancel a previously-arranged callback arrangement for a file
|
||||
* descriptor. Forwards to the platform implementation when the hook is
|
||||
* not enabled.
|
||||
*
|
||||
* This function is not defined on Windows. The OS API there is too
|
||||
* different.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* If a callback was previously registered on the file descriptor, remove
|
||||
* it.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef _WIN32
|
||||
void
|
||||
Tcl_DeleteFileHandler(
|
||||
int fd) /* Stream id for which to remove callback
|
||||
* function. */
|
||||
{
|
||||
if (tclNotifierHooks.deleteFileHandlerProc) {
|
||||
tclNotifierHooks.deleteFileHandlerProc(fd);
|
||||
} else {
|
||||
TclpDeleteFileHandler(fd);
|
||||
}
|
||||
}
|
||||
#endif /* !_WIN32 */
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: c
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
# library via the stubs table. This file is used to generate the
|
||||
# tclOODecls.h, tclOOIntDecls.h and tclOOStubInit.c files.
|
||||
#
|
||||
# Copyright (c) 2008-2013 by Donal K. Fellows.
|
||||
# Copyright © 2008-2013 Donal K. Fellows.
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution of
|
||||
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
|
||||
+5
-3
@@ -105,9 +105,11 @@ typedef struct {
|
||||
* Tcl_NewInstanceMethod.
|
||||
*/
|
||||
|
||||
#define TCL_OO_METHOD_PUBLIC 1
|
||||
#define TCL_OO_METHOD_UNEXPORTED 0
|
||||
#define TCL_OO_METHOD_PRIVATE 0x20
|
||||
enum TclOOVisibilityConstants {
|
||||
TCL_OO_METHOD_PUBLIC = 1,
|
||||
TCL_OO_METHOD_UNEXPORTED = 0,
|
||||
TCL_OO_METHOD_PRIVATE = 0x20
|
||||
};
|
||||
|
||||
/*
|
||||
* The type of some object (or class) metadata. This describes how to delete
|
||||
|
||||
+20
-16
@@ -51,13 +51,15 @@ typedef struct {
|
||||
* Extra flags used for call chain management.
|
||||
*/
|
||||
|
||||
#define DEFINITE_PROTECTED 0x100000
|
||||
#define DEFINITE_PUBLIC 0x200000
|
||||
#define KNOWN_STATE (DEFINITE_PROTECTED | DEFINITE_PUBLIC)
|
||||
#define SPECIAL (CONSTRUCTOR | DESTRUCTOR | FORCE_UNKNOWN)
|
||||
#define BUILDING_MIXINS 0x400000
|
||||
#define TRAVERSED_MIXIN 0x800000
|
||||
#define OBJECT_MIXIN 0x1000000
|
||||
enum CallChainFlags {
|
||||
DEFINITE_PROTECTED = 0x100000,
|
||||
DEFINITE_PUBLIC = 0x200000,
|
||||
BUILDING_MIXINS = 0x400000,
|
||||
TRAVERSED_MIXIN = 0x800000,
|
||||
OBJECT_MIXIN = 0x1000000,
|
||||
KNOWN_STATE = (DEFINITE_PROTECTED | DEFINITE_PUBLIC),
|
||||
SPECIAL = (CONSTRUCTOR | DESTRUCTOR | FORCE_UNKNOWN)
|
||||
};
|
||||
#define MIXIN_CONSISTENT(flags) \
|
||||
(((flags) & OBJECT_MIXIN) || \
|
||||
!((flags) & BUILDING_MIXINS) == !((flags) & TRAVERSED_MIXIN))
|
||||
@@ -152,7 +154,6 @@ static const Tcl_ObjType methodNameType = {
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------
|
||||
@@ -422,6 +423,14 @@ FinalizeMethodRefs(
|
||||
* ----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* Name the bits used in the names table values.
|
||||
*/
|
||||
enum NameTableFlags {
|
||||
IN_LIST = 1,
|
||||
NO_IMPLEMENTATION = 2
|
||||
};
|
||||
|
||||
int
|
||||
TclOOGetSortedMethodList(
|
||||
Object *oPtr, /* The object to get the method names for. */
|
||||
@@ -453,12 +462,6 @@ TclOOGetSortedMethodList(
|
||||
Tcl_InitObjHashTable(&names);
|
||||
Tcl_InitHashTable(&examinedClasses, TCL_ONE_WORD_KEYS);
|
||||
|
||||
/*
|
||||
* Name the bits used in the names table values.
|
||||
*/
|
||||
#define IN_LIST 1
|
||||
#define NO_IMPLEMENTATION 2
|
||||
|
||||
/*
|
||||
* Process method names due to the object.
|
||||
*/
|
||||
@@ -2027,8 +2030,9 @@ AddSimpleClassDefineNamespaces(
|
||||
|
||||
static inline void
|
||||
AddDefinitionNamespaceToChain(
|
||||
Class *const definerCls, /* What class defines this entry. */
|
||||
Tcl_Obj *const namespaceName, /* The name for this entry (or NULL, a
|
||||
Class *const definerCls, /* What class defines this entry. */
|
||||
Tcl_Obj *const namespaceName,
|
||||
/* The name for this entry (or NULL, a
|
||||
* no-op). */
|
||||
DefineChain *const definePtr,
|
||||
/* The define chain to add the method
|
||||
|
||||
+28
-21
@@ -112,7 +112,9 @@ typedef struct ProcedureMethod {
|
||||
* methods.
|
||||
*/
|
||||
|
||||
#define USE_DECLARER_NS 0x80
|
||||
enum ProcedureMethodFlags {
|
||||
USE_DECLARER_NS = 0x80,
|
||||
};
|
||||
|
||||
/*
|
||||
* Forwarded methods have the following extra information.
|
||||
@@ -213,36 +215,38 @@ typedef struct Object {
|
||||
* command. */
|
||||
} 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 ROOT_OBJECT 0x1000 /* Flag to say that this object is the root of
|
||||
enum ObjectFlags {
|
||||
OBJECT_DESTRUCTING = 1, /* Indicates that an object is being or has
|
||||
* been destroyed */
|
||||
DESTRUCTOR_CALLED = 2, /* Indicates that evaluation of destructor
|
||||
* script for the object has began */
|
||||
OO_UNUSED_4 = 4, /* No longer used. */
|
||||
ROOT_OBJECT = 0x1000, /* Flag to say that this object is the root of
|
||||
* the class hierarchy and should be treated
|
||||
* specially during teardown. */
|
||||
#define FILTER_HANDLING 0x2000 /* Flag set when the object is processing a
|
||||
FILTER_HANDLING = 0x2000, /* Flag set when the object is processing a
|
||||
* filter; when set, filters are *not*
|
||||
* processed on the object, preventing nasty
|
||||
* recursive filtering problems. */
|
||||
#define USE_CLASS_CACHE 0x4000 /* Flag set to say that the object is a pure
|
||||
USE_CLASS_CACHE = 0x4000, /* Flag set to say that the object is a pure
|
||||
* instance of the class, and has had nothing
|
||||
* added that changes the dispatch chain (i.e.
|
||||
* no methods, mixins, or filters. */
|
||||
#define ROOT_CLASS 0x8000 /* Flag to say that this object is the root
|
||||
ROOT_CLASS = 0x8000, /* Flag to say that this object is the root
|
||||
* class of classes, and should be treated
|
||||
* specially during teardown (and in a few
|
||||
* other spots). */
|
||||
#define FORCE_UNKNOWN 0x10000 /* States that we are *really* looking up the
|
||||
FORCE_UNKNOWN = 0x10000, /* States that we are *really* looking up the
|
||||
* unknown method handler at that point. */
|
||||
#define HAS_PRIVATE_METHODS 0x20000
|
||||
HAS_PRIVATE_METHODS = 0x20000,
|
||||
/* Object/class has (or had) private methods,
|
||||
* and so shouldn't be cached so
|
||||
* aggressively. */
|
||||
#define DONT_DELETE 0x40000 /* Inhibit deletion of this object. Used
|
||||
DONT_DELETE = 0x40000 /* Inhibit deletion of this object. Used
|
||||
* during fundamental object type mutation to
|
||||
* make sure that the object actually survives
|
||||
* to the end of the operation. */
|
||||
};
|
||||
|
||||
/*
|
||||
* And the definition of a class. Note that every class also has an associated
|
||||
@@ -418,17 +422,18 @@ typedef struct CallContext {
|
||||
* Bits for the 'flags' field of the call chain.
|
||||
*/
|
||||
|
||||
#define PUBLIC_METHOD 0x01 /* This is a public (exported) method. */
|
||||
#define PRIVATE_METHOD 0x02 /* This is a private (class's direct instances
|
||||
enum TclCallChainFlags {
|
||||
PUBLIC_METHOD = 0x01, /* This is a public (exported) method. */
|
||||
PRIVATE_METHOD = 0x02, /* This is a private (class's direct instances
|
||||
* only) method. Supports itcl. */
|
||||
#define OO_UNKNOWN_METHOD 0x04 /* This is an unknown method. */
|
||||
#define CONSTRUCTOR 0x08 /* This is a constructor. */
|
||||
#define DESTRUCTOR 0x10 /* This is a destructor. */
|
||||
#define TRUE_PRIVATE_METHOD 0x20
|
||||
/* This is a private method only accessible
|
||||
OO_UNKNOWN_METHOD = 0x04, /* This is an unknown method. */
|
||||
CONSTRUCTOR = 0x08, /* This is a constructor. */
|
||||
DESTRUCTOR = 0x10, /* This is a destructor. */
|
||||
TRUE_PRIVATE_METHOD = 0x20, /* This is a private method only accessible
|
||||
* from other methods defined on this class
|
||||
* or instance. [TIP #500] */
|
||||
#define SCOPE_FLAGS (PUBLIC_METHOD | PRIVATE_METHOD | TRUE_PRIVATE_METHOD)
|
||||
SCOPE_FLAGS = (PUBLIC_METHOD | PRIVATE_METHOD | TRUE_PRIVATE_METHOD)
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure containing definition information about basic class methods.
|
||||
@@ -666,7 +671,9 @@ MODULE_SCOPE void TclOOSetupVariableResolver(Tcl_Namespace *nsPtr);
|
||||
* but all arguments are used multiple times and so must have no side effects.
|
||||
*/
|
||||
|
||||
#ifdef DUPLICATE
|
||||
#undef DUPLICATE /* prevent possible conflict with definition in WINAPI nb30.h */
|
||||
#endif /* DUPLICATE */
|
||||
#define DUPLICATE(target,source,type) \
|
||||
do { \
|
||||
size_t len = sizeof(type) * ((target).num=(source).num);\
|
||||
|
||||
+2
-1
@@ -1617,6 +1617,7 @@ TclSetDuplicateObj(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#undef Tcl_GetString
|
||||
char *
|
||||
Tcl_GetString(
|
||||
Tcl_Obj *objPtr) /* Object whose string rep byte pointer should
|
||||
@@ -2731,7 +2732,7 @@ Tcl_SetIntObj(
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
int
|
||||
Tcl_GetIntFromObj(
|
||||
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
|
||||
|
||||
+1
-1
@@ -935,7 +935,7 @@ TclParseBackslash(
|
||||
* #217987] test subst-3.2
|
||||
*/
|
||||
|
||||
if (TclUCS4Complete(p, numBytes - 1)) {
|
||||
if (Tcl_UtfCharComplete(p, numBytes - 1)) {
|
||||
count = TclUtfToUCS4(p, &unichar) + 1; /* +1 for '\' */
|
||||
} else {
|
||||
char utfBytes[8];
|
||||
|
||||
+29
-11
@@ -1,17 +1,35 @@
|
||||
/*
|
||||
* Minimal set of shared macro definitions and declarations so that multiple
|
||||
* source files can make use of the parsing table in tclParse.c
|
||||
* tclParse.h --
|
||||
*
|
||||
* This file contains the minimal set of shared macro definitions and
|
||||
* declarations so that multiple source files can make use of the parsing
|
||||
* table in tclParse.c.
|
||||
*
|
||||
* Copyright (c) 2012 by Don Porter
|
||||
*
|
||||
* See the file "license.terms" for information on usage and redistribution of
|
||||
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*/
|
||||
|
||||
#define TYPE_NORMAL 0
|
||||
#define TYPE_SPACE 0x1
|
||||
#define TYPE_COMMAND_END 0x2
|
||||
#define TYPE_SUBS 0x4
|
||||
#define TYPE_QUOTE 0x8
|
||||
#define TYPE_CLOSE_PAREN 0x10
|
||||
#define TYPE_CLOSE_BRACK 0x20
|
||||
#define TYPE_BRACE 0x40
|
||||
enum ParseTypes {
|
||||
TYPE_NORMAL = 0,
|
||||
TYPE_SPACE = 0x1,
|
||||
TYPE_COMMAND_END = 0x2,
|
||||
TYPE_SUBS = 0x4,
|
||||
TYPE_QUOTE = 0x8,
|
||||
TYPE_CLOSE_PAREN = 0x10,
|
||||
TYPE_CLOSE_BRACK = 0x20,
|
||||
TYPE_BRACE = 0x40
|
||||
};
|
||||
|
||||
#define CHAR_TYPE(c) tclCharTypeTable[(unsigned char)(c)]
|
||||
#define CHAR_TYPE(c) tclCharTypeTable[(unsigned char)(c)]
|
||||
|
||||
MODULE_SCOPE const char tclCharTypeTable[];
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: c
|
||||
* c-basic-offset: 4
|
||||
* fill-column: 78
|
||||
* End:
|
||||
*/
|
||||
|
||||
+14
-10
@@ -77,23 +77,27 @@ typedef struct FsPath {
|
||||
* Flag values for FsPath->flags.
|
||||
*/
|
||||
|
||||
#define TCLPATH_APPENDED 1
|
||||
#define TCLPATH_NEEDNORM 4
|
||||
enum FsPathFlags {
|
||||
TCLPATH_APPENDED = 1,
|
||||
TCLPATH_NEEDNORM = 4
|
||||
};
|
||||
|
||||
/*
|
||||
* Define some macros to give us convenient access to path-object specific
|
||||
* fields.
|
||||
*/
|
||||
|
||||
#define PATHOBJ(pathPtr) ((FsPath *) (TclFetchIntRep((pathPtr), &fsPathType)->twoPtrValue.ptr1))
|
||||
#define PATHOBJ(pathPtr) \
|
||||
((FsPath *) (TclFetchIntRep((pathPtr), &fsPathType)->twoPtrValue.ptr1))
|
||||
#define SETPATHOBJ(pathPtr,fsPathPtr) \
|
||||
do { \
|
||||
Tcl_ObjIntRep ir; \
|
||||
ir.twoPtrValue.ptr1 = (void *) (fsPathPtr); \
|
||||
ir.twoPtrValue.ptr2 = NULL; \
|
||||
Tcl_StoreIntRep((pathPtr), &fsPathType, &ir); \
|
||||
} while (0)
|
||||
#define PATHFLAGS(pathPtr) (PATHOBJ(pathPtr)->flags)
|
||||
do { \
|
||||
Tcl_ObjIntRep ir; \
|
||||
ir.twoPtrValue.ptr1 = (void *) (fsPathPtr); \
|
||||
ir.twoPtrValue.ptr2 = NULL; \
|
||||
Tcl_StoreIntRep((pathPtr), &fsPathType, &ir); \
|
||||
} while (0)
|
||||
#define PATHFLAGS(pathPtr) \
|
||||
(PATHOBJ(pathPtr)->flags)
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* tclPkgConfig.c --
|
||||
*
|
||||
* This file contains the configuration information to embed into the tcl
|
||||
* binary library.
|
||||
* library.
|
||||
*
|
||||
* Copyright © 2002 Andreas Kupries <andreas_kupries@users.sourceforge.net>
|
||||
*
|
||||
@@ -109,8 +109,9 @@ static Tcl_Config const cfg[] = {
|
||||
{"scriptdir,runtime", CFG_RUNTIME_SCRDIR},
|
||||
{"includedir,runtime", CFG_RUNTIME_INCDIR},
|
||||
{"docdir,runtime", CFG_RUNTIME_DOCDIR},
|
||||
#if !defined(STATIC_BUILD)
|
||||
{"dllfile,runtime", CFG_RUNTIME_DLLFILE},
|
||||
{"zipfile,runtime", CFG_RUNTIME_ZIPFILE},
|
||||
#endif
|
||||
|
||||
/* Installation paths to various stuff */
|
||||
|
||||
|
||||
@@ -40,6 +40,14 @@
|
||||
# define _TCHAR_DEFINED
|
||||
#endif
|
||||
|
||||
#ifndef MODULE_SCOPE
|
||||
# ifdef __cplusplus
|
||||
# define MODULE_SCOPE extern "C"
|
||||
# else
|
||||
# define MODULE_SCOPE extern
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* !BEGIN!: Do not edit below this line. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -57,6 +65,9 @@ EXTERN TCHAR * Tcl_WinUtfToTChar(const char *str, int len,
|
||||
/* 1 */
|
||||
EXTERN char * Tcl_WinTCharToUtf(const TCHAR *str, int len,
|
||||
Tcl_DString *dsPtr);
|
||||
/* Slot 2 is reserved */
|
||||
/* 3 */
|
||||
EXTERN void Tcl_WinConvertError(unsigned errCode);
|
||||
#endif /* WIN */
|
||||
#ifdef MAC_OSX_TCL /* MACOSX */
|
||||
/* 0 */
|
||||
@@ -69,6 +80,9 @@ EXTERN int Tcl_MacOSXOpenVersionedBundleResources(
|
||||
const char *bundleVersion,
|
||||
int hasResourceFile, int maxPathLen,
|
||||
char *libraryPath);
|
||||
/* 2 */
|
||||
EXTERN void Tcl_MacOSXNotifierAddRunLoopMode(
|
||||
const void *runLoopMode);
|
||||
#endif /* MACOSX */
|
||||
|
||||
typedef struct TclPlatStubs {
|
||||
@@ -78,10 +92,13 @@ typedef struct TclPlatStubs {
|
||||
#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
|
||||
TCHAR * (*tcl_WinUtfToTChar) (const char *str, int len, Tcl_DString *dsPtr); /* 0 */
|
||||
char * (*tcl_WinTCharToUtf) (const TCHAR *str, int len, Tcl_DString *dsPtr); /* 1 */
|
||||
void (*reserved2)(void);
|
||||
void (*tcl_WinConvertError) (unsigned errCode); /* 3 */
|
||||
#endif /* WIN */
|
||||
#ifdef MAC_OSX_TCL /* MACOSX */
|
||||
int (*tcl_MacOSXOpenBundleResources) (Tcl_Interp *interp, const char *bundleName, int hasResourceFile, int maxPathLen, char *libraryPath); /* 0 */
|
||||
int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, const char *bundleName, const char *bundleVersion, int hasResourceFile, int maxPathLen, char *libraryPath); /* 1 */
|
||||
void (*tcl_MacOSXNotifierAddRunLoopMode) (const void *runLoopMode); /* 2 */
|
||||
#endif /* MACOSX */
|
||||
} TclPlatStubs;
|
||||
|
||||
@@ -102,12 +119,17 @@ extern const TclPlatStubs *tclPlatStubsPtr;
|
||||
(tclPlatStubsPtr->tcl_WinUtfToTChar) /* 0 */
|
||||
#define Tcl_WinTCharToUtf \
|
||||
(tclPlatStubsPtr->tcl_WinTCharToUtf) /* 1 */
|
||||
/* Slot 2 is reserved */
|
||||
#define Tcl_WinConvertError \
|
||||
(tclPlatStubsPtr->tcl_WinConvertError) /* 3 */
|
||||
#endif /* WIN */
|
||||
#ifdef MAC_OSX_TCL /* MACOSX */
|
||||
#define Tcl_MacOSXOpenBundleResources \
|
||||
(tclPlatStubsPtr->tcl_MacOSXOpenBundleResources) /* 0 */
|
||||
#define Tcl_MacOSXOpenVersionedBundleResources \
|
||||
(tclPlatStubsPtr->tcl_MacOSXOpenVersionedBundleResources) /* 1 */
|
||||
#define Tcl_MacOSXNotifierAddRunLoopMode \
|
||||
(tclPlatStubsPtr->tcl_MacOSXNotifierAddRunLoopMode) /* 2 */
|
||||
#endif /* MACOSX */
|
||||
|
||||
#endif /* defined(USE_TCL_STUBS) */
|
||||
|
||||
+6
-1
@@ -464,6 +464,7 @@ Tcl_SetResult(
|
||||
|
||||
ResetObjResult(iPtr);
|
||||
}
|
||||
#endif /* !TCL_NO_DEPRECATED */
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
@@ -482,10 +483,12 @@ Tcl_SetResult(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#undef Tcl_GetStringResult
|
||||
const char *
|
||||
Tcl_GetStringResult(
|
||||
Tcl_Interp *interp)/* Interpreter whose result to return. */
|
||||
{
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
/*
|
||||
* If the string result is empty, move the object result to the string
|
||||
@@ -497,8 +500,10 @@ Tcl_GetStringResult(
|
||||
TCL_VOLATILE);
|
||||
}
|
||||
return iPtr->result;
|
||||
#else
|
||||
return TclGetString(Tcl_GetObjResult(interp));
|
||||
#endif
|
||||
}
|
||||
#endif /* !TCL_NO_DEPRECATED */
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
|
||||
+8
-7
@@ -16,13 +16,14 @@
|
||||
* Flag values used by Tcl_ScanObjCmd.
|
||||
*/
|
||||
|
||||
#define SCAN_NOSKIP 0x1 /* Don't skip blanks. */
|
||||
#define SCAN_SUPPRESS 0x2 /* Suppress assignment. */
|
||||
#define SCAN_UNSIGNED 0x4 /* Read an unsigned value. */
|
||||
#define SCAN_WIDTH 0x8 /* A width value was supplied. */
|
||||
|
||||
#define SCAN_LONGER 0x400 /* Asked for a wide value. */
|
||||
#define SCAN_BIG 0x800 /* Asked for a bignum value. */
|
||||
enum ScanFlags {
|
||||
SCAN_NOSKIP = 0x1, /* Don't skip blanks. */
|
||||
SCAN_SUPPRESS = 0x2, /* Suppress assignment. */
|
||||
SCAN_UNSIGNED = 0x4, /* Read an unsigned value. */
|
||||
SCAN_WIDTH = 0x8, /* A width value was supplied. */
|
||||
SCAN_LONGER = 0x400, /* Asked for a wide value. */
|
||||
SCAN_BIG = 0x800 /* Asked for a bignum value. */
|
||||
};
|
||||
|
||||
/*
|
||||
* The following structure contains the information associated with a
|
||||
|
||||
+26
-19
@@ -22,6 +22,11 @@
|
||||
#define copysign _copysign
|
||||
#endif
|
||||
|
||||
#ifndef PRIx64
|
||||
# define PRIx64 TCL_LL_MODIFIER "x"
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* This code supports (at least hypothetically), IBM, Cray, VAX and IEEE-754
|
||||
* floating point; of these, only IEEE-754 can represent NaN. IEEE-754 can be
|
||||
@@ -538,7 +543,7 @@ TclParseNumber(
|
||||
int under = 0; /* Flag trailing '_' as error if true once
|
||||
* number is accepted. */
|
||||
|
||||
#define ALL_BITS ((Tcl_WideUInt)-1)
|
||||
#define ALL_BITS UWIDE_MAX
|
||||
#define MOST_BITS (ALL_BITS >> 1)
|
||||
|
||||
/*
|
||||
@@ -725,7 +730,7 @@ TclParseNumber(
|
||||
&& (((size_t)shift >=
|
||||
CHAR_BIT*sizeof(Tcl_WideUInt))
|
||||
|| (octalSignificandWide >
|
||||
((Tcl_WideUInt)-1 >> shift)))) {
|
||||
(UWIDE_MAX >> shift)))) {
|
||||
octalSignificandOverflow = 1;
|
||||
err = mp_init_u64(&octalSignificandBig,
|
||||
octalSignificandWide);
|
||||
@@ -865,7 +870,7 @@ TclParseNumber(
|
||||
|
||||
if (significandWide != 0 &&
|
||||
((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) ||
|
||||
significandWide > ((Tcl_WideUInt)-1 >> shift))) {
|
||||
significandWide > (UWIDE_MAX >> shift))) {
|
||||
significandOverflow = 1;
|
||||
err = mp_init_u64(&significandBig,
|
||||
significandWide);
|
||||
@@ -899,12 +904,14 @@ TclParseNumber(
|
||||
under = 0;
|
||||
state = BINARY;
|
||||
break;
|
||||
} else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
|
||||
/* Ignore numeric "white space" */
|
||||
under = 1;
|
||||
break;
|
||||
} else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
|
||||
/* Ignore numeric "white space" */
|
||||
under = 1;
|
||||
break;
|
||||
} else if (c != '1') {
|
||||
goto endgame;
|
||||
} else {
|
||||
under = 0;
|
||||
}
|
||||
if (objPtr != NULL) {
|
||||
shift = numTrailZeros + 1;
|
||||
@@ -917,7 +924,7 @@ TclParseNumber(
|
||||
|
||||
if (significandWide != 0 &&
|
||||
((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) ||
|
||||
significandWide > ((Tcl_WideUInt)-1 >> shift))) {
|
||||
significandWide > (UWIDE_MAX >> shift))) {
|
||||
significandOverflow = 1;
|
||||
err = mp_init_u64(&significandBig,
|
||||
significandWide);
|
||||
@@ -944,11 +951,11 @@ TclParseNumber(
|
||||
under = 0;
|
||||
numTrailZeros++;
|
||||
} else if ( ! isdigit(UCHAR(c))) {
|
||||
if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
|
||||
/* Ignore numeric "white space" */
|
||||
under = 1;
|
||||
break;
|
||||
}
|
||||
if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
|
||||
/* Ignore numeric "white space" */
|
||||
under = 1;
|
||||
break;
|
||||
}
|
||||
goto endgame;
|
||||
}
|
||||
under = 0;
|
||||
@@ -1597,7 +1604,7 @@ AccumulateDecimalDigit(
|
||||
*wideRepPtr = digit;
|
||||
return 0;
|
||||
} else if (numZeros >= maxpow10_wide
|
||||
|| w > ((Tcl_WideUInt)-1-digit)/pow10_wide[numZeros+1]) {
|
||||
|| w > (UWIDE_MAX-digit)/pow10_wide[numZeros+1]) {
|
||||
/*
|
||||
* Wide multiplication will overflow. Expand the number to a
|
||||
* bignum and fall through into the bignum case.
|
||||
@@ -5251,23 +5258,23 @@ TclFormatNaN(
|
||||
#else
|
||||
union {
|
||||
double dv;
|
||||
Tcl_WideUInt iv;
|
||||
uint64_t iv;
|
||||
} bitwhack;
|
||||
|
||||
bitwhack.dv = value;
|
||||
if (n770_fp) {
|
||||
bitwhack.iv = Nokia770Twiddle(bitwhack.iv);
|
||||
}
|
||||
if (bitwhack.iv & ((Tcl_WideUInt) 1 << 63)) {
|
||||
bitwhack.iv &= ~ ((Tcl_WideUInt) 1 << 63);
|
||||
if (bitwhack.iv & (UINT64_C(1) << 63)) {
|
||||
bitwhack.iv &= ~ (UINT64_C(1) << 63);
|
||||
*buffer++ = '-';
|
||||
}
|
||||
*buffer++ = 'N';
|
||||
*buffer++ = 'a';
|
||||
*buffer++ = 'N';
|
||||
bitwhack.iv &= (((Tcl_WideUInt) 1) << 51) - 1;
|
||||
bitwhack.iv &= ((UINT64_C(1)) << 51) - 1;
|
||||
if (bitwhack.iv != 0) {
|
||||
sprintf(buffer, "(%" TCL_LL_MODIFIER "x)", bitwhack.iv);
|
||||
sprintf(buffer, "(%" PRIx64 ")", bitwhack.iv);
|
||||
} else {
|
||||
*buffer = '\0';
|
||||
}
|
||||
|
||||
+82
-16
@@ -70,6 +70,11 @@ static void SetUnicodeObj(Tcl_Obj *objPtr,
|
||||
static int UnicodeLength(const Tcl_UniChar *unicode);
|
||||
static void UpdateStringOfString(Tcl_Obj *objPtr);
|
||||
|
||||
#define ISCONTINUATION(bytes) (\
|
||||
((((bytes)[0] & 0xC0) == 0x80) || (((bytes)[0] == '\xED') \
|
||||
&& (((bytes)[1] & 0xF0) == 0xB0) && (((bytes)[2] & 0xC0) == 0x80))))
|
||||
|
||||
|
||||
/*
|
||||
* The structure below defines the string Tcl object type by means of
|
||||
* functions that can be invoked by generic object code.
|
||||
@@ -1199,10 +1204,10 @@ Tcl_AppendLimitedToObj(
|
||||
}
|
||||
eLen = strlen(ellipsis);
|
||||
while (eLen > limit) {
|
||||
eLen = TclUtfPrev(ellipsis+eLen, ellipsis) - ellipsis;
|
||||
eLen = Tcl_UtfPrev(ellipsis+eLen, ellipsis) - ellipsis;
|
||||
}
|
||||
|
||||
toCopy = TclUtfPrev(bytes+limit+1-eLen, bytes) - bytes;
|
||||
toCopy = Tcl_UtfPrev(bytes+limit+1-eLen, bytes) - bytes;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1218,6 +1223,11 @@ Tcl_AppendLimitedToObj(
|
||||
SetStringFromAny(NULL, objPtr);
|
||||
stringPtr = GET_STRING(objPtr);
|
||||
|
||||
/* If appended string starts with a continuation byte or a lower surrogate,
|
||||
* force objPtr to unicode representation. See [7f1162a867] */
|
||||
if (bytes && ISCONTINUATION(bytes)) {
|
||||
Tcl_GetUnicode(objPtr);
|
||||
}
|
||||
if (stringPtr->hasUnicode && stringPtr->numChars > 0) {
|
||||
AppendUtfToUnicodeRep(objPtr, bytes, toCopy);
|
||||
} else {
|
||||
@@ -1415,6 +1425,12 @@ Tcl_AppendObjToObj(
|
||||
SetStringFromAny(NULL, objPtr);
|
||||
stringPtr = GET_STRING(objPtr);
|
||||
|
||||
/* If appended string starts with a continuation byte or a lower surrogate,
|
||||
* force objPtr to unicode representation. See [7f1162a867]
|
||||
* This fixes append-3.4, append-3.7 and utf-1.18 testcases. */
|
||||
if (ISCONTINUATION(TclGetString(appendObjPtr))) {
|
||||
Tcl_GetUnicode(objPtr);
|
||||
}
|
||||
/*
|
||||
* If objPtr has a valid Unicode rep, then get a Unicode string from
|
||||
* appendObjPtr and append it.
|
||||
@@ -2644,7 +2660,7 @@ AppendPrintfToObjVA(
|
||||
* multi-byte characters.
|
||||
*/
|
||||
|
||||
q = TclUtfPrev(end, bytes);
|
||||
q = Tcl_UtfPrev(end, bytes);
|
||||
if (!Tcl_UtfCharComplete(q, (int)(end - q))) {
|
||||
end = q;
|
||||
}
|
||||
@@ -3032,7 +3048,7 @@ TclStringCat(
|
||||
{
|
||||
Tcl_Obj *objResultPtr, * const *ov;
|
||||
int oc, length = 0, binary = 1;
|
||||
int allowUniChar = 1, requestUniChar = 0;
|
||||
int allowUniChar = 1, requestUniChar = 0, forceUniChar = 0;
|
||||
int first = objc - 1; /* Index of first value possibly not empty */
|
||||
int last = 0; /* Index of last value possibly not empty */
|
||||
int inPlace = flags & TCL_STRING_IN_PLACE;
|
||||
@@ -3068,7 +3084,9 @@ TclStringCat(
|
||||
*/
|
||||
|
||||
binary = 0;
|
||||
if ((objPtr->typePtr) && (objPtr->typePtr != &tclStringType)) {
|
||||
if (ov > objv+1 && ISCONTINUATION(TclGetString(objPtr))) {
|
||||
forceUniChar = 1;
|
||||
} else if ((objPtr->typePtr) && (objPtr->typePtr != &tclStringType)) {
|
||||
/* Prevent shimmer of non-string types. */
|
||||
allowUniChar = 0;
|
||||
}
|
||||
@@ -3117,7 +3135,7 @@ TclStringCat(
|
||||
}
|
||||
}
|
||||
} while (--oc);
|
||||
} else if (allowUniChar && requestUniChar) {
|
||||
} else if ((allowUniChar && requestUniChar) || forceUniChar) {
|
||||
/*
|
||||
* Result will be pure Tcl_UniChar array. Pre-size it.
|
||||
*/
|
||||
@@ -3270,7 +3288,7 @@ TclStringCat(
|
||||
dst += more;
|
||||
}
|
||||
}
|
||||
} else if (allowUniChar && requestUniChar) {
|
||||
} else if ((allowUniChar && requestUniChar) || forceUniChar) {
|
||||
/* Efficiently produce a pure Tcl_UniChar array result */
|
||||
Tcl_UniChar *dst;
|
||||
|
||||
@@ -3456,7 +3474,7 @@ TclStringCmp(
|
||||
s1 = (char *) Tcl_GetUnicode(value1Ptr);
|
||||
s2 = (char *) Tcl_GetUnicode(value2Ptr);
|
||||
if (
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#if defined(WORDS_BIGENDIAN) && (TCL_UTF_MAX > 3)
|
||||
1
|
||||
#else
|
||||
checkEq
|
||||
@@ -3809,6 +3827,9 @@ TclStringReverse(
|
||||
String *stringPtr;
|
||||
Tcl_UniChar ch = 0;
|
||||
int inPlace = flags & TCL_STRING_IN_PLACE;
|
||||
#if TCL_UTF_MAX < 4
|
||||
int needFlip = 0;
|
||||
#endif
|
||||
|
||||
if (TclIsPureByteArray(objPtr)) {
|
||||
int numBytes;
|
||||
@@ -3827,10 +3848,9 @@ TclStringReverse(
|
||||
if (stringPtr->hasUnicode) {
|
||||
Tcl_UniChar *from = Tcl_GetUnicode(objPtr);
|
||||
Tcl_UniChar *src = from + stringPtr->numChars;
|
||||
Tcl_UniChar *to;
|
||||
|
||||
if (!inPlace || Tcl_IsShared(objPtr)) {
|
||||
Tcl_UniChar *to;
|
||||
|
||||
/*
|
||||
* Create a non-empty, pure unicode value, so we can coax
|
||||
* Tcl_SetObjLength into growing the unicode rep buffer.
|
||||
@@ -3840,19 +3860,54 @@ TclStringReverse(
|
||||
Tcl_SetObjLength(objPtr, stringPtr->numChars);
|
||||
to = Tcl_GetUnicode(objPtr);
|
||||
while (--src >= from) {
|
||||
#if TCL_UTF_MAX < 4
|
||||
ch = *src;
|
||||
if ((ch & 0xF800) == 0xD800) {
|
||||
needFlip = 1;
|
||||
}
|
||||
*to++ = ch;
|
||||
#else
|
||||
*to++ = *src;
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Reversing in place.
|
||||
*/
|
||||
|
||||
#if TCL_UTF_MAX < 4
|
||||
to = src;
|
||||
#endif
|
||||
while (--src > from) {
|
||||
ch = *src;
|
||||
#if TCL_UTF_MAX < 4
|
||||
if ((ch & 0xF800) == 0xD800) {
|
||||
needFlip = 1;
|
||||
}
|
||||
#endif
|
||||
*src = *from;
|
||||
*from++ = ch;
|
||||
}
|
||||
}
|
||||
#if TCL_UTF_MAX < 4
|
||||
if (needFlip) {
|
||||
/*
|
||||
* Flip back surrogate pairs.
|
||||
*/
|
||||
|
||||
from = to - stringPtr->numChars;
|
||||
while (--to >= from) {
|
||||
ch = *to;
|
||||
if ((ch & 0xFC00) == 0xD800) {
|
||||
if ((to-1 >= from) && ((to[-1] & 0xFC00) == 0xDC00)) {
|
||||
to[0] = to[-1];
|
||||
to[-1] = ch;
|
||||
--to;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (objPtr->bytes) {
|
||||
@@ -3876,8 +3931,8 @@ TclStringReverse(
|
||||
* Pass 1. Reverse the bytes of each multi-byte character.
|
||||
*/
|
||||
|
||||
int charCount = 0;
|
||||
int bytesLeft = numBytes;
|
||||
int chw;
|
||||
|
||||
while (bytesLeft) {
|
||||
/*
|
||||
@@ -3886,18 +3941,16 @@ TclStringReverse(
|
||||
* skip calling Tcl_UtfCharComplete() here.
|
||||
*/
|
||||
|
||||
int bytesInChar = TclUtfToUniChar(from, &ch);
|
||||
int bytesInChar = TclUtfToUCS4(from, &chw);
|
||||
|
||||
ReverseBytes((unsigned char *)to, (unsigned char *)from,
|
||||
bytesInChar);
|
||||
to += bytesInChar;
|
||||
from += bytesInChar;
|
||||
bytesLeft -= bytesInChar;
|
||||
charCount++;
|
||||
}
|
||||
|
||||
from = to = objPtr->bytes;
|
||||
stringPtr->numChars = charCount;
|
||||
}
|
||||
/* Pass 2. Reverse all the bytes. */
|
||||
ReverseBytes((unsigned char *)to, (unsigned char *)from, numBytes);
|
||||
@@ -4110,9 +4163,22 @@ ExtendUnicodeRepWithString(
|
||||
} else {
|
||||
numAppendChars = 0;
|
||||
}
|
||||
for (dst=stringPtr->unicode + numOrigChars; numAppendChars-- > 0; dst++) {
|
||||
dst = stringPtr->unicode + numOrigChars;
|
||||
if (numAppendChars-- > 0) {
|
||||
bytes += TclUtfToUniChar(bytes, &unichar);
|
||||
*dst = unichar;
|
||||
#if TCL_UTF_MAX > 3
|
||||
/* join upper/lower surrogate */
|
||||
if (bytes && (stringPtr->unicode[numOrigChars - 1] | 0x3FF) == 0xDBFF && (unichar | 0x3FF) == 0xDFFF) {
|
||||
stringPtr->numChars--;
|
||||
unichar = ((stringPtr->unicode[numOrigChars - 1] & 0x3FF) << 10) + (unichar & 0x3FF) + 0x10000;
|
||||
dst--;
|
||||
}
|
||||
#endif
|
||||
*dst++ = unichar;
|
||||
while (numAppendChars-- > 0) {
|
||||
bytes += TclUtfToUniChar(bytes, &unichar);
|
||||
*dst++ = unichar;
|
||||
}
|
||||
}
|
||||
*dst = 0;
|
||||
}
|
||||
|
||||
+53
-13
@@ -65,15 +65,22 @@
|
||||
#undef TclWinGetSockOpt
|
||||
#undef TclWinSetSockOpt
|
||||
#undef TclWinNToHS
|
||||
#undef TclStaticPackage
|
||||
#undef TclStaticLibrary
|
||||
#undef Tcl_BackgroundError
|
||||
#undef TclGuessPackageName
|
||||
#undef TclGetLoadedPackages
|
||||
#define TclStaticPackage Tcl_StaticPackage
|
||||
#define TclStaticLibrary Tcl_StaticLibrary
|
||||
#undef Tcl_UniCharToUtfDString
|
||||
#undef Tcl_UtfToUniCharDString
|
||||
#undef Tcl_UtfToUniChar
|
||||
#undef Tcl_MacOSXOpenBundleResources
|
||||
#undef TclWinConvertWSAError
|
||||
#undef TclWinConvertError
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
#define TclWinConvertWSAError (void (*)(DWORD))(void *)Tcl_WinConvertError
|
||||
#define TclWinConvertError (void (*)(DWORD))(void *)Tcl_WinConvertError
|
||||
#endif
|
||||
|
||||
|
||||
#if TCL_UTF_MAX > 3
|
||||
static void uniCodePanic(void) {
|
||||
@@ -90,6 +97,32 @@ static void uniCodePanic(void) {
|
||||
# define Tcl_UniCharNcmp (int(*)(const Tcl_UniChar *, const Tcl_UniChar *, unsigned long))(void *)uniCodePanic
|
||||
#endif
|
||||
|
||||
#define TclUtfCharComplete UtfCharComplete
|
||||
#define TclUtfNext UtfNext
|
||||
#define TclUtfPrev UtfPrev
|
||||
|
||||
static int TclUtfCharComplete(const char *src, int length) {
|
||||
if ((unsigned)((unsigned char)*(src) - 0xF0) < 5) {
|
||||
return length < 3;
|
||||
}
|
||||
return Tcl_UtfCharComplete(src, length);
|
||||
}
|
||||
|
||||
static const char *TclUtfNext(const char *src) {
|
||||
if ((unsigned)((unsigned char)*(src) - 0xF0) < 5) {
|
||||
return src + 1;
|
||||
}
|
||||
return Tcl_UtfNext(src);
|
||||
}
|
||||
|
||||
static const char *TclUtfPrev(const char *src, const char *start) {
|
||||
if ((src >= start + 3) && ((src[-1] & 0xC0) == 0x80)
|
||||
&& ((src[-2] & 0xC0) == 0x80) && ((src[-3] & 0xC0) == 0x80)) {
|
||||
return src - 3;
|
||||
}
|
||||
return Tcl_UtfPrev(src, start);
|
||||
}
|
||||
|
||||
#define TclBN_mp_add mp_add
|
||||
#define TclBN_mp_and mp_and
|
||||
#define TclBN_mp_clamp mp_clamp
|
||||
@@ -138,10 +171,11 @@ static void uniCodePanic(void) {
|
||||
#define TclBN_mp_to_radix mp_to_radix
|
||||
#define TclBN_mp_to_ubin mp_to_ubin
|
||||
#define TclBN_mp_ubin_size mp_ubin_size
|
||||
#define TclBN_mp_unpack mp_unpack
|
||||
#define TclBN_mp_xor mp_xor
|
||||
#define TclBN_mp_zero mp_zero
|
||||
#define TclBN_s_mp_add s_mp_add
|
||||
#define TclBN_s_mp_balance_mul mp_balance_mul
|
||||
#define TclBN_s_mp_balance_mul s_mp_balance_mul
|
||||
#define TclBN_mp_karatsuba_mul s_mp_karatsuba_mul
|
||||
#define TclBN_mp_karatsuba_sqr s_mp_karatsuba_sqr
|
||||
#define TclBN_s_mp_mul_digs s_mp_mul_digs
|
||||
@@ -282,7 +316,7 @@ static int TclGetLoadedPackages(
|
||||
* otherwise, just return info about this
|
||||
* interpreter. */
|
||||
{
|
||||
return TclGetLoadedPackagesEx(interp, targetName, NULL);
|
||||
return TclGetLoadedLibraries(interp, targetName, NULL);
|
||||
}
|
||||
|
||||
mp_err TclBN_mp_div_3(const mp_int *a, mp_int *c, unsigned int *d) {
|
||||
@@ -396,7 +430,9 @@ TclWinGetPlatformId(void)
|
||||
|
||||
#define TclpCreateTempFile_ TclpCreateTempFile
|
||||
#define TclUnixWaitForFile_ TclUnixWaitForFile
|
||||
#ifndef MAC_OSX_TCL /* On UNIX, fill with other stub entries */
|
||||
#ifdef MAC_OSX_TCL /* On UNIX, fill with other stub entries */
|
||||
#define TclMacOSXNotifierAddRunLoopMode Tcl_MacOSXNotifierAddRunLoopMode
|
||||
#else
|
||||
#define TclMacOSXGetFileAttribute (int (*)(Tcl_Interp *, int, Tcl_Obj *, Tcl_Obj **))(void *)TclpCreateProcess
|
||||
#define TclMacOSXSetFileAttribute (int (*)(Tcl_Interp *, int, Tcl_Obj *, Tcl_Obj *))(void *)isatty
|
||||
#define TclMacOSXCopyFileAttributes (int (*)(const char *, const char *, const Tcl_StatBuf *))(void *)TclUnixCopyFile
|
||||
@@ -599,8 +635,6 @@ static int utfNcasecmp(const char *s1, const char *s2, unsigned int n){
|
||||
# define Tcl_Eval 0
|
||||
# undef Tcl_GlobalEval
|
||||
# define Tcl_GlobalEval 0
|
||||
# undef Tcl_GetStringResult
|
||||
# define Tcl_GetStringResult 0
|
||||
# undef Tcl_SaveResult
|
||||
# define Tcl_SaveResult 0
|
||||
# undef Tcl_RestoreResult
|
||||
@@ -1003,7 +1037,7 @@ static const TclIntStubs tclIntStubs = {
|
||||
TclPtrIncrObjVar, /* 254 */
|
||||
TclPtrObjMakeUpvar, /* 255 */
|
||||
TclPtrUnsetVar, /* 256 */
|
||||
TclStaticPackage, /* 257 */
|
||||
TclStaticLibrary, /* 257 */
|
||||
TclpCreateTemporaryDirectory, /* 258 */
|
||||
TclGetBytesFromObj, /* 259 */
|
||||
TclUnusedStubEntry, /* 260 */
|
||||
@@ -1119,10 +1153,13 @@ static const TclPlatStubs tclPlatStubs = {
|
||||
#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
|
||||
Tcl_WinUtfToTChar, /* 0 */
|
||||
Tcl_WinTCharToUtf, /* 1 */
|
||||
0, /* 2 */
|
||||
Tcl_WinConvertError, /* 3 */
|
||||
#endif /* WIN */
|
||||
#ifdef MAC_OSX_TCL /* MACOSX */
|
||||
Tcl_MacOSXOpenBundleResources, /* 0 */
|
||||
Tcl_MacOSXOpenVersionedBundleResources, /* 1 */
|
||||
Tcl_MacOSXNotifierAddRunLoopMode, /* 2 */
|
||||
#endif /* MACOSX */
|
||||
};
|
||||
|
||||
@@ -1200,7 +1237,7 @@ const TclTomMathStubs tclTomMathStubs = {
|
||||
TclBN_mp_set_u64, /* 68 */
|
||||
TclBN_mp_get_mag_u64, /* 69 */
|
||||
TclBN_mp_set_i64, /* 70 */
|
||||
0, /* 71 */
|
||||
TclBN_mp_unpack, /* 71 */
|
||||
0, /* 72 */
|
||||
TclBN_mp_tc_and, /* 73 */
|
||||
TclBN_mp_tc_or, /* 74 */
|
||||
@@ -1489,7 +1526,7 @@ const TclStubs tclStubs = {
|
||||
Tcl_SourceRCFile, /* 241 */
|
||||
Tcl_SplitList, /* 242 */
|
||||
Tcl_SplitPath, /* 243 */
|
||||
Tcl_StaticPackage, /* 244 */
|
||||
Tcl_StaticLibrary, /* 244 */
|
||||
Tcl_StringMatch, /* 245 */
|
||||
Tcl_TellOld, /* 246 */
|
||||
Tcl_TraceVar, /* 247 */
|
||||
@@ -1571,12 +1608,12 @@ const TclStubs tclStubs = {
|
||||
Tcl_UniCharToUpper, /* 323 */
|
||||
Tcl_UniCharToUtf, /* 324 */
|
||||
Tcl_UtfAtIndex, /* 325 */
|
||||
Tcl_UtfCharComplete, /* 326 */
|
||||
TclUtfCharComplete, /* 326 */
|
||||
Tcl_UtfBackslash, /* 327 */
|
||||
Tcl_UtfFindFirst, /* 328 */
|
||||
Tcl_UtfFindLast, /* 329 */
|
||||
Tcl_UtfNext, /* 330 */
|
||||
Tcl_UtfPrev, /* 331 */
|
||||
TclUtfNext, /* 330 */
|
||||
TclUtfPrev, /* 331 */
|
||||
Tcl_UtfToExternal, /* 332 */
|
||||
Tcl_UtfToExternalDString, /* 333 */
|
||||
Tcl_UtfToLower, /* 334 */
|
||||
@@ -1899,6 +1936,9 @@ const TclStubs tclStubs = {
|
||||
TclGetStringFromObj, /* 651 */
|
||||
TclGetUnicodeFromObj, /* 652 */
|
||||
TclGetByteArrayFromObj, /* 653 */
|
||||
Tcl_UtfCharComplete, /* 654 */
|
||||
Tcl_UtfNext, /* 655 */
|
||||
Tcl_UtfPrev, /* 656 */
|
||||
};
|
||||
|
||||
/* !END!: Do not edit above this line. */
|
||||
|
||||
+12
-9
@@ -19,6 +19,9 @@
|
||||
#ifndef USE_TCL_STUBS
|
||||
# define USE_TCL_STUBS
|
||||
#endif
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
# define TCL_NO_DEPRECATED
|
||||
#endif
|
||||
#include "tclInt.h"
|
||||
#ifdef TCL_WITH_EXTERNAL_TOMMATH
|
||||
# include "tommath.h"
|
||||
@@ -274,7 +277,7 @@ static Tcl_CmdProc Testset2Cmd;
|
||||
static Tcl_CmdProc TestseterrorcodeCmd;
|
||||
static Tcl_ObjCmdProc TestsetobjerrorcodeCmd;
|
||||
static Tcl_CmdProc TestsetplatformCmd;
|
||||
static Tcl_CmdProc TeststaticpkgCmd;
|
||||
static Tcl_CmdProc TeststaticlibraryCmd;
|
||||
static Tcl_CmdProc TesttranslatefilenameCmd;
|
||||
static Tcl_CmdProc TestupvarCmd;
|
||||
static Tcl_ObjCmdProc TestWrongNumArgsObjCmd;
|
||||
@@ -601,7 +604,7 @@ Tcltest_Init(
|
||||
NULL, NULL);
|
||||
Tcl_CreateCommand(interp, "testsocket", TestSocketCmd,
|
||||
NULL, NULL);
|
||||
Tcl_CreateCommand(interp, "teststaticpkg", TeststaticpkgCmd,
|
||||
Tcl_CreateCommand(interp, "teststaticlibrary", TeststaticlibraryCmd,
|
||||
NULL, NULL);
|
||||
Tcl_CreateCommand(interp, "testtranslatefilename",
|
||||
TesttranslatefilenameCmd, NULL, NULL);
|
||||
@@ -4214,10 +4217,10 @@ TestsetplatformCmd(
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TeststaticpkgCmd --
|
||||
* TeststaticlibraryCmd --
|
||||
*
|
||||
* This procedure implements the "teststaticpkg" command.
|
||||
* It is used to test the procedure Tcl_StaticPackage.
|
||||
* This procedure implements the "teststaticlibrary" command.
|
||||
* It is used to test the procedure Tcl_StaticLibrary.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
@@ -4230,7 +4233,7 @@ TestsetplatformCmd(
|
||||
*/
|
||||
|
||||
static int
|
||||
TeststaticpkgCmd(
|
||||
TeststaticlibraryCmd(
|
||||
TCL_UNUSED(void *),
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int argc, /* Number of arguments. */
|
||||
@@ -4240,7 +4243,7 @@ TeststaticpkgCmd(
|
||||
|
||||
if (argc != 4) {
|
||||
Tcl_AppendResult(interp, "wrong # arguments: should be \"",
|
||||
argv[0], " pkgName safe loaded\"", NULL);
|
||||
argv[0], " prefix safe loaded\"", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (Tcl_GetInt(interp, argv[2], &safe) != TCL_OK) {
|
||||
@@ -4249,7 +4252,7 @@ TeststaticpkgCmd(
|
||||
if (Tcl_GetInt(interp, argv[3], &loaded) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_StaticPackage((loaded) ? interp : NULL, argv[1],
|
||||
Tcl_StaticLibrary((loaded) ? interp : NULL, argv[1],
|
||||
StaticInitProc, (safe) ? StaticInitProc : NULL);
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -6962,7 +6965,7 @@ TestUtfPrevCmd(
|
||||
} else {
|
||||
offset = numBytes;
|
||||
}
|
||||
result = TclUtfPrev(bytes + offset, bytes);
|
||||
result = Tcl_UtfPrev(bytes + offset, bytes);
|
||||
Tcl_SetObjResult(interp, Tcl_NewIntObj(result - bytes));
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -1176,7 +1176,7 @@ TeststringobjCmd(
|
||||
{
|
||||
Tcl_UniChar *unicode;
|
||||
int varIndex, option, i, length;
|
||||
size_t size;
|
||||
int size;
|
||||
#define MAX_STRINGS 11
|
||||
const char *index, *string, *strings[MAX_STRINGS+1];
|
||||
String *strPtr;
|
||||
@@ -1371,7 +1371,7 @@ TeststringobjCmd(
|
||||
if (Tcl_GetIntFromObj(interp, objv[3], &i) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if ((i < 0) || ((size_t)i > size)) {
|
||||
if ((i < 0) || (i > size)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"index value out of range", -1));
|
||||
return TCL_ERROR;
|
||||
@@ -1402,7 +1402,7 @@ TeststringobjCmd(
|
||||
if (Tcl_GetIntFromObj(interp, objv[3], &i) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if ((i < 0) || ((size_t)i > size)) {
|
||||
if ((i < 0) || (i > size)) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
||||
"index value out of range", -1));
|
||||
return TCL_ERROR;
|
||||
|
||||
+36
-37
@@ -82,18 +82,17 @@ typedef union Block {
|
||||
* and statistics information.
|
||||
*/
|
||||
|
||||
typedef struct Bucket {
|
||||
typedef struct {
|
||||
Block *firstPtr; /* First block available */
|
||||
Block *lastPtr; /* End of block list */
|
||||
long numFree; /* Number of blocks available */
|
||||
size_t numFree; /* Number of blocks available */
|
||||
|
||||
/* All fields below for accounting only */
|
||||
|
||||
long numRemoves; /* Number of removes from bucket */
|
||||
long numInserts; /* Number of inserts into bucket */
|
||||
long numWaits; /* Number of waits to acquire a lock */
|
||||
long numLocks; /* Number of locks acquired */
|
||||
long totalAssigned; /* Total space assigned to bucket */
|
||||
size_t numRemoves; /* Number of removes from bucket */
|
||||
size_t numInserts; /* Number of inserts into bucket */
|
||||
size_t numLocks; /* Number of locks acquired */
|
||||
size_t totalAssigned; /* Total space assigned to bucket */
|
||||
} Bucket;
|
||||
|
||||
/*
|
||||
@@ -107,9 +106,9 @@ typedef struct Cache {
|
||||
struct Cache *nextPtr; /* Linked list of cache entries */
|
||||
Tcl_ThreadId owner; /* Which thread's cache is this? */
|
||||
Tcl_Obj *firstObjPtr; /* List of free objects for thread */
|
||||
int numObjects; /* Number of objects for thread */
|
||||
size_t numObjects; /* Number of objects for thread */
|
||||
Tcl_Obj *lastPtr; /* Last object in this cache */
|
||||
int totalAssigned; /* Total space assigned to thread */
|
||||
size_t totalAssigned; /* Total space assigned to thread */
|
||||
Bucket buckets[NBUCKETS]; /* The buckets for this thread */
|
||||
} Cache;
|
||||
|
||||
@@ -120,8 +119,8 @@ typedef struct Cache {
|
||||
|
||||
static struct {
|
||||
size_t blockSize; /* Bucket blocksize. */
|
||||
int maxBlocks; /* Max blocks before move to share. */
|
||||
int numMove; /* Num blocks to move to share. */
|
||||
size_t maxBlocks; /* Max blocks before move to share. */
|
||||
size_t numMove; /* Num blocks to move to share. */
|
||||
Tcl_Mutex *lockPtr; /* Share bucket lock. */
|
||||
} bucketInfo[NBUCKETS];
|
||||
|
||||
@@ -132,12 +131,12 @@ static struct {
|
||||
static Cache * GetCache(void);
|
||||
static void LockBucket(Cache *cachePtr, int bucket);
|
||||
static void UnlockBucket(Cache *cachePtr, int bucket);
|
||||
static void PutBlocks(Cache *cachePtr, int bucket, int numMove);
|
||||
static void PutBlocks(Cache *cachePtr, int bucket, size_t numMove);
|
||||
static int GetBlocks(Cache *cachePtr, int bucket);
|
||||
static Block * Ptr2Block(void *ptr);
|
||||
static void * Block2Ptr(Block *blockPtr, int bucket, unsigned int reqSize);
|
||||
static void MoveObjs(Cache *fromPtr, Cache *toPtr, int numMove);
|
||||
static void PutObjs(Cache *fromPtr, int numMove);
|
||||
static void * Block2Ptr(Block *blockPtr, int bucket, size_t reqSize);
|
||||
static void MoveObjs(Cache *fromPtr, Cache *toPtr, size_t numMove);
|
||||
static void PutObjs(Cache *fromPtr, size_t numMove);
|
||||
|
||||
/*
|
||||
* Local variables defined in this file and initialized at startup.
|
||||
@@ -548,7 +547,7 @@ TclThreadAllocObj(void)
|
||||
*/
|
||||
|
||||
if (cachePtr->numObjects == 0) {
|
||||
int numMove;
|
||||
size_t numMove;
|
||||
|
||||
Tcl_MutexLock(objLockPtr);
|
||||
numMove = sharedPtr->numObjects;
|
||||
@@ -565,11 +564,11 @@ TclThreadAllocObj(void)
|
||||
cachePtr->numObjects = numMove = NOBJALLOC;
|
||||
newObjsPtr = (Tcl_Obj *)TclpSysAlloc(sizeof(Tcl_Obj) * numMove, 0);
|
||||
if (newObjsPtr == NULL) {
|
||||
Tcl_Panic("alloc: could not allocate %d new objects", numMove);
|
||||
Tcl_Panic("alloc: could not allocate %" TCL_Z_MODIFIER "u new objects", numMove);
|
||||
}
|
||||
cachePtr->lastPtr = newObjsPtr + numMove - 1;
|
||||
objPtr = cachePtr->firstObjPtr; /* NULL */
|
||||
while (--numMove >= 0) {
|
||||
while (numMove-- > 0) {
|
||||
newObjsPtr[numMove].internalRep.twoPtrValue.ptr1 = objPtr;
|
||||
objPtr = newObjsPtr + numMove;
|
||||
}
|
||||
@@ -671,14 +670,14 @@ Tcl_GetMemoryInfo(
|
||||
Tcl_DStringAppendElement(dsPtr, buf);
|
||||
}
|
||||
for (n = 0; n < NBUCKETS; ++n) {
|
||||
sprintf(buf, "%lu %ld %ld %ld %ld %ld %ld",
|
||||
(unsigned long) bucketInfo[n].blockSize,
|
||||
sprintf(buf, "%" TCL_Z_MODIFIER "u %" TCL_Z_MODIFIER "u %" TCL_Z_MODIFIER "u %"
|
||||
TCL_Z_MODIFIER "u %" TCL_Z_MODIFIER "u %" TCL_Z_MODIFIER "u",
|
||||
bucketInfo[n].blockSize,
|
||||
cachePtr->buckets[n].numFree,
|
||||
cachePtr->buckets[n].numRemoves,
|
||||
cachePtr->buckets[n].numInserts,
|
||||
cachePtr->buckets[n].totalAssigned,
|
||||
cachePtr->buckets[n].numLocks,
|
||||
cachePtr->buckets[n].numWaits);
|
||||
cachePtr->buckets[n].numLocks);
|
||||
Tcl_DStringAppendElement(dsPtr, buf);
|
||||
}
|
||||
Tcl_DStringEndSublist(dsPtr);
|
||||
@@ -707,7 +706,7 @@ static void
|
||||
MoveObjs(
|
||||
Cache *fromPtr,
|
||||
Cache *toPtr,
|
||||
int numMove)
|
||||
size_t numMove)
|
||||
{
|
||||
Tcl_Obj *objPtr = fromPtr->firstObjPtr;
|
||||
Tcl_Obj *fromFirstObjPtr = objPtr;
|
||||
@@ -720,7 +719,7 @@ MoveObjs(
|
||||
* to be moved) as the first object in the 'from' cache.
|
||||
*/
|
||||
|
||||
while (--numMove) {
|
||||
while (numMove-- > 1) {
|
||||
objPtr = (Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr1;
|
||||
}
|
||||
fromPtr->firstObjPtr = (Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr1;
|
||||
@@ -754,9 +753,9 @@ MoveObjs(
|
||||
static void
|
||||
PutObjs(
|
||||
Cache *fromPtr,
|
||||
int numMove)
|
||||
size_t numMove)
|
||||
{
|
||||
int keep = fromPtr->numObjects - numMove;
|
||||
size_t keep = fromPtr->numObjects - numMove;
|
||||
Tcl_Obj *firstPtr, *lastPtr = NULL;
|
||||
|
||||
fromPtr->numObjects = keep;
|
||||
@@ -767,7 +766,7 @@ PutObjs(
|
||||
do {
|
||||
lastPtr = firstPtr;
|
||||
firstPtr = (Tcl_Obj *)firstPtr->internalRep.twoPtrValue.ptr1;
|
||||
} while (--keep > 0);
|
||||
} while (keep-- > 1);
|
||||
lastPtr->internalRep.twoPtrValue.ptr1 = NULL;
|
||||
}
|
||||
|
||||
@@ -808,7 +807,7 @@ static void *
|
||||
Block2Ptr(
|
||||
Block *blockPtr,
|
||||
int bucket,
|
||||
unsigned int reqSize)
|
||||
size_t reqSize)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
@@ -898,14 +897,14 @@ static void
|
||||
PutBlocks(
|
||||
Cache *cachePtr,
|
||||
int bucket,
|
||||
int numMove)
|
||||
size_t numMove)
|
||||
{
|
||||
/*
|
||||
* We have numFree. Want to shed numMove. So compute how many
|
||||
* Blocks to keep.
|
||||
*/
|
||||
|
||||
int keep = cachePtr->buckets[bucket].numFree - numMove;
|
||||
size_t keep = cachePtr->buckets[bucket].numFree - numMove;
|
||||
Block *lastPtr = NULL, *firstPtr;
|
||||
|
||||
cachePtr->buckets[bucket].numFree = keep;
|
||||
@@ -916,7 +915,7 @@ PutBlocks(
|
||||
do {
|
||||
lastPtr = firstPtr;
|
||||
firstPtr = firstPtr->nextBlock;
|
||||
} while (--keep > 0);
|
||||
} while (keep-- > 1);
|
||||
lastPtr->nextBlock = NULL;
|
||||
}
|
||||
|
||||
@@ -961,7 +960,7 @@ GetBlocks(
|
||||
int bucket)
|
||||
{
|
||||
Block *blockPtr;
|
||||
int n;
|
||||
size_t n;
|
||||
|
||||
/*
|
||||
* First, atttempt to move blocks from the shared cache. Note the
|
||||
@@ -994,7 +993,7 @@ GetBlocks(
|
||||
cachePtr->buckets[bucket].firstPtr = blockPtr;
|
||||
sharedPtr->buckets[bucket].numFree -= n;
|
||||
cachePtr->buckets[bucket].numFree = n;
|
||||
while (--n > 0) {
|
||||
while (n-- > 1) {
|
||||
blockPtr = blockPtr->nextBlock;
|
||||
}
|
||||
sharedPtr->buckets[bucket].firstPtr = blockPtr->nextBlock;
|
||||
@@ -1016,7 +1015,7 @@ GetBlocks(
|
||||
blockPtr = NULL;
|
||||
n = NBUCKETS;
|
||||
size = 0;
|
||||
while (--n > bucket) {
|
||||
while (n-- > (size_t)bucket + 1) {
|
||||
if (cachePtr->buckets[n].numFree > 0) {
|
||||
size = bucketInfo[n].blockSize;
|
||||
blockPtr = cachePtr->buckets[n].firstPtr;
|
||||
@@ -1045,7 +1044,7 @@ GetBlocks(
|
||||
n = size / bucketInfo[bucket].blockSize;
|
||||
cachePtr->buckets[bucket].numFree = n;
|
||||
cachePtr->buckets[bucket].firstPtr = blockPtr;
|
||||
while (--n > 0) {
|
||||
while (n-- > 1) {
|
||||
blockPtr->nextBlock = (Block *)
|
||||
((char *) blockPtr + bucketInfo[bucket].blockSize);
|
||||
blockPtr = blockPtr->nextBlock;
|
||||
@@ -1082,9 +1081,9 @@ TclInitThreadAlloc(void)
|
||||
objLockPtr = TclpNewAllocMutex();
|
||||
for (i = 0; i < NBUCKETS; ++i) {
|
||||
bucketInfo[i].blockSize = MINALLOC << i;
|
||||
bucketInfo[i].maxBlocks = 1 << (NBUCKETS - 1 - i);
|
||||
bucketInfo[i].maxBlocks = ((size_t)1) << (NBUCKETS - 1 - i);
|
||||
bucketInfo[i].numMove = i < NBUCKETS - 1 ?
|
||||
1 << (NBUCKETS - 2 - i) : 1;
|
||||
(size_t)1 << (NBUCKETS - 2 - i) : 1;
|
||||
bucketInfo[i].lockPtr = TclpNewAllocMutex();
|
||||
}
|
||||
TclpInitAllocCache();
|
||||
|
||||
@@ -305,6 +305,8 @@ TclSignalExitThread(
|
||||
|
||||
Tcl_MutexUnlock(&threadPtr->threadMutex);
|
||||
}
|
||||
#else
|
||||
TCL_MAC_EMPTY_FILE(generic_tclThreadJoin_c)
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/*
|
||||
|
||||
@@ -368,9 +368,9 @@ ThreadObjCmd(
|
||||
if (result == TCL_OK) {
|
||||
Tcl_SetIntObj(Tcl_GetObjResult(interp), status);
|
||||
} else {
|
||||
char buf[20];
|
||||
char buf[TCL_INTEGER_SPACE];
|
||||
|
||||
sprintf(buf, "%" TCL_LL_MODIFIER "d", id);
|
||||
sprintf(buf, "%" TCL_LL_MODIFIER "d", (long long)id);
|
||||
Tcl_AppendResult(interp, "cannot join thread ", buf, NULL);
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
# If you edit this file, advance the revision number (and the epoch
|
||||
# if the new stubs are not backward compatible) in tclTomMathDecls.h
|
||||
#
|
||||
# Copyright (c) 2005 by Kevin B. Kenny. All rights reserved.
|
||||
# Copyright © 2005 Kevin B. Kenny. All rights reserved.
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
@@ -17,7 +17,6 @@ library tcl
|
||||
# Define the unsupported generic interfaces.
|
||||
|
||||
interface tclTomMath
|
||||
# hooks {tclTomMathInt}
|
||||
scspec EXTERN
|
||||
|
||||
# Declare each of the functions in the Tcl tommath interface
|
||||
@@ -244,6 +243,10 @@ declare 69 {
|
||||
declare 70 {
|
||||
void TclBN_mp_set_i64(mp_int *a, int64_t i)
|
||||
}
|
||||
declare 71 {
|
||||
mp_err MP_WUR TclBN_mp_unpack(mp_int *rop, size_t count, mp_order order, size_t size,
|
||||
mp_endian endian, size_t nails, const void *op)
|
||||
}
|
||||
|
||||
# Added in libtommath 1.1.0
|
||||
declare 73 {deprecated {merged with mp_and}} {
|
||||
|
||||
@@ -53,7 +53,11 @@
|
||||
#define MP_FREE(mem, size) TclBNFree(mem)
|
||||
|
||||
#ifndef MODULE_SCOPE
|
||||
# define MODULE_SCOPE extern
|
||||
# ifdef __cplusplus
|
||||
# define MODULE_SCOPE extern "C"
|
||||
# else
|
||||
# define MODULE_SCOPE extern
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -69,6 +73,11 @@ MODULE_SCOPE mp_err TclBN_s_mp_mul_d(const mp_int *a, mp_digit b, mp_int *c);
|
||||
MODULE_SCOPE void TclBN_s_mp_reverse(unsigned char *s, size_t len);
|
||||
MODULE_SCOPE void TclBN_s_mp_set(mp_int *a, mp_digit b);
|
||||
MODULE_SCOPE mp_err TclBN_s_mp_sub_d(const mp_int *a, mp_digit b, mp_int *c);
|
||||
MODULE_SCOPE mp_err TclBN_s_mp_balance_mul(const mp_int *a, const mp_int *b, mp_int *c);
|
||||
MODULE_SCOPE const char *const TclBN_mp_s_rmap;
|
||||
MODULE_SCOPE const uint8_t TclBN_mp_s_rmap_reverse[];
|
||||
MODULE_SCOPE const size_t TclBN_mp_s_rmap_reverse_sz;
|
||||
MODULE_SCOPE mp_err TclBN_mp_set_int(mp_int *a, unsigned long b);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -141,10 +150,11 @@ MODULE_SCOPE mp_err TclBN_s_mp_sub_d(const mp_int *a, mp_digit b, mp_int *c);
|
||||
#define mp_to_radix TclBN_mp_to_radix
|
||||
#define mp_to_ubin TclBN_mp_to_ubin
|
||||
#define mp_ubin_size TclBN_mp_ubin_size
|
||||
#define mp_unpack TclBN_mp_unpack
|
||||
#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_balance_mul TclBN_s_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
|
||||
@@ -379,7 +389,11 @@ EXTERN void TclBN_mp_set_u64(mp_int *a, uint64_t i);
|
||||
EXTERN uint64_t TclBN_mp_get_mag_u64(const mp_int *a) MP_WUR;
|
||||
/* 70 */
|
||||
EXTERN void TclBN_mp_set_i64(mp_int *a, int64_t i);
|
||||
/* Slot 71 is reserved */
|
||||
/* 71 */
|
||||
EXTERN mp_err TclBN_mp_unpack(mp_int *rop, size_t count,
|
||||
mp_order order, size_t size,
|
||||
mp_endian endian, size_t nails,
|
||||
const void *op) MP_WUR;
|
||||
/* Slot 72 is reserved */
|
||||
/* 73 */
|
||||
TCL_DEPRECATED("merged with mp_and")
|
||||
@@ -482,7 +496,7 @@ typedef struct TclTomMathStubs {
|
||||
void (*tclBN_mp_set_u64) (mp_int *a, uint64_t i); /* 68 */
|
||||
uint64_t (*tclBN_mp_get_mag_u64) (const mp_int *a) MP_WUR; /* 69 */
|
||||
void (*tclBN_mp_set_i64) (mp_int *a, int64_t i); /* 70 */
|
||||
void (*reserved71)(void);
|
||||
mp_err (*tclBN_mp_unpack) (mp_int *rop, size_t count, mp_order order, size_t size, mp_endian endian, size_t nails, const void *op) MP_WUR; /* 71 */
|
||||
void (*reserved72)(void);
|
||||
TCL_DEPRECATED_API("merged with mp_and") mp_err (*tclBN_mp_tc_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 73 */
|
||||
TCL_DEPRECATED_API("merged with mp_or") mp_err (*tclBN_mp_tc_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 74 */
|
||||
@@ -648,7 +662,8 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
|
||||
(tclTomMathStubsPtr->tclBN_mp_get_mag_u64) /* 69 */
|
||||
#define TclBN_mp_set_i64 \
|
||||
(tclTomMathStubsPtr->tclBN_mp_set_i64) /* 70 */
|
||||
/* Slot 71 is reserved */
|
||||
#define TclBN_mp_unpack \
|
||||
(tclTomMathStubsPtr->tclBN_mp_unpack) /* 71 */
|
||||
/* Slot 72 is reserved */
|
||||
#define TclBN_mp_tc_and \
|
||||
(tclTomMathStubsPtr->tclBN_mp_tc_and) /* 73 */
|
||||
|
||||
+17
-16
@@ -68,25 +68,26 @@ typedef struct {
|
||||
* TCL_TRACE_ENTER_DURING_EXEC == 4 * TCL_TRACE_ENTER_EXEC and that
|
||||
* TCL_TRACE_LEAVE_DURING_EXEC == 4 * TCL_TRACE_LEAVE_EXEC.
|
||||
*
|
||||
* TCL_TRACE_ENTER_DURING_EXEC - Trace each command inside the command
|
||||
* currently being traced, before execution.
|
||||
* TCL_TRACE_LEAVE_DURING_EXEC - Trace each command inside the command
|
||||
* currently being traced, after execution.
|
||||
* TCL_TRACE_ANY_EXEC - OR'd combination of all EXEC flags.
|
||||
* TCL_TRACE_EXEC_IN_PROGRESS - The callback function on this trace is
|
||||
* currently executing. Therefore we don't let
|
||||
* further traces execute.
|
||||
* TCL_TRACE_EXEC_DIRECT - This execution trace is triggered directly
|
||||
* by the command being traced, not because of
|
||||
* an internal trace.
|
||||
* The flag 'TCL_TRACE_DESTROYED' may also be used in command execution traces.
|
||||
*/
|
||||
|
||||
#define TCL_TRACE_ENTER_DURING_EXEC 4
|
||||
#define TCL_TRACE_LEAVE_DURING_EXEC 8
|
||||
#define TCL_TRACE_ANY_EXEC 15
|
||||
#define TCL_TRACE_EXEC_IN_PROGRESS 0x10
|
||||
#define TCL_TRACE_EXEC_DIRECT 0x20
|
||||
enum TraceExecutionFlags {
|
||||
TCL_TRACE_ENTER_DURING_EXEC = 4,
|
||||
/* Trace each command inside the command
|
||||
* currently being traced, before
|
||||
* execution. */
|
||||
TCL_TRACE_LEAVE_DURING_EXEC = 8,
|
||||
/* Trace each command inside the command
|
||||
* currently being traced, after execution. */
|
||||
TCL_TRACE_ANY_EXEC = 15, /* OR'd combination of all EXEC flags. */
|
||||
TCL_TRACE_EXEC_IN_PROGRESS = 0x10,
|
||||
/* The callback function on this trace is
|
||||
* currently executing. Therefore we don't let
|
||||
* further traces execute. */
|
||||
TCL_TRACE_EXEC_DIRECT = 0x20/* This execution trace is triggered directly
|
||||
* by the command being traced, not because of
|
||||
* an internal trace. */
|
||||
};
|
||||
|
||||
/*
|
||||
* Forward declarations for functions defined in this file:
|
||||
|
||||
+35
-34
@@ -64,20 +64,12 @@ static const unsigned char totalBytes[256] = {
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
/* Tcl_UtfCharComplete() might point to 2nd byte of valid 4-byte sequence */
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
|
||||
/* End of "continuation byte section" */
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
|
||||
#if TCL_UTF_MAX > 3
|
||||
4,4,4,4,4,
|
||||
#else
|
||||
1,1,1,1,1,
|
||||
#endif
|
||||
1,1,1,1,1,1,1,1,1,1,1
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,1,1,1,1,1,1,1,1,1,1,1
|
||||
};
|
||||
|
||||
|
||||
static const unsigned char complete[256] = {
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
@@ -88,15 +80,9 @@ static const unsigned char complete[256] = {
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
|
||||
/* End of "continuation byte section" */
|
||||
2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
|
||||
#if TCL_UTF_MAX > 3
|
||||
4,4,4,4,4,
|
||||
#else
|
||||
3,3,3,3,3,
|
||||
#endif
|
||||
1,1,1,1,1,1,1,1,1,1,1
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,1,1,1,1,1,1,1,1,1,1,1
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Functions used only in this module.
|
||||
*/
|
||||
@@ -694,7 +680,7 @@ Tcl_UtfToUniCharDString(
|
||||
p += TclUtfToUCS4(p, &ch);
|
||||
*w++ = ch;
|
||||
}
|
||||
while ((p < endPtr) && TclUCS4Complete(p, endPtr-p)) {
|
||||
while ((p < endPtr) && Tcl_UtfCharComplete(p, endPtr-p)) {
|
||||
p += TclUtfToUCS4(p, &ch);
|
||||
*w++ = ch;
|
||||
}
|
||||
@@ -752,7 +738,7 @@ Tcl_UtfToChar16DString(
|
||||
*w++ = ch;
|
||||
}
|
||||
while (p < endPtr) {
|
||||
if (TclChar16Complete(p, endPtr-p)) {
|
||||
if (Tcl_UtfCharComplete(p, endPtr-p)) {
|
||||
p += Tcl_UtfToChar16(p, &ch);
|
||||
*w++ = ch;
|
||||
} else {
|
||||
@@ -833,7 +819,7 @@ Tcl_NumUtfChars(
|
||||
/* Pointer to the end of string. Never read endPtr[0] */
|
||||
const char *endPtr = src + length;
|
||||
/* Pointer to last byte where optimization still can be used */
|
||||
const char *optPtr = endPtr - TCL_UTF_MAX;
|
||||
const char *optPtr = endPtr - 4;
|
||||
|
||||
/*
|
||||
* Optimize away the call in this loop. Justified because...
|
||||
@@ -970,6 +956,10 @@ Tcl_UtfNext(
|
||||
const char *next;
|
||||
|
||||
if (((*src) & 0xC0) == 0x80) {
|
||||
/* Continuation byte, so we start 'inside' a (possible valid) UTF-8
|
||||
* sequence. Since we are not allowed to access src[-1], we cannot
|
||||
* check if the sequence is actually valid, the best we can do is
|
||||
* just assume it is valid and locate the end. */
|
||||
if ((((*++src) & 0xC0) == 0x80) && (((*++src) & 0xC0) == 0x80)) {
|
||||
++src;
|
||||
}
|
||||
@@ -1064,7 +1054,7 @@ Tcl_UtfPrev(
|
||||
* it (the fallback) is correct.
|
||||
*/
|
||||
|
||||
|| (trailBytesSeen >= complete[byte])) {
|
||||
|| (trailBytesSeen >= totalBytes[byte])) {
|
||||
/*
|
||||
* That is, (1 + trailBytesSeen > needed).
|
||||
* We've examined more bytes than needed to complete
|
||||
@@ -1105,19 +1095,14 @@ Tcl_UtfPrev(
|
||||
|
||||
/* Continue the search backwards... */
|
||||
look--;
|
||||
} while (trailBytesSeen < TCL_UTF_MAX);
|
||||
} while (trailBytesSeen < 4);
|
||||
|
||||
/*
|
||||
* We've seen TCL_UTF_MAX trail bytes, so we know there will not be a
|
||||
* We've seen 4 trail bytes, so we know there will not be a
|
||||
* properly formed byte sequence to find, and we can stop looking,
|
||||
* accepting the fallback (for TCL_UTF_MAX > 3) or just go back as
|
||||
* far as we can.
|
||||
* accepting the fallback.
|
||||
*/
|
||||
#if TCL_UTF_MAX > 3
|
||||
return fallback;
|
||||
#else
|
||||
return src - TCL_UTF_MAX;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1744,7 +1729,7 @@ Tcl_UniCharToLower(
|
||||
/* Clear away extension bits, if any */
|
||||
return ch & 0x1FFFFF;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -1838,7 +1823,7 @@ Tcl_UniCharNcmp(
|
||||
const Tcl_UniChar *uct, /* Unicode string ucs is compared to. */
|
||||
unsigned long numChars) /* Number of unichars to compare. */
|
||||
{
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#if defined(WORDS_BIGENDIAN) && (TCL_UTF_MAX > 3)
|
||||
/*
|
||||
* We are definitely on a big-endian machine; memcmp() is safe
|
||||
*/
|
||||
@@ -1852,6 +1837,14 @@ Tcl_UniCharNcmp(
|
||||
|
||||
for ( ; numChars != 0; ucs++, uct++, numChars--) {
|
||||
if (*ucs != *uct) {
|
||||
#if TCL_UTF_MAX < 4
|
||||
/* special case for handling upper surrogates */
|
||||
if (((*ucs & 0xFC00) == 0xD800) && ((*uct & 0xFC00) != 0xD800)) {
|
||||
return 1;
|
||||
} else if (((*uct & 0xFC00) == 0xD800)) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
return (*ucs - *uct);
|
||||
}
|
||||
}
|
||||
@@ -1889,6 +1882,14 @@ Tcl_UniCharNcasecmp(
|
||||
Tcl_UniChar lct = Tcl_UniCharToLower(*uct);
|
||||
|
||||
if (lcs != lct) {
|
||||
#if TCL_UTF_MAX < 4
|
||||
/* special case for handling upper surrogates */
|
||||
if (((lcs & 0xFC00) == 0xD800) && ((lct & 0xFC00) != 0xD800)) {
|
||||
return 1;
|
||||
} else if (((lct & 0xFC00) == 0xD800)) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
return (lcs - lct);
|
||||
}
|
||||
}
|
||||
|
||||
+20
-11
@@ -88,11 +88,13 @@ static ProcessGlobalValue executableName = {
|
||||
*/
|
||||
|
||||
#define COMPAT 1
|
||||
#define CONVERT_NONE 0
|
||||
#define CONVERT_BRACE 2
|
||||
#define CONVERT_ESCAPE 4
|
||||
#define CONVERT_MASK (CONVERT_BRACE | CONVERT_ESCAPE)
|
||||
#define CONVERT_ANY 16
|
||||
enum FormatListFlags {
|
||||
CONVERT_NONE = 0,
|
||||
CONVERT_BRACE = 2,
|
||||
CONVERT_ESCAPE = 4,
|
||||
CONVERT_MASK = (CONVERT_BRACE | CONVERT_ESCAPE),
|
||||
CONVERT_ANY = 16
|
||||
};
|
||||
|
||||
/*
|
||||
* The following key is used by Tcl_PrintDouble and TclPrecTraceProc to
|
||||
@@ -1707,7 +1709,7 @@ TclTrimRight(
|
||||
const char *q = trim;
|
||||
int pInc = 0, bytesLeft = numTrim;
|
||||
|
||||
pp = TclUtfPrev(p, bytes);
|
||||
pp = Tcl_UtfPrev(p, bytes);
|
||||
do {
|
||||
pp += pInc;
|
||||
pInc = TclUtfToUCS4(pp, &ch1);
|
||||
@@ -1718,14 +1720,14 @@ TclTrimRight(
|
||||
*/
|
||||
|
||||
do {
|
||||
int qInc = TclUtfToUCS4(q, &ch2);
|
||||
pInc = TclUtfToUCS4(q, &ch2);
|
||||
|
||||
if (ch1 == ch2) {
|
||||
break;
|
||||
}
|
||||
|
||||
q += qInc;
|
||||
bytesLeft -= qInc;
|
||||
q += pInc;
|
||||
bytesLeft -= pInc;
|
||||
} while (bytesLeft);
|
||||
|
||||
if (bytesLeft == 0) {
|
||||
@@ -1771,7 +1773,7 @@ TclTrimLeft(
|
||||
* rely on (trim[numTrim] == '\0'). */
|
||||
{
|
||||
const char *p = bytes;
|
||||
int ch1, ch2;
|
||||
int ch1, ch2;
|
||||
|
||||
/* Empty strings -> nothing to do */
|
||||
if ((numBytes == 0) || (numTrim == 0)) {
|
||||
@@ -2030,7 +2032,14 @@ Tcl_ConcatObj(
|
||||
continue;
|
||||
}
|
||||
if (resPtr) {
|
||||
if (TCL_OK != Tcl_ListObjAppendList(NULL, resPtr, objPtr)) {
|
||||
Tcl_Obj *elemPtr = NULL;
|
||||
|
||||
Tcl_ListObjIndex(NULL, objPtr, 0, &elemPtr);
|
||||
if (elemPtr == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (Tcl_GetString(elemPtr)[0] == '#' || TCL_OK
|
||||
!= Tcl_ListObjAppendList(NULL, resPtr, objPtr)) {
|
||||
/* Abandon ship! */
|
||||
Tcl_DecrRefCount(resPtr);
|
||||
goto slow;
|
||||
|
||||
+1982
-1071
File diff suppressed because it is too large
Load Diff
+13
-15
@@ -130,21 +130,19 @@ typedef struct {
|
||||
} ZlibChannelData;
|
||||
|
||||
/*
|
||||
* Value bits for the flags field. Definitions are:
|
||||
* ASYNC - Whether this is an asynchronous channel.
|
||||
* IN_HEADER - Whether the inHeader field has been registered with
|
||||
* the input compressor.
|
||||
* OUT_HEADER - Whether the outputHeader field has been registered
|
||||
* with the output decompressor.
|
||||
* STREAM_DECOMPRESS - Signal decompress pending data.
|
||||
* STREAM_DONE - Flag to signal stream end up to transform input.
|
||||
* Value bits for the flags field:
|
||||
*/
|
||||
|
||||
#define ASYNC 0x01
|
||||
#define IN_HEADER 0x02
|
||||
#define OUT_HEADER 0x04
|
||||
#define STREAM_DECOMPRESS 0x08
|
||||
#define STREAM_DONE 0x10
|
||||
enum ZlibChannelFlags {
|
||||
ASYNC = 0x01, /* Whether this is an asynchronous channel. */
|
||||
IN_HEADER = 0x02, /* Whether the inHeader field has been
|
||||
* registered with the input compressor. */
|
||||
OUT_HEADER = 0x04, /* Whether the outputHeader field has been
|
||||
* registered with the output decompressor. */
|
||||
STREAM_DECOMPRESS = 0x08, /* Signal decompress pending data. */
|
||||
STREAM_DONE = 0x10 /* Flag to signal stream end up to transform
|
||||
* input. */
|
||||
};
|
||||
|
||||
/*
|
||||
* Size of buffers allocated by default, and the range it can be set to. The
|
||||
@@ -214,7 +212,7 @@ static const Tcl_ChannelType zlibChannelType = {
|
||||
ZlibTransformGetOption,
|
||||
ZlibTransformWatch,
|
||||
ZlibTransformGetHandle,
|
||||
ZlibTransformClose, /* close2Proc */
|
||||
ZlibTransformClose, /* close2Proc */
|
||||
ZlibTransformBlockMode,
|
||||
NULL, /* flushProc */
|
||||
ZlibTransformEventHandler,
|
||||
@@ -3957,7 +3955,7 @@ TclZlibInit(
|
||||
* Formally provide the package as a Tcl built-in.
|
||||
*/
|
||||
|
||||
#ifndef TCL_NO_DEPRECATED
|
||||
#if !defined(TCL_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9)
|
||||
Tcl_PkgProvide(interp, "zlib", TCL_ZLIB_VERSION);
|
||||
#endif
|
||||
return Tcl_PkgProvide(interp, "tcl::zlib", TCL_ZLIB_VERSION);
|
||||
|
||||
+110
-100
@@ -70,60 +70,70 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} {
|
||||
# gives the end-user ultimate control to work-around any bugs, or
|
||||
# to customize.
|
||||
|
||||
if {[info exists env($enVarName)]} {
|
||||
lappend dirs $env($enVarName)
|
||||
}
|
||||
if {[info exists env($enVarName)]} {
|
||||
lappend dirs $env($enVarName)
|
||||
}
|
||||
|
||||
catch {
|
||||
set found 0
|
||||
set found 0
|
||||
set root [zipfs root]
|
||||
set mountpoint [file join $root lib [string tolower $basename]]
|
||||
lappend dirs [file join $root app ${basename}_library]
|
||||
lappend dirs [file join $root lib $mountpoint ${basename}_library]
|
||||
lappend dirs [file join $root lib $mountpoint]
|
||||
set mountpoint [file join $root lib $basename]
|
||||
lappend dirs [file join $root app ${basename}_library]
|
||||
lappend dirs [file join $root lib $mountpoint ${basename}_library]
|
||||
lappend dirs [file join $root lib $mountpoint]
|
||||
if {![zipfs exists [file join $root app ${basename}_library]] \
|
||||
&& ![zipfs exists $mountpoint]} {
|
||||
set found 0
|
||||
foreach pkgdat [info loaded] {
|
||||
lassign $pkgdat dllfile dllpkg
|
||||
if {[string tolower $dllpkg] ne [string tolower $basename]} continue
|
||||
if {$dllfile eq {}} {
|
||||
# Loaded statically
|
||||
break
|
||||
}
|
||||
set found 1
|
||||
zipfs mount $mountpoint $dllfile
|
||||
break
|
||||
}
|
||||
if {!$found} {
|
||||
set paths {}
|
||||
lappend paths [file join $root app]
|
||||
lappend paths [::${basename}::pkgconfig get libdir,runtime]
|
||||
lappend paths [::${basename}::pkgconfig get bindir,runtime]
|
||||
if {[catch {::${basename}::pkgconfig get zipfile,runtime} zipfile]} {
|
||||
set zipfile [string tolower \
|
||||
"lib${basename}_[join [list {*}[split $version .] {*}$patch] _].zip"]
|
||||
}
|
||||
lappend paths [file dirname [file join [pwd] [info nameofexecutable]]]
|
||||
foreach path $paths {
|
||||
set archive [file join $path $zipfile]
|
||||
if {![file exists $archive]} continue
|
||||
zipfs mount $mountpoint $archive
|
||||
if {[zipfs exists [file join $mountpoint ${basename}_library $initScript]]} {
|
||||
lappend dirs [file join $mountpoint ${basename}_library]
|
||||
set found 1
|
||||
break
|
||||
} elseif {[zipfs exists [file join $mountpoint $initScript]]} {
|
||||
lappend dirs [file join $mountpoint $initScript]
|
||||
set found 1
|
||||
break
|
||||
} else {
|
||||
catch {zipfs unmount $archive}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&& ![zipfs exists $mountpoint]} {
|
||||
set found 0
|
||||
foreach pkgdat [info loaded] {
|
||||
lassign $pkgdat dllfile dllpkg
|
||||
if {$dllpkg ne $basename} continue
|
||||
if {$dllfile eq {}} {
|
||||
# Loaded statically
|
||||
break
|
||||
}
|
||||
set found 1
|
||||
zipfs mount $mountpoint $dllfile
|
||||
break
|
||||
}
|
||||
if {!$found} {
|
||||
set paths {}
|
||||
if {![catch {::${basename}::pkgconfig get libdir,runtime} dir]} {
|
||||
lappend paths $dir
|
||||
} else {
|
||||
catch {lappend paths [::tcl::pkgconfig get libdir,runtime]}
|
||||
}
|
||||
if {![catch {::${basename}::pkgconfig get bindir,runtime} dir]} {
|
||||
lappend paths $dir
|
||||
} else {
|
||||
catch {lappend paths [::tcl::pkgconfig get bindir,runtime]}
|
||||
}
|
||||
if {[catch {::${basename}::pkgconfig get dllfile,runtime} dllfile]} {
|
||||
set dllfile "lib${basename}${version}[info sharedlibextension]"
|
||||
}
|
||||
set dir [file dirname [file join [pwd] [info nameofexecutable]]]
|
||||
lappend paths $dir
|
||||
lappend paths [file join [file dirname $dir] lib]
|
||||
foreach path $paths {
|
||||
set archive [file join $path $dllfile]
|
||||
if {![file exists $archive]} {
|
||||
continue
|
||||
}
|
||||
zipfs mount $mountpoint $archive
|
||||
if {[zipfs exists [file join $mountpoint ${basename}_library $initScript]]} {
|
||||
lappend dirs [file join $mountpoint ${basename}_library]
|
||||
set found 1
|
||||
break
|
||||
} elseif {[zipfs exists [file join $mountpoint $initScript]]} {
|
||||
lappend dirs [file join $mountpoint $initScript]
|
||||
set found 1
|
||||
break
|
||||
} else {
|
||||
catch {zipfs unmount $archive}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# 2. In the package script directory registered within the
|
||||
# configuration of the package itself.
|
||||
@@ -158,11 +168,11 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} {
|
||||
# ../../../foo1.0.1/library
|
||||
# (From unix/arch directory in parallel build hierarchy)
|
||||
|
||||
set parentDir [file dirname [file dirname [info nameofexecutable]]]
|
||||
set grandParentDir [file dirname $parentDir]
|
||||
lappend dirs [file join $parentDir lib $basename$version]
|
||||
lappend dirs [file join $grandParentDir lib $basename$version]
|
||||
lappend dirs [file join $parentDir library]
|
||||
set parentDir [file dirname [file dirname [info nameofexecutable]]]
|
||||
set grandParentDir [file dirname $parentDir]
|
||||
lappend dirs [file join $parentDir lib $basename$version]
|
||||
lappend dirs [file join $grandParentDir lib $basename$version]
|
||||
lappend dirs [file join $parentDir library]
|
||||
if {0} {
|
||||
lappend dirs [file join $grandParentDir library]
|
||||
lappend dirs [file join $grandParentDir $basename$patch library]
|
||||
@@ -185,19 +195,19 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} {
|
||||
}
|
||||
set seen($norm) {}
|
||||
|
||||
set the_library $i
|
||||
set file [file join $i $initScript]
|
||||
set the_library $i
|
||||
set file [file join $i $initScript]
|
||||
|
||||
# source everything when in a safe interpreter because we have a
|
||||
# source command, but no file exists command
|
||||
|
||||
if {[interp issafe] || [file exists $file]} {
|
||||
if {![catch {uplevel #0 [list source $file]} msg opts]} {
|
||||
return
|
||||
}
|
||||
if {[interp issafe] || [file exists $file]} {
|
||||
if {![catch {uplevel #0 [list source $file]} msg opts]} {
|
||||
return
|
||||
}
|
||||
append errors "$file: $msg\n"
|
||||
append errors [dict get $opts -errorinfo]\n
|
||||
}
|
||||
}
|
||||
}
|
||||
unset -nocomplain the_library
|
||||
set msg "Can't find a usable $initScript in the following directories: \n"
|
||||
@@ -236,7 +246,7 @@ if {[interp issafe]} {
|
||||
|
||||
proc auto_mkindex {dir args} {
|
||||
if {[interp issafe]} {
|
||||
error "can't generate index within safe interpreter"
|
||||
error "can't generate index within safe interpreter"
|
||||
}
|
||||
|
||||
set oldDir [pwd]
|
||||
@@ -292,7 +302,7 @@ proc auto_mkindex_old {dir args} {
|
||||
set f ""
|
||||
set error [catch {
|
||||
set f [open $file]
|
||||
fconfigure $f -encoding utf-8 -eofchar \032
|
||||
fconfigure $f -encoding utf-8 -eofchar "\032 {}"
|
||||
while {[gets $f line] >= 0} {
|
||||
if {[regexp {^proc[ ]+([^ ]*)} $line match procName]} {
|
||||
set procName [lindex [auto_qualify $procName "::"] 0]
|
||||
@@ -404,7 +414,7 @@ proc auto_mkindex_parser::mkindex {file} {
|
||||
set scriptFile $file
|
||||
|
||||
set fid [open $file]
|
||||
fconfigure $fid -encoding utf-8 -eofchar \032
|
||||
fconfigure $fid -encoding utf-8 -eofchar "\032 {}"
|
||||
set contents [read $fid]
|
||||
close $fid
|
||||
|
||||
@@ -424,7 +434,7 @@ proc auto_mkindex_parser::mkindex {file} {
|
||||
$parser eval $contents
|
||||
|
||||
foreach name $imports {
|
||||
catch {$parser eval [list _%@namespace forget $name]}
|
||||
catch {$parser eval [list _%@namespace forget $name]}
|
||||
}
|
||||
return $index
|
||||
}
|
||||
@@ -494,9 +504,9 @@ proc auto_mkindex_parser::commandInit {name arglist body} {
|
||||
set ns [namespace qualifiers $name]
|
||||
set tail [namespace tail $name]
|
||||
if {$ns eq ""} {
|
||||
set fakeName [namespace current]::_%@fake_$tail
|
||||
set fakeName [namespace current]::_%@fake_$tail
|
||||
} else {
|
||||
set fakeName [namespace current]::[string map {:: _} _%@fake_$name]
|
||||
set fakeName [namespace current]::[string map {:: _} _%@fake_$name]
|
||||
}
|
||||
proc $fakeName $arglist $body
|
||||
|
||||
@@ -505,8 +515,8 @@ proc auto_mkindex_parser::commandInit {name arglist body} {
|
||||
# the fully qualified names, and have the procs point to the aliases.
|
||||
|
||||
if {[string match *::* $name]} {
|
||||
set exportCmd [list _%@namespace export [namespace tail $name]]
|
||||
$parser eval [list _%@namespace eval $ns $exportCmd]
|
||||
set exportCmd [list _%@namespace export [namespace tail $name]]
|
||||
$parser eval [list _%@namespace eval $ns $exportCmd]
|
||||
|
||||
# The following proc definition does not work if you want to tolerate
|
||||
# space or something else diabolical in the procedure name, (i.e.,
|
||||
@@ -518,11 +528,11 @@ proc auto_mkindex_parser::commandInit {name arglist body} {
|
||||
# A gold star to someone that can make test autoMkindex-3.3 work
|
||||
# properly
|
||||
|
||||
set alias [namespace tail $fakeName]
|
||||
$parser invokehidden proc $name {args} "_%@eval {$alias} \$args"
|
||||
$parser alias $alias $fakeName
|
||||
set alias [namespace tail $fakeName]
|
||||
$parser invokehidden proc $name {args} "_%@eval {$alias} \$args"
|
||||
$parser alias $alias $fakeName
|
||||
} else {
|
||||
$parser alias $name $fakeName
|
||||
$parser alias $name $fakeName
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -544,18 +554,18 @@ proc auto_mkindex_parser::fullname {name} {
|
||||
variable contextStack
|
||||
|
||||
if {![string match ::* $name]} {
|
||||
foreach ns $contextStack {
|
||||
set name "${ns}::$name"
|
||||
if {[string match ::* $name]} {
|
||||
break
|
||||
}
|
||||
}
|
||||
foreach ns $contextStack {
|
||||
set name "${ns}::$name"
|
||||
if {[string match ::* $name]} {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {[namespace qualifiers $name] eq ""} {
|
||||
set name [namespace tail $name]
|
||||
set name [namespace tail $name]
|
||||
} elseif {![string match ::* $name]} {
|
||||
set name "::$name"
|
||||
set name "::$name"
|
||||
}
|
||||
|
||||
# Earlier, mkindex replaced all $'s with \0. Now, we have to reverse that
|
||||
@@ -645,27 +655,27 @@ auto_mkindex_parser::hook {
|
||||
|
||||
auto_mkindex_parser::command namespace {op args} {
|
||||
switch -- $op {
|
||||
eval {
|
||||
variable parser
|
||||
variable contextStack
|
||||
eval {
|
||||
variable parser
|
||||
variable contextStack
|
||||
|
||||
set name [lindex $args 0]
|
||||
set args [lrange $args 1 end]
|
||||
set name [lindex $args 0]
|
||||
set args [lrange $args 1 end]
|
||||
|
||||
set contextStack [linsert $contextStack 0 $name]
|
||||
set contextStack [linsert $contextStack 0 $name]
|
||||
$parser eval [list _%@namespace eval $name] $args
|
||||
set contextStack [lrange $contextStack 1 end]
|
||||
}
|
||||
import {
|
||||
variable parser
|
||||
variable imports
|
||||
foreach pattern $args {
|
||||
if {$pattern ne "-force"} {
|
||||
lappend imports $pattern
|
||||
}
|
||||
}
|
||||
catch {$parser eval "_%@namespace import $args"}
|
||||
}
|
||||
set contextStack [lrange $contextStack 1 end]
|
||||
}
|
||||
import {
|
||||
variable parser
|
||||
variable imports
|
||||
foreach pattern $args {
|
||||
if {$pattern ne "-force"} {
|
||||
lappend imports $pattern
|
||||
}
|
||||
}
|
||||
catch {$parser eval "_%@namespace import $args"}
|
||||
}
|
||||
ensemble {
|
||||
variable parser
|
||||
variable contextStack
|
||||
|
||||
+1
-2
@@ -2988,8 +2988,7 @@ proc ::tcl::clock::GetSystemTimeZone {} {
|
||||
set timezone $result
|
||||
} elseif {[set result [getenv TZ]] ne {}} {
|
||||
set timezone $result
|
||||
}
|
||||
if {![info exists timezone]} {
|
||||
} else {
|
||||
# Cache the time zone only if it was detected by one of the
|
||||
# expensive methods.
|
||||
if { [info exists CachedSystemTimeZone] } {
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
if {![package vsatisfies [package provide Tcl] 8.5-]} return
|
||||
if {[info sharedlibextension] != ".dll"} return
|
||||
package ifneeded dde 1.4.3 [list load [file join $dir tcldde14.dll]]
|
||||
if {[package vsatisfies [package provide Tcl] 9.0-]} {
|
||||
package ifneeded dde 1.4.4 \
|
||||
[list load [file join $dir tcl9dde14.dll] Dde]
|
||||
} elseif {![package vsatisfies [package provide Tcl] 8.7]
|
||||
&& [::tcl::pkgconfig get debug]} {
|
||||
package ifneeded dde 1.4.4 \
|
||||
[list load [file join $dir tcldde14g.dll] Dde]
|
||||
} else {
|
||||
package ifneeded dde 1.4.4 \
|
||||
[list load [file join $dir tcldde14.dll] Dde]
|
||||
}
|
||||
|
||||
+1
-1
@@ -442,7 +442,7 @@ proc auto_load_index {} {
|
||||
continue
|
||||
} else {
|
||||
set error [catch {
|
||||
fconfigure $f -encoding utf-8 -eofchar \032
|
||||
fconfigure $f -encoding utf-8 -eofchar "\032 {}"
|
||||
set id [gets $f]
|
||||
if {$id eq "# Tcl autoload index file, version 2.0"} {
|
||||
eval [read $f]
|
||||
|
||||
+3
-3
@@ -35,7 +35,7 @@ proc ::practcl::_pkgindex_directory {path} {
|
||||
# Read the file, and override assumptions as needed
|
||||
###
|
||||
set fin [open $file r]
|
||||
fconfigure $fin -encoding utf-8 -eofchar \032
|
||||
fconfigure $fin -encoding utf-8 -eofchar "\032 {}"
|
||||
set dat [read $fin]
|
||||
close $fin
|
||||
# Look for a teapot style Package statement
|
||||
@@ -59,7 +59,7 @@ proc ::practcl::_pkgindex_directory {path} {
|
||||
foreach file [glob -nocomplain $path/*.tcl] {
|
||||
if { [file tail $file] == "version_info.tcl" } continue
|
||||
set fin [open $file r]
|
||||
fconfigure $fin -encoding utf-8 -eofchar \032
|
||||
fconfigure $fin -encoding utf-8 -eofchar "\032 {}"
|
||||
set dat [read $fin]
|
||||
close $fin
|
||||
if {![regexp "package provide" $dat]} continue
|
||||
@@ -79,7 +79,7 @@ proc ::practcl::_pkgindex_directory {path} {
|
||||
return $buffer
|
||||
}
|
||||
set fin [open $pkgidxfile r]
|
||||
fconfigure $fin -encoding utf-8 -eofchar \032
|
||||
fconfigure $fin -encoding utf-8 -eofchar "\032 {}"
|
||||
set dat [read $fin]
|
||||
close $fin
|
||||
set trace 0
|
||||
|
||||
@@ -10,9 +10,9 @@ apply {{dir} {
|
||||
1 opt 0.4.8 {opt optparse.tcl}
|
||||
0 cookiejar 0.2.0 {cookiejar cookiejar.tcl}
|
||||
0 tcl::idna 1.0.1 {cookiejar idna.tcl}
|
||||
0 platform 1.0.15 {platform platform.tcl}
|
||||
0 platform 1.0.17 {platform platform.tcl}
|
||||
0 platform::shell 1.1.4 {platform shell.tcl}
|
||||
1 tcltest 2.5.3 {tcltest tcltest.tcl}
|
||||
1 tcltest 2.5.4 {tcltest tcltest.tcl}
|
||||
} {
|
||||
if {$isafe && !$safe} continue
|
||||
package ifneeded $package $version [list source [file join $dir {*}$file]]
|
||||
|
||||
@@ -601,7 +601,7 @@ proc ::tcl::OptCheckType {arg type {typeArgs ""}} {
|
||||
return [expr {$arg ? 1 : 0}]
|
||||
}
|
||||
choice {
|
||||
if {[lsearch -exact $typeArgs $arg] < 0} {
|
||||
if {$arg ni $typeArgs} {
|
||||
error "invalid choice"
|
||||
}
|
||||
return $arg
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package ifneeded platform 1.0.15 [list source [file join $dir platform.tcl]]
|
||||
package ifneeded platform 1.0.17 [list source [file join $dir platform.tcl]]
|
||||
package ifneeded platform::shell 1.1.4 [list source [file join $dir shell.tcl]]
|
||||
|
||||
|
||||
@@ -29,8 +29,10 @@
|
||||
# are on "Windows NT" or "Windows XP" or whatever.
|
||||
#
|
||||
# Machine specific
|
||||
# % amd64 -> x86_64
|
||||
# % arm* -> arm
|
||||
# % sun4* -> sparc
|
||||
# % ia32* -> ix86
|
||||
# % intel -> ix86
|
||||
# % i*86* -> ix86
|
||||
# % Power* -> powerpc
|
||||
@@ -71,6 +73,7 @@ proc ::platform::generic {} {
|
||||
set cpu sparc
|
||||
}
|
||||
intel -
|
||||
ia32* -
|
||||
i*86* {
|
||||
set cpu ix86
|
||||
}
|
||||
@@ -80,6 +83,7 @@ proc ::platform::generic {} {
|
||||
set cpu ix86
|
||||
}
|
||||
}
|
||||
ppc -
|
||||
"Power*" {
|
||||
set cpu powerpc
|
||||
}
|
||||
@@ -176,8 +180,9 @@ proc ::platform::identify {} {
|
||||
macosx {
|
||||
set major [lindex [split $tcl_platform(osVersion) .] 0]
|
||||
if {$major > 19} {
|
||||
incr major -20
|
||||
append plat 11.$major
|
||||
set minor [lindex [split $tcl_platform(osVersion) .] 1]
|
||||
incr major -9
|
||||
append plat $major.[expr {$minor - 1}]
|
||||
} else {
|
||||
incr major -4
|
||||
append plat 10.$major
|
||||
@@ -404,7 +409,7 @@ proc ::platform::patterns {id} {
|
||||
# ### ### ### ######### ######### #########
|
||||
## Ready
|
||||
|
||||
package provide platform 1.0.15
|
||||
package provide platform 1.0.17
|
||||
|
||||
# ### ### ### ######### ######### #########
|
||||
## Demo application
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
if {![package vsatisfies [package provide Tcl] 8.5-]} return
|
||||
if {[info sharedlibextension] != ".dll"} return
|
||||
package ifneeded registry 1.3.5 \
|
||||
[list load [file join $dir tclregistry13.dll]]
|
||||
if {[package vsatisfies [package provide Tcl] 9.0-]} {
|
||||
package ifneeded registry 1.3.6 \
|
||||
[list load [file join $dir tcl9registry13.dll] Registry]
|
||||
} else {
|
||||
package ifneeded registry 1.3.6 \
|
||||
[list load [file join $dir tclregistry13.dll] Registry]
|
||||
}
|
||||
|
||||
+13
-13
@@ -980,7 +980,7 @@ proc ::safe::AliasSource {child args} {
|
||||
set replacementMsg "script error"
|
||||
set code [catch {
|
||||
set f [open $realfile]
|
||||
fconfigure $f -encoding $encoding -eofchar \032
|
||||
fconfigure $f -encoding $encoding -eofchar "\032 {}"
|
||||
set contents [read $f]
|
||||
close $f
|
||||
::interp eval $child [list info script $file]
|
||||
@@ -1009,8 +1009,8 @@ proc ::safe::AliasLoad {child file args} {
|
||||
return -code error $msg
|
||||
}
|
||||
|
||||
# package name (can be empty if file is not).
|
||||
set package [lindex $args 0]
|
||||
# prefix (can be empty if file is not).
|
||||
set prefix [lindex $args 0]
|
||||
|
||||
namespace upvar ::safe [VarName $child] state
|
||||
|
||||
@@ -1022,23 +1022,23 @@ proc ::safe::AliasLoad {child file args} {
|
||||
# authorize that.
|
||||
if {!$state(nestedok)} {
|
||||
Log $child "loading to a sub interp (nestedok)\
|
||||
disabled (trying to load $package to $target)"
|
||||
disabled (trying to load $prefix to $target)"
|
||||
return -code error "permission denied (nested load)"
|
||||
}
|
||||
}
|
||||
|
||||
# Determine what kind of load is requested
|
||||
if {$file eq ""} {
|
||||
# static package loading
|
||||
if {$package eq ""} {
|
||||
set msg "load error: empty filename and no package name"
|
||||
# static loading
|
||||
if {$prefix eq ""} {
|
||||
set msg "load error: empty filename and no prefix"
|
||||
Log $child $msg
|
||||
return -code error $msg
|
||||
}
|
||||
if {!$state(staticsok)} {
|
||||
Log $child "static packages loading disabled\
|
||||
(trying to load $package to $target)"
|
||||
return -code error "permission denied (static package)"
|
||||
Log $child "static loading disabled\
|
||||
(trying to load $prefix to $target)"
|
||||
return -code error "permission denied (static library)"
|
||||
}
|
||||
} else {
|
||||
# file loading
|
||||
@@ -1061,10 +1061,10 @@ proc ::safe::AliasLoad {child file args} {
|
||||
}
|
||||
|
||||
try {
|
||||
return [::interp invokehidden $child load $file $package $target]
|
||||
return [::interp invokehidden $child load $file $prefix $target]
|
||||
} on error msg {
|
||||
# Some packages return no error message.
|
||||
set msg0 "load of binary library for package $package failed"
|
||||
# Some libraries return no error message.
|
||||
set msg0 "load of library for prefix $prefix failed"
|
||||
if {$msg eq {}} {
|
||||
set msg $msg0
|
||||
} else {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user