From 69c68955b910a9f284fa25b9ebb30eff5c040e0b Mon Sep 17 00:00:00 2001 From: fche Date: Thu, 2 Jun 2005 19:43:55 +0000 Subject: 2005-06-02 Frank Ch. Eigler Parse foreach construct. Added fuller copyright notices throughout. * staptree.h (foreach_loop): New tree node type. * staptree.cxx: Print it, visit it, love it, leave it. * parse.cxx: Parse it. (parse_stmt_block): Don't require ";" separators between statements. (parse_array_in): Use [] as index group operator instead of (). * elaborate.cxx (visit_foreach_loop): New code. * translate.cxx: Slightly tighten errorcount/actioncount handling. * main.cxx: Accept "-" as script file name standing for stdin. (visit_arrayindex): Switch to simpler set_arity call. * configure.ac: Generate DATE macro. * Makefile.in, configure, config.in: Regenerated. * testsuite/*: New/updated tests for syntax changes, foreach (). --- main.cxx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'main.cxx') diff --git a/main.cxx b/main.cxx index 94026001..4ab4e0bd 100644 --- a/main.cxx +++ b/main.cxx @@ -1,6 +1,10 @@ // systemtap translator driver -// Copyright 2005 Red Hat Inc. -// GPL +// Copyright (C) 2005 Red Hat Inc. +// +// This file is part of systemtap, and is free software. You can +// redistribute it and/or modify it under the terms of the GNU General +// Public License (GPL); either version 2, or (at your option) any +// later version. #include "config.h" #include "staptree.h" @@ -20,9 +24,13 @@ extern "C" { using namespace std; - void usage () { + cerr << "SystemTap translator " + << "(version " << VERSION << " built " << DATE << ")" << endl; + cerr << "Copyright (C) 2005 Red Hat, Inc." << endl; + cerr << "This is free software; see the source for copying conditions." << endl; + cerr << endl; cerr << "Usage: stap [options] FILE [ARGS ...] \tRun script files." << endl; cerr << " or: stap [options] -e PROGRAM [ARGS ...]\tRun script." << endl; cerr << endl; @@ -118,7 +126,9 @@ main (int argc, char * const argv []) // PASS 1a: PARSING USER SCRIPT // XXX: pass args vector, so parser (or lexer?) can substitute // $1..$NN with actual arguments - if (script_file != "") + if (script_file == "-") + s.user_file = parser::parse (cin); + else if (script_file != "") s.user_file = parser::parse (script_file); else { -- cgit