summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarijke Hengstmengel <MHengstmengel@users.noreply.github.com>2011-11-07 10:14:28 +0000
committerMarijke Hengstmengel <MHengstmengel@users.noreply.github.com>2011-11-07 10:14:28 +0000
commit4662df2b1ee472e6b3a7c5e2380a76526c164b28 (patch)
tree5825148ca4123d64f76abd648fc8cf5ae1001ce7
parent3d9e58480d454a4ba1619fe276266edbf2986c86 (diff)
downloadATCD-4662df2b1ee472e6b3a7c5e2380a76526c164b28.tar.gz
Mon Nov 07 10:10:14 UTC 2011 Marijke Hengstmengel <mhengstmengel@remedy.nl>
* TAO_IDL/be/be_codegen.cpp: * TAO_IDL/be/be_global.cpp: * TAO_IDL/be/be_produce.cpp: * TAO_IDL/be/be_util.cpp: * TAO_IDL/be_include/be_global.h: * TAO_IDL/be_include/be_util.h: Add option -oE: Output directory for the generated CIAO executor files and option -oN for not overwrite CIAO executor files.
-rw-r--r--TAO/ChangeLog13
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp7
-rw-r--r--TAO/TAO_IDL/be/be_global.cpp99
-rw-r--r--TAO/TAO_IDL/be/be_produce.cpp19
-rw-r--r--TAO/TAO_IDL/be/be_util.cpp48
-rw-r--r--TAO/TAO_IDL/be_include/be_global.h26
-rw-r--r--TAO/TAO_IDL/be_include/be_util.h9
7 files changed, 203 insertions, 18 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 70d30b69ab0..7344207d513 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,16 @@
+Mon Nov 07 10:10:14 UTC 2011 Marijke Hengstmengel <mhengstmengel@remedy.nl>
+
+ * TAO_IDL/be/be_codegen.cpp:
+ * TAO_IDL/be/be_global.cpp:
+ * TAO_IDL/be/be_produce.cpp:
+ * TAO_IDL/be/be_util.cpp:
+ * TAO_IDL/be_include/be_global.h:
+ * TAO_IDL/be_include/be_util.h:
+ Add option -oE: Output directory for the generated CIAO executor files
+ and option -oN for not overwrite CIAO executor files.
+
+
+
Sat Nov 05 18:18:13 UTC 2011 Martin Corino <mcorino@remedy.nl>
* tests/Bug_3531b_Regression/server.cpp:
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
index 856b20614c4..782f51a9bf4 100644
--- a/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -1183,8 +1183,8 @@ TAO_CodeGen::start_ciao_exec_header (const char *fname)
-1);
int status =
- this->ciao_exec_header_->open (fname,
- TAO_OutStream::CIAO_EXEC_HDR);
+ this->ciao_exec_header_->open (fname,
+ TAO_OutStream::CIAO_EXEC_HDR);
if (status == -1)
{
@@ -1240,7 +1240,6 @@ TAO_CodeGen::start_ciao_exec_source (const char *fname)
int status =
this->ciao_exec_source_->open (fname,
TAO_OutStream::CIAO_EXEC_IMPL);
-
if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -2045,7 +2044,7 @@ TAO_CodeGen::gen_export_file (const char *filename,
ACE_CString file_str;
const char *output_path =
- be_util::get_output_path (false, for_skel);
+ be_util::get_output_path (false, for_skel, false);
if (output_path != 0)
{
diff --git a/TAO/TAO_IDL/be/be_global.cpp b/TAO/TAO_IDL/be/be_global.cpp
index d24446abc8e..370eb6e2b18 100644
--- a/TAO/TAO_IDL/be/be_global.cpp
+++ b/TAO/TAO_IDL/be/be_global.cpp
@@ -92,6 +92,7 @@ BE_GlobalData::BE_GlobalData (void)
stub_include_dir_ (0),
skel_output_dir_ (0),
anyop_output_dir_ (0),
+ exec_output_dir_ (0),
any_support_ (true),
cdr_support_ (true),
tc_support_ (true),
@@ -139,6 +140,7 @@ BE_GlobalData::BE_GlobalData (void)
gen_ciao_exec_idl_ (false),
gen_ciao_exec_impl_ (false),
gen_ciao_exec_reactor_impl_ (false),
+ overwrite_not_exec_(false),
gen_ciao_conn_impl_ (false),
gen_dds_typesupport_idl_ (false),
gen_ciao_valuefactory_reg_ (true),
@@ -182,7 +184,8 @@ be_change_idl_file_extension (UTL_String* idl_file,
const char *new_extension,
bool base_name_only = false,
bool for_anyop = false,
- bool for_skel = false)
+ bool for_skel = false,
+ bool for_exec = false)
{
// @@ This shouldn't happen anyway; but a better error handling
// mechanism is needed.
@@ -227,7 +230,7 @@ be_change_idl_file_extension (UTL_String* idl_file,
// Anyop * skel file output defaults to general output dir if not set.
const char *output_path =
- be_util::get_output_path (for_anyop, for_skel);
+ be_util::get_output_path (for_anyop, for_skel, for_exec);
if (!base_name_only && output_path != 0)
{
@@ -272,7 +275,6 @@ be_change_idl_file_extension (UTL_String* idl_file,
// Append the newextension.
ACE_OS::strcat (fname, new_extension);
-
return fname;
}
@@ -443,7 +445,10 @@ BE_GlobalData::be_get_ciao_exec_header (UTL_String *idl_file_name,
{
return be_change_idl_file_extension (idl_file_name,
be_global->ciao_exec_header_ending (),
- base_name_only);
+ base_name_only,
+ false,
+ false,
+ true);
}
const char *
@@ -452,7 +457,10 @@ BE_GlobalData::be_get_ciao_exec_source (UTL_String *idl_file_name,
{
return be_change_idl_file_extension (idl_file_name,
be_global->ciao_exec_source_ending (),
- base_name_only);
+ base_name_only,
+ false,
+ false,
+ true);
}
const char *
@@ -1498,6 +1506,17 @@ BE_GlobalData::output_dir (void) const
{
return this->output_dir_;
}
+bool
+BE_GlobalData::overwrite_not_exec (void) const
+{
+ return this->overwrite_not_exec_;
+}
+
+void
+BE_GlobalData::overwrite_not_exec (bool val)
+{
+ this->overwrite_not_exec_ = val;
+}
void
BE_GlobalData::skel_output_dir (const char* s)
@@ -1539,6 +1558,18 @@ BE_GlobalData::anyop_output_dir (void) const
}
void
+BE_GlobalData::exec_output_dir (const char* s)
+{
+ ACE::strdelete (this->exec_output_dir_);
+ this->exec_output_dir_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::exec_output_dir (void) const
+{
+ return this->exec_output_dir_;
+}
+void
BE_GlobalData::any_support (bool val)
{
this->any_support_ = val;
@@ -2032,6 +2063,9 @@ BE_GlobalData::destroy (void)
ACE::strdelete (this->anyop_output_dir_);
this->anyop_output_dir_ = 0;
+ ACE::strdelete (this->exec_output_dir_);
+ this->exec_output_dir_ = 0;
+
if (0 != this->messaging_)
{
this->messaging_->destroy ();
@@ -2924,6 +2958,61 @@ BE_GlobalData::parse_args (long &i, char **av)
));
}
}
+ else if (av[i][2] == 'E')
+ {
+ if (av[i][3] == '\0')
+ {
+ idl_global->append_idl_flag (av[i + 1]);
+ int result = ACE_OS::mkdir (av[i + 1]);
+
+ #if !defined (__BORLANDC__)
+ if (result != 0 && errno != EEXIST)
+ #else
+ // The Borland RTL doesn't give EEXIST back, only EACCES in
+ // case the directory exists, reported to Borland as QC 9495
+ if (result != 0 && errno != EEXIST && errno != EACCES)
+ #endif
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: unable to create directory %C")
+ ACE_TEXT (" specified by -oE option\n"),
+ av[i + 1]
+ ));
+
+ break;
+ }
+
+ be_global->exec_output_dir (av[i + 1]);
+ ++i;
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand")
+ ACE_TEXT (" the '%C' option\n"),
+ av[i]
+ ));
+ }
+ }
+ else if (av[i][2] == 'N')
+ {
+ if (av[i][3] == '\0')
+ {
+ // Don't overwrite exec files.
+ be_global->overwrite_not_exec (true);
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand")
+ ACE_TEXT (" the '%C' option\n"),
+ av[i]
+ ));
+ }
+ }
else if (av[i][2] == 'S')
{
if (av[i][3] == '\0')
diff --git a/TAO/TAO_IDL/be/be_produce.cpp b/TAO/TAO_IDL/be/be_produce.cpp
index aa74be74b5c..75d88932c39 100644
--- a/TAO/TAO_IDL/be/be_produce.cpp
+++ b/TAO/TAO_IDL/be/be_produce.cpp
@@ -74,6 +74,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "be_extern.h"
#include "fe_extern.h"
#include "global_extern.h"
+#include "be_util.h"
// Clean up before exit, whether successful or not.
TAO_IDL_BE_Export void
@@ -239,13 +240,17 @@ BE_produce (void)
if (be_global->gen_ciao_exec_impl ())
{
- ctx.state (TAO_CodeGen::TAO_ROOT_EXH);
- be_visitor_root_exh root_exh_visitor (&ctx);
- BE_visit_root (root_exh_visitor, "CIAO exec impl header");
-
- ctx.state (TAO_CodeGen::TAO_ROOT_EXS);
- be_visitor_root_exs root_exs_visitor (&ctx);
- BE_visit_root (root_exs_visitor, "CIAO exec impl source");
+ bool generate = be_util::overwrite_ciao_exec_files ();
+ if(generate)
+ {
+ ctx.state (TAO_CodeGen::TAO_ROOT_EXH);
+ be_visitor_root_exh root_exh_visitor (&ctx);
+ BE_visit_root (root_exh_visitor, "CIAO exec impl header");
+
+ ctx.state (TAO_CodeGen::TAO_ROOT_EXS);
+ be_visitor_root_exs root_exs_visitor (&ctx);
+ BE_visit_root (root_exs_visitor, "CIAO exec impl source");
+ }
}
if (be_global->gen_ciao_conn_impl ())
diff --git a/TAO/TAO_IDL/be/be_util.cpp b/TAO/TAO_IDL/be/be_util.cpp
index a3dd1bf7e12..0e5f7269162 100644
--- a/TAO/TAO_IDL/be/be_util.cpp
+++ b/TAO/TAO_IDL/be/be_util.cpp
@@ -789,6 +789,17 @@ be_util::usage (void)
));
ACE_DEBUG ((
LM_DEBUG,
+ ACE_TEXT (" -oE <output_dir>\tOutput directory for the generated ")
+ ACE_TEXT ("executor files, only when -Gex option is used.")
+ ACE_TEXT (" Default is current directory\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT (" -oN\tWhen -Gex option is used, executor files shouldn't be overwritten ")
+ ACE_TEXT ("if they are already in the output directory.\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
ACE_TEXT (" -si\t\t\tServer's inline file name ending.")
ACE_TEXT (" Default is S.inl\n")
));
@@ -905,7 +916,8 @@ be_util::generator_init (void)
const char *
be_util::get_output_path (bool for_anyop,
- bool for_skel)
+ bool for_skel,
+ bool for_exec)
{
if (for_anyop && 0 != be_global->anyop_output_dir ())
{
@@ -915,12 +927,46 @@ be_util::get_output_path (bool for_anyop,
{
return be_global->skel_output_dir ();
}
+ else if (for_exec && 0 != be_global->exec_output_dir ())
+ {
+ return be_global->exec_output_dir ();
+ }
else
{
return be_global->output_dir ();
}
}
+bool
+be_util::overwrite_ciao_exec_files ()
+{
+ bool overwrite = true;
+ if (be_global->overwrite_not_exec())
+ {
+ bool src_exist = false;
+ bool hdr_exist = false;
+ const char *fname_hdr = be_global->be_get_ciao_exec_hdr_fname (false);
+ FILE* fp_hdr = ACE_OS::fopen(fname_hdr, "r");
+ if (fp_hdr)
+ {
+ // file exists, don't generate new exec files.
+ ACE_OS::fclose(fp_hdr);
+ hdr_exist = true;
+ }
+ const char *fname_src = be_global->be_get_ciao_exec_src_fname (false);
+ FILE* fp_src = ACE_OS::fopen(fname_src, "r");
+ if (fp_src)
+ {
+ // file exists, don't generate new exec files.
+ ACE_OS::fclose(fp_src);
+ src_exist = true;
+ }
+ if (hdr_exist && src_exist)
+ overwrite = false;
+ }
+ return overwrite;
+}
+
void
be_util::set_arg_seen_bit (be_type *bt)
{
diff --git a/TAO/TAO_IDL/be_include/be_global.h b/TAO/TAO_IDL/be_include/be_global.h
index 4838d0b77ff..59e544b0f13 100644
--- a/TAO/TAO_IDL/be_include/be_global.h
+++ b/TAO/TAO_IDL/be_include/be_global.h
@@ -603,6 +603,20 @@ public:
/// to be kept. Default is output_dir_.
const char* anyop_output_dir (void) const;
+ /// Set the directory where all the *exec.* files are
+ /// to be kept. Default is output_dir_.
+ void exec_output_dir (const char* s);
+
+ /// Get the directory where all the *exec.* files are
+ /// to be kept. Default is output_dir_.
+ const char* exec_output_dir (void) const;
+
+ ///Get the flag for not overwriting already existing exec files.
+ bool overwrite_not_exec (void) const;
+
+ ///Set the flag for not overwriting already existing exec files.
+ void overwrite_not_exec (bool val);
+
/// Set any support.
void any_support (bool);
@@ -1045,6 +1059,14 @@ private:
*/
char* anyop_output_dir_;
+ /**
+ * Directory where all the *exec.* files are to be
+ * kept. Default value is 0 for this string which means the
+ * value for output_dir_ is used.
+ */
+ char* exec_output_dir_;
+
+
/// do we support Any operators?
bool any_support_;
@@ -1206,6 +1228,10 @@ private:
bool gen_ciao_exec_impl_;
bool gen_ciao_exec_reactor_impl_;
+ ///Flag to indicate whether generated exec files should
+ ///overwritten already existing exe files
+ bool overwrite_not_exec_;
+
/// False by default, this flag triggers code generation
/// for CCM connector implementations.
bool gen_ciao_conn_impl_;
diff --git a/TAO/TAO_IDL/be_include/be_util.h b/TAO/TAO_IDL/be_include/be_util.h
index 26f05ee0bd7..7152e910841 100644
--- a/TAO/TAO_IDL/be_include/be_util.h
+++ b/TAO/TAO_IDL/be_include/be_util.h
@@ -63,7 +63,14 @@ public:
/// Called from various places.
static const char *
- get_output_path (bool for_anyop, bool for_skel);
+ get_output_path (bool for_anyop, bool for_skel, bool for_exec);
+
+ static const char *
+ get_complete_file_name (bool for_exec);
+
+ /// Called from various places.
+ static bool
+ overwrite_ciao_exec_files (void);
// Called by each node upon construction.
static void set_arg_seen_bit (be_type *);