Compare commits

...
23 Commits
Author SHA1 Message Date
dkf dd45c8be9d Merge 8.7 2020-11-08 17:31:38 +00:00
dkf 40b3d4d5dd TIP 582: Comments in Expressions 2020-11-08 17:21:09 +00:00
dkf 25c115b5a8 Added badges to README 2020-11-08 13:38:20 +00:00
dkf d4ef5a261a Added experimental Windows CI build instructions 2020-11-08 13:34:03 +00:00
dkf 81a445ad46 Updated arrangement 2020-11-08 12:08:01 +00:00
dkf ca9f2d6210 Updated README 2020-11-07 14:29:06 +00:00
dkf 0b56647743 Updated workflow name 2020-11-07 14:21:15 +00:00
dkf f827fd2a9d Added basic github action starter 2020-11-07 14:14:17 +00:00
jan.nijtmans d60bc321ce Merge 8.6 2020-11-06 17:33:22 +00:00
jan.nijtmans 4404292972 Add MSVC "StaticPackage" build to travis. Fix another bug in winDde.test which didn't account for statically loaded dde package. 2020-11-06 17:17:41 +00:00
jan.nijtmans 82ffc550db Merge jn-module-names. Sorry Don, but this is 100% compatible! 2020-11-06 16:11:58 +00:00
jan.nijtmans 89e3b6811b Deprecate the (internal) functions TclGuessPackageName/TclGetLoadedPackages functions, since they turn out to be useless. The can be removed in 9.0 2020-11-06 14:43:48 +00:00
jan.nijtmans 3c53be5e75 Correct casing of "packageName" argument in Tcl_StaticPackage() call and "load" command (which - actually - is not a packageName at all ...)
UPDATE: I am moving this to a feature branch.  Changing the arguments passed to Tcl_StaticPackage will be an incompatible break for any scripts currently searching the [info loaded] list for "dde" or "registry".  Not a change we should put in a patchlevel without at least a ticket to record the explanation and a (POTENTIAL INCOMPATIBILITY) warning.
2020-11-06 13:32:39 +00:00
dkf b7efdfe9bc Merge 8.7 2020-11-01 14:25:49 +00:00
jan.nijtmans 3b0ee42270 Merge 8.6 2020-10-30 14:05:26 +00:00
jan.nijtmans f163c24b4c Simplify testcases using "incr" 2020-10-30 13:56:15 +00:00
jan.nijtmans 8f3e8012b1 Merge 8.6 2020-10-30 13:37:42 +00:00
jan.nijtmans 076a7e2839 Add "{}" around many "expr" commands in testcases. Also in doc/expr.n 2020-10-30 13:27:52 +00:00
jan.nijtmans 63855497af Merge 8.7 2020-10-24 14:50:11 +00:00
dkf fe94c1d6c4 Tricky case in function calls. 2020-08-24 13:31:00 +00:00
dkf 1192757fb7 Added two test cases 2020-08-24 08:56:34 +00:00
dkf c76cad8a92 Added documentation 2020-08-22 14:24:31 +00:00
dkf 42a34d459e Implementation of TIP 582: comments in expressions 2020-08-22 14:14:05 +00:00
69 changed files with 665 additions and 570 deletions
+37
View File
@@ -0,0 +1,37 @@
name: Linux Build and Test
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Configure
working-directory: unix
run: |
mkdir "${HOME}/install dir"
./configure ${CFGOPT} "--prefix=$HOME/install dir" || (cat config.log && exit 1)
- name: Build
working-directory: unix
run: |
make all
- name: Build Test Harness
working-directory: unix
run: |
make tcltest
- name: Run Tests
working-directory: unix
run: |
make test
- name: Test-Drive Installation
working-directory: unix
run: |
make install
- name: Create Distribution Package
working-directory: unix
run: |
make dist
- name: Convert Documentation to HTML
working-directory: unix
run: |
make html-tcl
+37
View File
@@ -0,0 +1,37 @@
name: Linux Build and Test
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Configure
working-directory: unix
run: |
mkdir "${HOME}/install dir"
./configure ${CFGOPT} "--prefix=$HOME/install dir" || (cat config.log && exit 1)
- name: Build
working-directory: unix
run: |
make all
- name: Build Test Harness
working-directory: unix
run: |
make tcltest
- name: Run Tests
working-directory: unix
run: |
make test
- name: Test-Drive Installation
working-directory: unix
run: |
make install
- name: Create Distribution Package
working-directory: unix
run: |
make dist
- name: Convert Documentation to HTML
working-directory: unix
run: |
make html-tcl
+22
View File
@@ -0,0 +1,22 @@
name: Windows Build and Test
on: [push]
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Init MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Build
working-directory: win
run: |
nmake -f makefile.vc all
- name: Build Test Harness
working-directory: win
run: |
nmake -f makefile.vc tcltest
- name: Run Tests
working-directory: win
run: |
nmake -f makefile.vc test
+15
View File
@@ -5,7 +5,22 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
+9
View File
@@ -259,6 +259,15 @@ jobs:
script:
- cmd.exe //C vcvarsall.bat x64 '&&' nmake 'OPTS=static,msvcrt' '-f' makefile.vc all tcltest
- cmd.exe //C vcvarsall.bat x64 '&&' nmake 'OPTS=static,msvcrt' '-f' makefile.vc test
- name: "Windows/MSVC/StaticPackage"
os: windows
compiler: cl
env: *vcenv
before_install: *vcpreinst
install: []
script:
- cmd.exe //C vcvarsall.bat x64 '&&' nmake 'OPTS=static,staticpkg,msvcrt' '-f' makefile.vc all tcltest
- cmd.exe //C vcvarsall.bat x64 '&&' nmake 'OPTS=static,staticpkg,msvcrt' '-f' makefile.vc test
- name: "Windows/MSVC/Debug"
os: windows
compiler: cl
+11 -1
View File
@@ -5,7 +5,17 @@ This is the **Tcl 8.7a4** source distribution.
You can get any source release of Tcl from [our distribution
site](https://sourceforge.net/projects/tcl/files/Tcl/).
[![Build Status](https://travis-ci.org/tcltk/tcl.svg?branch=core-8-branch)](https://travis-ci.org/tcltk/tcl)
8.6.10
[![Build Status](https://github.com/tcltk/tcl/workflows/Linux%20Build%20and%20Test/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tcl/actions?query=workflow%3A%22Linux+Build+and+Test%22+branch%3Acore-8-6-branch)
[![Build Status](https://github.com/tcltk/tcl/workflows/Windows%20Build%20and%20Test/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tcl/actions?query=workflow%3A%22Windows+Build+and+Test%22+branch%3Acore-8-6-branch)
<br>
8.7a4
[![Build Status](https://github.com/tcltk/tcl/workflows/Linux%20Build%20and%20Test/badge.svg?branch=core-8-branch)](https://github.com/tcltk/tcl/actions?query=workflow%3A%22Linux+Build+and+Test%22+branch%3Acore-8-branch)
[![Build Status](https://github.com/tcltk/tcl/workflows/Windows%20Build%20and%20Test/badge.svg?branch=core-8-branch)](https://github.com/tcltk/tcl/actions?query=workflow%3A%22Windows+Build+and+Test%22+branch%3Acore-8-branch)
<br>
9.0a2
[![Build Status](https://github.com/tcltk/tcl/workflows/Linux%20Build%20and%20Test/badge.svg?branch=main)](https://github.com/tcltk/tcl/actions?query=workflow%3A%22Linux+Build+and+Test%22+branch%3Amain)
[![Build Status](https://github.com/tcltk/tcl/workflows/Windows%20Build%20and%20Test/badge.svg?branch=main)](https://github.com/tcltk/tcl/actions?query=workflow%3A%22Windows+Build+and+Test%22+branch%3Amain)
## Contents
1. [Introduction](#intro)
+13 -4
View File
@@ -41,6 +41,12 @@ When an expression evaluates to an integer, the value is the decimal form of
the integer, and when an expression evaluates to a floating-point number, the
value is the form produced by the \fB%g\fR format specifier of Tcl's
\fBformat\fR command.
.PP
.VS "TIP 582"
You can use \fB#\fR at any point in the expression (except inside double
quotes or braces) to start a comment. Comments last to the end of the line or
the end of the expression, whichever comes first.
.VE "TIP 582"
.SS OPERANDS
.PP
An expression consists of a combination of operands, operators, parentheses and
@@ -82,9 +88,9 @@ produces the value on the right side.
.PP
.CS
.ta 9c
\fBexpr\fR 3.1 + $a \fI6.1\fR
\fBexpr\fR 2 + "$a.$b" \fI5.6\fR
\fBexpr\fR 4*[llength "6 2"] \fI8\fR
\fBexpr\fR {3.1 + $a} \fI6.1\fR
\fBexpr\fR {2 + "$a.$b"} \fI5.6\fR
\fBexpr\fR {4*[llength "6 2"]} \fI8\fR
\fBexpr\fR {{word one} < "word $a"} \fI0\fR
.CE
.PP
@@ -270,7 +276,7 @@ which means that operands are not evaluated if they are
not needed to determine the outcome. For example, in
.PP
.CS
\fBexpr\fR {$v ? [a] : [b]}
\fBexpr\fR {$v?[a]:[b]}
.CE
.PP
only one of \fB[a]\fR or \fB[b]\fR is evaluated,
@@ -487,7 +493,9 @@ value of true:
.PP
.CS
set isTrue [\fBexpr\fR {
# Does the environment variable exist, and...
[info exists ::env(SOME_ENV_VAR)] &&
# ...does it contain a proper true value?
[string is true -strict $::env(SOME_ENV_VAR)]
}]
.CE
@@ -510,4 +518,5 @@ Copyright \(co 2005 by Kevin B. Kenny <kennykb@acm.org>. All rights reserved.
.fi
'\" Local Variables:
'\" mode: nroff
'\" fill-column: 78
'\" End:
+48 -5
View File
@@ -164,6 +164,8 @@ enum Marks {
* "=" is encountered. */
#define 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
* expression, whichever comes first. */
/* Leaf lexemes */
@@ -462,7 +464,7 @@ static const unsigned char Lexeme[] = {
INVALID /* FS */, INVALID /* GS */,
INVALID /* RS */, INVALID /* US */,
INVALID /* SPACE */, 0 /* ! or != */,
QUOTED /* " */, INVALID /* # */,
QUOTED /* " */, 0 /* # */,
VARIABLE /* $ */, MOD /* % */,
0 /* & or && */, INVALID /* ' */,
OPEN_PAREN /* ( */, CLOSE_PAREN /* ) */,
@@ -674,9 +676,10 @@ ParseExpr(
OpNode *newPtr = NULL;
do {
if (size <= UINT_MAX/sizeof(OpNode)) {
newPtr = (OpNode *)attemptckrealloc(nodes, size * sizeof(OpNode));
}
if (size <= UINT_MAX/sizeof(OpNode)) {
newPtr = (OpNode *) attemptckrealloc(nodes,
size * sizeof(OpNode));
}
} while ((newPtr == NULL)
&& ((size -= (size - nodesUsed) / 2) > nodesUsed));
if (newPtr == NULL) {
@@ -708,6 +711,10 @@ ParseExpr(
int b;
switch (lexeme) {
case COMMENT:
start += scanned;
numBytes -= scanned;
continue;
case INVALID:
msg = Tcl_ObjPrintf("invalid character \"%.*s\"",
scanned, start);
@@ -742,6 +749,32 @@ ParseExpr(
} else if (Tcl_GetBooleanFromObj(NULL,literal,&b) == TCL_OK) {
lexeme = BOOLEAN;
} else {
/*
* Tricky case: see test expr-62.10
*/
int scanned2 = scanned;
do {
scanned2 += TclParseAllWhiteSpace(
start + scanned2, numBytes - scanned2);
scanned2 += ParseLexeme(
start + scanned2, numBytes - scanned2, &lexeme,
NULL);
} while (lexeme == COMMENT);
if (lexeme == OPEN_PAREN) {
/*
* Actually a function call, but with obscuring
* comments. Skip to the start of the parentheses.
* Note that we assume that open parentheses are one
* byte long.
*/
lexeme = FUNCTION;
Tcl_ListObjAppendElement(NULL, funcList, literal);
scanned = scanned2 - 1;
break;
}
Tcl_DecrRefCount(literal);
msg = Tcl_ObjPrintf("invalid bareword \"%.*s%s\"",
(scanned < limit) ? scanned : limit - 3, start,
@@ -1894,7 +1927,7 @@ ParseLexeme(
storage, if non-NULL. */
{
const char *end;
int scanned;
int scanned, size;
Tcl_UniChar ch = 0;
Tcl_Obj *literal = NULL;
unsigned char byte;
@@ -1909,6 +1942,16 @@ ParseLexeme(
return 1;
}
switch (byte) {
case '#':
/*
* Scan forward over the comment contents.
*/
for (size = 0; byte != '\n' && byte != 0 && size < numBytes; size++) {
byte = UCHAR(start[size]);
}
*lexemePtr = COMMENT;
return size - (byte == '\n');
case '*':
if ((numBytes > 1) && (start[1] == '*')) {
*lexemePtr = EXPON;
+5
View File
@@ -1413,4 +1413,9 @@ extern const TclIntStubs *tclIntStubsPtr;
# define Tcl_StaticPackage (tclIntStubsPtr->tclStaticPackage)
#endif
#undef TclGuessPackageName
#ifndef TCL_NO_DEPRECATED
# define TclGuessPackageName(fileName, pkgName) ((void)fileName,(void)pkgName,0)
#endif
#endif /* _TCLINTDECLS */
+43 -60
View File
@@ -302,60 +302,55 @@ Tcl_LoadObjCmd(
if (packageName != NULL) {
Tcl_DStringAppend(&pkgName, packageName, -1);
} else {
int retc;
Tcl_Obj *splitPtr, *pkgGuessPtr;
int pElements;
const char *pkgGuess;
/*
* Threading note - this call used to be protected by a mutex.
*/
retc = TclGuessPackageName(fullFileName, &pkgName);
if (!retc) {
Tcl_Obj *splitPtr, *pkgGuessPtr;
int pElements;
const char *pkgGuess;
/*
* The platform-specific code couldn't figure out the module
* name. Make a guess by taking the last element of the file
* name, stripping off any leading "lib", and then using all
* of the alphabetic and underline characters that follow
* that.
*/
/*
* The platform-specific code couldn't figure out the module
* name. Make a guess by taking the last element of the file
* name, stripping off any leading "lib", and then using all
* of the alphabetic and underline characters that follow
* that.
*/
splitPtr = Tcl_FSSplitPath(objv[1], &pElements);
Tcl_ListObjIndex(NULL, splitPtr, pElements -1, &pkgGuessPtr);
pkgGuess = Tcl_GetString(pkgGuessPtr);
if ((pkgGuess[0] == 'l') && (pkgGuess[1] == 'i')
&& (pkgGuess[2] == 'b')) {
pkgGuess += 3;
}
#ifdef __CYGWIN__
if ((pkgGuess[0] == 'c') && (pkgGuess[1] == 'y')
&& (pkgGuess[2] == 'g')) {
pkgGuess += 3;
}
#endif /* __CYGWIN__ */
for (p = pkgGuess; *p != 0; p += offset) {
offset = TclUtfToUniChar(p, &ch);
if ((ch > 0x100)
|| !(isalpha(UCHAR(ch)) /* INTL: ISO only */
|| (UCHAR(ch) == '_'))) {
break;
}
}
if (p == pkgGuess) {
Tcl_DecrRefCount(splitPtr);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't figure out package name for %s",
fullFileName));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LOAD",
"WHATPACKAGE", NULL);
code = TCL_ERROR;
goto done;
}
Tcl_DStringAppend(&pkgName, pkgGuess, p - pkgGuess);
Tcl_DecrRefCount(splitPtr);
splitPtr = Tcl_FSSplitPath(objv[1], &pElements);
Tcl_ListObjIndex(NULL, splitPtr, pElements -1, &pkgGuessPtr);
pkgGuess = Tcl_GetString(pkgGuessPtr);
if ((pkgGuess[0] == 'l') && (pkgGuess[1] == 'i')
&& (pkgGuess[2] == 'b')) {
pkgGuess += 3;
}
#ifdef __CYGWIN__
else if ((pkgGuess[0] == 'c') && (pkgGuess[1] == 'y')
&& (pkgGuess[2] == 'g')) {
pkgGuess += 3;
}
#endif /* __CYGWIN__ */
for (p = pkgGuess; *p != 0; p += offset) {
offset = TclUtfToUniChar(p, &ch);
if ((ch > 0x100)
|| !(isalpha(UCHAR(ch)) /* INTL: ISO only */
|| (UCHAR(ch) == '_'))) {
break;
}
}
if (p == pkgGuess) {
Tcl_DecrRefCount(splitPtr);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't figure out package name for %s",
fullFileName));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LOAD",
"WHATPACKAGE", NULL);
code = TCL_ERROR;
goto done;
}
Tcl_DStringAppend(&pkgName, pkgGuess, p - pkgGuess);
Tcl_DecrRefCount(splitPtr);
}
/*
@@ -1025,7 +1020,7 @@ Tcl_StaticPackage(
/*
*----------------------------------------------------------------------
*
* TclGetLoadedPackages, TclGetLoadedPackagesEx --
* TclGetLoadedPackagesEx --
*
* This function returns information about all of the files that are
* loaded (either in a particular interpreter, or for all interpreters).
@@ -1043,18 +1038,6 @@ Tcl_StaticPackage(
*----------------------------------------------------------------------
*/
int
TclGetLoadedPackages(
Tcl_Interp *interp, /* Interpreter in which to return information
* or error message. */
const char *targetName) /* Name of target interpreter or NULL. If
* NULL, return info about all interps;
* otherwise, just return info about this
* interpreter. */
{
return TclGetLoadedPackagesEx(interp, targetName, NULL);
}
int
TclGetLoadedPackagesEx(
Tcl_Interp *interp, /* Interpreter in which to return information
-30
View File
@@ -53,36 +53,6 @@ TclpDlopen(
return TCL_ERROR;
}
/*
*----------------------------------------------------------------------
*
* TclGuessPackageName --
*
* If the "load" command is invoked without providing a package name,
* this procedure is invoked to try to figure it out.
*
* Results:
* Always returns 0 to indicate that we couldn't figure out a package
* name; generic code will then try to guess the package from the file
* name. A return value of 1 would have meant that we figured out the
* package name and put it in bufPtr.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
TclGuessPackageName(
const char *fileName, /* Name of file containing package (already
* translated to local form if needed). */
Tcl_DString *bufPtr) /* Initialized empty dstring. Append package
* name to this if possible. */
{
return 0;
}
/*
* These functions are fallbacks if we somehow determine that the platform can
* do loading from memory but the user wishes to disable it. They just report
+22
View File
@@ -67,6 +67,8 @@
#undef TclWinNToHS
#undef TclStaticPackage
#undef Tcl_BackgroundError
#undef TclGuessPackageName
#undef TclGetLoadedPackages
#define TclStaticPackage Tcl_StaticPackage
#undef Tcl_UniCharToUtfDString
#undef Tcl_UtfToUniCharDString
@@ -261,8 +263,28 @@ mp_err TclBN_mp_mul_d(const mp_int *a, unsigned int b, mp_int *c) {
# define Tcl_ChannelCloseProc 0
# define Tcl_Close 0
# define Tcl_MacOSXOpenBundleResources 0
# define TclGuessPackageName 0
# define TclGetLoadedPackages 0
#else
#define TclGuessPackageName guessPackageName
static int TclGuessPackageName(
TCL_UNUSED(const char *),
TCL_UNUSED(Tcl_DString *)) {
return 0;
}
#define TclGetLoadedPackages getLoadedPackages
static int TclGetLoadedPackages(
Tcl_Interp *interp, /* Interpreter in which to return information
* or error message. */
const char *targetName) /* Name of target interpreter or NULL. If
* NULL, return info about all interps;
* otherwise, just return info about this
* interpreter. */
{
return TclGetLoadedPackagesEx(interp, targetName, NULL);
}
mp_err TclBN_mp_div_3(const mp_int *a, mp_int *c, unsigned int *d) {
mp_digit d2;
mp_err result = mp_div_d(a, 3, c, &d2);
+1 -1
View File
@@ -1,3 +1,3 @@
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] dde]
package ifneeded dde 1.4.3 [list load [file join $dir tcldde14.dll] Dde]
+1 -1
View File
@@ -1,4 +1,4 @@
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 tclreg13.dll] registry]
[list load [file join $dir tclreg13.dll] Registry]
+2 -2
View File
@@ -32,7 +32,7 @@ test append-1.3 {append command} {
test append-2.1 {long appends} {
set x ""
for {set i 0} {$i < 1000} {set i [expr $i+1]} {
for {set i 0} {$i < 1000} {incr i} {
append x "foobar "
}
set y "foobar"
@@ -158,7 +158,7 @@ test append-5.1 {long lappends} -setup {
if {$l != $size} {
return "length mismatch: should have been $size, was $l"
}
for {set i 0} {$i < $size} {set i [expr $i+1]} {
for {set i 0} {$i < $size} {incr i} {
set j [lindex $var $i]
if {$j ne "item $i"} {
return "element $i should have been \"item $i\", was \"$j\""
+2 -2
View File
@@ -41,7 +41,7 @@ test appendComp-1.3 {append command} {
test appendComp-2.1 {long appends} {
proc foo {} {
set x ""
for {set i 0} {$i < 1000} {set i [expr $i+1]} {
for {set i 0} {$i < 1000} {incr i} {
append x "foobar "
}
set y "foobar"
@@ -223,7 +223,7 @@ test appendComp-5.1 {long lappends} -setup {
}
} -body {
set x ""
for {set i 0} {$i < 300} {set i [expr $i+1]} {
for {set i 0} {$i < 300} {incr i} {
lappend x "item $i"
}
check $x 300
+2 -2
View File
@@ -40,8 +40,8 @@ namespace import -force blt::*
# Should be able to handle "proc" definitions, even if they are preceded by
# white space.
proc normal {x y} {return [expr $x+$y]}
proc indented {x y} {return [expr $x+$y]}
proc normal {x y} {return [expr {$x+$y}]}
proc indented {x y} {return [expr {$x+$y}]}
#
# Should be able to handle proc declarations within namespaces, even if they
+1 -1
View File
@@ -674,7 +674,7 @@ proc l3 {} {
# Do all tests once byte compiled and once with direct string evaluation
foreach noComp {0 1} {
if $noComp {
if {$noComp} {
interp alias {} run {} testevalex
set constraints testevalex
} else {
+10 -10
View File
@@ -3050,7 +3050,7 @@ test chan-io-30.13 {Tcl_Write crlf on block boundary, Tcl_Read auto} -setup {
string length [chan read $f]
} -cleanup {
chan close $f
} -result [expr 700*15+1]
} -result [expr {700*15 + 1}]
test chan-io-30.14 {Tcl_Write crlf on block boundary, Tcl_Read crlf} -setup {
file delete $path(test1)
} -body {
@@ -3067,7 +3067,7 @@ test chan-io-30.14 {Tcl_Write crlf on block boundary, Tcl_Read crlf} -setup {
string length [chan read $f]
} -cleanup {
chan close $f
} -result [expr 700*15+1]
} -result [expr {700*15 + 1}]
test chan-io-30.15 {Tcl_Write mixed, Tcl_Read auto} -setup {
file delete $path(test1)
} -body {
@@ -3909,7 +3909,7 @@ test chan-io-31.31 {Tcl_Write crlf on block boundary, Tcl_Gets crlf} -setup {
}
chan close $f
string length $c
} -result [expr 700*15+1]
} -result [expr {700*15 + 1}]
test chan-io-31.32 {Tcl_Write crlf on block boundary, Tcl_Gets auto} -setup {
file delete $path(test1)
set c ""
@@ -3929,7 +3929,7 @@ test chan-io-31.32 {Tcl_Write crlf on block boundary, Tcl_Gets auto} -setup {
}
chan close $f
string length $c
} -result [expr 700*15+1]
} -result [expr {700*15 + 1}]
# Test Tcl_Read and buffering.
@@ -5340,7 +5340,7 @@ test chan-io-40.2 {POSIX open access modes: CREAT} -setup {
} -constraints {unix} -body {
set f [open $path(test3) {WRONLY CREAT} 0600]
file stat $path(test3) stats
set x [format "%#o" [expr $stats(mode)&0o777]]
set x [format "%#o" [expr {$stats(mode) & 0o777}]]
chan puts $f "line 1"
chan close $f
set f [open $path(test3) r]
@@ -5354,7 +5354,7 @@ test chan-io-40.3 {POSIX open access modes: CREAT} -setup {
# This test only works if your umask is 2, like ouster's.
chan close [open $path(test3) {WRONLY CREAT}]
file stat $path(test3) stats
format "%#o" [expr $stats(mode)&0o777]
format "%#o" [expr {$stats(mode) & 0o777}]
} -result [format %#5o [expr {0o666 & ~ $umaskValue}]]
test chan-io-40.4 {POSIX open access modes: CREAT} -setup {
file delete $path(test3)
@@ -6721,7 +6721,7 @@ test chan-io-52.6 {TclCopyChannel} -setup {
set f2 [open $path(test1) w]
chan configure $f1 -translation lf -blocking 0
chan configure $f2 -translation lf -blocking 0
set s0 [chan copy $f1 $f2 -size [expr [file size $thisScript] + 5]]
set s0 [chan copy $f1 $f2 -size [expr {[file size $thisScript] + 5}]]
set result [list [chan configure $f1 -blocking] [chan configure $f2 -blocking]]
chan close $f1
chan close $f2
@@ -6963,7 +6963,7 @@ test chan-io-53.5 {CopyData: error during chan copy} {socket fcopy} {
chan close $listen ;# This means the socket open never really succeeds
chan copy $in $out -command [namespace code FcopyTestDone]
variable fcopyTestDone
if ![info exists fcopyTestDone] {
if {![info exists fcopyTestDone]} {
vwait [namespace which -variable fcopyTestDone] ;# The error occurs here in the b.g.
}
chan close $in
@@ -6983,7 +6983,7 @@ test chan-io-53.6 {CopyData: error during chan copy} -setup {
set out [open $path(test1) w]
chan copy $in $out -command [namespace code FcopyTestDone]
variable fcopyTestDone
if ![info exists fcopyTestDone] {
if {![info exists fcopyTestDone]} {
vwait [namespace which -variable fcopyTestDone]
}
return $fcopyTestDone ;# 0 for plain end of file
@@ -7036,7 +7036,7 @@ test chan-io-53.7 {CopyData: Flooding chan copy from pipe} -setup {
vwait [namespace which -variable fcopyTestDone]
}
# -1=error 0=script error N=number of bytes
expr ($fcopyTestDone == 0) ? $fcopyTestCount : -1
expr {($fcopyTestDone == 0) ? $fcopyTestCount : -1}
} -cleanup {
catch {chan close $in}
chan close $out
+3 -3
View File
@@ -35436,7 +35436,7 @@ test clock-32.1 {scan/format across the Gregorian change} {
# clock clicks
test clock-33.1 {clock clicks tests} {
expr [clock clicks]+1
expr {[clock clicks] + 1}
concat {}
} {}
test clock-33.2 {clock clicks tests} {
@@ -35449,7 +35449,7 @@ test clock-33.3 {clock clicks tests} {
list [catch {clock clicks foo} msg] $msg
} {1 {bad option "foo": must be -milliseconds or -microseconds}}
test clock-33.4 {clock clicks tests} {
expr [clock clicks -milliseconds]+1
expr {[clock clicks -milliseconds] + 1}
concat {}
} {}
test clock-33.4a {clock milliseconds} {
@@ -35905,7 +35905,7 @@ test clock-34.68 {clock scan tests (merid and TZ)} {
# clock seconds
test clock-35.1 {clock seconds tests} {
expr [clock seconds]+1
expr {[clock seconds] + 1}
concat {}
} {}
test clock-35.2 {clock seconds tests} {
+1 -1
View File
@@ -1093,7 +1093,7 @@ test cmdAH-23.4 {Tcl_FileObjCmd: lstat} -setup {
unset -nocomplain stat
} -constraints {unix nonPortable} -body {
file lstat $linkfile stat
list $stat(nlink) [expr $stat(mode)&0777] $stat(type)
list $stat(nlink) [expr {$stat(mode) & 0o777}] $stat(type)
} -result {1 511 link}
test cmdAH-23.5 {Tcl_FileObjCmd: lstat errors} {nonPortable} {
list [catch {file lstat _bogus_ stat} msg] [string tolower $msg] \
+1 -1
View File
@@ -514,7 +514,7 @@ test cmdIL-5.5 {lsort with list style index and sharing} -body {
foreach e $l {lappend n [list [expr {rand()}] $e]}
lindex [lsort -real -index $l $n] 1 1
}
expr srand(1)
expr {srand(1)}
test_lsort 0
} -result 0 -cleanup {
rename test_lsort ""
+38 -2
View File
@@ -308,7 +308,7 @@ test compExpr-4.9 {CompileCondExpr procedure, error in "false" clause} {
} {0 15}
test compExpr-5.1 {CompileMathFuncCall procedure, math function found} {
format %.6g [expr atan2(1.0, 2.0)]
format %.6g [expr {atan2(1.0, 2.0)}]
} 0.463648
test compExpr-5.2 {CompileMathFuncCall procedure, math function not found} -body {
expr {do_it()}
@@ -317,7 +317,7 @@ test compExpr-5.5 {CompileMathFuncCall procedure, not enough arguments} -body {
expr {atan2(1.0)}
} -returnCodes error -match glob -result {not enough arguments for math function*}
test compExpr-5.6 {CompileMathFuncCall procedure, complex argument} {
format %.6g [expr pow(2.1, 27.5-(24.4*(5%2)))]
format %.6g [expr {pow(2.1, 27.5-(24.4*(5%2)))}]
} 9.97424
test compExpr-5.7 {CompileMathFuncCall procedure, error in argument} -body {
expr {sinh(2.*)}
@@ -371,10 +371,46 @@ test compExpr-7.2 {[Bug 1869989]: expr parser memleak} -constraints memory -setu
unset end i tmp
rename getbytes {}
} -result 0
proc extract {opcodes descriptor} {
set instructions [dict values [dict get $descriptor instructions]]
return [lmap i $instructions {
if {[lindex $i 0] in $opcodes} {string cat $i} else continue
}]
}
test compExpr-8.1 {TIP 582: expression comments} -setup {} -body {
extract {loadStk add} [tcl::unsupported::getbytecode script {expr {
$abc
# + $def
+ $ghi
}}]
} -result {loadStk loadStk add}
test compExpr-8.2 {TIP 582: expression comments} -setup {} -body {
extract {loadStk add} [tcl::unsupported::getbytecode script {expr {
$abc
# + $def
# + $ghi }}]
} -result loadStk
test compExpr-8.3 {TIP 582: expression comments} -setup {} -body {
extract {loadStk add} [tcl::unsupported::getbytecode script {expr {
$abc
# + $def\
+ $ghi
}}]
} -result loadStk
test compExpr-8.4 {TIP 582: expression comments} -setup {} -body {
extract {loadStk add} [tcl::unsupported::getbytecode script {expr {
$abc
# + $def\\
+ $ghi
}}]
} -result {loadStk loadStk add}
# cleanup
catch {unset a}
catch {unset b}
catch {rename extract ""}
::tcltest::cleanupTests
return
+4 -4
View File
@@ -204,7 +204,7 @@ test compile-4.1 {TclCompileForCmd: command substituted test expression} {
set i 0
set j 0
# Should be "forever"
for {} [expr $i < 3] {} {
for {} [expr {$i < 3}] {} {
set j [incr i]
if {$j > 3} break
}
@@ -278,7 +278,7 @@ test compile-7.1 {TclCompileWhileCmd: command substituted test expression} {
set i 0
set j 0
# Should be "forever"
while [expr $i < 3] {
while [expr {$i < 3}] {
set j [incr i]
if {$j > 3} break
}
@@ -337,7 +337,7 @@ test compile-11.6 {Tcl_Append*: ensure Tcl_ResetResult is used properly} -body {
apply {{} { set r [list foobar] ; incr}}
} -returnCodes error -result {wrong # args: should be "incr varName ?increment?"}
test compile-11.7 {Tcl_Append*: ensure Tcl_ResetResult is used properly} -body {
apply {{} { set r [list foobar] ; expr !a }}
apply {{} { set r [list foobar] ; expr [concat !a] }}
} -returnCodes error -match glob -result *
test compile-11.8 {Tcl_Append*: ensure Tcl_ResetResult is used properly} -body {
apply {{} { set r [list foobar] ; expr {!a} }}
@@ -566,7 +566,7 @@ test compile-15.5 {proper TCL_RETURN code from [return]} {
# Do all tests once byte compiled and once with direct string evaluation
foreach noComp {0 1} {
if $noComp {
if {$noComp} {
interp alias {} run {} testevalex
set constraints testevalex
} else {
+15 -15
View File
@@ -821,49 +821,49 @@ test execute-7.10 {Wide int handling in INST_MOD} {
expr {((wide(1)<<60)-1) % 0x400000000}
} 17179869183
test execute-7.11 {Wide int handling in INST_LSHIFT} {
expr wide(42)<<30
expr {wide(42) << 30}
} 45097156608
test execute-7.12 {Wide int handling in INST_LSHIFT} {
expr 12345678901<<3
expr {12345678901 << 3}
} 98765431208
test execute-7.13 {Wide int handling in INST_RSHIFT} {
expr 0x543210febcda9876>>7
expr {0x543210febcda9876 >> 7}
} 47397893236700464
test execute-7.14 {Wide int handling in INST_RSHIFT} {
expr wide(0x9876543210febcda)>>7
expr {wide(0x9876543210febcda) >> 7}
} -58286587177206407
test execute-7.15 {Wide int handling in INST_BITOR} {
expr wide(0x9876543210febcda) | 0x543210febcda9876
expr {wide(0x9876543210febcda) | 0x543210febcda9876}
} -2560765885044310786
test execute-7.16 {Wide int handling in INST_BITXOR} {
expr wide(0x9876543210febcda) ^ 0x543210febcda9876
expr {wide(0x9876543210febcda) ^ 0x543210febcda9876}
} -3727778945703861076
test execute-7.17 {Wide int handling in INST_BITAND} {
expr wide(0x9876543210febcda) & 0x543210febcda9876
expr {wide(0x9876543210febcda) & 0x543210febcda9876}
} 1167013060659550290
test execute-7.18 {Wide int handling in INST_ADD} {
expr wide(0x7fffffff)+wide(0x7fffffff)
expr {wide(0x7fffffff) + wide(0x7fffffff)}
} 4294967294
test execute-7.19 {Wide int handling in INST_ADD} {
expr 0x7fffffff+wide(0x7fffffff)
expr {0x7fffffff + wide(0x7fffffff)}
} 4294967294
test execute-7.20 {Wide int handling in INST_ADD} {
expr wide(0x7fffffff)+0x7fffffff
expr {wide(0x7fffffff) + 0x7fffffff}
} 4294967294
test execute-7.21 {Wide int handling in INST_ADD} {
expr double(0x7fffffff)+wide(0x7fffffff)
expr {double(0x7fffffff) + wide(0x7fffffff)}
} 4294967294.0
test execute-7.22 {Wide int handling in INST_ADD} {
expr wide(0x7fffffff)+double(0x7fffffff)
expr {wide(0x7fffffff) + double(0x7fffffff)}
} 4294967294.0
test execute-7.23 {Wide int handling in INST_SUB} {
expr 0x123456789a-0x20406080a
expr {0x123456789a - 0x20406080a}
} 69530054800
test execute-7.24 {Wide int handling in INST_MULT} {
expr 0x123456789a*193
expr {0x123456789a * 193}
} 15090186251290
test execute-7.25 {Wide int handling in INST_DIV} {
expr 0x123456789a/193
expr {0x123456789a / 193}
} 405116546
test execute-7.26 {Wide int handling in INST_UPLUS} {
set x 0x123456871234568
+1 -1
View File
@@ -524,7 +524,7 @@ test expr-old-26.10b {error conditions} ieeeFloatingPoint {
list [catch {expr 2.0/0.0} msg] $msg
} {0 Inf}
test expr-old-26.11 {error conditions} -body {
expr 2#
expr 2`
} -returnCodes error -match glob -result *
test expr-old-26.12 {error conditions} -body {
expr a.b
+61
View File
@@ -7384,6 +7384,67 @@ foreach v1 $values r1 $results {
}
}
unset -nocomplain values results ctr
test expr-62.1 {TIP 582: comments} -body {
expr {1 # + 2}
} -result 1
test expr-62.2 {TIP 582: comments} -body {
expr "1 #\n+ 2"
} -result 3
test expr-62.3 {TIP 582: comments} -setup {
set ctr 0
} -body {
expr {
# This is a demonstration of a comment
1 + 2 + 3
# and another comment
+ 4 + 5
# + [incr ctr]
+ [incr ctr]
}
} -result 16
# Buggy because line breaks aren't tracked inside expressions at all
test expr-62.4 {TIP 582: comments don't hide line breaks} -setup {
proc getline {} {
dict get [info frame -1] line
}
set base [getline]
} -constraints knownBug -body {
expr {
0
# a comment
+ [getline] - $base
}
} -cleanup {
rename getline ""
} -result 5
test expr-62.5 {TIP 582: comments don't splice tokens} {
set a False
expr {$a#don't splice
ne#don't splice
false}
} 1
test expr-62.6 {TIP 582: comments don't splice tokens} {
expr {0x2#don't splice
ne#don't splice
2}
} 1
test expr-62.7 {TIP 582: comments can go inside function calls} {
expr {max(1,# comment
2)}
} 2
test expr-62.8 {TIP 582: comments can go inside function calls} {
expr {max(1# comment
,2)}
} 2
test expr-62.9 {TIP 582: comments can go inside function calls} {
expr {max(# comment
1,2)}
} 2
test expr-62.10 {TIP 582: comments can go inside function calls} {
expr {max# comment
(1,2)}
} 2
# cleanup
unset -nocomplain a
+7 -7
View File
@@ -22,23 +22,23 @@ if {"::tcltest" ni [namespace children]} {
catch {unset a i}
test for-old-1.1 {for tests} {
set a {}
for {set i 1} {$i<6} {set i [expr $i+1]} {
for {set i 1} {$i<6} {incr i} {
set a [concat $a $i]
}
set a
} {1 2 3 4 5}
test for-old-1.2 {for tests} {
set a {}
for {set i 1} {$i<6} {set i [expr $i+1]} {
if $i==4 continue
for {set i 1} {$i<6} {incr i} {
if {$i==4} continue
set a [concat $a $i]
}
set a
} {1 2 3 5}
test for-old-1.3 {for tests} {
set a {}
for {set i 1} {$i<6} {set i [expr $i+1]} {
if $i==4 break
for {set i 1} {$i<6} {incr i} {
if {$i==4} break
set a [concat $a $i]
}
set a
@@ -55,12 +55,12 @@ test for-old-1.7 {for tests} {
} {wrong # args: should be "for start test next command"}
test for-old-1.8 {for tests} {
set a {xyz}
for {set i 1} {$i<6} {set i [expr $i+1]} {}
for {set i 1} {$i<6} {incr i} {}
set a
} xyz
test for-old-1.9 {for tests} {
set a {}
for {set i 1} {$i<6} {set i [expr $i+1]; if $i==4 break} {
for {set i 1} {$i<6} {incr i; if {$i==4} break} {
set a [concat $a $i]
}
set a
+31 -31
View File
@@ -62,15 +62,15 @@ test for-1.8 {TclCompileForCmd: error compiling command body} -body {
catch {unset a}
test for-1.9 {TclCompileForCmd: simple command body} {
set a {}
for {set i 1} {$i<6} {set i [expr $i+1]} {
if $i==4 break
for {set i 1} {$i<6} {incr i} {
if {$i==4} break
set a [concat $a $i]
}
set a
} {1 2 3}
test for-1.10 {TclCompileForCmd: command body in quotes} {
set a {}
for {set i 1} {$i<6} {set i [expr $i+1]} "append a x"
for {set i 1} {$i<6} {incr i} "append a x"
set a
} {xxxxx}
test for-1.11 {TclCompileForCmd: computed command body} {
@@ -81,7 +81,7 @@ test for-1.11 {TclCompileForCmd: computed command body} {
set bb {break}
set x2 {; append a x2}
set a {}
for {set i 1} {$i<6} {set i [expr $i+1]} $x1$bb$x2
for {set i 1} {$i<6} {incr i} $x1$bb$x2
set a
} {x1}
test for-1.12 {TclCompileForCmd: error in "next" command} -body {
@@ -92,9 +92,9 @@ test for-1.12 {TclCompileForCmd: error in "next" command} -body {
"set"*}
test for-1.13 {TclCompileForCmd: long command body} {
set a {}
for {set i 1} {$i<6} {set i [expr $i+1]} {
if $i==4 break
if $i>5 continue
for {set i 1} {$i<6} {incr i} {
if {$i==4} break
if {$i>5} continue
if {$i>6 && $tcl_platform(machine)=="xxx"} {
catch {set a $a} msg
catch {incr i 5} msg
@@ -129,7 +129,7 @@ test for-1.14 {TclCompileForCmd: for command result} {
set a
} {}
test for-1.15 {TclCompileForCmd: for command result} {
set a [for {set i 0} {$i < 5} {incr i} {if $i==3 break}]
set a [for {set i 0} {$i < 5} {incr i} {if {$i==3} break}]
set a
} {}
@@ -144,7 +144,7 @@ test for-2.2 {TclCompileContinueCmd: continue result} {
} 4
test for-2.3 {continue tests} {
set a {}
for {set i 1} {$i <= 4} {set i [expr $i+1]} {
for {set i 1} {$i <= 4} {incr i} {
if {$i == 2} continue
set a [concat $a $i]
}
@@ -152,7 +152,7 @@ test for-2.3 {continue tests} {
} {1 3 4}
test for-2.4 {continue tests} {
set a {}
for {set i 1} {$i <= 4} {set i [expr $i+1]} {
for {set i 1} {$i <= 4} {incr i} {
if {$i != 2} continue
set a [concat $a $i]
}
@@ -170,10 +170,10 @@ test for-2.5 {continue tests, nested loops} {
} {1.1 1.2 2.1 3.1 4.1}
test for-2.6 {continue tests, long command body} {
set a {}
for {set i 1} {$i<6} {set i [expr $i+1]} {
if $i==2 continue
if $i==4 break
if $i>5 continue
for {set i 1} {$i<6} {incr i} {
if {$i==2} continue
if {$i==4} break
if {$i>5} continue
if {$i>6 && $tcl_platform(machine)=="xxx"} {
catch {set a $a} msg
catch {incr i 5} msg
@@ -246,10 +246,10 @@ test for-3.4 {break tests, nested loops} {
} {1.1 1.2 2.1 3.1 4.1}
test for-3.5 {break tests, long command body} {
set a {}
for {set i 1} {$i<6} {set i [expr $i+1]} {
if $i==2 continue
if $i==5 break
if $i>5 continue
for {set i 1} {$i<6} {incr i} {
if {$i==2} continue
if {$i==5} break
if {$i>5} continue
if {$i>6 && $tcl_platform(machine)=="xxx"} {
catch {set a $a} msg
catch {incr i 5} msg
@@ -265,7 +265,7 @@ test for-3.5 {break tests, long command body} {
catch {incr i 5} msg
catch {incr i -5} msg
}
if $i==4 break
if {$i==4} break
if {$i>6 && $tcl_platform(machine)=="xxx"} {
catch {set a $a} msg
catch {incr i 5} msg
@@ -386,7 +386,7 @@ proc formatMail {} {
continue
}
}
if $inheaders {
if {$inheaders} {
set limit 55
} else {
set limit 55
@@ -430,12 +430,12 @@ proc formatMail {} {
continue
}
}
set climit [expr $limit-1]
set climit [expr {$limit-1}]
set cutoff 50
set continuation 0
while {[string length $line] > $limit} {
for {set c [expr $limit-1]} {$c >= $cutoff} {incr c -1} {
for {set c [expr {$limit-1}]} {$c >= $cutoff} {incr c -1} {
set char [string index $line $c]
if {$char == " " || $char == "\t"} {
break
@@ -446,7 +446,7 @@ proc formatMail {} {
}
if {$c < $cutoff} {
if {! $inheaders} {
set c [expr $limit-1]
set c [expr {$limit-1}]
} else {
set c [string length $line]
}
@@ -585,7 +585,7 @@ Tcl/Tk Shop. Check it out!
test for-4.1 {break must reset the interp result} {
catch {
set z GLOBTESTDIR/dir2/file2.c
if [string match GLOBTESTDIR/dir2/* $z] {
if {[string match GLOBTESTDIR/dir2/* $z]} {
break
}
} j
@@ -696,8 +696,8 @@ test for-6.9 {Tcl_ForObjCmd: error executing command body} -body {
test for-6.10 {Tcl_ForObjCmd: simple command body} {
set z for
set a {}
$z {set i 1} {$i<6} {set i [expr $i+1]} {
if $i==4 break
$z {set i 1} {$i<6} {incr i} {
if {$i==4} break
set a [concat $a $i]
}
set a
@@ -705,7 +705,7 @@ test for-6.10 {Tcl_ForObjCmd: simple command body} {
test for-6.11 {Tcl_ForObjCmd: command body in quotes} {
set z for
set a {}
$z {set i 1} {$i<6} {set i [expr $i+1]} "append a x"
$z {set i 1} {$i<6} {incr i} "append a x"
set a
} {xxxxx}
test for-6.12 {Tcl_ForObjCmd: computed command body} {
@@ -717,7 +717,7 @@ test for-6.12 {Tcl_ForObjCmd: computed command body} {
set bb {break}
set x2 {; append a x2}
set a {}
$z {set i 1} {$i<6} {set i [expr $i+1]} $x1$bb$x2
$z {set i 1} {$i<6} {incr i} $x1$bb$x2
set a
} {x1}
test for-6.13 {Tcl_ForObjCmd: error in "next" command} -body {
@@ -733,9 +733,9 @@ test for-6.13 {Tcl_ForObjCmd: error in "next" command} -body {
test for-6.14 {Tcl_ForObjCmd: long command body} {
set z for
set a {}
$z {set i 1} {$i<6} {set i [expr $i+1]} {
if $i==4 break
if $i>5 continue
$z {set i 1} {$i<6} {incr i} {
if {$i==4} break
if {$i>5} continue
if {$i>6 && $tcl_platform(machine)=="xxx"} {
catch {set a $a} msg
catch {incr i 5} msg
+10 -8
View File
@@ -40,7 +40,7 @@ test history-1.1 {event option} history {history event -1} \
{set b [format {A test %s} string]}
test history-1.2 {event option} history {history event $num} \
{set a 12345}
test history-1.3 {event option} history {history event [expr $num+2]} \
test history-1.3 {event option} history {history event [expr {$num+2}]} \
{Another test}
test history-1.4 {event option} history {history event set} \
{set b [format {A test %s} string]}
@@ -149,11 +149,11 @@ test history-5.1 {info option} history {history info} [format {%6d set a {b
%6d set b 1234
%6d set c {a
b
c}} $num [expr $num+1] [expr $num+2]]
c}} $num [expr {$num+1}] [expr {$num+2}]]
test history-5.2 {info option} history {history i 2} [format {%6d set b 1234
%6d set c {a
b
c}} [expr $num+1] [expr $num+2]]
c}} [expr {$num+1}] [expr {$num+2}]]
test history-5.3 {info option} history {catch {history i 2 3}} 1
test history-5.4 {info option} history {
catch {history i 2 3} msg
@@ -164,7 +164,7 @@ test history-5.5 {info option} history {history} [format {%6d set a {b
%6d set b 1234
%6d set c {a
b
c}} $num [expr $num+1] [expr $num+2]]
c}} $num [expr {$num+1}] [expr {$num+2}]]
# "history keep"
@@ -174,7 +174,9 @@ if {[testConstraint history]} {
history add "foo3"
history keep 2
}
test history-6.1 {keep option} history {history event [expr [history n]-1]} foo3
test history-6.1 {keep option} history {
history event [expr {[history n]-1}]
} foo3
test history-6.2 {keep option} history {history event -1} foo2
test history-6.3 {keep option} history {catch {history event -3}} 1
test history-6.4 {keep option} history {
@@ -216,7 +218,7 @@ if {[testConstraint history]} {
history add "Testing2"
}
test history-7.1 {nextid option} history {history event} "Testing"
test history-7.2 {nextid option} history {history next} [expr $num+2]
test history-7.2 {nextid option} history {history next} [expr {$num+2}]
test history-7.3 {nextid option} history {catch {history nextid garbage}} 1
test history-7.4 {nextid option} history {
catch {history nextid garbage} msg
@@ -262,7 +264,7 @@ test history-10.1 {references kept by history} -constraints history -setup {
} -body {
histtest eval {
# A fresh object, refcount 1 from the variable we write it to
set obj [expr rand()]
set obj [expr {rand()}]
set baseline [refcount $obj]
lappend result [refcount $obj]
history add [list list $obj]
@@ -288,7 +290,7 @@ test history-10.2 {references kept by history} -constraints history -setup {
} -body {
histtest eval {
# A fresh object, refcount 1 from the variable we write it to
set obj [expr rand()]
set obj [expr {rand()}]
set baseline [refcount $obj]
lappend result [refcount $obj]
history add [list list $obj]
+1 -1
View File
@@ -124,7 +124,7 @@ test http-3.2 {http::geturl} -returnCodes error -body {
http::geturl http:junk
} -result {Unsupported URL: http:junk}
set url //${::HOST}:$port
set badurl //${::HOST}:[expr $port+1]
set badurl //${::HOST}:[expr {$port+1}]
test http-3.3 {http::geturl} -body {
set token [http::geturl $url]
http::data $token
+24 -24
View File
@@ -142,7 +142,7 @@ test if-1.16 {TclCompileIfCmd: test jumpFalse instruction replacement after long
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 2
@@ -165,7 +165,7 @@ test if-1.16 {TclCompileIfCmd: test jumpFalse instruction replacement after long
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 3
@@ -239,7 +239,7 @@ test if-2.5 {TclCompileIfCmd: test jumpFalse instruction replacement after long
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 2
@@ -262,7 +262,7 @@ test if-2.5 {TclCompileIfCmd: test jumpFalse instruction replacement after long
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 3
@@ -287,7 +287,7 @@ test if-2.5 {TclCompileIfCmd: test jumpFalse instruction replacement after long
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 5
@@ -310,7 +310,7 @@ test if-2.5 {TclCompileIfCmd: test jumpFalse instruction replacement after long
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 6
@@ -389,7 +389,7 @@ test if-3.6 {TclCompileIfCmd: test jumpFalse instruction replacement after long
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 2
@@ -412,7 +412,7 @@ test if-3.6 {TclCompileIfCmd: test jumpFalse instruction replacement after long
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 3
@@ -437,7 +437,7 @@ test if-3.6 {TclCompileIfCmd: test jumpFalse instruction replacement after long
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 5
@@ -460,7 +460,7 @@ test if-3.6 {TclCompileIfCmd: test jumpFalse instruction replacement after long
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 6
@@ -485,7 +485,7 @@ test if-3.6 {TclCompileIfCmd: test jumpFalse instruction replacement after long
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 8
@@ -508,7 +508,7 @@ test if-3.6 {TclCompileIfCmd: test jumpFalse instruction replacement after long
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 9
@@ -713,7 +713,7 @@ test if-5.16 {if cmd with computed command names: test jumpFalse instruction rep
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 2
@@ -736,7 +736,7 @@ test if-5.16 {if cmd with computed command names: test jumpFalse instruction rep
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 3
@@ -816,7 +816,7 @@ test if-6.5 {if cmd with computed command names: test jumpFalse instruction repl
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 2
@@ -839,7 +839,7 @@ test if-6.5 {if cmd with computed command names: test jumpFalse instruction repl
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 3
@@ -864,7 +864,7 @@ test if-6.5 {if cmd with computed command names: test jumpFalse instruction repl
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 5
@@ -887,7 +887,7 @@ test if-6.5 {if cmd with computed command names: test jumpFalse instruction repl
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 6
@@ -975,7 +975,7 @@ test if-7.6 {if cmd with computed command names: test jumpFalse instruction repl
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 2
@@ -998,7 +998,7 @@ test if-7.6 {if cmd with computed command names: test jumpFalse instruction repl
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 3
@@ -1023,7 +1023,7 @@ test if-7.6 {if cmd with computed command names: test jumpFalse instruction repl
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 5
@@ -1046,7 +1046,7 @@ test if-7.6 {if cmd with computed command names: test jumpFalse instruction repl
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 6
@@ -1071,7 +1071,7 @@ test if-7.6 {if cmd with computed command names: test jumpFalse instruction repl
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 8
@@ -1094,7 +1094,7 @@ test if-7.6 {if cmd with computed command names: test jumpFalse instruction repl
set i $i
set i [lindex $s $i]
}
set i [expr $i-1]
incr i -1
}
}
set a 9
+1 -1
View File
@@ -325,7 +325,7 @@ test info-9.2 {info level option} {
} {1 {t1 146 testString}}
test info-9.3 {info level option} {
proc t1 {a b} {
t2 [expr $a*2] $b
t2 [expr {$a*2}] $b
}
proc t2 {x y} {
list [info level] [info level 1] [info level 2] [info level -1] \
+22 -22
View File
@@ -105,7 +105,7 @@ test interp-2.11 {anonymous interps vs existing procs} {
proc interp$thenum {} {}
set x [interp create]
regexp "interp(\[0-9]+)" $x dummy anothernum
expr $anothernum > $thenum
expr {$anothernum > $thenum}
} 1
test interp-2.12 {anonymous interps vs existing procs} {
set x [interp create -safe]
@@ -114,7 +114,7 @@ test interp-2.12 {anonymous interps vs existing procs} {
proc interp$thenum {} {}
set x [interp create -safe]
regexp "interp(\[0-9]+)" $x dummy anothernum
expr $anothernum - $thenum
expr {$anothernum - $thenum}
} 1
test interp-2.13 {correct default when no $path arg is given} -body {
interp create --
@@ -224,22 +224,22 @@ interp create a
# Part 5: Testing eval in interpreter object command and with interp command
test interp-6.1 {testing eval} {
a eval expr 3 + 5
a eval expr {{3 + 5}}
} 8
test interp-6.2 {testing eval} -returnCodes error -body {
a eval foo
} -result {invalid command name "foo"}
test interp-6.3 {testing eval} {
a eval {proc foo {} {expr 3 + 5}}
a eval {proc foo {} {expr {3 + 5}}}
a eval foo
} 8
catch {a eval {proc foo {} {expr 3 + 5}}}
catch {a eval {proc foo {} {expr {3 + 5}}}}
test interp-6.4 {testing eval} {
interp eval a foo
} 8
test interp-6.5 {testing eval} {
interp create {a x2}
interp eval {a x2} {proc frob {} {expr 4 * 9}}
interp eval {a x2} {proc frob {} {expr {4 * 9}}}
interp eval {a x2} frob
} 36
catch {interp create {a x2}}
@@ -746,7 +746,7 @@ test interp-16.5 {testing deletion order, bgerror} {
xxx eval {proc bgerror {args} {exit}}
xxx alias exit kill xxx
proc kill {i} {interp delete $i}
xxx eval after 100 expr a + b
xxx eval after 100 expr {a + b}
after 200
update
interp exists xxx
@@ -966,7 +966,7 @@ test interp-19.9 {alias deletion, renaming} {
interp create a
interp alias a foo a bar
interp eval a rename foo blotz
interp eval a {proc foo {} {expr 34 * 34}}
interp eval a {proc foo {} {expr {34 * 34}}}
interp alias a foo {}
set l [interp eval a foo]
interp delete a
@@ -3171,7 +3171,7 @@ test interp-34.3.1 {basic test of limits - pure inside-command loop} -body {
}
}
# We use a time limit here; command limits don't trap this case
$i limit time -seconds [expr {[clock seconds]+2}]
$i limit time -seconds [expr {[clock seconds] + 2}]
$i eval foobar
} -returnCodes error -result {time limit exceeded} -cleanup {
interp delete $i
@@ -3193,8 +3193,8 @@ test interp-34.4 {limits with callbacks: extending limits} -setup {
} -body {
interp alias $i foo {} cb1
set curlim [$i eval info cmdcount]
$i limit command -command "cb2 [expr $curlim+100]" \
-value [expr {$curlim+10}]
$i limit command -command "cb2 [expr {$curlim + 100}]" \
-value [expr {$curlim + 10}]
$i eval {for {set i 0} {$i<10} {incr i} {foo}}
list $a $b $c
} -result {6 4 b} -cleanup {
@@ -3222,7 +3222,7 @@ test interp-34.5 {limits with callbacks: removing limits} -setup {
} -body {
interp alias $i foo {} cb1
set curlim [$i eval info cmdcount]
$i limit command -command "cb2 {}" -value [expr {$curlim+10}]
$i limit command -command "cb2 {}" -value [expr {$curlim + 10}]
$i eval {for {set i 0} {$i<10} {incr i} {foo}}
list $a $b $c
} -result {6 4 b} -cleanup {
@@ -3247,7 +3247,7 @@ test interp-34.6 {limits with callbacks: removing limits and handlers} -setup {
} -body {
interp alias $i foo {} cb1
set curlim [$i eval info cmdcount]
$i limit command -command cb2 -value [expr {$curlim+10}]
$i limit command -command cb2 -value [expr {$curlim + 10}]
$i eval {for {set i 0} {$i<10} {incr i} {foo}}
list $a $b $c
} -result {6 4 b} -cleanup {
@@ -3266,7 +3266,7 @@ test interp-34.7 {limits with callbacks: deleting the handler interp} -setup {
proc cb2 {args} {
global c i curlim
set c b
$i limit command -value [expr {$curlim+1000}]
$i limit command -value [expr {$curlim + 1000}]
trapToParent
}
}
@@ -3289,7 +3289,7 @@ test interp-34.7 {limits with callbacks: deleting the handler interp} -setup {
set c a
interp alias $i foo {} cb1
set curlim [$i eval info cmdcount]
$i limit command -command cb2 -value [expr {$curlim+10}]
$i limit command -command cb2 -value [expr {$curlim + 10}]
}
$i eval {
$i eval {
@@ -3304,7 +3304,7 @@ test interp-34.7 {limits with callbacks: deleting the handler interp} -setup {
# Bug 1085023
test interp-34.8 {time limits trigger in vwaits} -body {
set i [interp create]
interp limit $i time -seconds [expr {[clock seconds]+1}] -granularity 1
interp limit $i time -seconds [expr {[clock seconds] + 1}] -granularity 1
$i eval {
set x {}
vwait x
@@ -3352,8 +3352,8 @@ test interp-34.11 {time limit extension in callbacks} -setup {
} -body {
set i [interp create]
set t0 [clock seconds]
$i limit time -seconds [expr {$t0+1}] -granularity 1 \
-command "cb1 $i [expr {$t0+2}]"
$i limit time -seconds [expr {$t0 + 1}] -granularity 1 \
-command "cb1 $i [expr {$t0 + 2}]"
set ::result {}
lappend ::result [catch {
$i eval {
@@ -3380,8 +3380,8 @@ test interp-34.12 {time limit extension in callbacks} -setup {
} -body {
set i [interp create]
set t0 [clock seconds]
set ::times "[expr {$t0+2}] [expr {$t0+100}]"
$i limit time -seconds [expr {$t0+1}] -granularity 1 -command "cb1 $i"
set ::times "[expr {$t0 + 2}] [expr {$t0 + 100}]"
$i limit time -seconds [expr {$t0 + 1}] -granularity 1 -command "cb1 $i"
set ::result {}
lappend ::result [catch {
$i eval {
@@ -3615,8 +3615,8 @@ test interp-37.1 {safe interps and min() and max(): Bug 2895741} -setup {
set result {}
} -body {
interp create {a b} -safe
lappend result [interp eval a {expr min(5,2,3)*max(7,13,11)}]
lappend result [interp eval {a b} {expr min(5,2,3)*max(7,13,11)}]
lappend result [interp eval a {expr {min(5,2,3)*max(7,13,11)}}]
lappend result [interp eval {a b} {expr {min(5,2,3)*max(7,13,11)}}]
} -cleanup {
unset -nocomplain result
interp delete a
+3 -3
View File
@@ -7578,7 +7578,7 @@ test io-53.5 {CopyData: error during fcopy} {socket fcopy} {
close $listen ;# This means the socket open never really succeeds
fcopy $in $out -command [namespace code FcopyTestDone]
variable fcopyTestDone
if ![info exists fcopyTestDone] {
if {![info exists fcopyTestDone]} {
vwait [namespace which -variable fcopyTestDone] ;# The error occurs here in the b.g.
}
close $in
@@ -7597,7 +7597,7 @@ test io-53.6 {CopyData: error during fcopy} {stdio fcopy} {
set out [open $path(test1) w]
fcopy $in $out -command [namespace code FcopyTestDone]
variable fcopyTestDone
if ![info exists fcopyTestDone] {
if {![info exists fcopyTestDone]} {
vwait [namespace which -variable fcopyTestDone]
}
catch {close $in}
@@ -7644,7 +7644,7 @@ test io-53.7 {CopyData: Flooding fcopy from pipe} {stdio fcopy} {
set out [open $path(test1) w]
doFcopy $in $out
variable fcopyTestDone
if ![info exists fcopyTestDone] {
if {![info exists fcopyTestDone]} {
vwait [namespace which -variable fcopyTestDone]
}
catch {close $in}
+7 -7
View File
@@ -98,26 +98,26 @@ concat {}
proc slowsort list {
set result {}
set last [expr [llength $list] - 1]
set last [expr {[llength $list] - 1}]
while {$last > 0} {
set minIndex [expr [llength $list] - 1]
set minIndex [expr {[llength $list] - 1}]
set min [lindex $list $last]
set i [expr $minIndex-1]
set i [expr {$minIndex - 1}]
while {$i >= 0} {
if {[string compare [lindex $list $i] $min] < 0} {
set minIndex $i
set min [lindex $list $i]
}
set i [expr $i-1]
incr i -1
}
set result [concat $result [list $min]]
if {$minIndex == 0} {
set list [lrange $list 1 end]
} else {
set list [concat [lrange $list 0 [expr $minIndex-1]] \
[lrange $list [expr $minIndex+1] end]]
set list [concat [lrange $list 0 [expr {$minIndex - 1}]] \
[lrange $list [expr {$minIndex + 1}] end]]
}
set last [expr $last-1]
set last [expr {$last - 1}]
}
return [concat $result $list]
}
+60 -58
View File
@@ -45,30 +45,30 @@ testConstraint teststaticpkg [llength [info commands teststaticpkg]]
testConstraint testsimplefilesystem \
[llength [info commands testsimplefilesystem]]
test load-1.1 {basic errors} {} {
list [catch {load} msg] $msg
} "1 {wrong \# args: should be \"load ?-global? ?-lazy? ?--? fileName ?packageName? ?interp?\"}"
test load-1.2 {basic errors} {} {
list [catch {load a b c d} msg] $msg
} "1 {wrong \# args: should be \"load ?-global? ?-lazy? ?--? fileName ?packageName? ?interp?\"}"
test load-1.3 {basic errors} {} {
list [catch {load a b foobar} msg] $msg
} {1 {could not find interpreter "foobar"}}
test load-1.4 {basic errors} {} {
list [catch {load -global {}} msg] $msg
} {1 {must specify either file name or package name}}
test load-1.5 {basic errors} {} {
list [catch {load -lazy {} {}} msg] $msg
} {1 {must specify either file name or package name}}
test load-1.6 {basic errors} {} {
list [catch {load {} Unknown} msg] $msg
} {1 {package "Unknown" isn't loaded statically}}
test load-1.7 {basic errors} {} {
list [catch {load -abc foo} msg] $msg
} "1 {bad option \"-abc\": must be -global, -lazy, or --}"
test load-1.8 {basic errors} {} {
list [catch {load -global} msg] $msg
} "1 {couldn't figure out package name for -global}"
test load-1.1 {basic errors} -returnCodes error -body {
load
} -result {wrong # args: should be "load ?-global? ?-lazy? ?--? fileName ?packageName? ?interp?"}
test load-1.2 {basic errors} -returnCodes error -body {
load a b c d
} -result {wrong # args: should be "load ?-global? ?-lazy? ?--? fileName ?packageName? ?interp?"}
test load-1.3 {basic errors} -returnCodes error -body {
load a b foobar
} -result {could not find interpreter "foobar"}
test load-1.4 {basic errors} -returnCodes error -body {
load -global {}
} -result {must specify either file name or package name}
test load-1.5 {basic errors} -returnCodes error -body {
load -lazy {} {}
} -result {must specify either file name or package name}
test load-1.6 {basic errors} -returnCodes error -body {
load {} Unknown
} -result {package "Unknown" isn't loaded statically}
test load-1.7 {basic errors} -returnCodes error -body {
load -abc foo
} -result {bad option "-abc": must be -global, -lazy, or --}
test load-1.8 {basic errors} -returnCodes error -body {
load -global
} -result {couldn't figure out package name for -global}
test load-2.1 {basic loading, with guess for package name} \
[list $dll $loaded] {
@@ -130,16 +130,16 @@ test load-4.2 {reloading package into same interpreter} -setup {
load [file join $testDir pkga$ext] pkgb
} -result "file \"[file join $testDir pkga$ext]\" is already loaded for package \"Pkga\""
test load-5.1 {file name not specified and no static package: pick default} \
[list $dll $loaded] {
test load-5.1 {file name not specified and no static package: pick default} -setup {
catch {interp delete x}
interp create x
} -constraints [list $dll $loaded] -body {
load -global [file join $testDir pkga$ext] pkga
load {} pkga x
set result [info loaded x]
info loaded x
} -cleanup {
interp delete x
set result
} [list [list [file join $testDir pkga$ext] Pkga]]
} -result [list [list [file join $testDir pkga$ext] Pkga]]
# On some platforms, like SunOS 4.1.3, these tests can't be run because
# they cause the process to exit.
@@ -185,16 +185,16 @@ test load-7.4 {Tcl_StaticPackage procedure, redundant calls} -setup {
info loaded
} -result [list {{} Double} {{} More} {{} Another} {{} Test} {*}$currentRealPackages {*}$alreadyTotalLoaded]
testConstraint teststaticpkg_8.x \
[if {[testConstraint teststaticpkg]} {
testConstraint teststaticpkg_8.x 0
if {[testConstraint teststaticpkg]} {
catch {
teststaticpkg Test 1 1
teststaticpkg Another 0 1
teststaticpkg More 0 1
teststaticpkg Double 0 1
expr 1
} else {
expr 0
}]
testConstraint teststaticpkg_8.x 1
}
}
test load-8.1 {TclGetLoadedPackages procedure} [list teststaticpkg_8.x $dll $loaded] {
lsort -index 1 [info loaded]
@@ -214,30 +214,32 @@ test load-8.4 {TclGetLoadedPackages procedure} [list teststaticpkg_8.x $dll $loa
} [list [lsort -index 1 [concat [list [list [file join $testDir pkgb$ext] Pkgb] {{} Double} {{} More} {{} Another} {{} Test} [list [file join $testDir pkga$ext] Pkga]] $alreadyLoaded]] {pkgb_demo pkgb_sub pkgb_unsafe}]
interp delete child
test load-9.1 {Tcl_StaticPackage, load already-loaded package into another interp} \
-constraints {teststaticpkg} \
-setup {
interp create child1
interp create child2
load {} Tcltest child1
load {} Tcltest child2
} \
-body {
child1 eval { teststaticpkg Loadninepointone 0 1 }
child2 eval { teststaticpkg Loadninepointone 0 1 }
list \
[child1 eval { info loaded {} }] \
[child2 eval { info loaded {} }]
} \
-match glob -result {{{{} Loadninepointone} {* Tcltest}} {{{} Loadninepointone} {* Tcltest}}} \
-cleanup { interp delete child1 ; interp delete child2 }
test load-9.1 {Tcl_StaticPackage, load already-loaded package into another interp} -setup {
interp create child1
interp create child2
load {} Tcltest child1
load {} Tcltest child2
} -constraints {teststaticpkg} -body {
child1 eval { teststaticpkg Loadninepointone 0 1 }
child2 eval { teststaticpkg Loadninepointone 0 1 }
list [child1 eval { info loaded {} }] \
[child2 eval { info loaded {} }]
} -match glob -cleanup {
interp delete child1
interp delete child2
} -result {{{{} Loadninepointone} {* Tcltest}} {{{} Loadninepointone} {* Tcltest}}}
test load-10.1 {load from vfs} \
-constraints [list $dll $loaded testsimplefilesystem] \
-setup {set dir [pwd]; cd $testDir; testsimplefilesystem 1} \
-body {list [catch {load simplefs:/pkgd$ext pkgd} msg] $msg} \
-result {0 {}} \
-cleanup {testsimplefilesystem 0; cd $dir; unset dir}
test load-10.1 {load from vfs} -setup {
set dir [pwd]
cd $testDir
testsimplefilesystem 1
} -constraints [list $dll $loaded testsimplefilesystem] -body {
list [catch {load simplefs:/pkgd$ext pkgd} msg] $msg
} -result {0 {}} -cleanup {
testsimplefilesystem 0
cd $dir
unset dir
}
test load-11.1 {Load TclOO extension using Stubs (Bug [f51efe99a7])} \
[list $dll $loaded] {
+1 -1
View File
@@ -384,7 +384,7 @@ test lsearch-14.8 {combinations: -start, -inline and -not} {
} {c4}
test lsearch-15.1 {make sure no shimmering occurs} {
set x [expr int(sin(0))]
set x [expr {int(sin(0))}]
lsearch -start $x $x $x
} 0
+3 -3
View File
@@ -901,10 +901,10 @@ test mathop-22.2 { bitwise ops on bignums } {
set exp {}
foreach d {5 7 2 1 D C 1 F E 0 -D -D 8 -9 -1 -0 -E E} {
if {[string match "-*" $d]} {
set d [format %X [expr 15-0x[string range $d 1 end]]]
set val [expr -0x[string repeat $d $dig]-1]
set d [format %X [expr {15-"0x[string range $d 1 end]"}]]
set val [expr {-"0x[string repeat $d $dig]"-1}]
} else {
set val [expr 0x[string repeat $d $dig]]
set val [expr {"0x[string repeat $d $dig]"}]
}
lappend exp $val
}
+2 -2
View File
@@ -749,13 +749,13 @@ test namespace-old-9.14 {imported commands can be removed} {
} {{} 1 {invalid command name "cmd1"}}
test namespace-old-9.15 {existing commands can't be overwritten} {
proc cmd1 {x y} {
return [expr $x+$y]
return [expr {$x+$y}]
}
list [catch {namespace import test_ns_import::cmd?} msg] $msg \
[cmd1 3 5]
} {1 {can't import command "cmd1": already exists} 8}
test namespace-old-9.16 {use "-force" option to override existing commands} {
proc cmd1 {x y} { return [expr $x+$y] }
proc cmd1 {x y} { return [expr {$x+$y}] }
list [cmd1 3 5] \
[namespace import -force test_ns_import::cmd?] \
[cmd1 3 5]
+4 -4
View File
@@ -1967,7 +1967,7 @@ test oo-13.5 {OO: changing an object's class: non-class to class} -setup {
class oo::class
}
oo::define fooObj {
method x {} {expr 1+2+3}
method x {} {expr {1+2+3}}
}
[fooObj new] x
} -cleanup {
@@ -1979,7 +1979,7 @@ test oo-13.6 {OO: changing an object's class: class to non-class} -setup {
} -body {
set result dangling
oo::define foo {
method x {} {expr 1+2+3}
method x {} {expr {1+2+3}}
}
oo::class create boo {
superclass foo
@@ -2002,7 +2002,7 @@ test oo-13.7 {OO: changing an object's class} -setup {
} -body {
oo::define bar method x {} {return ok}
oo::define foo {
method x {} {expr 1+2+3}
method x {} {expr {1+2+3}}
self mixin foo
}
lappend result [foo x]
@@ -2016,7 +2016,7 @@ test oo-13.8 {OO: changing an object's class to itself} -setup {
oo::class create foo
} -body {
oo::define foo {
method x {} {expr 1+2+3}
method x {} {expr {1+2+3}}
}
oo::objdefine foo class foo
} -cleanup {
+2 -2
View File
@@ -27,8 +27,8 @@ package require opt 0.4.8
set n $::tcl::OptDescN
test opt-1.1 {OptKeyRegister / check that auto allocation is skipping existing keys} {
list [::tcl::OptKeyRegister {} $n] [::tcl::OptKeyRegister {} [expr $n+1]] [::tcl::OptKeyRegister {}]
} "$n [expr $n+1] [expr $n+2]"
list [::tcl::OptKeyRegister {} $n] [::tcl::OptKeyRegister {} [expr {$n+1}]] [::tcl::OptKeyRegister {}]
} "$n [expr {$n+1}] [expr {$n+2}]"
test opt-2.1 {OptKeyDelete} {
list [::tcl::OptKeyRegister {} testkey] \
+2 -2
View File
@@ -481,7 +481,7 @@ test parse-10.2 {Tcl_EvalTokens, backslash sequences} testevalex {
testevalex {concat test\063\062test}
} {test32test}
test parse-10.3 {Tcl_EvalTokens, nested commands} testevalex {
testevalex {concat [expr 2 + 6]}
testevalex {concat [expr {2 + 6}]}
} {8}
test parse-10.4 {Tcl_EvalTokens, nested commands} testevalex {
unset -nocomplain a
@@ -499,7 +499,7 @@ test parse-10.6 {Tcl_EvalTokens, array variables} testevalex {
test parse-10.7 {Tcl_EvalTokens, array variables} testevalex {
unset -nocomplain a
set a(12) 46
testevalex {concat $a(1[expr 3 - 1])}
testevalex {concat $a(1[expr {3 - 1}])}
} {46}
test parse-10.8 {Tcl_EvalTokens, array variables} testevalex {
unset -nocomplain a
+8
View File
@@ -1075,6 +1075,14 @@ test parseExpr-22.21 {Bug d2ffcca163} -constraints testexprparser -body {
testexprparser in\u0433(0) -1
} -returnCodes error -match glob -result {missing operand*}
test parseExpr-23.1 {TIP 582: comments} -constraints testexprparser -body {
testexprparser "7 # * 8 " -1
} -result {- {} 0 subexpr 7 1 text 7 0 {}}
test parseExpr-23.2 {TIP 582: comments} -constraints testexprparser -body {
testexprparser "7 #\n* 8 " -1
} -result {- {} 0 subexpr {7 #
*} 5 operator # 0 subexpr 7 1 text 7 0 subexpr * 1 text * 0 {}}
# cleanup
cleanupTests
return
+1 -1
View File
@@ -135,7 +135,7 @@ format %s $b
} a22b
test parseOld-4.4 {command substitution} {
set a 7.7
if [catch {expr int($a)}] {set a foo}
if {[catch {expr {int($a)}}]} {set a foo}
set a
} 7.7
+6 -6
View File
@@ -315,7 +315,7 @@ namespace eval pkg2 {
namespace export p2-1
}
proc pkg2::p2-1 { num } {
return [expr $num * 2]
return [expr {$num * 2}]
}
} [file join pkg pkg2_a.tcl]
@@ -328,7 +328,7 @@ namespace eval pkg2 {
namespace export p2-2
}
proc pkg2::p2-2 { num } {
return [expr $num * 3]
return [expr {$num * 3}]
}
} [file join pkg pkg2_b.tcl]
@@ -409,10 +409,10 @@ namespace eval pkg3 {
namespace export p3-1 p3-2
}
proc pkg3::p3-1 { num } {
return {[expr $num * 2]}
return {[expr {$num * 2}]}
}
proc pkg3::p3-2 { num } {
return {[expr $num * 3]}
return {[expr {$num * 3}]}
}
} [file join pkg pkg3.tcl]
@@ -520,10 +520,10 @@ namespace eval circ2 {
namespace export c2-1 c2-2
}
proc circ2::c2-1 { num } {
return [expr $num * [circ3::c3-1]]
return [expr {$num * [circ3::c3-1]}]
}
proc circ2::c2-2 { num } {
return [expr $num * [circ3::c3-2]]
return [expr {$num * [circ3::c3-2]}]
}
} [file join pkg circ2.tcl]
+6 -6
View File
@@ -25,7 +25,7 @@ catch {rename foo ""}
proc tproc {} {return a; return b}
test proc-old-1.1 {simple procedure call and return} {tproc} a
proc tproc x {
set x [expr $x+1]
set x [expr {$x + 1}]
return $x
}
test proc-old-1.2 {simple procedure call and return} {tproc 2} 3
@@ -49,7 +49,7 @@ test proc-old-1.6 {simple procedure call and return (shared proc body string)} {
test proc-old-2.1 {local and global variables} {
proc tproc x {
set x [expr $x+1]
set x [expr {$x + 1}]
return $x
}
set x 42
@@ -57,7 +57,7 @@ test proc-old-2.1 {local and global variables} {
} {7 42}
test proc-old-2.2 {local and global variables} {
proc tproc x {
set y [expr $x+1]
set y [expr {$x + 1}]
return $y
}
set y 18
@@ -66,7 +66,7 @@ test proc-old-2.2 {local and global variables} {
test proc-old-2.3 {local and global variables} {
proc tproc x {
global y
set y [expr $x+1]
set y [expr {$x + 1}]
return $y
}
set y 189
@@ -75,7 +75,7 @@ test proc-old-2.3 {local and global variables} {
test proc-old-2.4 {local and global variables} {
proc tproc x {
global y
return [expr $x+$y]
return [expr {$x + $y}]
}
set y 189
list [tproc 6] $y
@@ -504,7 +504,7 @@ test proc-old-10.1 {ByteCode epoch change during recursive proc execution} {
set y 20
rename expr expr.old
rename expr.old expr
if $x then {t1 0} ;# recursive call after foo's code is invalidated
if {$x} then {t1 0} ;# recursive call after foo's code is invalidated
return 20
}
t1 1
+1 -1
View File
@@ -100,7 +100,7 @@ test proc-1.7 {Tcl_ProcObjCmd, check that formal parameter names are not array e
catch {rename p ""}
} -returnCodes error -body {
proc p {a(1) a(2)} {
set z [expr $a(1)+$a(2)]
set z [expr {$a(1)+$a(2)}]
puts "$z=z, $a(1)=$a(1)"
}
} -result {formal parameter "a(1)" is an array element}
+3 -2
View File
@@ -20,9 +20,10 @@ test pwd-1.1 {simple pwd} {
catch pwd
} 0
test pwd-1.2 {simple pwd} {
expr [string length pwd]>0
expr {[string length [pwd]]>0}
} 1
test pwd-1.3 {pwd takes no args} -body {
test pwd-2.1 {pwd takes no args} -body {
pwd foobar
} -returnCodes error -result "wrong \# args: should be \"pwd\""
+4 -4
View File
@@ -91,8 +91,8 @@ if {![info exists serverPort]} {
if {![info exists serverPort]} {
for {set i 0} {$i < $argc} {incr i} {
if {[string compare -port [lindex $argv $i]] == 0} {
if {$i < [expr $argc - 1]} {
set serverPort [lindex $argv [expr $i + 1]]
if {$i < $argc - 1} {
set serverPort [lindex $argv [expr {$i + 1}]]
}
break
}
@@ -110,8 +110,8 @@ if {![info exists serverAddress]} {
if {![info exists serverAddress]} {
for {set i 0} {$i < $argc} {incr i} {
if {[string compare -address [lindex $argv $i]] == 0} {
if {$i < [expr $argc - 1]} {
set serverAddress [lindex $argv [expr $i + 1]]
if {$i < $argc - 1} {
set serverAddress [lindex $argv [expr {$i + 1}]]
}
break
}
+2 -2
View File
@@ -69,7 +69,7 @@ if {"::tcltest" ni [namespace children]} {
catch [list package require -exact Tcltest [info patchlevel]]
::tcltest::loadTestedCommands
if {[expr {[info exists ::env(TRAVIS_OSX_IMAGE)] && [string match xcode* $::env(TRAVIS_OSX_IMAGE)]}]} {
if {[info exists ::env(TRAVIS_OSX_IMAGE)] && [string match xcode* $::env(TRAVIS_OSX_IMAGE)]} {
return
}
testConstraint notWine [expr {$::tcl_platform(platform) ne "windows" || ![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
@@ -969,7 +969,7 @@ test socket_$af-6.1 {accept callback error} -constraints [list socket supported_
}
close $f
set f [open "|[list [interpreter] $path(script)]" r+]
proc accept {s a p} {expr 10 / 0}
proc accept {s a p} {expr {10 / 0}}
set s [socket -server accept -myaddr $localhost 0]
puts $f [lindex [fconfigure $s -sockname] 2]
close $f
+6 -6
View File
@@ -132,20 +132,20 @@ test subst-7.3 {switches} -returnCodes error -body {
} -result {bad option "-bogus": must be -nobackslashes, -nocommands, or -novariables}
test subst-7.4 {switches} {
set x 123
subst -nobackslashes {abc $x [expr 1+2] \\\x41}
subst -nobackslashes {abc $x [expr {1 + 2}] \\\x41}
} {abc 123 3 \\\x41}
test subst-7.5 {switches} {
set x 123
subst -nocommands {abc $x [expr 1+2] \\\x41}
} {abc 123 [expr 1+2] \A}
subst -nocommands {abc $x [expr {1 + 2}] \\\x41}
} {abc 123 [expr {1 + 2}] \A}
test subst-7.6 {switches} {
set x 123
subst -novariables {abc $x [expr 1+2] \\\x41}
subst -novariables {abc $x [expr {1 + 2}] \\\x41}
} {abc $x 3 \A}
test subst-7.7 {switches} {
set x 123
subst -nov -nob -noc {abc $x [expr 1+2] \\\x41}
} {abc $x [expr 1+2] \\\x41}
subst -nov -nob -noc {abc $x [expr {1 + 2}] \\\x41}
} {abc $x [expr {1 + 2}] \\\x41}
test subst-8.1 {return in a subst} {
subst {foo [return {x}; bogus code] bar}
+1 -1
View File
@@ -1444,7 +1444,7 @@ test tcltest-23.2 {removeFile} {
file mkdir $mfdir
makeFile {} t1.tmp
makeFile {} et1.tmp $mfdir
if {![file exists [file join [temporaryDirectory] t1.tmp]] || \
if {![file exists [file join [temporaryDirectory] t1.tmp]] || \
![file exists [file join $mfdir et1.tmp]]} {
error "file creation didn't work"
}
+2 -2
View File
@@ -2314,8 +2314,8 @@ test trace-28.10 {exec trace info nonsense} {
} {1 {wrong # args: should be "trace remove execution name opList command"}}
test trace-29.1 {Tcl_CreateTrace, correct command and argc/argv arguments of trace proc} {testcmdtrace} {
testcmdtrace tracetest {set stuff [expr 14 + 16]}
} {{expr 14 + 16} {expr 14 + 16} {set stuff [expr 14 + 16]} {set stuff 30}}
testcmdtrace tracetest {set stuff [expr {14 + 16}]}
} {{expr {14 + 16}} {expr {14 + 16}} {set stuff [expr {14 + 16}]} {set stuff 30}}
test trace-29.2 {Tcl_CreateTrace, correct command and argc/argv arguments of trace proc} {testcmdtrace} {
testcmdtrace tracetest {set stuff [info tclversion]}
} [concat {{info tclversion} {info tclversion} ::tcl::info::tclversion {::tcl::info::tclversion} {set stuff [info tclversion]}} [list "set stuff [info tclversion]"]]
-3
View File
@@ -38,9 +38,6 @@ testConstraint $loaded [expr {![string match *pkgua* $alreadyLoaded]}]
set alreadyTotalLoaded [info loaded]
# Certain tests require the 'teststaticpkg' command from tcltest
testConstraint teststaticpkg [llength [info commands teststaticpkg]]
# Certain tests need the 'testsimplefilsystem' in tcltest
testConstraint testsimplefilesystem \
[llength [info commands testsimplefilesystem]]
+1 -1
View File
@@ -17,7 +17,7 @@ if {"::tcltest" ni [namespace children]} {
}
proc a {x y} {
newset z [expr $x+$y]
newset z [expr {$x + $y}]
return $z
}
proc newset {name value} {
+1 -1
View File
@@ -452,7 +452,7 @@ test var-7.4 {Tcl_VariableObjCmd, list of vars} -setup {
variable three 3 four 4
}
list [lsort [info vars test_ns_var::*]] \
[namespace eval test_ns_var {expr $three+$four}]
[namespace eval test_ns_var {expr {$three+$four}}]
} -result [list [lsort {::test_ns_var::four ::test_ns_var::three ::test_ns_var::two ::test_ns_var::one}] 7]
test var-7.5 {Tcl_VariableObjCmd, value for last var is optional} -setup {
catch {unset a}
+4 -4
View File
@@ -20,7 +20,7 @@ if {"::tcltest" ni [namespace children]} {
test while-old-1.1 {basic while loops} {
set count 0
while {$count < 10} {set count [expr $count+1]}
while {$count < 10} {set count [expr {$count + 1}]}
set count
} 10
test while-old-1.2 {basic while loops} {
@@ -58,9 +58,9 @@ test while-old-2.1 {continue in while loop} {
set index 0
set result {}
while {$index < 5} {
if {$index == 2} {set index [expr $index+1]; continue}
if {$index == 2} {set index [expr {$index + 1}]; continue}
set result [concat $result [lindex $list $index]]
set index [expr $index+1]
set index [expr {$index + 1}]
}
set result
} {1 2 4 5}
@@ -72,7 +72,7 @@ test while-old-3.1 {break in while loop} {
while {$index < 5} {
if {$index == 3} break
set result [concat $result [lindex $list $index]]
set index [expr $index+1]
set index [expr {$index + 1}]
}
set result
} {1 2 3}
+22 -22
View File
@@ -77,7 +77,7 @@ test while-1.9 {TclCompileWhileCmd: simple command body} -body {
set a {}
set i 1
while {$i<6} {
if $i==4 break
if {$i==4} break
set a [concat $a $i]
incr i
}
@@ -112,8 +112,8 @@ test while-1.12 {TclCompileWhileCmd: long command body} -body {
set a {}
set i 1
while {$i<6} {
if $i==4 break
if $i>5 continue
if {$i==4} break
if {$i>5} continue
if {$i>6 && $tcl_platform(machine)=="xxx"} {
catch {set a $a} msg
catch {incr i 5} msg
@@ -155,7 +155,7 @@ test while-1.13 {TclCompileWhileCmd: while command result} -body {
} -result {}
test while-1.14 {TclCompileWhileCmd: while command result} -body {
set i 0
set a [while {$i < 5} {if $i==3 break; incr i}]
set a [while {$i < 5} {if {$i==3} break; incr i}]
return $a
} -cleanup {
unset a i
@@ -207,9 +207,9 @@ test while-2.4 {continue tests, long command body} -body {
set a {}
set i 1
while {$i<6} {
if $i==2 {incr i; continue}
if $i==4 break
if $i>5 continue
if {$i==2} {incr i; continue}
if {$i==4} break
if {$i>5} continue
if {$i>6 && $tcl_platform(machine)=="xxx"} {
catch {set a $a} msg
catch {incr i 5} msg
@@ -277,9 +277,9 @@ test while-3.3 {break tests, long command body} -body {
set a {}
set i 1
while {$i<6} {
if $i==2 {incr i; continue}
if $i==5 break
if $i>5 continue
if {$i==2} {incr i; continue}
if {$i==5} break
if {$i>5} continue
if {$i>6 && $tcl_platform(machine)=="xxx"} {
catch {set a $a} msg
catch {incr i 5} msg
@@ -295,7 +295,7 @@ test while-3.3 {break tests, long command body} -body {
catch {incr i 5} msg
catch {incr i -5} msg
}
if $i==4 break
if {$i==4} break
if {$i>6 && $tcl_platform(machine)=="xxx"} {
catch {set a $a} msg
catch {incr i 5} msg
@@ -401,7 +401,7 @@ test while-4.10 {while (not compiled): simple command body} -body {
set i 1
set z while
$z {$i<6} {
if $i==4 break
if {$i==4} break
set a [concat $a $i]
incr i
}
@@ -439,8 +439,8 @@ test while-4.13 {while (not compiled): long command body} -body {
set z while
set i 1
$z {$i<6} {
if $i==4 break
if $i>5 continue
if {$i==4} break
if {$i>5} continue
if {$i>6 && $tcl_platform(machine)=="xxx"} {
catch {set a $a} msg
catch {incr i 5} msg
@@ -484,7 +484,7 @@ test while-4.14 {while (not compiled): while command result} -body {
test while-4.15 {while (not compiled): while command result} -body {
set i 0
set z while
set a [$z {$i < 5} {if $i==3 break; incr i}]
set a [$z {$i < 5} {if {$i==3} break; incr i}]
return $a
} -cleanup {
unset a i z
@@ -538,9 +538,9 @@ test while-5.4 {break tests, long command body with computed command names} -bod
set i 1
set z break
while {$i<6} {
if $i==2 {incr i; continue}
if $i==5 $z
if $i>5 continue
if {$i==2} {incr i; continue}
if {$i==5} $z
if {$i>5} continue
if {$i>6 && $tcl_platform(machine)=="xxx"} {
catch {set a $a} msg
catch {incr i 5} msg
@@ -556,7 +556,7 @@ test while-5.4 {break tests, long command body with computed command names} -bod
catch {incr i 5} msg
catch {incr i -5} msg
}
if $i==4 $z
if {$i==4} $z
if {$i>6 && $tcl_platform(machine)=="xxx"} {
catch {set a $a} msg
catch {incr i 5} msg
@@ -637,9 +637,9 @@ test while-6.5 {continue tests, long command body with computed command names} -
set i 1
set z continue
while {$i<6} {
if $i==2 {incr i; continue}
if $i==4 break
if $i>5 $z
if {$i==2} {incr i; continue}
if {$i==4} break
if {$i>5} $z
if {$i>6 && $tcl_platform(machine)=="xxx"} {
catch {set a $a} msg
catch {incr i 5} msg
+5 -5
View File
@@ -20,7 +20,7 @@ if {[testConstraint win]} {
if {![catch {
::tcltest::loadTestedCommands
set ::ddever [package require dde 1.4.3]
set ::ddelib [lindex [package ifneeded dde $::ddever] 1]}]} {
set ::ddelib [info loaded "" Dde]}]} {
testConstraint dde 1
}
}
@@ -38,7 +38,7 @@ proc createChildProcess {ddeServerName args} {
set f [open $::scriptName w+]
puts $f [list set ddeServerName $ddeServerName]
puts $f [list load $::ddelib dde]
puts $f [list load $::ddelib Dde]
puts $f {
# DDE child server -
#
@@ -111,7 +111,7 @@ test winDde-1.1 {Settings the server's topic name} -constraints dde -body {
} -result {foobar foobar self}
test winDde-2.1 {Checking for other services} -constraints dde -body {
expr [llength [dde services {} {}]] >= 0
expr {[llength [dde services {} {}]] >= 0}
} -result 1
test winDde-2.2 {Checking for existence, with service and topic specified} \
-constraints dde -body {
@@ -119,11 +119,11 @@ test winDde-2.2 {Checking for existence, with service and topic specified} \
} -result 1
test winDde-2.3 {Checking for existence, with only the service specified} \
-constraints dde -body {
expr [llength [dde services TclEval {}]] >= 1
expr {[llength [dde services TclEval {}]] >= 1}
} -result 1
test winDde-2.4 {Checking for existence, with only the topic specified} \
-constraints dde -body {
expr [llength [dde services {} self]] >= 1
expr {[llength [dde services {} self]] >= 1}
} -result 1
# -------------------------------------------------------------------------
+2 -2
View File
@@ -140,7 +140,7 @@ test zlib-7.7 {zlib stream: Bug 25842c161} -constraints zlib -body {
} -result ""
# Also causes Tk Bug 10f2e7872b
test zlib-7.8 {zlib stream: Bug b26e38a3e4} -constraints zlib -setup {
expr srand(12345)
expr {srand(12345)}
set randdata {}
for {set i 0} {$i<6001} {incr i} {
append randdata [binary format c [expr {int(256*rand())}]]
@@ -451,7 +451,7 @@ test zlib-8.16 {Bug 3603553: buffer transfer with large writes} -setup {
# Actual data isn't very important; needs to be substantially larger than
# the internal buffer (32kB) and incompressible.
set largeData {}
for {set i 0;expr srand(1)} {$i < 100000} {incr i} {
for {set i 0;expr {srand(1)}} {$i < 100000} {incr i} {
append largeData [lindex "a b c d e f g h i j k l m n o p" \
[expr {int(16*rand())}]]
}
-28
View File
@@ -259,34 +259,6 @@ UnloadFile(
ckfree(loadHandle);
}
/*
*----------------------------------------------------------------------
*
* TclGuessPackageName --
*
* If the "load" command is invoked without providing a package name,
* this procedure is invoked to try to figure it out.
*
* Results:
* Always returns 0 to indicate that we couldn't figure out a package
* name; generic code will then try to guess the package from the file
* name. A return value of 1 would have meant that we figured out the
* package name and put it in bufPtr.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
TclGuessPackageName(
TCL_UNUSED(const char *) /*fileName*/,
TCL_UNUSED(Tcl_DString *))
{
return 0;
}
/*
* Local Variables:
* mode: c
-28
View File
@@ -465,34 +465,6 @@ UnloadFile(
ckfree(loadHandle);
}
/*
*----------------------------------------------------------------------
*
* TclGuessPackageName --
*
* If the "load" command is invoked without providing a package name,
* this procedure is invoked to try to figure it out.
*
* Results:
* Always returns 0 to indicate that we couldn't figure out a package
* name; generic code will then try to guess the package from the file
* name. A return value of 1 would have meant that we figured out the
* package name and put it in bufPtr.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
TclGuessPackageName(
TCL_UNUSED(const char *) /*fileName*/,
TCL_UNUSED(Tcl_DString *) /*bufPtr*/)
{
return 0;
}
/*
*----------------------------------------------------------------------
*
-30
View File
@@ -178,36 +178,6 @@ UnloadFile(
ckfree(loadHandle);
}
/*
*----------------------------------------------------------------------
*
* TclGuessPackageName --
*
* If the "load" command is invoked without providing a package name,
* this procedure is invoked to try to figure it out.
*
* Results:
* Always returns 0 to indicate that we couldn't figure out a package
* name; generic code will then try to guess the package from the file
* name. A return value of 1 would have meant that we figured out the
* package name and put it in bufPtr.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
TclGuessPackageName(
const char *fileName, /* Name of file containing package (already
* translated to local form if needed). */
Tcl_DString *bufPtr) /* Initialized empty dstring. Append package
* name to this if possible. */
{
return 0;
}
/*
* Local Variables:
* mode: c
-30
View File
@@ -196,36 +196,6 @@ UnloadFile(
ckfree(loadHandle);
}
/*
*----------------------------------------------------------------------
*
* TclGuessPackageName --
*
* If the "load" command is invoked without providing a package name,
* this function is invoked to try to figure it out.
*
* Results:
* Always returns 0 to indicate that we couldn't figure out a package
* name; generic code will then try to guess the package from the file
* name. A return value of 1 would have meant that we figured out the
* package name and put it in bufPtr.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
TclGuessPackageName(
const char *fileName, /* Name of file containing package (already
* translated to local form if needed). */
Tcl_DString *bufPtr) /* Initialized empty dstring. Append package
* name to this if possible. */
{
return 0;
}
/*
* Local Variables:
* mode: c
-30
View File
@@ -185,36 +185,6 @@ UnloadFile(
ckfree(loadHandle);
}
/*
*----------------------------------------------------------------------
*
* TclGuessPackageName --
*
* If the "load" command is invoked without providing a package name,
* this procedure is invoked to try to figure it out.
*
* Results:
* Always returns 0 to indicate that we couldn't figure out a package
* name; generic code will then try to guess the package from the file
* name. A return value of 1 would have meant that we figured out the
* package name and put it in bufPtr.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
TclGuessPackageName(
const char *fileName, /* Name of file containing package (already
* translated to local form if needed). */
Tcl_DString *bufPtr) /* Initialized empty dstring. Append package
* name to this if possible. */
{
return 0;
}
/*
* Local Variables:
* mode: c
+3 -3
View File
@@ -156,9 +156,9 @@ TEST_DLL_FILE = tcltest$(VER)${DLLSUFFIX}
TEST_EXE_FILE = tcltest${EXESUFFIX}
TEST_LIB_FILE = @LIBPREFIX@tcltest$(VER)${DLLSUFFIX}${LIBSUFFIX}
TEST_LOAD_PRMS = lappend ::auto_path {$(ROOT_DIR_WIN_NATIVE)/tests};\
package ifneeded dde 1.4.3 [list load [file normalize ${DDE_DLL_FILE}] dde];\
package ifneeded registry 1.3.5 [list load [file normalize ${REG_DLL_FILE}] registry]
TEST_LOAD_FACILITIES = package ifneeded Tcltest ${VERSION}@TCL_PATCH_LEVEL@ [list load [file normalize ${TEST_DLL_FILE}] Tcltest];\
package ifneeded dde 1.4.3 [list load [file normalize ${DDE_DLL_FILE}] Dde];\
package ifneeded registry 1.3.5 [list load [file normalize ${REG_DLL_FILE}] Registry]
TEST_LOAD_FACILITIES = package ifneeded Tcltest ${VERSION}@TCL_PATCH_LEVEL@ [list load [file normalize ${TEST_DLL_FILE}]];\
$(TEST_LOAD_PRMS)
ZLIB_DLL_FILE = zlib1.dll
TOMMATH_DLL_FILE = libtommath.dll
+2 -2
View File
@@ -168,12 +168,12 @@ Tcl_AppInit(
if (Registry_Init(interp) == TCL_ERROR) {
return TCL_ERROR;
}
Tcl_StaticPackage(interp, "registry", Registry_Init, NULL);
Tcl_StaticPackage(interp, "Registry", Registry_Init, NULL);
if (Dde_Init(interp) == TCL_ERROR) {
return TCL_ERROR;
}
Tcl_StaticPackage(interp, "dde", Dde_Init, Dde_SafeInit);
Tcl_StaticPackage(interp, "Dde", Dde_Init, Dde_SafeInit);
#endif
#ifdef TCL_TEST
-28
View File
@@ -259,34 +259,6 @@ UnloadFile(
ckfree(loadHandle);
}
/*
*----------------------------------------------------------------------
*
* TclGuessPackageName --
*
* If the "load" command is invoked without providing a package name,
* this function is invoked to try to figure it out.
*
* Results:
* Always returns 0 to indicate that we couldn't figure out a package
* name; generic code will then try to guess the package from the file
* name. A return value of 1 would have meant that we figured out the
* package name and put it in bufPtr.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
TclGuessPackageName(
TCL_UNUSED(const char *),
TCL_UNUSED(Tcl_DString *))
{
return 0;
}
/*
*----------------------------------------------------------------------
*