Index: xotcl/ChangeLog =================================================================== diff -u -rfda7a40548bb07598ac92453064c2d844d6b12da -r3eed8eb06e3bcc8a17de2d9d130f0caae5ea4123 --- xotcl/ChangeLog (.../ChangeLog) (revision fda7a40548bb07598ac92453064c2d844d6b12da) +++ xotcl/ChangeLog (.../ChangeLog) (revision 3eed8eb06e3bcc8a17de2d9d130f0caae5ea4123) @@ -1,3 +1,8 @@ +2004-11-19 Uwe Zdun + * fixed bug: empty non-pos args, double dash alone. + Thanks to Bryan Schofield for reporting this bug. + Added tests. + 2004-11-18 Gustaf.Neumann@wu-wien.ac.at * changed internal communication between end-of-filterchanin and "unknown" to flag instead of return code XOTCL_UNKNOWN Index: xotcl/Makefile =================================================================== diff -u -rfda7a40548bb07598ac92453064c2d844d6b12da -r3eed8eb06e3bcc8a17de2d9d130f0caae5ea4123 --- xotcl/Makefile (.../Makefile) (revision fda7a40548bb07598ac92453064c2d844d6b12da) +++ xotcl/Makefile (.../Makefile) (revision 3eed8eb06e3bcc8a17de2d9d130f0caae5ea4123) @@ -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: Makefile,v 1.25 2004/11/19 01:41:32 neumann Exp $ +# RCS: @(#) $Id: Makefile,v 1.26 2004/11/19 22:59:37 neumann Exp $ #======================================================================== # Add additional lines to handle any additional AC_SUBST cases that @@ -120,7 +120,7 @@ PACKAGE_NAME = xotcl PACKAGE_VERSION = 1.3.3 CC = gcc -pipe -CFLAGS_DEFAULT = -O -g +CFLAGS_DEFAULT = -O CFLAGS_WARNING = -Wall -Wconversion -Wno-implicit-int CLEANFILES = *.o *.a *.so *~ core gmon.out config.* EXEEXT = Index: xotcl/doc/xo-daemon.html =================================================================== diff -u -rfda7a40548bb07598ac92453064c2d844d6b12da -r3eed8eb06e3bcc8a17de2d9d130f0caae5ea4123 --- xotcl/doc/xo-daemon.html (.../xo-daemon.html) (revision fda7a40548bb07598ac92453064c2d844d6b12da) +++ xotcl/doc/xo-daemon.html (.../xo-daemon.html) (revision 3eed8eb06e3bcc8a17de2d9d130f0caae5ea4123) @@ -76,7 +76,7 @@ Date: - [::xotcl::rcs date {$Date: 2004/11/19 01:41:32 $}] + [::xotcl::rcs date {$Date: 2004/11/19 22:59:37 $}] Index: xotcl/doc/xo-whichPkg.html =================================================================== diff -u -rfda7a40548bb07598ac92453064c2d844d6b12da -r3eed8eb06e3bcc8a17de2d9d130f0caae5ea4123 --- xotcl/doc/xo-whichPkg.html (.../xo-whichPkg.html) (revision fda7a40548bb07598ac92453064c2d844d6b12da) +++ xotcl/doc/xo-whichPkg.html (.../xo-whichPkg.html) (revision 3eed8eb06e3bcc8a17de2d9d130f0caae5ea4123) @@ -52,7 +52,7 @@ Date: - [::xotcl::rcs date {$Date: 2004/11/19 01:41:32 $}] + [::xotcl::rcs date {$Date: 2004/11/19 22:59:37 $}] Index: xotcl/generic/xotcl.c =================================================================== diff -u -rfda7a40548bb07598ac92453064c2d844d6b12da -r3eed8eb06e3bcc8a17de2d9d130f0caae5ea4123 --- xotcl/generic/xotcl.c (.../xotcl.c) (revision fda7a40548bb07598ac92453064c2d844d6b12da) +++ xotcl/generic/xotcl.c (.../xotcl.c) (revision 3eed8eb06e3bcc8a17de2d9d130f0caae5ea4123) @@ -1,4 +1,4 @@ -/* $Id: xotcl.c,v 1.30 2004/11/19 01:41:32 neumann Exp $ +/* $Id: xotcl.c,v 1.31 2004/11/19 22:59:37 neumann Exp $ * * XOTcl - Extended OTcl * @@ -4255,10 +4255,12 @@ ObjStr(objv[2]), "'", 0); result = TCL_ERROR; } - /* be sure to reset unknown flag */ - RUNTIME_STATE(in)->unknown = 0; + } } + /* be sure to reset unknown flag */ + if (unknown) + RUNTIME_STATE(in)->unknown = 0; #ifdef DISPATCH_TRACE printExit(in,"DISPATCH", objc,objv, result); @@ -5376,6 +5378,7 @@ nobjc = 1; } csc->callType |= XOTCL_CSC_CALL_IS_NEXT; + RUNTIME_STATE(in)->unknown = 0; result = DoCallProcCheck(cp, (ClientData)obj, in, nobjc, nobjv, cmd, obj, *cl, *method, frameType, 1/*fromNext*/); @@ -10010,17 +10013,17 @@ if (isNonPositionalArg(in, argStr, nonPosArgsDefc, nonPosArgsDefv, &varName)) { i++; - if (i > argsc) + if (i >= argsc) return XOTclVarErrMsg(in, "Non positional arg '", - ObjStr(argsv[1]), "': value missing", + argStr, "': value missing", NULL); Tcl_SetVar2(in, varName, 0, ObjStr(argsv[i]), 0); } else { endOfNonPosArgsReached = 1; } } - if (endOfNonPosArgsReached) { + if (endOfNonPosArgsReached && i < argsc) { if (ordinaryArgsCounter >= ordinaryArgsDefc) { return XOTclObjErrArgCnt(in, NULL, ObjStr(nonPosArgs->ordinaryArgs)); } Index: xotcl/tests/testx.xotcl =================================================================== diff -u -rfda7a40548bb07598ac92453064c2d844d6b12da -r3eed8eb06e3bcc8a17de2d9d130f0caae5ea4123 --- xotcl/tests/testx.xotcl (.../testx.xotcl) (revision fda7a40548bb07598ac92453064c2d844d6b12da) +++ xotcl/tests/testx.xotcl (.../testx.xotcl) (revision 3eed8eb06e3bcc8a17de2d9d130f0caae5ea4123) @@ -1,4 +1,4 @@ -#$Id: testx.xotcl,v 1.20 2004/11/19 01:41:32 neumann Exp $ +#$Id: testx.xotcl,v 1.21 2004/11/19 22:59:37 neumann Exp $ package require XOTcl namespace import -force xotcl::* @@ -3565,7 +3565,27 @@ a: ack b: banana c: apple] \ "non pos + default values 6" - return "PASSED [self]" + Object o + o proc foo {{-foo 1}} {} { + #puts "foo: $foo" + } + o foo + o foo -foo 0 + catch {o foo -foo} msg + errorCheck $msg "Non positional arg '-foo': value missing" "Empty non-pos arg" + + Object oa + oa proc foo {{-a A}} {b} { + #puts "$a $b" + } + oa foo "B" + oa foo "-" + oa foo "---" + catch {oa foo "--"} msg + + errorCheck $msg "wrong # args: should be {b}" "Non-pos arg: double dash alone" + + return "PASSED [self]" }