be_util.cpp

Go to the documentation of this file.
00001 
00002 //=============================================================================
00003 /**
00004  *  @file    be_util.cpp
00005  *
00006  *
00007  *  Static helper methods used by multiple visitors.
00008  *
00009  *
00010  *  @author Gary Maxey
00011  *  @author Jeff Parsons
00012  */
00013 //=============================================================================
00014 
00015 #include "be_util.h"
00016 #include "be_extern.h"
00017 
00018 #include "ast_generator.h"
00019 
00020 #include "ace/OS_NS_strings.h"
00021 
00022 // Prepare an argument for a BE
00023 void
00024 be_util::prep_be_arg (char *arg)
00025 {
00026   static const char WB_EXPORT_MACRO[] = "export_macro=";
00027   static const size_t SZ_WB_EXPORT_MACRO = sizeof(WB_EXPORT_MACRO) - 1;
00028   static const char WB_EXPORT_INCLUDE[] = "export_include=";
00029   static const size_t SZ_WB_EXPORT_INCLUDE = sizeof(WB_EXPORT_INCLUDE) - 1;
00030   static const char WB_PCH_INCLUDE[] = "pch_include=";
00031   static const size_t SZ_WB_PCH_INCLUDE = sizeof(WB_PCH_INCLUDE) - 1;
00032   static const char WB_JAVA[] = "java";
00033   static const size_t SZ_WB_JAVA = sizeof(WB_JAVA) - 1;
00034   static const char WB_TAO_INC_PRE[] = "tao_include_prefix=";
00035   static const size_t SZ_WB_TAO_INC_PRE = sizeof(WB_TAO_INC_PRE) - 1;
00036   static const char WB_V8[] = "v8";
00037   static const size_t SZ_WB_V8 = sizeof(WB_V8) - 1;
00038 
00039   if (0 == ACE_OS::strncasecmp(arg, WB_EXPORT_MACRO, SZ_WB_EXPORT_MACRO)) {
00040     be_global->export_macro(arg + SZ_WB_EXPORT_MACRO);
00041 
00042   } else if (0 == ACE_OS::strncasecmp(arg, WB_EXPORT_INCLUDE,
00043                                       SZ_WB_EXPORT_INCLUDE)) {
00044     be_global->export_include(arg + SZ_WB_EXPORT_INCLUDE);
00045 
00046   } else if (0 == ACE_OS::strncasecmp(arg, WB_PCH_INCLUDE, SZ_WB_PCH_INCLUDE)) {
00047     be_global->pch_include(arg + SZ_WB_PCH_INCLUDE);
00048 
00049   } else if (0 == ACE_OS::strncasecmp(arg, WB_JAVA, SZ_WB_JAVA)) {
00050     be_global->java(true);
00051     if (ACE_OS::strlen(arg + SZ_WB_JAVA)) {
00052       be_global->java_arg(arg + SZ_WB_JAVA + 1 /* = */);
00053     }
00054 
00055   } else if (0 == ACE_OS::strncasecmp(arg, WB_TAO_INC_PRE, SZ_WB_TAO_INC_PRE)) {
00056     be_global->tao_inc_pre_ = arg + SZ_WB_TAO_INC_PRE;
00057 
00058   } else if (0 == ACE_OS::strncasecmp(arg, WB_V8, SZ_WB_V8)) {
00059     be_global->v8(true);
00060   }
00061 }
00062 
00063 void
00064 be_util::arg_post_proc (void)
00065 {
00066 }
00067 
00068 void
00069 be_util::usage (void)
00070 {
00071   ACE_DEBUG((LM_DEBUG,
00072     ACE_TEXT(" -o <dir>\t\tsets output directory for all files\n")
00073     ACE_TEXT(" -Lface\t\t\tgenerate FACE IDL to C++ mapping\n")
00074     ACE_TEXT(" -Lspcpp\t\t\tgenerate Safety Profile IDL to C++ mapping\n")
00075     ACE_TEXT(" -SI\t\t\tsuppress generation of *TypeSupport.idl\n")
00076     ACE_TEXT(" -Sa\t\t\tsuppress IDL any (ignored, for tao_idl compatibility)\n")
00077     ACE_TEXT(" -St\t\t\tsuppress IDL typecode when -L* option is present\n")
00078     ACE_TEXT(" -Gws\t\t\tgenerate wireshark sample dissector configuration\n")
00079     ACE_TEXT(" -Gitl\t\t\tgenerate ITL\n")
00080     ACE_TEXT(" -GfaceTS\t\tgenerate FACE TS API for DCPS data types\n")
00081     ACE_TEXT(" -Wb,export_macro=<macro name>\t\tsets export macro ")
00082     ACE_TEXT("for all files\n")
00083     ACE_TEXT(" -Wb,export_include=<include path>\tsets export include ")
00084     ACE_TEXT("file for all files\n")
00085     ACE_TEXT(" -Wb,pch_include=<include path>\t\tsets include ")
00086     ACE_TEXT("file for precompiled header mechanism\n")
00087     ACE_TEXT(" -Wb,java[=<output_file>]\t\tenables Java support ")
00088     ACE_TEXT("for TypeSupport files.  Do not specify an 'output_file' ")
00089     ACE_TEXT("except for special cases.\n")
00090     ACE_TEXT(" -Wb,tao_include_prefix=<path>\t\tPrefix for including the TAO-")
00091     ACE_TEXT("generated header file.\n")
00092     ACE_TEXT(" -Wb,v8\t\t\tgenerate TypeSupport for converting data samples ")
00093     ACE_TEXT("to v8 JavaScript objects\n")
00094     ACE_TEXT(" -ZC <include>\t\t\tadd <include> to *TypeSupportImpl.cpp\n")
00095   ));
00096 }
00097 
00098 AST_Generator *
00099 be_util::generator_init (void)
00100 {
00101   AST_Generator* gen = 0;
00102   ACE_NEW_RETURN(gen, AST_Generator, 0);
00103   return gen;
00104 }

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