blob: 82d765ca1459cbb461f9130a29aaba453b79651b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// $Id$
#include "PSDL_Scope.h"
#include "PSDL_Extern.h"
#include "Dump_Visitor.h"
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
void *result_ptr = 0;
TAO_PSDL_Extern psdl_extern;
if (argc < 2)
psdl_extern.TAO_PSDL_Extern_yyin (stdin);
else
psdl_extern.TAO_PSDL_Extern_yyin (ACE_OS::fopen (argv[1], "r"));
ACE_OS::strtok (argv[1], ACE_TEXT ("."));
TAO_PSDL_Scope::instance ()->set_stub_prefix (ACE_TEXT_ALWAYS_CHAR (argv[1]));
TAO_PSDL_Scope::instance ()->set_root_scope ();
// The syntax is checked and ASTs are build.
int result = psdl_extern.TAO_PSDL_Extern_yyparse (result_ptr);
if (result != 0)
{
ACE_DEBUG ((LM_ERROR,
"Error in yyparse\n"));
return -1;
}
TAO_PSDL_Node *tree_node = psdl_extern.TAO_PSDL_Extern_yyval ();
// The following segment of the code is for printing out a parse
// tree. To-Do: have a parse option so that
// the parse tree will be printed out when that option is used.
// {@@
/*Dump_Visitor visitor (0);
int result_visitor = tree_node->accept (&visitor);
if (result_visitor != 0)
ACE_DEBUG ((LM_DEBUG,
"Error in creating the parse tree\n"));
// @@}
*/
// This segment is responsible for generating code
// for the stubs.
// {@@
TAO_PSDL_Node_Visitor node_visitor;
result = tree_node->accept (&node_visitor);
if (result != 0)
{
ACE_DEBUG ((LM_ERROR,
"Error in writing the stubs\n"));
return -1;
}
// @@}
return 0;
}
|