OpenDDS  Snapshot(2023/04/28-20:55)
Functions | Variables
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

◆ BE_abort()

void BE_abort ( )

◆ BE_cleanup()

void BE_cleanup ( )

Definition at line 94 of file be_produce.cpp.

Referenced by BE_abort(), and BE_produce().

95 {
96  if (idl_global) {
97  idl_global->destroy();
98  }
99 }

◆ BE_init()

int BE_init ( int &  ,
ACE_TCHAR [] 
)

Definition at line 28 of file be_init.cpp.

References ACE_NEW_RETURN, and be_global.

29 {
31  idl_global->default_idl_version_ = IDL_VERSION_4;
32  idl_global->anon_type_diagnostic(IDL_GlobalData::ANON_TYPE_SILENT);
33  return 0;
34 }
BE_GlobalData * be_global
Definition: be_global.cpp:44
#define ACE_NEW_RETURN(POINTER, CONSTRUCTOR, RET_VAL)

◆ BE_post_init()

void BE_post_init ( char *  [],
long   
)

Definition at line 37 of file be_init.cpp.

References be_global, ACE_String_Base< char >::c_str(), be_util::dds_root(), OPENDDS_MAJOR_VERSION, OPENDDS_MICRO_VERSION, OPENDDS_MINOR_VERSION, and Annotations::register_all().

38 {
39  if (idl_global->idl_version_ < IDL_VERSION_4) {
40  idl_global->ignore_files_ = true; // Exit without parsing files
41  be_global->error("OpenDDS requires IDL version to be 4 or greater");
42  return;
43  }
44 
45  std::ostringstream version;
46  version << "-D__OPENDDS_IDL=0x"
47  << std::setw(2) << std::setfill('0') << OPENDDS_MAJOR_VERSION
48  << std::setw(2) << std::setfill('0') << OPENDDS_MINOR_VERSION
49  << std::setw(2) << std::setfill('0') << OPENDDS_MICRO_VERSION;
50  DRV_cpp_putarg(version.str().c_str());
51 
52 #ifdef ACE_HAS_CDR_FIXED
53  DRV_cpp_putarg("-D__OPENDDS_IDL_HAS_FIXED");
54 #endif
55 
56  std::string include_dds = be_util::dds_root();
57  if (include_dds.find(' ') != std::string::npos && include_dds[0] != '"') {
58  include_dds.insert(include_dds.begin(), '"');
59  include_dds.insert(include_dds.end(), '"');
60  }
61  be_global->add_inc_path(include_dds.c_str());
62  ACE_CString included;
63  DRV_add_include_path(included, include_dds.c_str(), 0, true);
64 
65  DRV_cpp_putarg("-D__OPENDDS_IDL_HAS_ANNOTATIONS");
66  be_global->builtin_annotations_.register_all();
67  // This annotation isn't used, but must match the one in idl2jni to avoid
68  // warnings or errors.
69  idl_global->eval("module OpenDDS {@annotation hidden_op_in_java {string impl;};};\n");
70 }
#define OPENDDS_MICRO_VERSION
Definition: Version.h:13
const char * c_str(void) const
void register_all()
Definition: annotations.cpp:14
#define OPENDDS_MINOR_VERSION
Definition: Version.h:12
const char * dds_root()
Get DDS_ROOT. It is a fatal error if it wasn&#39;t set.
#define OPENDDS_MAJOR_VERSION
Definition: Version.h:11
BE_GlobalData * be_global
Definition: be_global.cpp:44

◆ BE_produce()

void BE_produce ( )

Definition at line 299 of file be_produce.cpp.

References ACE_ERROR, ACE_TEXT(), BE_abort(), BE_cleanup(), be_global, ACE_String_Base< char >::c_str(), BE_GlobalData::filename(), ACE_String_Base< char >::length(), LM_ERROR, ACE_OS::strcasecmp(), and strncmp().

300 {
301  const char* idl_fn = idl_global->main_filename()->get_string();
302  be_global->filename(idl_fn);
303 
304  const BE_GlobalData::stream_enum_t out_stream =
305  be_global->language_mapping() == BE_GlobalData::LANGMAP_NONE
306  ? BE_GlobalData::STREAM_H : BE_GlobalData::STREAM_LANG_H;
307 
308  ifstream idl(idl_fn);
309  const size_t buffer_sz = 512;
310  char buffer[buffer_sz];
311  unsigned lineno = 0;
312 
313  while (idl) {
314  idl.getline(buffer, buffer_sz);
315  ++lineno;
316 
317  // search for #includes in the IDL, add them as #includes in the stubs/skels
318  if (0 == strncmp("#include", buffer, 8)) { //FUTURE: account for comments?
319  string inc(buffer + 8);
320  size_t delim1 = inc.find_first_of("<\"");
321  size_t delim2 = inc.find_first_of(">\"", delim1 + 1);
322  string included(inc, delim1 + 1, delim2 - delim1 - 1);
323  size_t len = included.size();
324  string base_name;
325 
326  if (len >= 5 &&
327  0 == ACE_OS::strcasecmp(included.c_str() + len - 4, ".idl")) {
328  base_name.assign(included.c_str(), len - 4);
329 
330  } else if (len >= 6 &&
331  0 == ACE_OS::strcasecmp(included.c_str() + len - 5, ".pidl")) {
332  base_name.assign(included.c_str(), len - 5);
333 
334  } else {
335  continue;
336  }
337 
338  if (be_global->language_mapping() == BE_GlobalData::LANGMAP_SP_CXX &&
339  base_name.substr(0, 4) == "tao/" &&
340  base_name.substr(base_name.size() - 3) == "Seq") {
341  continue; // with Safety Profile C++, skip include of tao/*SeqC.h
342  }
343 
344  string stb_inc = base_name + "C.h";
345  if (stb_inc != "tao/orbC.h") {
346  be_global->add_include(stb_inc.c_str(), out_stream);
347  if (stb_inc == "orbC.h" ||
348  (stb_inc.size() >= 7
349  && stb_inc.substr(stb_inc.size() - 7) == "/orbC.h") ) {
350  be_global->warning(
351  "Potential inclusion of TAO orbC.h\n"
352  " Include TAO orb.idl with path of tao/orb.idl"
353  " to prevent compilation errors",
354  idl_fn, lineno);
355  }
356  }
357 
358  }
359  }
360 
361  idl.close();
362 
363  be_global->open_streams(idl_fn);
364 
365  AST_Decl* d = idl_global->root();
366  AST_Root* root = dynamic_cast<AST_Root*>(d);
367 
368  if (root == 0) {
369  ACE_ERROR((LM_ERROR,
370  ACE_TEXT("(%N:%l) BE_produce - ")
371  ACE_TEXT("No Root\n")));
372 
373  BE_abort();
374  }
375 
376  be_global->set_inc_paths(idl_global->idl_flags());
377 
378  const bool java_ts_only = be_global->java_arg().length() > 0;
379 
380  dds_visitor visitor(d, java_ts_only);
381 
382  if (root->ast_accept(&visitor) == -1) {
383  ACE_ERROR((LM_ERROR,
384  ACE_TEXT("(%N:%l) BE_produce -")
385  ACE_TEXT(" failed to accept adding visitor\n")));
386  BE_abort();
387  }
388 
389  if (!java_ts_only) {
390  postprocess(be_global->header_name_.c_str(),
391  be_global->header_, BE_GlobalData::STREAM_H);
392  if (!be_global->suppress_idl()) {
393  postprocess(be_global->idl_name_.c_str(),
394  be_global->idl_, BE_GlobalData::STREAM_IDL);
395  }
396  }
397 
398  postprocess(be_global->impl_name_.c_str(),
399  be_global->impl_, BE_GlobalData::STREAM_CPP);
400 
401  if (be_global->itl()) {
402  if (!BE_GlobalData::writeFile(be_global->itl_name_.c_str(), be_global->itl_.str())) {
403  BE_abort(); //error message already printed
404  }
405  }
406 
407  if (be_global->face_ts()) {
408  postprocess(be_global->facets_header_name_.c_str(), be_global->facets_header_,
409  BE_GlobalData::STREAM_FACETS_H);
410  postprocess(be_global->facets_impl_name_.c_str(), be_global->facets_impl_,
411  BE_GlobalData::STREAM_FACETS_CPP);
412  }
413 
414  if (be_global->language_mapping() != BE_GlobalData::LANGMAP_NONE) {
415  postprocess(be_global->lang_header_name_.c_str(), be_global->lang_header_,
416  BE_GlobalData::STREAM_LANG_H);
417  }
418 
419  BE_cleanup();
420 }
const char * filename(void) const
Definition: be_global.cpp:86
#define ACE_ERROR(X)
const char * c_str(void) const
int strncmp(const char *s, const char *t, size_t len)
void BE_abort()
Definition: be_produce.cpp:103
void BE_cleanup()
Definition: be_produce.cpp:94
ACE_TEXT("TCP_Factory")
int strcasecmp(const char *s, const char *t)
BE_GlobalData * be_global
Definition: be_global.cpp:44
size_type length(void) const

◆ BE_version()

void BE_version ( )

Definition at line 21 of file be_init.cpp.

References ACE_DEBUG, ACE_TEXT(), LM_DEBUG, and OPENDDS_VERSION.

22 {
23  ACE_DEBUG((LM_DEBUG, ACE_TEXT("OpenDDS version ") ACE_TEXT(OPENDDS_VERSION)
24  ACE_TEXT("\n")));
25 }
#define ACE_DEBUG(X)
#define OPENDDS_VERSION
Definition: Version.h:16
ACE_TEXT("TCP_Factory")

Variable Documentation

◆ be_global

BE_GlobalData* be_global

Definition at line 44 of file be_global.cpp.

Referenced by Function::addArg(), BE_abort(), BE_init(), BE_post_init(), BE_produce(), FieldInfo::cxx11(), dds_visitor::dds_visitor(), typeobject_generator::declare_get_type_map(), Function::endArgs(), Function::Function(), GeneratorBase::gen_array(), Cxx11Generator::gen_array(), GeneratorBase::gen_array_traits(), GeneratorBase::gen_array_typedef(), Cxx11Generator::gen_common_strunion_post(), Cxx11Generator::gen_common_strunion_pre(), langmap_generator::gen_const(), marshal_generator::gen_enum(), value_reader_generator::gen_enum(), value_writer_generator::gen_enum(), metaclass_generator::gen_enum(), langmap_generator::gen_enum(), itl_generator::gen_enum(), itl_generator::gen_epilogue(), typeobject_generator::gen_epilogue(), marshal_generator::gen_field_getValueFromSerialized(), langmap_generator::gen_interf_fwd(), itl_generator::gen_prologue(), FaceGenerator::gen_sequence(), SafetyProfileGenerator::gen_sequence(), Cxx11Generator::gen_sequence(), GeneratorBase::gen_simple_out(), keys_generator::gen_struct(), marshal_generator::gen_struct(), value_reader_generator::gen_struct(), value_writer_generator::gen_struct(), metaclass_generator::gen_struct(), langmap_generator::gen_struct(), itl_generator::gen_struct(), FaceGenerator::gen_struct(), SafetyProfileGenerator::gen_struct(), Cxx11Generator::gen_struct(), langmap_generator::gen_struct_fwd(), Cxx11Generator::gen_struct_members(), Cxx11Generator::gen_typecode_ptrs(), marshal_generator::gen_typedef(), metaclass_generator::gen_typedef(), langmap_generator::gen_typedef(), itl_generator::gen_typedef(), GeneratorBase::gen_typedef_varout(), keys_generator::gen_union(), marshal_generator::gen_union(), value_reader_generator::gen_union(), value_writer_generator::gen_union(), metaclass_generator::gen_union(), itl_generator::gen_union(), GeneratorBase::gen_union(), Cxx11Generator::gen_union(), gen_union_branch(), marshal_generator::gen_union_default(), langmap_generator::gen_union_fwd(), Cxx11Generator::gen_union_pragma_post(), Cxx11Generator::gen_union_pragma_pre(), typeobject_generator::generate(), java_ts_generator::generate(), face_ts_generator::generate(), generate_anon_fields(), typeobject_generator::generate_array_type_identifier(), marshal_generator::generate_dheader_code(), typeobject_generator::generate_enum_type_identifier(), typeobject_generator::generate_sequence_type_identifier(), typeobject_generator::generate_struct_type_identifier(), RefWrapper::generate_tag(), ts_generator::generate_ts(), GeneratorBase::generate_union_field(), typeobject_generator::generate_union_type_identifier(), generateBranchLabels(), generateCaseBody(), GeneratorBase::generateDefaultValue(), generateSwitchBody(), generateSwitchForUnion(), getEnumLabel(), getWrapper(), KeyLessThanWrapper::has_keys_signature(), KeyLessThanWrapper::has_no_keys_signature(), langmap_generator::init(), FaceGenerator::init(), SafetyProfileGenerator::init(), Cxx11Generator::init(), insert_cxx11_accessor_parens(), KeyLessThanWrapper::key_compare(), KeyLessThanWrapper::KeyLessThanWrapper(), GeneratorBase::map_type(), NamespaceGuard::NamespaceGuard(), needs_distinct_type(), needs_forany(), needs_nested_key_only(), NestedForLoops::NestedForLoops(), itl_generator::new_type(), GeneratorBase::GenerateUnionAccessors::operator()(), TopicKeys::Iterator::operator++(), operator<<(), PreprocessorIfGuard::output(), typeobject_generator::set_builtin_member_annotations(), string_type(), typeobject_generator::strong_connect(), GeneratorBase::struct_decls(), Cxx11Generator::struct_decls(), struct_has_explicit_keys(), ts_generator::ts_generator(), type_to_default(), Cxx11Generator::union_accessors(), Cxx11Generator::union_field(), Fields::Iterator::validate_pos(), dds_visitor::visit_structure(), Function::~Function(), KeyLessThanWrapper::~KeyLessThanWrapper(), NamespaceGuard::~NamespaceGuard(), and NestedForLoops::~NestedForLoops().