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. --- translate.cxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'translate.cxx') diff --git a/translate.cxx b/translate.cxx index 276382e5..bd1f576a 100644 --- a/translate.cxx +++ b/translate.cxx @@ -1538,6 +1538,12 @@ c_unparser::visit_foreach_loop (foreach_loop *s) // // varlock_r guard (*this, mv); + // sort array if desired + if (s->sort_direction) + o->newline() << "_stp_map_sort (" << mv.qname() << ", " + << s->sort_column << ", " << - s->sort_direction << ");"; + // NB: sort direction sense is opposite in runtime, thus the negation + o->newline() << iv << " = " << iv.start (mv) << ";"; // condition -- cgit