diff options
author | dgp <dgp@users.sourceforge.net> | 2007-10-16 03:50:30 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2007-10-16 03:50:30 (GMT) |
commit | 469bf66686a3b807980f329a316d7494e80ef1b9 (patch) | |
tree | 0e7f1172118865035b0a062f8b80afa363cbda75 | |
parent | d3f32c25f4f4e52eff048406ab16786b1de14677 (diff) | |
download | tcl-469bf66686a3b807980f329a316d7494e80ef1b9.zip tcl-469bf66686a3b807980f329a316d7494e80ef1b9.tar.gz tcl-469bf66686a3b807980f329a316d7494e80ef1b9.tar.bz2 |
merge updates from HEAD
-rw-r--r-- | ChangeLog | 36 | ||||
-rw-r--r-- | generic/tclCompExpr.c | 25 | ||||
-rw-r--r-- | generic/tclIOCmd.c | 22 | ||||
-rw-r--r-- | generic/tclUtil.c | 9 | ||||
-rw-r--r-- | tests/cmdAH.test | 4 | ||||
-rw-r--r-- | tests/cmdIL.test | 10 | ||||
-rw-r--r-- | tests/compExpr-old.test | 10 | ||||
-rw-r--r-- | tests/compExpr.test | 6 | ||||
-rw-r--r-- | tests/compile.test | 8 | ||||
-rw-r--r-- | tests/expr-old.test | 12 | ||||
-rw-r--r-- | tests/expr.test | 14 | ||||
-rw-r--r-- | tests/incr.test | 6 | ||||
-rw-r--r-- | tests/io.test | 10 | ||||
-rw-r--r-- | tests/lindex.test | 52 | ||||
-rw-r--r-- | tests/link.test | 6 | ||||
-rw-r--r-- | tests/mathop.test | 66 | ||||
-rw-r--r-- | tests/parseExpr.test | 16 | ||||
-rw-r--r-- | tests/set.test | 10 | ||||
-rw-r--r-- | tests/string.test | 22 | ||||
-rw-r--r-- | tests/stringComp.test | 14 | ||||
-rw-r--r-- | tools/mkdepend.tcl | 118 | ||||
-rw-r--r-- | unix/tclUnixFCmd.c | 23 | ||||
-rw-r--r-- | win/makefile.vc | 4 |
23 files changed, 301 insertions, 202 deletions
@@ -1,3 +1,39 @@ +2007-10-15 Don Porter <dgp@users.sourceforge.net> + + * generic/tclIOCmd.c: Revise [open] so that it interprets leading + zero strings passed as the "permissions" argument as octal numbers, + even if Tcl itself no longer parses integers in that way. + + * unix/tclUnixFCmd.c: Revise the "-permissions" [file attribute] so + that it interprets leading zero strings as octal numbers, even if Tcl + itself no longer parses integers in that way. + + * generic/tclCompExpr.c: Corrections to code that produces + * generic/tclUtil.c: extended "bad octal" error messages. + + * tests/cmdAH.test: Test revisions so that tests pass whether or + * tests/cmdIL.test: not Tcl parses leading zero strings as octal. + * tests/compExpr-old.test: + * tests/compExpr.test: + * tests/compile.test: + * tests/expr-old.test: + * tests/expr.test: + * tests/incr.test: + * tests/io.test: + * tests/lindex.test: + * tests/link.test: + * tests/mathop.test: + * tests/parseExpr.test: + * tests/set.test: + * tests/string.test: + * tests/stringComp.test: + +2007-10-15 David Gravereaux <davygrvy@pobox.com> + + * tools/mkdepend.tcl: Produces usable output. Include path + * win/makefile.vc: problem fixed. Never fight city hall + when it comes to levels of quoting issues. + 2007-10-15 Miguel Sofer <msofer@users.sf.net> * generic/tclParse.c (Tcl_ParseBraces): fix for possible read diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 5ce9c8d..982b23f 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompExpr.c,v 1.53.2.9 2007/09/04 17:43:49 dgp Exp $ + * RCS: @(#) $Id: tclCompExpr.c,v 1.53.2.10 2007/10/16 03:50:31 dgp Exp $ */ #include "tclInt.h" @@ -744,6 +744,29 @@ ParseExpr( " or \"%.*s%s(...)\" or ...", (scanned < limit) ? scanned : limit - 3, start, (scanned < limit) ? "" : "..."); + if (NotOperator(lastParsed)) { + if ((lastStart[0] == '0') + && ((lastStart[1] == 'o') + || (lastStart[1] == 'O')) + && (lastStart[2] >= '0') + && (lastStart[2] <= '9')) { + const char *end = lastStart + 2; + while (isdigit(*end)) { + end++; + } + Tcl_Obj *copy = Tcl_NewStringObj(lastStart, + end - lastStart); + if (TclCheckBadOctal(NULL, + Tcl_GetString(copy))) { + TclNewLiteralStringObj(post, + "(invalid octal number?)"); + } + Tcl_DecrRefCount(copy); + } + scanned = 0; + insertMark = 1; + parsePtr->errorType = TCL_PARSE_BAD_NUMBER; + } goto error; } } diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 28d60dc..02fe534 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOCmd.c,v 1.40.2.3 2007/09/06 18:20:31 dgp Exp $ + * RCS: @(#) $Id: tclIOCmd.c,v 1.40.2.4 2007/10/16 03:50:31 dgp Exp $ */ #include "tclInt.h" @@ -1025,7 +1025,25 @@ Tcl_OpenObjCmd( } else { modeString = Tcl_GetString(objv[2]); if (objc == 4) { - if (Tcl_GetIntFromObj(interp, objv[3], &prot) != TCL_OK) { + char *permString = TclGetString(objv[3]); + int code = TCL_ERROR; + int scanned = TclParseAllWhiteSpace(permString, -1); + + /* Support legacy octal numbers */ + if ((permString[scanned] == '0') + && (permString[scanned+1] >= '0') + && (permString[scanned+1] <= '7')) { + + Tcl_Obj *permObj; + + TclNewLiteralStringObj(permObj, "0o"); + Tcl_AppendToObj(permObj, permString+scanned+1, -1); + code = Tcl_GetIntFromObj(NULL, permObj, &prot); + Tcl_DecrRefCount(permObj); + } + + if ((code == TCL_ERROR) + && Tcl_GetIntFromObj(interp, objv[3], &prot) != TCL_OK) { return TCL_ERROR; } } diff --git a/generic/tclUtil.c b/generic/tclUtil.c index fe7f18a..3c1e161 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUtil.c,v 1.82 2007/05/07 19:45:33 dgp Exp $ + * RCS: @(#) $Id: tclUtil.c,v 1.82.2.1 2007/10/16 03:50:31 dgp Exp $ */ #include "tclInt.h" @@ -2372,8 +2372,8 @@ TclGetIntForIndex( Tcl_AppendResult(interp, "bad index \"", bytes, "\": must be integer?[+-]integer? or end?[+-]integer?", (char *) NULL); - if (!strncmp(bytes, "end-", 3)) { - bytes += 3; + if (!strncmp(bytes, "end-", 4)) { + bytes += 4; } TclCheckBadOctal(interp, bytes); } @@ -2556,6 +2556,9 @@ TclCheckBadOctal( p++; } if (*p == '0') { + if ((p[1] == 'o') || p[1] == 'O') { + p+=2; + } while (isdigit(UCHAR(*p))) { /* INTL: digit. */ p++; } diff --git a/tests/cmdAH.test b/tests/cmdAH.test index 031d152..d4323d0 100644 --- a/tests/cmdAH.test +++ b/tests/cmdAH.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: cmdAH.test,v 1.55 2007/01/18 22:09:44 dkf Exp $ +# RCS: @(#) $Id: cmdAH.test,v 1.55.2.1 2007/10/16 03:50:32 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2.1 @@ -1332,7 +1332,7 @@ test cmdAH-28.4 {Tcl_FileObjCmd: stat} { test cmdAH-28.5 {Tcl_FileObjCmd: stat} {unix} { catch {unset stat} file stat $gorpfile stat - expr $stat(mode)&0777 + expr $stat(mode)&0o777 } {501} test cmdAH-28.6 {Tcl_FileObjCmd: stat} { string tolower [list [catch {file stat _bogus_ stat} msg] \ diff --git a/tests/cmdIL.test b/tests/cmdIL.test index c9796db..0987244 100644 --- a/tests/cmdIL.test +++ b/tests/cmdIL.test @@ -8,7 +8,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: cmdIL.test,v 1.33 2007/03/13 17:34:04 dgp Exp $ +# RCS: @(#) $Id: cmdIL.test,v 1.33.2.1 2007/10/16 03:50:32 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -195,8 +195,8 @@ test cmdIL-3.10 {SortCompare procedure, -integer option} { list [catch {lsort -integer {3 q}} msg] $msg } {1 {expected integer but got "q"}} test cmdIL-3.11 {SortCompare procedure, -integer option} { - lsort -integer {35 21 0x20 30 023 100 8} -} {8 023 21 30 0x20 35 100} + lsort -integer {35 21 0x20 30 0o23 100 8} +} {8 0o23 21 30 0x20 35 100} test cmdIL-3.12 {SortCompare procedure, -real option} { list [catch {lsort -real {6...4 3}} msg] $msg } {1 {expected floating-point number but got "6...4"}} @@ -247,8 +247,8 @@ test cmdIL-3.18 {SortCompare procedure, -command option} -body { rename cmp "" } -result {48 36 35 22 21 18 6} test cmdIL-3.19 {SortCompare procedure, -decreasing option} { - lsort -decreasing -integer {35 21 0x20 30 023 100 8} -} {100 35 0x20 30 21 023 8} + lsort -decreasing -integer {35 21 0x20 30 0o23 100 8} +} {100 35 0x20 30 21 0o23 8} test cmdIL-4.1 {DictionaryCompare procedure, numerics, leading zeros} { lsort -dictionary {a003b a03b} diff --git a/tests/compExpr-old.test b/tests/compExpr-old.test index 78e6090..9c571e3 100644 --- a/tests/compExpr-old.test +++ b/tests/compExpr-old.test @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: compExpr-old.test,v 1.21 2006/10/09 19:15:44 msofer Exp $ +# RCS: @(#) $Id: compExpr-old.test,v 1.21.4.1 2007/10/16 03:50:32 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -362,7 +362,7 @@ test compExpr-old-9.10 {CompileRelationalExpr: error compiling relational arm} - test compExpr-old-10.1 {CompileShiftExpr: just add expr} {expr 4+-2} 2 test compExpr-old-10.2 {CompileShiftExpr: just add expr} {expr 0xff-2} 253 test compExpr-old-10.3 {CompileShiftExpr: just add expr} {expr -1--2} 1 -test compExpr-old-10.4 {CompileShiftExpr: just add expr} {expr 1-0123} -82 +test compExpr-old-10.4 {CompileShiftExpr: just add expr} {expr 1-0o123} -82 test compExpr-old-10.5 {CompileShiftExpr: error in add expr} -body { expr x+3 } -returnCodes error -match glob -result * @@ -384,7 +384,7 @@ test compExpr-old-10.11 {CompileShiftExpr: runtime error} { test compExpr-old-11.1 {CompileAddExpr: just multiply expr} {expr 4*-2} -8 test compExpr-old-11.2 {CompileAddExpr: just multiply expr} {expr 0xff%2} 1 test compExpr-old-11.3 {CompileAddExpr: just multiply expr} {expr -1/2} -1 -test compExpr-old-11.4 {CompileAddExpr: just multiply expr} {expr 7891%0123} 6 +test compExpr-old-11.4 {CompileAddExpr: just multiply expr} {expr 7891%0o123} 6 test compExpr-old-11.5 {CompileAddExpr: error in multiply expr} -body { expr x*3 } -returnCodes error -match glob -result * @@ -435,7 +435,7 @@ test compExpr-old-12.11 {CompileMultiplyExpr: runtime error} { } {1 {can't use non-numeric string as operand of "/"}} test compExpr-old-13.1 {CompileUnaryExpr: unary exprs} {expr -0xff} -255 -test compExpr-old-13.2 {CompileUnaryExpr: unary exprs} {expr +000123} 83 +test compExpr-old-13.2 {CompileUnaryExpr: unary exprs} {expr +0o00123} 83 test compExpr-old-13.3 {CompileUnaryExpr: unary exprs} {expr +--++36} 36 test compExpr-old-13.4 {CompileUnaryExpr: unary exprs} {expr !2} 0 test compExpr-old-13.5 {CompileUnaryExpr: unary exprs} {expr +--+-62.0} -62.0 @@ -470,7 +470,7 @@ test compExpr-old-13.16 {CompileUnaryExpr: error in primary expr} { test compExpr-old-14.1 {CompilePrimaryExpr: literal primary} {expr 1} 1 test compExpr-old-14.2 {CompilePrimaryExpr: literal primary} {expr 123} 123 test compExpr-old-14.3 {CompilePrimaryExpr: literal primary} {expr 0xff} 255 -test compExpr-old-14.4 {CompilePrimaryExpr: literal primary} {expr 00010} 8 +test compExpr-old-14.4 {CompilePrimaryExpr: literal primary} {expr 0o0010} 8 test compExpr-old-14.5 {CompilePrimaryExpr: literal primary} {expr 62.0} 62.0 test compExpr-old-14.6 {CompilePrimaryExpr: literal primary} { expr 3.1400000 diff --git a/tests/compExpr.test b/tests/compExpr.test index e2972ec..fad8a43 100644 --- a/tests/compExpr.test +++ b/tests/compExpr.test @@ -8,7 +8,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: compExpr.test,v 1.13.6.1 2007/09/04 17:44:06 dgp Exp $ +# RCS: @(#) $Id: compExpr.test,v 1.13.6.2 2007/10/16 03:50:32 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -37,7 +37,7 @@ test compExpr-1.3 {TclCompileExpr procedure, error compiling expr} -body { } -match glob -result {1 {* "*foo"}} test compExpr-1.4 {TclCompileExpr procedure, expr has no operators} { - set a {000123} + set a {0o00123} expr {$a} } 83 @@ -283,7 +283,7 @@ test compExpr-4.7 {CompileCondExpr procedure, simple "false" clause} { } nope test compExpr-4.8 {CompileCondExpr procedure, convert "false" clause to numeric} { catch {unset a} - set a 00123 + set a 0o0123 expr {0? 42 : $a} } 83 test compExpr-4.9 {CompileCondExpr procedure, error in "false" clause} { diff --git a/tests/compile.test b/tests/compile.test index 18d3b16..46ccdd6 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: compile.test,v 1.46 2007/03/07 19:16:05 dgp Exp $ +# RCS: @(#) $Id: compile.test,v 1.46.2.1 2007/10/16 03:50:32 dgp Exp $ package require tcltest 2 namespace import -force ::tcltest::* @@ -241,10 +241,10 @@ test compile-11.2 {Tcl_Append*: ensure Tcl_ResetResult is used properly} { proc p {} { set r [list foobar] ; string index a bogus } list [catch {p} msg] $msg } {1 {bad index "bogus": must be integer?[+-]integer? or end?[+-]integer?}} -test compile-11.3 {Tcl_Append*: ensure Tcl_ResetResult is used properly} { - proc p {} { set r [list foobar] ; string index a 09 } +test compile-11.3 {Tcl_Append*: ensure Tcl_ResetResult is used properly} -body { + proc p {} { set r [list foobar] ; string index a 0o9 } list [catch {p} msg] $msg -} {1 {bad index "09": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}} +} -match glob -result {1 {*invalid octal number*}} test compile-11.4 {Tcl_Append*: ensure Tcl_ResetResult is used properly} { proc p {} { set r [list foobar] ; array set var {one two many} } list [catch {p} msg] $msg diff --git a/tests/expr-old.test b/tests/expr-old.test index 598697c..c4e5910 100644 --- a/tests/expr-old.test +++ b/tests/expr-old.test @@ -13,7 +13,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: expr-old.test,v 1.38 2006/08/31 20:09:19 dgp Exp $ +# RCS: @(#) $Id: expr-old.test,v 1.38.6.1 2007/10/16 03:50:32 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2.1 @@ -465,7 +465,7 @@ test expr-old-23.8 {double quotes} { # Numbers in various bases. test expr-old-24.1 {numbers in different bases} {expr 0x20} 32 -test expr-old-24.2 {numbers in different bases} {expr 015} 13 +test expr-old-24.2 {numbers in different bases} {expr 0o15} 13 # Conversions between various data types. @@ -678,7 +678,7 @@ test expr-old-28.14 {Tcl_ExprBool usage} { # Operands enclosed in braces test expr-old-29.1 {braces} {expr {{abc}}} abc -test expr-old-29.2 {braces} {expr {{00010}}} 8 +test expr-old-29.2 {braces} {expr {{0o0010}}} 8 test expr-old-29.3 {braces} {expr {{3.1200000}}} 3.12 test expr-old-29.4 {braces} {expr {{a{b}{1 {2 3}}c}}} "a{b}{1 {2 3}}c" test expr-old-29.5 {braces} -body { @@ -959,10 +959,10 @@ test expr-old-34.17 {errors in math functions} -constraints testmathfunctions \ } -match glob -result {1 {too many arguments for math function*}} test expr-old-36.1 {ExprLooksLikeInt procedure} -body { - expr 0289 + expr 0o289 } -returnCodes error -match glob -result {*invalid octal number*} test expr-old-36.2 {ExprLooksLikeInt procedure} { - set x 0289 + set x 0o289 list [catch {expr {$x+1}} msg] $msg } {1 {can't use invalid octal number as operand of "+"}} test expr-old-36.3 {ExprLooksLikeInt procedure} { @@ -1014,7 +1014,7 @@ test expr-old-36.14 {ExprLooksLikeInt procedure} { expr {$x+1} } 123456789012345678901234567891 test expr-old-36.15 {ExprLooksLikeInt procedure} { - set x "099 " + set x "0o99 " list [catch {expr {$x+1}} msg] $msg } {1 {can't use invalid octal number as operand of "+"}} test expr-old-36.16 {ExprLooksLikeInt procedure} { diff --git a/tests/expr.test b/tests/expr.test index e110c3e..0aece0c 100644 --- a/tests/expr.test +++ b/tests/expr.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: expr.test,v 1.67.2.1 2007/09/04 17:44:06 dgp Exp $ +# RCS: @(#) $Id: expr.test,v 1.67.2.2 2007/10/16 03:50:32 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2.1 @@ -441,7 +441,7 @@ test expr-9.10 {CompileRelationalExpr: error compiling relational arm} -body { test expr-10.1 {CompileShiftExpr: just add expr} {expr 4+-2} 2 test expr-10.2 {CompileShiftExpr: just add expr} {expr 0xff-2} 253 test expr-10.3 {CompileShiftExpr: just add expr} {expr -1--2} 1 -test expr-10.4 {CompileShiftExpr: just add expr} {expr 1-0123} -82 +test expr-10.4 {CompileShiftExpr: just add expr} {expr 1-0o123} -82 test expr-10.5 {CompileShiftExpr: error in add expr} -body { expr x+3 } -returnCodes error -match glob -result * @@ -463,7 +463,7 @@ test expr-10.11 {CompileShiftExpr: runtime error} { test expr-11.1 {CompileAddExpr: just multiply expr} {expr 4*-2} -8 test expr-11.2 {CompileAddExpr: just multiply expr} {expr 0xff%2} 1 test expr-11.3 {CompileAddExpr: just multiply expr} {expr -1/2} -1 -test expr-11.4 {CompileAddExpr: just multiply expr} {expr 7891%0123} 6 +test expr-11.4 {CompileAddExpr: just multiply expr} {expr 7891%0o123} 6 test expr-11.5 {CompileAddExpr: error in multiply expr} -body { expr x*3 } -returnCodes error -match glob -result * @@ -514,7 +514,7 @@ test expr-12.11 {CompileMultiplyExpr: runtime error} { } {1 {can't use non-numeric string as operand of "/"}} test expr-13.1 {CompileUnaryExpr: unary exprs} {expr -0xff} -255 -test expr-13.2 {CompileUnaryExpr: unary exprs} {expr +000123} 83 +test expr-13.2 {CompileUnaryExpr: unary exprs} {expr +0o00123} 83 test expr-13.3 {CompileUnaryExpr: unary exprs} {expr +--++36} 36 test expr-13.4 {CompileUnaryExpr: unary exprs} {expr !2} 0 test expr-13.5 {CompileUnaryExpr: unary exprs} {expr +--+-62.0} -62.0 @@ -553,7 +553,7 @@ test expr-13.17 {CompileUnaryExpr: negating non-numeric boolean literals} { test expr-14.1 {CompilePrimaryExpr: literal primary} {expr 1} 1 test expr-14.2 {CompilePrimaryExpr: literal primary} {expr 123} 123 test expr-14.3 {CompilePrimaryExpr: literal primary} {expr 0xff} 255 -test expr-14.4 {CompilePrimaryExpr: literal primary} {expr 00010} 8 +test expr-14.4 {CompilePrimaryExpr: literal primary} {expr 0o0010} 8 test expr-14.5 {CompilePrimaryExpr: literal primary} {expr 62.0} 62.0 test expr-14.6 {CompilePrimaryExpr: literal primary} { expr 3.1400000 @@ -6452,10 +6452,10 @@ test expr-39.25 {Tcl_ExprDoubleObj and NaN} \ } {1 {domain error: argument not in valid range}} test expr-40.1 {large octal shift} { - expr 0100000000000000000000000000000000 + expr 0o100000000000000000000000000000000 } [expr 0x1000000000000000000000000] test expr-40.2 {large octal shift} { - expr 0100000000000000000000000000000001 + expr 0o100000000000000000000000000000001 } [expr 0x1000000000000000000000001] test expr-41.1 {exponent overflow} { diff --git a/tests/incr.test b/tests/incr.test index 9546db8..051f4e9 100644 --- a/tests/incr.test +++ b/tests/incr.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: incr.test,v 1.14 2006/10/09 19:15:44 msofer Exp $ +# RCS: @(#) $Id: incr.test,v 1.14.4.1 2007/10/16 03:50:33 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -194,7 +194,7 @@ test incr-1.22 {TclCompileIncrCmd: increment given, large int} { } 200005 test incr-1.23 {TclCompileIncrCmd: increment given, formatted int != int} { set i 25 - incr i 000012345 ;# an octal literal + incr i 0o00012345 ;# an octal literal } 5374 test incr-1.24 {TclCompileIncrCmd: increment given, formatted int != int} { set i 25 @@ -445,7 +445,7 @@ test incr-2.22 {incr command (not compiled): increment given, large int} { test incr-2.23 {incr command (not compiled): increment given, formatted int != int} { set z incr set i 25 - $z i 000012345 ;# an octal literal + $z i 0o00012345 ;# an octal literal } 5374 test incr-2.24 {incr command (not compiled): increment given, formatted int != int} { set z incr diff --git a/tests/io.test b/tests/io.test index f74b078..58f160b 100644 --- a/tests/io.test +++ b/tests/io.test @@ -13,7 +13,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: io.test,v 1.76 2007/05/04 14:59:06 kennykb Exp $ +# RCS: @(#) $Id: io.test,v 1.76.2.1 2007/10/16 03:50:33 dgp Exp $ if {[catch {package require tcltest 2}]} { puts stderr "Skipping tests in [info script]. tcltest 2 required." @@ -48,7 +48,7 @@ testConstraint largefileSupport 0 # some tests can only be run is umask is 2 # if "umask" cannot be run, the tests will be skipped. set umaskValue 0 -testConstraint umask [expr {![catch {set umaskValue [exec /bin/sh -c umask]}]}] +testConstraint umask [expr {![catch {set umaskValue [scan [exec /bin/sh -c umask] %o]}]}] testConstraint makeFileInHome [expr {![file exists ~/_test_] && [file writable ~]}] @@ -5209,7 +5209,7 @@ test io-40.2 {POSIX open access modes: CREAT} {unix} { file delete $path(test3) set f [open $path(test3) {WRONLY CREAT} 0600] file stat $path(test3) stats - set x [format "0%o" [expr $stats(mode)&0777]] + set x [format "0%o" [expr $stats(mode)&0o777]] puts $f "line 1" close $f set f [open $path(test3) r] @@ -5223,8 +5223,8 @@ test io-40.3 {POSIX open access modes: CREAT} {unix umask} { set f [open $path(test3) {WRONLY CREAT}] close $f file stat $path(test3) stats - format "0%o" [expr $stats(mode)&0777] -} [format %04o [expr {0666 & ~ $umaskValue}]] + format "0%o" [expr $stats(mode)&0o777] +} [format %04o [expr {0o666 & ~ $umaskValue}]] test io-40.4 {POSIX open access modes: CREAT} { file delete $path(test3) set f [open $path(test3) w] diff --git a/tests/lindex.test b/tests/lindex.test index a5e6b8a..3a0bb7d 100644 --- a/tests/lindex.test +++ b/tests/lindex.test @@ -12,10 +12,10 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: lindex.test,v 1.14.2.1 2007/09/04 17:44:07 dgp Exp $ +# RCS: @(#) $Id: lindex.test,v 1.14.2.2 2007/10/16 03:50:33 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest + package require tcltest 2.2 namespace import -force ::tcltest::* } @@ -66,14 +66,14 @@ test lindex-3.4 {integer 3} testevalex { set x [string range 33 0 0] list [testevalex {lindex {a b c} $x}] [testevalex {lindex {a b c} $x}] } {{} {}} -test lindex-3.5 {bad octal} testevalex { - set x 08 +test lindex-3.5 {bad octal} -constraints testevalex -body { + set x 0o8 list [catch { testevalex {lindex {a b c} $x} } result] $result -} {1 {bad index "08": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}} -test lindex-3.6 {bad octal} testevalex { - set x -09 +} -match glob -result {1 {*invalid octal number*}} +test lindex-3.6 {bad octal} -constraints testevalex -body { + set x -0o9 list [catch { testevalex {lindex {a b c} $x} } result] $result -} {1 {bad index "-09": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}} +} -match glob -result {1 {*invalid octal number*}} test lindex-3.7 {indexes don't shimmer wide ints} { set x [expr {(wide(1)<<31) - 2}] list $x [lindex {1 2 3} $x] [incr x] [incr x] @@ -101,14 +101,14 @@ test lindex-4.5 {index = end-3} testevalex { set x end-3 list [testevalex {lindex {a b c} $x}] [testevalex {lindex {a b c} $x}] } {{} {}} -test lindex-4.6 {bad octal} testevalex { - set x end-08 +test lindex-4.6 {bad octal} -constraints testevalex -body { + set x end-0o8 list [catch { testevalex {lindex {a b c} $x} } result] $result -} {1 {bad index "end-08": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}} -test lindex-4.7 {bad octal} testevalex { - set x end--09 +} -match glob -result {1 {*invalid octal number*}} +test lindex-4.7 {bad octal} -constraints testevalex -body { + set x end--0o9 list [catch { testevalex {lindex {a b c} $x} } result] $result -} {1 {bad index "end--09": must be integer?[+-]integer? or end?[+-]integer?}} +} -match glob -result {1 {*invalid octal number*}} test lindex-4.8 {bad integer, not octal} testevalex { set x end-0a2 list [catch { testevalex {lindex {a b c} $x} } result] $result @@ -257,14 +257,14 @@ test lindex-11.4 {integer 3} { } result set result } {{} {}} -test lindex-11.5 {bad octal} { - set x 08 +test lindex-11.5 {bad octal} -body { + set x 0o8 list [catch { lindex {a b c} $x } result] $result -} {1 {bad index "08": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}} -test lindex-11.6 {bad octal} { - set x -09 +} -match glob -result {1 {*invalid octal number*}} +test lindex-11.6 {bad octal} -body { + set x -0o9 list [catch { lindex {a b c} $x } result] $result -} {1 {bad index "-09": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}} +} -match glob -result {1 {*invalid octal number*}} # Indices relative to end @@ -303,14 +303,14 @@ test lindex-12.5 {index = end-3} { } result set result } {{} {}} -test lindex-12.6 {bad octal} { - set x end-08 +test lindex-12.6 {bad octal} -body { + set x end-0o8 list [catch { lindex {a b c} $x } result] $result -} {1 {bad index "end-08": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}} -test lindex-12.7 {bad octal} { - set x end--09 +} -match glob -result {1 {*invalid octal number*}} +test lindex-12.7 {bad octal} -body { + set x end--0o9 list [catch { lindex {a b c} $x } result] $result -} {1 {bad index "end--09": must be integer?[+-]integer? or end?[+-]integer?}} +} -match glob -result {1 {*invalid octal number*}} test lindex-12.8 {bad integer, not octal} { set x end-0a2 list [catch { lindex {a b c} $x } result] $result diff --git a/tests/link.test b/tests/link.test index 08251b1..689a05a 100644 --- a/tests/link.test +++ b/tests/link.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: link.test,v 1.15 2006/03/21 11:12:29 dkf Exp $ +# RCS: @(#) $Id: link.test,v 1.15.6.1 2007/10/16 03:50:33 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -40,7 +40,7 @@ test link-2.1 {writing C variables from Tcl} {testlink} { testlink delete testlink set 43 1.21 4 - 56785678 64 250 30000 60000 0xbaadbeef 12321 32123 3.25 1231231234 testlink create 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - set int "00721" + set int "0o0721" set real -10.5 set bool true set string abcdef @@ -55,7 +55,7 @@ test link-2.1 {writing C variables from Tcl} {testlink} { set float 1.0987654321 set uwide 357357357357 concat [testlink get] | $int $real $bool $string $wide $char $uchar $short $ushort $uint $long $ulong $float $uwide -} {465 -10.5 1 abcdef 135135 79 161 8000 40000 -1073628482 34543 567890 1.0987653732299805 357357357357 | 00721 -10.5 true abcdef 135135 79 161 8000 40000 0xc001babe 34543 567890 1.0987654321 357357357357} +} {465 -10.5 1 abcdef 135135 79 161 8000 40000 -1073628482 34543 567890 1.0987653732299805 357357357357 | 0o0721 -10.5 true abcdef 135135 79 161 8000 40000 0xc001babe 34543 567890 1.0987654321 357357357357} test link-2.2 {writing bad values into variables} {testlink} { testlink delete testlink set 43 1.23 4 - 56785678 64 250 30000 60000 0xbeefbabe 12321 32123 3.25 1231231234 diff --git a/tests/mathop.test b/tests/mathop.test index 6bc86dc..c784b51 100644 --- a/tests/mathop.test +++ b/tests/mathop.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: mathop.test,v 1.8.2.1 2007/09/09 17:26:39 dgp Exp $ +# RCS: @(#) $Id: mathop.test,v 1.8.2.2 2007/10/16 03:50:33 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2.1 @@ -127,10 +127,10 @@ namespace eval ::testmathop { + 0 nan } -result {can't use non-numeric floating-point value as operand of "+"} test mathop-1.15 {compiled +: errors} -returnCodes error -body { - + 08 0 + + 0o8 0 } -result {can't use invalid octal number as operand of "+"} test mathop-1.16 {compiled +: errors} -returnCodes error -body { - + 0 08 + + 0 0o8 } -result {can't use invalid octal number as operand of "+"} test mathop-1.17 {compiled +: errors} -returnCodes error -body { + 0 [error expectedError] @@ -165,10 +165,10 @@ namespace eval ::testmathop { $op 0 nan } -result {can't use non-numeric floating-point value as operand of "+"} test mathop-1.33 {interpreted +: errors} -returnCodes error -body { - $op 08 0 + $op 0o8 0 } -result {can't use invalid octal number as operand of "+"} test mathop-1.34 {interpreted +: errors} -returnCodes error -body { - $op 0 08 + $op 0 0o8 } -result {can't use invalid octal number as operand of "+"} test mathop-1.35 {interpreted +: errors} -returnCodes error -body { $op 0 [error expectedError] @@ -202,10 +202,10 @@ namespace eval ::testmathop { * 0 nan } -result {can't use non-numeric floating-point value as operand of "*"} test mathop-2.15 {compiled *: errors} -returnCodes error -body { - * 08 0 + * 0o8 0 } -result {can't use invalid octal number as operand of "*"} test mathop-2.16 {compiled *: errors} -returnCodes error -body { - * 0 08 + * 0 0o8 } -result {can't use invalid octal number as operand of "*"} test mathop-2.17 {compiled *: errors} -returnCodes error -body { * 0 [error expectedError] @@ -240,10 +240,10 @@ namespace eval ::testmathop { $op 0 nan } -result {can't use non-numeric floating-point value as operand of "*"} test mathop-2.33 {interpreted *: errors} -returnCodes error -body { - $op 08 0 + $op 0o8 0 } -result {can't use invalid octal number as operand of "*"} test mathop-2.34 {interpreted *: errors} -returnCodes error -body { - $op 0 08 + $op 0 0o8 } -result {can't use invalid octal number as operand of "*"} test mathop-2.35 {interpreted *: errors} -returnCodes error -body { $op 0 [error expectedError] @@ -384,9 +384,9 @@ namespace eval ::testmathop { & 1 2 3.0 } -result {can't use floating-point value as operand of "&"} test mathop-6.7 {compiled &} { & 100000000002 18 -126 } 2 - test mathop-6.8 {compiled &} { & 0xff 0377 333333333333 } 85 + test mathop-6.8 {compiled &} { & 0xff 0o377 333333333333 } 85 test mathop-6.9 {compiled &} { & 1000000000000000000002 18 -126 } 2 - test mathop-6.10 {compiled &} { & 0xff 0377 3333333333333333333333 } 85 + test mathop-6.10 {compiled &} { & 0xff 0o377 3333333333333333333333 } 85 test mathop-6.11 {compiled &: errors} -returnCodes error -body { & x 0 } -result {can't use non-numeric string as operand of "&"} @@ -400,10 +400,10 @@ namespace eval ::testmathop { & 0 nan } -result {can't use non-numeric floating-point value as operand of "&"} test mathop-6.15 {compiled &: errors} -returnCodes error -body { - & 08 0 + & 0o8 0 } -result {can't use invalid octal number as operand of "&"} test mathop-6.16 {compiled &: errors} -returnCodes error -body { - & 0 08 + & 0 0o8 } -result {can't use invalid octal number as operand of "&"} test mathop-6.17 {compiled &: errors} -returnCodes error -body { & 0 [error expectedError] @@ -426,9 +426,9 @@ namespace eval ::testmathop { $op 1 2 3.0 } -result {can't use floating-point value as operand of "&"} test mathop-6.25 {interpreted &} { $op 100000000002 18 -126 } 2 - test mathop-6.26 {interpreted &} { $op 0xff 0377 333333333333 } 85 + test mathop-6.26 {interpreted &} { $op 0xff 0o377 333333333333 } 85 test mathop-6.27 {interpreted &} { $op 1000000000000000000002 18 -126 } 2 - test mathop-6.28 {interpreted &} { $op 0xff 0377 3333333333333333333333 } 85 + test mathop-6.28 {interpreted &} { $op 0xff 0o377 3333333333333333333333 } 85 test mathop-6.29 {interpreted &: errors} -returnCodes error -body { $op x 0 } -result {can't use non-numeric string as operand of "&"} @@ -442,10 +442,10 @@ namespace eval ::testmathop { $op 0 nan } -result {can't use non-numeric floating-point value as operand of "&"} test mathop-6.33 {interpreted &: errors} -returnCodes error -body { - $op 08 0 + $op 0o8 0 } -result {can't use invalid octal number as operand of "&"} test mathop-6.34 {interpreted &: errors} -returnCodes error -body { - $op 0 08 + $op 0 0o8 } -result {can't use invalid octal number as operand of "&"} test mathop-6.35 {interpreted &: errors} -returnCodes error -body { $op 0 [error expectedError] @@ -494,9 +494,9 @@ namespace eval ::testmathop { | 1 2 3.0 } -result {can't use floating-point value as operand of "|"} test mathop-7.7 {compiled |} { | 100000000002 18 -126 } -110 - test mathop-7.8 {compiled |} { | 0xff 0377 333333333333 } 333333333503 + test mathop-7.8 {compiled |} { | 0xff 0o377 333333333333 } 333333333503 test mathop-7.9 {compiled |} { | 1000000000000000000002 18 -126 } -110 - test mathop-7.10 {compiled |} { | 0xff 0377 3333333333333333333333 } 3333333333333333333503 + test mathop-7.10 {compiled |} { | 0xff 0o377 3333333333333333333333 } 3333333333333333333503 test mathop-7.11 {compiled |: errors} -returnCodes error -body { | x 0 } -result {can't use non-numeric string as operand of "|"} @@ -510,10 +510,10 @@ namespace eval ::testmathop { | 0 nan } -result {can't use non-numeric floating-point value as operand of "|"} test mathop-7.15 {compiled |: errors} -returnCodes error -body { - | 08 0 + | 0o8 0 } -result {can't use invalid octal number as operand of "|"} test mathop-7.16 {compiled |: errors} -returnCodes error -body { - | 0 08 + | 0 0o8 } -result {can't use invalid octal number as operand of "|"} test mathop-7.17 {compiled |: errors} -returnCodes error -body { | 0 [error expectedError] @@ -536,9 +536,9 @@ namespace eval ::testmathop { $op 1 2 3.0 } -result {can't use floating-point value as operand of "|"} test mathop-7.25 {interpreted |} { $op 100000000002 18 -126 } -110 - test mathop-7.26 {interpreted |} { $op 0xff 0377 333333333333 } 333333333503 + test mathop-7.26 {interpreted |} { $op 0xff 0o377 333333333333 } 333333333503 test mathop-7.27 {interpreted |} { $op 1000000000000000000002 18 -126 } -110 - test mathop-7.28 {interpreted |} { $op 0xff 0377 3333333333333333333333 } 3333333333333333333503 + test mathop-7.28 {interpreted |} { $op 0xff 0o377 3333333333333333333333 } 3333333333333333333503 test mathop-7.29 {interpreted |: errors} -returnCodes error -body { $op x 0 } -result {can't use non-numeric string as operand of "|"} @@ -552,10 +552,10 @@ namespace eval ::testmathop { $op 0 nan } -result {can't use non-numeric floating-point value as operand of "|"} test mathop-7.33 {interpreted |: errors} -returnCodes error -body { - $op 08 0 + $op 0o8 0 } -result {can't use invalid octal number as operand of "|"} test mathop-7.34 {interpreted |: errors} -returnCodes error -body { - $op 0 08 + $op 0 0o8 } -result {can't use invalid octal number as operand of "|"} test mathop-7.35 {interpreted |: errors} -returnCodes error -body { $op 0 [error expectedError] @@ -604,9 +604,9 @@ namespace eval ::testmathop { ^ 1 2 3.0 } -result {can't use floating-point value as operand of "^"} test mathop-8.7 {compiled ^} { ^ 100000000002 18 -126 } -100000000110 - test mathop-8.8 {compiled ^} { ^ 0xff 0377 333333333333 } 333333333333 + test mathop-8.8 {compiled ^} { ^ 0xff 0o377 333333333333 } 333333333333 test mathop-8.9 {compiled ^} { ^ 1000000000000000000002 18 -126 } -1000000000000000000110 - test mathop-8.10 {compiled ^} { ^ 0xff 0377 3333333333333333333333 } 3333333333333333333333 + test mathop-8.10 {compiled ^} { ^ 0xff 0o377 3333333333333333333333 } 3333333333333333333333 test mathop-8.11 {compiled ^: errors} -returnCodes error -body { ^ x 0 } -result {can't use non-numeric string as operand of "^"} @@ -620,10 +620,10 @@ namespace eval ::testmathop { ^ 0 nan } -result {can't use non-numeric floating-point value as operand of "^"} test mathop-8.15 {compiled ^: errors} -returnCodes error -body { - ^ 08 0 + ^ 0o8 0 } -result {can't use invalid octal number as operand of "^"} test mathop-8.16 {compiled ^: errors} -returnCodes error -body { - ^ 0 08 + ^ 0 0o8 } -result {can't use invalid octal number as operand of "^"} test mathop-8.17 {compiled ^: errors} -returnCodes error -body { ^ 0 [error expectedError] @@ -646,9 +646,9 @@ namespace eval ::testmathop { $op 1 2 3.0 } -result {can't use floating-point value as operand of "^"} test mathop-8.25 {interpreted ^} { $op 100000000002 18 -126 } -100000000110 - test mathop-8.26 {interpreted ^} { $op 0xff 0377 333333333333 } 333333333333 + test mathop-8.26 {interpreted ^} { $op 0xff 0o377 333333333333 } 333333333333 test mathop-8.27 {interpreted ^} { $op 1000000000000000000002 18 -126 } -1000000000000000000110 - test mathop-8.28 {interpreted ^} { $op 0xff 0377 3333333333333333333333 } 3333333333333333333333 + test mathop-8.28 {interpreted ^} { $op 0xff 0o377 3333333333333333333333 } 3333333333333333333333 test mathop-8.29 {interpreted ^: errors} -returnCodes error -body { $op x 0 } -result {can't use non-numeric string as operand of "^"} @@ -662,10 +662,10 @@ namespace eval ::testmathop { $op 0 nan } -result {can't use non-numeric floating-point value as operand of "^"} test mathop-8.33 {interpreted ^: errors} -returnCodes error -body { - $op 08 0 + $op 0o8 0 } -result {can't use invalid octal number as operand of "^"} test mathop-8.34 {interpreted ^: errors} -returnCodes error -body { - $op 0 08 + $op 0 0o8 } -result {can't use invalid octal number as operand of "^"} test mathop-8.35 {interpreted ^: errors} -returnCodes error -body { $op 0 [error expectedError] diff --git a/tests/parseExpr.test b/tests/parseExpr.test index 31b1649..50a04c3 100644 --- a/tests/parseExpr.test +++ b/tests/parseExpr.test @@ -8,7 +8,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: parseExpr.test,v 1.25.6.2 2007/09/04 17:44:07 dgp Exp $ +# RCS: @(#) $Id: parseExpr.test,v 1.25.6.3 2007/10/16 03:50:33 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -590,7 +590,7 @@ test parseExpr-16.5 {GetLexeme procedure, integer lexeme too big} testexprparser testexprparser {12345678901234567890} -1 } {- {} 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} test parseExpr-16.6 {GetLexeme procedure, bad integer lexeme} -constraints testexprparser -body { - testexprparser {0999} -1 + testexprparser {0o999} -1 } -returnCodes error -match glob -result {*invalid octal number*} test parseExpr-16.7 {GetLexeme procedure, double lexeme} testexprparser { testexprparser {0.999} -1 @@ -762,15 +762,11 @@ test parseExpr-21.6 {error messages} -body { } -returnCodes error -result {missing operator at _@_ in expression "0 _@_0"} test parseExpr-21.7 {error messages} -body { - expr {08} -} -returnCodes error -result {missing operator at _@_ -in expression "0_@_8"; -looks like invalid octal number} + expr {0o8} +} -returnCodes error -match glob -result {*invalid octal number*} test parseExpr-21.8 {error messages} -body { - expr {08x} -} -returnCodes error -result {missing operator at _@_ -in expression "0_@_8x"; -looks like invalid octal number} + expr {0o8x} +} -returnCodes error -match glob -result {*invalid octal number*} test parseExpr-21.9 {error messages} -body { expr {"} } -returnCodes error -result {missing " diff --git a/tests/set.test b/tests/set.test index f57eb50..3733e4c 100644 --- a/tests/set.test +++ b/tests/set.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: set.test,v 1.11 2006/10/09 19:15:45 msofer Exp $ +# RCS: @(#) $Id: set.test,v 1.11.4.1 2007/10/16 03:50:33 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -190,9 +190,9 @@ test set-1.22 {TclCompileSetCmd: doing assignment, large int} { } 200000 test set-1.23 {TclCompileSetCmd: doing assignment, formatted int != int} { set i 25 - set i 000012345 ;# an octal literal == 5349 decimal + set i 0o00012345 ;# an octal literal == 5349 decimal list $i [incr i] -} {000012345 5350} +} {0o00012345 5350} test set-1.24 {TclCompileSetCmd: too many arguments} { set i 10 @@ -465,9 +465,9 @@ test set-3.22 {uncompiled set command: doing assignment, large int} { test set-3.23 {uncompiled set command: doing assignment, formatted int != int} { set z set $z i 25 - $z i 000012345 ;# an octal literal == 5349 decimal + $z i 0o00012345 ;# an octal literal == 5349 decimal list $i [incr i] -} {000012345 5350} +} {0o00012345 5350} test set-3.24 {uncompiled set command: too many arguments} { set z set diff --git a/tests/string.test b/tests/string.test index 6ad7212..6837dac 100644 --- a/tests/string.test +++ b/tests/string.test @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: string.test,v 1.62.2.2 2007/10/15 18:38:07 dgp Exp $ +# RCS: @(#) $Id: string.test,v 1.62.2.3 2007/10/16 03:50:33 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -274,12 +274,12 @@ test string-5.16 {string index, bytearray object with string obj shimmering} { binary scan $str H* dump string compare [string index $str 10] \x00 } 0 -test string-5.17 {string index, bad integer} { - list [catch {string index "abc" 08} msg] $msg -} {1 {bad index "08": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}} -test string-5.18 {string index, bad integer} { - list [catch {string index "abc" end-00289} msg] $msg -} {1 {bad index "end-00289": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}} +test string-5.17 {string index, bad integer} -body { + list [catch {string index "abc" 0o8} msg] $msg +} -match glob -result {1 {*invalid octal number*}} +test string-5.18 {string index, bad integer} -body { + list [catch {string index "abc" end-0o0289} msg] $msg +} -match glob -result {1 {*invalid octal number*}} test string-5.19 {string index, bytearray object out of bounds} { string index [binary format I* {0x50515253 0x52}] -1 } {} @@ -480,8 +480,8 @@ test string-6.57 {string is integer, false} { list [string is integer -fail var " "] $var } {0 0} test string-6.58 {string is integer, false on bad octal} { - list [string is integer -fail var 036963] $var -} {0 3} + list [string is integer -fail var 0o36963] $var +} {0 4} test string-6.58.1 {string is integer, false on bad octal} { list [string is integer -fail var 0o36963] $var } {0 4} @@ -650,8 +650,8 @@ test string-6.104 {string is wideinteger, false} { list [string is wideinteger -fail var " "] $var } {0 0} test string-6.105 {string is wideinteger, false on bad octal} { - list [string is wideinteger -fail var 036963] $var -} {0 3} + list [string is wideinteger -fail var 0o36963] $var +} {0 4} test string-6.105.1 {string is wideinteger, false on bad octal} { list [string is wideinteger -fail var 0o36963] $var } {0 4} diff --git a/tests/stringComp.test b/tests/stringComp.test index 2de537d..3ccfc75 100644 --- a/tests/stringComp.test +++ b/tests/stringComp.test @@ -15,7 +15,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: stringComp.test,v 1.11.2.1 2007/06/12 15:56:44 dgp Exp $ +# RCS: @(#) $Id: stringComp.test,v 1.11.2.2 2007/10/16 03:50:33 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -349,14 +349,14 @@ test stringComp-5.16 {string index, bytearray object with string obj shimmering} } foo } 0 -test stringComp-5.17 {string index, bad integer} { - proc foo {} {string index "abc" 08} +test stringComp-5.17 {string index, bad integer} -body { + proc foo {} {string index "abc" 0o8} list [catch {foo} msg] $msg -} {1 {bad index "08": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}} -test stringComp-5.18 {string index, bad integer} { - proc foo {} {string index "abc" end-00289} +} -match glob -result {1 {*invalid octal number*}} +test stringComp-5.18 {string index, bad integer} -body { + proc foo {} {string index "abc" end-0o0289} list [catch {foo} msg] $msg -} {1 {bad index "end-00289": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}} +} -match glob -result {1 {*invalid octal number*}} test stringComp-5.19 {string index, bytearray object out of bounds} { proc foo {} {string index [binary format I* {0x50515253 0x52}] -1} foo diff --git a/tools/mkdepend.tcl b/tools/mkdepend.tcl index 2a19a6f..7af6120 100644 --- a/tools/mkdepend.tcl +++ b/tools/mkdepend.tcl @@ -23,10 +23,11 @@ #============================================================================== # # Modified heavily by David Gravereaux <davygrvy@pobox.com> about 9/17/2006. -# Original can be found @ http://www.doc.ic.ac.uk/~np2/software/mkdepend.html +# Original can be found @ +# http://web.archive.org/web/20070616205924/http://www.doc.ic.ac.uk/~np2/software/mkdepend.html # #============================================================================== -# RCS: @(#) $Id: mkdepend.tcl,v 1.1.4.2 2007/10/15 18:38:07 dgp Exp $ +# RCS: @(#) $Id: mkdepend.tcl,v 1.1.4.3 2007/10/16 03:50:33 dgp Exp $ #============================================================================== array set mode_data {} @@ -34,10 +35,6 @@ set mode_data(vc32) {cl -nologo -E} set cpp_args "" set source_extensions [list .c .cpp .cxx] -set target_extension ".obj" -set target_prefix "" -set remove_prefix "" -set verbose 1 set excludes [list] if [info exists env(INCLUDE)] { @@ -61,7 +58,7 @@ if [info exists env(INCLUDE)] { proc openOutput {file} { global output set output [open $file w] - puts $output "# Automatically generated at [clock format [clock seconds]] by [info script]" + puts $output "# Automatically generated at [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"] by [info script]\n" } # closeOutput -- @@ -83,7 +80,7 @@ proc closeOutput {} { # readDepends -- # -# Read off CCP pipe for #include references. pipe channel +# Read off CCP pipe for #line references. pipe channel # is closed when done. # # Arguments: @@ -93,32 +90,23 @@ proc closeOutput {} { # Raw dependency list pairs. proc readDepends {chan} { - global source_extensions target_extension verbose - - array set depends {} set line "" + array set depends {} while {[gets $chan line] != -1} { - if {[regexp {^#line [0-9]+ \"(.*)\"$} $line tmp fname] != 0} { - if {[lsearch $source_extensions [file extension $fname]] != -1} { - set target2 "[file rootname $fname]$target_extension" - - if {![info exists target] || - [string compare $target $target2] != 0} \ - { - set target $target2 - set depends($target|[file normalize $fname]) "" - - if $verbose { - puts stderr "processing [file tail $fname]" - } - } + if {[regexp {^#line [0-9]+ \"(.*)\"$} $line dummy fname] != 0} { + set fname [file normalize $fname] + if {![info exists target]} { + # this is ourself + set target $fname + puts stderr "processing [file tail $fname]" } else { - set depends($target|[file normalize $fname]) "" + # don't include ourselves as a dependency of ourself. + if {![string compare $fname $target]} {continue} + set depends($target|$fname) "" } } } - catch {close $chan} set result {} foreach n [array names depends] { @@ -129,48 +117,51 @@ proc readDepends {chan} { return $result } -# genStubs::interface -- +# writeDepends -- # -# This function is used in the declarations file to set the name -# of the interface currently being defined. +# Write the processed list out to the file. # # Arguments: -# name The name of the interface. +# out The channel to write to. +# depends The list of dependency pairs # # Results: # None. + proc writeDepends {out depends} { foreach pair $depends { puts $out "[lindex $pair 0] : \\\n\t[join [lindex $pair 1] " \\\n\t"]" } } -# genStubs::interface -- +# stringStartsWith -- # -# This function is used in the declarations file to set the name -# of the interface currently being defined. +# Compares second string to the beginning of the first. # # Arguments: -# name The name of the interface. +# str The string to test the beginning of. +# prefix The string to test against # # Results: -# None. +# the result of the comparison. + proc stringStartsWith {str prefix} { set front [string range $str 0 [expr {[string length $prefix] - 1}]] return [expr {[string compare [string tolower $prefix] \ [string tolower $front]] == 0}] } -# genStubs::interface -- +# filterExcludes -- # -# This function is used in the declarations file to set the name -# of the interface currently being defined. +# Remove non-project header files. # # Arguments: -# name The name of the interface. +# depends List of dependency pairs. +# excludes List of directories that should be removed # # Results: -# None. +# the processed dependency list. + proc filterExcludes {depends excludes} { set filtered {} @@ -193,16 +184,17 @@ proc filterExcludes {depends excludes} { return $filtered } -# genStubs::interface -- +# replacePrefix -- # -# This function is used in the declarations file to set the name -# of the interface currently being defined. +# Take the normalized search path and put back the +# macro name for it. # # Arguments: -# name The name of the interface. +# file filename. # # Results: -# None. +# filename properly replaced with macro for it. + proc replacePrefix {file} { global srcPathList srcPathReplaceList @@ -217,10 +209,10 @@ proc replacePrefix {file} { # Replaces normalized paths with original macro names. # # Arguments: -# depends Dependency pair list. +# depends Dependency pair list. # # Results: -# None. +# The processed dependency pair list. proc rebaseFiles {depends} { set rebased {} @@ -251,6 +243,7 @@ proc compressDeps {depends} { lappend compressed([lindex $pair 0]) [lindex $pair 1] } + set result [list] foreach n [array names compressed] { lappend result [list $n $compressed($n)] } @@ -321,6 +314,10 @@ proc readInputListFile {objectListFile} { lappend srcFileList [file join $path ${baseName}.c] } elseif {[file exist [file join $path ${baseName}.cpp]]} { lappend srcFileList [file join $path ${baseName}.cpp] + } elseif {[file exist [file join $path ${baseName}.cxx]]} { + lappend srcFileList [file join $path ${baseName}.cxx] + } elseif {[file exist [file join $path ${baseName}.cc]]} { + lappend srcFileList [file join $path ${baseName}.cc] } else { # ignore it } @@ -366,7 +363,9 @@ proc main {} { set mode mgw32 } -passthru:* { - puts stderr [set passthru [string range $arg 10 end]] + set passthru [string range $arg 10 end] + regsub -all {"} $passthru {\"} passthru + regsub -all {\\} $passthru {/} passthru } -out:* { openOutput [string range $arg 5 end] @@ -393,14 +392,25 @@ proc main {} { # Execute the CPP command and parse output foreach srcFile $srcFileList { - set command "$mode_data($mode) $passthru \"$srcFile\"" - set input [open |$command r] - - set depends [readDepends $input] + if {[catch { + set command "$mode_data($mode) $passthru \"$srcFile\"" + set input [open |$command r] + set depends [readDepends $input] + set status [catch {close $input} result] + if {$status == 1 && [lindex $::errorCode 0] eq "CHILDSTATUS"} { + foreach { - pid code } $::errorCode break + if {$code == 2} { + # compilation died a cruel death. + error $result + } + } + } err]} { + puts stderr "error ocurred: $err\n" + continue + } set depends [filterExcludes $depends $excludes] set depends [rebaseFiles $depends] set depends [compressDeps $depends] - set depends [lsort -index 0 $depends] writeDepends $output $depends } diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index 5185eb8..d6be698 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixFCmd.c,v 1.61.2.1 2007/09/04 17:44:22 dgp Exp $ + * RCS: @(#) $Id: tclUnixFCmd.c,v 1.61.2.2 2007/10/16 03:50:33 dgp Exp $ * * Portions of this code were derived from NetBSD source code which has the * following copyright notice: @@ -1595,18 +1595,31 @@ SetPermissionsAttribute( { long mode; mode_t newMode; - int result; + int result = TCL_ERROR; CONST char *native; + char *modeStringPtr = TclGetString(attributePtr); + int scanned = TclParseAllWhiteSpace(modeStringPtr, -1); /* - * First try if the string is a number + * First supply support for octal number format */ - if (Tcl_GetLongFromObj(NULL, attributePtr, &mode) == TCL_OK) { + if ((modeStringPtr[scanned] == '0') + && (modeStringPtr[scanned+1] >= '0') + && (modeStringPtr[scanned+1] <= '7')) { + /* Leading zero - attempt octal interpretation */ + Tcl_Obj *modeObj; + + TclNewLiteralStringObj(modeObj, "0o"); + Tcl_AppendToObj(modeObj, modeStringPtr+scanned+1, -1); + result = Tcl_GetLongFromObj(NULL, modeObj, &mode); + Tcl_DecrRefCount(modeObj); + } + if (result == TCL_OK + || Tcl_GetLongFromObj(NULL, attributePtr, &mode) == TCL_OK) { newMode = (mode_t) (mode & 0x00007FFF); } else { Tcl_StatBuf buf; - char *modeStringPtr = TclGetString(attributePtr); /* * Try the forms "rwxrwxrwx" and "ugo=rwx" diff --git a/win/makefile.vc b/win/makefile.vc index 4c050d1..a0e6894 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -12,7 +12,7 @@ # Copyright (c) 2001-2004 David Gravereaux. # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: makefile.vc,v 1.160.2.5 2007/10/15 18:38:09 dgp Exp $ +# RCS: @(#) $Id: makefile.vc,v 1.160.2.6 2007/10/16 03:50:34 dgp Exp $ #------------------------------------------------------------------------------ # Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR) @@ -844,7 +844,7 @@ depend: @echo Build tclsh first! !else $(TCLSH) $(TOOLSDIR:\=/)/mkdepend.tcl -vc32 -out:"$(OUT_DIR)\depend.mk" \ - -passthru:"-DBUILD_tcl $(TCL_INCLUDES:"=""")" $(GENERICDIR),$$(GENERICDIR) \ + -passthru:"-DBUILD_tcl $(TCL_INCLUDES)" $(GENERICDIR),$$(GENERICDIR) \ $(COMPATDIR),$$(COMPATDIR) $(TOMMATHDIR),$$(TOMMATHDIR) $(WINDIR),$$(WINDIR) @<< $(TCLOBJS) << |