be_extern.h File Reference

#include "be_global.h"

Include dependency graph for be_extern.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int BE_init (int &, ACE_TCHAR *[])
void BE_post_init (char *[], long)
void BE_version ()
void BE_produce ()
void BE_abort ()
void BE_cleanup ()

Variables

BE_GlobalDatabe_global


Function Documentation

void BE_abort (  ) 

Definition at line 101 of file be_produce.cpp.

References BE_cleanup().

Referenced by BE_produce(), postprocess(), and read_template().

00102 {
00103   ACE_ERROR((LM_ERROR, ACE_TEXT("Fatal Error - Aborting\n")));
00104   BE_cleanup();
00105   ACE_OS::exit(1);
00106 }

void BE_cleanup (  ) 

Definition at line 94 of file be_produce.cpp.

Referenced by BE_abort(), and BE_produce().

00095 {
00096   idl_global->destroy();
00097 }

int BE_init ( int &  ,
ACE_TCHAR *  [] 
)

Definition at line 28 of file be_init.cpp.

References be_global.

00029 {
00030   ACE_NEW_RETURN(be_global, BE_GlobalData, -1);
00031   return 0;
00032 }

void BE_post_init ( char *  [],
long   
)

Definition at line 35 of file be_init.cpp.

References BE_GlobalData::add_inc_path(), be_global, DDS_MAJOR_VERSION, DDS_MICRO_VERSION, and DDS_MINOR_VERSION.

00036 {
00037   std::ostringstream version;
00038   version << "-D__OPENDDS_IDL=0x"
00039           << std::setw(2) << std::setfill('0') << DDS_MAJOR_VERSION
00040           << std::setw(2) << std::setfill('0') << DDS_MINOR_VERSION
00041           << std::setw(2) << std::setfill('0') << DDS_MICRO_VERSION;
00042   DRV_cpp_putarg(version.str().c_str());
00043 
00044 #ifdef ACE_HAS_CDR_FIXED
00045   DRV_cpp_putarg("-D__OPENDDS_IDL_HAS_FIXED");
00046 #endif
00047 
00048   const char* env = ACE_OS::getenv("DDS_ROOT");
00049   if (env && env[0]) {
00050     std::string dds_root = env;
00051     if (dds_root.find(' ') != std::string::npos && dds_root[0] != '"') {
00052       dds_root.insert(dds_root.begin(), '"');
00053       dds_root.insert(dds_root.end(), '"');
00054     }
00055     be_global->add_inc_path(dds_root.c_str());
00056     ACE_CString included;
00057     DRV_add_include_path(included, dds_root.c_str(), 0, true);
00058   }
00059 }

void BE_produce (  ) 

Definition at line 283 of file be_produce.cpp.

References BE_GlobalData::add_include(), BE_abort(), BE_cleanup(), be_global, BE_GlobalData::face_ts(), BE_GlobalData::facets_header_, BE_GlobalData::facets_header_name_, BE_GlobalData::facets_impl_, BE_GlobalData::facets_impl_name_, BE_GlobalData::generate_itl(), BE_GlobalData::generate_wireshark(), BE_GlobalData::header_, BE_GlobalData::header_name_, BE_GlobalData::idl_, BE_GlobalData::idl_name_, BE_GlobalData::impl_, BE_GlobalData::impl_name_, BE_GlobalData::itl_, BE_GlobalData::itl_name_, BE_GlobalData::java_arg(), BE_GlobalData::lang_header_, BE_GlobalData::lang_header_name_, BE_GlobalData::LANGMAP_FACE_CXX, BE_GlobalData::LANGMAP_SP_CXX, BE_GlobalData::language_mapping(), BE_GlobalData::open_streams(), postprocess(), BE_GlobalData::set_inc_paths(), BE_GlobalData::STREAM_CPP, BE_GlobalData::STREAM_FACETS_CPP, BE_GlobalData::STREAM_FACETS_H, BE_GlobalData::STREAM_H, BE_GlobalData::STREAM_IDL, BE_GlobalData::STREAM_LANG_H, BE_GlobalData::STREAM_WS, BE_GlobalData::suppress_idl(), BE_GlobalData::writeFile(), BE_GlobalData::ws_config_, and BE_GlobalData::ws_config_name_.

00284 {
00285   //search for #includes in the IDL, add them as #includes in the stubs/skels
00286   const char* idl_fn = idl_global->main_filename()->get_string();
00287 
00288   ifstream idl(idl_fn);
00289   const size_t buffer_sz = 512;
00290   char buffer[buffer_sz];
00291 
00292   while (idl) {
00293     idl.getline(buffer, buffer_sz);
00294 
00295     if (0 == strncmp("#include", buffer, 8)) { //FUTURE: account for comments?
00296       string inc(buffer + 8);
00297       size_t delim1 = inc.find_first_of("<\"");
00298       size_t delim2 = inc.find_first_of(">\"", delim1 + 1);
00299       string included(inc, delim1 + 1, delim2 - delim1 - 1);
00300       size_t len = included.size();
00301       string base_name;
00302 
00303       if (len >= 5 &&
00304           0 == ACE_OS::strcasecmp(included.c_str() + len - 4, ".idl")) {
00305         base_name.assign(included.c_str(), len - 4);
00306 
00307       } else if (len >= 6 &&
00308                  0 == ACE_OS::strcasecmp(included.c_str() + len - 5, ".pidl")) {
00309         base_name.assign(included.c_str(), len - 5);
00310 
00311       } else {
00312         ACE_ERROR((LM_ERROR, ACE_TEXT("(%N:%l) BE_produce - included ")
00313                    ACE_TEXT("file must end in .idl or .pidl\n")));
00314         BE_abort();
00315       }
00316 
00317       string stb_inc = base_name + "C.h";
00318       if (stb_inc != "tao/orbC.h") {
00319         be_global->add_include(stb_inc.c_str());
00320         if (stb_inc == "orbC.h" ||
00321             (stb_inc.size() >= 7
00322             && stb_inc.substr(stb_inc.size() - 7) == "/orbC.h") ) {
00323           ACE_DEBUG((LM_WARNING,
00324                      ACE_TEXT("Warning: (%s) Potential inclusion of TAO orbC.H ")
00325                      ACE_TEXT(" Include TAO orb.idl with path of tao/orb.idl")
00326                      ACE_TEXT(" to prevent compilation errors\n"), idl_fn));
00327         }
00328       }
00329 
00330     }
00331   }
00332 
00333   idl.close();
00334 
00335   be_global->open_streams(idl_fn);
00336 
00337   AST_Decl* d = idl_global->root();
00338   AST_Root* root = AST_Root::narrow_from_decl(d);
00339 
00340   if (root == 0) {
00341     ACE_ERROR((LM_ERROR,
00342                ACE_TEXT("(%N:%l) BE_produce - ")
00343                ACE_TEXT("No Root\n")));
00344 
00345     BE_abort();
00346   }
00347 
00348   be_global->set_inc_paths(idl_global->idl_flags());
00349 
00350   const bool java_ts_only = be_global->java_arg().length() > 0;
00351 
00352   dds_visitor visitor(d, java_ts_only);
00353 
00354   if (root->ast_accept(&visitor) == -1) {
00355     ACE_ERROR((LM_ERROR,
00356                ACE_TEXT("(%N:%l) BE_produce -")
00357                ACE_TEXT(" failed to accept adding visitor\n")));
00358     BE_abort();
00359   }
00360 
00361   if (!java_ts_only) {
00362     postprocess(be_global->header_name_.c_str(),
00363                 be_global->header_, BE_GlobalData::STREAM_H);
00364     if (!be_global->suppress_idl()) {
00365       postprocess(be_global->idl_name_.c_str(),
00366                   be_global->idl_, BE_GlobalData::STREAM_IDL);
00367     }
00368   }
00369 
00370   postprocess(be_global->impl_name_.c_str(),
00371               be_global->impl_, BE_GlobalData::STREAM_CPP);
00372 
00373   if (be_global->generate_wireshark()) {
00374     postprocess(be_global->ws_config_name_.c_str(),
00375                 be_global->ws_config_, BE_GlobalData::STREAM_WS);
00376   }
00377 
00378   if (be_global->generate_itl()) {
00379     if (!BE_GlobalData::writeFile(be_global->itl_name_.c_str(), be_global->itl_.str())) {
00380       BE_abort();  //error message already printed
00381     }
00382   }
00383 
00384   if (be_global->face_ts()) {
00385     postprocess(be_global->facets_header_name_.c_str(), be_global->facets_header_,
00386                 BE_GlobalData::STREAM_FACETS_H);
00387     postprocess(be_global->facets_impl_name_.c_str(), be_global->facets_impl_,
00388                 BE_GlobalData::STREAM_FACETS_CPP);
00389   }
00390 
00391   if (be_global->language_mapping() == BE_GlobalData::LANGMAP_FACE_CXX ||
00392       be_global->language_mapping() == BE_GlobalData::LANGMAP_SP_CXX) {
00393     postprocess(be_global->lang_header_name_.c_str(), be_global->lang_header_,
00394                 BE_GlobalData::STREAM_LANG_H);
00395   }
00396 
00397   BE_cleanup();
00398 }

void BE_version (  ) 

Definition at line 21 of file be_init.cpp.

References DDS_VERSION.

00022 {
00023   ACE_DEBUG((LM_DEBUG, ACE_TEXT("OpenDDS version ") ACE_TEXT(DDS_VERSION)
00024              ACE_TEXT("\n")));
00025 }


Variable Documentation

BE_GlobalData* be_global

Definition at line 30 of file be_global.cpp.

Referenced by add_includes(), Function::addArg(), assign_field(), BE_Comment_Guard::BE_Comment_Guard(), BE_init(), BE_post_init(), BE_produce(), compare_field(), dds_visitor::dds_visitor(), delegateToNested(), Function::endArgs(), exporter(), Function::Function(), v8_generator::fwd_decl(), wireshark_generator::gen_array(), gen_array(), gen_array_traits(), langmap_generator::gen_const(), gen_copyto(), wireshark_generator::gen_enum(), metaclass_generator::gen_enum(), marshal_generator::gen_enum(), langmap_generator::gen_enum(), itl_generator::gen_enum(), itl_generator::gen_epilogue(), gen_field_createQC(), gen_field_getValue(), gen_field_getValueFromSerialized(), langmap_generator::gen_interf_fwd(), itl_generator::gen_prologue(), gen_sequence(), SafetyProfileGenerator::gen_sequence(), FaceGenerator::gen_sequence(), wireshark_generator::gen_struct(), v8_generator::gen_struct(), ts_generator::gen_struct(), metaclass_generator::gen_struct(), marshal_generator::gen_struct(), SafetyProfileGenerator::gen_struct(), FaceGenerator::gen_struct(), keys_generator::gen_struct(), itl_generator::gen_struct(), langmap_generator::gen_struct_fwd(), gen_typecode(), wireshark_generator::gen_typedef(), v8_generator::gen_typedef(), metaclass_generator::gen_typedef(), langmap_generator::gen_typedef(), itl_generator::gen_typedef(), wireshark_generator::gen_union(), metaclass_generator::gen_union(), marshal_generator::gen_union(), GeneratorBase::gen_union(), itl_generator::gen_union(), langmap_generator::gen_union_fwd(), face_ts_generator::generate(), java_ts_generator::generate(), GeneratorBase::generate_union_field(), generateBranchLabels(), generateCaseBody(), generateSwitchBodyForUnion(), generateSwitchForUnion(), genRtpsParameter(), genRtpsSpecialSequence(), genRtpsSpecialStruct(), genRtpsSubmessage(), get_raw_field(), langmap_generator::init(), SafetyProfileGenerator::init(), FaceGenerator::init(), map_type(), NamespaceGuard::NamespaceGuard(), NestedForLoops::NestedForLoops(), itl_generator::new_type(), GeneratorBase::GenerateGettersAndSetters::operator()(), operator<<(), postprocess(), be_util::prep_be_arg(), print_field_name(), struct_decls(), dds_visitor::visit_structure(), write_branch(), wireshark_generator::write_common(), write_field(), BE_GlobalData::writeFile(), BE_Comment_Guard::~BE_Comment_Guard(), Function::~Function(), NamespaceGuard::~NamespaceGuard(), and NestedForLoops::~NestedForLoops().


Generated on Fri Feb 12 20:05:30 2016 for OpenDDS by  doxygen 1.4.7