1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
[manpage_begin struct::stack n 1.3.1]
[moddesc {Tcl Data Structures}]
[titledesc {Create and manipulate stack objects}]
[require Tcl 8.2]
[require struct::stack [opt 1.3.1]]
[description]
The [cmd ::struct::stack] command creates a new stack object with an
associated global Tcl command whose name is [emph stackName]. This
command may be used to invoke various operations on the stack. It has
the following general form:
[list_begin definitions]
[call [arg stackName] [cmd option] [opt [arg "arg arg ..."]]]
[arg Option] and the [arg arg]s determine the exact behavior of the
command. The following commands are possible for stack objects:
[call [arg stackName] [cmd clear]]
Remove all items from the stack.
[call [arg stackName] [cmd destroy]]
Destroy the stack, including its storage space and associated command.
[call [arg stackName] [cmd peek] [opt "[arg count]"]]
Return the top [arg count] items of the stack, without removing them from
the stack. If [arg count] is not specified, it defaults to 1. If
[arg count] is 1, the result is a simple string; otherwise, it is a
list. If specified, [arg count] must be greater than or equal to 1.
If there are not enoughs items on the stack to fulfull the request,
this command will throw an error.
[call [arg stackName] [cmd pop] [opt "[arg count]"]]
Return the top [arg count] items of the stack, and remove them
from the stack. If [arg count] is not specified, it defaults to 1.
If [arg count] is 1, the result is a simple string; otherwise, it is a
list. If specified, [arg count] must be greater than or equal to 1.
If there are not enoughs items on the stack to fulfull the request,
this command will throw an error.
[call [arg stackName] [cmd push] [arg item] [opt "[arg "item ..."]"]]
Push the [arg item] or items specified onto the stack. If more than
one [arg item] is given, they will be pushed in the order they are
listed.
[call [arg stackName] [cmd size]]
Return the number of items on the stack.
[list_end]
[section {BUGS, IDEAS, FEEDBACK}]
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category [emph {struct :: stack}] of the
[uri {http://sourceforge.net/tracker/?group_id=12883} {Tcllib SF Trackers}].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
[keywords queue matrix tree graph]
[manpage_end]
|