diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-08-08 07:06:52 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-08-08 07:06:52 +0000 |
commit | a317a6881dfef65e6acdcf0d0e291a88f9676653 (patch) | |
tree | 08e1aa5d7f89de609fcacc4a9ce1265d2612e6db /CIAO/tools | |
parent | 2723b2fbcf2e3e87562b3243fafbdc4669dc3d84 (diff) | |
download | ATCD-a317a6881dfef65e6acdcf0d0e291a88f9676653.tar.gz |
ChangeLogTag: Wed Aug 8 07:03:33 UTC 2007 Jeff Parsons <j.parsons@vanderbilt.edu>
Diffstat (limited to 'CIAO/tools')
-rw-r--r-- | CIAO/tools/IDL3_to_IDL2/identifier_helper.cpp | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/CIAO/tools/IDL3_to_IDL2/identifier_helper.cpp b/CIAO/tools/IDL3_to_IDL2/identifier_helper.cpp index 057fedd4797..9b8a255b9c5 100644 --- a/CIAO/tools/IDL3_to_IDL2/identifier_helper.cpp +++ b/CIAO/tools/IDL3_to_IDL2/identifier_helper.cpp @@ -4,30 +4,39 @@ #include "identifier_helper.h" #include "utl_identifier.h" #include "utl_string.h" +#include "fe_private.h" #include "global_extern.h" Identifier * IdentifierHelper::original_local_name (Identifier * local_name) { Identifier * id = 0; + const char *lname = local_name->get_string (); - // Remove _cxx_ if it is present. - if (ACE_OS::strstr (local_name->get_string (), - "_cxx_") - == local_name->get_string ()) + // Remove _cxx_ if: + // 1. it occurs and + // 2. it occurs at the beginning of the string and + // 3. the rest of the string is a C++ keyword + if (ACE_OS::strstr (lname, "_cxx_") == lname) { - // CString class is good to do this stuff. - ACE_CString name_str (local_name->get_string ()); - - // Remove _cxx_. - name_str = name_str.substr (ACE_OS::strlen ("_cxx_")); + TAO_IDL_CPP_Keyword_Table cpp_key_tbl; + + unsigned int len = + static_cast<unsigned int> (ACE_OS::strlen (lname + 5)); + + const TAO_IDL_CPP_Keyword_Entry *entry = + cpp_key_tbl.lookup (lname + 5, len); - // Assign to the Identifier variable. - ACE_NEW_RETURN (id, - Identifier (name_str.c_str ()), - 0); + if (entry != 0) + { + // Remove _cxx_ and assign to the Identifier variable. + ACE_NEW_RETURN (id, + Identifier (lname + 5), + 0); + } } - else + + if (id == 0) { id = local_name->copy (); } @@ -35,7 +44,6 @@ IdentifierHelper::original_local_name (Identifier * local_name) return id; } - ACE_CString IdentifierHelper::orig_sn (UTL_IdList * sn, bool appended_to) { @@ -77,7 +85,7 @@ IdentifierHelper::orig_sn (UTL_IdList * sn, bool appended_to) } } - id->destroy (); + id->destroy (); delete id; id = 0; } |