summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-07-02 17:32:23 +0000
committeralex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-07-02 17:32:23 +0000
commit12cd0ca1ec84d3598b29f55a0880d53de04c0da8 (patch)
tree3272a3691e3e52bc444cd60a75f40d81ff79643c
parent315f0f9022667c6c6419d9d71ab167ac4654aeb0 (diff)
downloadATCD-12cd0ca1ec84d3598b29f55a0880d53de04c0da8.tar.gz
*** empty log message ***
-rw-r--r--TAO/ChangeLog-98c12
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp30
-rw-r--r--TAO/TAO_IDL/be/be_helper.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_interface.cpp505
-rw-r--r--TAO/TAO_IDL/be_include/be_codegen.h26
-rw-r--r--TAO/TAO_IDL/be_include/be_interface.h14
-rw-r--r--TAO/TAO_IDL/driver/drv_args.cpp4
7 files changed, 494 insertions, 99 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index 191e203e3f8..2e9b52bdae9 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,3 +1,15 @@
+Thu Jul 2 12:29:10 1998 Alexander Babu Arulanthu <alex@cs.wustl.edu>
+
+ The Next round of changes for GPERF + TAO_IDL integration. NT
+ related stuff have been taken care of. attributes also should work
+ now.
+ * TAO_IDL/driver/drv_args.cpp (DRV_parse_args):
+ * TAO_IDL/be_include/be_interface.h (be_type):
+ * TAO_IDL/be_include/be_codegen.h:
+ * TAO_IDL/be/be_interface.cpp (tc_encap_len):
+ * TAO_IDL/be/be_helper.cpp:
+ * TAO_IDL/be/be_codegen.cpp:
+
Thu Jul 02 09:17:57 1998 David L. Levine <levine@cs.wustl.edu>
* tests/CDR/growth.cpp (main),
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
index ce3e63b887f..1ad0ceb79f4 100644
--- a/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -10,8 +10,8 @@
// be_codegen.cpp
//
// = DESCRIPTION
-//
// Code generation
+//
// = AUTHOR
// Aniruddha Gokhale
//
@@ -34,6 +34,8 @@ TAO_CodeGen::TAO_CodeGen (void)
server_template_skeletons_ (0),
server_inline_ (0),
server_template_inline_ (0),
+ gperf_input_stream_ (0),
+ gperf_input_filename_ (0),
curr_os_ (0),
visitor_factory_ (0),
strategy_ (TAO_DYNAMIC_HASH)
@@ -254,7 +256,7 @@ TAO_CodeGen::client_inline (void)
return this->client_inline_;
}
-// set the server header stream
+// set the server header stream.
int
TAO_CodeGen::start_server_header (const char *fname)
{
@@ -422,14 +424,14 @@ TAO_CodeGen::start_server_skeletons (const char *fname)
return 0;
}
-// get the server skeletons stream
+// Get the server skeletons stream.
TAO_OutStream *
TAO_CodeGen::server_skeletons (void)
{
return this->server_skeletons_;
}
-// set the server template skeleton stream
+// Start the server template skeleton stream.
int
TAO_CodeGen::start_server_template_skeletons (const char *fname)
{
@@ -636,15 +638,27 @@ TAO_CodeGen::end_server_template_skeletons (void)
// effectively a global.
void
-TAO_CodeGen::gperf_input (TAO_OutStream *os)
+TAO_CodeGen::gperf_input_stream (TAO_OutStream *os)
{
- this->gperf_input_ = os;
+ this->gperf_input_stream_ = os;
}
TAO_OutStream *
-TAO_CodeGen::gperf_input (void)
+TAO_CodeGen::gperf_input_stream (void)
+{
+ return this->gperf_input_stream_;
+}
+
+void
+TAO_CodeGen::gperf_input_filename (char *filename)
+{
+ this->gperf_input_filename_ = filename;
+}
+
+char *
+TAO_CodeGen::gperf_input_filename (void)
{
- return this->gperf_input_;
+ return this->gperf_input_filename_;
}
void
diff --git a/TAO/TAO_IDL/be/be_helper.cpp b/TAO/TAO_IDL/be/be_helper.cpp
index 0690fc9a899..79d87e1e632 100644
--- a/TAO/TAO_IDL/be/be_helper.cpp
+++ b/TAO/TAO_IDL/be/be_helper.cpp
@@ -77,7 +77,7 @@ TAO_OutStream::open (const char *fname,
if (fname)
{
// file name exists, open an I/O file handle
- fp_ = ACE_OS::fopen (fname, "w+");
+ fp_ = ACE_OS::fopen (fname, "w");
if (fp_)
{
this->st_ = st;
diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp
index b620ea47d27..bdb46025ce7 100644
--- a/TAO/TAO_IDL/be/be_interface.cpp
+++ b/TAO/TAO_IDL/be/be_interface.cpp
@@ -782,56 +782,160 @@ be_interface::tc_encap_len (void)
return this->encap_len_;
}
-// helper
+// helper.
int
be_interface::gen_operation_table (void)
{
- TAO_OutStream *ss; // output stream
- TAO_NL nl; // end line
+ TAO_OutStream *ss; // output stream.
+ TAO_NL nl; // end line.
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ // Retrieve the singleton instance of the CodeGen.
+ TAO_CodeGen *cg = 0;
+ cg = TAO_CODEGEN::instance ();
- ss = cg->server_skeletons ();
+ // Check out the op_lookup_strategy.
+ switch (cg->lookup_strategy ())
+ {
+ case TAO_CodeGen::TAO_DYNAMIC_HASH:
+ // Init the outstream appropriately.
+ ss = cg->server_skeletons ();
- ss->indent (); // start from current indentation level
- *ss << "static const TAO_operation_db_entry " << this->flatname () <<
- "_operations [] = {\n";
- ss->incr_indent (0);
+ // start from current indentation level.
+ ss->indent ();
- if (this->traverse_inheritance_graph (be_interface::gen_optable_helper, ss) == -1)
- {
+ // Start the table generation.
+ *ss << "static const TAO_operation_db_entry " << this->flatname () <<
+ "_operations [] = {\n";
+ ss->incr_indent (0);
+
+ // Traverse the graph.
+ if (this->traverse_inheritance_graph (be_interface::gen_optable_helper, ss) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_interface::gen_operation_table - "
+ "inheritance graph traversal failed\n"), -1);
+ }
+
+ // generate the skeleton for the is_a method.
+ ss->indent ();
+ *ss << "{\"_is_a\", &" << this->full_skel_name () << "::_is_a_skel}\n";
+ this->skel_count_++;
+
+ ss->decr_indent ();
+ *ss << "};" << nl << nl;
+
+ // XXXASG - this code should be based on using different strategies for
+ // demux - for next release
+ *ss << "static const CORBA::Long _tao_" << this->flatname ()
+ << "_optable_size = sizeof (ACE_Hash_Map_Entry<const char *,"
+ << " TAO_Skeleton>) * (" << (3*this->skel_count_)
+ << ");" << be_nl;
+ *ss << "static char _tao_" << this->flatname () << "_optable_pool "
+ << "[_tao_" << this->flatname () << "_optable_size];" << be_nl;
+ *ss << "static ACE_Static_Allocator_Base _tao_" << this->flatname ()
+ << "_allocator (_tao_" << this->flatname () << "_optable_pool, "
+ << "_tao_" << this->flatname () << "_optable_size);" << be_nl;
+ *ss << "TAO_Dynamic_Hash_OpTable tao_" << this->flatname () << "_optable "
+ << "(" << this->flatname () << "_operations, " << this->skel_count_
+ << ", " << 2*this->skel_count_ << ", &_tao_" << this->flatname ()
+ << "_allocator);" << be_nl;
+
+ break;
+
+ case TAO_CodeGen::TAO_PERFECT_HASH:
+ // For each interface in the IDL, have a new temp file to
+ // collect the input for the gperf program.
+ {
+ // Temp file name.
+ char *temp_file = 0;
+ ACE_NEW_RETURN (temp_file,
+ char [ACE_OS::strlen (this->flatname ()) +
+ ACE_OS::strlen (".gperf")],
+ -1);
+ ACE_OS::sprintf (temp_file, "%s.gperf", this->flatname ());
+
+ // Save this file name with the codegen singleton.
+ cg->gperf_input_filename (temp_file);
+
+ // Make a new outstream to hold the gperf_temp_file for this
+ // interface.
+
+ // Retrieve the singleton instance to the outstream factory.
+ TAO_OutStream_Factory *factory =
+ TAO_OUTSTREAM_FACTORY::instance ();
+
+ // Get a new instance for the temp file.
+ ss = factory->make_outstream ();
+ if (ss == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss",
+ "::",
+ "visit_interface-",
+ "make_outstream failed"),
+ -1);
+
+ // Store the outstream with the codegen singleton.
+ cg->gperf_input_stream (ss);
+
+ // Open the temp file.
+ if (ss->open (temp_file,
+ TAO_OutStream::TAO_GPERF_INPUT) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss",
+ "::",
+ "visit_interface-",
+ "gperf_input.tmp file open failed"),
+ -1);
+
+ // Add the gperf input header.
+ gen_gperf_input_header (ss);
+
+ // Traverse the graph.
+ if (this->traverse_inheritance_graph (be_interface::gen_optable_helper, ss) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_interface::gen_operation_table - "
+ "inheritance graph traversal failed\n"),
+ -1);
+
+ // Generate the skeleton for the is_a method.
+ ss->indent ();
+ *ss << "_is_a" << ",\t&" << this->full_skel_name () << "::_is_a_skel\n";
+ this->skel_count_++;
+
+ // Input to the gperf is ready. Run gperf and get things done.
+ gen_perfect_hash_optable ();
+
+ // Cleanup the temp file. Delete the stream, remove the file
+ // and delete the filename ptr.
+ cleanup_gperf_temp_file ();
+ }
+ break;
+
+ default:
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_interface::gen_operation_table - "
- "inheritance graph traversal failed\n"), -1);
+ "be_interface",
+ "::",
+ "gen_operation_table",
+ "unknown op_lookup_strategy"),
+ -1);
}
-
- // generate the skeleton for the is_a method
- ss->indent ();
- *ss << "{\"_is_a\", &" << this->full_skel_name () << "::_is_a_skel}\n";
- this->skel_count_++;
-
- ss->decr_indent ();
- *ss << "};" << nl << nl;
-
- // XXXASG - this code should be based on using different strategies for
- // demux - for next release
- *ss << "static const CORBA::Long _tao_" << this->flatname ()
- << "_optable_size = sizeof (ACE_Hash_Map_Entry<const char *,"
- << " TAO_Skeleton>) * (" << (3*this->skel_count_)
- << ");" << be_nl;
- *ss << "static char _tao_" << this->flatname () << "_optable_pool "
- << "[_tao_" << this->flatname () << "_optable_size];" << be_nl;
- *ss << "static ACE_Static_Allocator_Base _tao_" << this->flatname ()
- << "_allocator (_tao_" << this->flatname () << "_optable_pool, "
- << "_tao_" << this->flatname () << "_optable_size);" << be_nl;
- *ss << "TAO_Dynamic_Hash_OpTable tao_" << this->flatname () << "_optable "
- << "(" << this->flatname () << "_operations, " << this->skel_count_
- << ", " << 2*this->skel_count_ << ", &_tao_" << this->flatname ()
- << "_allocator);" << be_nl;
return 0;
}
+// Output the header (type declaration and %%) to the gperf's input
+// file.
+void
+be_interface::gen_gperf_input_header (TAO_OutStream *ss)
+{
+ *ss << "class TAO_operation_db_entry {\n"
+ << "public:\n"
+ << "\tchar *opname_;" << "\n"
+ << "\tTAO_Skeleton skel_ptr_;" << "\n"
+ << "};" << "\n"
+ << "%%"
+ << "\n";
+}
+
// we separate the generation of operation table entries from the
// "gen_operation_table" method. This enables us to invoke generation of
// entries for interfaces from which we inherit without any additional
@@ -847,57 +951,130 @@ be_interface::gen_optable_entries (be_interface *derived)
// retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- ss = cg->server_skeletons ();
-
- if (this->nmembers () > 0)
+ switch (cg->lookup_strategy ())
{
- // if there are elements in this scope i.e., any operations and
- // attributes defined by "this" which happens to be the same as "derived"
- // or one of its ancestors.
+ case TAO_CodeGen::TAO_DYNAMIC_HASH:
+ // Init the outstream.
+ ss = cg->server_skeletons ();
- si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
- // instantiate a scope iterator.
-
- while (!(si->is_done ()))
+ // The major stuff.
+ if (this->nmembers () > 0)
{
- // get the next AST decl node
- d = si->item ();
- if (d->node_type () == AST_Decl::NT_op)
- {
- ss->indent (); // start from current indentation level
- // we are an operation node
- *ss << "{\"" << d->local_name () << "\", &" << derived->full_skel_name
- () << "::" << d->local_name () << "_skel},\n";
- derived->skel_count_++;
- }
- else if (d->node_type () == AST_Decl::NT_attr)
+ // if there are elements in this scope i.e., any operations and
+ // attributes defined by "this" which happens to be the same as "derived"
+ // or one of its ancestors.
+
+ si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
+ // instantiate a scope iterator.
+
+ while (!(si->is_done ()))
{
- AST_Attribute *attr;
+ // get the next AST decl node
+ d = si->item ();
+ if (d->node_type () == AST_Decl::NT_op)
+ {
+ ss->indent (); // start from current indentation level
+ // we are an operation node
+ *ss << "{\"" << d->local_name () << "\", &"
+ << derived->full_skel_name () << "::"
+ << d->local_name () << "_skel},\n";
+ derived->skel_count_++;
+ }
+ else if (d->node_type () == AST_Decl::NT_attr)
+ {
+ AST_Attribute *attr;
- ss->indent (); // start from current indentation level
- // generate only the "get" entry if we are readonly
- *ss << "{\"_get_" << d->local_name () << "\", &" <<
- derived->full_skel_name () << "::_get_" << d->local_name () <<
- "_skel},\n";
- derived->skel_count_++;
+ ss->indent (); // start from current indentation level
+ // generate only the "get" entry if we are readonly
+ *ss << "{\"_get_" << d->local_name () << "\", &" <<
+ derived->full_skel_name () << "::_get_" << d->local_name () <<
+ "_skel},\n";
+ derived->skel_count_++;
- attr = AST_Attribute::narrow_from_decl (d);
- if (!attr)
- return -1;
+ attr = AST_Attribute::narrow_from_decl (d);
+ if (!attr)
+ return -1;
- if (!attr->readonly ())
+ if (!attr->readonly ())
+ {
+ // the set method
+ ss->indent (); // start from current indentation level
+ *ss << "{\"_set_" << d->local_name () << "\", &" <<
+ derived->full_skel_name () << "::_set_" << d->local_name
+ () << "_skel},\n";
+ derived->skel_count_++;
+ }
+ }
+ si->next ();
+ } // end of while
+ delete si; // free the iterator object
+ }
+ break;
+
+ case TAO_CodeGen::TAO_PERFECT_HASH:
+ // Init the outstream.
+ ss = cg->gperf_input_stream ();
+
+ if (this->nmembers () > 0)
+ {
+ // if there are elements in this scope i.e., any operations and
+ // attributes defined by "this" which happens to be the same as "derived"
+ // or one of its ancestors.
+
+ si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
+ // instantiate a scope iterator.
+
+ while (!(si->is_done ()))
+ {
+ // Get the next AST decl node.
+ d = si->item ();
+ if (d->node_type () == AST_Decl::NT_op)
{
- // the set method
ss->indent (); // start from current indentation level
- *ss << "{\"_set_" << d->local_name () << "\", &" <<
- derived->full_skel_name () << "::_set_" << d->local_name
- () << "_skel},\n";
+ // we are an operation node
+ *ss << d->local_name () << ",\t&"
+ << derived->full_skel_name () << "::"
+ << d->local_name () << "_skel" << "\n";
derived->skel_count_++;
}
- }
- si->next ();
- } // end of while
- delete si; // free the iterator object
+ else if (d->node_type () == AST_Decl::NT_attr)
+ {
+ AST_Attribute *attr;
+
+ ss->indent (); // start from current indentation level
+ // generate only the "get" entry if we are readonly
+ *ss << "_get_" << d->local_name () << ",\t&"
+ << derived->full_skel_name () << "::_get_"
+ << d->local_name () << "_skel\n";
+ derived->skel_count_++;
+
+ attr = AST_Attribute::narrow_from_decl (d);
+ if (!attr)
+ return -1;
+
+ if (!attr->readonly ())
+ {
+ // the set method
+ ss->indent (); // start from current indentation level
+ *ss << "_set_" << d->local_name () << ",\t&"
+ << derived->full_skel_name () << "::_set_"
+ << d->local_name () << "_skel\n";
+ derived->skel_count_++;
+ }
+ }
+ si->next ();
+ } // end of while
+ delete si; // free the iterator object
+ }
+ break;
+
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_interface",
+ "::",
+ "gen_optable_entries",
+ "unknown op_lookup_strategy"),
+ -1);
}
return 0;
}
@@ -905,7 +1082,8 @@ be_interface::gen_optable_entries (be_interface *derived)
// template method that traverses the inheritance graph in a breadth-first
// style. The actual work on each element in the inheritance graph is carried
// out by the function passed as argument
-int be_interface::traverse_inheritance_graph (be_interface::tao_code_emitter gen,
+int
+be_interface::traverse_inheritance_graph (be_interface::tao_code_emitter gen,
TAO_OutStream *os)
{
long i; // loop index
@@ -1055,6 +1233,175 @@ be_interface::gen_optable_helper (be_interface *derived,
return 0;
}
+// The main optable generator for the perfect hashing strategy.
+int
+be_interface::gen_perfect_hash_optable (void)
+{
+ // Output a class definition deriving from
+ // TAO_Perfect_Hash_OpTable.
+ gen_perfect_hash_class_definition ();
+
+ // Call GPERF and get the methods defined.
+ if (gen_perfect_hash_methods () == -1)
+ return -1;
+
+ // Create an instance of this perfect hash table.
+ gen_perfect_hash_instance ();
+
+ return 0;
+}
+
+
+// Outputs the class definition for the perfect hashing. This class
+// will inherit from the TAO_Perfect_Hash_OpTable.
+void
+be_interface::gen_perfect_hash_class_definition (void)
+{
+ // Codegen singleton.
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ // Outstream.
+ TAO_OutStream *ss = cg->server_skeletons ();
+
+ *ss << "class " << "TAO_" << this->flatname () << "_Perfect_Hash_OpTable"
+ << " : public TAO_Perfect_Hash_OpTable"
+ << be_nl
+ << "{"
+ << be_nl
+ << "private:"
+ << be_nl
+ << " unsigned int hash (const char *str, int len);"
+ << be_nl
+ << "public:"
+ << be_nl
+ << " const TAO_operation_db_entry * lookup (const char *str, int len);"
+ << be_nl
+ << "};"
+ << "\n";
+}
+
+// We have collected the input (Operations and the corresponding
+// skeleton pointers) for the gperf program. Now let us execute gperf
+// and get things done.
+// GPERF reads from our temp file and write to the Server Skeleton
+// file.
+int
+be_interface::gen_perfect_hash_methods (void)
+{
+ // Using ACE_Process.
+ ACE_Process process_manager;
+ ACE_Process_Options process_options;
+
+ // Codegen's singleton.
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ // Adjust the offset of the underlying file pointer.
+ ACE_OS::rewind (cg->gperf_input_stream ()->file ());
+
+ // Set the stdin and stdout appropriately for the gperf program.
+
+ // Stdin is our temp file. Close the temp file and open using
+ // ACE_OS::open so that we will get ACE_HANDLE.
+
+ if (ACE_OS::fclose (cg->gperf_input_stream ()->file ()) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p:File close failed on temp gperf's input file\n"),
+ -1);
+
+ ACE_HANDLE input = ACE_OS::open (cg->gperf_input_filename (),
+ O_RDONLY);
+ if (input == ACE_INVALID_HANDLE)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p:File open failed on gperf's temp input file\n"),
+ -1);
+
+ // Stdout is server skeleton. Do *not* close the file, just open
+ // again with ACE_OS::open with WRITE + APPEND option.. After this,
+ // remember to update the file offset to the correct location.
+
+ ACE_HANDLE output = ACE_OS::open (idl_global->be_get_server_skeleton_fname (),
+ O_WRONLY | O_APPEND);
+ if (output == ACE_INVALID_HANDLE)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p:File open failed on server skeleton file\n"),
+ -1);
+
+ // Set the handles now in the process options.
+ process_options.set_handles (input, output);
+
+ // Set the command line for the gperf program.
+ process_options.command_line ("gperf"
+ " "
+ "-m -M -J -c -C"
+ " "
+ "-D -E -T -f 0"
+ " "
+ "-a -o -t -p -K"
+ " "
+ "opname_ -L C++"
+ " "
+ "-Z TAO_%s_Perfect_Hash_OpTable"
+ " "
+ "-N lookup",
+ this->flatname ());
+
+ // Spawn a process for gperf.
+ if (process_manager.spawn (process_options) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p:Couldnt spawn a process for gperf program\n"),
+ -1);
+
+ // Wait for gperf to complete.
+ if (process_manager.wait () == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p:wait'ing for gperf program failed.\n"),
+ -1);
+
+ // Adjust the file offset to the EOF for the server skeleton file.
+ ACE_OS::fseek (cg->server_skeletons ()->file (), 0, SEEK_END);
+
+ return 0;
+}
+
+// Create an instance of this perfect hash table.
+void
+be_interface::gen_perfect_hash_instance ()
+{
+ // Codegen singleton.
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ // Outstream.
+ TAO_OutStream *ss = cg->server_skeletons ();
+
+ *ss << "TAO_" << this->flatname () << "_Perfect_Hash_OpTable"
+ << " "
+ << "tao_" << this->flatname () << "_optable"
+ << ";"
+ << be_nl;
+}
+
+// Delete the stream and filename for this temp file and also remove
+// the temperary gperf's input file.
+void
+be_interface::cleanup_gperf_temp_file (void)
+{
+ // Codegen singleton.
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ // Delete the stream ptr.
+ TAO_OutStream *ss = cg->gperf_input_stream ();
+ if (ss != 0)
+ delete ss;
+
+ // Delete the temp file.
+ ACE_OS::unlink (cg->gperf_input_filename ());
+
+ // Delete the filename ptr.
+ char *fname = cg->gperf_input_filename ();
+ if (fname != 0)
+ delete fname;
+}
+
int
be_interface::is_a_helper (be_interface * /*derived*/,
be_interface *bi,
diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h
index 2156265bbb4..1c54cbda431 100644
--- a/TAO/TAO_IDL/be_include/be_codegen.h
+++ b/TAO/TAO_IDL/be_include/be_codegen.h
@@ -440,7 +440,7 @@ public:
// get the server header template stream
TAO_OutStream *server_skeletons (void);
- // get the server skeletons stream
+ // Get the server skeletons stream.
TAO_OutStream *server_template_skeletons (void);
// get the server template skeletons stream
@@ -451,12 +451,21 @@ public:
TAO_OutStream *server_template_inline (void);
// get the server template inline stream
- void gperf_input (TAO_OutStream *gperf_input);
+ void gperf_input_stream (TAO_OutStream *gperf_input);
// Set the gperf input file stream.
- TAO_OutStream *gperf_input (void);
+ TAO_OutStream *gperf_input_stream (void);
// Retrieve the gperf input stream being used.
+ void gperf_input_filename (char *filename);
+ // Set the gperf input file name.
+
+ char *gperf_input_filename (void);
+ // Retrieve the gperf input file name being used.
+ // Name of the temp file used to collect the input for gperf
+ // program. This is needed coz I do ACE_OS::open on this when I need
+ // ACE_HANDLE for the file instead FILE*.
+
void outstream (TAO_OutStream *os);
// set current out stream
@@ -478,7 +487,7 @@ public:
void lookup_strategy (LOOKUP_STRATEGY s);
// Set the lookup strategy.
- LOOKUP_STRATEGY lookup_strategy (void) const;
+ TAO_CodeGen::LOOKUP_STRATEGY lookup_strategy (void) const;
// Return the enumerated value for the lookup strategy. Default is
// Dynamic Hashing.
@@ -499,7 +508,7 @@ private:
// server header template stream
TAO_OutStream *server_skeletons_;
- // server skeleton stream
+ // server skeleton stream.
TAO_OutStream *server_template_skeletons_;
// server skeleton template stream
@@ -510,9 +519,14 @@ private:
TAO_OutStream *server_template_inline_;
// server side template inline file.
- TAO_OutStream *gperf_input_;
+ TAO_OutStream *gperf_input_stream_;
// TAO_OutStream to collect the input for gperf program.
+ char *gperf_input_filename_;
+ // Name of the temp file used to collect the input for gperf
+ // program. This is needed coz I do ACE_OS::open on this when I need
+ // ACE_HANDLE for the file instead FILE*.
+
TAO_OutStream *curr_os_;
// currently used out stream
diff --git a/TAO/TAO_IDL/be_include/be_interface.h b/TAO/TAO_IDL/be_include/be_interface.h
index 22b6554bd29..06331ef0d92 100644
--- a/TAO/TAO_IDL/be_include/be_interface.h
+++ b/TAO/TAO_IDL/be_include/be_interface.h
@@ -179,10 +179,16 @@ private:
void gen_perfect_hash_instance ();
// Create an instance of this perfect hash table.
-
- char *full_skel_name_; // fully scoped skeleton name
-
- int skel_count_; // number of static skeletons in the operation table
+
+ void cleanup_gperf_temp_file ();
+ // Delete the stream and filename for this temp file and also remove
+ // the temperary gperf's input file from the disk.
+
+ char *full_skel_name_;
+ // Fully scoped skeleton name.
+
+ int skel_count_;
+ // Number of static skeletons in the operation table.
char *full_coll_name_;
char *local_coll_name_;
diff --git a/TAO/TAO_IDL/driver/drv_args.cpp b/TAO/TAO_IDL/driver/drv_args.cpp
index 74e20e25958..b99d19b633c 100644
--- a/TAO/TAO_IDL/driver/drv_args.cpp
+++ b/TAO/TAO_IDL/driver/drv_args.cpp
@@ -157,9 +157,11 @@ DRV_parse_args(long ac, char **av)
strcat(idl_global->local_escapes(), s);
strcat(idl_global->local_escapes(), " ");
break;
-
+
// Perfect hashing-Operation lookup strategy.
case 'P':
+ ACE_DEBUG ((LM_DEBUG,
+ "IDL Compiler : Using Perfect Hashing Operation Lookup Strategy\n"));
cg->lookup_strategy (TAO_CodeGen::TAO_PERFECT_HASH);
break;