summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/util
diff options
context:
space:
mode:
authorgokhale <asgokhale@users.noreply.github.com>1997-05-16 21:24:37 +0000
committergokhale <asgokhale@users.noreply.github.com>1997-05-16 21:24:37 +0000
commit88658235b6f416fb066fe88d9c0a9a61441b43a1 (patch)
tree1fd3171b644792ea0bfac396246004de5bc5f3be /TAO/TAO_IDL/util
parent266e72153f2bd2ba621584e68cb887c3bebb0f22 (diff)
downloadATCD-88658235b6f416fb066fe88d9c0a9a61441b43a1.tar.gz
TAO IDL Compiler: Helper functions
Diffstat (limited to 'TAO/TAO_IDL/util')
-rw-r--r--TAO/TAO_IDL/util/Makefile479
-rw-r--r--TAO/TAO_IDL/util/utl_decllist.cpp147
-rw-r--r--TAO/TAO_IDL/util/utl_err.cpp694
-rw-r--r--TAO/TAO_IDL/util/utl_error.cpp694
-rw-r--r--TAO/TAO_IDL/util/utl_exceptlist.cpp145
-rw-r--r--TAO/TAO_IDL/util/utl_exprlist.cpp145
-rw-r--r--TAO/TAO_IDL/util/utl_global.cpp466
-rw-r--r--TAO/TAO_IDL/util/utl_identifier.cpp114
-rw-r--r--TAO/TAO_IDL/util/utl_idlist.cpp187
-rw-r--r--TAO/TAO_IDL/util/utl_indenter.cpp123
-rw-r--r--TAO/TAO_IDL/util/utl_labellist.cpp145
-rw-r--r--TAO/TAO_IDL/util/utl_list.cpp197
-rw-r--r--TAO/TAO_IDL/util/utl_namelist.cpp145
-rw-r--r--TAO/TAO_IDL/util/utl_scope.cpp1190
-rw-r--r--TAO/TAO_IDL/util/utl_stack.cpp254
-rw-r--r--TAO/TAO_IDL/util/utl_string.cpp196
-rw-r--r--TAO/TAO_IDL/util/utl_strlist.cpp196
17 files changed, 5517 insertions, 0 deletions
diff --git a/TAO/TAO_IDL/util/Makefile b/TAO/TAO_IDL/util/Makefile
new file mode 100644
index 00000000000..e297ac70fdf
--- /dev/null
+++ b/TAO/TAO_IDL/util/Makefile
@@ -0,0 +1,479 @@
+#----------------------------------------------------------------------------
+# $Id$
+#
+# Makefile for libutil
+#----------------------------------------------------------------------------
+
+MAKEFILE = Makefile
+LIBNAME = libutil
+LIB = $(LIBNAME).a
+SHLIB = $(LIBNAME).so
+IDL_CFE_VERSION = \"1.3.0\"
+
+# These are components that are sources of
+
+UTIL_FILES = \
+ utl_scope \
+ utl_stack \
+ utl_string \
+ utl_decllist \
+ utl_labellist \
+ utl_namelist \
+ utl_exceptlist \
+ utl_strlist \
+ utl_list \
+ utl_exprlist \
+ utl_error \
+ utl_indenter \
+ utl_identifier \
+ utl_idlist \
+ utl_global
+
+FILES = $(UTIL_FILES)
+
+LSRC = $(addsuffix .cpp,$(FILES))
+LOBJ = $(addsuffix .o,$(FILES))
+SHOBJ = $(addsuffix .so,$(FILES))
+
+
+LDLIBS = -lutil
+LIBS = -lACE
+VLDLIBS = $(LDLIBS:%=%$(VAR))
+
+BUILD = $(VSHLIB) $(VLIB)
+
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(WRAPPER_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(WRAPPER_ROOT)/include/makeinclude/macros.GNU
+include $(WRAPPER_ROOT)/include/makeinclude/rules.common.GNU
+include $(WRAPPER_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(WRAPPER_ROOT)/include/makeinclude/rules.lib.GNU
+include $(WRAPPER_ROOT)/include/makeinclude/rules.bin.GNU
+include $(WRAPPER_ROOT)/include/makeinclude/rules.local.GNU
+
+#----------------------------------------------------------------------------
+# Local targets (and local hacks)
+#----------------------------------------------------------------------------
+
+CPPFLAGS += -I../include -I. -DCPP_LOCATION=\"$(CXX)\" -DIDL_CFE_VERSION=$(IDL_CFE_VERSION)
+
+$(LOBJS): $(LHDRS)
+
+#----------------------------------------------------------------------------
+# Dependencies
+#----------------------------------------------------------------------------
+
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+.obj/utl_scope.o .shobj/utl_scope.so: utl_scope.cpp ../include/idl.h ../include/intlmacros.h \
+ ../include/idl_narrow.h ../include/idl_defines.h ../include/idl_fwd.h \
+ ../include/idl_bool.h ../include/utl_string.h \
+ ../include/utl_identifier.h ../include/ast.h \
+ ../include/utl_scoped_name.h ../include/ast_decl.h \
+ ../include/ast_expression.h ../include/utl_scope.h \
+ ../include/ast_type.h ../include/ast_concrete_type.h \
+ ../include/ast_predefined_type.h ../include/ast_module.h \
+ ../include/ast_root.h ../include/ast_interface.h \
+ ../include/ast_interface_fwd.h ../include/ast_structure.h \
+ ../include/ast_exception.h ../include/ast_enum.h \
+ ../include/ast_operation.h ../include/utl_list.h \
+ ../include/ast_field.h ../include/ast_argument.h \
+ ../include/ast_attribute.h ../include/ast_union.h \
+ ../include/ast_union_branch.h ../include/ast_union_label.h \
+ ../include/ast_constant.h ../include/ast_enum_val.h \
+ ../include/ast_array.h ../include/ast_sequence.h \
+ ../include/ast_string.h ../include/ast_typedef.h \
+ ../include/utl_strlist.h ../include/utl_exprlist.h \
+ ../include/ast_generator.h ../include/util.h ../include/utl_stack.h \
+ ../include/utl_idlist.h ../include/utl_exceptlist.h \
+ ../include/utl_namelist.h ../include/utl_labellist.h \
+ ../include/utl_decllist.h ../include/idl_global.h \
+ ../include/utl_error.h ../include/utl_indenter.h \
+ ../include/idl_extern.h ../include/fe_extern.h ../include/be_extern.h \
+ ../include/drv_extern.h ../include/ast_extern.h \
+ ../include/nr_extern.h ../include/global_extern.h
+.obj/utl_stack.o .shobj/utl_stack.so: utl_stack.cpp ../include/idl.h ../include/intlmacros.h \
+ ../include/idl_narrow.h ../include/idl_defines.h ../include/idl_fwd.h \
+ ../include/idl_bool.h ../include/utl_string.h \
+ ../include/utl_identifier.h ../include/ast.h \
+ ../include/utl_scoped_name.h ../include/ast_decl.h \
+ ../include/ast_expression.h ../include/utl_scope.h \
+ ../include/ast_type.h ../include/ast_concrete_type.h \
+ ../include/ast_predefined_type.h ../include/ast_module.h \
+ ../include/ast_root.h ../include/ast_interface.h \
+ ../include/ast_interface_fwd.h ../include/ast_structure.h \
+ ../include/ast_exception.h ../include/ast_enum.h \
+ ../include/ast_operation.h ../include/utl_list.h \
+ ../include/ast_field.h ../include/ast_argument.h \
+ ../include/ast_attribute.h ../include/ast_union.h \
+ ../include/ast_union_branch.h ../include/ast_union_label.h \
+ ../include/ast_constant.h ../include/ast_enum_val.h \
+ ../include/ast_array.h ../include/ast_sequence.h \
+ ../include/ast_string.h ../include/ast_typedef.h \
+ ../include/utl_strlist.h ../include/utl_exprlist.h \
+ ../include/ast_generator.h ../include/util.h ../include/utl_stack.h \
+ ../include/utl_idlist.h ../include/utl_exceptlist.h \
+ ../include/utl_namelist.h ../include/utl_labellist.h \
+ ../include/utl_decllist.h ../include/idl_global.h \
+ ../include/utl_error.h ../include/utl_indenter.h \
+ ../include/idl_extern.h ../include/fe_extern.h ../include/be_extern.h \
+ ../include/drv_extern.h ../include/ast_extern.h \
+ ../include/nr_extern.h ../include/global_extern.h
+.obj/utl_string.o .shobj/utl_string.so: utl_string.cpp ../include/idl.h ../include/intlmacros.h \
+ ../include/idl_narrow.h ../include/idl_defines.h ../include/idl_fwd.h \
+ ../include/idl_bool.h ../include/utl_string.h \
+ ../include/utl_identifier.h ../include/ast.h \
+ ../include/utl_scoped_name.h ../include/ast_decl.h \
+ ../include/ast_expression.h ../include/utl_scope.h \
+ ../include/ast_type.h ../include/ast_concrete_type.h \
+ ../include/ast_predefined_type.h ../include/ast_module.h \
+ ../include/ast_root.h ../include/ast_interface.h \
+ ../include/ast_interface_fwd.h ../include/ast_structure.h \
+ ../include/ast_exception.h ../include/ast_enum.h \
+ ../include/ast_operation.h ../include/utl_list.h \
+ ../include/ast_field.h ../include/ast_argument.h \
+ ../include/ast_attribute.h ../include/ast_union.h \
+ ../include/ast_union_branch.h ../include/ast_union_label.h \
+ ../include/ast_constant.h ../include/ast_enum_val.h \
+ ../include/ast_array.h ../include/ast_sequence.h \
+ ../include/ast_string.h ../include/ast_typedef.h \
+ ../include/utl_strlist.h ../include/utl_exprlist.h \
+ ../include/ast_generator.h ../include/util.h ../include/utl_stack.h \
+ ../include/utl_idlist.h ../include/utl_exceptlist.h \
+ ../include/utl_namelist.h ../include/utl_labellist.h \
+ ../include/utl_decllist.h ../include/idl_global.h \
+ ../include/utl_error.h ../include/utl_indenter.h \
+ ../include/idl_extern.h ../include/fe_extern.h ../include/be_extern.h \
+ ../include/drv_extern.h ../include/ast_extern.h \
+ ../include/nr_extern.h ../include/global_extern.h
+.obj/utl_decllist.o .shobj/utl_decllist.so: utl_decllist.cpp ../include/idl.h \
+ ../include/intlmacros.h ../include/idl_narrow.h \
+ ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \
+ ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \
+ ../include/utl_scoped_name.h ../include/ast_decl.h \
+ ../include/ast_expression.h ../include/utl_scope.h \
+ ../include/ast_type.h ../include/ast_concrete_type.h \
+ ../include/ast_predefined_type.h ../include/ast_module.h \
+ ../include/ast_root.h ../include/ast_interface.h \
+ ../include/ast_interface_fwd.h ../include/ast_structure.h \
+ ../include/ast_exception.h ../include/ast_enum.h \
+ ../include/ast_operation.h ../include/utl_list.h \
+ ../include/ast_field.h ../include/ast_argument.h \
+ ../include/ast_attribute.h ../include/ast_union.h \
+ ../include/ast_union_branch.h ../include/ast_union_label.h \
+ ../include/ast_constant.h ../include/ast_enum_val.h \
+ ../include/ast_array.h ../include/ast_sequence.h \
+ ../include/ast_string.h ../include/ast_typedef.h \
+ ../include/utl_strlist.h ../include/utl_exprlist.h \
+ ../include/ast_generator.h ../include/util.h ../include/utl_stack.h \
+ ../include/utl_idlist.h ../include/utl_exceptlist.h \
+ ../include/utl_namelist.h ../include/utl_labellist.h \
+ ../include/utl_decllist.h ../include/idl_global.h \
+ ../include/utl_error.h ../include/utl_indenter.h \
+ ../include/idl_extern.h ../include/fe_extern.h ../include/be_extern.h \
+ ../include/drv_extern.h ../include/ast_extern.h \
+ ../include/nr_extern.h ../include/global_extern.h
+.obj/utl_labellist.o .shobj/utl_labellist.so: utl_labellist.cpp ../include/idl.h \
+ ../include/intlmacros.h ../include/idl_narrow.h \
+ ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \
+ ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \
+ ../include/utl_scoped_name.h ../include/ast_decl.h \
+ ../include/ast_expression.h ../include/utl_scope.h \
+ ../include/ast_type.h ../include/ast_concrete_type.h \
+ ../include/ast_predefined_type.h ../include/ast_module.h \
+ ../include/ast_root.h ../include/ast_interface.h \
+ ../include/ast_interface_fwd.h ../include/ast_structure.h \
+ ../include/ast_exception.h ../include/ast_enum.h \
+ ../include/ast_operation.h ../include/utl_list.h \
+ ../include/ast_field.h ../include/ast_argument.h \
+ ../include/ast_attribute.h ../include/ast_union.h \
+ ../include/ast_union_branch.h ../include/ast_union_label.h \
+ ../include/ast_constant.h ../include/ast_enum_val.h \
+ ../include/ast_array.h ../include/ast_sequence.h \
+ ../include/ast_string.h ../include/ast_typedef.h \
+ ../include/utl_strlist.h ../include/utl_exprlist.h \
+ ../include/ast_generator.h ../include/util.h ../include/utl_stack.h \
+ ../include/utl_idlist.h ../include/utl_exceptlist.h \
+ ../include/utl_namelist.h ../include/utl_labellist.h \
+ ../include/utl_decllist.h ../include/idl_global.h \
+ ../include/utl_error.h ../include/utl_indenter.h \
+ ../include/idl_extern.h ../include/fe_extern.h ../include/be_extern.h \
+ ../include/drv_extern.h ../include/ast_extern.h \
+ ../include/nr_extern.h ../include/global_extern.h
+.obj/utl_namelist.o .shobj/utl_namelist.so: utl_namelist.cpp ../include/idl.h \
+ ../include/intlmacros.h ../include/idl_narrow.h \
+ ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \
+ ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \
+ ../include/utl_scoped_name.h ../include/ast_decl.h \
+ ../include/ast_expression.h ../include/utl_scope.h \
+ ../include/ast_type.h ../include/ast_concrete_type.h \
+ ../include/ast_predefined_type.h ../include/ast_module.h \
+ ../include/ast_root.h ../include/ast_interface.h \
+ ../include/ast_interface_fwd.h ../include/ast_structure.h \
+ ../include/ast_exception.h ../include/ast_enum.h \
+ ../include/ast_operation.h ../include/utl_list.h \
+ ../include/ast_field.h ../include/ast_argument.h \
+ ../include/ast_attribute.h ../include/ast_union.h \
+ ../include/ast_union_branch.h ../include/ast_union_label.h \
+ ../include/ast_constant.h ../include/ast_enum_val.h \
+ ../include/ast_array.h ../include/ast_sequence.h \
+ ../include/ast_string.h ../include/ast_typedef.h \
+ ../include/utl_strlist.h ../include/utl_exprlist.h \
+ ../include/ast_generator.h ../include/util.h ../include/utl_stack.h \
+ ../include/utl_idlist.h ../include/utl_exceptlist.h \
+ ../include/utl_namelist.h ../include/utl_labellist.h \
+ ../include/utl_decllist.h ../include/idl_global.h \
+ ../include/utl_error.h ../include/utl_indenter.h \
+ ../include/idl_extern.h ../include/fe_extern.h ../include/be_extern.h \
+ ../include/drv_extern.h ../include/ast_extern.h \
+ ../include/nr_extern.h ../include/global_extern.h
+.obj/utl_exceptlist.o .shobj/utl_exceptlist.so: utl_exceptlist.cpp ../include/idl.h \
+ ../include/intlmacros.h ../include/idl_narrow.h \
+ ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \
+ ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \
+ ../include/utl_scoped_name.h ../include/ast_decl.h \
+ ../include/ast_expression.h ../include/utl_scope.h \
+ ../include/ast_type.h ../include/ast_concrete_type.h \
+ ../include/ast_predefined_type.h ../include/ast_module.h \
+ ../include/ast_root.h ../include/ast_interface.h \
+ ../include/ast_interface_fwd.h ../include/ast_structure.h \
+ ../include/ast_exception.h ../include/ast_enum.h \
+ ../include/ast_operation.h ../include/utl_list.h \
+ ../include/ast_field.h ../include/ast_argument.h \
+ ../include/ast_attribute.h ../include/ast_union.h \
+ ../include/ast_union_branch.h ../include/ast_union_label.h \
+ ../include/ast_constant.h ../include/ast_enum_val.h \
+ ../include/ast_array.h ../include/ast_sequence.h \
+ ../include/ast_string.h ../include/ast_typedef.h \
+ ../include/utl_strlist.h ../include/utl_exprlist.h \
+ ../include/ast_generator.h ../include/util.h ../include/utl_stack.h \
+ ../include/utl_idlist.h ../include/utl_exceptlist.h \
+ ../include/utl_namelist.h ../include/utl_labellist.h \
+ ../include/utl_decllist.h ../include/idl_global.h \
+ ../include/utl_error.h ../include/utl_indenter.h \
+ ../include/idl_extern.h ../include/fe_extern.h ../include/be_extern.h \
+ ../include/drv_extern.h ../include/ast_extern.h \
+ ../include/nr_extern.h ../include/global_extern.h
+.obj/utl_strlist.o .shobj/utl_strlist.so: utl_strlist.cpp ../include/idl.h \
+ ../include/intlmacros.h ../include/idl_narrow.h \
+ ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \
+ ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \
+ ../include/utl_scoped_name.h ../include/ast_decl.h \
+ ../include/ast_expression.h ../include/utl_scope.h \
+ ../include/ast_type.h ../include/ast_concrete_type.h \
+ ../include/ast_predefined_type.h ../include/ast_module.h \
+ ../include/ast_root.h ../include/ast_interface.h \
+ ../include/ast_interface_fwd.h ../include/ast_structure.h \
+ ../include/ast_exception.h ../include/ast_enum.h \
+ ../include/ast_operation.h ../include/utl_list.h \
+ ../include/ast_field.h ../include/ast_argument.h \
+ ../include/ast_attribute.h ../include/ast_union.h \
+ ../include/ast_union_branch.h ../include/ast_union_label.h \
+ ../include/ast_constant.h ../include/ast_enum_val.h \
+ ../include/ast_array.h ../include/ast_sequence.h \
+ ../include/ast_string.h ../include/ast_typedef.h \
+ ../include/utl_strlist.h ../include/utl_exprlist.h \
+ ../include/ast_generator.h ../include/util.h ../include/utl_stack.h \
+ ../include/utl_idlist.h ../include/utl_exceptlist.h \
+ ../include/utl_namelist.h ../include/utl_labellist.h \
+ ../include/utl_decllist.h ../include/idl_global.h \
+ ../include/utl_error.h ../include/utl_indenter.h \
+ ../include/idl_extern.h ../include/fe_extern.h ../include/be_extern.h \
+ ../include/drv_extern.h ../include/ast_extern.h \
+ ../include/nr_extern.h ../include/global_extern.h
+.obj/utl_list.o .shobj/utl_list.so: utl_list.cpp ../include/idl.h ../include/intlmacros.h \
+ ../include/idl_narrow.h ../include/idl_defines.h ../include/idl_fwd.h \
+ ../include/idl_bool.h ../include/utl_string.h \
+ ../include/utl_identifier.h ../include/ast.h \
+ ../include/utl_scoped_name.h ../include/ast_decl.h \
+ ../include/ast_expression.h ../include/utl_scope.h \
+ ../include/ast_type.h ../include/ast_concrete_type.h \
+ ../include/ast_predefined_type.h ../include/ast_module.h \
+ ../include/ast_root.h ../include/ast_interface.h \
+ ../include/ast_interface_fwd.h ../include/ast_structure.h \
+ ../include/ast_exception.h ../include/ast_enum.h \
+ ../include/ast_operation.h ../include/utl_list.h \
+ ../include/ast_field.h ../include/ast_argument.h \
+ ../include/ast_attribute.h ../include/ast_union.h \
+ ../include/ast_union_branch.h ../include/ast_union_label.h \
+ ../include/ast_constant.h ../include/ast_enum_val.h \
+ ../include/ast_array.h ../include/ast_sequence.h \
+ ../include/ast_string.h ../include/ast_typedef.h \
+ ../include/utl_strlist.h ../include/utl_exprlist.h \
+ ../include/ast_generator.h ../include/util.h ../include/utl_stack.h \
+ ../include/utl_idlist.h ../include/utl_exceptlist.h \
+ ../include/utl_namelist.h ../include/utl_labellist.h \
+ ../include/utl_decllist.h ../include/idl_global.h \
+ ../include/utl_error.h ../include/utl_indenter.h \
+ ../include/idl_extern.h ../include/fe_extern.h ../include/be_extern.h \
+ ../include/drv_extern.h ../include/ast_extern.h \
+ ../include/nr_extern.h ../include/global_extern.h
+.obj/utl_exprlist.o .shobj/utl_exprlist.so: utl_exprlist.cpp ../include/idl.h \
+ ../include/intlmacros.h ../include/idl_narrow.h \
+ ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \
+ ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \
+ ../include/utl_scoped_name.h ../include/ast_decl.h \
+ ../include/ast_expression.h ../include/utl_scope.h \
+ ../include/ast_type.h ../include/ast_concrete_type.h \
+ ../include/ast_predefined_type.h ../include/ast_module.h \
+ ../include/ast_root.h ../include/ast_interface.h \
+ ../include/ast_interface_fwd.h ../include/ast_structure.h \
+ ../include/ast_exception.h ../include/ast_enum.h \
+ ../include/ast_operation.h ../include/utl_list.h \
+ ../include/ast_field.h ../include/ast_argument.h \
+ ../include/ast_attribute.h ../include/ast_union.h \
+ ../include/ast_union_branch.h ../include/ast_union_label.h \
+ ../include/ast_constant.h ../include/ast_enum_val.h \
+ ../include/ast_array.h ../include/ast_sequence.h \
+ ../include/ast_string.h ../include/ast_typedef.h \
+ ../include/utl_strlist.h ../include/utl_exprlist.h \
+ ../include/ast_generator.h ../include/util.h ../include/utl_stack.h \
+ ../include/utl_idlist.h ../include/utl_exceptlist.h \
+ ../include/utl_namelist.h ../include/utl_labellist.h \
+ ../include/utl_decllist.h ../include/idl_global.h \
+ ../include/utl_error.h ../include/utl_indenter.h \
+ ../include/idl_extern.h ../include/fe_extern.h ../include/be_extern.h \
+ ../include/drv_extern.h ../include/ast_extern.h \
+ ../include/nr_extern.h ../include/global_extern.h
+.obj/utl_error.o .shobj/utl_error.so: utl_error.cpp ../include/idl.h ../include/intlmacros.h \
+ ../include/idl_narrow.h ../include/idl_defines.h ../include/idl_fwd.h \
+ ../include/idl_bool.h ../include/utl_string.h \
+ ../include/utl_identifier.h ../include/ast.h \
+ ../include/utl_scoped_name.h ../include/ast_decl.h \
+ ../include/ast_expression.h ../include/utl_scope.h \
+ ../include/ast_type.h ../include/ast_concrete_type.h \
+ ../include/ast_predefined_type.h ../include/ast_module.h \
+ ../include/ast_root.h ../include/ast_interface.h \
+ ../include/ast_interface_fwd.h ../include/ast_structure.h \
+ ../include/ast_exception.h ../include/ast_enum.h \
+ ../include/ast_operation.h ../include/utl_list.h \
+ ../include/ast_field.h ../include/ast_argument.h \
+ ../include/ast_attribute.h ../include/ast_union.h \
+ ../include/ast_union_branch.h ../include/ast_union_label.h \
+ ../include/ast_constant.h ../include/ast_enum_val.h \
+ ../include/ast_array.h ../include/ast_sequence.h \
+ ../include/ast_string.h ../include/ast_typedef.h \
+ ../include/utl_strlist.h ../include/utl_exprlist.h \
+ ../include/ast_generator.h ../include/util.h ../include/utl_stack.h \
+ ../include/utl_idlist.h ../include/utl_exceptlist.h \
+ ../include/utl_namelist.h ../include/utl_labellist.h \
+ ../include/utl_decllist.h ../include/idl_global.h \
+ ../include/utl_error.h ../include/utl_indenter.h \
+ ../include/idl_extern.h ../include/fe_extern.h ../include/be_extern.h \
+ ../include/drv_extern.h ../include/ast_extern.h \
+ ../include/nr_extern.h ../include/global_extern.h
+.obj/utl_indenter.o .shobj/utl_indenter.so: utl_indenter.cpp ../include/idl.h \
+ ../include/intlmacros.h ../include/idl_narrow.h \
+ ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \
+ ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \
+ ../include/utl_scoped_name.h ../include/ast_decl.h \
+ ../include/ast_expression.h ../include/utl_scope.h \
+ ../include/ast_type.h ../include/ast_concrete_type.h \
+ ../include/ast_predefined_type.h ../include/ast_module.h \
+ ../include/ast_root.h ../include/ast_interface.h \
+ ../include/ast_interface_fwd.h ../include/ast_structure.h \
+ ../include/ast_exception.h ../include/ast_enum.h \
+ ../include/ast_operation.h ../include/utl_list.h \
+ ../include/ast_field.h ../include/ast_argument.h \
+ ../include/ast_attribute.h ../include/ast_union.h \
+ ../include/ast_union_branch.h ../include/ast_union_label.h \
+ ../include/ast_constant.h ../include/ast_enum_val.h \
+ ../include/ast_array.h ../include/ast_sequence.h \
+ ../include/ast_string.h ../include/ast_typedef.h \
+ ../include/utl_strlist.h ../include/utl_exprlist.h \
+ ../include/ast_generator.h ../include/util.h ../include/utl_stack.h \
+ ../include/utl_idlist.h ../include/utl_exceptlist.h \
+ ../include/utl_namelist.h ../include/utl_labellist.h \
+ ../include/utl_decllist.h ../include/idl_global.h \
+ ../include/utl_error.h ../include/utl_indenter.h \
+ ../include/idl_extern.h ../include/fe_extern.h ../include/be_extern.h \
+ ../include/drv_extern.h ../include/ast_extern.h \
+ ../include/nr_extern.h ../include/global_extern.h
+.obj/utl_identifier.o .shobj/utl_identifier.so: utl_identifier.cpp ../include/idl.h \
+ ../include/intlmacros.h ../include/idl_narrow.h \
+ ../include/idl_defines.h ../include/idl_fwd.h ../include/idl_bool.h \
+ ../include/utl_string.h ../include/utl_identifier.h ../include/ast.h \
+ ../include/utl_scoped_name.h ../include/ast_decl.h \
+ ../include/ast_expression.h ../include/utl_scope.h \
+ ../include/ast_type.h ../include/ast_concrete_type.h \
+ ../include/ast_predefined_type.h ../include/ast_module.h \
+ ../include/ast_root.h ../include/ast_interface.h \
+ ../include/ast_interface_fwd.h ../include/ast_structure.h \
+ ../include/ast_exception.h ../include/ast_enum.h \
+ ../include/ast_operation.h ../include/utl_list.h \
+ ../include/ast_field.h ../include/ast_argument.h \
+ ../include/ast_attribute.h ../include/ast_union.h \
+ ../include/ast_union_branch.h ../include/ast_union_label.h \
+ ../include/ast_constant.h ../include/ast_enum_val.h \
+ ../include/ast_array.h ../include/ast_sequence.h \
+ ../include/ast_string.h ../include/ast_typedef.h \
+ ../include/utl_strlist.h ../include/utl_exprlist.h \
+ ../include/ast_generator.h ../include/util.h ../include/utl_stack.h \
+ ../include/utl_idlist.h ../include/utl_exceptlist.h \
+ ../include/utl_namelist.h ../include/utl_labellist.h \
+ ../include/utl_decllist.h ../include/idl_global.h \
+ ../include/utl_error.h ../include/utl_indenter.h \
+ ../include/idl_extern.h ../include/fe_extern.h ../include/be_extern.h \
+ ../include/drv_extern.h ../include/ast_extern.h \
+ ../include/nr_extern.h ../include/global_extern.h
+.obj/utl_idlist.o .shobj/utl_idlist.so: utl_idlist.cpp ../include/idl.h ../include/intlmacros.h \
+ ../include/idl_narrow.h ../include/idl_defines.h ../include/idl_fwd.h \
+ ../include/idl_bool.h ../include/utl_string.h \
+ ../include/utl_identifier.h ../include/ast.h \
+ ../include/utl_scoped_name.h ../include/ast_decl.h \
+ ../include/ast_expression.h ../include/utl_scope.h \
+ ../include/ast_type.h ../include/ast_concrete_type.h \
+ ../include/ast_predefined_type.h ../include/ast_module.h \
+ ../include/ast_root.h ../include/ast_interface.h \
+ ../include/ast_interface_fwd.h ../include/ast_structure.h \
+ ../include/ast_exception.h ../include/ast_enum.h \
+ ../include/ast_operation.h ../include/utl_list.h \
+ ../include/ast_field.h ../include/ast_argument.h \
+ ../include/ast_attribute.h ../include/ast_union.h \
+ ../include/ast_union_branch.h ../include/ast_union_label.h \
+ ../include/ast_constant.h ../include/ast_enum_val.h \
+ ../include/ast_array.h ../include/ast_sequence.h \
+ ../include/ast_string.h ../include/ast_typedef.h \
+ ../include/utl_strlist.h ../include/utl_exprlist.h \
+ ../include/ast_generator.h ../include/util.h ../include/utl_stack.h \
+ ../include/utl_idlist.h ../include/utl_exceptlist.h \
+ ../include/utl_namelist.h ../include/utl_labellist.h \
+ ../include/utl_decllist.h ../include/idl_global.h \
+ ../include/utl_error.h ../include/utl_indenter.h \
+ ../include/idl_extern.h ../include/fe_extern.h ../include/be_extern.h \
+ ../include/drv_extern.h ../include/ast_extern.h \
+ ../include/nr_extern.h ../include/global_extern.h
+.obj/utl_global.o .shobj/utl_global.so: utl_global.cpp ../include/idl.h ../include/intlmacros.h \
+ ../include/idl_narrow.h ../include/idl_defines.h ../include/idl_fwd.h \
+ ../include/idl_bool.h ../include/utl_string.h \
+ ../include/utl_identifier.h ../include/ast.h \
+ ../include/utl_scoped_name.h ../include/ast_decl.h \
+ ../include/ast_expression.h ../include/utl_scope.h \
+ ../include/ast_type.h ../include/ast_concrete_type.h \
+ ../include/ast_predefined_type.h ../include/ast_module.h \
+ ../include/ast_root.h ../include/ast_interface.h \
+ ../include/ast_interface_fwd.h ../include/ast_structure.h \
+ ../include/ast_exception.h ../include/ast_enum.h \
+ ../include/ast_operation.h ../include/utl_list.h \
+ ../include/ast_field.h ../include/ast_argument.h \
+ ../include/ast_attribute.h ../include/ast_union.h \
+ ../include/ast_union_branch.h ../include/ast_union_label.h \
+ ../include/ast_constant.h ../include/ast_enum_val.h \
+ ../include/ast_array.h ../include/ast_sequence.h \
+ ../include/ast_string.h ../include/ast_typedef.h \
+ ../include/utl_strlist.h ../include/utl_exprlist.h \
+ ../include/ast_generator.h ../include/util.h ../include/utl_stack.h \
+ ../include/utl_idlist.h ../include/utl_exceptlist.h \
+ ../include/utl_namelist.h ../include/utl_labellist.h \
+ ../include/utl_decllist.h ../include/idl_global.h \
+ ../include/utl_error.h ../include/utl_indenter.h \
+ ../include/idl_extern.h ../include/fe_extern.h ../include/be_extern.h \
+ ../include/drv_extern.h ../include/ast_extern.h \
+ ../include/nr_extern.h ../include/global_extern.h
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/TAO/TAO_IDL/util/utl_decllist.cpp b/TAO/TAO_IDL/util/utl_decllist.cpp
new file mode 100644
index 00000000000..39ffe61b9e0
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_decllist.cpp
@@ -0,0 +1,147 @@
+/*
+
+COPYRIGHT
+
+Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
+States of America. All Rights Reserved.
+
+This product is protected by copyright and distributed under the following
+license restricting its use.
+
+The Interface Definition Language Compiler Front End (CFE) is made
+available for your use provided that you include this license and copyright
+notice on all media and documentation and the software program in which
+this product is incorporated in whole or part. You may copy and extend
+functionality (but may not remove functionality) of the Interface
+Definition Language CFE without charge, but you are not authorized to
+license or distribute it to anyone else except as part of a product or
+program developed by you or with the express written consent of Sun
+Microsystems, Inc. ("Sun").
+
+The names of Sun Microsystems, Inc. and any of its subsidiaries or
+affiliates may not be used in advertising or publicity pertaining to
+distribution of Interface Definition Language CFE as permitted herein.
+
+This license is effective until terminated by Sun for failure to comply
+with this license. Upon termination, you shall destroy or return all code
+and documentation for the Interface Definition Language CFE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
+DEALING, USAGE OR TRADE PRACTICE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
+ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
+TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
+
+SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
+RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
+INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
+
+IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
+ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
+DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Use, duplication, or disclosure by the government is subject to
+restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
+Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
+52.227-19.
+
+Sun, Sun Microsystems and the Sun logo are trademarks or registered
+trademarks of Sun Microsystems, Inc.
+
+SunSoft, Inc.
+2550 Garcia Avenue
+Mountain View, California 94043
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+ */
+
+#pragma ident "%@(#)utl_decllist.cc 1.27% %92/06/10% Sun Microsystems"
+
+// utl_decllist.cc
+//
+// Implementation of a list of declarators
+
+// 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.
+//
+// For portability reasons we have decided to provide both this and
+// an implementation of the list classes in terms of templates. If
+// your compiler supports templates, please use the files in the
+// include/utl_tmpl and util/utl_tmpl directories instead of the
+// files by the same names in the include and util directories.
+
+#include "idl.h"
+#include "idl_extern.h"
+
+/*
+ * Constructor(s)
+ */
+
+UTL_DeclList::UTL_DeclList(FE_Declarator *s, UTL_DeclList *cdr)
+ : pd_car_data(s),
+ UTL_List(cdr)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Get list item
+FE_Declarator *
+UTL_DeclList::head()
+{
+ return pd_car_data;
+}
+
+/*
+ * Redefinition of inherited virtual operations
+ */
+
+// UTL_DeclList active iterator
+
+/*
+ * Constructor
+ */
+
+UTL_DecllistActiveIterator::UTL_DecllistActiveIterator(UTL_DeclList *s)
+ : UTL_ListActiveIterator(s)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Get current item
+FE_Declarator *
+UTL_DecllistActiveIterator::item()
+{
+ if (source == NULL)
+ return NULL;
+
+ return ((UTL_DeclList *) source)->head();
+}
+
+/*
+ * Redefined inherited operations
+ */
+
diff --git a/TAO/TAO_IDL/util/utl_err.cpp b/TAO/TAO_IDL/util/utl_err.cpp
new file mode 100644
index 00000000000..97fa27e713f
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_err.cpp
@@ -0,0 +1,694 @@
+/*
+
+COPYRIGHT
+
+Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
+States of America. All Rights Reserved.
+
+This product is protected by copyright and distributed under the following
+license restricting its use.
+
+The Interface Definition Language Compiler Front End (CFE) is made
+available for your use provided that you include this license and copyright
+notice on all media and documentation and the software program in which
+this product is incorporated in whole or part. You may copy and extend
+functionality (but may not remove functionality) of the Interface
+Definition Language CFE without charge, but you are not authorized to
+license or distribute it to anyone else except as part of a product or
+program developed by you or with the express written consent of Sun
+Microsystems, Inc. ("Sun").
+
+The names of Sun Microsystems, Inc. and any of its subsidiaries or
+affiliates may not be used in advertising or publicity pertaining to
+distribution of Interface Definition Language CFE as permitted herein.
+
+This license is effective until terminated by Sun for failure to comply
+with this license. Upon termination, you shall destroy or return all code
+and documentation for the Interface Definition Language CFE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
+DEALING, USAGE OR TRADE PRACTICE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
+ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
+TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
+
+SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
+RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
+INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
+
+IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
+ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
+DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Use, duplication, or disclosure by the government is subject to
+restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
+Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
+52.227-19.
+
+Sun, Sun Microsystems and the Sun logo are trademarks or registered
+trademarks of Sun Microsystems, Inc.
+
+SunSoft, Inc.
+2550 Garcia Avenue
+Mountain View, California 94043
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+ */
+
+#pragma ident "%@(#)utl_error.cc 1.18% %92/06/10% Sun Microsystems"
+
+// utl_error.cc - Implementation of error reporting object for IDL
+// compiler program
+
+#include "idl.h"
+#include "idl_extern.h"
+
+/*
+ * 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 char *
+static char *
+error_string(UTL_Error::ErrorCode c)
+{
+ switch (c) {
+ case UTL_Error::EIDL_OK:
+ return GTDEVEL("all is fine ");
+ case UTL_Error::EIDL_SYNTAX_ERROR:
+ return "";
+ case UTL_Error::EIDL_REDEF:
+ return GTDEVEL("illegal redefinition ");
+ case UTL_Error::EIDL_DEF_USE:
+ return GTDEVEL("redefinition after use, ");
+ case UTL_Error::EIDL_MULTIPLE_BRANCH:
+ return GTDEVEL("union with duplicate branch label ");
+ case UTL_Error::EIDL_COERCION_FAILURE:
+ return GTDEVEL("coercion failure ");
+ case UTL_Error::EIDL_SCOPE_CONFLICT:
+ return GTDEVEL("definition scope is different than fwd declare scope, ");
+ case UTL_Error::EIDL_ONEWAY_CONFLICT:
+ return GTDEVEL("oneway operation with OUT or INOUT parameters, ");
+ case UTL_Error::EIDL_DISC_TYPE:
+ return GTDEVEL("union with illegal discriminator type, ");
+ case UTL_Error::EIDL_LABEL_TYPE:
+ return GTDEVEL("label type incompatible with union discriminator type, ");
+ case UTL_Error::EIDL_ILLEGAL_ADD:
+ return GTDEVEL("illegal add operation, ");
+ case UTL_Error::EIDL_ILLEGAL_USE:
+ return GTDEVEL("illegal type used in expression, ");
+ case UTL_Error::EIDL_ILLEGAL_RAISES:
+ return GTDEVEL("error in raises(..) clause, ");
+ case UTL_Error::EIDL_ILLEGAL_CONTEXT:
+ return GTDEVEL("error in context(..) clause, ");
+ case UTL_Error::EIDL_CANT_INHERIT:
+ return GTDEVEL("cannot inherit from ");
+ case UTL_Error::EIDL_LOOKUP_ERROR:
+ return GTDEVEL("error in lookup of symbol: ");
+ case UTL_Error::EIDL_INHERIT_FWD_ERROR:
+ /* More intelligible message printed by error routine */
+ return "";
+ case UTL_Error::EIDL_CONSTANT_EXPECTED:
+ return GTDEVEL("constant expected: ");
+ case UTL_Error::EIDL_EVAL_ERROR:
+ return GTDEVEL("expression evaluation error: ");
+ case UTL_Error::EIDL_NAME_CASE_ERROR:
+ return GTDEVEL("identifier used with two differing spellings: ");
+ case UTL_Error::EIDL_ENUM_VAL_EXPECTED:
+ return GTDEVEL("enumerator expected: ");
+ case UTL_Error::EIDL_ENUM_VAL_NOT_FOUND:
+ return GTDEVEL("enumerator by this name not defined: ");
+ case UTL_Error::EIDL_AMBIGUOUS:
+ return GTDEVEL("ambiguous definition: ");
+ case UTL_Error::EIDL_DECL_NOT_DEFINED:
+ return GTDEVEL("forward declared but never defined: ");
+ case UTL_Error::EIDL_FWD_DECL_LOOKUP:
+ /* More intelligible message printed by error routine */
+ return "";
+ case UTL_Error::EIDL_RECURSIVE_TYPE:
+ return GTDEVEL("illegal recursive use of type: ");
+ case UTL_Error::EIDL_NONVOID_ONEWAY:
+ return GTDEVEL("non-void return type in oneway operation: ");
+ case UTL_Error::EIDL_REDEF_SCOPE:
+ return GTDEVEL("redefinition inside defining scope: ");
+ case UTL_Error::EIDL_NOT_A_TYPE:
+ return GTDEVEL("specified symbol is not a type: ");
+ case UTL_Error::EIDL_BACK_END:
+ return GTDEVEL("back end: ");
+ }
+}
+
+// Print out an error message header on cerr
+static void
+idl_error_header(UTL_Error::ErrorCode c, long lineno, String *s)
+{
+ cerr << idl_global->prog_name()
+ << ": \""
+ << (idl_global->read_from_stdin() ? "standard input" : s->get_string())
+ << GTDEVEL("\", line ")
+ << ((lineno == -1) ? idl_global->lineno() : lineno)
+ << ": "
+ << error_string(c);
+}
+
+// Convert the type of an AST_Expression to a char *
+static char *
+exprtype_to_string(AST_Expression::ExprType t)
+{
+ switch (t) {
+ case AST_Expression::EV_short:
+ return "short";
+ case AST_Expression::EV_ushort:
+ return "unsigned short";
+ case AST_Expression::EV_long:
+ return "long";
+ case AST_Expression::EV_ulong:
+ return "unsigned long";
+ case AST_Expression::EV_float:
+ return "float";
+ case AST_Expression::EV_double:
+ return "double";
+ case AST_Expression::EV_char:
+ return "char";
+ case AST_Expression::EV_octet:
+ return "octet";
+ case AST_Expression::EV_bool:
+ return "boolean";
+ case AST_Expression::EV_string:
+ return "string";
+ case AST_Expression::EV_any:
+ return "any";
+ case AST_Expression::EV_void:
+ return "void";
+ case AST_Expression::EV_none:
+ return "none";
+ }
+}
+
+/*
+ * Convert a parse state into a possible error message
+ */
+static char *
+parse_state_to_error_message(IDL_GlobalData::ParseState ps)
+{
+ switch (ps) {
+ case IDL_GlobalData::PS_NoState:
+ return GTDEVEL("Statement can not be parsed");
+ case IDL_GlobalData::PS_TypeDeclSeen:
+ return GTDEVEL("Malformed typedef declaration");
+ case IDL_GlobalData::PS_ConstDeclSeen:
+ return GTDEVEL("Malformed const declaration");
+ case IDL_GlobalData::PS_ExceptDeclSeen:
+ return
+ GTDEVEL("Malformed exception declaration");
+ case IDL_GlobalData::PS_InterfaceDeclSeen:
+ return
+ GTDEVEL("Malformed interface declaration");
+ case IDL_GlobalData::PS_ModuleDeclSeen:
+ return GTDEVEL("Malformed module declaration");
+ case IDL_GlobalData::PS_AttrDeclSeen:
+ return
+ GTDEVEL("Malformed attribute declaration");
+ case IDL_GlobalData::PS_OpDeclSeen:
+ return
+ GTDEVEL("Malformed operation declaration");
+ case IDL_GlobalData::PS_ModuleSeen:
+ return GTDEVEL("Missing module identifier following MODULE keyword");
+ case IDL_GlobalData::PS_ModuleIDSeen:
+ return GTDEVEL("Missing '{' or illegal syntax following module identifier");
+ case IDL_GlobalData::PS_ModuleSqSeen:
+ return GTDEVEL("Illegal syntax following module '{' opener");
+ case IDL_GlobalData::PS_ModuleQsSeen:
+ return GTDEVEL("Illegal syntax following module '}' closer");
+ case IDL_GlobalData::PS_ModuleBodySeen:
+ return GTDEVEL("Illegal syntax following module body statement(s)");
+ case IDL_GlobalData::PS_InterfaceSeen:
+ return GTDEVEL("Missing interface identifier following INTERFACE keyword");
+ case IDL_GlobalData::PS_InterfaceIDSeen:
+ return GTDEVEL("Illegal syntax following interface identifier");
+ case IDL_GlobalData::PS_InheritSpecSeen:
+ return GTDEVEL("Missing '{' or illegal syntax following inheritance spec");
+ case IDL_GlobalData::PS_ForwardDeclSeen:
+ return GTDEVEL("Missing ';' following forward interface declaration");
+ case IDL_GlobalData::PS_InterfaceSqSeen:
+ return GTDEVEL("Illegal syntax following interface '{' opener");
+ case IDL_GlobalData::PS_InterfaceQsSeen:
+ return GTDEVEL("Illegal syntax following interface '}' closer");
+ case IDL_GlobalData::PS_InterfaceBodySeen:
+ return GTDEVEL("Illegal syntax following interface body statement(s)");
+ case IDL_GlobalData::PS_InheritColonSeen:
+ return GTDEVEL("Illegal syntax following ':' starting inheritance list");
+ case IDL_GlobalData::PS_SNListCommaSeen:
+ return GTDEVEL("Found illegal scoped name in scoped name list");
+ case IDL_GlobalData::PS_ScopedNameSeen:
+ return GTDEVEL("Missing ',' following scoped name in scoped name list");
+ case IDL_GlobalData::PS_SN_IDSeen:
+ return GTDEVEL("Illegal component in scoped name");
+ case IDL_GlobalData::PS_ScopeDelimSeen:
+ return GTDEVEL("Illegal component in scoped name following '::'");
+ case IDL_GlobalData::PS_ConstSeen:
+ return GTDEVEL("Missing type or illegal syntax following CONST keyword");
+ case IDL_GlobalData::PS_ConstTypeSeen:
+ return GTDEVEL("Missing identifier or illegal syntax following const type");
+ case IDL_GlobalData::PS_ConstIDSeen:
+ return GTDEVEL("Missing '=' or illegal syntax after const identifier");
+ case IDL_GlobalData::PS_ConstAssignSeen:
+ return GTDEVEL("Missing value expr or illegal syntax following '='");
+ case IDL_GlobalData::PS_ConstExprSeen:
+ return GTDEVEL("Missing ';' or illegal syntax following value expr in const");
+ case IDL_GlobalData::PS_TypedefSeen:
+ return GTDEVEL("Missing type or illegal syntax following TYPEDEF keyword");
+ case IDL_GlobalData::PS_TypeSpecSeen:
+ return GTDEVEL("Missing declarators or illegal syntax following type spec");
+ case IDL_GlobalData::PS_DeclaratorsSeen:
+ return GTDEVEL("Illegal syntax following declarators in TYPEDEF declaration");
+ case IDL_GlobalData::PS_StructSeen:
+ return GTDEVEL("Missing struct identifier following STRUCT keyword");
+ case IDL_GlobalData::PS_StructIDSeen:
+ return GTDEVEL("Missing '{' or illegal syntax following struct identifier");
+ case IDL_GlobalData::PS_StructSqSeen:
+ return GTDEVEL("Illegal syntax following struct '{' opener");
+ case IDL_GlobalData::PS_StructQsSeen:
+ return GTDEVEL("Illegal syntax following struct '}' closer");
+ case IDL_GlobalData::PS_StructBodySeen:
+ return GTDEVEL("Illegal syntax following struct body statement(s)");
+ case IDL_GlobalData::PS_MemberTypeSeen:
+ return GTDEVEL("Illegal syntax of missing identifier following member type");
+ case IDL_GlobalData::PS_MemberDeclsSeen:
+ return GTDEVEL("Illegal syntax following member declarator(s)");
+ case IDL_GlobalData::PS_MemberDeclsCompleted:
+ return GTDEVEL("Missing ',' between member decls of same type(?)");
+ case IDL_GlobalData::PS_UnionSeen:
+ return GTDEVEL("Missing identifier following UNION keyword");
+ case IDL_GlobalData::PS_UnionIDSeen:
+ return GTDEVEL("Illegal syntax following union identifier");
+ case IDL_GlobalData::PS_SwitchSeen:
+ return GTDEVEL("Illegal syntax following SWITCH keyword");
+ case IDL_GlobalData::PS_SwitchOpenParSeen:
+ return GTDEVEL("Illegal syntax following '(' in switch in union");
+ case IDL_GlobalData::PS_SwitchTypeSeen:
+ return GTDEVEL("Illegal syntax following type decl in switch in union");
+ case IDL_GlobalData::PS_SwitchCloseParSeen:
+ return GTDEVEL("Missing union '{' opener");
+ case IDL_GlobalData::PS_UnionSqSeen:
+ return GTDEVEL("Illegal syntax following union '{' opener");
+ case IDL_GlobalData::PS_UnionQsSeen:
+ return GTDEVEL("Illegal syntax following union '}' closer");
+ case IDL_GlobalData::PS_DefaultSeen:
+ return GTDEVEL("Illegal syntax or missing ':' following DEFAULT keyword");
+ case IDL_GlobalData::PS_UnionLabelSeen:
+ return GTDEVEL("Illegal syntax following branch label in union");
+ case IDL_GlobalData::PS_LabelColonSeen:
+ return GTDEVEL("Illegal syntax following ':' in branch label in union");
+ case IDL_GlobalData::PS_LabelExprSeen:
+ return GTDEVEL("Illegal syntax following label expression in union");
+ case IDL_GlobalData::PS_UnionElemSeen:
+ case IDL_GlobalData::PS_UnionElemCompleted:
+ return GTDEVEL("Illegal syntax following union element");
+ case IDL_GlobalData::PS_CaseSeen:
+ return GTDEVEL("Illegal syntax following CASE keyword in union");
+ case IDL_GlobalData::PS_UnionElemTypeSeen:
+ return GTDEVEL("Illegal syntax following type decl in union element");
+ case IDL_GlobalData::PS_UnionElemDeclSeen:
+ return GTDEVEL("Illegal syntax following declarator in union element");
+ case IDL_GlobalData::PS_UnionBodySeen:
+ return GTDEVEL("Illegal syntax following union body statement(s)");
+ case IDL_GlobalData::PS_EnumSeen:
+ return GTDEVEL("Illegal syntax or missing identifier following ENUM keyword");
+ case IDL_GlobalData::PS_EnumIDSeen:
+ return GTDEVEL("Illegal syntax or missing '{' following enum identifier");
+ case IDL_GlobalData::PS_EnumSqSeen:
+ return GTDEVEL("Illegal syntax following enum '{' opener");
+ case IDL_GlobalData::PS_EnumQsSeen:
+ return GTDEVEL("Illegal syntax following enum '}' closer");
+ case IDL_GlobalData::PS_EnumBodySeen:
+ return GTDEVEL("Illegal syntax following enum body statement(s)");
+ case IDL_GlobalData::PS_EnumCommaSeen:
+ return GTDEVEL("Illegal syntax or missing identifier following ',' in enum");
+ case IDL_GlobalData::PS_SequenceSeen:
+ return GTDEVEL("Illegal syntax or missing '<' following SEQUENCE keyword");
+ case IDL_GlobalData::PS_SequenceSqSeen:
+ return GTDEVEL("Illegal syntax or missing type following '<' in sequence");
+ case IDL_GlobalData::PS_SequenceQsSeen:
+ return GTDEVEL("Illegal syntax following '>' in sequence");
+ case IDL_GlobalData::PS_SequenceTypeSeen:
+ return GTDEVEL("Illegal syntax following sequence type declaration");
+ case IDL_GlobalData::PS_SequenceCommaSeen:
+ return
+ GTDEVEL("Illegal syntax of missing size expr following ',' in sequence");
+ case IDL_GlobalData::PS_SequenceExprSeen:
+ return
+ GTDEVEL("Illegal syntax or missing '>' following size expr in sequence");
+ case IDL_GlobalData::PS_StringSeen:
+ return GTDEVEL("Illegal syntax or missing '<' following STRING keyword");
+ case IDL_GlobalData::PS_StringSqSeen:
+ return GTDEVEL("Illegal syntax or missing size expr following '<' in string");
+ case IDL_GlobalData::PS_StringQsSeen:
+ return GTDEVEL("Illegal syntax following '>' in string");
+ case IDL_GlobalData::PS_StringExprSeen:
+ return GTDEVEL("Illegal syntax or missing '>' after size expr in string");
+ case IDL_GlobalData::PS_StringCompleted:
+ return GTDEVEL("Illegal syntax after string declaration");
+ case IDL_GlobalData::PS_ArrayIDSeen:
+ return GTDEVEL("Illegal syntax or missing dimensions after array identifier");
+ case IDL_GlobalData::PS_ArrayCompleted:
+ return GTDEVEL("Illegal syntax after array declaration");
+ case IDL_GlobalData::PS_DimSqSeen:
+ return
+ GTDEVEL("Illegal syntax or missing size expr after '[' in array declaration");
+ case IDL_GlobalData::PS_DimQsSeen:
+ return GTDEVEL("Illegal syntax after ']' in array declaration");
+ case IDL_GlobalData::PS_DimExprSeen:
+ return
+ GTDEVEL("Illegal syntax or missing ']' after size expr in array declaration");
+ case IDL_GlobalData::PS_AttrROSeen:
+ return GTDEVEL("Illegal syntax after READONLY keyword");
+ case IDL_GlobalData::PS_AttrSeen:
+ return GTDEVEL("Illegal syntax after ATTRIBUTE keyword");
+ case IDL_GlobalData::PS_AttrTypeSeen:
+ return GTDEVEL("Illegal syntax after type in attribute declaration");
+ case IDL_GlobalData::PS_AttrDeclsSeen:
+ return GTDEVEL("Illegal syntax after attribute declarators");
+ case IDL_GlobalData::PS_AttrCompleted:
+ return GTDEVEL("Illegal syntax after attribute declaration");
+ case IDL_GlobalData::PS_ExceptSeen:
+ return
+ GTDEVEL("Illegal syntax or missing identifier after EXCEPTION keyword");
+ case IDL_GlobalData::PS_ExceptIDSeen:
+ return GTDEVEL("Illegal syntax or missing '{' after exception identifier");
+ case IDL_GlobalData::PS_ExceptSqSeen:
+ return GTDEVEL("Illegal syntax after exception '{' opener");
+ case IDL_GlobalData::PS_ExceptQsSeen:
+ return GTDEVEL("Illegal syntax after exception '}' closer");
+ case IDL_GlobalData::PS_ExceptBodySeen:
+ return GTDEVEL("Illegal syntax after exception body statement(s)");
+ case IDL_GlobalData::PS_OpAttrSeen:
+ return GTDEVEL("Illegal syntax or missing type after operation attribute");
+ case IDL_GlobalData::PS_OpTypeSeen:
+ return GTDEVEL("Illegal syntax or missing identifier after operation type");
+ case IDL_GlobalData::PS_OpIDSeen:
+ return GTDEVEL("Illegal syntax or missing '(' after operation identifier");
+ case IDL_GlobalData::PS_OpParsCompleted:
+ return GTDEVEL("Illegal syntax after operation parameter list");
+ case IDL_GlobalData::PS_OpRaiseCompleted:
+ return
+ GTDEVEL("Illegal syntax after optional RAISES in operation declaration");
+ case IDL_GlobalData::PS_OpContextCompleted:
+ return
+ GTDEVEL("Illegal syntax after optional CONTEXT in operation declaration");
+ case IDL_GlobalData::PS_OpCompleted:
+ return GTDEVEL("Illegal syntax after operation declaration");
+ case IDL_GlobalData::PS_OpSqSeen:
+ return GTDEVEL("Illegal syntax after operation parameter list '(' opener");
+ case IDL_GlobalData::PS_OpQsSeen:
+ return GTDEVEL("Illegal syntax after operation parameter list ')' closer");
+ case IDL_GlobalData::PS_OpParCommaSeen:
+ return
+ GTDEVEL("Illegal syntax or missing direction in parameter declaration");
+ case IDL_GlobalData::PS_OpParDirSeen:
+ return GTDEVEL("Illegal syntax or missing type in parameter declaration");
+ case IDL_GlobalData::PS_OpParTypeSeen:
+ return
+ GTDEVEL("Illegal syntax or missing declarator in parameter declaration");
+ case IDL_GlobalData::PS_OpParDeclSeen:
+ return GTDEVEL("Illegal syntax following parameter declarator");
+ case IDL_GlobalData::PS_OpRaiseSeen:
+ return GTDEVEL("Illegal syntax or missing '(' after RAISES keyword");
+ case IDL_GlobalData::PS_OpRaiseSqSeen:
+ return GTDEVEL("Illegal syntax after RAISES '(' opener");
+ case IDL_GlobalData::PS_OpRaiseQsSeen:
+ return GTDEVEL("Illegal syntax after RAISES ')' closer");
+ case IDL_GlobalData::PS_OpContextSeen:
+ return GTDEVEL("Illegal syntax or missing '(' after CONTEXT keyword");
+ case IDL_GlobalData::PS_OpContextSqSeen:
+ return GTDEVEL("Illegal syntax after CONTEXT '(' opener");
+ case IDL_GlobalData::PS_OpContextQsSeen:
+ return GTDEVEL("Illegal syntax after CONTEXT ')' closer");
+ case IDL_GlobalData::PS_OpContextCommaSeen:
+ return
+ GTDEVEL("Illegal syntax after ',' in CONTEXT in operation declaration");
+ case IDL_GlobalData::PS_DeclsCommaSeen:
+ return GTDEVEL("Illegal syntax after ',' in declarators list");
+ case IDL_GlobalData::PS_DeclsDeclSeen:
+ return GTDEVEL("Illegal syntax after declarator in declarators list");
+
+ default:
+ return GTDEVEL("Some syntax error");
+ }
+}
+/*
+ * Public methods
+ */
+
+// Report error messages with various numbers of arguments
+
+void
+UTL_Error::syntax_error(IDL_GlobalData::ParseState ps)
+{
+ idl_error_header(EIDL_SYNTAX_ERROR,
+ idl_global->lineno(),
+ idl_global->filename());
+ cerr << parse_state_to_error_message(ps) << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+void
+UTL_Error::error0(UTL_Error::ErrorCode c)
+{
+ idl_error_header(c, idl_global->lineno(), idl_global->filename());
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+void
+UTL_Error::error1(UTL_Error::ErrorCode c, AST_Decl *d)
+{
+ idl_error_header(c, d->line(), d->file_name());
+ d->name()->dump(cerr); cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+void
+UTL_Error::error2(UTL_Error::ErrorCode c, AST_Decl *d1, AST_Decl *d2)
+{
+ idl_error_header(c, d1->line(), d1->file_name());
+ d1->name()->dump(cerr); cerr << ", ";
+ d2->name()->dump(cerr); cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+void
+UTL_Error::error3(UTL_Error::ErrorCode c,
+ AST_Decl *d1,
+ AST_Decl *d2,
+ AST_Decl *d3)
+{
+ idl_error_header(c, d1->line(), d1->file_name());
+ d1->name()->dump(cerr); cerr << ", ";
+ d2->name()->dump(cerr); cerr << ", ";
+ d3->name()->dump(cerr); cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report a failed coercion attempt
+void
+UTL_Error::coercion_error(AST_Expression *v, AST_Expression::ExprType t)
+{
+ idl_error_header(EIDL_COERCION_FAILURE, v->line(), v->file_name());
+ v->dump(cerr);
+ cerr << GTDEVEL(" to ") << exprtype_to_string(t) << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report a failed name lookup attempt
+void
+UTL_Error::lookup_error(UTL_ScopedName *n)
+{
+ idl_error_header(EIDL_LOOKUP_ERROR,
+ idl_global->lineno(),
+ idl_global->filename());
+ n->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report an attempt to inherit from an interface which was only
+// declared forward but not yet defined
+void
+UTL_Error::inheritance_fwd_error(UTL_ScopedName *n, AST_Interface *f)
+{
+ idl_error_header(EIDL_INHERIT_FWD_ERROR, f->line(), f->file_name());
+ cerr << "interface ";
+ n->dump(cerr);
+ cerr << GTDEVEL(" cannot inherit from forward declared interface ");
+ f->local_name()->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report an attempt to inherit from something other than an interface
+void
+UTL_Error::inheritance_error(UTL_ScopedName *n, AST_Decl *d)
+{
+ idl_error_header(EIDL_CANT_INHERIT, d->line(), d->file_name());
+ cerr << " interface ";
+ n->dump(cerr);
+ cerr << GTDEVEL(" attempts to inherit from ");
+ d->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report an error while evaluating an expression
+void
+UTL_Error::eval_error(AST_Expression *v)
+{
+ idl_error_header(EIDL_EVAL_ERROR, v->line(), v->file_name());
+ v->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report a situation where a constant was expected but we
+// got something else. This may occur in a union when a label
+// evaluates to a non-constant
+void
+UTL_Error::constant_expected(UTL_ScopedName *n, AST_Decl *d)
+{
+ idl_error_header(EIDL_CONSTANT_EXPECTED, d->line(), d->file_name());
+ n->dump(cerr);
+ cerr << GTDEVEL(" bound to ");
+ d->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report a situation where an enumerator was expected but we
+// got something else. This may occur in a union with an enum
+// discriminator where a label did not evaluate to a constant
+// enumerator
+void
+UTL_Error::enum_val_expected(AST_Union *u, AST_UnionLabel *l)
+{
+ idl_error_header(EIDL_ENUM_VAL_EXPECTED, u->line(), u->file_name());
+ cerr << " union " << u->local_name()->get_string() << ", ";
+ l->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report a situation where an enumerator was received but we
+// could not find it (by name) in an enum. This occurs when
+// a union with an enum discriminator is being parsed, and a
+// label evaluates to an enumerator which is not a member of
+// the enum discriminator type
+void
+UTL_Error::enum_val_lookup_failure(AST_Union *u,
+ AST_Enum *e,
+ UTL_ScopedName *n)
+{
+ idl_error_header(EIDL_ENUM_VAL_NOT_FOUND, u->line(), u->file_name());
+ cerr << " union " << u->local_name()->get_string() << ", ";
+ cerr << " enum " << e->local_name()->get_string() << ", ";
+ cerr << " enumerator ";
+ n->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report two or more spellings for an identifier
+void
+UTL_Error::name_case_error(char *b, char *n)
+{
+ idl_error_header(EIDL_NAME_CASE_ERROR,
+ idl_global->lineno(),
+ idl_global->filename());
+ cerr << "\"" << b << GTDEVEL("\" and ") << "\"" << n << "\"\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report an ambiguous definition of a name
+void
+UTL_Error::ambiguous(UTL_Scope *s, AST_Decl *l, AST_Decl *d)
+{
+ idl_error_header(EIDL_AMBIGUOUS, d->line(), d->file_name());
+ cerr << GTDEVEL(" scope: ")
+ << (ScopeAsDecl(s))->local_name()->get_string()
+ << ", ";
+ cerr << GTDEVEL(" collision: ");
+ d->name()->dump(cerr);
+ cerr << " vs. ";
+ l->name()->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report a forward declared interface which was never defined
+void
+UTL_Error::fwd_decl_not_defined(AST_Interface *d)
+{
+ idl_error_header(EIDL_DECL_NOT_DEFINED, d->line(), d->file_name());
+ cerr << "interface ";
+ d->local_name()->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report lookup in undefined forward declared but undefined interface
+void
+UTL_Error::fwd_decl_lookup(AST_Interface *d, UTL_ScopedName *n)
+{
+ idl_error_header(EIDL_FWD_DECL_LOOKUP,
+ idl_global->lineno(),
+ idl_global->filename());
+ cerr << GTDEVEL("trying to look up ");
+ n->dump(cerr);
+ cerr << GTDEVEL(" in undefined forward declared interface ");
+ d->local_name()->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report a redefinition inside its own scope
+void
+UTL_Error::redefinition_in_scope(AST_Decl *d, AST_Decl *s)
+{
+ idl_error_header(EIDL_REDEF_SCOPE, d->line(), d->file_name());
+ d->name()->dump(cerr);
+ cerr << ", ";
+ s->name()->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report not a type error
+void
+UTL_Error::not_a_type(AST_Decl *d)
+{
+ idl_error_header(EIDL_NOT_A_TYPE,
+ idl_global->lineno(),
+ idl_global->filename());
+ if (d == NULL || d->name() == NULL)
+ cerr << GTDEVEL("unknown symbol");
+ else
+ d->name()->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+void
+UTL_Error::back_end(long lineno, String *s)
+{
+ idl_error_header(EIDL_BACK_END, lineno, s);
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
diff --git a/TAO/TAO_IDL/util/utl_error.cpp b/TAO/TAO_IDL/util/utl_error.cpp
new file mode 100644
index 00000000000..97fa27e713f
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_error.cpp
@@ -0,0 +1,694 @@
+/*
+
+COPYRIGHT
+
+Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
+States of America. All Rights Reserved.
+
+This product is protected by copyright and distributed under the following
+license restricting its use.
+
+The Interface Definition Language Compiler Front End (CFE) is made
+available for your use provided that you include this license and copyright
+notice on all media and documentation and the software program in which
+this product is incorporated in whole or part. You may copy and extend
+functionality (but may not remove functionality) of the Interface
+Definition Language CFE without charge, but you are not authorized to
+license or distribute it to anyone else except as part of a product or
+program developed by you or with the express written consent of Sun
+Microsystems, Inc. ("Sun").
+
+The names of Sun Microsystems, Inc. and any of its subsidiaries or
+affiliates may not be used in advertising or publicity pertaining to
+distribution of Interface Definition Language CFE as permitted herein.
+
+This license is effective until terminated by Sun for failure to comply
+with this license. Upon termination, you shall destroy or return all code
+and documentation for the Interface Definition Language CFE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
+DEALING, USAGE OR TRADE PRACTICE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
+ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
+TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
+
+SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
+RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
+INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
+
+IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
+ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
+DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Use, duplication, or disclosure by the government is subject to
+restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
+Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
+52.227-19.
+
+Sun, Sun Microsystems and the Sun logo are trademarks or registered
+trademarks of Sun Microsystems, Inc.
+
+SunSoft, Inc.
+2550 Garcia Avenue
+Mountain View, California 94043
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+ */
+
+#pragma ident "%@(#)utl_error.cc 1.18% %92/06/10% Sun Microsystems"
+
+// utl_error.cc - Implementation of error reporting object for IDL
+// compiler program
+
+#include "idl.h"
+#include "idl_extern.h"
+
+/*
+ * 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 char *
+static char *
+error_string(UTL_Error::ErrorCode c)
+{
+ switch (c) {
+ case UTL_Error::EIDL_OK:
+ return GTDEVEL("all is fine ");
+ case UTL_Error::EIDL_SYNTAX_ERROR:
+ return "";
+ case UTL_Error::EIDL_REDEF:
+ return GTDEVEL("illegal redefinition ");
+ case UTL_Error::EIDL_DEF_USE:
+ return GTDEVEL("redefinition after use, ");
+ case UTL_Error::EIDL_MULTIPLE_BRANCH:
+ return GTDEVEL("union with duplicate branch label ");
+ case UTL_Error::EIDL_COERCION_FAILURE:
+ return GTDEVEL("coercion failure ");
+ case UTL_Error::EIDL_SCOPE_CONFLICT:
+ return GTDEVEL("definition scope is different than fwd declare scope, ");
+ case UTL_Error::EIDL_ONEWAY_CONFLICT:
+ return GTDEVEL("oneway operation with OUT or INOUT parameters, ");
+ case UTL_Error::EIDL_DISC_TYPE:
+ return GTDEVEL("union with illegal discriminator type, ");
+ case UTL_Error::EIDL_LABEL_TYPE:
+ return GTDEVEL("label type incompatible with union discriminator type, ");
+ case UTL_Error::EIDL_ILLEGAL_ADD:
+ return GTDEVEL("illegal add operation, ");
+ case UTL_Error::EIDL_ILLEGAL_USE:
+ return GTDEVEL("illegal type used in expression, ");
+ case UTL_Error::EIDL_ILLEGAL_RAISES:
+ return GTDEVEL("error in raises(..) clause, ");
+ case UTL_Error::EIDL_ILLEGAL_CONTEXT:
+ return GTDEVEL("error in context(..) clause, ");
+ case UTL_Error::EIDL_CANT_INHERIT:
+ return GTDEVEL("cannot inherit from ");
+ case UTL_Error::EIDL_LOOKUP_ERROR:
+ return GTDEVEL("error in lookup of symbol: ");
+ case UTL_Error::EIDL_INHERIT_FWD_ERROR:
+ /* More intelligible message printed by error routine */
+ return "";
+ case UTL_Error::EIDL_CONSTANT_EXPECTED:
+ return GTDEVEL("constant expected: ");
+ case UTL_Error::EIDL_EVAL_ERROR:
+ return GTDEVEL("expression evaluation error: ");
+ case UTL_Error::EIDL_NAME_CASE_ERROR:
+ return GTDEVEL("identifier used with two differing spellings: ");
+ case UTL_Error::EIDL_ENUM_VAL_EXPECTED:
+ return GTDEVEL("enumerator expected: ");
+ case UTL_Error::EIDL_ENUM_VAL_NOT_FOUND:
+ return GTDEVEL("enumerator by this name not defined: ");
+ case UTL_Error::EIDL_AMBIGUOUS:
+ return GTDEVEL("ambiguous definition: ");
+ case UTL_Error::EIDL_DECL_NOT_DEFINED:
+ return GTDEVEL("forward declared but never defined: ");
+ case UTL_Error::EIDL_FWD_DECL_LOOKUP:
+ /* More intelligible message printed by error routine */
+ return "";
+ case UTL_Error::EIDL_RECURSIVE_TYPE:
+ return GTDEVEL("illegal recursive use of type: ");
+ case UTL_Error::EIDL_NONVOID_ONEWAY:
+ return GTDEVEL("non-void return type in oneway operation: ");
+ case UTL_Error::EIDL_REDEF_SCOPE:
+ return GTDEVEL("redefinition inside defining scope: ");
+ case UTL_Error::EIDL_NOT_A_TYPE:
+ return GTDEVEL("specified symbol is not a type: ");
+ case UTL_Error::EIDL_BACK_END:
+ return GTDEVEL("back end: ");
+ }
+}
+
+// Print out an error message header on cerr
+static void
+idl_error_header(UTL_Error::ErrorCode c, long lineno, String *s)
+{
+ cerr << idl_global->prog_name()
+ << ": \""
+ << (idl_global->read_from_stdin() ? "standard input" : s->get_string())
+ << GTDEVEL("\", line ")
+ << ((lineno == -1) ? idl_global->lineno() : lineno)
+ << ": "
+ << error_string(c);
+}
+
+// Convert the type of an AST_Expression to a char *
+static char *
+exprtype_to_string(AST_Expression::ExprType t)
+{
+ switch (t) {
+ case AST_Expression::EV_short:
+ return "short";
+ case AST_Expression::EV_ushort:
+ return "unsigned short";
+ case AST_Expression::EV_long:
+ return "long";
+ case AST_Expression::EV_ulong:
+ return "unsigned long";
+ case AST_Expression::EV_float:
+ return "float";
+ case AST_Expression::EV_double:
+ return "double";
+ case AST_Expression::EV_char:
+ return "char";
+ case AST_Expression::EV_octet:
+ return "octet";
+ case AST_Expression::EV_bool:
+ return "boolean";
+ case AST_Expression::EV_string:
+ return "string";
+ case AST_Expression::EV_any:
+ return "any";
+ case AST_Expression::EV_void:
+ return "void";
+ case AST_Expression::EV_none:
+ return "none";
+ }
+}
+
+/*
+ * Convert a parse state into a possible error message
+ */
+static char *
+parse_state_to_error_message(IDL_GlobalData::ParseState ps)
+{
+ switch (ps) {
+ case IDL_GlobalData::PS_NoState:
+ return GTDEVEL("Statement can not be parsed");
+ case IDL_GlobalData::PS_TypeDeclSeen:
+ return GTDEVEL("Malformed typedef declaration");
+ case IDL_GlobalData::PS_ConstDeclSeen:
+ return GTDEVEL("Malformed const declaration");
+ case IDL_GlobalData::PS_ExceptDeclSeen:
+ return
+ GTDEVEL("Malformed exception declaration");
+ case IDL_GlobalData::PS_InterfaceDeclSeen:
+ return
+ GTDEVEL("Malformed interface declaration");
+ case IDL_GlobalData::PS_ModuleDeclSeen:
+ return GTDEVEL("Malformed module declaration");
+ case IDL_GlobalData::PS_AttrDeclSeen:
+ return
+ GTDEVEL("Malformed attribute declaration");
+ case IDL_GlobalData::PS_OpDeclSeen:
+ return
+ GTDEVEL("Malformed operation declaration");
+ case IDL_GlobalData::PS_ModuleSeen:
+ return GTDEVEL("Missing module identifier following MODULE keyword");
+ case IDL_GlobalData::PS_ModuleIDSeen:
+ return GTDEVEL("Missing '{' or illegal syntax following module identifier");
+ case IDL_GlobalData::PS_ModuleSqSeen:
+ return GTDEVEL("Illegal syntax following module '{' opener");
+ case IDL_GlobalData::PS_ModuleQsSeen:
+ return GTDEVEL("Illegal syntax following module '}' closer");
+ case IDL_GlobalData::PS_ModuleBodySeen:
+ return GTDEVEL("Illegal syntax following module body statement(s)");
+ case IDL_GlobalData::PS_InterfaceSeen:
+ return GTDEVEL("Missing interface identifier following INTERFACE keyword");
+ case IDL_GlobalData::PS_InterfaceIDSeen:
+ return GTDEVEL("Illegal syntax following interface identifier");
+ case IDL_GlobalData::PS_InheritSpecSeen:
+ return GTDEVEL("Missing '{' or illegal syntax following inheritance spec");
+ case IDL_GlobalData::PS_ForwardDeclSeen:
+ return GTDEVEL("Missing ';' following forward interface declaration");
+ case IDL_GlobalData::PS_InterfaceSqSeen:
+ return GTDEVEL("Illegal syntax following interface '{' opener");
+ case IDL_GlobalData::PS_InterfaceQsSeen:
+ return GTDEVEL("Illegal syntax following interface '}' closer");
+ case IDL_GlobalData::PS_InterfaceBodySeen:
+ return GTDEVEL("Illegal syntax following interface body statement(s)");
+ case IDL_GlobalData::PS_InheritColonSeen:
+ return GTDEVEL("Illegal syntax following ':' starting inheritance list");
+ case IDL_GlobalData::PS_SNListCommaSeen:
+ return GTDEVEL("Found illegal scoped name in scoped name list");
+ case IDL_GlobalData::PS_ScopedNameSeen:
+ return GTDEVEL("Missing ',' following scoped name in scoped name list");
+ case IDL_GlobalData::PS_SN_IDSeen:
+ return GTDEVEL("Illegal component in scoped name");
+ case IDL_GlobalData::PS_ScopeDelimSeen:
+ return GTDEVEL("Illegal component in scoped name following '::'");
+ case IDL_GlobalData::PS_ConstSeen:
+ return GTDEVEL("Missing type or illegal syntax following CONST keyword");
+ case IDL_GlobalData::PS_ConstTypeSeen:
+ return GTDEVEL("Missing identifier or illegal syntax following const type");
+ case IDL_GlobalData::PS_ConstIDSeen:
+ return GTDEVEL("Missing '=' or illegal syntax after const identifier");
+ case IDL_GlobalData::PS_ConstAssignSeen:
+ return GTDEVEL("Missing value expr or illegal syntax following '='");
+ case IDL_GlobalData::PS_ConstExprSeen:
+ return GTDEVEL("Missing ';' or illegal syntax following value expr in const");
+ case IDL_GlobalData::PS_TypedefSeen:
+ return GTDEVEL("Missing type or illegal syntax following TYPEDEF keyword");
+ case IDL_GlobalData::PS_TypeSpecSeen:
+ return GTDEVEL("Missing declarators or illegal syntax following type spec");
+ case IDL_GlobalData::PS_DeclaratorsSeen:
+ return GTDEVEL("Illegal syntax following declarators in TYPEDEF declaration");
+ case IDL_GlobalData::PS_StructSeen:
+ return GTDEVEL("Missing struct identifier following STRUCT keyword");
+ case IDL_GlobalData::PS_StructIDSeen:
+ return GTDEVEL("Missing '{' or illegal syntax following struct identifier");
+ case IDL_GlobalData::PS_StructSqSeen:
+ return GTDEVEL("Illegal syntax following struct '{' opener");
+ case IDL_GlobalData::PS_StructQsSeen:
+ return GTDEVEL("Illegal syntax following struct '}' closer");
+ case IDL_GlobalData::PS_StructBodySeen:
+ return GTDEVEL("Illegal syntax following struct body statement(s)");
+ case IDL_GlobalData::PS_MemberTypeSeen:
+ return GTDEVEL("Illegal syntax of missing identifier following member type");
+ case IDL_GlobalData::PS_MemberDeclsSeen:
+ return GTDEVEL("Illegal syntax following member declarator(s)");
+ case IDL_GlobalData::PS_MemberDeclsCompleted:
+ return GTDEVEL("Missing ',' between member decls of same type(?)");
+ case IDL_GlobalData::PS_UnionSeen:
+ return GTDEVEL("Missing identifier following UNION keyword");
+ case IDL_GlobalData::PS_UnionIDSeen:
+ return GTDEVEL("Illegal syntax following union identifier");
+ case IDL_GlobalData::PS_SwitchSeen:
+ return GTDEVEL("Illegal syntax following SWITCH keyword");
+ case IDL_GlobalData::PS_SwitchOpenParSeen:
+ return GTDEVEL("Illegal syntax following '(' in switch in union");
+ case IDL_GlobalData::PS_SwitchTypeSeen:
+ return GTDEVEL("Illegal syntax following type decl in switch in union");
+ case IDL_GlobalData::PS_SwitchCloseParSeen:
+ return GTDEVEL("Missing union '{' opener");
+ case IDL_GlobalData::PS_UnionSqSeen:
+ return GTDEVEL("Illegal syntax following union '{' opener");
+ case IDL_GlobalData::PS_UnionQsSeen:
+ return GTDEVEL("Illegal syntax following union '}' closer");
+ case IDL_GlobalData::PS_DefaultSeen:
+ return GTDEVEL("Illegal syntax or missing ':' following DEFAULT keyword");
+ case IDL_GlobalData::PS_UnionLabelSeen:
+ return GTDEVEL("Illegal syntax following branch label in union");
+ case IDL_GlobalData::PS_LabelColonSeen:
+ return GTDEVEL("Illegal syntax following ':' in branch label in union");
+ case IDL_GlobalData::PS_LabelExprSeen:
+ return GTDEVEL("Illegal syntax following label expression in union");
+ case IDL_GlobalData::PS_UnionElemSeen:
+ case IDL_GlobalData::PS_UnionElemCompleted:
+ return GTDEVEL("Illegal syntax following union element");
+ case IDL_GlobalData::PS_CaseSeen:
+ return GTDEVEL("Illegal syntax following CASE keyword in union");
+ case IDL_GlobalData::PS_UnionElemTypeSeen:
+ return GTDEVEL("Illegal syntax following type decl in union element");
+ case IDL_GlobalData::PS_UnionElemDeclSeen:
+ return GTDEVEL("Illegal syntax following declarator in union element");
+ case IDL_GlobalData::PS_UnionBodySeen:
+ return GTDEVEL("Illegal syntax following union body statement(s)");
+ case IDL_GlobalData::PS_EnumSeen:
+ return GTDEVEL("Illegal syntax or missing identifier following ENUM keyword");
+ case IDL_GlobalData::PS_EnumIDSeen:
+ return GTDEVEL("Illegal syntax or missing '{' following enum identifier");
+ case IDL_GlobalData::PS_EnumSqSeen:
+ return GTDEVEL("Illegal syntax following enum '{' opener");
+ case IDL_GlobalData::PS_EnumQsSeen:
+ return GTDEVEL("Illegal syntax following enum '}' closer");
+ case IDL_GlobalData::PS_EnumBodySeen:
+ return GTDEVEL("Illegal syntax following enum body statement(s)");
+ case IDL_GlobalData::PS_EnumCommaSeen:
+ return GTDEVEL("Illegal syntax or missing identifier following ',' in enum");
+ case IDL_GlobalData::PS_SequenceSeen:
+ return GTDEVEL("Illegal syntax or missing '<' following SEQUENCE keyword");
+ case IDL_GlobalData::PS_SequenceSqSeen:
+ return GTDEVEL("Illegal syntax or missing type following '<' in sequence");
+ case IDL_GlobalData::PS_SequenceQsSeen:
+ return GTDEVEL("Illegal syntax following '>' in sequence");
+ case IDL_GlobalData::PS_SequenceTypeSeen:
+ return GTDEVEL("Illegal syntax following sequence type declaration");
+ case IDL_GlobalData::PS_SequenceCommaSeen:
+ return
+ GTDEVEL("Illegal syntax of missing size expr following ',' in sequence");
+ case IDL_GlobalData::PS_SequenceExprSeen:
+ return
+ GTDEVEL("Illegal syntax or missing '>' following size expr in sequence");
+ case IDL_GlobalData::PS_StringSeen:
+ return GTDEVEL("Illegal syntax or missing '<' following STRING keyword");
+ case IDL_GlobalData::PS_StringSqSeen:
+ return GTDEVEL("Illegal syntax or missing size expr following '<' in string");
+ case IDL_GlobalData::PS_StringQsSeen:
+ return GTDEVEL("Illegal syntax following '>' in string");
+ case IDL_GlobalData::PS_StringExprSeen:
+ return GTDEVEL("Illegal syntax or missing '>' after size expr in string");
+ case IDL_GlobalData::PS_StringCompleted:
+ return GTDEVEL("Illegal syntax after string declaration");
+ case IDL_GlobalData::PS_ArrayIDSeen:
+ return GTDEVEL("Illegal syntax or missing dimensions after array identifier");
+ case IDL_GlobalData::PS_ArrayCompleted:
+ return GTDEVEL("Illegal syntax after array declaration");
+ case IDL_GlobalData::PS_DimSqSeen:
+ return
+ GTDEVEL("Illegal syntax or missing size expr after '[' in array declaration");
+ case IDL_GlobalData::PS_DimQsSeen:
+ return GTDEVEL("Illegal syntax after ']' in array declaration");
+ case IDL_GlobalData::PS_DimExprSeen:
+ return
+ GTDEVEL("Illegal syntax or missing ']' after size expr in array declaration");
+ case IDL_GlobalData::PS_AttrROSeen:
+ return GTDEVEL("Illegal syntax after READONLY keyword");
+ case IDL_GlobalData::PS_AttrSeen:
+ return GTDEVEL("Illegal syntax after ATTRIBUTE keyword");
+ case IDL_GlobalData::PS_AttrTypeSeen:
+ return GTDEVEL("Illegal syntax after type in attribute declaration");
+ case IDL_GlobalData::PS_AttrDeclsSeen:
+ return GTDEVEL("Illegal syntax after attribute declarators");
+ case IDL_GlobalData::PS_AttrCompleted:
+ return GTDEVEL("Illegal syntax after attribute declaration");
+ case IDL_GlobalData::PS_ExceptSeen:
+ return
+ GTDEVEL("Illegal syntax or missing identifier after EXCEPTION keyword");
+ case IDL_GlobalData::PS_ExceptIDSeen:
+ return GTDEVEL("Illegal syntax or missing '{' after exception identifier");
+ case IDL_GlobalData::PS_ExceptSqSeen:
+ return GTDEVEL("Illegal syntax after exception '{' opener");
+ case IDL_GlobalData::PS_ExceptQsSeen:
+ return GTDEVEL("Illegal syntax after exception '}' closer");
+ case IDL_GlobalData::PS_ExceptBodySeen:
+ return GTDEVEL("Illegal syntax after exception body statement(s)");
+ case IDL_GlobalData::PS_OpAttrSeen:
+ return GTDEVEL("Illegal syntax or missing type after operation attribute");
+ case IDL_GlobalData::PS_OpTypeSeen:
+ return GTDEVEL("Illegal syntax or missing identifier after operation type");
+ case IDL_GlobalData::PS_OpIDSeen:
+ return GTDEVEL("Illegal syntax or missing '(' after operation identifier");
+ case IDL_GlobalData::PS_OpParsCompleted:
+ return GTDEVEL("Illegal syntax after operation parameter list");
+ case IDL_GlobalData::PS_OpRaiseCompleted:
+ return
+ GTDEVEL("Illegal syntax after optional RAISES in operation declaration");
+ case IDL_GlobalData::PS_OpContextCompleted:
+ return
+ GTDEVEL("Illegal syntax after optional CONTEXT in operation declaration");
+ case IDL_GlobalData::PS_OpCompleted:
+ return GTDEVEL("Illegal syntax after operation declaration");
+ case IDL_GlobalData::PS_OpSqSeen:
+ return GTDEVEL("Illegal syntax after operation parameter list '(' opener");
+ case IDL_GlobalData::PS_OpQsSeen:
+ return GTDEVEL("Illegal syntax after operation parameter list ')' closer");
+ case IDL_GlobalData::PS_OpParCommaSeen:
+ return
+ GTDEVEL("Illegal syntax or missing direction in parameter declaration");
+ case IDL_GlobalData::PS_OpParDirSeen:
+ return GTDEVEL("Illegal syntax or missing type in parameter declaration");
+ case IDL_GlobalData::PS_OpParTypeSeen:
+ return
+ GTDEVEL("Illegal syntax or missing declarator in parameter declaration");
+ case IDL_GlobalData::PS_OpParDeclSeen:
+ return GTDEVEL("Illegal syntax following parameter declarator");
+ case IDL_GlobalData::PS_OpRaiseSeen:
+ return GTDEVEL("Illegal syntax or missing '(' after RAISES keyword");
+ case IDL_GlobalData::PS_OpRaiseSqSeen:
+ return GTDEVEL("Illegal syntax after RAISES '(' opener");
+ case IDL_GlobalData::PS_OpRaiseQsSeen:
+ return GTDEVEL("Illegal syntax after RAISES ')' closer");
+ case IDL_GlobalData::PS_OpContextSeen:
+ return GTDEVEL("Illegal syntax or missing '(' after CONTEXT keyword");
+ case IDL_GlobalData::PS_OpContextSqSeen:
+ return GTDEVEL("Illegal syntax after CONTEXT '(' opener");
+ case IDL_GlobalData::PS_OpContextQsSeen:
+ return GTDEVEL("Illegal syntax after CONTEXT ')' closer");
+ case IDL_GlobalData::PS_OpContextCommaSeen:
+ return
+ GTDEVEL("Illegal syntax after ',' in CONTEXT in operation declaration");
+ case IDL_GlobalData::PS_DeclsCommaSeen:
+ return GTDEVEL("Illegal syntax after ',' in declarators list");
+ case IDL_GlobalData::PS_DeclsDeclSeen:
+ return GTDEVEL("Illegal syntax after declarator in declarators list");
+
+ default:
+ return GTDEVEL("Some syntax error");
+ }
+}
+/*
+ * Public methods
+ */
+
+// Report error messages with various numbers of arguments
+
+void
+UTL_Error::syntax_error(IDL_GlobalData::ParseState ps)
+{
+ idl_error_header(EIDL_SYNTAX_ERROR,
+ idl_global->lineno(),
+ idl_global->filename());
+ cerr << parse_state_to_error_message(ps) << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+void
+UTL_Error::error0(UTL_Error::ErrorCode c)
+{
+ idl_error_header(c, idl_global->lineno(), idl_global->filename());
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+void
+UTL_Error::error1(UTL_Error::ErrorCode c, AST_Decl *d)
+{
+ idl_error_header(c, d->line(), d->file_name());
+ d->name()->dump(cerr); cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+void
+UTL_Error::error2(UTL_Error::ErrorCode c, AST_Decl *d1, AST_Decl *d2)
+{
+ idl_error_header(c, d1->line(), d1->file_name());
+ d1->name()->dump(cerr); cerr << ", ";
+ d2->name()->dump(cerr); cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+void
+UTL_Error::error3(UTL_Error::ErrorCode c,
+ AST_Decl *d1,
+ AST_Decl *d2,
+ AST_Decl *d3)
+{
+ idl_error_header(c, d1->line(), d1->file_name());
+ d1->name()->dump(cerr); cerr << ", ";
+ d2->name()->dump(cerr); cerr << ", ";
+ d3->name()->dump(cerr); cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report a failed coercion attempt
+void
+UTL_Error::coercion_error(AST_Expression *v, AST_Expression::ExprType t)
+{
+ idl_error_header(EIDL_COERCION_FAILURE, v->line(), v->file_name());
+ v->dump(cerr);
+ cerr << GTDEVEL(" to ") << exprtype_to_string(t) << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report a failed name lookup attempt
+void
+UTL_Error::lookup_error(UTL_ScopedName *n)
+{
+ idl_error_header(EIDL_LOOKUP_ERROR,
+ idl_global->lineno(),
+ idl_global->filename());
+ n->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report an attempt to inherit from an interface which was only
+// declared forward but not yet defined
+void
+UTL_Error::inheritance_fwd_error(UTL_ScopedName *n, AST_Interface *f)
+{
+ idl_error_header(EIDL_INHERIT_FWD_ERROR, f->line(), f->file_name());
+ cerr << "interface ";
+ n->dump(cerr);
+ cerr << GTDEVEL(" cannot inherit from forward declared interface ");
+ f->local_name()->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report an attempt to inherit from something other than an interface
+void
+UTL_Error::inheritance_error(UTL_ScopedName *n, AST_Decl *d)
+{
+ idl_error_header(EIDL_CANT_INHERIT, d->line(), d->file_name());
+ cerr << " interface ";
+ n->dump(cerr);
+ cerr << GTDEVEL(" attempts to inherit from ");
+ d->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report an error while evaluating an expression
+void
+UTL_Error::eval_error(AST_Expression *v)
+{
+ idl_error_header(EIDL_EVAL_ERROR, v->line(), v->file_name());
+ v->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report a situation where a constant was expected but we
+// got something else. This may occur in a union when a label
+// evaluates to a non-constant
+void
+UTL_Error::constant_expected(UTL_ScopedName *n, AST_Decl *d)
+{
+ idl_error_header(EIDL_CONSTANT_EXPECTED, d->line(), d->file_name());
+ n->dump(cerr);
+ cerr << GTDEVEL(" bound to ");
+ d->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report a situation where an enumerator was expected but we
+// got something else. This may occur in a union with an enum
+// discriminator where a label did not evaluate to a constant
+// enumerator
+void
+UTL_Error::enum_val_expected(AST_Union *u, AST_UnionLabel *l)
+{
+ idl_error_header(EIDL_ENUM_VAL_EXPECTED, u->line(), u->file_name());
+ cerr << " union " << u->local_name()->get_string() << ", ";
+ l->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report a situation where an enumerator was received but we
+// could not find it (by name) in an enum. This occurs when
+// a union with an enum discriminator is being parsed, and a
+// label evaluates to an enumerator which is not a member of
+// the enum discriminator type
+void
+UTL_Error::enum_val_lookup_failure(AST_Union *u,
+ AST_Enum *e,
+ UTL_ScopedName *n)
+{
+ idl_error_header(EIDL_ENUM_VAL_NOT_FOUND, u->line(), u->file_name());
+ cerr << " union " << u->local_name()->get_string() << ", ";
+ cerr << " enum " << e->local_name()->get_string() << ", ";
+ cerr << " enumerator ";
+ n->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report two or more spellings for an identifier
+void
+UTL_Error::name_case_error(char *b, char *n)
+{
+ idl_error_header(EIDL_NAME_CASE_ERROR,
+ idl_global->lineno(),
+ idl_global->filename());
+ cerr << "\"" << b << GTDEVEL("\" and ") << "\"" << n << "\"\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report an ambiguous definition of a name
+void
+UTL_Error::ambiguous(UTL_Scope *s, AST_Decl *l, AST_Decl *d)
+{
+ idl_error_header(EIDL_AMBIGUOUS, d->line(), d->file_name());
+ cerr << GTDEVEL(" scope: ")
+ << (ScopeAsDecl(s))->local_name()->get_string()
+ << ", ";
+ cerr << GTDEVEL(" collision: ");
+ d->name()->dump(cerr);
+ cerr << " vs. ";
+ l->name()->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report a forward declared interface which was never defined
+void
+UTL_Error::fwd_decl_not_defined(AST_Interface *d)
+{
+ idl_error_header(EIDL_DECL_NOT_DEFINED, d->line(), d->file_name());
+ cerr << "interface ";
+ d->local_name()->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report lookup in undefined forward declared but undefined interface
+void
+UTL_Error::fwd_decl_lookup(AST_Interface *d, UTL_ScopedName *n)
+{
+ idl_error_header(EIDL_FWD_DECL_LOOKUP,
+ idl_global->lineno(),
+ idl_global->filename());
+ cerr << GTDEVEL("trying to look up ");
+ n->dump(cerr);
+ cerr << GTDEVEL(" in undefined forward declared interface ");
+ d->local_name()->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report a redefinition inside its own scope
+void
+UTL_Error::redefinition_in_scope(AST_Decl *d, AST_Decl *s)
+{
+ idl_error_header(EIDL_REDEF_SCOPE, d->line(), d->file_name());
+ d->name()->dump(cerr);
+ cerr << ", ";
+ s->name()->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+// Report not a type error
+void
+UTL_Error::not_a_type(AST_Decl *d)
+{
+ idl_error_header(EIDL_NOT_A_TYPE,
+ idl_global->lineno(),
+ idl_global->filename());
+ if (d == NULL || d->name() == NULL)
+ cerr << GTDEVEL("unknown symbol");
+ else
+ d->name()->dump(cerr);
+ cerr << "\n";
+ idl_global->set_err_count(idl_global->err_count() + 1);
+}
+
+void
+UTL_Error::back_end(long lineno, String *s)
+{
+ idl_error_header(EIDL_BACK_END, 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
new file mode 100644
index 00000000000..3c07d880883
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_exceptlist.cpp
@@ -0,0 +1,145 @@
+/*
+
+COPYRIGHT
+
+Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
+States of America. All Rights Reserved.
+
+This product is protected by copyright and distributed under the following
+license restricting its use.
+
+The Interface Definition Language Compiler Front End (CFE) is made
+available for your use provided that you include this license and copyright
+notice on all media and documentation and the software program in which
+this product is incorporated in whole or part. You may copy and extend
+functionality (but may not remove functionality) of the Interface
+Definition Language CFE without charge, but you are not authorized to
+license or distribute it to anyone else except as part of a product or
+program developed by you or with the express written consent of Sun
+Microsystems, Inc. ("Sun").
+
+The names of Sun Microsystems, Inc. and any of its subsidiaries or
+affiliates may not be used in advertising or publicity pertaining to
+distribution of Interface Definition Language CFE as permitted herein.
+
+This license is effective until terminated by Sun for failure to comply
+with this license. Upon termination, you shall destroy or return all code
+and documentation for the Interface Definition Language CFE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
+DEALING, USAGE OR TRADE PRACTICE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
+ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
+TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
+
+SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
+RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
+INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
+
+IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
+ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
+DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Use, duplication, or disclosure by the government is subject to
+restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
+Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
+52.227-19.
+
+Sun, Sun Microsystems and the Sun logo are trademarks or registered
+trademarks of Sun Microsystems, Inc.
+
+SunSoft, Inc.
+2550 Garcia Avenue
+Mountain View, California 94043
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+ */
+
+#pragma ident "%@(#)utl_exceptlist.cc 1.33% %92/06/10% Sun Microsystems"
+
+// utl_exceptlist.cc
+//
+// Implementation of a list of exceptions
+
+// 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.
+//
+// For portability reasons we have decided to provide both this and
+// an implementation of the list classes in terms of templates. If
+// your compiler supports templates, please use the files in the
+// include/utl_tmpl and util/utl_tmpl directories instead of the
+// files by the same names in the include and util directories.
+
+#include "idl.h"
+#include "idl_extern.h"
+
+/*
+ * Constructor(s)
+ */
+
+UTL_ExceptList::UTL_ExceptList(AST_Exception *s, UTL_ExceptList *cdr)
+ : pd_car_data(s),
+ UTL_List(cdr)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Get list item
+AST_Exception *
+UTL_ExceptList::head()
+{
+ return pd_car_data;
+}
+
+/*
+ * Redefinition of inherited virtual operations
+ */
+
+// UTL_ExceptList active iterator
+
+/*
+ * Constructor
+ */
+
+UTL_ExceptlistActiveIterator::UTL_ExceptlistActiveIterator(UTL_ExceptList *s)
+ : UTL_ListActiveIterator(s)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Get current item
+AST_Exception *
+UTL_ExceptlistActiveIterator::item()
+{
+ if (source == NULL)
+ return NULL;
+ 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
new file mode 100644
index 00000000000..cefe2750a09
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_exprlist.cpp
@@ -0,0 +1,145 @@
+/*
+
+COPYRIGHT
+
+Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
+States of America. All Rights Reserved.
+
+This product is protected by copyright and distributed under the following
+license restricting its use.
+
+The Interface Definition Language Compiler Front End (CFE) is made
+available for your use provided that you include this license and copyright
+notice on all media and documentation and the software program in which
+this product is incorporated in whole or part. You may copy and extend
+functionality (but may not remove functionality) of the Interface
+Definition Language CFE without charge, but you are not authorized to
+license or distribute it to anyone else except as part of a product or
+program developed by you or with the express written consent of Sun
+Microsystems, Inc. ("Sun").
+
+The names of Sun Microsystems, Inc. and any of its subsidiaries or
+affiliates may not be used in advertising or publicity pertaining to
+distribution of Interface Definition Language CFE as permitted herein.
+
+This license is effective until terminated by Sun for failure to comply
+with this license. Upon termination, you shall destroy or return all code
+and documentation for the Interface Definition Language CFE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
+DEALING, USAGE OR TRADE PRACTICE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
+ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
+TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
+
+SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
+RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
+INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
+
+IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
+ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
+DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Use, duplication, or disclosure by the government is subject to
+restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
+Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
+52.227-19.
+
+Sun, Sun Microsystems and the Sun logo are trademarks or registered
+trademarks of Sun Microsystems, Inc.
+
+SunSoft, Inc.
+2550 Garcia Avenue
+Mountain View, California 94043
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+ */
+
+#pragma ident "%@(#)utl_exprlist.cc 1.33% %92/06/10% Sun Microsystems"
+
+// utl_exprlist.cc
+//
+// Implementation of a list of strings
+
+// 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.
+//
+// For portability reasons we have decided to provide both this and
+// an implementation of the list classes in terms of templates. If
+// your compiler supports templates, please use the files in the
+// include/utl_tmpl and util/utl_tmpl directories instead of the
+// files by the same names in the include and util directories.
+
+#include "idl.h"
+#include "idl_extern.h"
+
+/*
+ * Constructor(s)
+ */
+
+UTL_ExprList::UTL_ExprList(AST_Expression *s, UTL_ExprList *cdr)
+ : pd_car_data(s),
+ UTL_List(cdr)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Get list item
+AST_Expression *
+UTL_ExprList::head()
+{
+ return pd_car_data;
+}
+
+/*
+ * Redefinition of inherited virtual operations
+ */
+
+// UTL_ExprList active iterator
+
+/*
+ * Constructor
+ */
+
+UTL_ExprlistActiveIterator::UTL_ExprlistActiveIterator(UTL_ExprList *s)
+ : UTL_ListActiveIterator(s)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Get current item
+AST_Expression *
+UTL_ExprlistActiveIterator::item()
+{
+ if (source == NULL)
+ return NULL;
+ 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
new file mode 100644
index 00000000000..f7632e3bc68
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_global.cpp
@@ -0,0 +1,466 @@
+/*
+
+COPYRIGHT
+
+Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
+States of America. All Rights Reserved.
+
+This product is protected by copyright and distributed under the following
+license restricting its use.
+
+The Interface Definition Language Compiler Front End (CFE) is made
+available for your use provided that you include this license and copyright
+notice on all media and documentation and the software program in which
+this product is incorporated in whole or part. You may copy and extend
+functionality (but may not remove functionality) of the Interface
+Definition Language CFE without charge, but you are not authorized to
+license or distribute it to anyone else except as part of a product or
+program developed by you or with the express written consent of Sun
+Microsystems, Inc. ("Sun").
+
+The names of Sun Microsystems, Inc. and any of its subsidiaries or
+affiliates may not be used in advertising or publicity pertaining to
+distribution of Interface Definition Language CFE as permitted herein.
+
+This license is effective until terminated by Sun for failure to comply
+with this license. Upon termination, you shall destroy or return all code
+and documentation for the Interface Definition Language CFE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
+DEALING, USAGE OR TRADE PRACTICE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
+ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
+TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
+
+SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
+RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
+INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
+
+IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
+ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
+DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Use, duplication, or disclosure by the government is subject to
+restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
+Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
+52.227-19.
+
+Sun, Sun Microsystems and the Sun logo are trademarks or registered
+trademarks of Sun Microsystems, Inc.
+
+SunSoft, Inc.
+2550 Garcia Avenue
+Mountain View, California 94043
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+ */
+
+#pragma ident "%@(#)utl_global.cc 1.19% %92/06/10% Sun Microsystems"
+
+// utl_global.cc - Implementation of class IDL_GlobalData
+//
+
+#include "idl.h"
+#include "idl_extern.h"
+
+// Define an increment for the size of the array used to store names of
+// included files
+#undef INCREMENT
+#define INCREMENT 64
+
+IDL_GlobalData::IDL_GlobalData()
+ : pd_scopes(NULL),
+ pd_root(NULL),
+ pd_gen(NULL),
+ pd_err(NULL),
+ pd_err_count(0),
+ pd_lineno(0),
+ pd_filename(NULL),
+ pd_main_filename(NULL),
+ pd_real_filename(NULL),
+ pd_in_main_file(I_FALSE),
+ pd_prog_name(NULL),
+ pd_cpp_location(NULL),
+ pd_compile_flags(0),
+ pd_be(NULL),
+ pd_local_escapes(NULL),
+ pd_indent(NULL),
+ pd_pragmas(NULL),
+ pd_read_from_stdin(I_FALSE),
+ pd_include_file_names(NULL),
+ pd_n_include_file_names(0),
+ pd_n_alloced_file_names(0),
+ pd_parse_state(PS_NoState)
+{
+ // empty
+}
+
+// Get or set scopes stack
+UTL_ScopeStack *
+IDL_GlobalData::scopes()
+{
+ return pd_scopes;
+}
+void
+IDL_GlobalData::set_scopes(UTL_ScopeStack *s)
+{
+ pd_scopes = s;
+}
+
+// Get or set root of AST
+AST_Root *
+IDL_GlobalData::root()
+{
+ return pd_root;
+}
+void
+IDL_GlobalData::set_root(AST_Root *r)
+{
+ pd_root = r;
+}
+
+// Get or set generator object
+AST_Generator *
+IDL_GlobalData::gen()
+{
+ return pd_gen;
+}
+void
+IDL_GlobalData::set_gen(AST_Generator *g)
+{
+ pd_gen = g;
+}
+
+// Get or set error object
+UTL_Error *
+IDL_GlobalData::err()
+{
+ return pd_err;
+}
+void
+IDL_GlobalData::set_err(UTL_Error *e)
+{
+ pd_err = e;
+}
+
+// Get or set error count
+long
+IDL_GlobalData::err_count()
+{
+ return pd_err_count;
+}
+void
+IDL_GlobalData::set_err_count(long c)
+{
+ pd_err_count = c;
+}
+
+// Get or set line number
+long
+IDL_GlobalData::lineno()
+{
+ return pd_lineno;
+}
+void
+IDL_GlobalData::set_lineno(long n)
+{
+ pd_lineno = n;
+}
+
+// Get or set file name being read now
+String *
+IDL_GlobalData::filename()
+{
+ return pd_filename;
+}
+void
+IDL_GlobalData::set_filename(String *f)
+{
+ pd_filename = f;
+}
+
+// Get or set main file name
+String *
+IDL_GlobalData::main_filename()
+{
+ return pd_main_filename;
+}
+void
+IDL_GlobalData::set_main_filename(String *n)
+{
+ pd_main_filename = n;
+}
+
+// Get or set real file name
+String *
+IDL_GlobalData::real_filename()
+{
+ return pd_real_filename;
+}
+void
+IDL_GlobalData::set_real_filename(String *n)
+{
+ pd_real_filename = n;
+}
+
+// Get or set indicator whether import is on
+idl_bool
+IDL_GlobalData::imported()
+{
+ return pd_in_main_file ? I_FALSE : pd_import;
+}
+idl_bool
+IDL_GlobalData::import()
+{
+ return pd_import;
+}
+void
+IDL_GlobalData::set_import(idl_bool is_in)
+{
+ pd_import = is_in;
+}
+
+// Get or set indicator whether we're reading the main file now
+idl_bool
+IDL_GlobalData::in_main_file()
+{
+ return pd_in_main_file;
+}
+void
+IDL_GlobalData::set_in_main_file(idl_bool is_in)
+{
+ pd_in_main_file = is_in;
+}
+
+// Get or set stripped file name
+String *
+IDL_GlobalData::stripped_filename()
+{
+ return pd_stripped_filename;
+}
+void
+IDL_GlobalData::set_stripped_filename(String *nm)
+{
+ pd_stripped_filename = nm;
+}
+
+// Get or set cache value for argv[0]
+char *
+IDL_GlobalData::prog_name()
+{
+ return pd_prog_name;
+}
+void
+IDL_GlobalData::set_prog_name(char *pn)
+{
+ pd_prog_name = pn;
+}
+
+// Get or set location to find C preprocessor
+char *
+IDL_GlobalData::cpp_location()
+{
+ return pd_cpp_location;
+}
+void
+IDL_GlobalData::set_cpp_location(char *l)
+{
+ pd_cpp_location = l;
+}
+
+// Get or set IDL compiler flags
+long
+IDL_GlobalData::compile_flags()
+{
+ return pd_compile_flags;
+}
+void
+IDL_GlobalData::set_compile_flags(long cf)
+{
+ pd_compile_flags = cf;
+}
+
+// Get or set BE to be used
+char *
+IDL_GlobalData::be()
+{
+ return pd_be;
+}
+void
+IDL_GlobalData::set_be(char *nbe)
+{
+ pd_be = nbe;
+}
+
+// Get or set local escapes string. This provides additional mechanism
+// to pass information to a BE.
+char *
+IDL_GlobalData::local_escapes()
+{
+ return pd_local_escapes;
+}
+void
+IDL_GlobalData::set_local_escapes(char *e)
+{
+ pd_local_escapes = e;
+}
+
+// Get or set indent object
+UTL_Indenter *
+IDL_GlobalData::indent()
+{
+ return pd_indent;
+}
+void
+IDL_GlobalData::set_indent(UTL_Indenter *i)
+{
+ pd_indent = i;
+}
+
+// Get or set list of pragmas being parsed
+UTL_StrList *
+IDL_GlobalData::pragmas()
+{
+ UTL_StrList *p = pd_pragmas;
+
+ pd_pragmas = NULL;
+ return p;
+}
+void
+IDL_GlobalData::set_pragmas(UTL_StrList *p)
+{
+ pd_pragmas = p;
+}
+
+// Get or set indicator whether we're reading from stdin
+idl_bool
+IDL_GlobalData::read_from_stdin()
+{
+ return pd_read_from_stdin;
+}
+void
+IDL_GlobalData::set_read_from_stdin(idl_bool r)
+{
+ pd_read_from_stdin = r;
+}
+
+// Have we seen this include file name before?
+long
+IDL_GlobalData::seen_include_file_before(String *n)
+{
+ unsigned long i;
+
+ for (i = 0; i < pd_n_include_file_names; i++)
+ if (n->compare(pd_include_file_names[i]))
+ return I_TRUE;
+ return I_FALSE;
+}
+
+// Store a name of an #include file
+void
+IDL_GlobalData::store_include_file_name(String *n)
+{
+ String **o_include_file_names;
+ unsigned long o_n_alloced_file_names,
+ i;
+
+ /*
+ * Check if we need to store it at all or whether we've seen it already
+ */
+ if (seen_include_file_before(n))
+ return;
+ /*
+ * OK, need to store. Make sure there's space for one more string
+ */
+ if (pd_n_include_file_names == pd_n_alloced_file_names) {
+ if (pd_n_alloced_file_names == 0) {
+ pd_n_alloced_file_names = INCREMENT;
+ pd_include_file_names = new String *[pd_n_alloced_file_names];
+ } else {
+ o_include_file_names = pd_include_file_names;
+ o_n_alloced_file_names = pd_n_alloced_file_names;
+ pd_n_alloced_file_names += INCREMENT;
+ pd_include_file_names = new String *[pd_n_alloced_file_names];
+ for (i = 0; i < o_n_alloced_file_names; i++)
+ pd_include_file_names[i] = o_include_file_names[i];
+ delete [] o_include_file_names;
+ }
+ }
+ /*
+ * Store it
+ */
+ pd_include_file_names[pd_n_include_file_names++] = n;
+}
+
+void
+IDL_GlobalData::set_include_file_names(String **ns)
+{
+ pd_include_file_names = ns;
+}
+
+String **
+IDL_GlobalData::include_file_names()
+{
+ return pd_include_file_names;
+}
+
+void
+IDL_GlobalData::set_n_include_file_names(unsigned long n)
+{
+ pd_n_include_file_names = n;
+}
+
+unsigned long
+IDL_GlobalData::n_include_file_names()
+{
+ return pd_n_include_file_names;
+}
+
+void
+IDL_GlobalData::set_parse_state(ParseState ps)
+{
+ pd_parse_state = ps;
+}
+
+IDL_GlobalData::ParseState
+IDL_GlobalData::parse_state()
+{
+ return pd_parse_state;
+}
+
+/*
+ * Convert a PredefinedType to an ExprType
+ */
+AST_Expression::ExprType
+IDL_GlobalData::PredefinedTypeToExprType(AST_PredefinedType::PredefinedType pt)
+{
+ switch (pt) {
+ case AST_PredefinedType::PT_long:
+ return AST_Expression::EV_long;
+ case AST_PredefinedType::PT_ulong:
+ return AST_Expression::EV_ulong;
+ case AST_PredefinedType::PT_short:
+ return AST_Expression::EV_short;
+ case AST_PredefinedType::PT_ushort:
+ return AST_Expression::EV_ushort;
+ case AST_PredefinedType::PT_float:
+ return AST_Expression::EV_float;
+ case AST_PredefinedType::PT_double:
+ return AST_Expression::EV_double;
+ case AST_PredefinedType::PT_char:
+ return AST_Expression::EV_char;
+ case AST_PredefinedType::PT_octet:
+ return AST_Expression::EV_octet;
+ case AST_PredefinedType::PT_boolean:
+ return AST_Expression::EV_bool;
+ default:
+ return AST_Expression::EV_any;
+ }
+}
diff --git a/TAO/TAO_IDL/util/utl_identifier.cpp b/TAO/TAO_IDL/util/utl_identifier.cpp
new file mode 100644
index 00000000000..6b7673a1b74
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_identifier.cpp
@@ -0,0 +1,114 @@
+/*
+
+COPYRIGHT
+
+Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
+States of America. All Rights Reserved.
+
+This product is protected by copyright and distributed under the following
+license restricting its use.
+
+The Interface Definition Language Compiler Front End (CFE) is made
+available for your use provided that you include this license and copyright
+notice on all media and documentation and the software program in which
+this product is incorporated in whole or part. You may copy and extend
+functionality (but may not remove functionality) of the Interface
+Definition Language CFE without charge, but you are not authorized to
+license or distribute it to anyone else except as part of a product or
+program developed by you or with the express written consent of Sun
+Microsystems, Inc. ("Sun").
+
+The names of Sun Microsystems, Inc. and any of its subsidiaries or
+affiliates may not be used in advertising or publicity pertaining to
+distribution of Interface Definition Language CFE as permitted herein.
+
+This license is effective until terminated by Sun for failure to comply
+with this license. Upon termination, you shall destroy or return all code
+and documentation for the Interface Definition Language CFE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
+DEALING, USAGE OR TRADE PRACTICE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
+ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
+TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
+
+SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
+RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
+INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
+
+IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
+ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
+DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Use, duplication, or disclosure by the government is subject to
+restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
+Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
+52.227-19.
+
+Sun, Sun Microsystems and the Sun logo are trademarks or registered
+trademarks of Sun Microsystems, Inc.
+
+SunSoft, Inc.
+2550 Garcia Avenue
+Mountain View, California 94043
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+ */
+
+#pragma ident "%@(#)utl_identifier.cc 1.34% %92/06/10% Sun Microsystems"
+
+// utl_identifier - Implementation of identifiers
+
+#include "idl.h"
+#include "idl_extern.h"
+
+/*
+ * Constructors
+ */
+
+Identifier::Identifier()
+ : pv_string(NULL)
+{
+}
+
+Identifier::Identifier(char *s, long, long, long)
+ : pv_string(s)
+{
+}
+
+Identifier::~Identifier() {}
+
+// Operations
+
+char *
+Identifier::get_string()
+{
+ return pv_string;
+}
+
+// Compare two Identifier *
+long
+Identifier::compare(Identifier *o)
+{
+ if (o == NULL) return I_FALSE;
+ if (pv_string == NULL || o->get_string() == NULL)
+ return I_FALSE;
+ return (strcmp(pv_string, o->get_string()) == 0) ? I_TRUE : I_FALSE;
+}
+
+// Dumping
+
+void
+Identifier::dump(ostream &o)
+{
+ if (pv_string == NULL) return;
+
+ o << get_string();
+}
diff --git a/TAO/TAO_IDL/util/utl_idlist.cpp b/TAO/TAO_IDL/util/utl_idlist.cpp
new file mode 100644
index 00000000000..0c7bbb7696c
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_idlist.cpp
@@ -0,0 +1,187 @@
+/*
+
+COPYRIGHT
+
+Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
+States of America. All Rights Reserved.
+
+This product is protected by copyright and distributed under the following
+license restricting its use.
+
+The Interface Definition Language Compiler Front End (CFE) is made
+available for your use provided that you include this license and copyright
+notice on all media and documentation and the software program in which
+this product is incorporated in whole or part. You may copy and extend
+functionality (but may not remove functionality) of the Interface
+Definition Language CFE without charge, but you are not authorized to
+license or distribute it to anyone else except as part of a product or
+program developed by you or with the express written consent of Sun
+Microsystems, Inc. ("Sun").
+
+The names of Sun Microsystems, Inc. and any of its subsidiaries or
+affiliates may not be used in advertising or publicity pertaining to
+distribution of Interface Definition Language CFE as permitted herein.
+
+This license is effective until terminated by Sun for failure to comply
+with this license. Upon termination, you shall destroy or return all code
+and documentation for the Interface Definition Language CFE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
+DEALING, USAGE OR TRADE PRACTICE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
+ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
+TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
+
+SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
+RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
+INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
+
+IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
+ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
+DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Use, duplication, or disclosure by the government is subject to
+restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
+Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
+52.227-19.
+
+Sun, Sun Microsystems and the Sun logo are trademarks or registered
+trademarks of Sun Microsystems, Inc.
+
+SunSoft, Inc.
+2550 Garcia Avenue
+Mountain View, California 94043
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+ */
+
+#pragma ident "%@(#)utl_idlist.cc 1.34% %92/06/10% Sun Microsystems"
+
+// utl_idlist.cc
+//
+// 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.
+//
+// For portability reasons we have decided to provide both this and
+// an implementation of the list classes in terms of templates. If
+// your compiler supports templates, please use the files in the
+// include/utl_tmpl and util/utl_tmpl directories instead of the
+// files by the same names in the include and util directories.
+
+#include "idl.h"
+#include "idl_extern.h"
+
+/*
+ * Constructor(s)
+ */
+
+UTL_IdList::UTL_IdList(Identifier *s, UTL_IdList *cdr)
+ : pd_car_data(s),
+ UTL_List((UTL_List *) cdr)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Copy a list
+UTL_List *
+UTL_IdList::copy()
+{
+ if (tail() == NULL)
+ return (UTL_List *) new UTL_IdList(head(), NULL);
+ return (UTL_List *) new UTL_IdList(head(), (UTL_IdList *) tail()->copy());
+}
+
+// Get list item
+Identifier *
+UTL_IdList::head()
+{
+ return pd_car_data;
+}
+
+// Get last item of this list
+Identifier *
+UTL_IdList::last_component()
+{
+ if (tail()== NULL)
+ return head();
+ return ((UTL_IdList *) tail())->last_component();
+}
+
+// AST Dumping
+void
+UTL_IdList::dump(ostream &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;
+ }
+ i->next();
+ }
+}
+
+/*
+ * Redefinition of inherited virtual operations
+ */
+
+// UTL_IdList active iterator
+
+/*
+ * Constructor
+ */
+
+UTL_IdListActiveIterator::UTL_IdListActiveIterator(UTL_IdList *s)
+ : UTL_ListActiveIterator(s)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Get current item
+Identifier *
+UTL_IdListActiveIterator::item()
+{
+ if (source == NULL)
+ return NULL;
+ return ((UTL_IdList *) source)->head();
+}
+
+/*
+ * Redefinition of inherited virtual operations
+ */
diff --git a/TAO/TAO_IDL/util/utl_indenter.cpp b/TAO/TAO_IDL/util/utl_indenter.cpp
new file mode 100644
index 00000000000..050d0456876
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_indenter.cpp
@@ -0,0 +1,123 @@
+/*
+
+COPYRIGHT
+
+Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
+States of America. All Rights Reserved.
+
+This product is protected by copyright and distributed under the following
+license restricting its use.
+
+The Interface Definition Language Compiler Front End (CFE) is made
+available for your use provided that you include this license and copyright
+notice on all media and documentation and the software program in which
+this product is incorporated in whole or part. You may copy and extend
+functionality (but may not remove functionality) of the Interface
+Definition Language CFE without charge, but you are not authorized to
+license or distribute it to anyone else except as part of a product or
+program developed by you or with the express written consent of Sun
+Microsystems, Inc. ("Sun").
+
+The names of Sun Microsystems, Inc. and any of its subsidiaries or
+affiliates may not be used in advertising or publicity pertaining to
+distribution of Interface Definition Language CFE as permitted herein.
+
+This license is effective until terminated by Sun for failure to comply
+with this license. Upon termination, you shall destroy or return all code
+and documentation for the Interface Definition Language CFE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
+DEALING, USAGE OR TRADE PRACTICE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
+ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
+TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
+
+SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
+RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
+INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
+
+IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
+ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
+DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Use, duplication, or disclosure by the government is subject to
+restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
+Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
+52.227-19.
+
+Sun, Sun Microsystems and the Sun logo are trademarks or registered
+trademarks of Sun Microsystems, Inc.
+
+SunSoft, Inc.
+2550 Garcia Avenue
+Mountain View, California 94043
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+ */
+
+#pragma ident "%@(#)utl_indenter.cc 1.9% %92/06/10% Sun Microsystems"
+
+// utl_indenter.cc - Implementation of indenter for dumping IDL AST
+//
+
+#include "idl.h"
+#include "idl_extern.h"
+
+/*
+ * Constructors
+ */
+UTL_Indenter::UTL_Indenter()
+ : pd_indent_level(0)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Reset indentation level
+void
+UTL_Indenter::reset()
+{
+ pd_indent_level = 0;
+}
+
+// Increase indentation level
+void
+UTL_Indenter::increase()
+{
+ pd_indent_level++;
+}
+
+// Decrease indentation level
+void
+UTL_Indenter::decrease()
+{
+ if (pd_indent_level > 0)
+ pd_indent_level--;
+}
+
+// Produce white space to indent to current indentation level on ostream o
+void
+UTL_Indenter::skip_to(ostream &o)
+{
+ long i;
+
+ for (i = 0; i < pd_indent_level; i++)
+ o << " ";
+}
+
+/*
+ * Redefined virtual operations
+ */
diff --git a/TAO/TAO_IDL/util/utl_labellist.cpp b/TAO/TAO_IDL/util/utl_labellist.cpp
new file mode 100644
index 00000000000..dc7450734f8
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_labellist.cpp
@@ -0,0 +1,145 @@
+/*
+
+COPYRIGHT
+
+Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
+States of America. All Rights Reserved.
+
+This product is protected by copyright and distributed under the following
+license restricting its use.
+
+The Interface Definition Language Compiler Front End (CFE) is made
+available for your use provided that you include this license and copyright
+notice on all media and documentation and the software program in which
+this product is incorporated in whole or part. You may copy and extend
+functionality (but may not remove functionality) of the Interface
+Definition Language CFE without charge, but you are not authorized to
+license or distribute it to anyone else except as part of a product or
+program developed by you or with the express written consent of Sun
+Microsystems, Inc. ("Sun").
+
+The names of Sun Microsystems, Inc. and any of its subsidiaries or
+affiliates may not be used in advertising or publicity pertaining to
+distribution of Interface Definition Language CFE as permitted herein.
+
+This license is effective until terminated by Sun for failure to comply
+with this license. Upon termination, you shall destroy or return all code
+and documentation for the Interface Definition Language CFE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
+DEALING, USAGE OR TRADE PRACTICE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
+ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
+TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
+
+SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
+RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
+INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
+
+IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
+ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
+DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Use, duplication, or disclosure by the government is subject to
+restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
+Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
+52.227-19.
+
+Sun, Sun Microsystems and the Sun logo are trademarks or registered
+trademarks of Sun Microsystems, Inc.
+
+SunSoft, Inc.
+2550 Garcia Avenue
+Mountain View, California 94043
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+ */
+
+#pragma ident "%@(#)utl_labellist.cc 1.27% %92/06/10% Sun Microsystems"
+
+// utl_labellist.cc
+//
+// 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.
+//
+// For portability reasons we have decided to provide both this and
+// an implementation of the list classes in terms of templates. If
+// your compiler supports templates, please use the files in the
+// include/utl_tmpl and util/utl_tmpl directories instead of the
+// files by the same names in the include and util directories.
+
+#include "idl.h"
+#include "idl_extern.h"
+
+/*
+ * Constructor(s)
+ */
+
+UTL_LabelList::UTL_LabelList(AST_UnionLabel *s, UTL_LabelList *cdr)
+ : pd_car_data(s),
+ UTL_List(cdr)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Get list item
+AST_UnionLabel *
+UTL_LabelList::head()
+{
+ return pd_car_data;
+}
+
+/*
+ * Redefinition of inherited virtual operations
+ */
+
+// UTL_LabelList active iterator
+
+/*
+ * Constructor
+ */
+
+UTL_LabellistActiveIterator::UTL_LabellistActiveIterator(UTL_LabelList *s)
+ : UTL_ListActiveIterator(s)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Get current item
+AST_UnionLabel *
+UTL_LabellistActiveIterator::item()
+{
+ if (source == NULL)
+ return NULL;
+ 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
new file mode 100644
index 00000000000..7c2873607a3
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_list.cpp
@@ -0,0 +1,197 @@
+/*
+
+COPYRIGHT
+
+Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
+States of America. All Rights Reserved.
+
+This product is protected by copyright and distributed under the following
+license restricting its use.
+
+The Interface Definition Language Compiler Front End (CFE) is made
+available for your use provided that you include this license and copyright
+notice on all media and documentation and the software program in which
+this product is incorporated in whole or part. You may copy and extend
+functionality (but may not remove functionality) of the Interface
+Definition Language CFE without charge, but you are not authorized to
+license or distribute it to anyone else except as part of a product or
+program developed by you or with the express written consent of Sun
+Microsystems, Inc. ("Sun").
+
+The names of Sun Microsystems, Inc. and any of its subsidiaries or
+affiliates may not be used in advertising or publicity pertaining to
+distribution of Interface Definition Language CFE as permitted herein.
+
+This license is effective until terminated by Sun for failure to comply
+with this license. Upon termination, you shall destroy or return all code
+and documentation for the Interface Definition Language CFE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
+DEALING, USAGE OR TRADE PRACTICE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
+ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
+TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
+
+SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
+RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
+INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
+
+IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
+ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
+DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Use, duplication, or disclosure by the government is subject to
+restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
+Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
+52.227-19.
+
+Sun, Sun Microsystems and the Sun logo are trademarks or registered
+trademarks of Sun Microsystems, Inc.
+
+SunSoft, Inc.
+2550 Garcia Avenue
+Mountain View, California 94043
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+ */
+
+#pragma ident "%@(#)utl_list.cc 1.34% %92/06/10% Sun Microsystems"
+
+// utl_list.cc
+//
+// Implementation of generic single-linked lists
+
+// 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.
+//
+// For portability reasons we have decided to provide both this and
+// an implementation of the list classes in terms of templates. If
+// your compiler supports templates, please use the files in the
+// include/utl_tmpl and util/utl_tmpl directories instead of the
+// files by the same names in the include and util directories.
+
+#include "idl.h"
+#include "idl_extern.h"
+
+/*
+ * Constructor(s)
+ */
+
+UTL_List::UTL_List(UTL_List *c)
+ : pd_cdr_data(c)
+{
+}
+
+/*
+ * Private operations
+ */
+
+// Compute list length
+long
+UTL_List::list_length(long n)
+{
+ if (pd_cdr_data == NULL)
+ return n;
+ else
+ return pd_cdr_data->list_length(n+1);
+}
+
+/*
+ * Public operations
+ */
+
+// Smash last cdr with l
+void
+UTL_List::nconc(UTL_List *l)
+{
+ if (pd_cdr_data == NULL)
+ pd_cdr_data = l;
+ else
+ pd_cdr_data->nconc(l);
+}
+
+/*
+ * Override this operation to copy lists of other types
+ */
+// Copy a list
+UTL_List *
+UTL_List::copy()
+{
+ if (pd_cdr_data == NULL)
+ return new UTL_List(NULL);
+ return new UTL_List(pd_cdr_data->copy());
+}
+
+// Get next list
+UTL_List *
+UTL_List::tail()
+{
+ return pd_cdr_data;
+}
+
+// Set next list
+void
+UTL_List::set_tail(UTL_List *l)
+{
+ pd_cdr_data = l;
+}
+
+// Compute list length
+long
+UTL_List::length()
+{
+ return list_length(1);
+}
+
+/*
+ * Redefinition of inherited virtual operations
+ */
+
+// UTL_List active iterator
+
+/*
+ * Constructor
+ */
+
+UTL_ListActiveIterator::UTL_ListActiveIterator(UTL_List *s)
+ : source(s)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Is iterator done?
+long
+UTL_ListActiveIterator::is_done()
+{
+ return (source == NULL) ? I_TRUE : I_FALSE;
+}
+
+// Advance to next item
+void
+UTL_ListActiveIterator::next()
+{
+ if (source != NULL)
+ source = source->tail();
+}
+
+/*
+ * Redefinition of inherited operations
+ */
+
diff --git a/TAO/TAO_IDL/util/utl_namelist.cpp b/TAO/TAO_IDL/util/utl_namelist.cpp
new file mode 100644
index 00000000000..ea1f8ca543a
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_namelist.cpp
@@ -0,0 +1,145 @@
+/*
+
+COPYRIGHT
+
+Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
+States of America. All Rights Reserved.
+
+This product is protected by copyright and distributed under the following
+license restricting its use.
+
+The Interface Definition Language Compiler Front End (CFE) is made
+available for your use provided that you include this license and copyright
+notice on all media and documentation and the software program in which
+this product is incorporated in whole or part. You may copy and extend
+functionality (but may not remove functionality) of the Interface
+Definition Language CFE without charge, but you are not authorized to
+license or distribute it to anyone else except as part of a product or
+program developed by you or with the express written consent of Sun
+Microsystems, Inc. ("Sun").
+
+The names of Sun Microsystems, Inc. and any of its subsidiaries or
+affiliates may not be used in advertising or publicity pertaining to
+distribution of Interface Definition Language CFE as permitted herein.
+
+This license is effective until terminated by Sun for failure to comply
+with this license. Upon termination, you shall destroy or return all code
+and documentation for the Interface Definition Language CFE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
+DEALING, USAGE OR TRADE PRACTICE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
+ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
+TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
+
+SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
+RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
+INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
+
+IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
+ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
+DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Use, duplication, or disclosure by the government is subject to
+restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
+Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
+52.227-19.
+
+Sun, Sun Microsystems and the Sun logo are trademarks or registered
+trademarks of Sun Microsystems, Inc.
+
+SunSoft, Inc.
+2550 Garcia Avenue
+Mountain View, California 94043
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+ */
+
+#pragma ident "%@(#)utl_namelist.cc 1.33% %92/06/10% Sun Microsystems"
+
+// utl_namelist.cc
+//
+// 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.
+//
+// For portability reasons we have decided to provide both this and
+// an implementation of the list classes in terms of templates. If
+// your compiler supports templates, please use the files in the
+// include/utl_tmpl and util/utl_tmpl directories instead of the
+// files by the same names in the include and util directories.
+
+#include "idl.h"
+#include "idl_extern.h"
+
+/*
+ * Constructor(s)
+ */
+
+UTL_NameList::UTL_NameList(UTL_ScopedName *s, UTL_NameList *cdr)
+ : pd_car_data(s),
+ UTL_List(cdr)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Get list item
+UTL_ScopedName *
+UTL_NameList::head()
+{
+ return pd_car_data;
+}
+
+/*
+ * Redefinition of inherited virtual operations
+ */
+
+// UTL_NameList active iterator
+
+/*
+ * Constructor
+ */
+
+UTL_NamelistActiveIterator::UTL_NamelistActiveIterator(UTL_NameList *s)
+ : UTL_ListActiveIterator(s)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Get current item
+UTL_ScopedName *
+UTL_NamelistActiveIterator::item()
+{
+ if (source == NULL)
+ return NULL;
+ 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
new file mode 100644
index 00000000000..8a4d0c9b5d2
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_scope.cpp
@@ -0,0 +1,1190 @@
+/*
+
+COPYRIGHT
+
+Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
+States of America. All Rights Reserved.
+
+This product is protected by copyright and distributed under the following
+license restricting its use.
+
+The Interface Definition Language Compiler Front End (CFE) is made
+available for your use provided that you include this license and copyright
+notice on all media and documentation and the software program in which
+this product is incorporated in whole or part. You may copy and extend
+functionality (but may not remove functionality) of the Interface
+Definition Language CFE without charge, but you are not authorized to
+license or distribute it to anyone else except as part of a product or
+program developed by you or with the express written consent of Sun
+Microsystems, Inc. ("Sun").
+
+The names of Sun Microsystems, Inc. and any of its subsidiaries or
+affiliates may not be used in advertising or publicity pertaining to
+distribution of Interface Definition Language CFE as permitted herein.
+
+This license is effective until terminated by Sun for failure to comply
+with this license. Upon termination, you shall destroy or return all code
+and documentation for the Interface Definition Language CFE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
+DEALING, USAGE OR TRADE PRACTICE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
+ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
+TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
+
+SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
+RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
+INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
+
+IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
+ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
+DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Use, duplication, or disclosure by the government is subject to
+restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
+Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
+52.227-19.
+
+Sun, Sun Microsystems and the Sun logo are trademarks or registered
+trademarks of Sun Microsystems, Inc.
+
+SunSoft, Inc.
+2550 Garcia Avenue
+Mountain View, California 94043
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+ */
+
+#pragma ident "%@(#)utl_scope.cc 1.46% %92/06/10% Sun Microsystems"
+
+/*
+ * utl_scope.cc - Implementation of class UTL_Scope
+ */
+
+#include "idl.h"
+#include "idl_extern.h"
+
+#undef INCREMENT
+#define INCREMENT 64
+
+/*
+ * Static functions
+ */
+static Identifier *_global_scope_name = NULL;
+static Identifier *_global_scope_root_name = NULL;
+
+/*
+ * Determines if a name is global
+ */
+static long
+is_global_name(Identifier *i)
+{
+ long comp_result = 0;
+ char *s;
+
+ if (i == NULL) return comp_result;
+ s = i->get_string();
+
+ if (_global_scope_name == NULL)
+ _global_scope_name = new Identifier("::", 1, 0, I_FALSE);
+
+ if (_global_scope_root_name == NULL)
+ _global_scope_root_name = new Identifier("", 1, 0, I_FALSE);
+
+ comp_result = i->compare(_global_scope_name);
+ if (!comp_result)
+ comp_result = i->compare(_global_scope_root_name);
+
+ return comp_result;
+}
+
+/*
+ * Helper function for lookup_by_name. Iterates doing local lookups of
+ * subsequent components of a scoped name
+ */
+static AST_Decl *
+iter_lookup_by_name_local(AST_Decl *d, UTL_ScopedName *e,
+ idl_bool treat_as_ref)
+{
+ Identifier *s;
+ AST_Typedef *td;
+ UTL_IdListActiveIterator *i;
+ UTL_Scope *sc;
+
+ i = new UTL_IdListActiveIterator(e);
+ for (i->next(); !(i->is_done()); ) {
+ s = i->item();
+ /*
+ * Update iterator before loop. This is needed for the check for
+ * typedef, since we only want to look at the base type if there
+ * actually are more components of the name to resolve.
+ */
+ i->next();
+ /*
+ * Next component in name was not found
+ */
+ if (d == NULL) {
+ return NULL;
+ }
+ /*
+ * If this is a typedef and we're not done, we should get the
+ * base type to get the scope it defines (if any)
+ */
+ if (!(i->is_done())) {
+ while (d != NULL && d->node_type() == AST_Decl::NT_typedef) {
+ td = AST_Typedef::narrow_from_decl(d);
+ if (td == NULL)
+ return NULL;
+ d = td->base_type();
+ }
+ if (d == NULL)
+ return NULL;
+ }
+ /*
+ * Try to convert the AST_Decl to a UTL_Scope
+ */
+ sc = DeclAsScope(d);
+ if (sc == NULL)
+ return NULL;
+ /*
+ * Look up the next element
+ */
+ d = sc->lookup_by_name_local(s, treat_as_ref);
+ }
+ /*
+ * OK, done with the loop
+ */
+ return d;
+}
+
+/*
+ * Constructor(s)
+ */
+UTL_Scope::UTL_Scope()
+ : pd_scope_node_type(AST_Decl::NT_module),
+ pd_decls(NULL),
+ pd_decls_allocated(0),
+ pd_decls_used(0),
+ pd_local_types(NULL),
+ pd_locals_allocated(0),
+ pd_locals_used(0),
+ pd_referenced(NULL),
+ pd_referenced_allocated(0),
+ pd_referenced_used(0)
+{
+}
+
+UTL_Scope::UTL_Scope(AST_Decl::NodeType nt)
+ : pd_scope_node_type(nt),
+ pd_decls(NULL),
+ pd_decls_allocated(0),
+ pd_decls_used(0),
+ pd_local_types(NULL),
+ pd_locals_allocated(0),
+ pd_locals_used(0),
+ pd_referenced(NULL),
+ pd_referenced_allocated(0),
+ pd_referenced_used(0)
+{
+};
+
+/*
+ * Private operations
+ */
+
+static
+AST_Decl * add_type(AST_Type *type)
+{
+ AST_Decl * result = 0;
+ UTL_Scope * scope = 0;
+ switch (type->node_type()) {
+ case AST_Decl::NT_array:
+ result =
+ idl_global->root()->add_array(AST_Array::narrow_from_decl(type));
+ break;
+ case AST_Decl::NT_enum:
+ result = type->defined_in()->add_enum(AST_Enum::narrow_from_decl(type));
+ scope = AST_Enum::narrow_from_decl(type);
+ break;
+ case AST_Decl::NT_sequence:
+ result =
+ idl_global->root()->add_sequence(AST_Sequence::narrow_from_decl(type));
+ break;
+ case AST_Decl::NT_string:
+ result =
+ idl_global->root()->add_string(AST_String::narrow_from_decl(type));
+ break;
+ case AST_Decl::NT_struct:
+ result =
+ type->defined_in()->
+ add_structure(AST_Structure::narrow_from_decl(type));
+ scope = AST_Structure::narrow_from_decl(type);
+ break;
+ case AST_Decl::NT_union:
+ result =
+ type->defined_in()->add_union(AST_Union::narrow_from_decl(type));
+ scope = AST_Union::narrow_from_decl(type);
+ break;
+ default:
+ // for non-complex types, like predefined types
+ // no additional add needed, assume everything is ok
+ result = (AST_Decl *) 1;
+ break;
+ }
+ if (scope)
+ result = scope->call_add();
+ return result;
+}
+
+/*
+ * Protected operations
+ */
+
+/*
+ * Special version of lookup which only looks at the local name instead of
+ * the fully scoped name, when doing lookups. This version is intended to
+ * be used only by the CFE add_xxx functions
+ */
+AST_Decl *
+UTL_Scope::lookup_for_add(AST_Decl *d, idl_bool treat_as_ref)
+{
+ if (d == NULL)
+ return NULL;
+ return lookup_by_name_local(d->local_name(), treat_as_ref);
+}
+
+/*
+ * Public operations
+ */
+
+// Narrowing
+IMPL_NARROW_METHODS0(UTL_Scope)
+IMPL_NARROW_FROM_SCOPE(UTL_Scope)
+
+// Scope Management Protocol
+//
+// All members of the protocol defined in UTL_Scope simply return the node
+// and don't do a thing. These members are simply dummies to retain
+// compatibility with pre-two-pass compiler back-ends.
+
+AST_PredefinedType *UTL_Scope::add_predefined_type(AST_PredefinedType *p)
+{
+ if (p == NULL) return NULL;
+ p->set_added(I_TRUE);
+ return p;
+}
+
+AST_Module *UTL_Scope::add_module(AST_Module *m)
+{
+ if (m == NULL) return NULL;
+ m->set_added(I_TRUE);
+ return m;
+}
+
+AST_Interface *UTL_Scope::add_interface(AST_Interface *i)
+{
+ if (i == NULL) return NULL;
+ i->set_added(I_TRUE);
+ return i;
+}
+
+AST_InterfaceFwd *UTL_Scope::add_interface_fwd(AST_InterfaceFwd *i)
+{
+ if (i == NULL) return NULL;
+ i->set_added(I_TRUE);
+ return i;
+}
+
+AST_Exception *UTL_Scope::add_exception(AST_Exception *e)
+{
+ if (e == NULL) return NULL;
+ e->set_added(I_TRUE);
+ return e;
+}
+
+AST_Constant *UTL_Scope::add_constant(AST_Constant *c)
+{
+ if (c == NULL) return NULL;
+ c->set_added(I_TRUE);
+ return c;
+}
+
+UTL_StrList *UTL_Scope::add_context(UTL_StrList *c)
+{
+ return c;
+}
+
+UTL_NameList *UTL_Scope::add_exceptions(UTL_NameList *e)
+{
+ return e;
+}
+
+AST_Attribute *UTL_Scope::add_attribute(AST_Attribute *a)
+{
+ if (a == NULL) return NULL;
+ a->set_added(I_TRUE);
+ if (!a->field_type()->added()) {
+ return add_type(a->field_type()) ? a : NULL;
+ } else
+ return a;
+}
+
+AST_Operation *UTL_Scope::add_operation(AST_Operation *o)
+{
+ if (o == NULL) return NULL;
+ o->set_added(I_TRUE);
+ if (!o->return_type()->added()) {
+ return add_type(o->return_type()) ? o : NULL;
+ } else
+ return o;
+}
+
+AST_Argument *UTL_Scope::add_argument(AST_Argument *a)
+{
+ if (a == NULL) return NULL;
+ a->set_added(I_TRUE);
+ if (!a->field_type()->added()) {
+ return add_type(a->field_type()) ? a : NULL;
+ } else
+ return a;
+}
+
+AST_Union *UTL_Scope::add_union(AST_Union *u)
+{
+ if (u == NULL) return NULL;
+ u->set_added(I_TRUE);
+ return u;
+}
+
+AST_UnionBranch *UTL_Scope::add_union_branch(AST_UnionBranch *u)
+{
+ if (u == NULL) return NULL;
+ u->set_added(I_TRUE);
+ if (!u->field_type()->added()) {
+ return add_type(u->field_type()) ? u : NULL;
+ } else
+ return u;
+}
+
+AST_Structure *UTL_Scope::add_structure(AST_Structure *s)
+{
+ if (s == NULL) return NULL;
+ s->set_added(I_TRUE);
+ return s;
+}
+
+AST_Field *UTL_Scope::add_field(AST_Field *f)
+{
+ if (f == NULL) return NULL;
+ f->set_added(I_TRUE);
+ if (!f->field_type()->added()) {
+ return add_type(f->field_type()) ? f : NULL;
+ } else
+ return f;
+}
+
+AST_Enum *UTL_Scope::add_enum(AST_Enum *e)
+{
+ if (e == NULL) return NULL;
+ e->set_added(I_TRUE);
+ return e;
+}
+
+AST_EnumVal *UTL_Scope::add_enum_val(AST_EnumVal *e)
+{
+ if (e == NULL) return NULL;
+ e->set_added(I_TRUE);
+ return e;
+}
+
+AST_Typedef *UTL_Scope::add_typedef(AST_Typedef *t)
+{
+ if (t == NULL) return NULL;
+ t->set_added(I_TRUE);
+ if (!t->base_type()->added()) {
+ return add_type(t->base_type()) ? t : NULL;
+ } else
+ return t;
+}
+
+AST_Sequence *UTL_Scope::add_sequence(AST_Sequence *s)
+{
+ if (s == NULL) return NULL;
+ s->set_added(I_TRUE);
+ if (!s->base_type()->added()) {
+ return add_type(s->base_type()) ? s : NULL;
+ } else
+ return s;
+}
+
+AST_String *UTL_Scope::add_string(AST_String *s)
+{
+ if (s == NULL) return NULL;
+ s->set_added(I_TRUE);
+ return s;
+}
+
+AST_Array *UTL_Scope::add_array(AST_Array *a)
+{
+ if (a == NULL) return NULL;
+ a->set_added(I_TRUE);
+ if (!a->base_type()->added()) {
+ return add_type(a->base_type()) ? a : NULL;
+ } else
+ return a;
+}
+
+// Protected Front End Scope Management Protocol
+//
+// All members of the protocol defined in UTL_Scope simply return NULL
+// and don't do a thing. This ensures that runtime errors will discover
+// operations which should have been redefined to allow certain kinds of
+// AST nodes to appear in a given context
+
+AST_PredefinedType *UTL_Scope::fe_add_predefined_type(AST_PredefinedType *)
+{
+ return NULL;
+}
+
+AST_Module *UTL_Scope::fe_add_module(AST_Module *)
+{
+ return NULL;
+}
+
+AST_Interface *UTL_Scope::fe_add_interface(AST_Interface *)
+{
+ return NULL;
+}
+
+AST_InterfaceFwd *UTL_Scope::fe_add_interface_fwd(AST_InterfaceFwd *)
+{
+ return NULL;
+}
+
+AST_Exception *UTL_Scope::fe_add_exception(AST_Exception *)
+{
+ return NULL;
+}
+
+AST_Constant *UTL_Scope::fe_add_constant(AST_Constant *)
+{
+ return NULL;
+}
+
+UTL_StrList *UTL_Scope::fe_add_context(UTL_StrList *)
+{
+ return NULL;
+}
+
+UTL_NameList *UTL_Scope::fe_add_exceptions(UTL_NameList *)
+{
+ return NULL;
+}
+
+AST_Attribute *UTL_Scope::fe_add_attribute(AST_Attribute *)
+{
+ return NULL;
+}
+
+AST_Operation *UTL_Scope::fe_add_operation(AST_Operation *)
+{
+ return NULL;
+}
+
+AST_Argument *UTL_Scope::fe_add_argument(AST_Argument *)
+{
+ return NULL;
+}
+
+AST_Union *UTL_Scope::fe_add_union(AST_Union *)
+{
+ return NULL;
+}
+
+AST_UnionBranch *UTL_Scope::fe_add_union_branch(AST_UnionBranch *)
+{
+ return NULL;
+}
+
+AST_Structure *UTL_Scope::fe_add_structure(AST_Structure *)
+{
+ return NULL;
+}
+
+AST_Field *UTL_Scope::fe_add_field(AST_Field *)
+{
+ return NULL;
+}
+
+AST_Enum *UTL_Scope::fe_add_enum(AST_Enum *)
+{
+ return NULL;
+}
+
+AST_EnumVal *UTL_Scope::fe_add_enum_val(AST_EnumVal *)
+{
+ return NULL;
+}
+
+AST_Typedef *UTL_Scope::fe_add_typedef(AST_Typedef *)
+{
+ return NULL;
+}
+
+AST_Sequence *UTL_Scope::fe_add_sequence(AST_Sequence *)
+{
+ return NULL;
+}
+
+AST_String *UTL_Scope::fe_add_string(AST_String *)
+{
+ return NULL;
+}
+
+AST_Array *UTL_Scope::fe_add_array(AST_Array *)
+{
+ return NULL;
+}
+
+// This is the second pass of the front end
+// It calls the public add protocol on everything in scope.
+// It calls the add_xx functions of the most derived AST_Node.
+
+AST_Decl *UTL_Scope::call_add()
+{
+ AST_Decl *result = NULL;
+ AST_Decl *decl;
+
+ UTL_ScopeActiveIterator *i;
+ UTL_Scope *scope;
+
+ i = new UTL_ScopeActiveIterator(this, UTL_Scope::IK_decls);
+ while(!(i->is_done())) {
+ decl = i->item();
+ scope = 0;
+ switch (decl->node_type()) {
+ case AST_Decl::NT_argument:
+ result = add_argument(AST_Argument::narrow_from_decl(decl));
+ break;
+ case AST_Decl::NT_array:
+ result = add_array(AST_Array::narrow_from_decl(decl));
+ break;
+ case AST_Decl::NT_attr:
+ result = add_attribute(AST_Attribute::narrow_from_decl(decl));
+ break;
+ case AST_Decl::NT_const:
+ result = add_constant(AST_Constant::narrow_from_decl(decl));
+ break;
+ case AST_Decl::NT_enum:
+ scope = AST_Enum::narrow_from_decl(decl);
+ result = add_enum(AST_Enum::narrow_from_decl(decl));
+ break;
+ case AST_Decl::NT_enum_val:
+ result = add_enum_val(AST_EnumVal::narrow_from_decl(decl));
+ break;
+ case AST_Decl::NT_except:
+ scope = AST_Exception::narrow_from_decl(decl);
+ result = add_exception(AST_Exception::narrow_from_decl(decl));
+ break;
+ case AST_Decl::NT_field:
+ result = add_field(AST_Field::narrow_from_decl(decl));
+ break;
+ case AST_Decl::NT_interface:
+ scope = AST_Interface::narrow_from_decl(decl);
+ result = add_interface(AST_Interface::narrow_from_decl(decl));
+ break;
+ case AST_Decl::NT_interface_fwd:
+ result = add_interface_fwd(AST_InterfaceFwd::narrow_from_decl(decl));
+ break;
+ case AST_Decl::NT_module:
+ scope = AST_Module::narrow_from_decl(decl);
+ result = add_module(AST_Module::narrow_from_decl(decl));
+ break;
+ case AST_Decl::NT_op:
+ result = add_operation(AST_Operation::narrow_from_decl(decl));
+ scope = AST_Operation::narrow_from_decl(decl);
+ break;
+ case AST_Decl::NT_pre_defined:
+ result =
+ add_predefined_type(AST_PredefinedType::narrow_from_decl(decl));
+ break;
+ case AST_Decl::NT_sequence:
+ result = add_sequence(AST_Sequence::narrow_from_decl(decl));
+ break;
+ case AST_Decl::NT_string:
+ result = add_string(AST_String::narrow_from_decl(decl));
+ break;
+ case AST_Decl::NT_struct:
+ result = add_structure(AST_Structure::narrow_from_decl(decl));
+ scope = AST_Structure::narrow_from_decl(decl);
+ break;
+ case AST_Decl::NT_typedef:
+ result = add_typedef(AST_Typedef::narrow_from_decl(decl));
+ break;
+ case AST_Decl::NT_union:
+ result = add_union(AST_Union::narrow_from_decl(decl));
+ scope = AST_Union::narrow_from_decl(decl);
+ break;
+ case AST_Decl::NT_union_branch:
+ result = add_union_branch(AST_UnionBranch::narrow_from_decl(decl));
+ break;
+ default:
+ return NULL;
+ }
+ if (scope)
+ scope->call_add();
+ i->next();
+ }
+ return result;
+}
+
+// Private lookup mechanism
+
+/*
+ * Lookup the node for a primitive (built in) type
+ */
+AST_Decl *
+UTL_Scope::lookup_primitive_type(AST_Expression::ExprType et)
+{
+ AST_Decl *as_decl;
+ UTL_Scope *ancestor;
+ AST_PredefinedType *t;
+ UTL_ScopeActiveIterator *i;
+ AST_PredefinedType::PredefinedType pdt;
+
+ as_decl = ScopeAsDecl(this);
+ if (as_decl == NULL)
+ return NULL;
+ ancestor = as_decl->defined_in();
+ if (ancestor != NULL)
+ return ancestor->lookup_primitive_type(et);
+
+ switch (et) {
+ case AST_Expression::EV_short:
+ pdt = AST_PredefinedType::PT_short;
+ break;
+ case AST_Expression::EV_ushort:
+ pdt = AST_PredefinedType::PT_ushort;
+ break;
+ case AST_Expression::EV_long:
+ pdt = AST_PredefinedType::PT_long;
+ break;
+ case AST_Expression::EV_ulong:
+ pdt = AST_PredefinedType::PT_ulong;
+ break;
+ case AST_Expression::EV_longlong:
+ pdt = AST_PredefinedType::PT_longlong;
+ break;
+ case AST_Expression::EV_ulonglong:
+ pdt = AST_PredefinedType::PT_ulonglong;
+ break;
+ case AST_Expression::EV_float:
+ pdt = AST_PredefinedType::PT_float;
+ break;
+ case AST_Expression::EV_double:
+ pdt = AST_PredefinedType::PT_double;
+ break;
+ case AST_Expression::EV_longdouble:
+ pdt = AST_PredefinedType::PT_longdouble;
+ break;
+ case AST_Expression::EV_char:
+ pdt = AST_PredefinedType::PT_char;
+ break;
+ case AST_Expression::EV_wchar:
+ pdt = AST_PredefinedType::PT_wchar;
+ break;
+ case AST_Expression::EV_octet:
+ pdt = AST_PredefinedType::PT_octet;
+ break;
+ case AST_Expression::EV_bool:
+ pdt = AST_PredefinedType::PT_boolean;
+ break;
+ case AST_Expression::EV_any:
+ pdt = AST_PredefinedType::PT_any;
+ break;
+ case AST_Expression::EV_void:
+ pdt = AST_PredefinedType::PT_void;
+ break;
+ case AST_Expression::EV_string:
+ case AST_Expression::EV_wstring:
+ case AST_Expression::EV_none:
+ return NULL;
+ }
+ i = new UTL_ScopeActiveIterator(this, UTL_Scope::IK_decls);
+ while (!(i->is_done())) {
+ as_decl = i->item();
+ if (as_decl->node_type() == AST_Decl::NT_pre_defined) {
+ t = AST_PredefinedType::narrow_from_decl(as_decl);
+ if (t == NULL) {
+ i->next();
+ continue;
+ }
+ if (t->pt() == pdt) {
+ delete i;
+ return t;
+ }
+ }
+ i->next();
+ }
+ delete i;
+ return NULL;
+}
+
+/*
+ * Look through inherited interfaces
+ */
+AST_Decl *
+UTL_Scope::look_in_inherited(UTL_ScopedName *e, idl_bool treat_as_ref)
+{
+ AST_Decl *d = NULL;
+ AST_Interface *i = AST_Interface::narrow_from_scope(this);
+ AST_Interface **is;
+ long nis;
+
+ /*
+ * This scope is not an interface..
+ */
+ if (i == NULL)
+ return NULL;
+ /*
+ * Can't look in an interface which was not yet defined
+ */
+ if (!i->is_defined()) {
+ idl_global->err()->fwd_decl_lookup(i, e);
+ return NULL;
+ }
+ /*
+ * OK, loop through inherited interfaces. Stop when you find it
+ */
+ for (nis = i->n_inherits(), is = i->inherits(); nis > 0; nis--, is++) {
+ d = (*is)->lookup_by_name(e, treat_as_ref);
+ if (d != NULL)
+ return d;
+ }
+ /*
+ * Not found
+ */
+ return NULL;
+}
+
+/*
+ * Look up a String * in local scope only
+ */
+AST_Decl *
+UTL_Scope::lookup_by_name_local(Identifier *e, idl_bool)
+{
+ UTL_ScopeActiveIterator *i = new UTL_ScopeActiveIterator(this,
+ UTL_Scope::IK_both);
+ AST_Decl *d;
+ AST_InterfaceFwd *fwd;
+
+ /*
+ * Iterate over this scope
+ */
+ while (!(i->is_done())) {
+ d = i->item();
+ if (d->local_name() != NULL && d->local_name()->compare(e)) {
+ delete i;
+ /*
+ * 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) {
+ fwd = AST_InterfaceFwd::narrow_from_decl(d);
+ if (fwd == NULL)
+ d = NULL;
+ else
+ d = fwd->full_definition();
+ }
+ return d;
+ }
+ i->next();
+ }
+ /*
+ * OK, not found, return NULL
+ */
+ return NULL;
+}
+
+/*
+ * Implements lookup by name for scoped names
+ */
+AST_Decl *
+UTL_Scope::lookup_by_name(UTL_ScopedName *e, idl_bool treat_as_ref)
+{
+ AST_Decl *d;
+ UTL_Scope *t = NULL;
+
+ /*
+ * Empty name? error
+ */
+ if (e == NULL) {
+ return NULL;
+ }
+ /*
+ * If name starts with "::" or "" start look up in global scope
+ */
+ if (is_global_name(e->head())) {
+ /*
+ * Get parent scope
+ */
+ d = ScopeAsDecl(this);
+ if (d == NULL)
+ return NULL;
+ t = d->defined_in();
+ /*
+ * If this is the global scope..
+ */
+ if (t == NULL) {
+ /*
+ * Look up tail of name starting here
+ */
+ d = lookup_by_name((UTL_ScopedName *) e->tail(), treat_as_ref);
+ /*
+ * Now return whatever we have
+ */
+ return d;
+ }
+ /*
+ * OK, not global scope yet, so simply iterate with parent scope
+ */
+ d = t->lookup_by_name(e, treat_as_ref);
+ /*
+ * If treat_as_ref is true and d is not NULL, add d to
+ * set of nodes referenced here
+ */
+ if (treat_as_ref && d != NULL)
+ add_to_referenced(d, I_FALSE);
+ /*
+ * Now return what we have
+ */
+ return d;
+ }
+ /*
+ * The name does not start with "::"
+ *
+ * Is name defined here?
+ */
+ d = lookup_by_name_local(e->head(), treat_as_ref);
+ if (d == NULL) {
+ /*
+ * OK, not found. Go down parent scope chain.
+ */
+ d = ScopeAsDecl(this);
+ if (d != NULL) {
+ t = d->defined_in();
+ if (t == NULL)
+ d = NULL;
+ else
+ d = t->lookup_by_name(e, treat_as_ref);
+ }
+ /*
+ * Special case for scope which is an interface. We have to look
+ * in the inherited interfaces as well..
+ */
+ if (d == NULL) {
+ if (pd_scope_node_type == AST_Decl::NT_interface)
+ d = look_in_inherited(e, treat_as_ref);
+ }
+ /*
+ * If treat_as_ref is true and d is not NULL, add d to
+ * set of nodes referenced here
+ */
+ if (treat_as_ref && d != NULL)
+ add_to_referenced(d, I_FALSE);
+ /*
+ * OK, now return whatever we found
+ */
+ return d;
+ }
+ /*
+ * OK, start of name is defined. Now loop doing local lookups
+ * of subsequent elements of the name
+ */
+ d = iter_lookup_by_name_local(d, e, treat_as_ref);
+ /*
+ * If treat_as_ref is true and d is not NULL, add d to set
+ * of nodes referenced here.
+ */
+ if (treat_as_ref && d != NULL)
+ add_to_referenced(d, I_FALSE);
+ /*
+ * All OK, name fully resolved
+ */
+ return d;
+}
+
+// Add a node to set of nodes referenced in this scope
+void
+UTL_Scope::add_to_referenced(AST_Decl *e, idl_bool recursive)
+{
+ UTL_Scope *s;
+ AST_Decl **tmp;
+ AST_Interface *itf;
+ long oreferenced_allocated;
+ long i;
+
+ if (e == NULL) return;
+
+ // 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) {
+ itf = AST_Interface::narrow_from_decl(e);
+ if (itf != NULL && itf->defined_in() == this && !itf->is_defined())
+ return;
+ }
+ // Only insert if it is not there already
+ if (referenced(e))
+ return;
+
+ // Make sure there's space for one more
+ if (pd_referenced_allocated == pd_referenced_used) {
+
+ oreferenced_allocated = pd_referenced_allocated;
+ pd_referenced_allocated += INCREMENT;
+ tmp = new AST_Decl *[pd_referenced_allocated];
+
+ for (i = 0; i < oreferenced_allocated; i++)
+ tmp[i] = pd_referenced[i];
+
+ delete pd_referenced;
+
+ pd_referenced = tmp;
+ }
+
+ // Insert new reference
+ pd_referenced[pd_referenced_used++] = e;
+
+ // Now, if recursive is specified and "this" is not a common ancestor
+ // of the referencing scope and the scope of definition of "e" then
+ // add "e" to the set of referenced nodes in the parent of "this"
+ if (recursive && !(e->has_ancestor(ScopeAsDecl(this)))) {
+ s = e->defined_in();
+ if (s != NULL)
+ s->add_to_referenced(e, recursive);
+ }
+}
+
+// Add a node to set of nodes declared in this scope
+void
+UTL_Scope::add_to_scope(AST_Decl *e)
+{
+ AST_Decl **tmp;
+ long odecls_allocated;
+ long i;
+
+ if (e == NULL) return;
+
+ // Make sure there's space for one more
+ if (pd_decls_allocated == pd_decls_used) {
+
+ odecls_allocated = pd_decls_allocated;
+ pd_decls_allocated += INCREMENT;
+ tmp = new AST_Decl *[pd_decls_allocated];
+
+ for (i = 0; i < odecls_allocated; i++)
+ tmp[i] = pd_decls[i];
+
+ delete pd_decls;
+
+ pd_decls = tmp;
+ }
+
+ // Insert new decl
+ pd_decls[pd_decls_used++] = e;
+}
+
+// Add a node to set of nodes representing manifest types defined in this scope
+void
+UTL_Scope::add_to_local_types(AST_Decl *e)
+{
+ AST_Decl **tmp;
+ long olocals_allocated;
+ long i;
+
+ if (e == NULL) return;
+
+ // Make sure there's space for one more
+ if (pd_locals_allocated == pd_locals_used) {
+
+ olocals_allocated = pd_locals_allocated;
+ pd_locals_allocated += INCREMENT;
+ tmp = new AST_Decl *[pd_locals_allocated];
+
+ for (i = 0; i < olocals_allocated; i++)
+ tmp[i] = pd_local_types[i];
+
+ delete pd_local_types;
+
+ pd_local_types = tmp;
+ }
+
+ // Insert new decl
+ pd_local_types[pd_locals_used++] = e;
+}
+
+// Has this node been referenced here before?
+idl_bool
+UTL_Scope::referenced(AST_Decl *e)
+{
+ long i = pd_referenced_used;
+ AST_Decl **tmp = pd_referenced;
+
+ for (; i > 0; i--, tmp++)
+ if (*tmp == e) // Same node?
+ return I_TRUE;
+
+ return I_FALSE; // Not found
+}
+
+/*
+ * Redefinition of inherited virtual operations
+ */
+
+// AST Dumping
+void
+UTL_Scope::dump(ostream &o)
+{
+ UTL_ScopeActiveIterator *i;
+ AST_Decl *d;
+
+ if (idl_global->indent() == NULL)
+ idl_global->set_indent(new UTL_Indenter());
+
+ idl_global->indent()->increase();
+
+ if (pd_locals_used > 0) {
+ i = new UTL_ScopeActiveIterator(this, UTL_Scope::IK_localtypes);
+
+ o << GTDEVEL("\n/* Locally defined types: */\n");
+ while (!(i->is_done())) {
+ d = i->item();
+ if (!d->imported()) {
+ idl_global->indent()->skip_to(o);
+ d->dump(o);
+ o << "\n";
+ }
+ i->next();
+ }
+ delete i;
+ }
+
+ if (pd_decls_used > 0) {
+ i = new UTL_ScopeActiveIterator(this, UTL_Scope::IK_decls);
+
+ o << GTDEVEL("\n/* Declarations: */\n");
+ while (!(i->is_done())) {
+ d = i->item();
+ if (!d->imported()) {
+ idl_global->indent()->skip_to(o);
+ d->dump(o);
+ o << ";\n";
+ }
+ i->next();
+ }
+ delete i;
+ }
+
+ idl_global->indent()->decrease();
+}
+
+// How many entries are defined?
+unsigned long
+UTL_Scope::nmembers()
+{
+ return pd_decls_used;
+}
+
+// UTL_SCOPE_ACTIVE_ITERATOR
+
+/*
+ * Constructor
+ */
+
+UTL_ScopeActiveIterator::UTL_ScopeActiveIterator(
+ UTL_Scope *s,
+ UTL_Scope::ScopeIterationKind i)
+ : iter_source(s),
+ ik(i),
+ il(0),
+ stage(i == UTL_Scope::IK_both
+ ? UTL_Scope::IK_decls
+ : i)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Advance to next iterm
+void
+UTL_ScopeActiveIterator::next()
+{
+ il++;
+}
+
+// Get current item
+AST_Decl *
+UTL_ScopeActiveIterator::item()
+{
+ if (is_done())
+ return NULL;
+ if (stage == UTL_Scope::IK_decls)
+ return iter_source->pd_decls[il];
+ if (stage == UTL_Scope::IK_localtypes)
+ return iter_source->pd_local_types[il];
+
+ return NULL;
+}
+
+// Is this iteration done?
+idl_bool
+UTL_ScopeActiveIterator::is_done()
+{
+ long limit;
+
+ limit = (stage == UTL_Scope::IK_decls)
+ ? iter_source->pd_decls_used
+ : iter_source->pd_locals_used;
+
+ for (;;) {
+ if (il < limit) // Last element?
+ return I_FALSE;
+ if (stage == UTL_Scope::IK_localtypes) // Already done local types?
+ return I_TRUE;
+ if (ik == UTL_Scope::IK_decls) // Only want decls?
+ return I_TRUE;
+
+ // Switch to next stage
+ stage = UTL_Scope::IK_localtypes;
+ il = 0;
+ limit = iter_source->pd_locals_used;
+ }
+}
+
+// What kind of iterator is this?
+UTL_Scope::ScopeIterationKind
+UTL_ScopeActiveIterator::iteration_kind()
+{
+ return ik;
+}
+
+// And where are we in the iteration?
+UTL_Scope::ScopeIterationKind
+UTL_ScopeActiveIterator::iteration_stage()
+{
+ return stage;
+}
diff --git a/TAO/TAO_IDL/util/utl_stack.cpp b/TAO/TAO_IDL/util/utl_stack.cpp
new file mode 100644
index 00000000000..d8f45089da9
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_stack.cpp
@@ -0,0 +1,254 @@
+/*
+
+COPYRIGHT
+
+Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
+States of America. All Rights Reserved.
+
+This product is protected by copyright and distributed under the following
+license restricting its use.
+
+The Interface Definition Language Compiler Front End (CFE) is made
+available for your use provided that you include this license and copyright
+notice on all media and documentation and the software program in which
+this product is incorporated in whole or part. You may copy and extend
+functionality (but may not remove functionality) of the Interface
+Definition Language CFE without charge, but you are not authorized to
+license or distribute it to anyone else except as part of a product or
+program developed by you or with the express written consent of Sun
+Microsystems, Inc. ("Sun").
+
+The names of Sun Microsystems, Inc. and any of its subsidiaries or
+affiliates may not be used in advertising or publicity pertaining to
+distribution of Interface Definition Language CFE as permitted herein.
+
+This license is effective until terminated by Sun for failure to comply
+with this license. Upon termination, you shall destroy or return all code
+and documentation for the Interface Definition Language CFE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
+DEALING, USAGE OR TRADE PRACTICE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
+ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
+TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
+
+SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
+RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
+INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
+
+IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
+ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
+DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Use, duplication, or disclosure by the government is subject to
+restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
+Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
+52.227-19.
+
+Sun, Sun Microsystems and the Sun logo are trademarks or registered
+trademarks of Sun Microsystems, Inc.
+
+SunSoft, Inc.
+2550 Garcia Avenue
+Mountain View, California 94043
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+ */
+
+#pragma ident "%@(#)utl_stack.cc 1.36% %92/06/10% Sun Microsystems"
+
+/*
+ * utl_stack.cc - Implementation of class UTL_ScopeStack
+ */
+
+#include "idl.h"
+#include "idl_extern.h"
+
+// Class UTL_ScopeStack
+
+#undef INCREMENT
+#define INCREMENT 64
+
+/*
+ * Constructor(s) and destructor
+ */
+
+UTL_ScopeStack::UTL_ScopeStack()
+ : pd_stack_data_nalloced(INCREMENT),
+ pd_stack_data(new UTL_Scope *[INCREMENT]),
+ pd_stack_top(0)
+{
+}
+
+UTL_ScopeStack::~UTL_ScopeStack()
+{
+ if (pd_stack_data != NULL)
+ delete pd_stack_data;
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Push an element on the stack
+UTL_ScopeStack *
+UTL_ScopeStack::push(UTL_Scope *el)
+{
+ UTL_Scope **tmp;
+ AST_Decl *d = ScopeAsDecl(el);
+ long ostack_data_nalloced;
+ long i;
+
+ // Make sure there's space for one more
+ if (pd_stack_data_nalloced == pd_stack_top) {
+ ostack_data_nalloced = pd_stack_data_nalloced;
+ pd_stack_data_nalloced += INCREMENT;
+ tmp = new UTL_Scope *[pd_stack_data_nalloced];
+
+ for (i = 0; i < ostack_data_nalloced; i++)
+ tmp[i] = pd_stack_data[i];
+
+ delete pd_stack_data;
+ pd_stack_data = tmp;
+ }
+
+ // Insert new scope
+ pd_stack_data[pd_stack_top++] = el;
+
+ return this;
+}
+
+// Pop an element from the stack
+void
+UTL_ScopeStack::pop()
+{
+ UTL_Scope *s;
+
+ if (pd_stack_top <= 0)
+ return;
+ s = pd_stack_data[--pd_stack_top];
+}
+
+// Return top element on stack
+UTL_Scope *
+UTL_ScopeStack::top()
+{
+ if (pd_stack_top <= 0)
+ return NULL;
+ return pd_stack_data[pd_stack_top - 1];
+}
+
+// Return bottom element on stack
+UTL_Scope *
+UTL_ScopeStack::bottom()
+{
+ if (pd_stack_top == 0)
+ return NULL;
+ return pd_stack_data[0];
+}
+
+// Clear entire stack
+void
+UTL_ScopeStack::clear()
+{
+ pd_stack_top = 0;
+}
+
+// How deep is the stack?
+unsigned long
+UTL_ScopeStack::depth()
+{
+ return pd_stack_top;
+}
+
+// Return (top - 1) element on stack
+UTL_Scope *
+UTL_ScopeStack::next_to_top()
+{
+ UTL_Scope *tmp, *retval;
+
+ if (depth() < 2)
+ return NULL;
+
+ 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
+UTL_Scope *
+UTL_ScopeStack::top_non_null()
+{
+ long i;
+
+ for (i = pd_stack_top - 1; i >= 0; i--)
+ if (pd_stack_data[i] != NULL)
+ return pd_stack_data[i];
+ return NULL;
+}
+
+/*
+ * 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)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Advance to next item
+void
+UTL_ScopeStackActiveIterator::next()
+{
+ il--;
+}
+
+// Get current item
+UTL_Scope *
+UTL_ScopeStackActiveIterator::item()
+{
+ if (il >= 0)
+ return source->pd_stack_data[il];
+ return NULL;
+}
+
+// Is this iteration done?
+long
+UTL_ScopeStackActiveIterator::is_done()
+{
+ if (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
new file mode 100644
index 00000000000..18aa761e12d
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_string.cpp
@@ -0,0 +1,196 @@
+/*
+
+COPYRIGHT
+
+Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
+States of America. All Rights Reserved.
+
+This product is protected by copyright and distributed under the following
+license restricting its use.
+
+The Interface Definition Language Compiler Front End (CFE) is made
+available for your use provided that you include this license and copyright
+notice on all media and documentation and the software program in which
+this product is incorporated in whole or part. You may copy and extend
+functionality (but may not remove functionality) of the Interface
+Definition Language CFE without charge, but you are not authorized to
+license or distribute it to anyone else except as part of a product or
+program developed by you or with the express written consent of Sun
+Microsystems, Inc. ("Sun").
+
+The names of Sun Microsystems, Inc. and any of its subsidiaries or
+affiliates may not be used in advertising or publicity pertaining to
+distribution of Interface Definition Language CFE as permitted herein.
+
+This license is effective until terminated by Sun for failure to comply
+with this license. Upon termination, you shall destroy or return all code
+and documentation for the Interface Definition Language CFE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
+DEALING, USAGE OR TRADE PRACTICE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
+ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
+TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
+
+SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
+RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
+INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
+
+IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
+ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
+DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Use, duplication, or disclosure by the government is subject to
+restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
+Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
+52.227-19.
+
+Sun, Sun Microsystems and the Sun logo are trademarks or registered
+trademarks of Sun Microsystems, Inc.
+
+SunSoft, Inc.
+2550 Garcia Avenue
+Mountain View, California 94043
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+ */
+
+#pragma ident "%@(#)utl_string.cc 1.20% %92/06/10% Sun Microsystems"
+
+// utl_string.cc - Implementation of quick and dirty TEMPORARY String
+// for IDL compiler
+
+#include "idl.h"
+#include "idl_extern.h"
+
+/*
+ * Constructors
+ */
+
+UTL_String::UTL_String() : p_str(NULL), len(0), alloced(0) {}
+
+UTL_String::UTL_String(char *str)
+{
+ if (str == NULL) {
+ len = alloced = 0;
+ p_str = c_str = NULL;
+ } else {
+ len = strlen(str);
+ alloced = len + 1;
+ p_str = new char [alloced];
+ c_str = new char [alloced];
+ strcpy(p_str, str);
+ canonicalize();
+ }
+}
+
+UTL_String::UTL_String(unsigned long maxlen)
+{
+ len = maxlen;
+ alloced = maxlen + 1;
+ p_str = new char [alloced];
+ c_str = new char [alloced];
+ p_str[0] = '\0';
+ c_str[0] = '\0';
+}
+
+UTL_String::UTL_String(UTL_String *s)
+{
+ char *b;
+
+ if (s == NULL) {
+ p_str = c_str = NULL;
+ alloced = len = 0;
+ } else {
+ b = s->get_string();
+ if (b == NULL) {
+ p_str = c_str = NULL;
+ alloced = len = 0;
+ } else {
+ len = strlen(b);
+ alloced = len + 1;
+ p_str = new char [alloced];
+ c_str = new char [alloced];
+ strcpy(p_str, b);
+ canonicalize();
+ }
+ }
+}
+
+/*
+ * 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
+void
+UTL_String::canonicalize()
+{
+ long i;
+
+ for (i = 0; i < len; i++)
+ c_str[i] = isalpha(p_str[i]) ? toupper(p_str[i]) : p_str[i];
+ c_str[i] = '\0';
+}
+
+/*
+ * Public operations
+ */
+
+// Compare two String *
+long
+UTL_String::compare(UTL_String *s)
+{
+ char *s_c_str;
+ long result;
+
+ if (c_str == NULL || s == NULL || (s_c_str = s->get_canonical_rep()) == NULL)
+ result = I_FALSE;
+ else
+ result = (strcmp(c_str, s_c_str) == 0) ? I_TRUE : I_FALSE;
+
+ /*
+ * Check that the names are typed consistently
+ */
+ if (result == I_TRUE && strcmp(p_str, s->get_string()) != 0)
+ idl_global->err()->name_case_error(p_str, s->get_string());
+
+ return result;
+}
+
+// Get the char * from a String
+char *
+UTL_String::get_string()
+{
+ return p_str;
+}
+
+// Get the canonical representation from a String
+char *
+UTL_String::get_canonical_rep()
+{
+ if (c_str == NULL) {
+ c_str = new char [alloced];
+ canonicalize();
+ }
+ return c_str;
+}
+
+/*
+ * Redefined virtual operations
+ */
+
+// AST Dumping
+void
+UTL_String::dump(ostream &o)
+{
+ o << p_str;
+}
diff --git a/TAO/TAO_IDL/util/utl_strlist.cpp b/TAO/TAO_IDL/util/utl_strlist.cpp
new file mode 100644
index 00000000000..4d3237e0a70
--- /dev/null
+++ b/TAO/TAO_IDL/util/utl_strlist.cpp
@@ -0,0 +1,196 @@
+/*
+
+COPYRIGHT
+
+Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
+States of America. All Rights Reserved.
+
+This product is protected by copyright and distributed under the following
+license restricting its use.
+
+The Interface Definition Language Compiler Front End (CFE) is made
+available for your use provided that you include this license and copyright
+notice on all media and documentation and the software program in which
+this product is incorporated in whole or part. You may copy and extend
+functionality (but may not remove functionality) of the Interface
+Definition Language CFE without charge, but you are not authorized to
+license or distribute it to anyone else except as part of a product or
+program developed by you or with the express written consent of Sun
+Microsystems, Inc. ("Sun").
+
+The names of Sun Microsystems, Inc. and any of its subsidiaries or
+affiliates may not be used in advertising or publicity pertaining to
+distribution of Interface Definition Language CFE as permitted herein.
+
+This license is effective until terminated by Sun for failure to comply
+with this license. Upon termination, you shall destroy or return all code
+and documentation for the Interface Definition Language CFE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
+ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
+DEALING, USAGE OR TRADE PRACTICE.
+
+INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
+ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
+TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
+
+SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
+RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
+INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
+
+IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
+ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
+DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Use, duplication, or disclosure by the government is subject to
+restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
+Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
+52.227-19.
+
+Sun, Sun Microsystems and the Sun logo are trademarks or registered
+trademarks of Sun Microsystems, Inc.
+
+SunSoft, Inc.
+2550 Garcia Avenue
+Mountain View, California 94043
+
+NOTE:
+
+SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
+trademarks or registered trademarks of Sun Microsystems, Inc.
+
+ */
+
+#pragma ident "%@(#)utl_strlist.cc 1.34% %92/06/10% Sun Microsystems"
+
+// utl_strlist.cc
+//
+// 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.
+//
+// For portability reasons we have decided to provide both this and
+// an implementation of the list classes in terms of templates. If
+// your compiler supports templates, please use the files in the
+// include/utl_tmpl and util/utl_tmpl directories instead of the
+// files by the same names in the include and util directories.
+
+#include "idl.h"
+#include "idl_extern.h"
+
+/*
+ * Constructor(s)
+ */
+
+UTL_StrList::UTL_StrList(String *s, UTL_StrList *cdr)
+ : pd_car_data(s),
+ UTL_List(cdr)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Get list item
+String *
+UTL_StrList::head()
+{
+ return pd_car_data;
+}
+
+// Set list item
+void
+UTL_StrList::set_head(String *s)
+{
+ pd_car_data = s;
+}
+
+// Get last item of this list
+String *
+UTL_StrList::last_component()
+{
+ if (tail() == NULL)
+ return pd_car_data;
+ return ((UTL_StrList *) tail())->last_component();
+}
+
+// Copy a list
+UTL_List *
+UTL_StrList::copy()
+{
+ if (tail() == NULL)
+ return new UTL_StrList(head(), NULL);
+ return new UTL_StrList(head(), (UTL_StrList *) tail()->copy());
+}
+
+// AST Dumping
+void
+UTL_StrList::dump(ostream &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;
+ }
+ i->next();
+ }
+}
+
+/*
+ * Redefinition of inherited virtual operations
+ */
+
+// UTL_StrList active iterator
+
+/*
+ * Constructor
+ */
+
+UTL_StrlistActiveIterator::UTL_StrlistActiveIterator(UTL_StrList *s)
+ : UTL_ListActiveIterator(s)
+{
+}
+
+/*
+ * Private operations
+ */
+
+/*
+ * Public operations
+ */
+
+// Get current item
+String *
+UTL_StrlistActiveIterator::item()
+{
+ if (source == NULL)
+ return NULL;
+ return ((UTL_StrList *) source)->head();
+}
+
+/*
+ * Redefinition of inherited virtual operations
+ */