summaryrefslogtreecommitdiffstats
path: root/stap.1.in
diff options
context:
space:
mode:
authordsmith <dsmith>2006-11-06 16:05:50 +0000
committerdsmith <dsmith>2006-11-06 16:05:50 +0000
commit27f21e8c049b0cd20fd2d4e2fd9b96cad6c910cc (patch)
tree78fad282ce4f36ad50a3b944d6c659941591d5f6 /stap.1.in
parenta90b629e6fe7420caeb0f7494f712c9664afbdc8 (diff)
downloadsystemtap-steved-27f21e8c049b0cd20fd2d4e2fd9b96cad6c910cc.tar.gz
systemtap-steved-27f21e8c049b0cd20fd2d4e2fd9b96cad6c910cc.tar.xz
systemtap-steved-27f21e8c049b0cd20fd2d4e2fd9b96cad6c910cc.zip
2006-11-06 David Smith <dsmith@redhat.com>
Added "limit EXP" support to foreach statements. * translate.cxx (c_tmpcounter::visit_foreach_loop): Handles "limit" member variable. (c_unparser::visit_foreach_loop): Ditto. * staptree.cxx (foreach_loop::print): Prints "limit EXP" addition. (traversing_visitor::visit_foreach_loop): Handles "limit" member variable. (deep_copy_visitor::visit_foreach_loop): Ditto. * staptree.h (struct foreach_loop): Added "limit" member variable. * stap.1.in: Added documentation for the "limit EXP" addition to foreach statement. * parse.cxx (lexer::scan): Added "limit" keyword for foreach statements. (parser::parse_foreach_loop): Parses "limit" keyword for foreach statements. * elaborate.cxx (symresolution_info::visit_foreach_loop): Handles "limit" member variable. (typeresolution_info::visit_foreach_loop): Ditto.
Diffstat (limited to 'stap.1.in')
-rw-r--r--stap.1.in9
1 files changed, 7 insertions, 2 deletions
diff --git a/stap.1.in b/stap.1.in
index 7b572943..8b3f7409 100644
--- a/stap.1.in
+++ b/stap.1.in
@@ -304,15 +304,20 @@ While integer-valued EXP evaluates to non-zero, execute STMT.
Execute EXP1 as initialization. While EXP2 is non-zero, execute
STMT, then the iteration expression EXP3.
.TP
-.BR foreach " (VAR " in " ARRAY) STMT"
+.BR foreach " (VAR " in " ARRAY [ "limit " EXP ]) STMT"
Loop over each element of the named global array, assigning current
key to VAR. The array may not be modified within the statement.
By adding a single
.BR + " or " \-
operator after the VAR or the ARRAY identifier, the iteration will
proceed in a sorted order, by ascending or descending index or value.
+
+Using the optional
+.BR limit
+keyword limits the number of loop iterations to EXP times. EXP is
+evaluted once at the beginning of the loop.
.TP
-.BR foreach " ([VAR1, VAR2, ...] " in " ARRAY) STMT"
+.BR foreach " ([VAR1, VAR2, ...] " in " ARRAY [ "limit " EXP ]) STMT"
Same as above, used when the array is indexed with a tuple of keys.
A sorting suffix may be used on at most one VAR or ARRAY identifier.
.TP