psdl_tao.cpp File Reference

#include "PSDL_Scope.h"
#include "PSDL_Extern.h"
#include "Dump_Visitor.h"

Include dependency graph for psdl_tao.cpp:

Include dependency graph

Go to the source code of this file.

Functions

int main (int argc, char *argv[])


Function Documentation

int main int  argc,
char *  argv[]
 

Definition at line 7 of file psdl_tao.cpp.

References TAO_PSDL_Node::accept(), ACE_DEBUG, TAO_PSDL_Scope::instance(), LM_ERROR, TAO_PSDL_Scope::set_root_scope(), TAO_PSDL_Scope::set_stub_prefix(), ACE_OS::strtok(), TAO_PSDL_Extern::TAO_PSDL_Extern_yyin(), TAO_PSDL_Extern::TAO_PSDL_Extern_yyparse(), and TAO_PSDL_Extern::TAO_PSDL_Extern_yyval().

00008 {
00009   void *result_ptr = 0;
00010 
00011   TAO_PSDL_Extern psdl_extern;
00012 
00013   if (argc < 2)
00014     psdl_extern.TAO_PSDL_Extern_yyin (stdin);
00015   else
00016     psdl_extern.TAO_PSDL_Extern_yyin (ACE_OS::fopen (argv[1], "r"));
00017 
00018   ACE_OS::strtok (argv[1], ".");
00019 
00020   TAO_PSDL_Scope::instance ()->set_stub_prefix (argv[1]);
00021   TAO_PSDL_Scope::instance ()->set_root_scope ();
00022 
00023   // The syntax is checked and ASTs are build.
00024   int result = psdl_extern.TAO_PSDL_Extern_yyparse (result_ptr);
00025 
00026   if (result != 0)
00027   {
00028     ACE_DEBUG ((LM_ERROR,
00029                 "Error in yyparse\n"));
00030     return -1;
00031   }
00032 
00033   TAO_PSDL_Node *tree_node = psdl_extern.TAO_PSDL_Extern_yyval ();
00034 
00035   // The following segment of the code is for printing out a parse
00036   // tree. To-Do: have a parse option so that
00037   // the parse tree will be printed out when that option is used.
00038   // {@@
00039   /*Dump_Visitor visitor (0);
00040 
00041   int result_visitor = tree_node->accept (&visitor);
00042 
00043   if (result_visitor != 0)
00044     ACE_DEBUG ((LM_DEBUG,
00045                 "Error in creating the parse tree\n"));
00046   // @@}
00047   */
00048 
00049   // This segment is responsible for generating code
00050   // for the stubs.
00051   // {@@
00052   TAO_PSDL_Node_Visitor node_visitor;
00053 
00054   result = tree_node->accept (&node_visitor);
00055 
00056   if (result != 0)
00057     {
00058       ACE_DEBUG ((LM_ERROR,
00059                   "Error in writing the stubs\n"));
00060       return -1;
00061     }
00062   // @@}
00063 
00064   return 0;
00065 }


Generated on Thu Nov 9 14:07:50 2006 for TAO_PSS by doxygen 1.3.6