summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/util
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/TAO_IDL/util')
-rw-r--r--TAO/TAO_IDL/util/utl_decllist.cpp40
-rw-r--r--TAO/TAO_IDL/util/utl_err.cpp416
-rw-r--r--TAO/TAO_IDL/util/utl_exceptlist.cpp72
-rw-r--r--TAO/TAO_IDL/util/utl_exprlist.cpp76
-rw-r--r--TAO/TAO_IDL/util/utl_global.cpp216
-rw-r--r--TAO/TAO_IDL/util/utl_identifier.cpp44
-rw-r--r--TAO/TAO_IDL/util/utl_idlist.cpp88
-rw-r--r--TAO/TAO_IDL/util/utl_indenter.cpp61
-rw-r--r--TAO/TAO_IDL/util/utl_labellist.cpp79
-rw-r--r--TAO/TAO_IDL/util/utl_list.cpp119
-rw-r--r--TAO/TAO_IDL/util/utl_namelist.cpp82
-rw-r--r--TAO/TAO_IDL/util/utl_scope.cpp352
-rw-r--r--TAO/TAO_IDL/util/utl_stack.cpp159
-rw-r--r--TAO/TAO_IDL/util/utl_string.cpp34
-rw-r--r--TAO/TAO_IDL/util/utl_strlist.cpp154
-rw-r--r--TAO/TAO_IDL/util/utl_tmpl/utl_idlist.cpp61
-rw-r--r--TAO/TAO_IDL/util/utl_tmpl/utl_strlist.cpp51
17 files changed, 1258 insertions, 846 deletions
diff --git a/TAO/TAO_IDL/util/utl_decllist.cpp b/TAO/TAO_IDL/util/utl_decllist.cpp
index 07031753b60..dd34ce2c344 100644
--- a/TAO/TAO_IDL/util/utl_decllist.cpp
+++ b/TAO/TAO_IDL/util/utl_decllist.cpp
@@ -74,36 +74,48 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// will cease to operate correctly if you use either multiple or
// public virtual inheritance.
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_decllist.h"
+#include "fe_declarator.h"
-ACE_RCSID(util, utl_decllist, "$Id$")
+ACE_RCSID (util,
+ utl_decllist,
+ "$Id$")
/*
* Constructor(s)
*/
-UTL_DeclList::UTL_DeclList(FE_Declarator *s, UTL_DeclList *cdr)
- : UTL_List(cdr),
- pd_car_data(s)
+UTL_DeclList::UTL_DeclList (FE_Declarator *s,
+ UTL_DeclList *cdr)
+ : UTL_List(cdr),
+ pd_car_data(s)
{
}
/*
- * Private operations
- */
-
-/*
* Public operations
*/
// Get list item
FE_Declarator *
-UTL_DeclList::head()
+UTL_DeclList::head (void)
{
return pd_car_data;
}
+void
+UTL_DeclList::destroy (void)
+{
+ if (this->pd_car_data != 0)
+ {
+ this->pd_car_data->destroy ();
+ delete this->pd_car_data;
+ this->pd_car_data = 0;
+ }
+
+ this->UTL_List::destroy ();
+}
+
/*
* Redefinition of inherited virtual operations
*/
@@ -115,7 +127,7 @@ UTL_DeclList::head()
*/
UTL_DecllistActiveIterator::UTL_DecllistActiveIterator (UTL_DeclList *s)
- : UTL_ListActiveIterator(s)
+ : UTL_ListActiveIterator (s)
{
}
@@ -129,14 +141,14 @@ UTL_DecllistActiveIterator::UTL_DecllistActiveIterator (UTL_DeclList *s)
// Get current item
FE_Declarator *
-UTL_DecllistActiveIterator::item()
+UTL_DecllistActiveIterator::item (void)
{
if (source == 0)
{
return 0;
}
- return ((UTL_DeclList *) source)->head();
+ return ((UTL_DeclList *) source)->head ();
}
/*
diff --git a/TAO/TAO_IDL/util/utl_err.cpp b/TAO/TAO_IDL/util/utl_err.cpp
index e22053dac0d..d27dd86cef4 100644
--- a/TAO/TAO_IDL/util/utl_err.cpp
+++ b/TAO/TAO_IDL/util/utl_err.cpp
@@ -67,24 +67,25 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// utl_err.cc - Implementation of error reporting object for IDL
// compiler program
-#include "idl.h"
-#include "idl_extern.h"
-
-ACE_RCSID(util, utl_err, "$Id$")
-
-#if defined(ACE_GCC_HONORS_STD_NAMESPACE) && (ACE_GCC_HONORS_STD_NAMESPACE == 1)
+#include "utl_err.h"
+#include "utl_identifier.h"
+#include "utl_string.h"
+#include "global_extern.h"
+#include "nr_extern.h"
+#include "ast_interface.h"
+#include "ast_enum.h"
+#include "ast_union.h"
+#include "ast_union_label.h"
+
+ACE_RCSID (util,
+ utl_err,
+ "$Id$")
+
+#if defined (ACE_GCC_HONORS_STD_NAMESPACE) \
+ && (ACE_GCC_HONORS_STD_NAMESPACE == 1)
using std::cerr;
#endif
-
-/*
- * Helper functions to do:
- *
- * - Convert an error code to an error string
- * - Print out an error message header
- * - Convert an ExprType to a string
- */
-
// Convert an error code into a const char *
static const char *
error_string (UTL_Error::ErrorCode c)
@@ -115,12 +116,18 @@ error_string (UTL_Error::ErrorCode c)
return "version already set by #pragma version or #pragma id, ";
case UTL_Error::EIDL_ID_RESET:
return "cannot reset id to a different string, ";
+ case UTL_Error::EIDL_TYPEID_RESET:
+ return "repo id already set by previous call to 'typeid', ";
+ case UTL_Error::EIDL_INVALID_TYPEID:
+ return "'typeid' may not be applied to this type, ";
+ case UTL_Error::EIDL_INVALID_TYPEPREFIX:
+ return "'typeprefix' may not be applied to this type, ";
case UTL_Error::EIDL_DISC_TYPE:
return "union with illegal discriminator type, ";
case UTL_Error::EIDL_LABEL_TYPE:
return "label type incompatible with union discriminator type, ";
case UTL_Error::EIDL_ILLEGAL_ADD:
- return "illegal add operation, ";
+ return "forward declared type may be used only as a sequence element, ";
case UTL_Error::EIDL_ILLEGAL_USE:
return "illegal type used in expression, ";
case UTL_Error::EIDL_ILLEGAL_RAISES:
@@ -128,16 +135,31 @@ error_string (UTL_Error::ErrorCode c)
case UTL_Error::EIDL_ILLEGAL_CONTEXT:
return "error in context(..) clause, ";
case UTL_Error::EIDL_CANT_INHERIT:
+ // More intelligible message printed by error routine.
+ return "";
+ case UTL_Error::EIDL_CANT_SUPPORT:
+ // More intelligible message printed by error routine.
return "";
case UTL_Error::EIDL_LOOKUP_ERROR:
return "error in lookup of symbol: ";
case UTL_Error::EIDL_INHERIT_FWD_ERROR:
- /* More intelligible message printed by error routine */
+ // More intelligible message printed by error routine.
+ return "";
+ case UTL_Error::EIDL_SUPPORTS_FWD_ERROR:
+ // More intelligible message printed by error routine.
return "";
case UTL_Error::EIDL_CONSTANT_EXPECTED:
return "constant expected: ";
+ case UTL_Error::EIDL_INTERFACE_EXPECTED:
+ return "interface expected: ";
+ case UTL_Error::EIDL_VALUETYPE_EXPECTED:
+ return "value type expected: ";
+ case UTL_Error::EIDL_ABSTRACT_EXPECTED:
+ return "abstract type expected: ";
case UTL_Error::EIDL_EVAL_ERROR:
return "expression evaluation error: ";
+ case UTL_Error::EIDL_INCOMPATIBLE_TYPE:
+ return "incompatible types in constant assignment: ";
case UTL_Error::EIDL_NAME_CASE_ERROR:
return "identifier spellings differ only in case: ";
case UTL_Error::EIDL_NAME_CASE_WARNING:
@@ -216,8 +238,8 @@ exprtype_to_string (AST_Expression::ExprType t)
return "boolean";
case AST_Expression::EV_string:
return "string";
- case AST_Expression::EV_any:
- return "any";
+ case AST_Expression::EV_enum:
+ return "enum";
case AST_Expression::EV_void:
return "void";
case AST_Expression::EV_none:
@@ -235,29 +257,52 @@ exprtype_to_string (AST_Expression::ExprType t)
// Convert a parse state into a possible error message
static const char *
-parse_state_to_error_message(IDL_GlobalData::ParseState ps)
+parse_state_to_error_message (IDL_GlobalData::ParseState ps)
{
- switch (ps) {
+ switch (ps)
+ {
case IDL_GlobalData::PS_NoState:
- return "Statement can not be parsed";
+ return "Statement cannot be parsed";
case IDL_GlobalData::PS_TypeDeclSeen:
return "Malformed typedef declaration";
+ case IDL_GlobalData::PS_TypeIdDeclSeen:
+ return "Malformed type id declaration";
+ case IDL_GlobalData::PS_TypePrefixDeclSeen:
+ return "Malformed type prefix declaration";
case IDL_GlobalData::PS_ConstDeclSeen:
return "Malformed const declaration";
case IDL_GlobalData::PS_ExceptDeclSeen:
- return
- "Malformed exception declaration";
+ return "Malformed exception declaration";
case IDL_GlobalData::PS_InterfaceDeclSeen:
- return
- "Malformed interface declaration";
+ return "Malformed interface declaration";
+ case IDL_GlobalData::PS_ValueTypeDeclSeen:
+ return "Malformed value type declaration";
+ case IDL_GlobalData::PS_ComponentDeclSeen:
+ return "Malformed value type declaration";
+ case IDL_GlobalData::PS_HomeDeclSeen:
+ return "Malformed home declaration";
+ case IDL_GlobalData::PS_EventDeclSeen:
+ return "Malformed value type declaration";
case IDL_GlobalData::PS_ModuleDeclSeen:
return "Malformed module declaration";
case IDL_GlobalData::PS_AttrDeclSeen:
- return
- "Malformed attribute declaration";
+ return "Malformed attribute declaration";
case IDL_GlobalData::PS_OpDeclSeen:
- return
- "Malformed operation declaration";
+ return "Malformed operation declaration";
+ case IDL_GlobalData::PS_ProvidesDeclSeen:
+ return "Malformed provides declaration";
+ case IDL_GlobalData::PS_UsesDeclSeen:
+ return "Malformed uses declaration";
+ case IDL_GlobalData::PS_EmitsDeclSeen:
+ return "Malformed emits declaration";
+ case IDL_GlobalData::PS_PublishesDeclSeen:
+ return "Malformed publishes declaration";
+ case IDL_GlobalData::PS_ConsumesDeclSeen:
+ return "Malformed consumes declaration";
+ case IDL_GlobalData::PS_FactoryDeclSeen:
+ return "Malformed factory declaration";
+ case IDL_GlobalData::PS_FinderDeclSeen:
+ return "Malformed finder declaration";
case IDL_GlobalData::PS_ModuleSeen:
return "Missing module identifier following MODULE keyword";
case IDL_GlobalData::PS_ModuleIDSeen:
@@ -268,22 +313,68 @@ parse_state_to_error_message(IDL_GlobalData::ParseState ps)
return "Illegal syntax following module '}' closer";
case IDL_GlobalData::PS_ModuleBodySeen:
return "Illegal syntax following module body statement(s)";
- case IDL_GlobalData::PS_InterfaceSeen:
- return "Missing interface identifier following INTERFACE keyword";
- case IDL_GlobalData::PS_InterfaceIDSeen:
- return "Illegal syntax following interface identifier";
+ case IDL_GlobalData::PS_InheritColonSeen:
+ return "Illegal syntax following ':' starting inheritance list";
case IDL_GlobalData::PS_InheritSpecSeen:
return "Missing '{' or illegal syntax following inheritance spec";
- case IDL_GlobalData::PS_ForwardDeclSeen:
+ case IDL_GlobalData::PS_SupportSpecSeen:
+ return "Missing '{' or illegal syntax following support spec";
+ case IDL_GlobalData::PS_ManagesSeen:
+ return "Missing component identifier following MANAGES keyword";
+ case IDL_GlobalData::PS_ManagesIDSeen:
+ return "Illegal syntax following managed component identifier";
+ case IDL_GlobalData::PS_PrimaryKeySpecSeen:
+ return "Illegal syntax following primary key spec";
+ case IDL_GlobalData::PS_InterfaceSeen:
+ return "Missing interface identifier following INTERFACE keyword";
+ case IDL_GlobalData::PS_InterfaceForwardSeen:
return "Missing ';' following forward interface declaration";
+ case IDL_GlobalData::PS_InterfaceIDSeen:
+ return "Missing '{' or illegal syntax following interface identifier";
case IDL_GlobalData::PS_InterfaceSqSeen:
return "Illegal syntax following interface '{' opener";
case IDL_GlobalData::PS_InterfaceQsSeen:
return "Illegal syntax following interface '}' closer";
case IDL_GlobalData::PS_InterfaceBodySeen:
return "Illegal syntax following interface body statement(s)";
- case IDL_GlobalData::PS_InheritColonSeen:
- return "Illegal syntax following ':' starting inheritance list";
+ case IDL_GlobalData::PS_ValueTypeSeen:
+ return "Missing interface identifier following VALUETYPE keyword";
+ case IDL_GlobalData::PS_ValueTypeForwardSeen:
+ return "Missing ';' following forward value type declaration";
+ case IDL_GlobalData::PS_ValueTypeIDSeen:
+ return "Missing '{' or illegal syntax following value type identifier";
+ case IDL_GlobalData::PS_ValueTypeSqSeen:
+ return "Illegal syntax following value type '{' opener";
+ case IDL_GlobalData::PS_ValueTypeQsSeen:
+ return "Illegal syntax following value type '}' closer";
+ case IDL_GlobalData::PS_ValueTypeBodySeen:
+ return "Illegal syntax following value type body statement(s)";
+ case IDL_GlobalData::PS_ComponentSeen:
+ return "Missing component identifier following COMPONENT keyword";
+ case IDL_GlobalData::PS_ComponentForwardSeen:
+ return "Missing ';' following forward component declaration";
+ case IDL_GlobalData::PS_ComponentIDSeen:
+ return "Missing '{' or illegal syntax following component identifier";
+ case IDL_GlobalData::PS_ComponentSqSeen:
+ return "Illegal syntax following component '{' opener";
+ case IDL_GlobalData::PS_ComponentQsSeen:
+ return "Illegal syntax following component '}' closer";
+ case IDL_GlobalData::PS_ComponentBodySeen:
+ return "Illegal syntax following component body statement(s)";
+ case IDL_GlobalData::PS_HomeSeen:
+ return "Missing component identifier following HOME keyword";
+ case IDL_GlobalData::PS_HomeIDSeen:
+ return "Missing '{' or illegal syntax following home identifier";
+ case IDL_GlobalData::PS_HomeSqSeen:
+ return "Illegal syntax following home '{' opener";
+ case IDL_GlobalData::PS_HomeQsSeen:
+ return "Illegal syntax following home '}' closer";
+ case IDL_GlobalData::PS_HomeBodySeen:
+ return "Illegal syntax following home body statement(s)";
+ case IDL_GlobalData::PS_StructForwardSeen:
+ return "Missing ';' following forward struct declaration";
+ case IDL_GlobalData::PS_UnionForwardSeen:
+ return "Missing ';' following forward union declaration";
case IDL_GlobalData::PS_SNListCommaSeen:
return "Found illegal scoped name in scoped name list";
case IDL_GlobalData::PS_ScopedNameSeen:
@@ -508,7 +599,7 @@ UTL_Error::error1 (UTL_Error::ErrorCode c,
idl_error_header (c,
idl_global->lineno (),
idl_global->filename ());
- d->name ()->dump (cerr);
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -522,9 +613,10 @@ UTL_Error::error2 (UTL_Error::ErrorCode c,
idl_error_header (c,
idl_global->lineno (),
idl_global->filename ());
- d1->name ()->dump (cerr);
- cerr << ", ";
- d2->name ()->dump (cerr);
+ d1->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ ", "));
+ d2->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -539,11 +631,13 @@ UTL_Error::error3 (UTL_Error::ErrorCode c,
idl_error_header (c,
idl_global->lineno (),
idl_global->filename ());
- d1->name ()->dump (cerr);
- cerr << ", ";
- d2->name ()->dump (cerr);
- cerr << ", ";
- d3->name ()->dump (cerr);
+ d1->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ ", "));
+ d2->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ ", "));
+ d3->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -555,7 +649,8 @@ UTL_Error::warning0 (UTL_Error::ErrorCode c)
idl_error_header (c,
idl_global->lineno (),
idl_global->filename ());
- cerr << "\n";
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
}
void
@@ -565,7 +660,7 @@ UTL_Error::warning1 (UTL_Error::ErrorCode c,
idl_error_header (c,
idl_global->lineno (),
idl_global->filename ());
- d->name ()->dump (cerr);
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
"\n"));
}
@@ -578,9 +673,10 @@ UTL_Error::warning2 (UTL_Error::ErrorCode c,
idl_error_header (c,
idl_global->lineno (),
idl_global->filename ());
- d1->name ()->dump (cerr);
- cerr << ", ";
- d2->name ()->dump (cerr);
+ d1->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ ", "));
+ d2->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
"\n"));
}
@@ -594,11 +690,13 @@ UTL_Error::warning3 (UTL_Error::ErrorCode c,
idl_error_header (c,
idl_global->lineno (),
idl_global->filename ());
- d1->name ()->dump (cerr);
- cerr << ", ";
- d2->name ()->dump (cerr);
- cerr << ", ";
- d3->name ()->dump (cerr);
+ d1->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ ", "));
+ d2->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ ", "));
+ d3->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
"\n"));
}
@@ -611,8 +709,10 @@ UTL_Error::coercion_error (AST_Expression *v,
idl_error_header (EIDL_COERCION_FAILURE,
v->line (),
v->file_name ());
- v->dump (cerr);
- cerr << " to " << exprtype_to_string (t) << "\n";
+ v->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ " to %s\n",
+ exprtype_to_string (t)));
idl_global->set_err_count (idl_global->err_count () + 1);
}
@@ -623,8 +723,9 @@ UTL_Error::lookup_error (UTL_ScopedName *n)
idl_error_header (EIDL_LOOKUP_ERROR,
idl_global->lineno (),
idl_global->filename ());
- n->dump (cerr);
- cerr << "\n";
+ n->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
}
@@ -679,10 +780,10 @@ UTL_Error::inheritance_fwd_error (UTL_ScopedName *n,
f->file_name ());
ACE_ERROR ((LM_ERROR,
"interface "));
- n->dump (cerr);
+ n->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
" cannot inherit from forward declared interface "));
- f->local_name ()->dump (cerr);
+ f->local_name ()->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -696,30 +797,109 @@ UTL_Error::inheritance_error (UTL_ScopedName *n,
idl_error_header (EIDL_CANT_INHERIT,
idl_global->lineno (),
idl_global->filename ());
- n->dump (cerr);
+ n->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
" attempts to inherit from "));
- d->name ()->dump (cerr);
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
}
-// Report inheritance from non-abstract valuetype.
+// Report an attempt to support an interface which was only
+// declared forward but not yet defined.
void
-UTL_Error::abstract_inheritance_error (UTL_ScopedName *n)
+UTL_Error::supports_fwd_error (UTL_ScopedName *n,
+ AST_Interface *f)
+{
+ idl_error_header (EIDL_SUPPORTS_FWD_ERROR,
+ f->line (),
+ f->file_name ());
+ ACE_ERROR ((LM_ERROR,
+ "interface "));
+ n->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ " cannot support forward declared interface "));
+ f->local_name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report an attempt to support something other than an interface.
+void
+UTL_Error::supports_error (UTL_ScopedName *n,
+ AST_Decl *d)
+{
+ idl_error_header (EIDL_CANT_SUPPORT,
+ idl_global->lineno (),
+ idl_global->filename ());
+ n->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ " attempts to support "));
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report illegal inheritance from non-abstract valuetype or interface.
+void
+UTL_Error::abstract_inheritance_error (UTL_ScopedName *v,
+ UTL_ScopedName *i)
{
idl_error_header (EIDL_CANT_INHERIT,
idl_global->lineno (),
idl_global->filename ());
ACE_ERROR ((LM_ERROR,
" abstract valuetype "));
- n->dump (cerr);
+ v->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ " attempts to inherit from nonabstract type: "));
+ i->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report illegal support of non-abstract interface.
+void
+UTL_Error::abstract_support_error (UTL_ScopedName *v,
+ UTL_ScopedName *i)
+{
+ idl_error_header (EIDL_CANT_SUPPORT,
+ idl_global->lineno (),
+ idl_global->filename ());
ACE_ERROR ((LM_ERROR,
- " attempts to inherit from nonabstract type\n"));
+ " valuetype "));
+ v->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ " attempts to support more than one concrete type: "));
+ i->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
}
+void
+UTL_Error::concrete_supported_inheritance_error (UTL_ScopedName *v,
+ UTL_ScopedName *i)
+{
+ idl_error_header (EIDL_CANT_SUPPORT,
+ idl_global->lineno (),
+ idl_global->filename ());
+ ACE_ERROR ((LM_ERROR,
+ " valuetype "));
+ v->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ " supports concrete interface that does not inherit from"
+ " all ancestors of valuetype's ancestor's concrete supported"
+ " interface: "));
+ i->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
// Report an error while evaluating an expression.
void
@@ -728,7 +908,20 @@ UTL_Error::eval_error (AST_Expression *v)
idl_error_header (EIDL_EVAL_ERROR,
v->line (),
v->file_name ());
- v->dump (cerr);
+ v->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report an error while evaluating an expression.
+void
+UTL_Error::incompatible_type_error (AST_Expression *v)
+{
+ idl_error_header (EIDL_INCOMPATIBLE_TYPE,
+ idl_global->lineno (),
+ idl_global->filename ());
+ v->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -744,10 +937,56 @@ UTL_Error::constant_expected (UTL_ScopedName *n,
idl_error_header (EIDL_CONSTANT_EXPECTED,
d->line (),
d->file_name ());
- n->dump (cerr);
+ n->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
" bound to "));
- d->dump (cerr);
+ d->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report a situation where an interface was expected but we got
+// something else instead. This most likely is a case in a supports
+// or inheritance list.
+void
+UTL_Error::interface_expected (AST_Decl *d)
+{
+ idl_error_header (EIDL_INTERFACE_EXPECTED,
+ d->line (),
+ d->file_name ());
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report a situation where an value type was expected but we got
+// something else instead. This most likely is a case in a primary
+// key, emits, publishes or consumes declaration.
+void
+UTL_Error::valuetype_expected (AST_Decl *d)
+{
+ idl_error_header (EIDL_VALUETYPE_EXPECTED,
+ d->line (),
+ d->file_name ());
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
+ ACE_ERROR ((LM_ERROR,
+ "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+}
+
+// Report a situation where an abstract type was expected but we got
+// something else instead. This is the case in an inheritance
+// list where a concrete type appears after an abstract type, or
+// where a valuetype inherits more than one concrete valuetype.
+void
+UTL_Error::abstract_expected (AST_Decl *d)
+{
+ idl_error_header (EIDL_ABSTRACT_EXPECTED,
+ d->line (),
+ d->file_name ());
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -767,7 +1006,7 @@ UTL_Error::enum_val_expected (AST_Union *u,
ACE_ERROR ((LM_ERROR,
" union %s, ",
u->local_name ()->get_string ()));
- l->dump (cerr);
+ l->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -790,7 +1029,7 @@ UTL_Error::enum_val_lookup_failure (AST_Union *u,
" union %s, enum %s, enumerator ",
u->local_name ()->get_string (),
e->local_name ()->get_string ()));
- n->dump (cerr);
+ n->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -874,10 +1113,10 @@ UTL_Error::ambiguous (UTL_Scope *s,
ACE_ERROR ((LM_ERROR,
" scope: %s, collision: ",
(ScopeAsDecl (s))->local_name ()->get_string ()));
- d->name ()->dump (cerr);
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
" vs. "));
- l->name ()->dump (cerr);
+ l->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -885,14 +1124,14 @@ UTL_Error::ambiguous (UTL_Scope *s,
// Report a forward declared interface which was never defined.
void
-UTL_Error::fwd_decl_not_defined (AST_Interface *d)
+UTL_Error::fwd_decl_not_defined (AST_Type *d)
{
idl_error_header (EIDL_DECL_NOT_DEFINED,
- d->line(),
- d->file_name());
+ d->line (),
+ d->file_name ());
ACE_ERROR ((LM_ERROR,
"interface "));
- d->local_name ()->dump (cerr);
+ d->local_name ()->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -904,14 +1143,14 @@ UTL_Error::fwd_decl_lookup (AST_Interface *d,
UTL_ScopedName *n)
{
idl_error_header (EIDL_FWD_DECL_LOOKUP,
- idl_global->lineno(),
- idl_global->filename());
+ idl_global->lineno (),
+ idl_global->filename ());
ACE_ERROR ((LM_ERROR,
"trying to look up "));
- n->dump (cerr);
+ n->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
" in undefined forward declared interface "));
- d->local_name ()->dump (cerr);
+ d->local_name ()->dump (*ACE_DEFAULT_LOG_STREAM);
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -925,10 +1164,10 @@ UTL_Error::redefinition_in_scope (AST_Decl *d,
idl_error_header (EIDL_REDEF_SCOPE,
d->line (),
d->file_name ());
- d->name ()->dump (cerr);
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
", "));
- s->name ()->dump (cerr);
+ s->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
ACE_ERROR ((LM_ERROR,
"\n"));
idl_global->set_err_count (idl_global->err_count () + 1);
@@ -939,8 +1178,8 @@ void
UTL_Error::not_a_type (AST_Decl *d)
{
idl_error_header (EIDL_NOT_A_TYPE,
- idl_global->lineno(),
- idl_global->filename());
+ idl_global->lineno (),
+ idl_global->filename ());
if (d == 0 || d->name () == 0)
{
ACE_ERROR ((LM_ERROR,
@@ -948,7 +1187,7 @@ UTL_Error::not_a_type (AST_Decl *d)
}
else
{
- d->name ()->dump (cerr);
+ d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
}
ACE_ERROR ((LM_ERROR,
@@ -965,3 +1204,4 @@ UTL_Error::back_end (long lineno,
s);
idl_global->set_err_count (idl_global->err_count () + 1);
}
+
diff --git a/TAO/TAO_IDL/util/utl_exceptlist.cpp b/TAO/TAO_IDL/util/utl_exceptlist.cpp
index 8ad5d138ead..f92c1ccabbe 100644
--- a/TAO/TAO_IDL/util/utl_exceptlist.cpp
+++ b/TAO/TAO_IDL/util/utl_exceptlist.cpp
@@ -62,7 +62,7 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
// utl_exceptlist.cc
//
@@ -74,68 +74,40 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// will cease to operate correctly if you use either multiple or
// public virtual inheritance.
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_exceptlist.h"
-ACE_RCSID(util, utl_exceptlist, "$Id$")
+ACE_RCSID (util,
+ utl_exceptlist,
+ "$Id$")
-/*
- * Constructor(s)
- */
-
-UTL_ExceptList::UTL_ExceptList(AST_Exception *s, UTL_ExceptList *cdr)
- : UTL_List(cdr),
- pd_car_data(s)
+UTL_ExceptList::UTL_ExceptList (AST_Exception *s,
+ UTL_ExceptList *cdr)
+ : UTL_List (cdr),
+ pd_car_data (s)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
-// Get list item
+// Get list item.
AST_Exception *
-UTL_ExceptList::head()
+UTL_ExceptList::head (void)
{
- return pd_car_data;
+ return this->pd_car_data;
}
-/*
- * Redefinition of inherited virtual operations
- */
-
-// UTL_ExceptList active iterator
-
-/*
- * Constructor
- */
-
-UTL_ExceptlistActiveIterator::UTL_ExceptlistActiveIterator(UTL_ExceptList *s)
- : UTL_ListActiveIterator(s)
+UTL_ExceptlistActiveIterator::UTL_ExceptlistActiveIterator (UTL_ExceptList *s)
+ : UTL_ListActiveIterator(s)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
-// Get current item
+// Get current item.
AST_Exception *
-UTL_ExceptlistActiveIterator::item()
+UTL_ExceptlistActiveIterator::item (void)
{
- if (source == NULL)
- return NULL;
- return ((UTL_ExceptList *) source)->head();
+ if (source == 0)
+ {
+ return 0;
+ }
+
+ return ((UTL_ExceptList *) source)->head ();
}
-/*
- * Redefinition of inherited virtual operations
- */
diff --git a/TAO/TAO_IDL/util/utl_exprlist.cpp b/TAO/TAO_IDL/util/utl_exprlist.cpp
index 0f3c5a3b2a8..2f96cded1b5 100644
--- a/TAO/TAO_IDL/util/utl_exprlist.cpp
+++ b/TAO/TAO_IDL/util/utl_exprlist.cpp
@@ -62,11 +62,9 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
-// utl_exprlist.cc
-//
-// Implementation of a list of strings
+// Implementation of a list of expressions.
// NOTE: This list class only works correctly because we use single public
// inheritance, as opposed to multiple inheritance or public virtual.
@@ -74,68 +72,40 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// will cease to operate correctly if you use either multiple or
// public virtual inheritance.
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_exprlist.h"
-ACE_RCSID(util, utl_exprlist, "$Id$")
+ACE_RCSID (util,
+ utl_exprlist,
+ "$Id$")
-/*
- * Constructor(s)
- */
-
-UTL_ExprList::UTL_ExprList(AST_Expression *s, UTL_ExprList *cdr)
- : UTL_List(cdr),
- pd_car_data(s)
+UTL_ExprList::UTL_ExprList (AST_Expression *s,
+ UTL_ExprList *cdr)
+ : UTL_List(cdr),
+ pd_car_data(s)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
-// Get list item
+// Get list item.
AST_Expression *
-UTL_ExprList::head()
+UTL_ExprList::head (void)
{
- return pd_car_data;
+ return this->pd_car_data;
}
-/*
- * Redefinition of inherited virtual operations
- */
-
-// UTL_ExprList active iterator
-
-/*
- * Constructor
- */
-
-UTL_ExprlistActiveIterator::UTL_ExprlistActiveIterator(UTL_ExprList *s)
- : UTL_ListActiveIterator(s)
+UTL_ExprlistActiveIterator::UTL_ExprlistActiveIterator (UTL_ExprList *s)
+ : UTL_ListActiveIterator(s)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
-// Get current item
+// Get current item.
AST_Expression *
-UTL_ExprlistActiveIterator::item()
+UTL_ExprlistActiveIterator::item (void)
{
- if (source == NULL)
- return NULL;
- return ((UTL_ExprList *) source)->head();
+ if (source == 0)
+ {
+ return 0;
+ }
+
+ return ((UTL_ExprList *) source)->head ();
}
-/*
- * Redefinition of inherited virtual operations
- */
diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp
index 48ee3661f6a..4641ca4cd4b 100644
--- a/TAO/TAO_IDL/util/utl_global.cpp
+++ b/TAO/TAO_IDL/util/utl_global.cpp
@@ -62,58 +62,63 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
-
-// utl_global.cc - Implementation of class IDL_GlobalData
-//
+*/
-#include "idl.h"
-#include "idl_extern.h"
+#include "idl_global.h"
+#include "global_extern.h"
+#include "ast_root.h"
+#include "ast_generator.h"
+#include "utl_identifier.h"
+#include "utl_indenter.h"
+#include "utl_err.h"
+#include "utl_string.h"
-ACE_RCSID(util, utl_global, "$Id$")
+ACE_RCSID (util,
+ utl_global,
+ "$Id$")
// Define an increment for the size of the array used to store names of
-// included files
-#undef INCREMENT
-#define INCREMENT 64
+// included files.
+#undef INCREMENT
+#define INCREMENT 64
IDL_GlobalData::IDL_GlobalData (void)
- : pd_scopes (0),
- pd_root (0),
- pd_gen (0),
- pd_err (0),
- pd_err_count (0),
- pd_lineno (0),
- pd_filename (0),
- pd_main_filename (0),
- pd_real_filename (0),
- pd_stripped_filename (0),
- pd_import (I_FALSE),
- pd_in_main_file (I_FALSE),
- pd_prog_name (0),
- pd_cpp_location (0),
- pd_compile_flags (0),
- pd_be (0),
- pd_local_escapes (0),
- pd_indent (0),
- pd_read_from_stdin (I_FALSE),
- pd_include_file_names (0),
- pd_n_include_file_names (0),
- pd_n_alloced_file_names (0),
- included_idl_files_ (0),
- n_included_idl_files_ (0),
- n_allocated_idl_files_ (0),
- pd_parse_state (PS_NoState),
- pd_idl_src_file (0),
- gperf_path_ (0),
- temp_dir_ (0),
- ident_string_ (0),
- obv_support_ (I_FALSE),
- case_diff_error_ (I_TRUE),
- idl_flags_ (""),
- last_seen_index_ (1),
- repeat_include_ (0)
- {
+ : pd_root (0),
+ pd_gen (0),
+ pd_err (0),
+ pd_err_count (0),
+ pd_lineno (0),
+ pd_filename (0),
+ pd_main_filename (0),
+ pd_real_filename (0),
+ pd_stripped_filename (0),
+ pd_import (I_FALSE),
+ pd_in_main_file (I_FALSE),
+ pd_prog_name (0),
+ pd_cpp_location (0),
+ pd_compile_flags (0),
+ pd_be (0),
+ pd_local_escapes (0),
+ pd_indent (0),
+ pd_read_from_stdin (I_FALSE),
+ pd_include_file_names (0),
+ pd_n_include_file_names (0),
+ pd_n_alloced_file_names (0),
+ included_idl_files_ (0),
+ n_included_idl_files_ (0),
+ n_allocated_idl_files_ (0),
+ pd_parse_state (PS_NoState),
+ pd_idl_src_file (0),
+ gperf_path_ (0),
+ temp_dir_ (0),
+ ident_string_ (0),
+ obv_support_ (I_FALSE),
+ component_support_ (I_FALSE),
+ case_diff_error_ (I_TRUE),
+ nest_orb_ (I_FALSE),
+ idl_flags_ (""),
+ last_seen_index_ (1)
+{
// 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
@@ -162,18 +167,12 @@ IDL_GlobalData::~IDL_GlobalData (void)
}
// Get or set scopes stack
-UTL_ScopeStack *
+UTL_ScopeStack &
IDL_GlobalData::scopes (void)
{
return this->pd_scopes;
}
-void
-IDL_GlobalData::set_scopes (UTL_ScopeStack *s)
-{
- this->pd_scopes = s;
-}
-
// Get or set root of AST
AST_Root *
IDL_GlobalData::root (void)
@@ -412,10 +411,10 @@ IDL_GlobalData::set_local_escapes (const char *e)
{
if (this->pd_local_escapes != 0)
{
- ACE_OS::free (this->pd_local_escapes);
+ delete [] this->pd_local_escapes;
}
- this->pd_local_escapes = ACE_OS::strdup (e);
+ this->pd_local_escapes = ACE::strnew (e);
}
// Get or set indent object
@@ -472,7 +471,7 @@ IDL_GlobalData::store_include_file_name (UTL_String *n)
unsigned long i;
long seen = this->seen_include_file_before (n);
- // Check if we need to store it at all or whether we've seen it already
+ // Check if we need to store it at all or whether we've seen it already.
if (seen)
{
this->last_seen_index_ = seen;
@@ -489,16 +488,22 @@ IDL_GlobalData::store_include_file_name (UTL_String *n)
if (this->pd_n_alloced_file_names == 0)
{
this->pd_n_alloced_file_names = INCREMENT;
- this->pd_include_file_names = new UTL_String *[this->pd_n_alloced_file_names];
+ ACE_NEW (this->pd_include_file_names,
+ UTL_String *[this->pd_n_alloced_file_names]);
}
else
{
o_include_file_names = this->pd_include_file_names;
o_n_alloced_file_names = this->pd_n_alloced_file_names;
this->pd_n_alloced_file_names += INCREMENT;
- this->pd_include_file_names = new UTL_String *[this->pd_n_alloced_file_names];
- for (i = 0; i < o_n_alloced_file_names; i++)
- this->pd_include_file_names[i] = o_include_file_names[i];
+ ACE_NEW (this->pd_include_file_names,
+ UTL_String *[this->pd_n_alloced_file_names]);
+
+ for (i = 0; i < o_n_alloced_file_names; ++i)
+ {
+ this->pd_include_file_names[i] = o_include_file_names[i];
+ }
+
delete [] o_include_file_names;
}
}
@@ -552,7 +557,6 @@ IDL_GlobalData::add_to_included_idl_files (char* file_name)
else
{
// Adding more storage.
-
char** old_included_idl_files =
this->included_idl_files_;
size_t n_old_allocated_idl_files =
@@ -560,8 +564,12 @@ IDL_GlobalData::add_to_included_idl_files (char* file_name)
this->n_allocated_idl_files_ += INCREMENT;
ACE_NEW (this->included_idl_files_,
char *[this->n_allocated_idl_files_]);
- for (size_t i = 0; i < n_old_allocated_idl_files; i++)
- this->included_idl_files_ [i] = old_included_idl_files [i];
+
+ for (size_t i = 0; i < n_old_allocated_idl_files; ++i)
+ {
+ this->included_idl_files_ [i] = old_included_idl_files [i];
+ }
+
delete [] old_included_idl_files;
}
}
@@ -717,18 +725,18 @@ IDL_GlobalData::PredefinedTypeToExprType(AST_PredefinedType::PredefinedType pt)
case AST_PredefinedType::PT_void:
return AST_Expression::EV_void;
default:
- return AST_Expression::EV_any;
+ return AST_Expression::EV_enum;
}
}
// returns the IDL source file being copiled
-UTL_String* IDL_GlobalData::idl_src_file()
+UTL_String* IDL_GlobalData::idl_src_file (void)
{
return this->pd_idl_src_file;
}
// set the source IDL file that is being parsed
-void IDL_GlobalData::idl_src_file(UTL_String *s)
+void IDL_GlobalData::idl_src_file (UTL_String *s)
{
this->pd_idl_src_file = s;
}
@@ -797,6 +805,18 @@ IDL_GlobalData::obv_support (void)
}
void
+IDL_GlobalData::component_support (idl_bool val)
+{
+ this->component_support_ = val;
+}
+
+idl_bool
+IDL_GlobalData::component_support (void)
+{
+ return this->component_support_;
+}
+
+void
IDL_GlobalData::case_diff_error (idl_bool val)
{
this->case_diff_error_ = val;
@@ -809,6 +829,18 @@ IDL_GlobalData::case_diff_error (void)
}
void
+IDL_GlobalData::nest_orb (idl_bool val)
+{
+ this->nest_orb_ = val;
+}
+
+idl_bool
+IDL_GlobalData::nest_orb (void)
+{
+ return this->nest_orb_;
+}
+
+void
IDL_GlobalData::destroy (void)
{
if (this->pd_filename != 0)
@@ -839,8 +871,12 @@ IDL_GlobalData::destroy (void)
this->pd_stripped_filename = 0;
}
- delete [] this->ident_string_;
- this->ident_string_ = 0;
+ if (this->pd_idl_src_file != 0)
+ {
+ this->pd_idl_src_file->destroy ();
+ delete this->pd_idl_src_file;
+ this->pd_idl_src_file = 0;
+ }
size_t size = this->pragma_prefixes ().size ();
char *trash = 0;
@@ -851,6 +887,25 @@ IDL_GlobalData::destroy (void)
delete [] trash;
trash = 0;
}
+
+ this->pd_root->destroy ();
+ delete this->pd_root;
+ this->pd_root = 0;
+
+ delete this->pd_err;
+ this->pd_err = 0;
+ delete this->pd_gen;
+ this->pd_gen = 0;
+ delete this->pd_indent;
+ this->pd_indent = 0;
+ delete [] this->pd_local_escapes;
+ this->pd_local_escapes = 0;
+ delete [] this->gperf_path_;
+ this->gperf_path_ = 0;
+ delete [] this->temp_dir_;
+ this->temp_dir_ = 0;
+ delete [] this->ident_string_;
+ this->ident_string_ = 0;
}
void
@@ -966,28 +1021,3 @@ IDL_GlobalData::string_to_scoped_name (char *s)
return retval;
}
-
-long
-IDL_GlobalData::last_seen_index (void) const
-{
- return this->last_seen_index_;
-}
-
-void
-IDL_GlobalData::last_seen_index (long val)
-{
- this->last_seen_index_ = val;
-}
-
-idl_bool
-IDL_GlobalData::repeat_include (void) const
-{
- return this->repeat_include_;
-}
-
-void
-IDL_GlobalData::repeat_include (idl_bool val)
-{
- this->repeat_include_ = val;
-}
-
diff --git a/TAO/TAO_IDL/util/utl_identifier.cpp b/TAO/TAO_IDL/util/utl_identifier.cpp
index 3a1b5c23027..367c1e467f2 100644
--- a/TAO/TAO_IDL/util/utl_identifier.cpp
+++ b/TAO/TAO_IDL/util/utl_identifier.cpp
@@ -62,20 +62,18 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
-// utl_identifier - Implementation of identifiers
+#include "utl_identifier.h"
+#include "global_extern.h"
+#include "utl_err.h"
+#include "utl_string.h"
-#include "idl.h"
-#include "idl_extern.h"
+ACE_RCSID (util,
+ utl_identifier,
+ "$Id$")
-ACE_RCSID(util, utl_identifier, "$Id$")
-
-/*
- * Constructors
- */
-
-Identifier::Identifier ()
+Identifier::Identifier (void)
: pv_string (0),
escaped_ (0)
{
@@ -111,16 +109,21 @@ Identifier::Identifier (const char *s)
if (shift)
{
- this->pv_string = ACE_OS::strdup (s + 1);
+ this->pv_string = ACE::strnew (s + 1);
}
else
{
- this->pv_string = ACE_OS::strdup (s);
+ this->pv_string = ACE::strnew (s);
}
}
Identifier::~Identifier (void)
{
+ if (this->pv_string != 0)
+ {
+ delete this->pv_string;
+ this->pv_string = 0;
+ }
}
// Operations.
@@ -134,12 +137,12 @@ Identifier::get_string (void)
void
Identifier::replace_string (const char * s)
{
- if (this->pv_string)
+ if (this->pv_string != 0)
{
- ACE_OS::free (this->pv_string);
+ delete [] this->pv_string;
}
- this->pv_string = ACE_OS::strdup (s);
+ this->pv_string = ACE::strnew (s);
}
// Compare two Identifier *
@@ -179,7 +182,7 @@ long
Identifier::case_compare_quiet (Identifier *o)
{
UTL_String member (this->pv_string);
- UTL_String other (o->get_string ());
+ UTL_String other (o->pv_string);
long result = member.compare_quiet (&other);
@@ -217,15 +220,10 @@ Identifier::dump (ACE_OSTREAM_TYPE &o)
return;
}
- o << get_string ();
+ o << this->pv_string;
}
void
Identifier::destroy (void)
{
- if (this->pv_string)
- {
- ACE_OS::free (this->pv_string);
- this->pv_string = 0;
- }
}
diff --git a/TAO/TAO_IDL/util/utl_idlist.cpp b/TAO/TAO_IDL/util/utl_idlist.cpp
index afa1c933569..54f4b88522c 100644
--- a/TAO/TAO_IDL/util/utl_idlist.cpp
+++ b/TAO/TAO_IDL/util/utl_idlist.cpp
@@ -64,20 +64,20 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
*/
-// utl_idlist.cc
-//
-// Implementation of a list of utl_string nodes
+// Implementation of a list of utl_string nodes.
// NOTE: This list class only works correctly because we use single public
-// inheritance, as opposed to multiple inheritance or public virtual.
+// inheritance, as opposed to multiple inheritance or public virtual.
// It relies on a type-unsafe cast from UTL_List to subclasses, which
// will cease to operate correctly if you use either multiple or
// public virtual inheritance.
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_idlist.h"
+#include "utl_identifier.h"
-ACE_RCSID(util, utl_idlist, "$Id$")
+ACE_RCSID (util,
+ utl_idlist,
+ "$Id$")
// Constructor
UTL_IdList::UTL_IdList (Identifier *s,
@@ -117,14 +117,14 @@ UTL_IdList::copy (void)
Identifier *
UTL_IdList::head (void)
{
- return pd_car_data;
+ return this->pd_car_data;
}
// Get last item of this list.
Identifier *
UTL_IdList::last_component (void)
{
- if (this->tail ()== 0)
+ if (this->tail () == 0)
{
return this->head ();
}
@@ -132,16 +132,59 @@ UTL_IdList::last_component (void)
return ((UTL_IdList *) this->tail ())->last_component ();
}
+// Get first item of this list holding a non-empty string.
+Identifier *
+UTL_IdList::first_component (void)
+{
+ if (ACE_OS::strlen (this->pd_car_data->get_string ()) > 0)
+ {
+ return this->pd_car_data;
+ }
+
+ return ((UTL_IdList *) this->tail ())->first_component ();
+}
+
+int
+UTL_IdList::compare (UTL_IdList *other)
+{
+ long this_length = this->length ();
+
+ if (this_length != other->length ())
+ {
+ return 1;
+ }
+
+ Identifier *this_id = 0;
+ Identifier *other_id = 0;
+
+ for (UTL_IdListActiveIterator this_iter (this), other_iter (other);
+ !this_iter.is_done ();
+ this_iter.next (), other_iter.next ())
+ {
+ this_id = this_iter.item ();
+ other_id = other_iter.item ();
+
+ if (ACE_OS::strcmp (this_id->get_string (),
+ other_id->get_string ())
+ != 0)
+ {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
// AST Dumping.
void
UTL_IdList::dump (ACE_OSTREAM_TYPE &o)
{
- UTL_IdListActiveIterator i (this);
-
long first = I_TRUE;
long second = I_FALSE;
- while (!(i.is_done ()))
+ for (UTL_IdListActiveIterator i (this);
+ !i.is_done ();
+ i.next ())
{
if (!first)
{
@@ -165,30 +208,19 @@ UTL_IdList::dump (ACE_OSTREAM_TYPE &o)
second = I_TRUE;
}
}
-
- i.next ();
}
}
void
UTL_IdList::destroy (void)
{
- Identifier *id = 0;
- UTL_IdListActiveIterator i (this);
-
- while (!(i.is_done ()))
+ if (this->pd_car_data != 0)
{
- id = i.item ();
-
- if (id != 0)
- {
- id->destroy ();
- delete id;
- id = 0;
- }
-
- i.next ();
+ delete this->pd_car_data;
+ this->pd_car_data = 0;
}
+
+ this->UTL_List::destroy ();
}
// UTL_IdList active iterator.
diff --git a/TAO/TAO_IDL/util/utl_indenter.cpp b/TAO/TAO_IDL/util/utl_indenter.cpp
index ba00f0cb394..06702447ce1 100644
--- a/TAO/TAO_IDL/util/utl_indenter.cpp
+++ b/TAO/TAO_IDL/util/utl_indenter.cpp
@@ -67,69 +67,62 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// utl_indenter.cc - Implementation of indenter for dumping IDL AST
//
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_indenter.h"
-ACE_RCSID(util, utl_indenter, "$Id$")
+ACE_RCSID (util,
+ utl_indenter,
+ "$Id$")
/*
* Constructors
*/
-UTL_Indenter::UTL_Indenter ()
+UTL_Indenter::UTL_Indenter (void)
: pd_indent_level (0)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
-// Reset indentation level
+// Reset indentation level.
void
-UTL_Indenter::reset ()
+UTL_Indenter::reset (void)
{
- pd_indent_level = 0;
+ this->pd_indent_level = 0;
}
-// Increase indentation level
+// Increase indentation level.
void
-UTL_Indenter::increase ()
+UTL_Indenter::increase (void)
{
- pd_indent_level++;
+ ++this->pd_indent_level;
}
-// Decrease indentation level
+// Decrease indentation level.
void
UTL_Indenter::decrease ()
{
- if (pd_indent_level > 0)
- pd_indent_level--;
+ if (this->pd_indent_level > 0)
+ {
+ --this->pd_indent_level;
+ }
}
-// Produce white space to indent to current indentation level on ostream o
+// Produce white space to indent to current indentation level on ostream o.
void
UTL_Indenter::skip_to (ACE_OSTREAM_TYPE &o)
{
- long i;
-
- for (i = 0; i < pd_indent_level; i++)
- o << " ";
+ for (long i = 0; i < this->pd_indent_level; ++i)
+ {
+ o << " ";
+ }
}
-// Produce white space to indent to current indentation level on ostream o
+// Produce white space to indent to current indentation level on ostream o.
void
UTL_Indenter::skip_to (FILE *fp)
{
- long i;
-
- for (i = 0; i < pd_indent_level; i++)
- ACE_OS::fprintf (fp, " ");
+ for (long i = 0; i < this->pd_indent_level; ++i)
+ {
+ ACE_OS::fprintf (fp,
+ " ");
+ }
}
-/*
- * Redefined virtual operations
- */
diff --git a/TAO/TAO_IDL/util/utl_labellist.cpp b/TAO/TAO_IDL/util/utl_labellist.cpp
index ac155b68602..8241f3c63c7 100644
--- a/TAO/TAO_IDL/util/utl_labellist.cpp
+++ b/TAO/TAO_IDL/util/utl_labellist.cpp
@@ -64,78 +64,49 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
*/
-// utl_labellist.cc
-//
-// Implementation of a list of scoped names
+// Implementation of a list of union labels.
// NOTE: This list class only works correctly because we use single public
// inheritance, as opposed to multiple inheritance or public virtual.
-// It relies on a type-unsafe cast from UTL_List to subclasses, which
-// will cease to operate correctly if you use either multiple or
-// public virtual inheritance.
+// It relies on a type-unsafe cast from UTL_List to subclasses, which
+// will cease to operate correctly if you use either multiple or
+// public virtual inheritance.
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_labellist.h"
-ACE_RCSID(util, utl_labellist, "$Id$")
+ACE_RCSID (util,
+ utl_labellist,
+ "$Id$")
-/*
- * Constructor(s)
- */
-
-UTL_LabelList::UTL_LabelList(AST_UnionLabel *s, UTL_LabelList *cdr)
- : UTL_List(cdr),
- pd_car_data(s)
+UTL_LabelList::UTL_LabelList (AST_UnionLabel *s,
+ UTL_LabelList *cdr)
+ : UTL_List(cdr),
+ pd_car_data(s)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
-// Get list item
+// Get list item.
AST_UnionLabel *
-UTL_LabelList::head()
+UTL_LabelList::head (void)
{
- return pd_car_data;
+ return this->pd_car_data;
}
-/*
- * Redefinition of inherited virtual operations
- */
-
-// UTL_LabelList active iterator
-
-/*
- * Constructor
- */
-
-UTL_LabellistActiveIterator::UTL_LabellistActiveIterator(UTL_LabelList *s)
- : UTL_ListActiveIterator(s)
+UTL_LabellistActiveIterator::UTL_LabellistActiveIterator (UTL_LabelList *s)
+ : UTL_ListActiveIterator (s)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-// Get current item
+// Get current item.
AST_UnionLabel *
-UTL_LabellistActiveIterator::item()
+UTL_LabellistActiveIterator::item (void)
{
- if (source == NULL)
- return NULL;
- return ((UTL_LabelList *) source)->head();
+ if (source == 0)
+ {
+ return 0;
+ }
+
+ return ((UTL_LabelList *) source)->head ();
}
-/*
- * Redefinition of inherited virtual operations
- */
diff --git a/TAO/TAO_IDL/util/utl_list.cpp b/TAO/TAO_IDL/util/utl_list.cpp
index a1c98460ee8..3fc44127e25 100644
--- a/TAO/TAO_IDL/util/utl_list.cpp
+++ b/TAO/TAO_IDL/util/utl_list.cpp
@@ -62,115 +62,136 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
-// utl_list.cc
-//
-// Implementation of generic single-linked lists
+// Implementation of generic single-linked list.
// NOTE: This list class only works correctly because we use single public
// inheritance, as opposed to multiple inheritance or public virtual.
-// It relies on a type-unsafe cast from UTL_List to subclasses, which
-// will cease to operate correctly if you use either multiple or
-// public virtual inheritance.
+// It relies on a type-unsafe cast from UTL_List to subclasses, which
+// will cease to operate correctly if you use either multiple or
+// public virtual inheritance.
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_list.h"
+#include "ace/OS.h"
-ACE_RCSID(util, utl_list, "$Id$")
+ACE_RCSID (util,
+ utl_list,
+ "$Id$")
-// Constructor
UTL_List::UTL_List (UTL_List *c)
: pd_cdr_data (c)
{
}
-// Destructor
UTL_List::~UTL_List (void)
{
-// delete this->pd_cdr_data;
-// this->pd_cdr_data = 0;
}
-// Private operations
-
-// Compute list length
+// Compute list length.
long
UTL_List::list_length (long n)
{
- if (pd_cdr_data == NULL)
- return n;
+ if (this->pd_cdr_data == 0)
+ {
+ return n;
+ }
else
- return pd_cdr_data->list_length (n+1);
+ {
+ return this->pd_cdr_data->list_length (n + 1);
+ }
}
-// Public operations
-
-// Smash last cdr with l
+// Smash last cdr with l.
void
UTL_List::nconc (UTL_List *l)
{
- if (pd_cdr_data == NULL)
- pd_cdr_data = l;
+ if (this->pd_cdr_data == 0)
+ {
+ this->pd_cdr_data = l;
+ }
else
- pd_cdr_data->nconc (l);
+ {
+ this->pd_cdr_data->nconc (l);
+ }
}
-// Override this operation to copy lists of other types
+// Override this operation to copy lists of other types.
UTL_List *
-UTL_List::copy ()
+UTL_List::copy (void)
{
- if (pd_cdr_data == NULL)
- return new UTL_List (NULL);
+ UTL_List *retval = 0;
+
+ if (this->pd_cdr_data == 0)
+ {
+ ACE_NEW_RETURN (retval,
+ UTL_List (0),
+ 0);
+ }
+ else
+ {
+ ACE_NEW_RETURN (retval,
+ UTL_List (this->pd_cdr_data->copy ()),
+ 0);
+ }
- return new UTL_List (pd_cdr_data->copy ());
+ return retval;
}
-// Get next list
+// Get next list.
UTL_List *
-UTL_List::tail ()
+UTL_List::tail (void)
{
return pd_cdr_data;
}
-// Set next list
+// Set next list.
void
UTL_List::set_tail (UTL_List *l)
{
+ this->pd_cdr_data->destroy ();
this->pd_cdr_data = l;
}
-// Compute list length
+// Compute list length.
long
-UTL_List::length ()
+UTL_List::length (void)
{
return list_length (1);
}
-// UTL_List active iterator
+void
+UTL_List::destroy (void)
+{
+ if (this->pd_cdr_data != 0)
+ {
+ this->pd_cdr_data->destroy ();
+ delete this->pd_cdr_data;
+ this->pd_cdr_data = 0;
+ }
+}
+
+// UTL_List active iterator.
-// Constructor
UTL_ListActiveIterator::UTL_ListActiveIterator (UTL_List *s)
: source (s)
{
}
-/*
- * Public operations
- */
-
// Is iterator done?
-long
-UTL_ListActiveIterator::is_done ()
+idl_bool
+UTL_ListActiveIterator::is_done (void)
{
- return (source == NULL) ? I_TRUE : I_FALSE;
+ return (this->source == 0) ? I_TRUE : I_FALSE;
}
-// Advance to next item
+// Advance to next item.
void
-UTL_ListActiveIterator::next ()
+UTL_ListActiveIterator::next (void)
{
- if (source != NULL)
- source = source->tail ();
+ if (this->source != 0)
+ {
+ this->source = this->source->tail ();
+ }
}
diff --git a/TAO/TAO_IDL/util/utl_namelist.cpp b/TAO/TAO_IDL/util/utl_namelist.cpp
index 9f9869d32de..92b3e7a998a 100644
--- a/TAO/TAO_IDL/util/utl_namelist.cpp
+++ b/TAO/TAO_IDL/util/utl_namelist.cpp
@@ -62,80 +62,50 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
-// utl_namelist.cc
-//
-// Implementation of a list of scoped names
+// Implementation of a list of scoped names.
// NOTE: This list class only works correctly because we use single public
// inheritance, as opposed to multiple inheritance or public virtual.
-// It relies on a type-unsafe cast from UTL_List to subclasses, which
-// will cease to operate correctly if you use either multiple or
-// public virtual inheritance.
+// It relies on a type-unsafe cast from UTL_List to subclasses, which
+// will cease to operate correctly if you use either multiple or
+// public virtual inheritance.
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_namelist.h"
-ACE_RCSID(util, utl_namelist, "$Id$")
+ACE_RCSID (util,
+ utl_namelist,
+ "$Id$")
-/*
- * Constructor(s)
- */
-
-UTL_NameList::UTL_NameList(UTL_ScopedName *s, UTL_NameList *cdr)
- : UTL_List(cdr),
- pd_car_data(s)
+UTL_NameList::UTL_NameList (UTL_ScopedName *s,
+ UTL_NameList *cdr)
+ : UTL_List(cdr),
+ pd_car_data(s)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
-// Get list item
+// Get list item.
UTL_ScopedName *
-UTL_NameList::head()
+UTL_NameList::head (void)
{
- return pd_car_data;
+ return this->pd_car_data;
}
-/*
- * Redefinition of inherited virtual operations
- */
-
-// UTL_NameList active iterator
-
-/*
- * Constructor
- */
-
-UTL_NamelistActiveIterator::UTL_NamelistActiveIterator(UTL_NameList *s)
- : UTL_ListActiveIterator(s)
+UTL_NamelistActiveIterator::UTL_NamelistActiveIterator (UTL_NameList *s)
+ : UTL_ListActiveIterator(s)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
-// Get current item
+// Get current item.
UTL_ScopedName *
-UTL_NamelistActiveIterator::item()
+UTL_NamelistActiveIterator::item (void)
{
- if (source == NULL)
- return NULL;
- return ((UTL_NameList *) source)->head();
+ if (source == 0)
+ {
+ return 0;
+ }
+
+ return ((UTL_NameList *) source)->head ();
}
-/*
- * Redefinition of inherited virtual operations
- */
diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp
index 9fd79747f2d..695bfa7a4f6 100644
--- a/TAO/TAO_IDL/util/utl_scope.cpp
+++ b/TAO/TAO_IDL/util/utl_scope.cpp
@@ -64,10 +64,44 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
*/
-#include "idl.h"
-#include "idl_extern.h"
-
-ACE_RCSID(util, utl_scope, "$Id$")
+#include "utl_scope.h"
+#include "utl_identifier.h"
+#include "utl_err.h"
+#include "utl_indenter.h"
+#include "utl_string.h"
+#include "ast_valuetype.h"
+#include "ast_valuetype_fwd.h"
+#include "ast_component.h"
+#include "ast_component_fwd.h"
+#include "ast_home.h"
+#include "ast_typedef.h"
+#include "ast_type.h"
+#include "ast_root.h"
+#include "ast_array.h"
+#include "ast_enum.h"
+#include "ast_concrete_type.h"
+#include "ast_sequence.h"
+#include "ast_string.h"
+#include "ast_structure_fwd.h"
+#include "ast_exception.h"
+#include "ast_constant.h"
+#include "ast_attribute.h"
+#include "ast_operation.h"
+#include "ast_argument.h"
+#include "ast_union.h"
+#include "ast_union_fwd.h"
+#include "ast_union_branch.h"
+#include "ast_field.h"
+#include "ast_enum_val.h"
+#include "ast_native.h"
+#include "ast_factory.h"
+#include "ast_visitor.h"
+#include "nr_extern.h"
+#include "global_extern.h"
+
+ACE_RCSID (util,
+ utl_scope,
+ "$Id$")
#undef INCREMENT
#define INCREMENT 64
@@ -320,8 +354,8 @@ UTL_Scope::lookup_for_add (AST_Decl *d,
return 0;
}
- return lookup_by_name_local (id,
- 0);
+ return this->lookup_by_name_local (id,
+ 0);
}
int
@@ -361,6 +395,35 @@ UTL_Scope::idl_keyword_clash (Identifier *e)
return 0;
}
+idl_bool
+UTL_Scope::redef_clash (AST_Decl::NodeType new_nt,
+ AST_Decl::NodeType scope_elem_nt)
+{
+ switch (new_nt)
+ {
+ case AST_Decl::NT_module:
+ return scope_elem_nt != AST_Decl::NT_module;
+ case AST_Decl::NT_struct:
+ case AST_Decl::NT_struct_fwd:
+ return scope_elem_nt != AST_Decl::NT_struct_fwd;
+ case AST_Decl::NT_union:
+ case AST_Decl::NT_union_fwd:
+ return scope_elem_nt != AST_Decl::NT_union_fwd;
+ case AST_Decl::NT_interface:
+ return scope_elem_nt != AST_Decl::NT_interface_fwd;
+ case AST_Decl::NT_interface_fwd:
+ return (scope_elem_nt != AST_Decl::NT_interface_fwd
+ && scope_elem_nt != AST_Decl::NT_interface);
+ case AST_Decl::NT_valuetype:
+ return scope_elem_nt != AST_Decl::NT_valuetype_fwd;
+ case AST_Decl::NT_valuetype_fwd:
+ return (scope_elem_nt != AST_Decl::NT_valuetype_fwd
+ && scope_elem_nt != AST_Decl::NT_valuetype);
+ default:
+ return I_TRUE;
+ }
+}
+
// Public operations.
// Scope Management Protocol.
@@ -417,6 +480,66 @@ UTL_Scope::add_interface_fwd (AST_InterfaceFwd *i)
return i;
}
+AST_ValueType *
+UTL_Scope::add_valuetype (AST_ValueType *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (I_TRUE);
+ return i;
+}
+
+AST_ValueTypeFwd *
+UTL_Scope::add_valuetype_fwd (AST_ValueTypeFwd *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (I_TRUE);
+ return i;
+}
+
+AST_Component *
+UTL_Scope::add_component (AST_Component *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (I_TRUE);
+ return i;
+}
+
+AST_ComponentFwd *
+UTL_Scope::add_component_fwd (AST_ComponentFwd *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (I_TRUE);
+ return i;
+}
+
+AST_Home *
+UTL_Scope::add_home (AST_Home *i)
+{
+ if (i == 0)
+ {
+ return 0;
+ }
+
+ i->set_added (I_TRUE);
+ return i;
+}
+
AST_Exception *
UTL_Scope::add_exception (AST_Exception *e)
{
@@ -525,6 +648,18 @@ UTL_Scope::add_union (AST_Union *u)
return u;
}
+AST_UnionFwd *
+UTL_Scope::add_union_fwd (AST_UnionFwd *u)
+{
+ if (u == 0)
+ {
+ return 0;
+ }
+
+ u->set_added (I_TRUE);
+ return u;
+}
+
AST_UnionBranch *
UTL_Scope::add_union_branch (AST_UnionBranch *u)
{
@@ -557,6 +692,18 @@ UTL_Scope::add_structure (AST_Structure *s)
return s;
}
+AST_StructureFwd *
+UTL_Scope::add_structure_fwd (AST_StructureFwd *s)
+{
+ if (s == 0)
+ {
+ return 0;
+ }
+
+ s->set_added (I_TRUE);
+ return s;
+}
+
AST_Field *
UTL_Scope::add_field (AST_Field *f)
{
@@ -728,6 +875,36 @@ UTL_Scope::fe_add_interface_fwd (AST_InterfaceFwd *)
return 0;
}
+AST_ValueType *
+UTL_Scope::fe_add_valuetype (AST_ValueType *)
+{
+ return 0;
+}
+
+AST_ValueTypeFwd *
+UTL_Scope::fe_add_valuetype_fwd (AST_ValueTypeFwd *)
+{
+ return 0;
+}
+
+AST_Component *
+UTL_Scope::fe_add_component (AST_Component *)
+{
+ return 0;
+}
+
+AST_ComponentFwd *
+UTL_Scope::fe_add_component_fwd (AST_ComponentFwd *)
+{
+ return 0;
+}
+
+AST_Home *
+UTL_Scope::fe_add_home (AST_Home *)
+{
+ return 0;
+}
+
AST_Exception *
UTL_Scope::fe_add_exception (AST_Exception *)
{
@@ -776,6 +953,12 @@ UTL_Scope::fe_add_union (AST_Union *)
return 0;
}
+AST_UnionFwd *
+UTL_Scope::fe_add_union_fwd (AST_UnionFwd *)
+{
+ return 0;
+}
+
AST_UnionBranch *
UTL_Scope::fe_add_union_branch (AST_UnionBranch *)
{
@@ -788,6 +971,12 @@ UTL_Scope::fe_add_structure (AST_Structure *)
return 0;
}
+AST_StructureFwd *
+UTL_Scope::fe_add_structure_fwd (AST_StructureFwd *)
+{
+ return 0;
+}
+
AST_Field *
UTL_Scope::fe_add_field (AST_Field *)
{
@@ -968,7 +1157,7 @@ UTL_Scope::lookup_pseudo (Identifier *e)
|| ACE_OS::strcmp (name_string, "ValueBase") == 0)
{
// Iterate over the global scope.
- UTL_ScopeActiveIterator global_iter (idl_global->scopes ()->bottom (),
+ UTL_ScopeActiveIterator global_iter (idl_global->scopes ().bottom (),
UTL_Scope::IK_decls);
i = &global_iter;
@@ -1009,18 +1198,16 @@ UTL_Scope::lookup_pseudo (Identifier *e)
AST_Decl *
UTL_Scope::lookup_primitive_type (AST_Expression::ExprType et)
{
- AST_Decl *as_decl = 0;
- UTL_Scope *ancestor = 0;
- AST_PredefinedType *t = 0;
AST_PredefinedType::PredefinedType pdt;
- as_decl = ScopeAsDecl (this);
+ AST_Decl *as_decl = ScopeAsDecl (this);
if (as_decl == 0)
{
return 0;
}
- ancestor = as_decl->defined_in ();
+
+ UTL_Scope *ancestor = as_decl->defined_in ();
if (ancestor != 0)
{
@@ -1071,9 +1258,13 @@ UTL_Scope::lookup_primitive_type (AST_Expression::ExprType et)
case AST_Expression::EV_any:
pdt = AST_PredefinedType::PT_any;
break;
+ case AST_Expression::EV_object:
+ pdt = AST_PredefinedType::PT_object;
+ break;
case AST_Expression::EV_void:
pdt = AST_PredefinedType::PT_void;
break;
+ case AST_Expression::EV_enum:
case AST_Expression::EV_string:
case AST_Expression::EV_wstring:
case AST_Expression::EV_none:
@@ -1081,6 +1272,8 @@ UTL_Scope::lookup_primitive_type (AST_Expression::ExprType et)
return 0;
}
+ AST_PredefinedType *t = 0;
+
for (UTL_ScopeActiveIterator i (this, UTL_Scope::IK_decls);
!i.is_done();
i.next ())
@@ -1091,7 +1284,7 @@ UTL_Scope::lookup_primitive_type (AST_Expression::ExprType et)
{
t = AST_PredefinedType::narrow_from_decl (as_decl);
- if (t == NULL)
+ if (t == 0)
{
continue;
}
@@ -1237,10 +1430,14 @@ UTL_Scope::lookup_by_name_local (Identifier *e,
{
if (index == 0)
{
- // Special case for forward declared interfaces.
- // Look through the forward declaration and retrieve
- // the full definition.
- if (d->node_type () == AST_Decl::NT_interface_fwd)
+ AST_Decl::NodeType nt = d->node_type ();
+
+ // Special case for forward declared interfaces,
+ // In this case, we want to return
+ // the full definition member, whether defined yet or not
+ if (nt == AST_Decl::NT_interface_fwd
+ || nt == AST_Decl::NT_valuetype_fwd
+ || nt == AST_Decl::NT_component_fwd)
{
d = AST_InterfaceFwd::narrow_from_decl (d)->full_definition ();
}
@@ -1346,10 +1543,11 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
if (d == 0)
{
- // Special case for scope which is an interface. We have to look
- // in the inherited interfaces as well.
- // Look before parent scopes.
- if (pd_scope_node_type == AST_Decl::NT_interface)
+ // Special case for scope which is an interface or value type.
+ // We have to look in the inherited interfaces as well.
+ // Look before parent scopes.
+ if (pd_scope_node_type == AST_Decl::NT_interface
+ || pd_scope_node_type == AST_Decl::NT_valuetype)
{
d = look_in_inherited (e,
treat_as_ref);
@@ -1397,16 +1595,6 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
id = e->head ();
}
- // If we have stripped e to the last component, then
- // add it - the last component of a scoped name is
- // the only one that counts as a reference in a scope.
- if (id == e->last_component ())
- {
- add_to_referenced (d,
- I_FALSE,
- id);
- }
-
AST_Type *t = AST_Type::narrow_from_decl (d);
// Are we a type, rather than an identifier?
@@ -1420,15 +1608,23 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
if (s != 0)
{
AST_Decl *parent = ScopeAsDecl (s);
-
- // If the scope we are defined in is itself inside
- // an interface or valuetype, then we should also
- // be exported to the interface (or valuetype) scope.
- if (parent->node_type () == AST_Decl::NT_interface)
+ AST_Decl::NodeType nt = parent->node_type ();
+
+ // If the scope we are defined in is itself
+ // inside a module, then we should also
+ // be exported to the enclosing scope,
+ // recursive until we get to the enclosing
+ // module (or root) scope. (CORBA 2.6 3.15.3).
+ while (nt != AST_Decl::NT_module
+ && nt != AST_Decl::NT_root)
{
s->add_to_referenced (d,
I_FALSE,
d->local_name ());
+
+ s = parent->defined_in ();
+ parent = ScopeAsDecl (s);
+ nt = parent->node_type ();
}
}
}
@@ -1507,7 +1703,7 @@ UTL_Scope::add_to_referenced (AST_Decl *e,
// Special case for forward declared interfaces in the
// scope in which they're defined. Cannot add before full
// definition is seen.
- if (e->node_type() == AST_Decl::NT_interface)
+ if (e->node_type () == AST_Decl::NT_interface)
{
itf = AST_Interface::narrow_from_decl(e);
@@ -1652,8 +1848,8 @@ UTL_Scope::add_to_scope (AST_Decl *e,
return;
}
- AST_Decl **tmp = this->pd_referenced;
- long i = this->pd_referenced_used;
+ AST_Decl **tmp = this->pd_decls;
+ long i = this->pd_decls_used;
Identifier *decl_name = e->local_name ();
char *decl_string = decl_name->get_string ();
@@ -1666,46 +1862,19 @@ UTL_Scope::add_to_scope (AST_Decl *e,
// in this scope.
for (; i > 0; i--, tmp++)
{
- if ((*tmp)->defined_in () == this)
- {
- // A local declaration doesn't use a scoped name.
- ref_name = (*tmp)->local_name ();
- ref_string = ref_name->get_string ();
- }
- else
- {
- // If this item is merely referenced in this scope,
- // then only the top level of whatever scoped name
- // is used may clash with a local declaration.
- UTL_ScopedName *s = (*tmp)->name ();
-
- UTL_IdListActiveIterator iter (s);
-
- ref_name = iter.item ();
- ref_string = ref_name->get_string ();
-
- // Get the first non-null component of the scoped
- // nane that's not the global double colon.
- while (!ACE_OS::strcmp (ref_string, "")
- || !ACE_OS::strcmp (ref_string, "::"))
- {
- iter.next ();
- ref_name = iter.item ();
- ref_string = ref_name->get_string ();
- }
- }
+ // A local declaration doesn't use a scoped name.
+ ref_name = (*tmp)->local_name ();
+ ref_string = ref_name->get_string ();
- // If the names compare exactly, it's a redefinition
+ // If the names compare exactly, it's a redefini8tion
// error, unless they're both modules (which can be
// reopened) or we have a belated definition of a
// forward-declared interface.
- AST_Decl::NodeType nt = e->node_type ();
+ AST_Decl::NodeType new_nt = e->node_type ();
+ AST_Decl::NodeType scope_elem_nt = (*tmp)->node_type ();
if (decl_name->compare (ref_name) == I_TRUE
- && nt != AST_Decl::NT_module
- && nt != AST_Decl::NT_interface_fwd
- && ((*tmp)->node_type () != AST_Decl::NT_interface_fwd
- || nt != AST_Decl::NT_interface))
+ && this->redef_clash (new_nt, scope_elem_nt) == I_TRUE)
{
idl_global->err ()->redef_error (decl_string,
ref_string);
@@ -1864,14 +2033,16 @@ UTL_Scope::referenced (AST_Decl *e,
return I_TRUE;
}
- if ((*tmp)->node_type () == AST_Decl::NT_interface_fwd
- && e->node_type () == AST_Decl::NT_interface)
+ // Are we definging a forward declared struct, union, or interface,
+ // or reopening a module?
+ idl_bool forward_redef = this->redef_clash (e->node_type (),
+ (*tmp)->node_type ());
+
+ if (forward_redef == I_FALSE)
{
member = (*tmp)->local_name ();
test = e->local_name ();
- // If we're just defining a forward
- // declared interface, no need to go any further.
if (member->compare (test) == I_TRUE)
{
return I_FALSE;
@@ -2023,6 +2194,27 @@ UTL_Scope::nmembers (void)
void
UTL_Scope::destroy (void)
{
+ for (UTL_ScopeActiveIterator iter (this, IK_both);
+ !iter.is_done ();
+ iter.next ())
+ {
+ AST_Decl *i = iter.item ();
+ i->destroy ();
+ delete i;
+ i = 0;
+ }
+
+ delete [] this->pd_decls;
+ this->pd_decls = 0;
+
+ delete [] this->pd_local_types;
+ this->pd_local_types = 0;
+
+ delete [] this->pd_referenced;
+ this->pd_referenced = 0;
+
+ delete [] this->pd_name_referenced;
+ this->pd_name_referenced = 0;
}
// Narrowing.
@@ -2037,9 +2229,9 @@ UTL_ScopeActiveIterator::UTL_ScopeActiveIterator (
UTL_Scope::ScopeIterationKind i
)
: iter_source (s),
- ik(i),
- stage(i == UTL_Scope::IK_both ? UTL_Scope::IK_localtypes : i),
- il(0)
+ ik (i),
+ stage (i == UTL_Scope::IK_both ? UTL_Scope::IK_localtypes : i),
+ il (0)
{
}
diff --git a/TAO/TAO_IDL/util/utl_stack.cpp b/TAO/TAO_IDL/util/utl_stack.cpp
index 29f6dc49b26..26db4e8c209 100644
--- a/TAO/TAO_IDL/util/utl_stack.cpp
+++ b/TAO/TAO_IDL/util/utl_stack.cpp
@@ -62,48 +62,35 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
-/*
- * utl_stack.cc - Implementation of class UTL_ScopeStack
- */
-
-#include "idl.h"
-#include "ast_decl.h"
-#include "idl_extern.h"
-
-ACE_RCSID(util, utl_stack, "$Id$")
+#include "utl_stack.h"
+#include "utl_scope.h"
+#include "global_extern.h"
-// Class UTL_ScopeStack
+ACE_RCSID (util,
+ utl_stack,
+ "$Id$")
#undef INCREMENT
#define INCREMENT 64
-/*
- * Constructor(s) and destructor
- */
-
-UTL_ScopeStack::UTL_ScopeStack()
- : pd_stack_data(new UTL_Scope *[INCREMENT]),
- pd_stack_data_nalloced(INCREMENT),
- pd_stack_top(0)
+UTL_ScopeStack::UTL_ScopeStack (void)
+ : pd_stack_data_nalloced (INCREMENT),
+ pd_stack_top (0)
{
+ ACE_NEW (this->pd_stack_data,
+ UTL_Scope *[INCREMENT]);
}
-UTL_ScopeStack::~UTL_ScopeStack()
+UTL_ScopeStack::~UTL_ScopeStack (void)
{
- if (pd_stack_data != NULL)
- delete pd_stack_data;
+ if (this->pd_stack_data != 0)
+ {
+ delete this->pd_stack_data;
+ }
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
// Push an element on the stack.
UTL_ScopeStack *
UTL_ScopeStack::push (UTL_Scope *el)
@@ -112,7 +99,7 @@ UTL_ScopeStack::push (UTL_Scope *el)
long ostack_data_nalloced;
long i;
- // Make sure there's space for one more
+ // Make sure there's space for one more.
if (this->pd_stack_data_nalloced == this->pd_stack_top)
{
ostack_data_nalloced = this->pd_stack_data_nalloced;
@@ -158,115 +145,111 @@ UTL_ScopeStack::pop (void)
--this->pd_stack_top;
}
-// Return top element on stack
+// Return top element on stack.
UTL_Scope *
UTL_ScopeStack::top (void)
{
- if (pd_stack_top <= 0)
- return NULL;
- return pd_stack_data[pd_stack_top - 1];
+ if (this->pd_stack_top <= 0)
+ {
+ return 0;
+ }
+
+ return this->pd_stack_data[pd_stack_top - 1];
}
-// Return bottom element on stack
+// Return bottom element on stack.
UTL_Scope *
UTL_ScopeStack::bottom (void)
{
- if (pd_stack_top == 0)
- return NULL;
- return pd_stack_data[0];
+ if (this->pd_stack_top == 0)
+ {
+ return 0;
+ }
+
+ return this->pd_stack_data[0];
}
-// Clear entire stack
+// Clear entire stack.
void
UTL_ScopeStack::clear (void)
{
- pd_stack_top = 0;
+ this->pd_stack_top = 0;
}
// How deep is the stack?
unsigned long
UTL_ScopeStack::depth (void)
{
- return pd_stack_top;
+ return this->pd_stack_top;
}
-// Return (top - 1) element on stack
+// Return (top - 1) element on stack.
UTL_Scope *
UTL_ScopeStack::next_to_top (void)
{
UTL_Scope *tmp, *retval;
- if (depth() < 2)
- return NULL;
+ if (this->depth () < 2)
+ {
+ return 0;
+ }
- tmp = top(); // Save top
- (void) pop(); // Pop it
- retval = top(); // Get next one down
- (void) push(tmp); // Push top back
+ tmp = top (); // Save top
+ (void) pop (); // Pop it
+ retval = top (); // Get next one down
+ (void) push (tmp); // Push top back
return retval; // Return next one down
}
-// Return topmost non-NULL element
+// Return topmost non-NULL element.
UTL_Scope *
UTL_ScopeStack::top_non_null (void)
{
- long i;
+ for (long i = this->pd_stack_top - 1; i >= 0; --i)
+ {
+ if (this->pd_stack_data[i] != 0)
+ {
+ return this->pd_stack_data[i];
+ }
+ }
- for (i = pd_stack_top - 1; i >= 0; i--)
- if (pd_stack_data[i] != NULL)
- return pd_stack_data[i];
- return NULL;
+ return 0;
}
-/*
- * Redefinition of inherited virtual operations
- */
-
-// Class UTL_ScopeStackActiveIterator
-
-/*
- * Constructor(s)
- */
-
-UTL_ScopeStackActiveIterator::UTL_ScopeStackActiveIterator(UTL_ScopeStack *s)
- : source(s),
- il(s->pd_stack_top - 1)
+UTL_ScopeStackActiveIterator::UTL_ScopeStackActiveIterator (UTL_ScopeStack &s)
+ : source (s),
+ il (s.pd_stack_top - 1)
{
}
-/*
- * Private operations
- */
-
-/*
- * Public operations
- */
-
// Advance to next item
void
-UTL_ScopeStackActiveIterator::next()
+UTL_ScopeStackActiveIterator::next (void)
{
il--;
}
-// Get current item
+// Get current item.
UTL_Scope *
-UTL_ScopeStackActiveIterator::item()
+UTL_ScopeStackActiveIterator::item (void)
{
- if (il >= 0)
- return source->pd_stack_data[il];
- return NULL;
+ if (this->il >= 0)
+ {
+ return this->source.pd_stack_data[il];
+ }
+
+ return 0;
}
// Is this iteration done?
long
-UTL_ScopeStackActiveIterator::is_done()
+UTL_ScopeStackActiveIterator::is_done (void)
{
- if (il >= 0)
- return I_FALSE;
+ if (this->il >= 0)
+ {
+ return I_FALSE;
+ }
+
return I_TRUE;
}
-/*
- * Redefinition of inherited virtual operations
- */
diff --git a/TAO/TAO_IDL/util/utl_string.cpp b/TAO/TAO_IDL/util/utl_string.cpp
index b5a714dc421..2b23ce2face 100644
--- a/TAO/TAO_IDL/util/utl_string.cpp
+++ b/TAO/TAO_IDL/util/utl_string.cpp
@@ -64,17 +64,13 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
*/
-// utl_string.cc - Implementation of quick and dirty TEMPORARY String
-// for IDL compiler
+#include "utl_string.h"
+#include "global_extern.h"
+#include "utl_err.h"
-#include "idl.h"
-#include "idl_extern.h"
-
-ACE_RCSID(util, utl_string, "$Id$")
-
-/*
- * Constructors.
- */
+ACE_RCSID (util,
+ utl_string,
+ "$Id$")
UTL_String::UTL_String (void)
: p_str (0),
@@ -132,10 +128,6 @@ UTL_String::~UTL_String (void)
{
}
-/*
- * Private operations.
- */
-
// Compute a canonical form for this string. This is (implemented as)
// a corresponding string with all upper case characters where the
// original has lower case characters, identical characters otherwise.
@@ -157,12 +149,8 @@ UTL_String::canonicalize (void)
c_str[this->len] = '\0';
}
-/*
- * Public operations.
- */
-
// Compare two UTL_String *.
-long
+idl_bool
UTL_String::compare (UTL_String *s)
{
char *s_c_str;
@@ -180,9 +168,7 @@ UTL_String::compare (UTL_String *s)
(ACE_OS::strcmp (this->c_str, s_c_str) == 0) ? I_TRUE : I_FALSE;
}
- /*
- * Check that the names are typed consistently.
- */
+ // Check that the names are typed consistently.
if (result == I_TRUE
&& ACE_OS::strcmp (this->p_str, s->get_string ()) != 0)
{
@@ -268,10 +254,6 @@ UTL_String::get_canonical_rep (void)
return this->c_str;
}
-/*
- * Redefined virtual operations.
- */
-
// AST Dumping.
void
UTL_String::dump (ACE_OSTREAM_TYPE &o)
diff --git a/TAO/TAO_IDL/util/utl_strlist.cpp b/TAO/TAO_IDL/util/utl_strlist.cpp
index c7776e5cff3..c1e7cdaaf54 100644
--- a/TAO/TAO_IDL/util/utl_strlist.cpp
+++ b/TAO/TAO_IDL/util/utl_strlist.cpp
@@ -62,113 +62,132 @@ NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
- */
+*/
-// utl_strlist.cc
-//
-// Implementation of a list of utl_string nodes
+// Implementation of a list of utl_string nodes.
// NOTE: This list class only works correctly because we use single public
// inheritance, as opposed to multiple inheritance or public virtual.
-// It relies on a type-unsafe cast from UTL_List to subclasses, which
-// will cease to operate correctly if you use either multiple or
-// public virtual inheritance.
+// It relies on a type-unsafe cast from UTL_List to subclasses, which
+// will cease to operate correctly if you use either multiple or
+// public virtual inheritance.
-#include "idl.h"
-#include "idl_extern.h"
+#include "utl_strlist.h"
+#include "utl_string.h"
-ACE_RCSID(util, utl_strlist, "$Id$")
+ACE_RCSID (util,
+ utl_strlist,
+ "$Id$")
-// Constructor
-UTL_StrList::UTL_StrList(UTL_String *s, UTL_StrList *cdr)
- : UTL_List(cdr),
- pd_car_data(s)
+UTL_StrList::UTL_StrList (UTL_String *s,
+ UTL_StrList *cdr)
+ : UTL_List(cdr),
+ pd_car_data(s)
{
}
-// Destructor
UTL_StrList::~UTL_StrList (void)
{
}
-// Public operations
-
-// Get list item
+// Get list item.
UTL_String *
-UTL_StrList::head()
+UTL_StrList::head (void)
{
- return pd_car_data;
+ return this->pd_car_data;
}
-// Set list item
+// Set list item.
void
-UTL_StrList::set_head(UTL_String *s)
+UTL_StrList::set_head (UTL_String *s)
{
- pd_car_data = s;
+ this->pd_car_data = s;
}
// Get last item of this list
UTL_String *
-UTL_StrList::last_component()
+UTL_StrList::last_component (void)
{
- if (tail() == NULL)
- return pd_car_data;
- return ((UTL_StrList *) tail())->last_component();
+ if (this->tail () == 0)
+ {
+ return pd_car_data;
+ }
+
+ return ((UTL_StrList *) this->tail ())->last_component();
}
-// Copy a list
+// Copy a list.
UTL_List *
-UTL_StrList::copy()
+UTL_StrList::copy (void)
{
- if (tail() == NULL)
- return new UTL_StrList(head(), NULL);
- return new UTL_StrList(head(), (UTL_StrList *) tail()->copy());
+ UTL_List *retval = 0;
+
+ if (this->tail () == 0)
+ {
+ ACE_NEW_RETURN (retval,
+ UTL_StrList (head (),
+ 0),
+ 0);
+ }
+ else
+ {
+ ACE_NEW_RETURN (retval,
+ UTL_StrList (head (),
+ (UTL_StrList *) this->tail ()->copy ()),
+ 0);
+ }
+
+ return retval;
}
void
UTL_StrList::destroy (void)
{
UTL_String *str = 0;
- UTL_StrlistActiveIterator *i = 0;
- ACE_NEW (i,
- UTL_StrlistActiveIterator (this));
- while (!(i->is_done ()))
+ for (UTL_StrlistActiveIterator i (this); !i.is_done (); i.next ())
{
- str = i->item ();
+ str = i.item ();
str->destroy ();
delete str;
str = 0;
- i->next ();
}
-
- delete i;
}
// AST Dumping
void
-UTL_StrList::dump(ACE_OSTREAM_TYPE &o)
+UTL_StrList::dump (ACE_OSTREAM_TYPE &o)
{
- char *s;
- UTL_StrlistActiveIterator *i = new UTL_StrlistActiveIterator(this);
- idl_bool first = I_TRUE;
- idl_bool second = I_FALSE;
-
- while (!(i->is_done())) {
- if (!first)
- o << "::";
- else if (second)
- first = second = I_FALSE;
- s = i->item()->get_string();
- o << s;
- if (first) {
- if (strcmp(s, "::") != 0)
- first = I_FALSE;
- else
- second = I_TRUE;
+ char *s = 0;
+ idl_bool first = I_TRUE;
+ idl_bool second = I_FALSE;
+
+ for (UTL_StrlistActiveIterator i (this); !i.is_done(); i.next ())
+ {
+ if (!first)
+ {
+ o << "::";
+ }
+ else if (second)
+ {
+ first = second = I_FALSE;
+ }
+
+ s = i.item ()->get_string ();
+ o << s;
+
+ if (first)
+ {
+ if (ACE_OS::strcmp (s, "::") != 0)
+ {
+ first = I_FALSE;
+ }
+ else
+ {
+ second = I_TRUE;
+ }
+ }
}
- i->next();
- }
}
/*
@@ -181,8 +200,8 @@ UTL_StrList::dump(ACE_OSTREAM_TYPE &o)
* Constructor
*/
-UTL_StrlistActiveIterator::UTL_StrlistActiveIterator(UTL_StrList *s)
- : UTL_ListActiveIterator(s)
+UTL_StrlistActiveIterator::UTL_StrlistActiveIterator (UTL_StrList *s)
+ : UTL_ListActiveIterator (s)
{
}
@@ -196,11 +215,14 @@ UTL_StrlistActiveIterator::UTL_StrlistActiveIterator(UTL_StrList *s)
// Get current item
UTL_String *
-UTL_StrlistActiveIterator::item()
+UTL_StrlistActiveIterator::item (void)
{
- if (source == NULL)
- return NULL;
- return ((UTL_StrList *) source)->head();
+ if (source == 0)
+ {
+ return 0;
+ }
+
+ return ((UTL_StrList *) source)->head ();
}
/*
diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_idlist.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_idlist.cpp
index 229376234ba..becb6e8d3d1 100644
--- a/TAO/TAO_IDL/util/utl_tmpl/utl_idlist.cpp
+++ b/TAO/TAO_IDL/util/utl_tmpl/utl_idlist.cpp
@@ -80,35 +80,48 @@ UTL_IdList::UTL_IdList(Identifier *s, UTL_IdList *cdr)
// Get last item of this list
Identifier *
-UTL_IdList::last_component()
+UTL_IdList::last_component (void)
{
- if (tail() == NULL)
- return head();
- return tail()->last_component();
+ if (tail() == 0)
+ {
+ return head ();
+ }
+
+ return tail ()->last_component ();
}
// AST Dumping
void
-UTL_IdList::dump(ACE_OSTREAM_TYPE &o)
+UTL_IdList::dump (ACE_OSTREAM_TYPE &o)
{
- UTL_IdListActiveIterator *i = new UTL_IdListActiveIterator(this);
- long first = I_TRUE;
- long second = I_FALSE;
-
- while (!(i->is_done())) {
- if (!first)
- o << "::";
- else if (second)
- first = second = I_FALSE;
- i->item()->dump(o);
- if (first) {
- if (strcmp(i->item()->get_string(), "::") != 0)
- first = I_FALSE;
- else
- second = I_TRUE;
+ long first = I_TRUE;
+ long second = I_FALSE;
+
+ for (UTL_IdListActiveIterator (this); !i.is_done (); i.next ())
+ {
+ if (!first)
+ {
+ o << "::";
+ }
+ else if (second)
+ {
+ first = second = I_FALSE;
+ }
+
+ i.item ()->dump (o);
+
+ if (first)
+ {
+ if (ACE_OS::strcmp (i.item ()->get_string (), "::") != 0)
+ {
+ first = I_FALSE;
+ }
+ else
+ {
+ second = I_TRUE;
+ }
+ }
}
- i->next();
- }
}
/*
@@ -121,8 +134,8 @@ UTL_IdList::dump(ACE_OSTREAM_TYPE &o)
* Constructor
*/
-UTL_IdListActiveIterator::UTL_IdListActiveIterator(UTL_IdList *s)
- : UTL_ListActiveIterator<UTL_IdList, Identifier>(s)
+UTL_IdListActiveIterator::UTL_IdListActiveIterator (UTL_IdList *s)
+ : UTL_ListActiveIterator<UTL_IdList, Identifier> (s)
{
}
diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_strlist.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_strlist.cpp
index c9649d21b93..baeeb6b0f77 100644
--- a/TAO/TAO_IDL/util/utl_tmpl/utl_strlist.cpp
+++ b/TAO/TAO_IDL/util/utl_tmpl/utl_strlist.cpp
@@ -89,28 +89,39 @@ UTL_StrList::last_component()
// AST Dumping
void
-UTL_StrList::dump(ACE_OSTREAM_TYPE &o)
+UTL_StrList::dump (ACE_OSTREAM_TYPE &o)
{
- char *s;
- UTL_StrlistActiveIterator *i = new UTL_StrlistActiveIterator(this);
- long first = I_TRUE;
- long second = I_FALSE;
-
- while (!(i->is_done())) {
- if (!first)
- o << "::";
- else if (second)
- first = second = I_FALSE;
- s = i->item()->get_string();
- o << s;
- if (first) {
- if (strcmp(s, "::") != 0)
- first = I_FALSE;
- else
- second = I_TRUE;
+ char *s = 0;;
+ UTL_StrlistActiveIterator *i = new UTL_StrlistActiveIterator (this);
+ long first = I_TRUE;
+ long second = I_FALSE;
+
+ for (UTL_StrlistActiveIterator (this); !i.is_done(); i.next ())
+ {
+ if (!first)
+ {
+ o << "::";
+ }
+ else if (second)
+ {
+ first = second = I_FALSE;
+ }
+
+ s = i.item ()->get_string ();
+ o << s;
+
+ if (first)
+ {
+ if (ACE_OS::strcmp (s, "::") != 0)
+ {
+ first = I_FALSE;
+ }
+ else
+ {
+ second = I_TRUE;
+ }
+ }
}
- i->next();
- }
}
/*