binpac: Added an option to quiet the status output from binpac.

This adds the -q command line flag to quiet the output.
It also fixes a small compiler warning.
This commit is contained in:
Seth Hall 2011-01-20 15:34:39 -05:00 committed by Tim Wojtulewicz
parent c2dbefab17
commit 1a15b968e6
4 changed files with 14 additions and 4 deletions

View file

@ -12,6 +12,7 @@
using namespace std;
extern bool FLAGS_pac_debug;
extern bool FLAGS_quiet;
extern vector<string> FLAGS_include_directories;
extern string input_filename;
extern int line_number;

View file

@ -21,6 +21,7 @@ extern void switch_to_file(FILE* fp_input);
string input_filename;
bool FLAGS_pac_debug = false;
bool FLAGS_quiet = false;
string FLAGS_output_directory;
vector<string> FLAGS_include_directories;
@ -192,6 +193,7 @@ void usage()
fprintf(stderr, " <pac files> | pac-language input files\n");
fprintf(stderr, " -d <dir> | use given directory for compiler output\n");
fprintf(stderr, " -D | enable debugging output\n");
fprintf(stderr, " -q | stay quiet\n");
fprintf(stderr, " -h | show command line help\n");
fprintf(stderr, " -I <dir> | include <dir> in input file search path\n");
exit(1);
@ -203,7 +205,7 @@ int main(int argc, char* argv[])
extern char *malloc_options;
#endif
int o;
while ( (o = getopt(argc, argv, "DI:d:h")) != -1 )
while ( (o = getopt(argc, argv, "DqI:d:h")) != -1 )
{
switch(o)
{
@ -215,6 +217,10 @@ int main(int argc, char* argv[])
#endif
break;
case 'q':
FLAGS_quiet = true;
break;
case 'I':
// Add to FLAGS_include_directories
add_to_include_directories(optarg);

View file

@ -313,6 +313,7 @@ void switch_to_file(const char *filename)
input_filename = string(filename);
line_number = 1;
switch_to_file(yyin);
if ( !FLAGS_quiet )
fprintf(stderr, "switching to file %s\n", input_filename.c_str());
}

View file

@ -94,6 +94,7 @@ void TypeDecl::GenCode(Output* out_h, Output* out_cc)
if ( type_->tot() == Type::EXTERN || type_->tot() == Type::STRING )
return;
if ( !FLAGS_quiet )
fprintf(stderr, "Generating code for %s\n", class_name().c_str());
if ( RequiresAnalyzerContext::compute(type_) )
@ -125,7 +126,8 @@ void TypeDecl::GenCode(Output* out_h, Output* out_cc)
out_h->println("");
out_h->print("class %s", class_name().c_str());
bool first = true;
foreach(i, vector<string>, &base_classes)
vector<string>::iterator i;
for ( i = (&base_classes)->begin(); i != (&base_classes)->end(); ++i )
{
if ( first )
{