psdl_tao.cpp

Go to the documentation of this file.
00001 // psdl_tao.cpp,v 1.1 2002/07/25 15:25:51 pgontla Exp
00002 
00003 #include "PSDL_Scope.h"
00004 #include "PSDL_Extern.h"
00005 #include "Dump_Visitor.h"
00006 
00007 int main (int argc, char *argv [])
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:05 2006 for TAO_PSS by doxygen 1.3.6