96 lines
3.9 KiB
Plaintext
96 lines
3.9 KiB
Plaintext
'\"
|
|
'\" Copyright (c) 1993 The Regents of the University of California.
|
|
'\" All rights reserved.
|
|
'\"
|
|
'\" Permission is hereby granted, without written agreement and without
|
|
'\" license or royalty fees, to use, copy, modify, and distribute this
|
|
'\" documentation for any purpose, provided that the above copyright
|
|
'\" notice and the following two paragraphs appear in all copies.
|
|
'\"
|
|
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
|
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
|
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
|
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
'\"
|
|
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
|
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
|
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
|
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
|
'\"
|
|
'\" $Header: /user6/ouster/tcl/man/RCS/array.n,v 1.1 93/04/14 16:52:55 ouster Exp $ SPRITE (Berkeley)
|
|
'\"
|
|
.so man.macros
|
|
.HS array tcl
|
|
.BS
|
|
'\" Note: do not modify the .SH NAME line immediately below!
|
|
.SH NAME
|
|
array \- Manipulate array variables
|
|
.SH SYNOPSIS
|
|
\fBarray \fIoption arrayName\fR ?\fIarg arg ...\fR?
|
|
.BE
|
|
|
|
.SH DESCRIPTION
|
|
.PP
|
|
This command performs one of several operations on the
|
|
variable given by \fIarrayName\fR.
|
|
\fIArrayName\fR must be the name of an existing array variable.
|
|
The \fIoption\fR argument determines what action is carried
|
|
out by the command.
|
|
The legal \fIoptions\fR (which may be abbreviated) are:
|
|
.TP
|
|
\fBarray anymore \fIarrayName searchId\fR
|
|
Returns 1 if there are any more elements left to be processed
|
|
in an array search, 0 if all elements have already been
|
|
returned.
|
|
\fISearchId\fR indicates which search on \fIarrayName\fR to
|
|
check, and must have been the return value from a previous
|
|
invocation of \fBarray startsearch\fR.
|
|
This option is particularly useful if an array has an element
|
|
with an empty name, since the return value from
|
|
\fBarray nextelement\fR won't indicate whether the search
|
|
has been completed.
|
|
.TP
|
|
\fBarray donesearch \fIarrayName searchId\fR
|
|
This command terminates an array search and destroys all the
|
|
state associated with that search. \fISearchId\fR indicates
|
|
which search on \fIarrayName\fR to destroy, and must have
|
|
been the return value from a previous invocation of
|
|
\fBarray startsearch\fR. Returns an empty string.
|
|
.TP
|
|
\fBarray names \fIarrayName\fR
|
|
Returns a list containing the names of all of the elements in
|
|
the array.
|
|
If there are no elements in the array then an empty string is
|
|
returned.
|
|
.TP
|
|
\fBarray nextelement \fIarrayName searchId\fR
|
|
Returns the name of the next element in \fIarrayName\fR, or
|
|
an empty string if all elements of \fIarrayName\fR have
|
|
already been returned in this search. The \fIsearchId\fR
|
|
argument identifies the search, and must have
|
|
been the return value of an \fBarray startsearch\fR command.
|
|
Warning: if elements are added to or deleted from the array,
|
|
then all searches are automatically terminated just as if
|
|
\fBarray donesearch\fR had been invoked; this will cause
|
|
\fBarray nextelement\fR operations to fail for those searches.
|
|
.TP
|
|
\fBarray size \fIarrayName\fR
|
|
Returns a decimal string giving the number of elements in the
|
|
array.
|
|
.TP
|
|
\fBarray startsearch \fIarrayName\fR
|
|
This command initializes an element-by-element search through the
|
|
array given by \fIarrayName\fR, such that invocations of the
|
|
\fBarray nextelement\fR command will return the names of the
|
|
individual elements in the array.
|
|
When the search has been completed, the \fBarray donesearch\fR
|
|
command should be invoked.
|
|
The return value is a
|
|
search identifier that must be used in \fBarray nextelement\fR
|
|
and \fBarray donesearch\fR commands; it allows multiple
|
|
searches to be underway simultaneously for the same array.
|
|
|
|
.SH KEYWORDS
|
|
array, element names, search
|