Hi all. There has been some discussion on the list of late about how one would go about getting a patch applied to the development version of tcljava in the CVS. The process is very easy, just grab the CVS version from Scriptics, add your patch, run the regression tests to make sure your patch does not break anything, and send it to the tcljava mailing list. You can also submit a bug report to the Scriptics bug tracking system (and doing both is even better). To get the CVS archive you would run the following commands. % setenv CVSROOT :pserver:[EMAIL PROTECTED]:/cvsroot (use "CVSROOT=:pserver:[EMAIL PROTECTED]:/cvsroot ; export CVSROOT" for bash) % cvs login (password is cvs) % cvs checkout tcljava % cd tcljava/unix % autoconf % mkdir Build % cd Build (If you only want to build Jacl you would run) % ../configure --with-build=jacl (If you only want to build Tcl Blend you would run) % ../configure --with-build=tclblend --with-tcl=$SOMEWHERE Then you could test your tcljava shell out like so: % make shell You would then do your patching and run the following in the tcljava directory that you just checked out. Don't forget to add an entry to the tcljava/ChangeLog file! % cvs diff > mychanges.patch Then post the mychanges.patch file to the list, it is just that easy. Ok, well it may not be that easy. If your patch changes something that will need to be reflected in the documentation, then you should also take a look at the HTML docs in the tcljava/docs subdirectory. I think a "real" example will help folks understand what files might need changing. I am going to append the output of a "cvs diff" that I made for a change I just checked in today. This modification changes a public API of the TclInteger class, so it requires source and documentaiton fixes. It also adds the [lindex $l end-1] functionality from Tcl 8.3 to Jacl, so a number of regression tests are also updated by this patch. Now keep in mind that most patches will not be this large or complex, but I think this example will help people understand what might be required to get a patch into the tcljava CVS. Mo Dejong Red Hat Inc. Index: ChangeLog =================================================================== RCS file: /home/cvs/external/tcljava/ChangeLog,v retrieving revision 1.8 diff -u -r1.8 ChangeLog --- ChangeLog 2000/03/15 04:30:35 1.8 +++ ChangeLog 2000/03/17 23:29:45 @@ -1,3 +1,31 @@ +2000-03-17 Mo DeJong <[EMAIL PROTECTED]> + + * docs/cFunctions.html: + * docs/TclJavaLib/TclInteger.htm: + * src/jacl/tcl/lang/LindexCmd.java: + * src/jacl/tcl/lang/LinsertCmd.java: + * src/jacl/tcl/lang/LrangeCmd.java: + * src/jacl/tcl/lang/LreplaceCmd.java: + * src/jacl/tcl/lang/LsortCmd.java: + * src/jacl/tcl/lang/StringCmd.java: + * src/jacl/tcl/lang/Util.java: + * src/tcljava/tcl/lang/TclInteger.java: + * tests/tcl/lindex.test: + * tests/tcl/linsert.test: + * tests/tcl/lrange.test: + * tests/tcl/lreplace.test: + * tests/tcl/string.test: + Renamed and moved the TclInteger.getForIndex() method + to Util.getIntForIndex(). It is a + mapping for the TclGetIntForIndex function + which is private, so it did not belong + in TclInteger. Along with this change, I + updated the implementation of getIntForIndex + so that it is compatible with Tcl 8.3, which + also required adding the Util.checkBadOctal() + method. A number of regression test were update + to account for these changes. + 2000-03-14 Mo DeJong <[EMAIL PROTECTED]> * demos/packDemo/StringSplitter.java: Removed file. Index: docs/cFunctions.html =================================================================== RCS file: /home/cvs/external/tcljava/docs/cFunctions.html,v retrieving revision 1.2 diff -u -r1.2 cFunctions.html --- cFunctions.html 2000/02/23 22:14:16 1.2 +++ cFunctions.html 2000/03/17 23:29:45 @@ -4,7 +4,7 @@ <HR> <H3>Links from C Library Functions to Java Library Functions</H3> <PRE> -<A HREF="TclJavaLib/TclInteger.htm">TclGetIntForIndex</A> <A HREF="TclJavaLib/TclBoolean.htm">Tcl_GetBooleanFromObj</A> <A HREF="TclJavaLib/InternalRep.htm">Tcl_ObjType.freeProc</A> +<A HREF="TclJavaLib/TclBoolean.htm">Tcl_GetBooleanFromObj</A> <A +HREF="TclJavaLib/InternalRep.htm">Tcl_ObjType.freeProc</A> <A HREF="TclJavaLib/TclObject.htm">TclObj.typePtr</A> <A HREF="TclJavaLib/createCmd.htm">Tcl_GetCommandInfo</A> <A HREF="TclJavaLib/InternalRep.htm">Tcl_ObjType.updateStringProc</A> <A HREF="TclJavaLib/backgdErr.htm">Tcl_AddErrorInfo</A> <A HREF="TclJavaLib/TclDouble.htm">Tcl_GetDoubleFromObj</A> <A HREF="TclJavaLib/pkgRequire.htm">Tcl_PkgProvide</A> <A HREF="TclJavaLib/TclString.htm">Tcl_AppendToObj</A> <A HREF="TclJavaLib/TclIndex.htm">Tcl_GetIndexFromObj</A> <A HREF="TclJavaLib/pkgRequire.htm">Tcl_PkgRequire</A> Index: docs/TclJavaLib/TclInteger.htm =================================================================== RCS file: /home/cvs/external/tcljava/docs/TclJavaLib/TclInteger.htm,v retrieving revision 1.1 diff -u -r1.1 TclInteger.htm --- TclInteger.htm 1999/05/08 22:26:19 1.1 +++ TclInteger.htm 2000/03/17 23:29:45 @@ -9,7 +9,6 @@ <DD><A HREF="TclInteger.htm#M4" NAME="L184">METHODS</A> <DL><DD>static TclObject <B>newInstance</B>(int <I>intValue</I>)</DL> <DL><DD>static int <B>get</B>(Interp <I>interp</I>, TclObject <I>tobj</I>) throws TclException</DL> -<DL><DD>static int <B>getForIndex</B>(Interp <I>interp</I>, TclObject <I>tobj</I>, int <I>endValue</I>) throws TclException</DL> <DL><DD>static void <B>set</B>(TclObject <I>tobj</I>, int <I>intValue</I>)</DL> <DD><A HREF="TclInteger.htm#M5" NAME="L185">ARGUMENTS</A> <DL> @@ -18,7 +17,6 @@ <DL> <DD><A HREF="TclInteger.htm#M7" NAME="L187"><B>newInstance</B></A> <DD><A HREF="TclInteger.htm#M8" NAME="L188"><B>get</B></A> -<DD><A HREF="TclInteger.htm#M9" NAME="L189"><B>getForIndex</B></A> <DD><A HREF="TclInteger.htm#M10" NAME="L190"><B>set</B></A> </DL> <DD><A HREF="TclInteger.htm#M11" NAME="L191">EQUIVALENT C FUNCTIONS</A> @@ -34,21 +32,18 @@ <H3><A NAME="M4">METHODS</A></H3> <P>static TclObject <B>newInstance</B>(int <I>intValue</I>) <P>static int <B>get</B>(Interp <I>interp</I>, TclObject <I>tobj</I>) throws TclException -<P>static int <B>getForIndex</B>(Interp <I>interp</I>, TclObject <I>tobj</I>, int <I>endValue</I>) throws TclException <P>static void <B>set</B>(TclObject <I>tobj</I>, int <I>intValue</I>) <H3><A NAME="M5">ARGUMENTS</A></H3> <DL> -<P><DT>int <B>intValue</B> ()<DD> +<P><DT>int <B>intValue</B><DD> New value for internal integer representation. -<P><DT>Interp <B>interp</B> ()<DD> +<P><DT>Interp <B>interp</B><DD> If an error occurs while converting an object to be an integer object, an error message is left in the interpreter's result object unless <I>interp</I> is NULL. -<P><DT>TclObject <B>tobj</B> ()<DD> +<P><DT>TclObject <B>tobj</B><DD> TclObject to manipulate. If the internal representation of <I>tobj</I> is not TclInteger, the method converts it to TclInteger. -<P><DT>int <B>endValue</B> ()<DD> -Value returned if <I>tobj</I> is a String object whose value is "end". <P></DL> <H3><A NAME="M6">DESCRIPTION</A></H3> <DL> @@ -60,11 +55,6 @@ occurs while converting <I>tobj</I> to be an integer object, an error message is left in the <I>interp</I>'s result object unless <I>interp</I> is NULL. -<P><DT><A NAME="M9"><B>getForIndex</B></A><DD> -The <B>getForIndex</B> method is intended to simplify operations that expect -either an integer value or the string "end". If <I>tobj</I> contains -the string "end", <I>endValue</I> is returned. Otherwise, the same -operations as TclInteger.get are performed. <P><DT><A NAME="M10"><B>set</B></A><DD> The <B>set</B> method sets <I>tobj</I> to have the integer value of <I>intValue</I>. When this method returns, the internal representation of <I>tobj</I> @@ -72,7 +62,7 @@ <P></DL> <H3><A NAME="M11">EQUIVALENT C FUNCTIONS</A></H3> -<A href="../cFunctions.html">Tcl_NewIntObj</A>, <A href="../cFunctions.html">Tcl_GetIntFromObj</A>, <A href="../cFunctions.html">TclGetIntForIndex</A>, <A href="../cFunctions.html">Tcl_SetIntObj</A> +<A href="../cFunctions.html">Tcl_NewIntObj</A>, <A +href="../cFunctions.html">Tcl_GetIntFromObj</A>, <A +href="../cFunctions.html">Tcl_SetIntObj</A> <H3><A NAME="M12">SEE ALSO</A></H3> <B><A HREF="../TclJavaLib/InternalRep.htm">InternalRep</A></B>, <B><A HREF="../TclJavaLib/TclObject.htm">TclObject</A></B>, <B><A HREF="../TclJavaLib/TclList.htm">TclList</A></B>, <B><A HREF="../TclJavaLib/TclIndex.htm">TclIndex</A></B>, <B><A HREF="../TclJavaLib/TclString.htm">TclString</A></B>, <B><A HREF="../TclJavaLib/TclDouble.htm">TclDouble</A></B>, <B><A HREF="../TclJavaLib/TclBoolean.htm">TclBoolean</A></B>, <B><A HREF="../TclJavaLib/ReflectObject.htm">ReflectObject</A></B> <H3><A NAME="M13">KEYWORDS</A></H3> Index: src/jacl/tcl/lang/LindexCmd.java =================================================================== RCS file: /home/cvs/external/tcljava/src/jacl/tcl/lang/LindexCmd.java,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 LindexCmd.java --- LindexCmd.java 1998/10/14 21:09:20 1.1.1.1 +++ LindexCmd.java 2000/03/17 23:29:46 @@ -53,7 +53,7 @@ } int size = TclList.getLength(interp, argv[1]); - int index = TclInteger.getForIndex(interp, argv[2], size-1); + int index = Util.getIntForIndex(interp, argv[2], size-1); TclObject element = TclList.index(interp, argv[1], index); if (element != null) { Index: src/jacl/tcl/lang/LinsertCmd.java =================================================================== RCS file: /home/cvs/external/tcljava/src/jacl/tcl/lang/LinsertCmd.java,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 LinsertCmd.java --- LinsertCmd.java 1998/10/14 21:09:21 1.1.1.1 +++ LinsertCmd.java 2000/03/17 23:29:46 @@ -32,7 +32,7 @@ } int size = TclList.getLength(interp, argv[1]); - int index = TclInteger.getForIndex(interp, argv[2], size); + int index = Util.getIntForIndex(interp, argv[2], size); TclObject list = argv[1]; list.preserve(); Index: src/jacl/tcl/lang/LrangeCmd.java =================================================================== RCS file: /home/cvs/external/tcljava/src/jacl/tcl/lang/LrangeCmd.java,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 LrangeCmd.java --- LrangeCmd.java 1998/10/14 21:09:20 1.1.1.1 +++ LrangeCmd.java 2000/03/17 23:29:46 @@ -35,8 +35,8 @@ int first; int last; - first = TclInteger.getForIndex(interp, argv[2], size-1); - last = TclInteger.getForIndex(interp, argv[3], size-1); + first = Util.getIntForIndex(interp, argv[2], size-1); + last = Util.getIntForIndex(interp, argv[3], size-1); if (last < 0) { interp.resetResult(); Index: src/jacl/tcl/lang/LreplaceCmd.java =================================================================== RCS file: /home/cvs/external/tcljava/src/jacl/tcl/lang/LreplaceCmd.java,v retrieving revision 1.2 diff -u -r1.2 LreplaceCmd.java --- LreplaceCmd.java 1999/05/09 00:43:41 1.2 +++ LreplaceCmd.java 2000/03/17 23:29:46 @@ -34,8 +34,8 @@ int first; int last; - first = TclInteger.getForIndex(interp, argv[2], size-1); - last = TclInteger.getForIndex(interp, argv[3], size-1); + first = Util.getIntForIndex(interp, argv[2], size-1); + last = Util.getIntForIndex(interp, argv[3], size-1); if (first < 0) { first = 0; Index: src/jacl/tcl/lang/LsortCmd.java =================================================================== RCS file: /home/cvs/external/tcljava/src/jacl/tcl/lang/LsortCmd.java,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 LsortCmd.java --- LsortCmd.java 1998/10/14 21:09:20 1.1.1.1 +++ LsortCmd.java 2000/03/17 23:29:46 @@ -106,7 +106,7 @@ throw new TclException(interp, "\"-index\" option must be followed by list index"); } - sortIndex = TclInteger.getForIndex(interp, argv[i + 1], -2); + sortIndex = Util.getIntForIndex(interp, argv[i + 1], -2); command = argv[i + 1].toString(); i++; break; Index: src/jacl/tcl/lang/StringCmd.java =================================================================== RCS file: /home/cvs/external/tcljava/src/jacl/tcl/lang/StringCmd.java,v retrieving revision 1.2 diff -u -r1.2 StringCmd.java --- StringCmd.java 2000/03/10 18:05:02 1.2 +++ StringCmd.java 2000/03/17 23:29:46 @@ -152,11 +152,11 @@ int first, strlen, last; strlen = str.length(); - first = TclInteger.getForIndex(interp, argv[3], strlen-1); + first = Util.getIntForIndex(interp, argv[3], strlen-1); if (first < 0) { first = 0; } - last = TclInteger.getForIndex(interp, argv[4], strlen-1); + last = Util.getIntForIndex(interp, argv[4], strlen-1); if (last >= strlen) { last = strlen-1; } Index: src/jacl/tcl/lang/Util.java =================================================================== RCS file: /home/cvs/external/tcljava/src/jacl/tcl/lang/Util.java,v retrieving revision 1.6 diff -u -r1.6 Util.java --- Util.java 2000/03/10 18:05:02 1.6 +++ Util.java 2000/03/17 23:29:46 @@ -1,7 +1,7 @@ /* * Util.java -- * - * This class handles Tcl expressions. + * This class provides useful Tcl utility methods. * * Copyright (c) 1997 Cornell University. * Copyright (c) 1997-1999 by Sun Microsystems, Inc. @@ -311,7 +311,118 @@ return (int)( res.value); } } + +/* + *---------------------------------------------------------------------- + * + * TclGetIntForIndex -> Util.getIntForIndex + * + * This procedure returns an integer corresponding to the list index + * held in a Tcl object. The Tcl object's value is expected to be + * either an integer or a string of the form "end([+-]integer)?". + * + * Results: + * The return value is the index that is found from the string. If + * the Tcl object referenced by tobj has the value "end", the + * value stored is endValue. If tobj's value is not of the form + * "end([+-]integer)?" and it + * can not be converted to an integer, an exception is raised. + * + * Side effects: + * The object referenced by tobj might be converted to an + * integer object. + * + *---------------------------------------------------------------------- + */ +static final int getIntForIndex(Interp interp, TclObject tobj, int endValue) + throws TclException { + int length, offset; + if (tobj.getInternalRep() instanceof TclInteger) { + return TclInteger.get(interp, tobj); + } + + String bytes = tobj.toString(); + length = bytes.length(); + + String intforindex_error = "bad index \"" + bytes + + "\": must be integer or end?-integer?" + checkBadOctal(interp, bytes); + + // FIXME : should we replace this call to regionMatches with a generic strncmp? + if (! "end".regionMatches(0, bytes, 0, (length > 3) ? 3 : length)) { + try { + offset = TclInteger.get(null, tobj); + } catch (TclException e) { + throw new TclException(interp, intforindex_error); + } + return offset; + } + + if (length <= 3) { + return endValue; + } else if (bytes.charAt(3) == '-') { + // This is our limited string expression evaluator + + offset = Util.getInt(interp, bytes.substring(3)); + return endValue + offset; + } else { + throw new TclException(interp, intforindex_error); + } +} + +/* + *---------------------------------------------------------------------- + * + * TclCheckBadOctal -> Util.checkBadOctal + * + * This procedure checks for a bad octal value and returns a + * meaningful error that should be appended to the interp's result. + * + * Results: + * Returns error message if it was a bad octal. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static final String +checkBadOctal( + Interp interp, // Interpreter to use for error reporting. + // If NULL, then no error message is returned. + String value) +{ + int p = 0; + final int len = value.length(); + + // A frequent mistake is invalid octal values due to an unwanted + // leading zero. Try to generate a meaningful error message. + + while (p < len && Character.isWhitespace(value.charAt(p))) { + p++; + } + if ((p < len) && (value.charAt(p) == '+' || value.charAt(p) == '-')) { + p++; + } + if ((p < len) && (value.charAt(p) == '0')) { + while ((p < len) && + Character.isDigit(value.charAt(p))) { // INTL: digit. + p++; + } + while ((p < len) && + Character.isWhitespace(value.charAt(p))) { // INTL: ISO space. + p++; + } + if (p >= len) { + // Reached end of string + if (interp != null) { + return " (looks like invalid octal number)"; + } + } + } + return ""; +} /* *---------------------------------------------------------------------- Index: src/tcljava/tcl/lang/TclInteger.java =================================================================== RCS file: /home/cvs/external/tcljava/src/tcljava/tcl/lang/TclInteger.java,v retrieving revision 1.2 diff -u -r1.2 TclInteger.java --- TclInteger.java 1999/05/15 23:52:54 1.2 +++ TclInteger.java 2000/03/17 23:29:46 @@ -119,39 +119,6 @@ } /** - * Returns the integer value of the object that can be used as an index. - * - * @param interp current interpreter. - * @param tobj the object to operate on. - * @param endValue the value of "end". - * @return the integer value of the object. - * @exception TclException if the object is not a valid Tcl integer or - * "end" - */ - public static int getForIndex(Interp interp, TclObject tobj, int endValue) - throws TclException { - InternalRep rep = tobj.getInternalRep(); - - if (rep instanceof TclInteger) { - TclInteger tint = (TclInteger)(tobj.getInternalRep()); - return tint.value; - } - - String end = "end"; - if (end.startsWith(tobj.toString())) { - return endValue; - } - try { - setIntegerFromAny(interp, tobj); - } catch (TclException e) { - throw new TclException(interp, "bad index \"" + tobj.toString() + - "\": must be integer or \"end\""); - } - TclInteger tint = (TclInteger)(tobj.getInternalRep()); - return tint.value; - } - - /** * Changes the integer value of the object. * * @param interp current interpreter. Index: tests/tcl/lindex.test =================================================================== RCS file: /home/cvs/external/tcljava/tests/tcl/lindex.test,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 lindex.test --- lindex.test 1998/10/14 21:09:25 1.1.1.1 +++ lindex.test 2000/03/17 23:29:46 @@ -49,7 +49,7 @@ } {1 {wrong # args: should be "lindex list index"}} test lindex-2.3 {error conditions} { list [catch {lindex 1 2a2} msg] $msg -} {1 {bad index "2a2": must be integer or "end"}} +} {1 {bad index "2a2": must be integer or end?-integer?}} test lindex-2.4 {error conditions} { list [catch {lindex "a \{" 2} msg] $msg } {1 {unmatched open brace in list}} Index: tests/tcl/linsert.test =================================================================== RCS file: /home/cvs/external/tcljava/tests/tcl/linsert.test,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 linsert.test --- linsert.test 1998/10/14 21:09:26 1.1.1.1 +++ linsert.test 2000/03/17 23:29:46 @@ -14,6 +14,9 @@ if {[string compare test [info procs test]] == 1} then {source defs} +catch {unset lis} +catch {rename p ""} + test linsert-1.1 {linsert command} { linsert {1 2 3 4 5} 0 a } {a 1 2 3 4 5} @@ -71,6 +74,9 @@ test linsert-1.19 {linsert command} { linsert {} end q r } {q r} +test linsert-1.20 {linsert command, use of end-int index} { + linsert {a b c d} end-2 e f +} {a b e f c d} test linsert-2.1 {linsert errors} { list [catch linsert msg] $msg @@ -80,7 +86,7 @@ } {1 {wrong # args: should be "linsert list index element ?element ...?"}} test linsert-2.3 {linsert errors} { list [catch {linsert a 12x 2} msg] $msg -} {1 {bad index "12x": must be integer or "end"}} +} {1 {bad index "12x": must be integer or end?-integer?}} test linsert-2.4 {linsert errors} { list [catch {linsert \{ 12 2} msg] $msg } {1 {unmatched open brace in list}} @@ -92,3 +98,12 @@ } p } "a b c" +test linsert-3.2 {linsert won't modify shared argument objects} { + catch {unset lis} + set lis [format "a \"%s\" c" "b"] + linsert $lis 0 [string length $lis] +} "7 a b c" + +# cleanup +catch {unset lis} +catch {rename p ""} Index: tests/tcl/lrange.test =================================================================== RCS file: /home/cvs/external/tcljava/tests/tcl/lrange.test,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 lrange.test --- lrange.test 1998/10/14 21:09:26 1.1.1.1 +++ lrange.test 2000/03/17 23:29:46 @@ -6,6 +6,7 @@ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994 Sun Microsystems, Inc. +# Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -71,10 +72,10 @@ } {1 {wrong # args: should be "lrange list first last"}} test lrange-2.3 {error conditions} { list [catch {lrange a b 6} msg] $msg -} {1 {bad index "b": must be integer or "end"}} +} {1 {bad index "b": must be integer or end?-integer?}} test lrange-2.4 {error conditions} { list [catch {lrange a 0 enigma} msg] $msg -} {1 {bad index "enigma": must be integer or "end"}} +} {1 {bad index "enigma": must be integer or end?-integer?}} test lrange-2.5 {error conditions} { list [catch {lrange "a \{b c" 3 4} msg] $msg } {1 {unmatched open brace in list}} Index: tests/tcl/lreplace.test =================================================================== RCS file: /home/cvs/external/tcljava/tests/tcl/lreplace.test,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 lreplace.test --- lreplace.test 1998/10/14 21:09:25 1.1.1.1 +++ lreplace.test 2000/03/17 23:29:46 @@ -6,6 +6,7 @@ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994 Sun Microsystems, Inc. +# Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -99,16 +100,27 @@ } {1 {wrong # args: should be "lreplace list first last ?element element ...?"}} test lreplace-2.3 {lreplace errors} { list [catch {lreplace x a 10} msg] $msg -} {1 {bad index "a": must be integer or "end"}} +} {1 {bad index "a": must be integer or end?-integer?}} test lreplace-2.4 {lreplace errors} { list [catch {lreplace x 10 x} msg] $msg -} {1 {bad index "x": must be integer or "end"}} +} {1 {bad index "x": must be integer or end?-integer?}} test lreplace-2.5 {lreplace errors} { list [catch {lreplace x 10 1x} msg] $msg -} {1 {bad index "1x": must be integer or "end"}} +} {1 {bad index "1x": must be integer or end?-integer?}} test lreplace-2.6 {lreplace errors} { list [catch {lreplace x 3 2} msg] $msg } {1 {list doesn't contain element 3}} test lreplace-2.7 {lreplace errors} { list [catch {lreplace x 1 1} msg] $msg } {1 {list doesn't contain element 1}} + +test lreplace-3.1 {lreplace won't modify shared argument objects} { + proc p {} { + lreplace "a b c" 1 1 "x y" + return "a b c" + } + p +} "a b c" + +# cleanup +catch {unset foo} Index: tests/tcl/string.test =================================================================== RCS file: /home/cvs/external/tcljava/tests/tcl/string.test,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 string.test --- string.test 1998/10/14 21:09:26 1.1.1.1 +++ string.test 2000/03/17 23:29:46 @@ -233,10 +233,10 @@ } {1 {wrong # args: should be "string range string first last"}} test string-7.12 {string range} { list [catch {string range abc abc 1} msg] $msg -} {1 {bad index "abc": must be integer or "end"}} +} {1 {bad index "abc": must be integer or end?-integer?}} test string-7.13 {string range} { list [catch {string range abc 1 eof} msg] $msg -} {1 {bad index "eof": must be integer or "end"}} +} {1 {bad index "eof": must be integer or end?-integer?}} test string-7.14 {string range} { string range abcdefghijklmnop end end } {p} ---------------------------------------------------------------- The TclJava mailing list is sponsored by Scriptics Corporation. To subscribe: send mail to [EMAIL PROTECTED] with the word SUBSCRIBE as the subject. To unsubscribe: send mail to [EMAIL PROTECTED] with the word UNSUBSCRIBE as the subject. To send to the list, send email to '[EMAIL PROTECTED]'. An archive is available at http://www.mail-archive.com/tcljava@scriptics.com