Midge  v3.9.2
Data Processing Framework
midge.cc
Go to the documentation of this file.
1 #include "midge_builder.hh"
2 #include "coremsg.hh"
3 #include "arguments.hh"
4 #include "compiler.hh"
5 #include "evaluator.hh"
6 #include "lexer.hh"
7 
8 #include <iostream>
9 
10 using namespace midge;
11 
12 using std::cout;
13 using std::endl;
14 
15 int main( int p_count, char** p_values )
16 {
17  arguments t_arguments;
18  t_arguments.required( "json" );
19 
20  try
21  {
22  t_arguments.start( p_count, p_values );
23  }
24  catch( const error& t_error )
25  {
26  msg_error( coremsg, "error occured in arguments:" << ret );
27  msg_error( coremsg, " " << t_error.what() << eom );
28  return -1;
29  }
30 
31  msg_normal( coremsg, "welcome to midge" << eom );
32  msg_normal( coremsg, "processing..." << eom );
33 
34  lexer t_lexer;
35  evaluator t_evaluator( t_arguments );
36  compiler t_compiler;
37 
38  t_evaluator.insert_after( &t_lexer );
39  t_compiler.insert_after( &t_evaluator );
40 
41  try
42  {
43  t_lexer( t_arguments.value< string >( "json" ) );
44  }
45  catch( const error& t_error )
46  {
47  msg_error( coremsg, "error occurred during lexing:" << ret );
48  msg_error( coremsg, " " << t_error.what() << eom );
49  return -1;
50  }
51 
52  try
53  {
54  t_arguments.stop();
55  }
56  catch( const error& t_error )
57  {
58  msg_error( msg, "an error occured in arguments:" << ret );
59  msg_error( msg, " " << t_error.what() << eom );
60  return -1;
61  }
62 
63  midge_builder t_builder;
64 
65  try
66  {
67  t_builder( t_compiler() );
68  }
69  catch( const error& t_error )
70  {
71  msg_error( coremsg, "error occurred during execution:" << ret );
72  msg_error( coremsg, " " << t_error.what() << eom );
73  return -1;
74  }
75 
76  msg_normal( coremsg, "...processing complete" << eom );
77  msg_normal( coremsg, "goodbye" << eom );
78 
79  return 0;
80 }
static const message_end eom
Definition: _buffer.hh:11
static const message_line ret
int main(int p_count, char **p_values)
Definition: midge.cc:15
#define msg_normal(x_name, x_content)
#define msg_error(x_name, x_content)