summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-10-09 11:54:58 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-10-09 11:54:58 +0000
commitbe208cb1ce0a5e8bee76bee48ab69c7c2c0e9638 (patch)
treeee4057fec085e764566efef312895b72713a4c16
parent54d9a8f1a0753b7e2a70091483107e5fcd491df5 (diff)
downloadATCD-be208cb1ce0a5e8bee76bee48ab69c7c2c0e9638.tar.gz
ChangeLogTag: Fri Oct 9 11:50:49 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--TAO/ChangeLog12
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp56
-rw-r--r--TAO/TAO_IDL/be/be_global.cpp40
-rw-r--r--TAO/TAO_IDL/be_include/be_codegen.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_global.h4
5 files changed, 88 insertions, 27 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 487a42a6c69..516fe9f3137 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,15 @@
+Fri Oct 9 11:50:49 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be/be_codegen.cpp:
+ * TAO_IDL/be/be_global.cpp:
+ * TAO_IDL/be_include/be_codegen.h:
+ * TAO_IDL/be_include/be_global.h:
+
+ Fixed generation of export macro header files to track
+ with -o <output dir> option similarly to the other
+ generated files. Thanks to Abdullah Sowayan
+ <sowayan at gmail dot com> for reporting the problem.
+
Fri Oct 9 08:25:07 UTC 2009 Vladimir Zykov <vz@prismtech.com>
* tao/GIOP_Message_Generator_Parser_12.cpp:
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
index 4420a665fcf..3a574a35a3e 100644
--- a/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -1854,10 +1854,12 @@ TAO_CodeGen::gen_export_files (void)
this->gen_export_file (
be_global->skel_export_include (),
be_global->skel_export_macro (),
- "skel");
+ "skel",
+ true);
}
- if (be_global->gen_svnt_export_hdr_file ())
+ if (be_global->gen_svnt_export_hdr_file ()
+ && be_global->svnt_export_include () != 0)
{
this->gen_export_file (
be_global->svnt_export_include (),
@@ -1877,18 +1879,50 @@ TAO_CodeGen::gen_export_files (void)
void
TAO_CodeGen::gen_export_file (const char *filename,
const char *macro,
- const char *msg)
+ const char *msg,
+ bool for_skel)
{
- ACE_CString work (macro);
-
// Svnt export macro may correctly default to skel
// export macro, so we just return silently. The
// null filename check below will catch a real error.
- if (work == "")
+ if (macro == 0)
{
return;
}
+ ACE_CString macro_str (macro);
+ ACE_CString file_str;
+
+ const char *output_path =
+ be_global->get_output_path (false, for_skel);
+
+ if (output_path != 0)
+ {
+ // Turn '\' and '\\' into '/'.
+ char* i = const_cast<char*> (output_path);
+
+ for (const char* j = output_path; *j != 0; ++i, ++j)
+ {
+ if (*j == '\\')
+ {
+ *i = '/';
+
+ if (*(j + 1) == '\\')
+ {
+ ++j;
+ }
+ }
+ else
+ {
+ *i = *j;
+ }
+ }
+
+ *i = 0;
+ file_str += output_path;
+ file_str += '/';
+ }
+
if (filename == 0)
{
ACE_ERROR ((LM_ERROR,
@@ -1898,9 +1932,11 @@ TAO_CodeGen::gen_export_file (const char *filename,
return;
}
+ file_str += filename;
+
TAO_OutStream os;
- if (os.open (filename) == -1)
+ if (os.open (file_str.c_str ()) == -1)
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("TAO_CodeGen::gen_export_file() - ")
@@ -1911,9 +1947,9 @@ TAO_CodeGen::gen_export_file (const char *filename,
ACE_CString suffix ("_Export");
size_t stem_len =
- work.length () - suffix.length ();
+ macro_str.length () - suffix.length ();
- if (work.substr (stem_len) != suffix)
+ if (macro_str.substr (stem_len) != suffix)
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("TAO_CodeGen::gen_export_file() - ")
@@ -1923,7 +1959,7 @@ TAO_CodeGen::gen_export_file (const char *filename,
return;
}
- ACE_CString stem_str (work.substr (0, stem_len));;
+ ACE_CString stem_str (macro_str.substr (0, stem_len));;
const char *stem = stem_str.c_str ();
os << "\n#ifndef " << stem << "_EXPORT_H\n"
diff --git a/TAO/TAO_IDL/be/be_global.cpp b/TAO/TAO_IDL/be/be_global.cpp
index 85bec137186..59046a3e1d3 100644
--- a/TAO/TAO_IDL/be/be_global.cpp
+++ b/TAO/TAO_IDL/be/be_global.cpp
@@ -207,20 +207,8 @@ 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 = 0;
-
- if (for_anyop && 0 != be_global->anyop_output_dir ())
- {
- output_path = be_global->anyop_output_dir ();
- }
- else if (for_skel && 0 != be_global->skel_output_dir ())
- {
- output_path = be_global->skel_output_dir ();
- }
- else
- {
- output_path = be_global->output_dir ();
- }
+ const char *output_path =
+ be_global->get_output_path (for_anyop, for_skel);
if (!base_name_only && output_path != 0)
{
@@ -230,7 +218,9 @@ be_change_idl_file_extension (UTL_String* idl_file,
ACE_OS::sprintf (fname, "%s/", output_path);
// Append the base part to fname.
- ACE_OS::strncpy (fname + ACE_OS::strlen (fname), string, base - string);
+ ACE_OS::strncpy (fname + ACE_OS::strlen (fname),
+ string,
+ base - string);
}
else
{
@@ -248,7 +238,7 @@ be_change_idl_file_extension (UTL_String* idl_file,
{
*i = '/';
- if (*(j+1) == '\\')
+ if (*(j + 1) == '\\')
{
++j;
}
@@ -3621,3 +3611,21 @@ BE_GlobalData::generator_init (void)
return gen;
}
+
+const char *
+BE_GlobalData::get_output_path (bool for_anyop,
+ bool for_skel)
+{
+ if (for_anyop && 0 != be_global->anyop_output_dir ())
+ {
+ return be_global->anyop_output_dir ();
+ }
+ else if (for_skel && 0 != be_global->skel_output_dir ())
+ {
+ return be_global->skel_output_dir ();
+ }
+ else
+ {
+ return be_global->output_dir ();
+ }
+}
diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h
index 523dc31a67a..2917397aba4 100644
--- a/TAO/TAO_IDL/be_include/be_codegen.h
+++ b/TAO/TAO_IDL/be_include/be_codegen.h
@@ -452,7 +452,8 @@ private:
void gen_export_file (const char *filename,
const char *macro,
- const char *msg);
+ const char *msg,
+ bool for_skel = false);
private:
TAO_OutStream *client_header_;
diff --git a/TAO/TAO_IDL/be_include/be_global.h b/TAO/TAO_IDL/be_include/be_global.h
index 1ff59d1c2b2..0cefc31c420 100644
--- a/TAO/TAO_IDL/be_include/be_global.h
+++ b/TAO/TAO_IDL/be_include/be_global.h
@@ -738,6 +738,10 @@ public:
AST_Generator *generator_init (void);
// Create an AST node generator.
+
+ const char *get_output_path (bool for_anyop,
+ bool for_skel);
+ // Called from various places.
private:
size_t changing_standard_include_files_;