CLASS
tcl.lang.TclList -- This class is used to create, modify and read from Tcl list objects.
IMPLEMENTS
tcl.lang.InternalRep
METHODS
static TclObject newInstance()
static void append(Interp interp, TclObject tobj, TclObject elem) throws TclException
static int getLength(Interp interp, TclObject tobj) throws TclException
static TclObject[ ] getElements(Interp interp, TclObject tobj) throws TclException
static TclObject index(Interp interp, TclObject tobj, int index) throws TclException
static void replace(Interp interp, TclObject tobj, int index, int count, TclObject elts[], int from, int to)
ARGUMENTS
DESCRIPTION
newInstance
append
getLength
getElements
index
replace
EQUIVALENT C FUNCTIONS
SEE ALSO
KEYWORDS

CLASS

tcl.lang.TclList -- This class is used to create, modify and read from Tcl list objects.

IMPLEMENTS

tcl.lang.InternalRep

METHODS

static TclObject newInstance()

static void append(Interp interp, TclObject tobj, TclObject elem) throws TclException

static int getLength(Interp interp, TclObject tobj) throws TclException

static TclObject[ ] getElements(Interp interp, TclObject tobj) throws TclException

static TclObject index(Interp interp, TclObject tobj, int index) throws TclException

static void replace(Interp interp, TclObject tobj, int index, int count, TclObject elts[], int from, int to)

ARGUMENTS

Interp interp
If an error occurs while converting an object to be a list object, an error message is left in the interpreter's result object unless interp is null.

TclObject tobj
Points to the list object to be manipulated. If tobj does not already point to a list object, an attempt will be made to convert it to one.

TclObject elem
Points to a list object containing elements to be appended onto tobj.

TclObject elts[]
An array of TclObjects to reaplace those in the list object tobj.

int index
The index of the element of tobj in question.

int count
The number of elements of the tobj to replace.

int from
The index of the first replacement element in elts.

int to
The index of the last replacement element in elts.

DESCRIPTION

The TclList class is used to create, modify and read from Tcl list objects. All of the methods defined below attempt to change the internal representation of tobj parameters to TclList. If such a conversion fails (e.g., the string value of tobj is not a proper Tcl list), a TclException is thrown, and an appropriate error message is left in interp's result if interp is not null.

Tcl list objects have an internal representation that supports the efficient indexing and appending. The procedures described in this man page are used to create, modify, index, and append to Tcl list objects from Java code. In all cases where tobj is an argument, if tobj is not a TclList, then an attempt is made to convert it to a TclList. If the attempt fails, a TclException is thrown.

newInstance
The newInstance method creates and returns a new empty TclList.

append
The append method adds one object, elem, to the end of the list object referenced by tobj. After appending the element, append increments the element's reference count since tobj now also refers to it.

getLength
The getLength method returns the number of elements in tobj.

getElements
The getElements method converts the TclList tobj to an array of TclObjects. The objects referenced by the returned array should be treated as readonly, and their ref counts are not incremented.

index
The index method returns a pointer to the indexth element of tobj. If index is negative or greater than or equal to the number of elements in the list, null is returned.

replace
The replace mehtod replaces zero or more elements of the list referenced by tobj with the objects in elts ranging from from to to.

EQUIVALENT C FUNCTIONS

Tcl_NewListObj, Tcl_ListObjAppendList, Tcl_ListObjLength, Tcl_ListObjGetElements, Tcl_ListObjIndex, Tcl_ListObjReplace

SEE ALSO

InternalRep, TclObject, TclIndex, TclDouble, TclString, TclInteger, TclBoolean, ReflectObject

KEYWORDS

append, index, insert, internal representation, length, list, list object, list type, object, object type, replace
Copyright © 1996-1998 Sun Microsystems, Inc.
Copyright © 1995-1997 Roger E. Critchlow Jr.