diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-11-15 17:27:27 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-11-15 17:27:27 +0000 |
commit | a06203f1e6090b19468fdfd3786323af5d1f4b8d (patch) | |
tree | 597f27fe888e07dfe089409e5b4aa6954151f31c /TAO/TAO_IDL/util | |
parent | 074832b635bdd4341d429c80896afd79bbf01eb2 (diff) | |
download | ATCD-a06203f1e6090b19468fdfd3786323af5d1f4b8d.tar.gz |
ChangeLogTag:Sat Nov 15 11:23:46 1997 Carlos O'Ryan <coryan@macarena.cs.wustl.edu>
Diffstat (limited to 'TAO/TAO_IDL/util')
-rw-r--r-- | TAO/TAO_IDL/util/utl_global.cpp | 154 |
1 files changed, 66 insertions, 88 deletions
diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp index 43abd1e2e02..4d31b1b3cda 100644 --- a/TAO/TAO_IDL/util/utl_global.cpp +++ b/TAO/TAO_IDL/util/utl_global.cpp @@ -476,124 +476,102 @@ void IDL_GlobalData::idl_src_file(String *s) } /************ Helper functions **************/ -const char * -IDL_GlobalData::be_get_client_hdr_fname () -{ - String *s; - char *base; - static char fname[MAXNAMELEN]; +static const char* +be_change_idl_file_extension (String* idl_file, + const char *new_extension) +{ + // @@ This shouldn't happen anyway; but a better error handling + // mechanism is needed. + if (idl_file == 0 || new_extension == 0) + { + return 0; + } + static char fname[MAXNAMELEN]; ACE_OS::memset (fname, 0, MAXNAMELEN); - s = idl_global->idl_src_file (); - // get the IDL source file name - base = ACE_OS::strstr (s->get_string (), ".idl"); + + const char* string = idl_file->get_string (); + // get the base part of the filename - if (base == NULL) + char* base = ACE_OS::strstr (string, ".idl"); + + if (base == 0) return 0; - ACE_OS::strncpy (fname, s->get_string (), base - s->get_string ()); - ACE_OS::strcat (fname, "C.h"); + ACE_OS::strncpy (fname, string, base - string); + ACE_OS::strcat (fname, new_extension); return fname; } -const char * -IDL_GlobalData::be_get_client_stub_fname () +const char * +IDL_GlobalData::be_get_client_hdr (String *idl_file_name) { - String *s; - char *base; - static char fname[MAXNAMELEN]; - - ACE_OS::memset (fname, 0, MAXNAMELEN); - s = idl_global->idl_src_file (); - // get the IDL source file name - base = ACE_OS::strstr (s->get_string (), ".idl"); - // get the base part of the filename - if (base == NULL) - return 0; - - ACE_OS::strncpy (fname, s->get_string (), base - s->get_string ()); - ACE_OS::strcat (fname, "C.cpp"); - return fname; + return be_change_idl_file_extension (idl_file_name, "C.h"); } -const char * -IDL_GlobalData::be_get_client_inline_fname () +const char * +IDL_GlobalData::be_get_client_stub (String *idl_file_name) { - String *s; - char *base; - static char fname[MAXNAMELEN]; + return be_change_idl_file_extension (idl_file_name, "C.cpp"); +} - ACE_OS::memset (fname, 0, MAXNAMELEN); - s = idl_global->idl_src_file (); - // get the IDL source file name - base = ACE_OS::strstr (s->get_string (), ".idl"); - // get the base part of the filename - if (base == NULL) - return 0; +const char * +IDL_GlobalData::be_get_client_inline (String *idl_file_name) +{ + return be_change_idl_file_extension (idl_file_name, "C.i"); +} - ACE_OS::strncpy (fname, s->get_string (), base - s->get_string ()); - ACE_OS::strcat (fname, "C.i"); - return fname; +const char * +IDL_GlobalData::be_get_server_hdr (String *idl_file_name) +{ + return be_change_idl_file_extension (idl_file_name, "S.h"); } -const char * -IDL_GlobalData::be_get_server_hdr_fname () +const char * +IDL_GlobalData::be_get_server_skeleton (String *idl_file_name) { - String *s; - char *base; - static char fname[MAXNAMELEN]; + return be_change_idl_file_extension (idl_file_name, "S.cpp"); +} - ACE_OS::memset (fname, 0, MAXNAMELEN); - s = idl_global->idl_src_file (); - // get the IDL source file name - base = ACE_OS::strstr (s->get_string (), ".idl"); - // get the base part of the filename - if (base == NULL) - return 0; +const char * +IDL_GlobalData::be_get_server_inline (String *idl_file_name) +{ + return be_change_idl_file_extension (idl_file_name, "S.i"); +} - ACE_OS::strncpy (fname, s->get_string (), base - s->get_string ()); - ACE_OS::strcat (fname, "S.h"); - return fname; +const char * +IDL_GlobalData::be_get_client_hdr_fname () +{ + return be_get_client_hdr (idl_global->idl_src_file ()); } const char * -IDL_GlobalData::be_get_server_inline_fname () +IDL_GlobalData::be_get_client_stub_fname () { - String *s; - char *base; - static char fname[MAXNAMELEN]; + return be_get_client_stub (idl_global->idl_src_file ()); +} - ACE_OS::memset (fname, 0, MAXNAMELEN); - s = idl_global->idl_src_file (); - // get the IDL source file name - base = ACE_OS::strstr (s->get_string (), ".idl"); - // get the base part of the filename - if (base == NULL) - return 0; +const char * +IDL_GlobalData::be_get_client_inline_fname () +{ + return be_get_client_inline (idl_global->idl_src_file ()); +} - ACE_OS::strncpy (fname, s->get_string (), base - s->get_string ()); - ACE_OS::strcat (fname, "S.i"); - return fname; +const char * +IDL_GlobalData::be_get_server_hdr_fname () +{ + return be_get_server_hdr (idl_global->idl_src_file ()); } const char * IDL_GlobalData::be_get_server_skeleton_fname () { - String *s; - char *base; - static char fname[MAXNAMELEN]; - - ACE_OS::memset (fname, 0, MAXNAMELEN); - s = idl_global->idl_src_file (); - // get the IDL source file name - base = ACE_OS::strstr (s->get_string (), ".idl"); - // get the base part of the filename - if (base == NULL) - return 0; - - ACE_OS::strncpy (fname, s->get_string (), base - s->get_string ()); - ACE_OS::strcat (fname, "S.cpp"); - return fname; + return be_get_server_skeleton (idl_global->idl_src_file ()); } +const char * +IDL_GlobalData::be_get_server_inline_fname () +{ + return be_get_server_inline (idl_global->idl_src_file ()); +} |