From 934845563af3c85df78c17ee4752caa100ea6157 Mon Sep 17 00:00:00 2001 From: fche Date: Fri, 7 Oct 2005 19:09:02 +0000 Subject: 2005-10-07 Frank Ch. Eigler PR 1366. * staptree.h (foreach_loop): Add sort_column, sort_direction fields. * parse.cxx (parse_foreach_loop): Parse "+"/"-" suffix operators. * stap.1.in, stapex.5.in: Document them. * staptree.cxx (foreach_loop print, copy): Propagate them. * translate.cxx (visit_foreach_loop): Support them. * testsuite/parseok/fifteen.stp, parseko/thirteen.stp, buildok/twentyone.stp: Test them. 2005-10-07 Frank Ch. Eigler PR 1366. * systemtap.samples/primes.*: Sort foreach gratuitiously. --- staptree.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'staptree.cxx') diff --git a/staptree.cxx b/staptree.cxx index a1e82158..94fd540d 100644 --- a/staptree.cxx +++ b/staptree.cxx @@ -359,8 +359,13 @@ void foreach_loop::print (ostream& o) const { if (i > 0) o << ", "; indexes[i]->print (o); + if (sort_direction != 0 && sort_column == i+1) + o << (sort_direction > 0 ? "+" : "-"); } - o << "] in " << base << ") "; + o << "] in " << base; + if (sort_direction != 0 && sort_column == 0) + o << (sort_direction > 0 ? "+" : "-"); + o << ") "; block->print (o); } @@ -1185,6 +1190,8 @@ deep_copy_visitor::visit_foreach_loop (foreach_loop* s) } n->base = s->base; n->base_referent = NULL; + n->sort_direction = s->sort_direction; + n->sort_column = s->sort_column; require (this, &(n->block), s->block); provide (this, n); } -- cgit