diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-11-09 15:04:38 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-11-09 15:04:38 +0000 |
commit | be2dfac87484d2873d5199d9592075156ffcb6b3 (patch) | |
tree | 945fb8c95f9a1bbe7c3606b741e87096cf616af0 | |
parent | 8ed6baac240159ddcee1275a1be0055364ac41ad (diff) | |
download | ATCD-be2dfac87484d2873d5199d9592075156ffcb6b3.tar.gz |
ChangeLogTag: Mon Nov 9 14:58:34 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r-- | TAO/ChangeLog | 25 | ||||
-rw-r--r-- | TAO/TAO_IDL/driver/drv_args.cpp | 4 | ||||
-rw-r--r-- | TAO/TAO_IDL/driver/drv_preproc.cpp | 88 | ||||
-rw-r--r-- | TAO/TAO_IDL/include/idl_global.h | 14 | ||||
-rw-r--r-- | TAO/TAO_IDL/tao_idl.cpp | 45 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_global.cpp | 22 |
6 files changed, 140 insertions, 58 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index a10eb3d20f6..dd6b6dbe987 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,28 @@ +Mon Nov 9 14:58:34 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu> + + * TAO_IDL/driver/drv_preproc.cpp: + * TAO_IDL/driver/drv_args.cpp: + + Cosmetic changes. + + * TAO_IDL/tao_idl.cpp: + + Added the (optional) behavior of creating a new IDL file + containing #includes of the individual IDL files on the + command line, or in the directory tree specified by -r + on some backends. Processing this 'container' IDL file + results in significant performance improvement when + processing multiple IDL files, especially if they include + Components.idl, since all the middleware IDL is then + processed only once. + + * TAO_IDL/util/utl_global.cpp: + * TAO_IDL/include/idl_global.h: + + Added a flag to toggle the above behavior, set by a + backend (currently only idl_to_picml) that processes + multiple IDL files into one output. + Mon Nov 9 12:41:31 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl> * TAO_IDL/be/be_helper.cpp: diff --git a/TAO/TAO_IDL/driver/drv_args.cpp b/TAO/TAO_IDL/driver/drv_args.cpp index 8ef48030e18..4373cf74d7c 100644 --- a/TAO/TAO_IDL/driver/drv_args.cpp +++ b/TAO/TAO_IDL/driver/drv_args.cpp @@ -76,10 +76,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "ace/OS_NS_unistd.h" #include "ace/os_include/os_ctype.h" -ACE_RCSID (driver, - drv_args, - "$Id$") - extern long DRV_nfiles; extern char *DRV_files[]; diff --git a/TAO/TAO_IDL/driver/drv_preproc.cpp b/TAO/TAO_IDL/driver/drv_preproc.cpp index 337c41b95e3..aae06ad4e98 100644 --- a/TAO/TAO_IDL/driver/drv_preproc.cpp +++ b/TAO/TAO_IDL/driver/drv_preproc.cpp @@ -168,58 +168,58 @@ DRV_cpp_expand_output_arg (const char *filename) static bool DRV_get_line (FILE *f) { - char *l = ACE_OS::fgets (drv_line, - drv_line_size, - f); + char *l = ACE_OS::fgets (drv_line, + drv_line_size, + f); - if (l == 0) - { - return false; - } + if (l == 0) + { + return false; + } - if (*l == '\0' && feof (f)) - { - return false; - } + if (*l == '\0' && feof (f)) + { + return false; + } - if (*l == '\0') - { - return true; - } + if (*l == '\0') + { + return true; + } - while (ACE_OS::strchr (drv_line, '\n') == 0) - { - // Haven't got to a newline yet. - // Create a bigger buffer and keep reading. - size_t temp_size; - temp_size = drv_line_size * 2; - char *temp = 0; - ACE_NEW_RETURN (temp, - char[temp_size], - false); - ACE_OS::strcpy (temp, drv_line); - delete [] drv_line; - drv_line = temp; - drv_line_size = temp_size; - - l = ACE_OS::fgets (drv_line + ACE_OS::strlen (drv_line), - drv_line_size - ACE_OS::strlen(drv_line), - f); + while (ACE_OS::strchr (drv_line, '\n') == 0) + { + // Haven't got to a newline yet. + // Create a bigger buffer and keep reading. + size_t temp_size; + temp_size = drv_line_size * 2; + char *temp = 0; + ACE_NEW_RETURN (temp, + char[temp_size], + false); + ACE_OS::strcpy (temp, drv_line); + delete [] drv_line; + drv_line = temp; + drv_line_size = temp_size; - if (l == 0 || *l == '\0') - { - break; - } - } + l = ACE_OS::fgets (drv_line + ACE_OS::strlen (drv_line), + drv_line_size - ACE_OS::strlen(drv_line), + f); - size_t i = ACE_OS::strlen (drv_line) - 1; + if (l == 0 || *l == '\0') + { + break; + } + } - if (drv_line[i] == '\n') - { - drv_line[i] = '\0'; - } + size_t i = ACE_OS::strlen (drv_line) - 1; + + if (drv_line[i] == '\n') + { + drv_line[i] = '\0'; + } - return true; + return true; } // Initialize the cpp argument list. diff --git a/TAO/TAO_IDL/include/idl_global.h b/TAO/TAO_IDL/include/idl_global.h index 722b524e22d..728c7555ae2 100644 --- a/TAO/TAO_IDL/include/idl_global.h +++ b/TAO/TAO_IDL/include/idl_global.h @@ -635,6 +635,13 @@ public: void recursion_start (const char *val); // Accessors for the member. + bool multi_file_input (void) const; + void multi_file_input (bool val); + // Accessors for the member. + + const char *big_file_name (void) const; + // Just get the const string. + UTL_String *utl_string_factory (const char *str); // Utility function to create UTL_String classes on the FE heap. @@ -727,6 +734,7 @@ private: char *path_; bool is_system_; }; + typedef ACE_Unbounded_Queue<Include_Path_Info> Unbounded_Paths_Queue; typedef ACE_Unbounded_Queue_Iterator<Include_Path_Info> Unbounded_Paths_Queue_Iterator; Unbounded_Paths_Queue include_paths_; @@ -764,6 +772,12 @@ private: char *recursion_start_; // Path to directory subtree we are iterating/recursing over. // Not used by all backends. + + bool multi_file_input_; + // Some backends process multiple files to a single output. + + const char *big_file_name_; + // Used if the above flag is set. }; diff --git a/TAO/TAO_IDL/tao_idl.cpp b/TAO/TAO_IDL/tao_idl.cpp index a80425bc792..ed06997b271 100644 --- a/TAO/TAO_IDL/tao_idl.cpp +++ b/TAO/TAO_IDL/tao_idl.cpp @@ -75,16 +75,14 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "drv_extern.h" #include "tao/Version.h" #include "ace/Argv_Type_Converter.h" +#include "ace/OS_NS_stdio.h" +#include "ace/OS_NS_unistd.h" #if !defined (ACE_LACKS_IOSTREAM_TOTALLY) // FUZZ: disable check_for_streams_include # include "ace/streams.h" #endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ -ACE_RCSID (TAO_IDL, - tao_idl, - "$Id$") - extern const ACE_TCHAR *DRV_arglist[]; extern unsigned long DRV_argcount; @@ -223,10 +221,15 @@ DRV_drive (const char *s) // and checked below. (void) FE_yyparse (); - // Filename set by FE_yyparse(), so we output it immediately after. - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT("processing %C\n"), - idl_global->filename ()->get_string ())); + // This option creates a single IDL file that includes all + // input files. The backend outputs their names individually. + if (!idl_global->multi_file_input ()) + { + // Filename set by FE_yyparse(), so we output it immediately after. + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("processing %C\n"), + idl_global->filename ()->get_string ())); + } // We must do this as late as possible to make sure any // forward declared structs or unions contained in a @@ -362,12 +365,36 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // Does various things in various backends. BE_post_init (DRV_files, DRV_nfiles); + + FILE *output_file = 0; + + if (idl_global->multi_file_input ()) + { + output_file = + ACE_OS::fopen (idl_global->big_file_name (), "w"); + } for (DRV_file_index = 0; DRV_file_index < DRV_nfiles; ++DRV_file_index) { - DRV_drive (DRV_files[DRV_file_index]); + if (idl_global->multi_file_input ()) + { + ACE_OS::fprintf (output_file, + "#include \"%s\"\n", + DRV_files[DRV_file_index]); + } + else + { + DRV_drive (DRV_files[DRV_file_index]); + } + } + + if (idl_global->multi_file_input ()) + { + ACE_OS::fclose (output_file); + DRV_drive (idl_global->big_file_name ()); + ACE_OS::unlink (idl_global->big_file_name ()); } } catch (Bailout) diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp index 73c07de6e04..173fe8157af 100644 --- a/TAO/TAO_IDL/util/utl_global.cpp +++ b/TAO/TAO_IDL/util/utl_global.cpp @@ -151,7 +151,9 @@ IDL_GlobalData::IDL_GlobalData (void) ignore_idl3_ (false), dcps_support_zero_copy_read_ (false), dcps_gen_zero_copy_read_ (false), - recursion_start_ (0) // Not used by all backends. + recursion_start_ (0), + multi_file_input_ (false), + big_file_name_ ("PICML_IDL_file_bag") { // Path for the perfect hash generator(gperf) program. // Default is $ACE_ROOT/bin/gperf unless ACE_GPERF is defined. @@ -1765,6 +1767,24 @@ IDL_GlobalData::recursion_start (const char *val) this->recursion_start_ = ACE::strnew (val); } +bool +IDL_GlobalData::multi_file_input (void) const +{ + return this->multi_file_input_; +} + +void +IDL_GlobalData::multi_file_input (bool val) +{ + this->multi_file_input_ = val; +} + +const char * +IDL_GlobalData::big_file_name (void) const +{ + return this->big_file_name_; +} + UTL_String * IDL_GlobalData::utl_string_factory (const char *str) { |