src
Namespaces | Functions
main.cc File Reference
#include "src/util/c99_stdint.h"
#include <string>
#include "src/codegen/output.h"
#include "src/conf/msg.h"
#include "src/conf/opt.h"
#include "src/conf/warn.h"
#include "src/globals.h"
#include "src/parse/input.h"
#include "src/parse/parser.h"
#include "src/parse/scanner.h"
Include dependency graph for main.cc:

Go to the source code of this file.

Namespaces

 re2c
 

Functions

int main (int, char *argv[])
 

Function Documentation

int main ( int  ,
char *  argv[] 
)

Definition at line 26 of file main.cc.

27 {
28  switch (parse_opts (argv, opts))
29  {
30  case OK: break;
31  case EXIT_OK: return 0;
32  case EXIT_FAIL: return 1;
33  }
34 
35  // set up the source stream
37  if (!input.open ())
38  {
39  error ("cannot open source file: %s", opts.source_file);
40  return 1;
41  }
42 
43  // set up the output streams
45  if (!output.source.open ())
46  {
47  error ("cannot open output file: %s", opts.output_file);
48  return 1;
49  }
50  if (opts->tFlag && !output.header.open ())
51  {
52  error ("cannot open header file: %s", opts->header_file);
53  return 1;
54  }
55 
56  Scanner scanner (input, output.source);
57  parse (scanner, output);
58 
59  return warn.error () ? 1 : 0;
60 }
bool tFlag
Definition: opt.h:118
void error(const char *fmt,...)
Definition: msg.cc:10
void parse(Scanner &, Output &)
Warn warn
Definition: warn.cc:11
const char * output_file
Definition: opt.h:154
const char * header_file
Definition: opt.h:118
Definition: opt.h:209
Opt opts
Definition: opt.cc:7
bool error() const
Definition: warn.cc:34
parse_opts_t parse_opts(char **argv, Opt &opts)
const char * source_file
Definition: opt.h:153

Here is the call graph for this function: