summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-05-23 19:34:10 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-05-23 19:34:10 +0000
commit7870e73938bdeb4793fa27473bd063b897f6d388 (patch)
tree986f3759fc2a4d77a24dc7ed16870ffcaa11c7dc
parentf45cdc9de9e05373a71e678465d36427d06b9b97 (diff)
downloadATCD-7870e73938bdeb4793fa27473bd063b897f6d388.tar.gz
ChangeLogTag: Wed May 23 14:26:07 2001 Jeff Parsons <parsons@cs.wustl.edu>
-rw-r--r--TAO/TAO_IDL/be_include/be_decl.h2
-rw-r--r--TAO/TAO_IDL/driver/drv_args.cpp39
-rw-r--r--TAO/TAO_IDL/driver/drv_preproc.cpp13
-rw-r--r--TAO/TAO_IDL/include/drv_private.h3
-rw-r--r--TAO/TAO_IDL/include/idl_global.h11
-rw-r--r--TAO/TAO_IDL/tao_idl.cpp43
-rw-r--r--TAO/TAO_IDL/util/utl_global.cpp16
7 files changed, 89 insertions, 38 deletions
diff --git a/TAO/TAO_IDL/be_include/be_decl.h b/TAO/TAO_IDL/be_include/be_decl.h
index 742002a7a7e..62918398646 100644
--- a/TAO/TAO_IDL/be_include/be_decl.h
+++ b/TAO/TAO_IDL/be_include/be_decl.h
@@ -148,7 +148,7 @@ protected:
virtual void compute_flat_name (void);
// Compute the flattened fully scoped name.
- virtual void destroy ();
+ virtual void destroy (void);
// Cleanup function.
// Variables that indicate if the code generation for that node is already
diff --git a/TAO/TAO_IDL/driver/drv_args.cpp b/TAO/TAO_IDL/driver/drv_args.cpp
index 3319c561fa8..7faa654166f 100644
--- a/TAO/TAO_IDL/driver/drv_args.cpp
+++ b/TAO/TAO_IDL/driver/drv_args.cpp
@@ -452,6 +452,8 @@ DRV_parse_args (long ac, char **av)
{
if (av[i][0] == '-')
{
+ idl_global->append_idl_flag (av[i]);
+
switch (av[i][1])
{
case 0:
@@ -498,24 +500,28 @@ DRV_parse_args (long ac, char **av)
{
// Client stub's header file ending.
// @@ No error handling done here.
+ idl_global->append_idl_flag (av[i+1]);
be_global->client_hdr_ending (av[i+1]);
i++;
}
else if (av[i][2] == 's')
{
// Server skeleton's header file.
+ idl_global->append_idl_flag (av[i+1]);
be_global->server_hdr_ending (av[i+1]);
i++;
}
else if (av[i][2] == 'T')
{
// Server Template header ending.
+ idl_global->append_idl_flag (av[i+1]);
be_global->server_template_hdr_ending (av[i+1]);
i++;
}
else if (av[i][2] == 'I')
{
// Server Template header ending.
+ idl_global->append_idl_flag (av[i+1]);
be_global->implementation_hdr_ending (av[i+1]);
i++;
}
@@ -541,12 +547,14 @@ DRV_parse_args (long ac, char **av)
if (av[i][2] == 's')
{
+ idl_global->append_idl_flag (av[i+1]);
be_global->client_stub_ending (av[i+1]);
i++;
}
else if (av[i][2] == 'i')
{
+ idl_global->append_idl_flag (av[i+1]);
be_global->client_inline_ending (av[i+1]);
i++;
}
@@ -579,27 +587,32 @@ DRV_parse_args (long ac, char **av)
if (av[i][2] == 's')
{
+ idl_global->append_idl_flag (av[i+1]);
be_global->server_skeleton_ending (av[i+1]);
i++;
}
else if (av[i][2] == 'T')
{
+ idl_global->append_idl_flag (av[i+1]);
be_global->server_template_skeleton_ending (av[i+1]);
i++;
}
else if (av[i][2] == 'i')
{
+ idl_global->append_idl_flag (av[i+1]);
be_global->server_inline_ending (av[i+1]);
i++;
}
else if (av[i][2] == 't')
{
+ idl_global->append_idl_flag (av[i+1]);
be_global->server_template_inline_ending (av[i+1]);
i++;
}
else if (av[i][2] == 'I')
{
+ idl_global->append_idl_flag (av[i+1]);
be_global->implementation_skel_ending (av[i+1]);
i++;
}
@@ -621,6 +634,8 @@ DRV_parse_args (long ac, char **av)
// <perfect_hash>, <dynamic_hash> or <binary_search>
// Default is perfect.
case 'H':
+ idl_global->append_idl_flag (av[i+1]);
+
if (ACE_OS::strcmp (av[i+1], "dynamic_hash") == 0)
{
be_global->lookup_strategy (
@@ -682,6 +697,7 @@ DRV_parse_args (long ac, char **av)
// Path for the perfect hash generator(gperf) program. Default
// is $ACE_ROOT/bin/gperf.
case 'g':
+ idl_global->append_idl_flag (av[i+1]);
idl_global->gperf_path (av[i+1]);
i++;
break;
@@ -693,12 +709,14 @@ DRV_parse_args (long ac, char **av)
// be kept. Default is the current directory from which the
// <tao_idl> is called.
case 'o':
+ idl_global->append_idl_flag (av[i+1]);
be_global->output_dir (av [i+1]);
i++;
break;
// Temp directory for the IDL compiler to keep its files.
case 't':
+ idl_global->append_idl_flag (av[i+1]);
idl_global->temp_dir (av [i+1]);
i++;
break;
@@ -710,10 +728,18 @@ DRV_parse_args (long ac, char **av)
{
if (i < ac - 1)
{
- buffer = new char[ACE_OS::strlen (av[i])
- + ACE_OS::strlen (av[i + 1])
- + 2];
- ACE_OS::sprintf (buffer, "%s%s", av[i], av[i+1]);
+ idl_global->append_idl_flag (av[i+1]);
+
+ ACE_NEW (buffer,
+ char[ACE_OS::strlen (av[i])
+ + ACE_OS::strlen (av[i + 1])
+ + 2]);
+
+ ACE_OS::sprintf (buffer,
+ "%s%s",
+ av[i],
+ av[i+1]);
+
DRV_cpp_putarg (buffer);
i++;
}
@@ -960,6 +986,7 @@ DRV_parse_args (long ac, char **av)
}
else if (av[i][2] == 'e')
{
+ idl_global->append_idl_flag (av[i+1]);
int option = ACE_OS::atoi (av[i+1]);
// exception support
@@ -1021,21 +1048,25 @@ DRV_parse_args (long ac, char **av)
{
if (av[k][j+3] == 's')
{
+ idl_global->append_idl_flag (av[i+1]);
be_global->implementation_skel_ending (av[i+1]);
i++;
}
else if (av[k][j+3] == 'h')
{
+ idl_global->append_idl_flag (av[i+1]);
be_global->implementation_hdr_ending (av[i+1]);
i++;
}
else if (av[k][j+3] == 'b')
{
+ idl_global->append_idl_flag (av[i+1]);
be_global->impl_class_prefix (av[i+1]);
i++;
}
else if (av[k][j+3] == 'e')
{
+ idl_global->append_idl_flag (av[i+1]);
be_global->impl_class_suffix (av[i+1]);
i++;
}
diff --git a/TAO/TAO_IDL/driver/drv_preproc.cpp b/TAO/TAO_IDL/driver/drv_preproc.cpp
index eb74100d0e3..50df446333a 100644
--- a/TAO/TAO_IDL/driver/drv_preproc.cpp
+++ b/TAO/TAO_IDL/driver/drv_preproc.cpp
@@ -78,14 +78,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
ACE_RCSID(driver, drv_preproc, "$Id$")
-#undef MAX_ARGLIST
-#define MAX_ARGLIST 128
-
-static const char *arglist[MAX_ARGLIST];
static long argcount = 0;
-
-// The ACE_Process_Options default size of 1024 is sometimes not enough.
-const unsigned long TAO_IDL_COMMAND_LINE_BUFFER_SIZE = 4 * 1024;
+static long max_argcount = 128;
+static const char *arglist[128];
// Push the new CPP location if we got a -Yp argument
void
@@ -98,13 +93,13 @@ DRV_cpp_new_location (const char *new_loc)
void
DRV_cpp_putarg (const char *str)
{
- if (argcount >= MAX_ARGLIST)
+ if (argcount >= max_argcount)
{
ACE_ERROR ((LM_ERROR,
"%s%s %d %s\n",
ACE_TEXT (idl_global->prog_name ()),
ACE_TEXT (": More than"),
- MAX_ARGLIST,
+ max_argcount,
ACE_TEXT ("arguments to preprocessor")));
ACE_OS::exit (99);
diff --git a/TAO/TAO_IDL/include/drv_private.h b/TAO/TAO_IDL/include/drv_private.h
index 75135e5e30d..c8921b2e219 100644
--- a/TAO/TAO_IDL/include/drv_private.h
+++ b/TAO/TAO_IDL/include/drv_private.h
@@ -72,6 +72,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// Data
+// The ACE_Process_Options default size of 1024 is sometimes not enough.
+const unsigned long TAO_IDL_COMMAND_LINE_BUFFER_SIZE = 4 * 1024;
+
extern const char *DRV_files[];
// All files to be processed
diff --git a/TAO/TAO_IDL/include/idl_global.h b/TAO/TAO_IDL/include/idl_global.h
index 880dd4fde4a..f965747e430 100644
--- a/TAO/TAO_IDL/include/idl_global.h
+++ b/TAO/TAO_IDL/include/idl_global.h
@@ -67,6 +67,8 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#ifndef _IDL_IDL_GLOBAL_HH
#define _IDL_IDL_GLOBAL_HH
+#include "ace/SString.h"
+
// idl_global.hh
//
// Defines a class containing all front end global data.
@@ -357,6 +359,12 @@ public:
virtual void destroy (void);
// Cleanup function.
+ virtual void append_idl_flag (const char *s);
+ // Save each flag passed to the IDL compiler.
+
+ virtual const char *idl_flags (void) const;
+ // Get a string representation of the flags passed to the idl compiler.
+
private:
// Data
UTL_ScopeStack *pd_scopes; // Store scopes stack
@@ -420,6 +428,9 @@ private:
idl_bool case_diff_error_;
// Do we report an error for indentifiers in the same scope that differ
// only by case? or just a warning?
+
+ ACE_CString idl_flags_;
+ // Concatenation of all the command line options.
};
#endif //_IDL_IDL_GLOBAL_HH
diff --git a/TAO/TAO_IDL/tao_idl.cpp b/TAO/TAO_IDL/tao_idl.cpp
index 78e69cd886e..57adff50c07 100644
--- a/TAO/TAO_IDL/tao_idl.cpp
+++ b/TAO/TAO_IDL/tao_idl.cpp
@@ -115,9 +115,7 @@ DRV_version (void)
BE_version ();
}
-// Until we find the time to make this portable, we'll just
-// have to skip it. It's been left in place
-// for the day when it may be implemented portably.
+// Fork off a process, wait for it to die.
void
DRV_fork (void)
{
@@ -125,8 +123,13 @@ DRV_fork (void)
DRV_file_index < DRV_nfiles;
++DRV_file_index)
{
- ACE_Process_Options options;
+ ACE_Process_Options options (1,
+ TAO_IDL_COMMAND_LINE_BUFFER_SIZE);
options.creation_flags (ACE_Process_Options::NO_EXEC);
+ options.command_line ("%s %s %s",
+ idl_global->prog_name (),
+ idl_global->idl_flags (),
+ DRV_files[DRV_file_index]);
ACE_Process manager;
pid_t child_pid = manager.spawn (options);
@@ -319,29 +322,25 @@ main (int argc, char *argv[])
ACE_OS::exit (0);
}
- // The original Sun frontend code included a fork if there
- // was more than one filename in the command line. This is
- // a long way from portable, so for now we output a warning
- // if multiple filenames are passed in.
+ // Fork off a process for each file to process. Fork only if
+ // there is more than one file to process.
if (DRV_nfiles > 1)
{
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("warning: Multiple file processing")
- ACE_TEXT (" not implemented.\nAll filenames")
- ACE_TEXT (" after the first will be ignored.\n")));
-
- // This isn't portable so we have to skip it for now.
- // DRV_fork ();
+ // DRV_fork never returns.
+ DRV_fork ();
}
-
- // Do the one file we have to parse.
- // Check if stdin and handle file name appropriately.
- if (DRV_nfiles == 0)
+ else
{
- DRV_files[0] = "standard input";
- }
+ // Do the one file we have to parse.
+ // Check if stdin and handle file name appropriately.
+ if (DRV_nfiles == 0)
+ {
+ DRV_files[0] = "standard input";
+ }
- DRV_drive (DRV_files[0]);
+ DRV_file_index = 0;
+ DRV_drive (DRV_files[DRV_file_index]);
+ }
ACE_OS::exit (0);
diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp
index 3ebea6782f5..ba9cbb1cd63 100644
--- a/TAO/TAO_IDL/util/utl_global.cpp
+++ b/TAO/TAO_IDL/util/utl_global.cpp
@@ -111,8 +111,9 @@ IDL_GlobalData::IDL_GlobalData (void)
temp_dir_ (0),
ident_string_ (0),
obv_support_ (I_FALSE),
- case_diff_error_ (I_TRUE)
-{
+ case_diff_error_ (I_TRUE),
+ idl_flags_ ("")
+ {
// Path for the perfect hash generator(gperf) program.
// Default is $ACE_ROOT/bin/gperf unless ACE_GPERF is defined.
// Use ACE_GPERF if $ACE_ROOT hasn't been set or won't be set
@@ -850,3 +851,14 @@ IDL_GlobalData::destroy (void)
// Should do pragmas here.
}
+void
+IDL_GlobalData::append_idl_flag (const char *s)
+{
+ idl_flags_ += " " + ACE_CString (s);
+}
+
+const char *
+IDL_GlobalData::idl_flags (void) const
+{
+ return idl_flags_.c_str ();
+}