diff options
-rw-r--r-- | TAO/TAO_IDL/fe/Makefile | 282 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/fe_declarator.cpp | 159 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/fe_extern.cpp | 121 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/fe_init.cpp | 369 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/fe_interface_header.cpp | 284 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/fe_private.cpp | 80 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/idl.ll | 485 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/idl.yy | 2189 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/lex.yy.cpp | 2270 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/y.tab.cpp | 3185 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/y.tab.h | 76 |
11 files changed, 9500 insertions, 0 deletions
diff --git a/TAO/TAO_IDL/fe/Makefile b/TAO/TAO_IDL/fe/Makefile new file mode 100644 index 00000000000..50116229499 --- /dev/null +++ b/TAO/TAO_IDL/fe/Makefile @@ -0,0 +1,282 @@ +#---------------------------------------------------------------------------- +# $Id$ +# +# Makefile for libfe +#---------------------------------------------------------------------------- + +MAKEFILE = Makefile +LIBNAME = libfe +LIB = $(LIBNAME).a +SHLIB = $(LIBNAME).so +IDL_CFE_VERSION = \"1.3.0\" + +# These are components that are sources of +FE_FILES = \ + fe_declarator \ + fe_private \ + fe_init \ + fe_extern \ + fe_interface_header + +OTHER_FILES = \ + y.tab \ + lex.yy + +FILES = $(FE_FILES) $(OTHER_FILES) + +LSRC = $(addsuffix .cpp,$(FILES)) +LHDR = $(addsuffix .h,$(HDRS)) +LOBJ = $(addsuffix .o,$(FILES)) +SHOBJ = $(addsuffix .so,$(FILES)) + + +LDLIBS = -lfe +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) +YACC = yacc +LEX = lex +YFLAGS = -t -d +LFLAGS = -t +# Create the parser and lexer +y.tab.hh y.tab.cpp: idl.yy + @-$(RM) $@ + $(YACC) $(YFLAGS) idl.yy + mv -f y.tab.c y.tab.cpp + +lex.yy.cpp: idl.ll y.tab.h + $(LEX) $(LFLAGS) idl.ll > $@ + + +#---------------------------------------------------------------------------- +# Dependencies +#---------------------------------------------------------------------------- + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + +.obj/fe_declarator.o .shobj/fe_declarator.so: fe_declarator.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 \ + ../include/fe_private.h ../include/fe_interface_header.h \ + ../include/fe_declarator.h +.obj/fe_private.o .shobj/fe_private.so: fe_private.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 \ + ../include/fe_private.h ../include/fe_interface_header.h \ + ../include/fe_declarator.h +.obj/fe_init.o .shobj/fe_init.so: fe_init.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 \ + ../include/fe_private.h ../include/fe_interface_header.h \ + ../include/fe_declarator.h +.obj/fe_extern.o .shobj/fe_extern.so: fe_extern.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 \ + ../include/fe_private.h ../include/fe_interface_header.h \ + ../include/fe_declarator.h +.obj/fe_interface_header.o .shobj/fe_interface_header.so: fe_interface_header.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 \ + ../include/fe_private.h ../include/fe_interface_header.h \ + ../include/fe_declarator.h +.obj/y.tab.o .shobj/y.tab.so: y.tab.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 \ + ../include/fe_private.h ../include/fe_interface_header.h \ + ../include/fe_declarator.h +.obj/lex.yy.o .shobj/lex.yy.so: lex.yy.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 \ + ../include/fe_private.h ../include/fe_interface_header.h \ + ../include/fe_declarator.h + +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/TAO_IDL/fe/fe_declarator.cpp b/TAO/TAO_IDL/fe/fe_declarator.cpp new file mode 100644 index 00000000000..23cd6188ebc --- /dev/null +++ b/TAO/TAO_IDL/fe/fe_declarator.cpp @@ -0,0 +1,159 @@ +/* + +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 "%@(#)fe_declarator.cc 1.30% %92/06/10% Sun Microsystems" + +/* + * fe_declarator.cc - Implementation of FE private declaration + * statement class + * + * The FE_Declarator class is used to hold together complex declarations + * until all the components are parsed and before they are composed into + * an AST_Type node. + */ + +#include "idl.h" +#include "idl_extern.h" + +#include "fe_private.h" + +/* + * Constructor(s) and destructor + */ + +FE_Declarator::FE_Declarator(UTL_ScopedName *n, DeclaratorType dt, + AST_Decl *cp) + : pd_name(n), + pd_complex_part(cp), + pd_decl_type(dt) +{ +} + +/* + * Private operations + */ + +/* + * Public operations + */ + +// Compose the type of the complex declarator (if any) with the base +// type supplied in ct +AST_Type * +FE_Declarator::compose(AST_Decl *d) +{ + AST_Array *arr; + AST_Type *ct; + + ct = AST_Type::narrow_from_decl(d); + if (ct == NULL) { + idl_global->err()->not_a_type(d); + return NULL; + } + if (ct->node_type() == AST_Decl::NT_except) { + idl_global->err()->not_a_type(d); + return NULL; + } + if (pd_decl_type == FD_simple || pd_complex_part == NULL) { + return ct; + } + if (pd_complex_part->node_type() == AST_Decl::NT_array) { + arr = AST_Array::narrow_from_decl(pd_complex_part); + arr->set_base_type(ct); + + /* + * Add the new array to the types defined in the global scope + */ + idl_global->root()->fe_add_array(arr); + + return arr; + } + return NULL; // return through this statement should not happen +} + +/* + * Redefinition of inherited virtual operations + */ + +/* + * Data accessors + */ + +AST_Decl * +FE_Declarator::complex_part() +{ + return pd_complex_part; +} + +UTL_ScopedName * +FE_Declarator::name() +{ + return pd_name; +} + +FE_Declarator::DeclaratorType +FE_Declarator::decl_type() +{ + return pd_decl_type; +} diff --git a/TAO/TAO_IDL/fe/fe_extern.cpp b/TAO/TAO_IDL/fe/fe_extern.cpp new file mode 100644 index 00000000000..4dd395684bc --- /dev/null +++ b/TAO/TAO_IDL/fe/fe_extern.cpp @@ -0,0 +1,121 @@ +/* + +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. + + */ + +/* + * fe_extern.cc - export FE interfaces to driver + */ + +#include "idl.h" +#include "idl_extern.h" + +#include "fe_private.h" + +#include "utl_error.h" +#include "utl_indenter.h" +#include "utl_string.h" + +/* + * yacc parser interface + */ + +extern int yyparse(); +extern File * yyin; + +int +FE_yyparse() +{ + int result = yyparse(); + if (idl_global->err_count() == 0) { + idl_global->root()->call_add(); + } + return result; +} + +void +FE_set_yyin(File * f) +{ + yyin = f; +} + +/* + * constructor interfaces + */ + +UTL_Error * +FE_new_UTL_Error() +{ + return new UTL_Error(); +} + +UTL_Indenter * +FE_new_UTL_Indenter() +{ + return new UTL_Indenter(); +} + +UTL_String * +FE_new_UTL_String(char * str) +{ + return new UTL_String(str); +} diff --git a/TAO/TAO_IDL/fe/fe_init.cpp b/TAO/TAO_IDL/fe/fe_init.cpp new file mode 100644 index 00000000000..b6ba87da25d --- /dev/null +++ b/TAO/TAO_IDL/fe/fe_init.cpp @@ -0,0 +1,369 @@ +/* + +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 "%@(#)fe_init.cc 1.21% %92/06/10% Sun Microsystems" + +/* + * fe_init.cc - Initialize the FE + * + * The FE initialization is carried out in two stages, with the BE + * initialization protocol sandwiched between the two stages. + * + * The first stage is responsible for creating the scopes stack. + * The second stage is run after the BE initialization has created + * and returned an instance of AST_Generator (or a subclass). This + * instance is used to create the root node for the AST, and to + * populate it with AST_PredefinedType nodes which represent the + * predefined IDL types. This AST root is then pushed on the scopes + * stack as the outermost scope. + */ + +#include "idl.h" +#include "idl_extern.h" + +#include "fe_private.h" + +/* + * Create a scoped name + */ +static UTL_ScopedName * +create_scoped_name(char *s) +{ + return new UTL_ScopedName(new Identifier(s, 1, 0, I_FALSE), NULL); +} + +/* + * Populate the global scope with all predefined entities + */ +void +fe_populate(AST_Module *m) +{ + AST_PredefinedType *pdt; + + pdt = idl_global->gen()->create_predefined_type(AST_PredefinedType::PT_long, + create_scoped_name("long"), + NULL); + m->fe_add_predefined_type(pdt); + + pdt = + idl_global->gen()->create_predefined_type(AST_PredefinedType::PT_ulong, + create_scoped_name("unsigned long"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = + idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_longlong, + create_scoped_name("long long"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = + idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_ulonglong, + create_scoped_name("unsigned long long"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen()->create_predefined_type(AST_PredefinedType::PT_short, + create_scoped_name("short"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = + idl_global->gen()->create_predefined_type(AST_PredefinedType::PT_ushort, + create_scoped_name("unsigned short"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen()->create_predefined_type(AST_PredefinedType::PT_float, + create_scoped_name("float"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = + idl_global->gen()->create_predefined_type(AST_PredefinedType::PT_double, + create_scoped_name("double"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = + idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_longdouble, + create_scoped_name("long double"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen()->create_predefined_type(AST_PredefinedType::PT_char, + create_scoped_name("char"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = + idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_wchar, + create_scoped_name("wchar_t"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen()->create_predefined_type(AST_PredefinedType::PT_octet, + create_scoped_name("octet"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen()->create_predefined_type(AST_PredefinedType::PT_any, + create_scoped_name("any"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = + idl_global->gen()->create_predefined_type(AST_PredefinedType::PT_boolean, + create_scoped_name("boolean"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen()->create_predefined_type(AST_PredefinedType::PT_void, + create_scoped_name("void"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("Object"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("TypeCode"), + NULL); + m->fe_add_predefined_type(pdt); + + /* + * Add these to make all keywords protected even in different spellings + */ + + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("attribute"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("case"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("const"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("context"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("default"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("enum"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("exception"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("in"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("out"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("inout"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("interface"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("module"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("oneway"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("raises"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("readonly"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("sequence"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("string"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("wstring_t"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("struct"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("switch"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("typedef"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("union"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("unsigned"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("TRUE"), + NULL); + m->fe_add_predefined_type(pdt); + pdt = idl_global->gen() + ->create_predefined_type(AST_PredefinedType::PT_pseudo, + create_scoped_name("FALSE"), + NULL); + m->fe_add_predefined_type(pdt); +} + +/* + * Initialization stage 1: create global scopes stack + */ +void +FE_init_stage1() +{ + idl_global->set_scopes(new UTL_ScopeStack()); + if (idl_global->scopes() == NULL) { + cerr << GTDEVEL("IDL: FE init failed to create scope stack, exiting\n"); + exit(99); + } +} + +/* + * Initialization stage 2: create global scope and populate it + */ +void +FE_init_stage2() +{ + AST_Root *r; + + /* + * Check that the BE init created a generator object + */ + if (idl_global->gen() == NULL) { + cerr << GTDEVEL("IDL: BE did not initialize idl_global->gen(), exiting\n"); + exit(99); + } + /* + * Create a global root for the AST. Note that the AST root has no + * name + */ + r = idl_global->gen()->create_root(create_scoped_name(""), NULL); + idl_global->set_root(r); + if (r == NULL) { + cerr << GTDEVEL("IDL: FE init failed to create AST root, exiting\n"); + exit(99); + } + /* + * Push it on the stack + */ + idl_global->scopes()->push(idl_global->root()); + /* + * Populate it with nodes for predefined types + */ + fe_populate(idl_global->root()); + /* + * Set flag to indicate we are processing the main file now + */ + idl_global->set_in_main_file(I_TRUE); +} diff --git a/TAO/TAO_IDL/fe/fe_interface_header.cpp b/TAO/TAO_IDL/fe/fe_interface_header.cpp new file mode 100644 index 00000000000..c4dd47b867c --- /dev/null +++ b/TAO/TAO_IDL/fe/fe_interface_header.cpp @@ -0,0 +1,284 @@ +/* + +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 "%@(#)fe_interface_header.cc 1.30% %92/06/10% Sun Microsystems" + +/* + * fe_interface_header.cc - Implements the FE private class FE_InterfaceHeader + * + * FE_InterfaceHeader instances are used to store information about an + * interface header as the interface is being parsed and before the + * AST_Interface node used to represent this interface is created. + */ + +#include "idl.h" +#include "idl_extern.h" + +#include "fe_private.h" + +/* + * Constructor(s) and destructor + */ + +FE_InterfaceHeader::FE_InterfaceHeader(UTL_ScopedName *n, UTL_NameList *nl) + : pd_interface_name(n) +{ + compile_inheritance(nl); +} + +/* + * Private operations + */ + +// Compute flattened, non-repeating list of inherited interfaces + +#undef INCREMENT +#define INCREMENT 512 + +/* + * Private storage used to store interfaces seen already in the + * computation of the unique, flattened inheritance list + */ +static AST_Interface **iseen = NULL; +static long iallocated = 0; +static long iused = 0; + +/* + * Add an interface to an inheritance spec + */ +static void +add_inheritance(AST_Interface *i) +{ + long oiallocated; + long k; + AST_Interface **oiseen; + + /* + * Make sure there's space for one more + */ + if (iallocated == iused) { + if (iallocated == 0) { + iallocated = INCREMENT; + iseen = new AST_Interface *[iallocated]; + } else { + oiallocated = iallocated; + oiseen = iseen; + iallocated += INCREMENT; + iseen = new AST_Interface *[iallocated]; + for (k = 0; k < iused; k++) + iseen[k] = oiseen[k]; + delete oiseen; + } + } + /* + * OK, now insert it + */ + iseen[iused] = i; + iused++; +} + +/* + * Have we already seen this interface? + */ +static long +already_seen(AST_Interface *ip) +{ + long i; + + for (i = 0; i < iused; i++) { + if (iseen[i] == ip) + return I_TRUE; + } + return I_FALSE; +} + +/* + * Add this interface to the list of inherited if not already there + */ +void +FE_InterfaceHeader::compile_one_inheritance(AST_Interface *i) +{ + /* + * Check for badly formed interface + */ + if (i == NULL) + return; + /* + * If we've seen it already then don't expand again + */ + if (already_seen(i)) + return; + /* + * OK, add i to the list of inherited interfaces + */ + add_inheritance(i); +} + +/* + * Compute the list of top-level interfaces this one inherits from + */ +void +FE_InterfaceHeader::compile_inheritance(UTL_NameList *nl) +{ + UTL_NamelistActiveIterator *l = new UTL_NamelistActiveIterator(nl); + AST_Decl *d; + AST_Interface *i; + long k; + + iused = 0; + /* + * Compute expanded flattened non-repeating list of interfaces + * which this one inherits from + */ + while (!(l->is_done())) { + /* + * Check that scope stack is valid + */ + if (idl_global->scopes()->top() == NULL) { + idl_global->err()->lookup_error(l->item()); + return; + } + /* + * Look it up + */ + d = idl_global->scopes()->top()->lookup_by_name(l->item(), I_TRUE); + /* + * Not found? + */ + if (d == NULL) { + idl_global->err()->lookup_error(l->item()); + return; + } + /* + * Not an interface? + */ + while(d->node_type() == AST_Decl::NT_typedef) + d = AST_Typedef::narrow_from_decl(d)->base_type(); + if (d->node_type() != AST_Decl::NT_interface) { + idl_global->err()->inheritance_error(pd_interface_name, d); + return; + } + /* + * OK, cast to an interface + */ + i = AST_Interface::narrow_from_decl(d); + if (i == NULL) + idl_global->err()->inheritance_error(pd_interface_name, d); + /* + * Forward declared interface? + */ + if (!i->is_defined()) { + idl_global->err()->inheritance_fwd_error(pd_interface_name, i); + return; + } + /* + * OK, see if we have to add this to the list of interfaces + * inherited from + */ + compile_one_inheritance(i); + + /* + * Next element in header list + */ + l->next(); + } + delete l; + /* + * OK, install in interface header + */ + pd_inherits = new AST_Interface *[iused]; + for (k = 0; k < iused; k++) + pd_inherits[k] = iseen[k]; + pd_n_inherits = iused; +} + +/* + * Public operations + */ + +/* + * Redefinition of inherited virtual operations + */ + +/* + * Data accessors + */ + +UTL_ScopedName * +FE_InterfaceHeader::interface_name() +{ + return pd_interface_name; +} + +AST_Interface ** +FE_InterfaceHeader::inherits() +{ + return pd_inherits; +} + +long +FE_InterfaceHeader::n_inherits() +{ + return pd_n_inherits; +} diff --git a/TAO/TAO_IDL/fe/fe_private.cpp b/TAO/TAO_IDL/fe/fe_private.cpp new file mode 100644 index 00000000000..9644a94ae2a --- /dev/null +++ b/TAO/TAO_IDL/fe/fe_private.cpp @@ -0,0 +1,80 @@ +/* + +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 "%@(#)fe_global.cc 1.22% %92/06/10% Sun Microsystems" + +/* + * fe_private.cc - Declare global data which are private to the FE + * part + */ + +#include "idl.h" +#include "idl_extern.h" + +#include "fe_private.h" + +/* + * List of pragmas + */ +UTL_StrList *DRV_global_pragmas = NULL; diff --git a/TAO/TAO_IDL/fe/idl.ll b/TAO/TAO_IDL/fe/idl.ll new file mode 100644 index 00000000000..fc043e2f655 --- /dev/null +++ b/TAO/TAO_IDL/fe/idl.ll @@ -0,0 +1,485 @@ + +%{ +/* + +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. + + */ + +/* + * idl.ll - Lexical scanner for IDL 1.1 + */ + +#include "idl.h" +#include "idl_extern.h" + +#include "fe_private.h" + +#include <y.tab.hh> + +#include <string.h> + +static char idl_escape_reader(char *); +static double idl_atof(char *); +static long idl_atoi(char *, long); +static void idl_parse_line_and_file(char *); +static void idl_store_pragma(char *); + +// HPUX has yytext typed to unsigned char *. We make sure here that +// we'll always use char * +static char *__yytext = (char *) yytext; + +%} + +%% + +module return MODULE; +raises return RAISES; +readonly return READONLY; +attribute return ATTRIBUTE; +exception return EXCEPTION; +context return CONTEXT; +interface return INTERFACE; +const return CONST; +typedef return TYPEDEF; +struct return STRUCT; +enum return ENUM; +string return STRING; +wstring_t return WSTRING; +sequence return SEQUENCE; +union return UNION; +switch return SWITCH; +case return CASE; +default return DEFAULT; +float return FLOAT; +double return DOUBLE; +long return LONG; +short return SHORT; +unsigned return UNSIGNED; +char return CHAR; +wchar_t return WCHAR; +boolean return BOOLEAN; +octet return OCTET; +void return VOID; + +TRUE return TRUETOK; +FALSE return FALSETOK; + +inout return INOUT; +in return IN; +out return OUT; +oneway return ONEWAY; + +\<\< return LEFT_SHIFT; +\>\> return RIGHT_SHIFT; +\:\: { + yylval.strval = "::"; + return SCOPE_DELIMITOR; + } + +[a-zA-Z][a-zA-Z0-9_]* { + char *z = (char *) malloc(strlen(__yytext) + 1); + strcpy(z, __yytext); + yylval.strval = z; + return IDENTIFIER; +} + +-?[0-9]+"."[0-9]*([eE][+-]?[0-9]+)?[lLfF]? { + yylval.dval = idl_atof(__yytext); + return FLOATING_PT_LITERAL; + } +-?[0-9]+[eE][+-]?[0-9]+[lLfF]? { + yylval.dval = idl_atof(__yytext); + return FLOATING_PT_LITERAL; + } + +-?[1-9][0-9]* { + yylval.ival = idl_atoi(__yytext, 10); + return INTEGER_LITERAL; + } +-?0[xX][a-fA-F0-9]+ { + yylval.ival = idl_atoi(__yytext, 16); + return INTEGER_LITERAL; + } +-?0[0-7]* { + yylval.ival = idl_atoi(__yytext, 8); + return INTEGER_LITERAL; + } + +"\""[^\"]*"\"" { + __yytext[strlen(__yytext)-1] = '\0'; + yylval.sval = new String(__yytext + 1); + return STRING_LITERAL; + } +"'"."'" { + yylval.cval = __yytext[1]; + return CHARACTER_LITERAL; + } +"'"\\([0-7]{1,3})"'" { + // octal character constant + yylval.cval = idl_escape_reader(__yytext + 1); + return CHARACTER_LITERAL; + } +"'"\\."'" { + yylval.cval = idl_escape_reader(__yytext + 1); + return CHARACTER_LITERAL; + } +^#[ \t]*pragma[ \t].*\n {/* remember pragma */ + idl_global->set_lineno(idl_global->lineno() + 1); + idl_store_pragma(__yytext); + } +^#[ \t]*[0-9]*" ""\""[^\"]*"\""" "[0-9]*\n { + idl_parse_line_and_file(__yytext); + } +^#[ \t]*[0-9]*" ""\""[^\"]*"\""\n { + idl_parse_line_and_file(__yytext); + } +^#[ \t]*[0-9]*\n { + idl_parse_line_and_file(__yytext); + } +^#[ \t]*ident.*\n { + /* ignore cpp ident */ + idl_global->set_lineno(idl_global->lineno() + 1); + } +\/\/.*\n { + /* ignore comments */ + idl_global->set_lineno(idl_global->lineno() + 1); + } +"/*" { + for(;;) { + char c = yyinput(); + if (c == '*') { + char next = yyinput(); + if (next == '/') + break; + else + yyunput(c); + if (c == '\n') + idl_global->set_lineno(idl_global->lineno() + 1); + } + } + } +[ \t]* ; +\n { + idl_global->set_lineno(idl_global->lineno() + 1); + } +. return __yytext[0]; + +%% + /* subroutines */ + +/* + * Strip down a name to the last component, i.e. everything after the last + * '/' character + */ +static char * +stripped_name(UTL_String *fn) +{ + char *n = fn->get_string(); + long l; + + if (n == NULL) + return NULL; + l = strlen(n); + for (n += l; l > 0 && *n != '/'; l--, n--); + if (*n == '/') n++; + return n; +} + +/* + * Parse a #line statement generated by the C preprocessor + */ +static void +idl_parse_line_and_file(char *buf) +{ + char *r = buf; + char *h; + UTL_String *nm; + + /* Skip initial '#' */ + if (*r != '#') { + return; + } + + /* Find line number */ + for (r++; *r == ' ' || *r == '\t'; r++); + h = r; + for (; *r != '\0' && *r != ' ' && *r != '\t'; r++); + *r++ = 0; + idl_global->set_lineno(idl_atoi(h, 10)); + + /* Find file name, if present */ + for (; *r != '"'; r++) { + if (*r == '\n' || *r == '\0') + return; + } + h = ++r; + for (; *r != '"'; r++); + *r = 0; + if (*h == '\0') + idl_global->set_filename(new String("standard input")); + else + idl_global->set_filename(new String(h)); + + idl_global->set_in_main_file( + (idl_global->filename()->compare(idl_global->real_filename())) ? + I_TRUE : + I_FALSE + ); + /* + * If it's an import file store the stripped name for the BE to use + */ + if (!(idl_global->in_main_file()) && idl_global->import()) { + nm = new UTL_String(stripped_name(idl_global->filename())); + idl_global->store_include_file_name(nm); + } +} + +/* + * Store a #pragma line into the list of pragmas + */ +static void +idl_store_pragma(char *buf) +{ + char *cp = buf + 1; + while(*cp != 'p') + cp++; + while(*cp != ' ' && *cp != '\t') + cp++; + while(*cp == ' ' || *cp == '\t') + cp++; + char pragma[80]; + char *pp = pragma; + while(*cp != '\n') { + *pp++ = *cp++; + } + *pp = 0; + if (strcmp(pragma, "import") == 0) { + idl_global->set_import(I_TRUE); + return; + } + if (strcmp(pragma, "include") == 0) { + idl_global->set_import(I_FALSE); + return; + } + UTL_StrList *p = idl_global->pragmas(); + if (p == NULL) + idl_global->set_pragmas(new UTL_StrList(new String(buf), NULL)); + else { + p->nconc(new UTL_StrList(new String(buf), NULL)); + idl_global->set_pragmas(p); + } +} + +/* + * idl_atoi - Convert a string of digits into an integer according to base b + */ +static long +idl_atoi(char *s, long b) +{ + long r = 0; + long negative = 0; + + if (*s == '-') { + negative = 1; + s++; + } + if (b == 8 && *s == '0') + s++; + else if (b == 16 && *s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X')) + s += 2; + + for (; *s; s++) + if (*s <= '9' && *s >= '0') + r = (r * b) + (*s - '0'); + else if (b > 10 && *s <= 'f' && *s >= 'a') + r = (r * b) + (*s - 'a' + 10); + else if (b > 10 && *s <= 'F' && *s >= 'A') + r = (r * b) + (*s - 'A' + 10); + else + break; + + if (negative) + r *= -1; + + return r; +} + +/* + * Convert a string to a float; atof doesn't seem to work, always. + */ +static double +idl_atof(char *s) +{ + char *h = s; + double d = 0.0; + double f = 0.0; + double e, k; + long neg = 0, negexp = 0; + + if (*s == '-') { + neg = 1; + s++; + } + while (*s >= '0' && *s <= '9') { + d = (d * 10) + *s - '0'; + s++; + } + if (*s == '.') { + s++; + e = 10; + while (*s >= '0' && *s <= '9') { + d += (*s - '0') / (e * 1.0); + e *= 10; + s++; + } + } + if (*s == 'e' || *s == 'E') { + s++; + if (*s == '-') { + negexp = 1; + s++; + } else if (*s == '+') + s++; + e = 0; + while (*s >= '0' && *s <= '9') { + e = (e * 10) + *s - '0'; + s++; + } + if (e > 0) { + for (k = 1; e > 0; k *= 10, e--); + if (negexp) + d /= k; + else + d *= k; + } + } + + if (neg) d *= -1.0; + + return d; +} + +/* + * Convert (some) escaped characters into their ascii values + */ +static char +idl_escape_reader( + char *str +) +{ + if (str[0] != '\\') { + return str[0]; + } + + switch (str[1]) { + case 'n': + return '\n'; + case 't': + return '\t'; + case 'v': + return '\v'; + case 'b': + return '\b'; + case 'r': + return '\r'; + case 'f': + return '\f'; + case 'a': + return '\a'; + case '\\': + return '\\'; + case '\?': + return '?'; + case '\'': + return '\''; + case '"': + return '"'; + case 'x': + { + // hex value + for (int i = 2; str[i] != '\0' && isxdigit(str[i]); i++) { + continue; + } + char save = str[i]; + str[i] = '\0'; + char out = (char)idl_atoi(&str[2], 16); + str[i] = save; + return out; + } + break; + default: + // check for octal value + if (str[1] >= '0' && str[1] <= '7') { + for (int i = 1; str[i] >= '0' && str[i] <= '7'; i++) { + continue; + } + char save = str[i]; + str[i] = '\0'; + char out = (char)idl_atoi(&str[1], 8); + str[i] = save; + return out; + } else { + return str[1] - 'a'; + } + break; + } +} diff --git a/TAO/TAO_IDL/fe/idl.yy b/TAO/TAO_IDL/fe/idl.yy new file mode 100644 index 00000000000..c99b42c894c --- /dev/null +++ b/TAO/TAO_IDL/fe/idl.yy @@ -0,0 +1,2189 @@ +/* + +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. + + */ + +/* + * idl.yy - YACC grammar for IDL 1.1 + */ + +/* Declarations */ + +%{ +#include "idl.h" +#include "idl_extern.h" + +#include "fe_private.h" + +#include <stdio.h> + +#if (defined(apollo) || defined(hpux)) && defined(__cplusplus) +extern "C" int yywrap(); +#endif // (defined(apollo) || defined(hpux)) && defined(__cplusplus) + +%} + +/* + * Declare the type of values in the grammar + */ + +%union { + AST_Decl *dcval; /* Decl value */ + UTL_StrList *slval; /* String list */ + UTL_NameList *nlval; /* Name list */ + UTL_ExprList *elval; /* Expression list */ + UTL_LabelList *llval; /* Label list */ + UTL_DeclList *dlval; /* Declaration list */ + FE_InterfaceHeader *ihval; /* Interface header */ + AST_Expression *exval; /* Expression value */ + AST_UnionLabel *ulval; /* Union label */ + AST_Field *ffval; /* Field value */ + AST_Expression::ExprType etval; /* Expression type */ + AST_Argument::Direction dival; /* Argument direction */ + AST_Operation::Flags ofval; /* Operation flags */ + FE_Declarator *deval; /* Declarator value */ + idl_bool bval; /* Boolean value */ + long ival; /* Long value */ + double dval; /* Double value */ + float fval; /* Float value */ + char cval; /* Char value */ + + String *sval; /* String value */ + char *strval; /* char * value */ + Identifier *idval; /* Identifier */ + UTL_IdList *idlist; /* Identifier list */ +} + +/* + * Token types: These are returned by the lexer + */ + +%token <strval> IDENTIFIER + +%token CONST +%token MODULE +%token INTERFACE +%token TYPEDEF +%token LONG +%token SHORT +%token UNSIGNED +%token DOUBLE +%token FLOAT +%token CHAR +%token WCHAR +%token OCTET +%token BOOLEAN +%token ANY +%token STRUCT +%token UNION +%token SWITCH +%token ENUM +%token SEQUENCE +%token STRING +%token WSTRING +%token EXCEPTION +%token CASE +%token DEFAULT +%token READONLY +%token ATTRIBUTE +%token ONEWAY +%token IDEMPOTENT +%token VOID +%token IN +%token OUT +%token INOUT +%token RAISES +%token CONTEXT + +%token <ival> INTEGER_LITERAL +%token <sval> STRING_LITERAL +%token <cval> CHARACTER_LITERAL +%token <dval> FLOATING_PT_LITERAL +%token TRUETOK +%token FALSETOK + +%token <strval> SCOPE_DELIMITOR +%token LEFT_SHIFT +%token RIGHT_SHIFT + +/* + * These are production names: + */ + +%type <dcval> type_spec simple_type_spec constructed_type_spec +%type <dcval> template_type_spec sequence_type_spec string_type_spec +%type <dcval> struct_type enum_type switch_type_spec union_type +%type <dcval> array_declarator op_type_spec seq_head wstring_type_spec + +%type <idlist> scoped_name +%type <slval> opt_context at_least_one_string_literal +%type <slval> string_literals + +%type <nlval> at_least_one_scoped_name scoped_names inheritance_spec +%type <nlval> opt_raises + +%type <elval> at_least_one_array_dim array_dims + +%type <llval> at_least_one_case_label case_labels + +%type <dlval> at_least_one_declarator declarators + +%type <ihval> interface_header + +%type <exval> expression const_expr or_expr xor_expr and_expr shift_expr +%type <exval> add_expr mult_expr unary_expr primary_expr literal +%type <exval> positive_int_expr array_dim + +%type <ulval> case_label + +%type <ffval> element_spec + +%type <etval> const_type integer_type char_type boolean_type +%type <etval> floating_pt_type any_type signed_int +%type <etval> unsigned_int base_type_spec octet_type + +%type <dival> direction + +%type <ofval> opt_op_attribute + +%type <deval> declarator simple_declarator complex_declarator + +%type <bval> opt_readonly + +%type <idval> interface_decl id + +%% + +/* + * Production starts here + */ +start : definitions ; + +definitions + : definition definitions + | /* empty */ + ; + +definition + : type_dcl + { + idl_global->set_parse_state(IDL_GlobalData::PS_TypeDeclSeen); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } + | const_dcl + { + idl_global->set_parse_state(IDL_GlobalData::PS_ConstDeclSeen); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } + | exception + { + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptDeclSeen); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } + | interface_def + { + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceDeclSeen); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } + | module + { + idl_global->set_parse_state(IDL_GlobalData::PS_ModuleDeclSeen); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } + | error + { + idl_global->err()->syntax_error(idl_global->parse_state()); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + yyerrok; + } + ; + +module : MODULE + { + idl_global->set_parse_state(IDL_GlobalData::PS_ModuleSeen); + } + IDENTIFIER + { + UTL_ScopedName *n = + new UTL_ScopedName(new Identifier($3, 1, 0, I_FALSE), NULL); + AST_Module *m = NULL; + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_StrList *p = idl_global->pragmas(); + + idl_global->set_parse_state(IDL_GlobalData::PS_ModuleIDSeen); + /* + * Make a new module and add it to the enclosing scope + */ + if (s != NULL) { + m = idl_global->gen()->create_module(n, p); + (void) s->fe_add_module(m); + } + /* + * Push it on the stack + */ + idl_global->scopes()->push(m); + } + '{' + { + idl_global->set_parse_state(IDL_GlobalData::PS_ModuleSqSeen); + } + definitions + { + idl_global->set_parse_state(IDL_GlobalData::PS_ModuleBodySeen); + } + '}' + { + idl_global->set_parse_state(IDL_GlobalData::PS_ModuleQsSeen); + /* + * Finished with this module - pop it from the scope stack + */ + idl_global->scopes()->pop(); + } + ; + +interface_def + : interface + | forward + ; + +interface : + interface_header + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + AST_Interface *i = NULL; + AST_Decl *v = NULL; + UTL_StrList *p = idl_global->pragmas(); + AST_Decl *d = NULL; + AST_Interface *fd = NULL; + + /* + * Make a new interface node and add it to its enclosing scope + */ + if (s != NULL && $1 != NULL) { + i = idl_global->gen()->create_interface($1->interface_name(), + $1->inherits(), + $1->n_inherits(), + p); + if (i != NULL && + (d = s->lookup_by_name(i->name(), I_FALSE)) != NULL) { + /* + * See if we're defining a forward declared interface. + */ + if (d->node_type() == AST_Decl::NT_interface) { + /* + * Narrow to an interface + */ + fd = AST_Interface::narrow_from_decl(d); + /* + * Successful? + */ + if (fd == NULL) { + /* + * Should we give an error here? + */ + } + /* + * If it is a forward declared interface.. + */ + else if (!fd->is_defined()) { + /* + * Check if redefining in same scope + */ + if (fd->defined_in() != s) { + idl_global->err() + ->error3(UTL_Error::EIDL_SCOPE_CONFLICT, + i, + fd, + ScopeAsDecl(s)); + } + /* + * All OK, do the redefinition + */ + else { + fd->set_inherits($1->inherits()); + fd->set_n_inherits($1->n_inherits()); + /* + * Update place of definition + */ + fd->set_imported(idl_global->imported()); + fd->set_in_main_file(idl_global->in_main_file()); + fd->set_line(idl_global->lineno()); + fd->set_file_name(idl_global->filename()); + fd->add_pragmas(p); + /* + * Use full definition node + */ + delete i; + i = fd; + } + } + } + } + /* + * Add the interface to its definition scope + */ + (void) s->fe_add_interface(i); + } + /* + * Push it on the scope stack + */ + idl_global->scopes()->push(i); + } + '{' + { + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSqSeen); + } + exports + { + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceBodySeen); + } + '}' + { + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceQsSeen); + /* + * Done with this interface - pop it off the scopes stack + */ + idl_global->scopes()->pop(); + } + ; + +interface_decl: + INTERFACE + { + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSeen); + } + id + { + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceIDSeen); + $$ = $3; + } + ; + +interface_header : + interface_decl inheritance_spec + { + idl_global->set_parse_state(IDL_GlobalData::PS_InheritSpecSeen); + /* + * Create an AST representation of the information in the header + * part of an interface - this representation contains a computed + * list of all interfaces which this interface inherits from, + * recursively + */ + $$ = new FE_InterfaceHeader(new UTL_ScopedName($1, NULL), $2); + } + ; + +inheritance_spec + : ':' + { + idl_global->set_parse_state(IDL_GlobalData::PS_InheritColonSeen); + } + at_least_one_scoped_name + { + $$ = $3; + } + | /* EMPTY */ + { + $$ = NULL; + } + ; + +exports + : exports export + | /* EMPTY */ + ; + +export + : type_dcl + { + idl_global->set_parse_state(IDL_GlobalData::PS_TypeDeclSeen); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } + | const_dcl + { + idl_global->set_parse_state(IDL_GlobalData::PS_ConstDeclSeen); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } + | exception + { + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptDeclSeen); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } + | attribute + { + idl_global->set_parse_state(IDL_GlobalData::PS_AttrDeclSeen); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } + | operation + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpDeclSeen); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } + | error + { + idl_global->err()->syntax_error(idl_global->parse_state()); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + yyerrok; + } + ; + +at_least_one_scoped_name : + scoped_name scoped_names + { + $$ = new UTL_NameList($1, $2); + } + ; + +scoped_names + : scoped_names + ',' + { + idl_global->set_parse_state(IDL_GlobalData::PS_SNListCommaSeen); + } + scoped_name + { + idl_global->set_parse_state(IDL_GlobalData::PS_ScopedNameSeen); + + if ($1 == NULL) + $$ = new UTL_NameList($4, NULL); + else { + $1->nconc(new UTL_NameList($4, NULL)); + $$ = $1; + } + } + | /* EMPTY */ + { + $$ = NULL; + } + ; + +scoped_name + : id + { + idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); + + $$ = new UTL_IdList($1, NULL); + } + | SCOPE_DELIMITOR + { + idl_global->set_parse_state(IDL_GlobalData::PS_ScopeDelimSeen); + } + id + { + idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); + + $$ = new UTL_IdList(new Identifier($1, 1, 0, I_FALSE), + new UTL_IdList($3, NULL)); + } + | scoped_name + SCOPE_DELIMITOR + { + idl_global->set_parse_state(IDL_GlobalData::PS_ScopeDelimSeen); + } + id + { + idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); + + $1->nconc(new UTL_IdList($4, NULL)); + $$ = $1; + } + ; + +id: IDENTIFIER + { + $$ = new Identifier($1, 1, 0, I_FALSE); + } + ; + +forward : + interface_decl + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_ScopedName *n = new UTL_ScopedName($1, NULL); + AST_InterfaceFwd *f = NULL; + UTL_StrList *p = idl_global->pragmas(); + + idl_global->set_parse_state(IDL_GlobalData::PS_ForwardDeclSeen); + /* + * Create a node representing a forward declaration of an + * interface. Store it in the enclosing scope + */ + if (s != NULL) { + f = idl_global->gen()->create_interface_fwd(n, p); + (void) s->fe_add_interface_fwd(f); + } + } + ; + +const_dcl : + CONST + { + idl_global->set_parse_state(IDL_GlobalData::PS_ConstSeen); + } + const_type + { + idl_global->set_parse_state(IDL_GlobalData::PS_ConstTypeSeen); + } + id + { + idl_global->set_parse_state(IDL_GlobalData::PS_ConstIDSeen); + } + '=' + { + idl_global->set_parse_state(IDL_GlobalData::PS_ConstAssignSeen); + } + expression + { + UTL_ScopedName *n = new UTL_ScopedName($5, NULL); + UTL_Scope *s = idl_global->scopes()->top_non_null(); + AST_Constant *c = NULL; + UTL_StrList *p = idl_global->pragmas(); + AST_Decl *v = NULL; + + idl_global->set_parse_state(IDL_GlobalData::PS_ConstExprSeen); + /* + * Create a node representing a constant declaration. Store + * it in the enclosing scope + */ + if ($9 != NULL && s != NULL) { + if ($9->coerce($3) == NULL) + idl_global->err()->coercion_error($9, $3); + else { + c = + idl_global->gen()->create_constant($3, $9, n, p); + (void) s->fe_add_constant(c); + } + } + } + ; + +const_type + : integer_type + | char_type + | octet_type + | boolean_type + | floating_pt_type + | string_type_spec + { + $$ = AST_Expression::EV_string; + } + | wstring_type_spec + { + $$ = AST_Expression::EV_wstring; + } + | scoped_name + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + AST_Decl *d = NULL; + AST_PredefinedType *c = NULL; + AST_Typedef *t = NULL; + + /* + * If the constant's type is a scoped name, it must resolve + * to a scalar constant type + */ + if (s != NULL && (d = s->lookup_by_name($1, I_TRUE)) != NULL) { + /* + * Look through typedefs + */ + while (d->node_type() == AST_Decl::NT_typedef) { + t = AST_Typedef::narrow_from_decl(d); + if (t == NULL) + break; + d = t->base_type(); + } + if (d == NULL) + $$ = AST_Expression::EV_any; + else if (d->node_type() == AST_Decl::NT_pre_defined) { + c = AST_PredefinedType::narrow_from_decl(d); + if (c != NULL) { + $$ = idl_global->PredefinedTypeToExprType(c->pt()); + } else { + $$ = AST_Expression::EV_any; + } + } else + $$ = AST_Expression::EV_any; + } else + $$ = AST_Expression::EV_any; + } + ; + +expression : const_expr ; + +const_expr : or_expr ; + +or_expr : xor_expr + | or_expr '|' xor_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_or, $1, $3); + } + ; + +xor_expr + : and_expr + | xor_expr '^' and_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_xor, $1, $3); + } + ; + +and_expr + : shift_expr + | and_expr '&' shift_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_and, $1, $3); + } + ; + +shift_expr + : add_expr + | shift_expr LEFT_SHIFT add_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_right,$1,$3); + } + | shift_expr RIGHT_SHIFT add_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_left,$1,$3); + } + ; + +add_expr + : mult_expr + | add_expr '+' mult_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_add, $1, $3); + } + | add_expr '-' mult_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_minus,$1,$3); + } + ; + +mult_expr + : unary_expr + | mult_expr '*' unary_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_mul, $1, $3); + } + | mult_expr '/' unary_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_div, $1, $3); + } + | mult_expr '%' unary_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_mod, $1, $3); + } + ; + +unary_expr + : primary_expr + | '+' primary_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_u_plus, + $2, + NULL); + } + | '-' primary_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_u_minus, + $2, + NULL); + } + | '~' primary_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_bit_neg, + $2, + NULL); + } + ; + +primary_expr + : scoped_name + { + /* + * An expression which is a scoped name is not resolved now, + * but only when it is evaluated (such as when it is assigned + * as a constant value) + */ + $$ = idl_global->gen()->create_expr($1); + } + | literal + | '(' const_expr ')' + { + $$ = $2; + } + ; + +literal + : INTEGER_LITERAL + { + $$ = idl_global->gen()->create_expr($1); + } + | STRING_LITERAL + { + $$ = idl_global->gen()->create_expr($1); + } + | CHARACTER_LITERAL + { + $$ = idl_global->gen()->create_expr($1); + } + | FLOATING_PT_LITERAL + { + $$ = idl_global->gen()->create_expr($1); + } + | TRUETOK + { + $$ = idl_global->gen()->create_expr((idl_bool) I_TRUE, + AST_Expression::EV_bool); + } + | FALSETOK + { + $$ = idl_global->gen()->create_expr((idl_bool) I_FALSE, + AST_Expression::EV_bool); + } + ; + +positive_int_expr : + const_expr + { + $1->evaluate(AST_Expression::EK_const); + $$ = idl_global->gen()->create_expr($1, AST_Expression::EV_ulong); + } + ; + +type_dcl + : TYPEDEF + { + idl_global->set_parse_state(IDL_GlobalData::PS_TypedefSeen); + } + type_declarator + | struct_type + | union_type + | enum_type + ; + +type_declarator : + type_spec + { + idl_global->set_parse_state(IDL_GlobalData::PS_TypeSpecSeen); + } + at_least_one_declarator + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_DecllistActiveIterator *l; + FE_Declarator *d = NULL; + AST_Typedef *t = NULL; + AST_Decl *v = NULL; + UTL_StrList *p = idl_global->pragmas(); + + idl_global->set_parse_state(IDL_GlobalData::PS_DeclaratorsSeen); + /* + * Create a list of type renamings. Add them to the + * enclosing scope + */ + if (s != NULL && $1 != NULL && $3 != NULL) { + l = new UTL_DecllistActiveIterator($3); + for (;!(l->is_done()); l->next()) { + d = l->item(); + if (d == NULL) + continue; + AST_Type * tp = d->compose($1); + if (tp == NULL) + continue; + t = idl_global->gen()->create_typedef(tp, d->name(), p); + (void) s->fe_add_typedef(t); + } + delete l; + } + } + ; + +type_spec + : simple_type_spec + | constructed_type_spec + ; + +simple_type_spec + : base_type_spec + { + $$ = idl_global->scopes()->bottom()->lookup_primitive_type($1); + } + | template_type_spec + | scoped_name + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + AST_Decl *d = NULL; + + if (s != NULL) + d = s->lookup_by_name($1, I_TRUE); + if (d == NULL) + idl_global->err()->lookup_error($1); + $$ = d; + } + ; + +base_type_spec + : integer_type + | floating_pt_type + | char_type + | boolean_type + | octet_type + | any_type + ; + +template_type_spec + : sequence_type_spec + | string_type_spec + | wstring_type_spec + ; + +constructed_type_spec + : struct_type + | union_type + | enum_type + ; + +at_least_one_declarator : + declarator declarators + { + $$ = new UTL_DeclList($1, $2); + } + ; +declarators + : declarators + ',' + { + idl_global->set_parse_state(IDL_GlobalData::PS_DeclsCommaSeen); + } + declarator + { + idl_global->set_parse_state(IDL_GlobalData::PS_DeclsDeclSeen); + + if ($1 == NULL) + $$ = new UTL_DeclList($4, NULL); + else { + $1->nconc(new UTL_DeclList($4, NULL)); + $$ = $1; + } + } + | /* EMPTY */ + { + $$ = NULL; + } + ; + +declarator + : simple_declarator + | complex_declarator + ; + +simple_declarator : + id + { + $$ = new FE_Declarator(new UTL_ScopedName($1, NULL), + FE_Declarator::FD_simple, NULL); + } + ; + +complex_declarator : + array_declarator + { + $$ = new FE_Declarator(new UTL_ScopedName($1->local_name(), NULL), + FE_Declarator::FD_complex, + $1); + } + ; + +integer_type + : signed_int + | unsigned_int + ; + +signed_int + : LONG + { + $$ = AST_Expression::EV_long; + } + | LONG LONG + { + $$ = AST_Expression::EV_longlong; + } + | SHORT + { + $$ = AST_Expression::EV_short; + } + ; + +unsigned_int + : UNSIGNED LONG + { + $$ = AST_Expression::EV_ulong; + } + | UNSIGNED LONG LONG + { + $$ = AST_Expression::EV_ulonglong; + } + | UNSIGNED SHORT + { + $$ = AST_Expression::EV_ushort; + } + ; + +floating_pt_type + : DOUBLE + { + $$ = AST_Expression::EV_double; + } + | FLOAT + { + $$ = AST_Expression::EV_float; + } + | LONG DOUBLE + { + $$ = AST_Expression::EV_longdouble; + } + ; + +char_type + : CHAR + { + $$ = AST_Expression::EV_char; + } + | WCHAR + { + $$ = AST_Expression::EV_wchar; + } + ; + +octet_type + : OCTET + { + $$ = AST_Expression::EV_octet; + } + ; + +boolean_type + : BOOLEAN + { + $$ = AST_Expression::EV_bool; + } + ; + +any_type + : ANY + { + $$ = AST_Expression::EV_any; + } + ; + +struct_type : + STRUCT + { + idl_global->set_parse_state(IDL_GlobalData::PS_StructSeen); + } + id + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_ScopedName *n = new UTL_ScopedName($3, NULL); + AST_Structure *d = NULL; + UTL_StrList *p = idl_global->pragmas(); + AST_Decl *v = NULL; + + idl_global->set_parse_state(IDL_GlobalData::PS_StructIDSeen); + /* + * Create a node representing a struct declaration. Add it + * to the enclosing scope + */ + if (s != NULL) { + d = idl_global->gen()->create_structure(n, p); + (void) s->fe_add_structure(d); + } + /* + * Push the scope of the struct on the scopes stack + */ + idl_global->scopes()->push(d); + } + '{' + { + idl_global->set_parse_state(IDL_GlobalData::PS_StructSqSeen); + } + at_least_one_member + { + idl_global->set_parse_state(IDL_GlobalData::PS_StructBodySeen); + } + '}' + { + idl_global->set_parse_state(IDL_GlobalData::PS_StructQsSeen); + /* + * Done with this struct. Pop its scope off the scopes stack + */ + if (idl_global->scopes()->top() == NULL) + $$ = NULL; + else { + $$ = + AST_Structure::narrow_from_scope( + idl_global->scopes()->top_non_null()); + idl_global->scopes()->pop(); + } + } + ; + +at_least_one_member : member members ; + +members + : members member + | /* EMPTY */ + ; + +member : + type_spec + { + idl_global->set_parse_state(IDL_GlobalData::PS_MemberTypeSeen); + } + at_least_one_declarator + { + idl_global->set_parse_state(IDL_GlobalData::PS_MemberDeclsSeen); + } + ';' + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_DecllistActiveIterator *l = NULL; + FE_Declarator *d = NULL; + AST_Field *f = NULL; + UTL_StrList *p = idl_global->pragmas(); + + idl_global->set_parse_state(IDL_GlobalData::PS_MemberDeclsCompleted); + /* + * Check for illegal recursive use of type + */ + if ($1 != NULL && AST_illegal_recursive_type($1)) + idl_global->err()->error1(UTL_Error::EIDL_RECURSIVE_TYPE, $1); + /* + * Create a node representing a struct or exception member + * Add it to the enclosing scope + */ + else if (s != NULL && $1 != NULL && $3 != NULL) { + l = new UTL_DecllistActiveIterator($3); + for (;!(l->is_done()); l->next()) { + d = l->item(); + if (d == NULL) + continue; + AST_Type *tp = d->compose($1); + if (tp == NULL) + continue; + f = idl_global->gen()->create_field(tp, d->name(), p); + (void) s->fe_add_field(f); + } + delete l; + } + } + | error + { + idl_global->err()->syntax_error(idl_global->parse_state()); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + yyerrok; + } + ; + +union_type : + UNION + { + idl_global->set_parse_state(IDL_GlobalData::PS_UnionSeen); + } + id + { + idl_global->set_parse_state(IDL_GlobalData::PS_UnionIDSeen); + } + SWITCH + { + idl_global->set_parse_state(IDL_GlobalData::PS_SwitchSeen); + } + '(' + { + idl_global->set_parse_state(IDL_GlobalData::PS_SwitchOpenParSeen); + } + switch_type_spec + { + idl_global->set_parse_state(IDL_GlobalData::PS_SwitchTypeSeen); + } + ')' + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_ScopedName *n = new UTL_ScopedName($3, NULL); + AST_Union *u = NULL; + AST_Decl *v = NULL; + UTL_StrList *p = idl_global->pragmas(); + + idl_global->set_parse_state(IDL_GlobalData::PS_SwitchCloseParSeen); + /* + * Create a node representing a union. Add it to its enclosing + * scope + */ + if ($9 != NULL && s != NULL) { + AST_ConcreteType *tp = AST_ConcreteType::narrow_from_decl($9); + if (tp == NULL) { + idl_global->err()->not_a_type($9); + } else { + u = idl_global->gen()->create_union(tp, n, p); + (void) s->fe_add_union(u); + } + } + /* + * Push the scope of the union on the scopes stack + */ + idl_global->scopes()->push(u); + } + '{' + { + idl_global->set_parse_state(IDL_GlobalData::PS_UnionSqSeen); + } + at_least_one_case_branch + { + idl_global->set_parse_state(IDL_GlobalData::PS_UnionBodySeen); + } + '}' + { + idl_global->set_parse_state(IDL_GlobalData::PS_UnionQsSeen); + /* + * Done with this union. Pop its scope from the scopes stack + */ + if (idl_global->scopes()->top() == NULL) + $$ = NULL; + else { + $$ = + AST_Union::narrow_from_scope( + idl_global->scopes()->top_non_null()); + idl_global->scopes()->pop(); + } + } + ; + +switch_type_spec : + integer_type + { + $$ = idl_global->scopes()->bottom()->lookup_primitive_type($1); + } + | char_type + { + $$ = idl_global->scopes()->bottom()->lookup_primitive_type($1); + } + | octet_type + { + $$ = idl_global->scopes()->bottom()->lookup_primitive_type($1); + } + | boolean_type + { + $$ = idl_global->scopes()->bottom()->lookup_primitive_type($1); + } + | enum_type + | scoped_name + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + AST_Decl *d = NULL; + AST_PredefinedType *p = NULL; + AST_Typedef *t = NULL; + long found = I_FALSE; + + /* + * The discriminator is a scoped name. Try to resolve to + * one of the scalar types or to an enum. Thread through + * typedef's to arrive at the base type at the end of the + * chain + */ + if (s != NULL && (d = s->lookup_by_name($1, I_TRUE)) != NULL) { + while (!found) { + switch (d->node_type()) { + case AST_Decl::NT_enum: + $$ = d; + found = I_TRUE; + break; + case AST_Decl::NT_pre_defined: + p = AST_PredefinedType::narrow_from_decl(d); + if (p != NULL) { + switch (p->pt()) { + case AST_PredefinedType::PT_long: + case AST_PredefinedType::PT_ulong: + case AST_PredefinedType::PT_longlong: + case AST_PredefinedType::PT_ulonglong: + case AST_PredefinedType::PT_short: + case AST_PredefinedType::PT_char: + case AST_PredefinedType::PT_wchar: + case AST_PredefinedType::PT_octet: + case AST_PredefinedType::PT_boolean: + $$ = p; + found = I_TRUE; + break; + default: + $$ = NULL; + found = I_TRUE; + break; + } + } + break; + case AST_Decl::NT_typedef: + t = AST_Typedef::narrow_from_decl(d); + if (t != NULL) d = t->base_type(); + break; + default: + $$ = NULL; + found = I_TRUE; + break; + } + } + } else + $$ = NULL; + + if ($$ == NULL) + idl_global->err()->lookup_error($1); + } + ; + +at_least_one_case_branch : case_branch case_branches ; + +case_branches + : case_branches case_branch + | /* empty */ + ; + +case_branch : + at_least_one_case_label + { + idl_global->set_parse_state(IDL_GlobalData::PS_UnionLabelSeen); + } + element_spec + { + idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemSeen); + } + ';' + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_LabellistActiveIterator *l = NULL; + AST_UnionLabel *d = NULL; + AST_UnionBranch *b = NULL; + AST_Field *f = $3; + + idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemCompleted); + /* + * Create several nodes representing branches of a union. + * Add them to the enclosing scope (the union scope) + */ + if (s != NULL && $1 != NULL && $3 != NULL) { + l = new UTL_LabellistActiveIterator($1); + for (;!(l->is_done()); l->next()) { + d = l->item(); + if (d == NULL) + continue; + b = idl_global->gen()->create_union_branch(d, + f->field_type(), + f->name(), + f->pragmas()); + (void) s->fe_add_union_branch(b); + } + delete l; + } + } + | error + { + idl_global->err()->syntax_error(idl_global->parse_state()); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + yyerrok; + } + ; + +at_least_one_case_label : + case_label case_labels + { + $$ = new UTL_LabelList($1, $2); + } + ; + +case_labels + : case_labels case_label + { + if ($1 == NULL) + $$ = new UTL_LabelList($2, NULL); + else { + $1->nconc(new UTL_LabelList($2, NULL)); + $$ = $1; + } + } + | /* EMPTY */ + { + $$ = NULL; + } + ; + +case_label + : DEFAULT + { + idl_global->set_parse_state(IDL_GlobalData::PS_DefaultSeen); + } + ':' + { + idl_global->set_parse_state(IDL_GlobalData::PS_LabelColonSeen); + + $$ = idl_global->gen()-> + create_union_label(AST_UnionLabel::UL_default, + NULL); + } + | CASE + { + idl_global->set_parse_state(IDL_GlobalData::PS_CaseSeen); + } + const_expr + { + idl_global->set_parse_state(IDL_GlobalData::PS_LabelExprSeen); + } + ':' + { + idl_global->set_parse_state(IDL_GlobalData::PS_LabelColonSeen); + + $$ = idl_global->gen()->create_union_label(AST_UnionLabel::UL_label, + $3); + } + ; + +element_spec : + type_spec + { + idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemTypeSeen); + } + declarator + { + idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemDeclSeen); + /* + * Check for illegal recursive use of type + */ + if ($1 != NULL && AST_illegal_recursive_type($1)) + idl_global->err()->error1(UTL_Error::EIDL_RECURSIVE_TYPE, $1); + /* + * Create a field in a union branch + */ + else if ($1 == NULL || $3 == NULL) + $$ = NULL; + else { + AST_Type *tp = $3->compose($1); + if (tp == NULL) + $$ = NULL; + else + $$ = idl_global->gen()->create_field(tp, + $3->name(), + idl_global->pragmas()); + } + } + ; + +enum_type : + ENUM + { + idl_global->set_parse_state(IDL_GlobalData::PS_EnumSeen); + } + id + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_ScopedName *n = new UTL_ScopedName($3, NULL); + AST_Enum *e = NULL; + AST_Decl *v = NULL; + UTL_StrList *p = idl_global->pragmas(); + + idl_global->set_parse_state(IDL_GlobalData::PS_EnumIDSeen); + /* + * Create a node representing an enum and add it to its + * enclosing scope + */ + if (s != NULL) { + e = idl_global->gen()->create_enum(n, p); + /* + * Add it to its defining scope + */ + (void) s->fe_add_enum(e); + } + /* + * Push the enum scope on the scopes stack + */ + idl_global->scopes()->push(e); + } + '{' + { + idl_global->set_parse_state(IDL_GlobalData::PS_EnumSqSeen); + } + at_least_one_enumerator + { + idl_global->set_parse_state(IDL_GlobalData::PS_EnumBodySeen); + } + '}' + { + idl_global->set_parse_state(IDL_GlobalData::PS_EnumQsSeen); + /* + * Done with this enum. Pop its scope from the scopes stack + */ + if (idl_global->scopes()->top() == NULL) + $$ = NULL; + else { + $$ = AST_Enum::narrow_from_scope(idl_global->scopes()->top_non_null()); + idl_global->scopes()->pop(); + } + } + ; + +at_least_one_enumerator : enumerator enumerators ; + +enumerators + : enumerators + ',' + { + idl_global->set_parse_state(IDL_GlobalData::PS_EnumCommaSeen); + } + enumerator + | /* EMPTY */ + ; + +enumerator : + IDENTIFIER + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_ScopedName *n = + new UTL_ScopedName(new Identifier($1, 1, 0, I_FALSE), NULL); + AST_EnumVal *e = NULL; + AST_Enum *c = NULL; + UTL_StrList *p = idl_global->pragmas(); + + /* + * Create a node representing one enumerator in an enum + * Add it to the enclosing scope (the enum scope) + */ + if (s != NULL && s->scope_node_type() == AST_Decl::NT_enum) { + c = AST_Enum::narrow_from_scope(s); + if (c != NULL) + e = idl_global->gen()->create_enum_val(c->next_enum_val(), n, p); + (void) s->fe_add_enum_val(e); + } + } + ; + +sequence_type_spec + : seq_head + ',' + { + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceCommaSeen); + } + positive_int_expr + { + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceExprSeen); + } + '>' + { + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceQsSeen); + /* + * Remove sequence marker from scopes stack + */ + if (idl_global->scopes()->top() == NULL) + idl_global->scopes()->pop(); + /* + * Create a node representing a sequence + */ + if ($4 == NULL || $4->coerce(AST_Expression::EV_ulong) == NULL) { + idl_global->err()->coercion_error($4, AST_Expression::EV_ulong); + $$ = NULL; + } else if ($1 == NULL) { + $$ = NULL; + } else { + AST_Type *tp = AST_Type::narrow_from_decl($1); + if (tp == NULL) + $$ = NULL; + else { + $$ = idl_global->gen()->create_sequence($4, tp); + /* + * Add this AST_Sequence to the types defined in the global scope + */ + (void) idl_global->root() + ->fe_add_sequence(AST_Sequence::narrow_from_decl($$)); + } + } + } + | seq_head + '>' + { + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceQsSeen); + /* + * Remove sequence marker from scopes stack + */ + if (idl_global->scopes()->top() == NULL) + idl_global->scopes()->pop(); + /* + * Create a node representing a sequence + */ + if ($1 == NULL) + $$ = NULL; + else { + AST_Type *tp = AST_Type::narrow_from_decl($1); + if (tp == NULL) + $$ = NULL; + else { + $$ = + idl_global->gen()->create_sequence( + idl_global->gen()->create_expr((unsigned long) 0), + tp); + /* + * Add this AST_Sequence to the types defined in the global scope + */ + (void) idl_global->root() + ->fe_add_sequence(AST_Sequence::narrow_from_decl($$)); + } + } + } + ; + +seq_head: + SEQUENCE + { + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceSeen); + /* + * Push a sequence marker on scopes stack + */ + idl_global->scopes()->push(NULL); + } + '<' + { + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceSqSeen); + } + simple_type_spec + { + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceTypeSeen); + $$ = $5; + } + ; + +string_type_spec + : string_head + '<' + { + idl_global->set_parse_state(IDL_GlobalData::PS_StringSqSeen); + } + positive_int_expr + { + idl_global->set_parse_state(IDL_GlobalData::PS_StringExprSeen); + } + '>' + { + idl_global->set_parse_state(IDL_GlobalData::PS_StringQsSeen); + /* + * Create a node representing a string + */ + if ($4 == NULL || $4->coerce(AST_Expression::EV_ulong) == NULL) { + idl_global->err()->coercion_error($4, AST_Expression::EV_ulong); + $$ = NULL; + } else { + $$ = idl_global->gen()->create_string($4); + /* + * Add this AST_String to the types defined in the global scope + */ + (void) idl_global->root() + ->fe_add_string(AST_String::narrow_from_decl($$)); + } + } + | string_head + { + idl_global->set_parse_state(IDL_GlobalData::PS_StringCompleted); + /* + * Create a node representing a string + */ + $$ = + idl_global->gen()->create_string( + idl_global->gen()->create_expr((unsigned long) 0)); + /* + * Add this AST_String to the types defined in the global scope + */ + (void) idl_global->root() + ->fe_add_string(AST_String::narrow_from_decl($$)); + } + ; + +string_head: + STRING + { + idl_global->set_parse_state(IDL_GlobalData::PS_StringSeen); + } + ; + +wstring_type_spec + : wstring_head + '<' + { + idl_global->set_parse_state(IDL_GlobalData::PS_StringSqSeen); + } + positive_int_expr + { + idl_global->set_parse_state(IDL_GlobalData::PS_StringExprSeen); + } + '>' + { + idl_global->set_parse_state(IDL_GlobalData::PS_StringQsSeen); + /* + * Create a node representing a string + */ + if ($4 == NULL || $4->coerce(AST_Expression::EV_ulong) == NULL) { + idl_global->err()->coercion_error($4, AST_Expression::EV_ulong); + $$ = NULL; + } else { + $$ = idl_global->gen()->create_wstring($4); + /* + * Add this AST_String to the types defined in the global scope + */ + (void) idl_global->root() + ->fe_add_string(AST_String::narrow_from_decl($$)); + } + } + | wstring_head + { + idl_global->set_parse_state(IDL_GlobalData::PS_StringCompleted); + /* + * Create a node representing a string + */ + $$ = + idl_global->gen()->create_wstring( + idl_global->gen()->create_expr((unsigned long) 0)); + /* + * Add this AST_String to the types defined in the global scope + */ + (void) idl_global->root() + ->fe_add_string(AST_String::narrow_from_decl($$)); + } + ; + +wstring_head: + WSTRING + { + idl_global->set_parse_state(IDL_GlobalData::PS_StringSeen); + } + ; + +array_declarator : + id + { + idl_global->set_parse_state(IDL_GlobalData::PS_ArrayIDSeen); + } + at_least_one_array_dim + { + idl_global->set_parse_state(IDL_GlobalData::PS_ArrayCompleted); + /* + * Create a node representing an array + */ + if ($3 != NULL) { + $$ = idl_global->gen()->create_array(new UTL_ScopedName($1, NULL), + $3->length(), $3); + } + } + ; + +at_least_one_array_dim : + array_dim array_dims + { + $$ = new UTL_ExprList($1, $2); + } + ; + +array_dims + : array_dims array_dim + { + if ($1 == NULL) + $$ = new UTL_ExprList($2, NULL); + else { + $1->nconc(new UTL_ExprList($2, NULL)); + $$ = $1; + } + } + | /* EMPTY */ + { + $$ = NULL; + } + ; + +array_dim : + '[' + { + idl_global->set_parse_state(IDL_GlobalData::PS_DimSqSeen); + } + positive_int_expr + { + idl_global->set_parse_state(IDL_GlobalData::PS_DimExprSeen); + } + ']' + { + idl_global->set_parse_state(IDL_GlobalData::PS_DimQsSeen); + /* + * Array dimensions are expressions which must be coerced to + * positive integers + */ + if ($3 == NULL || $3->coerce(AST_Expression::EV_ulong) == NULL) { + idl_global->err()->coercion_error($3, AST_Expression::EV_ulong); + $$ = NULL; + } else + $$ = $3; + } + ; + +attribute: + opt_readonly + ATTRIBUTE + { + idl_global->set_parse_state(IDL_GlobalData::PS_AttrSeen); + } + simple_type_spec + { + idl_global->set_parse_state(IDL_GlobalData::PS_AttrTypeSeen); + } + at_least_one_declarator + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_DecllistActiveIterator *l = NULL; + AST_Attribute *a = NULL; + FE_Declarator *d = NULL; + UTL_StrList *p = idl_global->pragmas(); + + idl_global->set_parse_state(IDL_GlobalData::PS_AttrCompleted); + /* + * Create nodes representing attributes and add them to the + * enclosing scope + */ + if (s != NULL && $4 != NULL && $6 != NULL) { + l = new UTL_DecllistActiveIterator($6); + for (;!(l->is_done()); l->next()) { + d = l->item(); + if (d == NULL) + continue; + AST_Type *tp = d->compose($4); + if (tp == NULL) + continue; + a = idl_global->gen()->create_attribute($1, tp, d->name(), p); + /* + * Add one attribute to the enclosing scope + */ + (void) s->fe_add_attribute(a); + } + delete l; + } + } + ; + +opt_readonly + : READONLY + { + idl_global->set_parse_state(IDL_GlobalData::PS_AttrROSeen); + $$ = I_TRUE; + } + | /* EMPTY */ + { + $$ = I_FALSE; + } + ; + +exception : + EXCEPTION + { + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptSeen); + } + id + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_ScopedName *n = new UTL_ScopedName($3, NULL); + AST_Exception *e = NULL; + UTL_StrList *p = idl_global->pragmas(); + AST_Decl *v = NULL; + + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptIDSeen); + /* + * Create a node representing an exception and add it to + * the enclosing scope + */ + if (s != NULL) { + e = idl_global->gen()->create_exception(n, p); + (void) s->fe_add_exception(e); + } + /* + * Push the exception scope on the scope stack + */ + idl_global->scopes()->push(e); + } + '{' + { + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptSqSeen); + } + members + { + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptBodySeen); + } + '}' + { + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptQsSeen); + /* + * Done with this exception. Pop its scope from the scope stack + */ + idl_global->scopes()->pop(); + } + ; + +operation : + opt_op_attribute + op_type_spec + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpTypeSeen); + } + IDENTIFIER + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_ScopedName *n = + new UTL_ScopedName(new Identifier($4, 1, 0, I_FALSE), NULL); + AST_Operation *o = NULL; + UTL_StrList *p = idl_global->pragmas(); + + idl_global->set_parse_state(IDL_GlobalData::PS_OpIDSeen); + /* + * Create a node representing an operation on an interface + * and add it to its enclosing scope + */ + if (s != NULL && $2 != NULL) { + AST_Type *tp = AST_Type::narrow_from_decl($2); + if (tp == NULL) { + idl_global->err()->not_a_type($2); + } else if (tp->node_type() == AST_Decl::NT_except) { + idl_global->err()->not_a_type($2); + } else { + o = idl_global->gen()->create_operation(tp, $1, n, p); + (void) s->fe_add_operation(o); + } + } + /* + * Push the operation scope onto the scopes stack + */ + idl_global->scopes()->push(o); + } + parameter_list + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpParsCompleted); + } + opt_raises + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseCompleted); + } + opt_context + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + AST_Operation *o = NULL; + + idl_global->set_parse_state(IDL_GlobalData::PS_OpCompleted); + /* + * Add exceptions and context to the operation + */ + if (s != NULL && s->scope_node_type() == AST_Decl::NT_op) { + o = AST_Operation::narrow_from_scope(s); + + if ($8 != NULL && o != NULL) + (void) o->fe_add_exceptions($8); + if ($10 != NULL) + (void) o->fe_add_context($10); + } + /* + * Done with this operation. Pop its scope from the scopes stack + */ + idl_global->scopes()->pop(); + } + ; + +opt_op_attribute + : ONEWAY + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpAttrSeen); + $$ = AST_Operation::OP_oneway; + } + | IDEMPOTENT + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpAttrSeen); + $$ = AST_Operation::OP_idempotent; + } + | /* EMPTY */ + { + $$ = AST_Operation::OP_noflags; + } + ; + +op_type_spec + : simple_type_spec + | VOID + { + $$ = + idl_global->scopes()->bottom() + ->lookup_primitive_type(AST_Expression::EV_void); + } + ; + +parameter_list + : '(' + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpSqSeen); + } + ')' + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpQsSeen); + } + | '(' + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpSqSeen); + } + at_least_one_parameter + ')' + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpQsSeen); + } + ; + +at_least_one_parameter : parameter parameters ; + +parameters + : parameters + ',' + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpParCommaSeen); + } + parameter + | /* EMPTY */ + ; + +parameter : + direction + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpParDirSeen); + } + simple_type_spec + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpParTypeSeen); + } + declarator + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + AST_Argument *a = NULL; + UTL_StrList *p = idl_global->pragmas(); + + idl_global->set_parse_state(IDL_GlobalData::PS_OpParDeclSeen); + /* + * Create a node representing an argument to an operation + * Add it to the enclosing scope (the operation scope) + */ + if ($3 != NULL && $5 != NULL && s != NULL) { + AST_Type *tp = $5->compose($3); + if (tp != NULL) { + a = idl_global->gen()->create_argument($1, tp, $5->name(), p); + (void) s->fe_add_argument(a); + } + } + } + ; + +direction + : IN + { + $$ = AST_Argument::dir_IN; + } + | OUT + { + $$ = AST_Argument::dir_OUT; + } + | INOUT + { + $$ = AST_Argument::dir_INOUT; + } + ; + +opt_raises + : RAISES + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseSeen); + } + '(' + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseSqSeen); + } + at_least_one_scoped_name + ')' + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseQsSeen); + $$ = $5; + } + | /* EMPTY */ + { + $$ = NULL; + } + ; + +opt_context + : CONTEXT + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpContextSeen); + } + '(' + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpContextSqSeen); + } + at_least_one_string_literal + ')' + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpContextQsSeen); + $$ = $5; + } + | /* EMPTY */ + { + $$ = NULL; + } + ; + +at_least_one_string_literal : + STRING_LITERAL string_literals + { + $$ = new UTL_StrList($1, $2); + } + ; + +string_literals + : string_literals + ',' + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpContextCommaSeen); + } + STRING_LITERAL + { + if ($1 == NULL) + $$ = new UTL_StrList($4, NULL); + else { + $1->nconc(new UTL_StrList($4, NULL)); + $$ = $1; + } + } + | /* EMPTY */ + { + $$ = NULL; + } + ; + +%% +/* programs */ + +/* + * ??? + */ +int +yywrap() +{ + return 1; +} + +/* + * Report an error situation discovered in a production + * + * This does not do anything since we report all error situations through + * idl_global->err() operations + */ +void +yyerror(char *) +{ +} diff --git a/TAO/TAO_IDL/fe/lex.yy.cpp b/TAO/TAO_IDL/fe/lex.yy.cpp new file mode 100644 index 00000000000..7d85e6951be --- /dev/null +++ b/TAO/TAO_IDL/fe/lex.yy.cpp @@ -0,0 +1,2270 @@ +#include <stdio.h> +# define U(x) x +# define NLSTATE yyprevious=YYNEWLINE +# define BEGIN yybgin = yysvec + 1 + +# define INITIAL 0 +# define YYLERR yysvec +# define YYSTATE (yyestate-yysvec-1) +# define YYOPTIM 1 +# define YYLMAX BUFSIZ +#ifndef __cplusplus +# define output(c) (void)putc(c,yyout) +#else +# define lex_output(c) (void)putc(c,yyout) +#endif + +#if defined(__cplusplus) || defined(__STDC__) + +#if defined(__cplusplus) && defined(__EXTERN_C__) +extern "C" { +#endif + int yyback(int *, int); + int yyinput(void); + int yylook(void); + void yyoutput(int); + int yyracc(int); + int yyreject(void); + void yyunput(int); + int yylex(void); +#ifdef YYLEX_E + void yywoutput(wchar_t); + wchar_t yywinput(void); +#endif +#ifndef yyless + int yyless(int); +#endif +#ifndef yywrap + int yywrap(void); +#endif +#ifdef LEXDEBUG + void allprint(char); + void sprint(char *); +#endif +#if defined(__cplusplus) && defined(__EXTERN_C__) +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif + void exit(int); +#ifdef __cplusplus +} +#endif + +#endif +# define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;} +# define yymore() (yymorfg=1) +#ifndef __cplusplus +# define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar) +#else +# define lex_input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar) +#endif +#define ECHO fprintf(yyout, "%s",yytext) +# define REJECT { nstr = yyreject(); goto yyfussy;} +int yyleng; +char yytext[YYLMAX]; +int yymorfg; +extern char *yysptr, yysbuf[]; +int yytchar; +FILE *yyin = {stdin}, *yyout = {stdout}; +extern int yylineno; +struct yysvf { + struct yywork *yystoff; + struct yysvf *yyother; + int *yystops;}; +struct yysvf *yyestate; +extern struct yysvf yysvec[], *yybgin; + +# line 4 "idl.ll" +/* + +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. + + */ + + +# line 68 "idl.ll" +/* + * idl.ll - Lexical scanner for IDL 1.1 + */ + +#include "idl.h" +#include "idl_extern.h" + +#include "fe_private.h" + +#include <y.tab.hh> + +#include <string.h> + +static char idl_escape_reader(char *); +static double idl_atof(char *); +static long idl_atoi(char *, long); +static void idl_parse_line_and_file(char *); +static void idl_store_pragma(char *); + +// HPUX has yytext typed to unsigned char *. We make sure here that +// we'll always use char * +static char *__yytext = (char *) yytext; + +# define YYNEWLINE 10 +yylex(){ +int nstr; extern int yyprevious; +#ifdef __cplusplus +/* to avoid CC and lint complaining yyfussy not being used ...*/ +static int __lex_hack = 0; +if (__lex_hack) goto yyfussy; +#endif +while((nstr = yylook()) >= 0) +yyfussy: switch(nstr){ +case 0: +if(yywrap()) return(0); break; +case 1: + +# line 94 "idl.ll" + return MODULE; +break; +case 2: + +# line 95 "idl.ll" + return RAISES; +break; +case 3: + +# line 96 "idl.ll" +return READONLY; +break; +case 4: + +# line 97 "idl.ll" +return ATTRIBUTE; +break; +case 5: + +# line 98 "idl.ll" +return EXCEPTION; +break; +case 6: + +# line 99 "idl.ll" + return CONTEXT; +break; +case 7: + +# line 100 "idl.ll" +return INTERFACE; +break; +case 8: + +# line 101 "idl.ll" + return CONST; +break; +case 9: + +# line 102 "idl.ll" + return TYPEDEF; +break; +case 10: + +# line 103 "idl.ll" + return STRUCT; +break; +case 11: + +# line 104 "idl.ll" + return ENUM; +break; +case 12: + +# line 105 "idl.ll" + return STRING; +break; +case 13: + +# line 106 "idl.ll" +return WSTRING; +break; +case 14: + +# line 107 "idl.ll" +return SEQUENCE; +break; +case 15: + +# line 108 "idl.ll" + return UNION; +break; +case 16: + +# line 109 "idl.ll" + return SWITCH; +break; +case 17: + +# line 110 "idl.ll" + return CASE; +break; +case 18: + +# line 111 "idl.ll" + return DEFAULT; +break; +case 19: + +# line 112 "idl.ll" + return FLOAT; +break; +case 20: + +# line 113 "idl.ll" + return DOUBLE; +break; +case 21: + +# line 114 "idl.ll" + return LONG; +break; +case 22: + +# line 115 "idl.ll" + return SHORT; +break; +case 23: + +# line 116 "idl.ll" +return UNSIGNED; +break; +case 24: + +# line 117 "idl.ll" + return CHAR; +break; +case 25: + +# line 118 "idl.ll" + return WCHAR; +break; +case 26: + +# line 119 "idl.ll" + return BOOLEAN; +break; +case 27: + +# line 120 "idl.ll" + return OCTET; +break; +case 28: + +# line 121 "idl.ll" + return VOID; +break; +case 29: + +# line 123 "idl.ll" + return TRUETOK; +break; +case 30: + +# line 124 "idl.ll" + return FALSETOK; +break; +case 31: + +# line 126 "idl.ll" + return INOUT; +break; +case 32: + +# line 127 "idl.ll" + return IN; +break; +case 33: + +# line 128 "idl.ll" + return OUT; +break; +case 34: + +# line 129 "idl.ll" + return ONEWAY; +break; +case 35: + +# line 131 "idl.ll" + return LEFT_SHIFT; +break; +case 36: + +# line 132 "idl.ll" + return RIGHT_SHIFT; +break; +case 37: + +# line 133 "idl.ll" + { + yylval.strval = "::"; + return SCOPE_DELIMITOR; + } +break; +case 38: + +# line 138 "idl.ll" +{ + char *z = (char *) malloc(strlen(__yytext) + 1); + strcpy(z, __yytext); + yylval.strval = z; + return IDENTIFIER; +} +break; +case 39: + +# line 145 "idl.ll" + { + yylval.dval = idl_atof(__yytext); + return FLOATING_PT_LITERAL; + } +break; +case 40: + +# line 149 "idl.ll" + { + yylval.dval = idl_atof(__yytext); + return FLOATING_PT_LITERAL; + } +break; +case 41: + +# line 154 "idl.ll" +{ + yylval.ival = idl_atoi(__yytext, 10); + return INTEGER_LITERAL; + } +break; +case 42: + +# line 158 "idl.ll" +{ + yylval.ival = idl_atoi(__yytext, 16); + return INTEGER_LITERAL; + } +break; +case 43: + +# line 162 "idl.ll" +{ + yylval.ival = idl_atoi(__yytext, 8); + return INTEGER_LITERAL; + } +break; +case 44: + +# line 167 "idl.ll" +{ + __yytext[strlen(__yytext)-1] = '\0'; + yylval.sval = new String(__yytext + 1); + return STRING_LITERAL; + } +break; +case 45: + +# line 172 "idl.ll" + { + yylval.cval = __yytext[1]; + return CHARACTER_LITERAL; + } +break; +case 46: + +# line 176 "idl.ll" +{ + // octal character constant + yylval.cval = idl_escape_reader(__yytext + 1); + return CHARACTER_LITERAL; + } +break; +case 47: + +# line 181 "idl.ll" +{ + yylval.cval = idl_escape_reader(__yytext + 1); + return CHARACTER_LITERAL; + } +break; +case 48: + +# line 185 "idl.ll" +{/* remember pragma */ + idl_global->set_lineno(idl_global->lineno() + 1); + idl_store_pragma(__yytext); + } +break; +case 49: + +# line 189 "idl.ll" + { + idl_parse_line_and_file(__yytext); + } +break; +case 50: + +# line 192 "idl.ll" + { + idl_parse_line_and_file(__yytext); + } +break; +case 51: + +# line 195 "idl.ll" +{ + idl_parse_line_and_file(__yytext); + } +break; +case 52: + +# line 198 "idl.ll" +{ + /* ignore cpp ident */ + idl_global->set_lineno(idl_global->lineno() + 1); + } +break; +case 53: + +# line 202 "idl.ll" +{ + /* ignore comments */ + idl_global->set_lineno(idl_global->lineno() + 1); + } +break; +case 54: + +# line 206 "idl.ll" + { + for(;;) { + char c = yyinput(); + if (c == '*') { + char next = yyinput(); + if (next == '/') + break; + else + yyunput(c); + if (c == '\n') + idl_global->set_lineno(idl_global->lineno() + 1); + } + } + } +break; +case 55: + +# line 220 "idl.ll" + ; +break; +case 56: + +# line 221 "idl.ll" + { + idl_global->set_lineno(idl_global->lineno() + 1); + } +break; +case 57: + +# line 224 "idl.ll" + return __yytext[0]; +break; +case -1: +break; +default: +(void)fprintf(yyout,"bad switch yylook %d",nstr); +} return(0); } +/* end of yylex */ + /* subroutines */ + +/* + * Strip down a name to the last component, i.e. everything after the last + * '/' character + */ +static char * +stripped_name(UTL_String *fn) +{ + char *n = fn->get_string(); + long l; + + if (n == NULL) + return NULL; + l = strlen(n); + for (n += l; l > 0 && *n != '/'; l--, n--); + if (*n == '/') n++; + return n; +} + +/* + * Parse a #line statement generated by the C preprocessor + */ +static void +idl_parse_line_and_file(char *buf) +{ + char *r = buf; + char *h; + UTL_String *nm; + + /* Skip initial '#' */ + if (*r != '#') { + return; + } + + /* Find line number */ + for (r++; *r == ' ' || *r == '\t'; r++); + h = r; + for (; *r != '\0' && *r != ' ' && *r != '\t'; r++); + *r++ = 0; + idl_global->set_lineno(idl_atoi(h, 10)); + + /* Find file name, if present */ + for (; *r != '"'; r++) { + if (*r == '\n' || *r == '\0') + return; + } + h = ++r; + for (; *r != '"'; r++); + *r = 0; + if (*h == '\0') + idl_global->set_filename(new String("standard input")); + else + idl_global->set_filename(new String(h)); + + idl_global->set_in_main_file( + (idl_global->filename()->compare(idl_global->real_filename())) ? + I_TRUE : + I_FALSE + ); + /* + * If it's an import file store the stripped name for the BE to use + */ + if (!(idl_global->in_main_file()) && idl_global->import()) { + nm = new UTL_String(stripped_name(idl_global->filename())); + idl_global->store_include_file_name(nm); + } +} + +/* + * Store a #pragma line into the list of pragmas + */ +static void +idl_store_pragma(char *buf) +{ + char *cp = buf + 1; + while(*cp != 'p') + cp++; + while(*cp != ' ' && *cp != '\t') + cp++; + while(*cp == ' ' || *cp == '\t') + cp++; + char pragma[80]; + char *pp = pragma; + while(*cp != '\n') { + *pp++ = *cp++; + } + *pp = 0; + if (strcmp(pragma, "import") == 0) { + idl_global->set_import(I_TRUE); + return; + } + if (strcmp(pragma, "include") == 0) { + idl_global->set_import(I_FALSE); + return; + } + UTL_StrList *p = idl_global->pragmas(); + if (p == NULL) + idl_global->set_pragmas(new UTL_StrList(new String(buf), NULL)); + else { + p->nconc(new UTL_StrList(new String(buf), NULL)); + idl_global->set_pragmas(p); + } +} + +/* + * idl_atoi - Convert a string of digits into an integer according to base b + */ +static long +idl_atoi(char *s, long b) +{ + long r = 0; + long negative = 0; + + if (*s == '-') { + negative = 1; + s++; + } + if (b == 8 && *s == '0') + s++; + else if (b == 16 && *s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X')) + s += 2; + + for (; *s; s++) + if (*s <= '9' && *s >= '0') + r = (r * b) + (*s - '0'); + else if (b > 10 && *s <= 'f' && *s >= 'a') + r = (r * b) + (*s - 'a' + 10); + else if (b > 10 && *s <= 'F' && *s >= 'A') + r = (r * b) + (*s - 'A' + 10); + else + break; + + if (negative) + r *= -1; + + return r; +} + +/* + * Convert a string to a float; atof doesn't seem to work, always. + */ +static double +idl_atof(char *s) +{ + char *h = s; + double d = 0.0; + double f = 0.0; + double e, k; + long neg = 0, negexp = 0; + + if (*s == '-') { + neg = 1; + s++; + } + while (*s >= '0' && *s <= '9') { + d = (d * 10) + *s - '0'; + s++; + } + if (*s == '.') { + s++; + e = 10; + while (*s >= '0' && *s <= '9') { + d += (*s - '0') / (e * 1.0); + e *= 10; + s++; + } + } + if (*s == 'e' || *s == 'E') { + s++; + if (*s == '-') { + negexp = 1; + s++; + } else if (*s == '+') + s++; + e = 0; + while (*s >= '0' && *s <= '9') { + e = (e * 10) + *s - '0'; + s++; + } + if (e > 0) { + for (k = 1; e > 0; k *= 10, e--); + if (negexp) + d /= k; + else + d *= k; + } + } + + if (neg) d *= -1.0; + + return d; +} + +/* + * Convert (some) escaped characters into their ascii values + */ +static char +idl_escape_reader( + char *str +) +{ + if (str[0] != '\\') { + return str[0]; + } + + switch (str[1]) { + case 'n': + return '\n'; + case 't': + return '\t'; + case 'v': + return '\v'; + case 'b': + return '\b'; + case 'r': + return '\r'; + case 'f': + return '\f'; + case 'a': + return '\a'; + case '\\': + return '\\'; + case '\?': + return '?'; + case '\'': + return '\''; + case '"': + return '"'; + case 'x': + { + // hex value + for (int i = 2; str[i] != '\0' && isxdigit(str[i]); i++) { + continue; + } + char save = str[i]; + str[i] = '\0'; + char out = (char)idl_atoi(&str[2], 16); + str[i] = save; + return out; + } + break; + default: + // check for octal value + if (str[1] >= '0' && str[1] <= '7') { + for (int i = 1; str[i] >= '0' && str[i] <= '7'; i++) { + continue; + } + char save = str[i]; + str[i] = '\0'; + char out = (char)idl_atoi(&str[1], 8); + str[i] = save; + return out; + } else { + return str[1] - 'a'; + } + break; + } +} +int yyvstop[] = { +0, + +55, +0, + +55, +0, + +57, +0, + +55, +57, +0, + +56, +0, + +57, +0, + +57, +0, + +57, +0, + +57, +0, + +43, +57, +0, + +41, +57, +0, + +57, +0, + +57, +0, + +57, +0, + +38, +57, +0, + +38, +57, +0, + +38, +57, +0, + +38, +57, +0, + +38, +57, +0, + +38, +57, +0, + +38, +57, +0, + +38, +57, +0, + +38, +57, +0, + +38, +57, +0, + +38, +57, +0, + +38, +57, +0, + +38, +57, +0, + +38, +57, +0, + +38, +57, +0, + +38, +57, +0, + +38, +57, +0, + +38, +57, +0, + +38, +57, +0, + +57, +0, + +55, +0, + +44, +0, + +43, +0, + +41, +0, + +54, +0, + +39, +0, + +43, +0, + +37, +0, + +35, +0, + +36, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +32, +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +51, +0, + +45, +0, + +45, +0, + +53, +0, + +39, +0, + +40, +0, + +42, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +33, +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +47, +0, + +46, +47, +0, + +39, +0, + +40, +0, + +38, +0, + +29, +38, +0, + +38, +0, + +38, +0, + +17, +38, +0, + +24, +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +11, +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +21, +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +28, +38, +0, + +38, +0, + +38, +0, + +46, +0, + +30, +38, +0, + +38, +0, + +38, +0, + +8, +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +19, +38, +0, + +31, +38, +0, + +38, +0, + +38, +0, + +27, +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +22, +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +15, +38, +0, + +38, +0, + +38, +0, + +38, +0, + +50, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +20, +38, +0, + +38, +0, + +38, +0, + +1, +38, +0, + +34, +38, +0, + +2, +38, +0, + +38, +0, + +38, +0, + +12, +38, +0, + +10, +38, +0, + +16, +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +49, +0, + +38, +0, + +26, +38, +0, + +6, +38, +0, + +18, +38, +0, + +38, +0, + +38, +0, + +38, +0, + +38, +0, + +9, +38, +0, + +38, +0, + +25, +38, +0, + +38, +0, + +52, +0, + +38, +0, + +38, +0, + +38, +0, + +3, +38, +0, + +14, +38, +0, + +23, +38, +0, + +38, +0, + +4, +38, +0, + +5, +38, +0, + +7, +38, +0, + +13, +38, +0, + +48, +0, +0}; +# define YYTYPE unsigned char +struct yywork { YYTYPE verify, advance; } yycrank[] = { +0,0, 0,0, 1,3, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 1,4, 1,5, +0,0, 4,35, 0,0, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 0,0, 1,6, +4,35, 0,0, 0,0, 0,0, +1,7, 0,0, 0,0, 0,0, +1,3, 0,0, 1,8, 84,129, +1,9, 1,10, 1,11, 38,88, +89,133, 0,0, 0,0, 9,42, +0,0, 1,11, 0,0, 1,12, +9,43, 1,13, 0,0, 1,14, +0,0, 0,0, 1,15, 11,44, +0,0, 11,41, 1,15, 1,16, +1,15, 12,49, 13,50, 14,51, +130,129, 1,15, 16,53, 0,0, +0,0, 99,140, 0,0, 0,0, +0,0, 1,17, 0,0, 0,0, +53,98, 1,15, 11,47, 0,0, +0,0, 0,0, 17,54, 98,139, +1,3, 54,99, 1,18, 1,19, +1,20, 1,21, 1,22, 1,23, +0,0, 6,36, 1,24, 0,0, +0,0, 1,25, 1,26, 58,103, +1,27, 6,36, 6,36, 1,28, +1,29, 1,30, 1,31, 1,32, +1,33, 2,34, 11,47, 19,56, +23,64, 2,7, 21,60, 20,57, +18,55, 22,62, 24,65, 2,8, +25,66, 2,9, 20,58, 26,67, +21,61, 30,77, 6,37, 22,63, +27,68, 20,59, 31,78, 32,79, +2,12, 28,71, 2,13, 6,36, +2,14, 28,72, 33,80, 27,69, +6,36, 6,36, 41,44, 55,100, +41,41, 56,101, 27,70, 57,102, +6,36, 29,73, 59,104, 60,105, +29,74, 61,106, 33,81, 62,107, +63,108, 6,36, 2,17, 64,109, +66,112, 6,36, 6,36, 6,36, +29,75, 41,47, 67,113, 29,76, +6,36, 7,38, 68,114, 2,18, +2,19, 2,20, 2,21, 2,22, +2,23, 7,38, 7,0, 2,24, +6,36, 65,110, 2,25, 2,26, +69,115, 2,27, 65,111, 6,36, +2,28, 2,29, 2,30, 2,31, +2,32, 2,33, 70,116, 71,117, +72,118, 41,47, 73,119, 74,120, +75,121, 76,122, 7,38, 46,46, +46,46, 46,46, 46,46, 46,46, +46,46, 46,46, 46,46, 7,38, +77,123, 78,124, 79,126, 80,127, +7,38, 7,38, 81,128, 86,131, +87,132, 100,141, 101,142, 78,125, +7,38, 102,143, 103,144, 104,145, +104,146, 105,147, 106,148, 107,149, +108,150, 7,38, 109,151, 110,152, +111,153, 7,38, 7,38, 7,38, +112,154, 113,155, 114,156, 115,157, +7,38, 8,40, 8,41, 8,41, +8,41, 8,41, 8,41, 8,41, +8,41, 8,41, 8,41, 117,158, +7,38, 118,159, 119,160, 120,161, +7,39, 122,164, 10,44, 7,38, +10,45, 10,45, 10,45, 10,45, +10,45, 10,45, 10,45, 10,45, +10,46, 10,46, 123,165, 124,166, +125,167, 126,168, 127,169, 128,170, +131,172, 47,95, 132,173, 47,95, +139,176, 10,47, 47,96, 47,96, +47,96, 47,96, 47,96, 47,96, +47,96, 47,96, 47,96, 47,96, +91,134, 141,177, 142,178, 145,179, +146,180, 121,162, 147,181, 148,182, +10,48, 91,135, 91,135, 91,135, +91,135, 91,135, 91,135, 91,135, +91,135, 121,163, 150,183, 151,184, +152,185, 10,47, 153,186, 155,187, +15,52, 15,52, 15,52, 15,52, +15,52, 15,52, 15,52, 15,52, +15,52, 15,52, 156,188, 157,189, +158,190, 159,191, 160,192, 161,193, +10,48, 15,52, 15,52, 15,52, +15,52, 15,52, 15,52, 15,52, +15,52, 15,52, 15,52, 15,52, +15,52, 15,52, 15,52, 15,52, +15,52, 15,52, 15,52, 15,52, +15,52, 15,52, 15,52, 15,52, +15,52, 15,52, 15,52, 162,194, +163,195, 164,196, 165,197, 15,52, +166,198, 15,52, 15,52, 15,52, +15,52, 15,52, 15,52, 15,52, +15,52, 15,52, 15,52, 15,52, +15,52, 15,52, 15,52, 15,52, +15,52, 15,52, 15,52, 15,52, +15,52, 15,52, 15,52, 15,52, +15,52, 15,52, 15,52, 34,82, +34,83, 93,136, 167,199, 93,136, +169,200, 170,201, 93,137, 93,137, +93,137, 93,137, 93,137, 93,137, +93,137, 93,137, 93,137, 93,137, +39,89, 172,204, 173,205, 43,43, +175,174, 177,206, 34,84, 178,207, +39,89, 39,0, 171,202, 43,43, +43,92, 180,208, 96,138, 181,209, +182,210, 183,211, 186,212, 187,213, +96,138, 189,214, 34,85, 34,85, +34,85, 34,85, 34,85, 34,85, +34,85, 34,85, 34,85, 34,85, +171,203, 39,89, 190,215, 191,216, +43,43, 192,217, 39,90, 194,218, +195,219, 196,220, 39,89, 197,221, +199,222, 43,43, 96,138, 39,91, +39,91, 200,223, 43,43, 43,43, +96,138, 137,94, 201,224, 39,89, +204,226, 205,227, 43,43, 137,94, +206,228, 207,229, 208,230, 209,231, +39,89, 211,232, 212,233, 43,43, +39,89, 39,89, 39,89, 43,43, +43,43, 43,43, 216,234, 39,89, +217,235, 221,236, 43,43, 34,86, +222,237, 223,238, 224,239, 227,241, +228,242, 137,94, 34,87, 39,89, +232,243, 233,244, 43,43, 137,94, +234,245, 235,246, 39,89, 237,247, +239,248, 43,43, 44,44, 44,44, +44,44, 44,44, 44,44, 44,44, +44,44, 44,44, 44,44, 44,44, +95,96, 95,96, 95,96, 95,96, +95,96, 95,96, 95,96, 95,96, +95,96, 95,96, 242,250, 44,93, +44,94, 243,251, 244,252, 248,253, +241,249, 45,44, 44,94, 45,45, +45,45, 45,45, 45,45, 45,45, +45,45, 45,45, 45,45, 45,46, +45,46, 136,137, 136,137, 136,137, +136,137, 136,137, 136,137, 136,137, +136,137, 136,137, 136,137, 241,249, +45,47, 0,0, 0,0, 44,93, +44,94, 85,83, 0,0, 0,0, +0,0, 0,0, 44,94, 0,0, +0,0, 0,0, 0,0, 203,225, +48,97, 48,97, 48,97, 48,97, +48,97, 48,97, 48,97, 48,97, +48,97, 48,97, 0,0, 85,130, +0,0, 0,0, 0,0, 129,129, +45,47, 48,97, 48,97, 48,97, +48,97, 48,97, 48,97, 129,129, +129,129, 0,0, 0,0, 85,85, +85,85, 85,85, 85,85, 85,85, +85,85, 85,85, 85,85, 85,85, +85,85, 203,203, 203,203, 203,203, +203,203, 203,203, 203,203, 203,203, +203,203, 203,203, 203,203, 0,0, +129,171, 48,97, 48,97, 48,97, +48,97, 48,97, 48,97, 0,0, +0,0, 129,129, 0,0, 0,0, +0,0, 0,0, 129,129, 129,129, +0,0, 0,0, 226,226, 0,0, +0,0, 0,0, 129,129, 0,0, +0,0, 0,0, 226,226, 226,240, +0,0, 0,0, 0,0, 129,129, +0,0, 0,0, 135,174, 129,129, +129,129, 129,129, 0,0, 0,0, +0,0, 0,0, 129,129, 135,175, +135,175, 135,175, 135,175, 135,175, +135,175, 135,175, 135,175, 226,226, +0,0, 0,0, 129,129, 0,0, +0,0, 0,0, 0,0, 249,249, +226,226, 129,129, 0,0, 0,0, +0,0, 226,226, 226,226, 249,249, +249,254, 0,0, 0,0, 0,0, +0,0, 226,226, 0,0, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 226,226, 0,0, +0,0, 0,0, 226,226, 226,226, +226,226, 0,0, 0,0, 0,0, +249,249, 226,226, 0,0, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 249,249, 0,0, 0,0, +0,0, 226,226, 249,249, 249,249, +0,0, 0,0, 0,0, 0,0, +226,226, 0,0, 249,249, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 0,0, 249,249, +0,0, 0,0, 0,0, 249,249, +249,249, 249,249, 0,0, 0,0, +0,0, 0,0, 249,249, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 249,249, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 249,249, 0,0, 0,0, +0,0}; +struct yysvf yysvec[] = { +0, 0, 0, +yycrank+-1, 0, yyvstop+1, +yycrank+-86, yysvec+1, yyvstop+3, +yycrank+0, 0, yyvstop+5, +yycrank+4, 0, yyvstop+7, +yycrank+0, 0, yyvstop+10, +yycrank+-104, 0, yyvstop+12, +yycrank+-180, 0, yyvstop+14, +yycrank+209, 0, yyvstop+16, +yycrank+13, 0, yyvstop+18, +yycrank+228, 0, yyvstop+20, +yycrank+21, yysvec+8, yyvstop+23, +yycrank+15, 0, yyvstop+26, +yycrank+14, 0, yyvstop+28, +yycrank+13, 0, yyvstop+30, +yycrank+284, 0, yyvstop+32, +yycrank+13, yysvec+15, yyvstop+35, +yycrank+12, yysvec+15, yyvstop+38, +yycrank+12, yysvec+15, yyvstop+41, +yycrank+12, yysvec+15, yyvstop+44, +yycrank+30, yysvec+15, yyvstop+47, +yycrank+25, yysvec+15, yyvstop+50, +yycrank+19, yysvec+15, yyvstop+53, +yycrank+16, yysvec+15, yyvstop+56, +yycrank+20, yysvec+15, yyvstop+59, +yycrank+21, yysvec+15, yyvstop+62, +yycrank+24, yysvec+15, yyvstop+65, +yycrank+41, yysvec+15, yyvstop+68, +yycrank+48, yysvec+15, yyvstop+71, +yycrank+60, yysvec+15, yyvstop+74, +yycrank+16, yysvec+15, yyvstop+77, +yycrank+32, yysvec+15, yyvstop+80, +yycrank+32, yysvec+15, yyvstop+83, +yycrank+51, yysvec+15, yyvstop+86, +yycrank+398, 0, yyvstop+89, +yycrank+0, yysvec+4, yyvstop+91, +yycrank+0, yysvec+6, 0, +yycrank+0, 0, yyvstop+93, +yycrank+12, 0, 0, +yycrank+-423, 0, 0, +yycrank+0, yysvec+10, yyvstop+95, +yycrank+108, yysvec+8, yyvstop+97, +yycrank+0, 0, yyvstop+99, +yycrank+-426, 0, 0, +yycrank+474, 0, yyvstop+101, +yycrank+503, 0, yyvstop+103, +yycrank+167, yysvec+45, 0, +yycrank+250, 0, 0, +yycrank+540, 0, 0, +yycrank+0, 0, yyvstop+105, +yycrank+0, 0, yyvstop+107, +yycrank+0, 0, yyvstop+109, +yycrank+0, yysvec+15, yyvstop+111, +yycrank+12, yysvec+15, yyvstop+113, +yycrank+12, yysvec+15, yyvstop+115, +yycrank+39, yysvec+15, yyvstop+117, +yycrank+46, yysvec+15, yyvstop+119, +yycrank+44, yysvec+15, yyvstop+121, +yycrank+14, yysvec+15, yyvstop+123, +yycrank+52, yysvec+15, yyvstop+125, +yycrank+61, yysvec+15, yyvstop+127, +yycrank+48, yysvec+15, yyvstop+129, +yycrank+50, yysvec+15, yyvstop+131, +yycrank+69, yysvec+15, yyvstop+133, +yycrank+60, yysvec+15, yyvstop+135, +yycrank+82, yysvec+15, yyvstop+137, +yycrank+62, yysvec+15, yyvstop+140, +yycrank+78, yysvec+15, yyvstop+142, +yycrank+66, yysvec+15, yyvstop+144, +yycrank+95, yysvec+15, yyvstop+146, +yycrank+90, yysvec+15, yyvstop+148, +yycrank+102, yysvec+15, yyvstop+150, +yycrank+111, yysvec+15, yyvstop+152, +yycrank+97, yysvec+15, yyvstop+154, +yycrank+100, yysvec+15, yyvstop+156, +yycrank+98, yysvec+15, yyvstop+158, +yycrank+108, yysvec+15, yyvstop+160, +yycrank+112, yysvec+15, yyvstop+162, +yycrank+120, yysvec+15, yyvstop+164, +yycrank+121, yysvec+15, yyvstop+166, +yycrank+123, yysvec+15, yyvstop+168, +yycrank+114, yysvec+15, yyvstop+170, +yycrank+0, yysvec+34, 0, +yycrank+0, 0, yyvstop+172, +yycrank+13, yysvec+34, 0, +yycrank+567, 0, 0, +yycrank+131, 0, 0, +yycrank+118, 0, 0, +yycrank+0, 0, yyvstop+174, +yycrank+13, 0, 0, +yycrank+0, yysvec+89, yyvstop+176, +yycrank+269, 0, 0, +yycrank+0, 0, yyvstop+178, +yycrank+366, 0, 0, +yycrank+0, 0, yyvstop+180, +yycrank+484, 0, 0, +yycrank+368, yysvec+95, yyvstop+182, +yycrank+0, yysvec+48, yyvstop+184, +yycrank+12, yysvec+15, yyvstop+186, +yycrank+12, yysvec+15, yyvstop+188, +yycrank+119, yysvec+15, yyvstop+190, +yycrank+126, yysvec+15, yyvstop+192, +yycrank+136, yysvec+15, yyvstop+194, +yycrank+124, yysvec+15, yyvstop+196, +yycrank+124, yysvec+15, yyvstop+198, +yycrank+144, yysvec+15, yyvstop+200, +yycrank+144, yysvec+15, yyvstop+202, +yycrank+134, yysvec+15, yyvstop+204, +yycrank+143, yysvec+15, yyvstop+206, +yycrank+149, yysvec+15, yyvstop+208, +yycrank+130, yysvec+15, yyvstop+210, +yycrank+147, yysvec+15, yyvstop+212, +yycrank+149, yysvec+15, yyvstop+214, +yycrank+136, yysvec+15, yyvstop+216, +yycrank+153, yysvec+15, yyvstop+218, +yycrank+136, yysvec+15, yyvstop+220, +yycrank+0, yysvec+15, yyvstop+222, +yycrank+152, yysvec+15, yyvstop+225, +yycrank+169, yysvec+15, yyvstop+227, +yycrank+153, yysvec+15, yyvstop+229, +yycrank+157, yysvec+15, yyvstop+231, +yycrank+208, yysvec+15, yyvstop+233, +yycrank+157, yysvec+15, yyvstop+235, +yycrank+185, yysvec+15, yyvstop+237, +yycrank+176, yysvec+15, yyvstop+239, +yycrank+183, yysvec+15, yyvstop+241, +yycrank+189, yysvec+15, yyvstop+243, +yycrank+193, yysvec+15, yyvstop+245, +yycrank+177, yysvec+15, yyvstop+247, +yycrank+-602, 0, 0, +yycrank+42, 0, 0, +yycrank+191, 0, 0, +yycrank+197, 0, 0, +yycrank+0, 0, yyvstop+249, +yycrank+0, 0, yyvstop+251, +yycrank+631, 0, 0, +yycrank+513, 0, 0, +yycrank+407, yysvec+136, yyvstop+254, +yycrank+0, 0, yyvstop+256, +yycrank+227, yysvec+15, yyvstop+258, +yycrank+0, yysvec+15, yyvstop+260, +yycrank+204, yysvec+15, yyvstop+263, +yycrank+209, yysvec+15, yyvstop+265, +yycrank+0, yysvec+15, yyvstop+267, +yycrank+0, yysvec+15, yyvstop+270, +yycrank+195, yysvec+15, yyvstop+273, +yycrank+211, yysvec+15, yyvstop+275, +yycrank+197, yysvec+15, yyvstop+277, +yycrank+207, yysvec+15, yyvstop+279, +yycrank+0, yysvec+15, yyvstop+281, +yycrank+214, yysvec+15, yyvstop+284, +yycrank+211, yysvec+15, yyvstop+286, +yycrank+212, yysvec+15, yyvstop+288, +yycrank+216, yysvec+15, yyvstop+290, +yycrank+0, yysvec+15, yyvstop+292, +yycrank+223, yysvec+15, yyvstop+295, +yycrank+226, yysvec+15, yyvstop+297, +yycrank+246, yysvec+15, yyvstop+299, +yycrank+243, yysvec+15, yyvstop+301, +yycrank+234, yysvec+15, yyvstop+303, +yycrank+245, yysvec+15, yyvstop+305, +yycrank+231, yysvec+15, yyvstop+307, +yycrank+265, yysvec+15, yyvstop+309, +yycrank+277, yysvec+15, yyvstop+311, +yycrank+278, yysvec+15, yyvstop+313, +yycrank+278, yysvec+15, yyvstop+315, +yycrank+270, yysvec+15, yyvstop+317, +yycrank+307, yysvec+15, yyvstop+319, +yycrank+0, yysvec+15, yyvstop+321, +yycrank+298, yysvec+15, yyvstop+324, +yycrank+308, yysvec+15, yyvstop+326, +yycrank+424, 0, 0, +yycrank+315, 0, 0, +yycrank+323, 0, 0, +yycrank+0, 0, yyvstop+328, +yycrank+389, 0, 0, +yycrank+0, yysvec+15, yyvstop+330, +yycrank+331, yysvec+15, yyvstop+333, +yycrank+334, yysvec+15, yyvstop+335, +yycrank+0, yysvec+15, yyvstop+337, +yycrank+317, yysvec+15, yyvstop+340, +yycrank+331, yysvec+15, yyvstop+342, +yycrank+339, yysvec+15, yyvstop+344, +yycrank+325, yysvec+15, yyvstop+346, +yycrank+0, yysvec+15, yyvstop+348, +yycrank+0, yysvec+15, yyvstop+351, +yycrank+340, yysvec+15, yyvstop+354, +yycrank+342, yysvec+15, yyvstop+356, +yycrank+0, yysvec+15, yyvstop+358, +yycrank+324, yysvec+15, yyvstop+361, +yycrank+343, yysvec+15, yyvstop+363, +yycrank+349, yysvec+15, yyvstop+365, +yycrank+351, yysvec+15, yyvstop+367, +yycrank+0, yysvec+15, yyvstop+369, +yycrank+360, yysvec+15, yyvstop+372, +yycrank+348, yysvec+15, yyvstop+374, +yycrank+361, yysvec+15, yyvstop+376, +yycrank+366, yysvec+15, yyvstop+378, +yycrank+0, yysvec+15, yyvstop+380, +yycrank+358, yysvec+15, yyvstop+383, +yycrank+378, yysvec+15, yyvstop+385, +yycrank+368, yysvec+15, yyvstop+387, +yycrank+0, 0, yyvstop+389, +yycrank+577, 0, 0, +yycrank+364, 0, 0, +yycrank+372, 0, 0, +yycrank+367, yysvec+15, yyvstop+391, +yycrank+375, yysvec+15, yyvstop+393, +yycrank+370, yysvec+15, yyvstop+395, +yycrank+371, yysvec+15, yyvstop+397, +yycrank+0, yysvec+15, yyvstop+399, +yycrank+384, yysvec+15, yyvstop+402, +yycrank+393, yysvec+15, yyvstop+404, +yycrank+0, yysvec+15, yyvstop+406, +yycrank+0, yysvec+15, yyvstop+409, +yycrank+0, yysvec+15, yyvstop+412, +yycrank+390, yysvec+15, yyvstop+415, +yycrank+401, yysvec+15, yyvstop+417, +yycrank+0, yysvec+15, yyvstop+419, +yycrank+0, yysvec+15, yyvstop+422, +yycrank+0, yysvec+15, yyvstop+425, +yycrank+399, yysvec+15, yyvstop+428, +yycrank+403, yysvec+15, yyvstop+430, +yycrank+389, yysvec+15, yyvstop+432, +yycrank+403, yysvec+15, yyvstop+434, +yycrank+0, 0, yyvstop+436, +yycrank+-653, 0, 0, +yycrank+410, 0, 0, +yycrank+392, yysvec+15, yyvstop+438, +yycrank+0, yysvec+15, yyvstop+440, +yycrank+0, yysvec+15, yyvstop+443, +yycrank+0, yysvec+15, yyvstop+446, +yycrank+401, yysvec+15, yyvstop+449, +yycrank+414, yysvec+15, yyvstop+451, +yycrank+395, yysvec+15, yyvstop+453, +yycrank+416, yysvec+15, yyvstop+455, +yycrank+0, yysvec+15, yyvstop+457, +yycrank+419, yysvec+15, yyvstop+460, +yycrank+0, yysvec+15, yyvstop+462, +yycrank+425, yysvec+15, yyvstop+465, +yycrank+0, 0, yyvstop+467, +yycrank+539, 0, 0, +yycrank+441, yysvec+15, yyvstop+469, +yycrank+435, yysvec+15, yyvstop+471, +yycrank+445, yysvec+15, yyvstop+473, +yycrank+0, yysvec+15, yyvstop+475, +yycrank+0, yysvec+15, yyvstop+478, +yycrank+0, yysvec+15, yyvstop+481, +yycrank+431, yysvec+15, yyvstop+484, +yycrank+-694, 0, 0, +yycrank+0, yysvec+15, yyvstop+486, +yycrank+0, yysvec+15, yyvstop+489, +yycrank+0, yysvec+15, yyvstop+492, +yycrank+0, yysvec+15, yyvstop+495, +yycrank+0, 0, yyvstop+498, +0, 0, 0}; +struct yywork *yytop = yycrank+789; +struct yysvf *yybgin = yysvec+1; +char yymatch[] = { + 0, 1, 1, 1, 1, 1, 1, 1, + 1, 9, 10, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 9, 1, 34, 1, 1, 1, 1, 1, + 1, 1, 1, 43, 1, 43, 1, 1, + 48, 49, 49, 49, 49, 49, 49, 49, + 56, 56, 1, 1, 1, 1, 1, 1, + 1, 65, 65, 65, 65, 69, 70, 71, + 71, 71, 71, 71, 76, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, + 88, 71, 71, 1, 1, 1, 1, 95, + 1, 65, 65, 65, 65, 69, 70, 71, + 71, 71, 71, 71, 76, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, + 88, 71, 71, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, +0}; +char yyextra[] = { +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0, +0}; +/* Copyright (c) 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#pragma ident "@(#)ncform 6.8 95/02/11 SMI" + +int yylineno =1; +# define YYU(x) x +# define NLSTATE yyprevious=YYNEWLINE +struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp; +char yysbuf[YYLMAX]; +char *yysptr = yysbuf; +int *yyfnd; +extern struct yysvf *yyestate; +int yyprevious = YYNEWLINE; +#if defined(__cplusplus) || defined(__STDC__) +int yylook(void) +#else +yylook() +#endif +{ + register struct yysvf *yystate, **lsp; + register struct yywork *yyt; + struct yysvf *yyz; + int yych, yyfirst; + struct yywork *yyr; +# ifdef LEXDEBUG + int debug; +# endif + char *yylastch; + /* start off machines */ +# ifdef LEXDEBUG + debug = 0; +# endif + yyfirst=1; + if (!yymorfg) + yylastch = yytext; + else { + yymorfg=0; + yylastch = yytext+yyleng; + } + for(;;){ + lsp = yylstate; + yyestate = yystate = yybgin; + if (yyprevious==YYNEWLINE) yystate++; + for (;;){ +# ifdef LEXDEBUG + if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1); +# endif + yyt = yystate->yystoff; + if(yyt == yycrank && !yyfirst){ /* may not be any transitions */ + yyz = yystate->yyother; + if(yyz == 0)break; + if(yyz->yystoff == yycrank)break; + } +#ifndef __cplusplus + *yylastch++ = yych = input(); +#else + *yylastch++ = yych = lex_input(); +#endif + if(yylastch > &yytext[YYLMAX]) { + fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); + exit(1); + } + yyfirst=0; + tryagain: +# ifdef LEXDEBUG + if(debug){ + fprintf(yyout,"char "); + allprint(yych); + putchar('\n'); + } +# endif + yyr = yyt; + if ( (int)yyt > (int)yycrank){ + yyt = yyr + yych; + if (yyt <= yytop && yyt->verify+yysvec == yystate){ + if(yyt->advance+yysvec == YYLERR) /* error transitions */ + {unput(*--yylastch);break;} + *lsp++ = yystate = yyt->advance+yysvec; + if(lsp > &yylstate[YYLMAX]) { + fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); + exit(1); + } + goto contin; + } + } +# ifdef YYOPTIM + else if((int)yyt < (int)yycrank) { /* r < yycrank */ + yyt = yyr = yycrank+(yycrank-yyt); +# ifdef LEXDEBUG + if(debug)fprintf(yyout,"compressed state\n"); +# endif + yyt = yyt + yych; + if(yyt <= yytop && yyt->verify+yysvec == yystate){ + if(yyt->advance+yysvec == YYLERR) /* error transitions */ + {unput(*--yylastch);break;} + *lsp++ = yystate = yyt->advance+yysvec; + if(lsp > &yylstate[YYLMAX]) { + fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); + exit(1); + } + goto contin; + } + yyt = yyr + YYU(yymatch[yych]); +# ifdef LEXDEBUG + if(debug){ + fprintf(yyout,"try fall back character "); + allprint(YYU(yymatch[yych])); + putchar('\n'); + } +# endif + if(yyt <= yytop && yyt->verify+yysvec == yystate){ + if(yyt->advance+yysvec == YYLERR) /* error transition */ + {unput(*--yylastch);break;} + *lsp++ = yystate = yyt->advance+yysvec; + if(lsp > &yylstate[YYLMAX]) { + fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); + exit(1); + } + goto contin; + } + } + if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){ +# ifdef LEXDEBUG + if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1); +# endif + goto tryagain; + } +# endif + else + {unput(*--yylastch);break;} + contin: +# ifdef LEXDEBUG + if(debug){ + fprintf(yyout,"state %d char ",yystate-yysvec-1); + allprint(yych); + putchar('\n'); + } +# endif + ; + } +# ifdef LEXDEBUG + if(debug){ + fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1); + allprint(yych); + putchar('\n'); + } +# endif + while (lsp-- > yylstate){ + *yylastch-- = 0; + if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){ + yyolsp = lsp; + if(yyextra[*yyfnd]){ /* must backup */ + while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){ + lsp--; + unput(*yylastch--); + } + } + yyprevious = YYU(*yylastch); + yylsp = lsp; + yyleng = yylastch-yytext+1; + yytext[yyleng] = 0; +# ifdef LEXDEBUG + if(debug){ + fprintf(yyout,"\nmatch "); + sprint(yytext); + fprintf(yyout," action %d\n",*yyfnd); + } +# endif + return(*yyfnd++); + } + unput(*yylastch); + } + if (yytext[0] == 0 /* && feof(yyin) */) + { + yysptr=yysbuf; + return(0); + } +#ifndef __cplusplus + yyprevious = yytext[0] = input(); + if (yyprevious>0) + output(yyprevious); +#else + yyprevious = yytext[0] = lex_input(); + if (yyprevious>0) + lex_output(yyprevious); +#endif + yylastch=yytext; +# ifdef LEXDEBUG + if(debug)putchar('\n'); +# endif + } + } +#if defined(__cplusplus) || defined(__STDC__) +int yyback(int *p, int m) +#else +yyback(p, m) + int *p; +#endif +{ + if (p==0) return(0); + while (*p) { + if (*p++ == m) + return(1); + } + return(0); +} + /* the following are only used in the lex library */ +#if defined(__cplusplus) || defined(__STDC__) +int yyinput(void) +#else +yyinput() +#endif +{ +#ifndef __cplusplus + return(input()); +#else + return(lex_input()); +#endif + } +#if defined(__cplusplus) || defined(__STDC__) +void yyoutput(int c) +#else +yyoutput(c) + int c; +#endif +{ +#ifndef __cplusplus + output(c); +#else + lex_output(c); +#endif + } +#if defined(__cplusplus) || defined(__STDC__) +void yyunput(int c) +#else +yyunput(c) + int c; +#endif +{ + unput(c); + } diff --git a/TAO/TAO_IDL/fe/y.tab.cpp b/TAO/TAO_IDL/fe/y.tab.cpp new file mode 100644 index 00000000000..198601ece21 --- /dev/null +++ b/TAO/TAO_IDL/fe/y.tab.cpp @@ -0,0 +1,3185 @@ + +# line 72 "idl.yy" +#include "idl.h" +#include "idl_extern.h" + +#include "fe_private.h" + +#include <stdio.h> + +#if (defined(apollo) || defined(hpux)) && defined(__cplusplus) +extern "C" int yywrap(); +#endif // (defined(apollo) || defined(hpux)) && defined(__cplusplus) + + +# line 89 "idl.yy" +typedef union +#ifdef __cplusplus + YYSTYPE +#endif + { + AST_Decl *dcval; /* Decl value */ + UTL_StrList *slval; /* String list */ + UTL_NameList *nlval; /* Name list */ + UTL_ExprList *elval; /* Expression list */ + UTL_LabelList *llval; /* Label list */ + UTL_DeclList *dlval; /* Declaration list */ + FE_InterfaceHeader *ihval; /* Interface header */ + AST_Expression *exval; /* Expression value */ + AST_UnionLabel *ulval; /* Union label */ + AST_Field *ffval; /* Field value */ + AST_Expression::ExprType etval; /* Expression type */ + AST_Argument::Direction dival; /* Argument direction */ + AST_Operation::Flags ofval; /* Operation flags */ + FE_Declarator *deval; /* Declarator value */ + idl_bool bval; /* Boolean value */ + long ival; /* Long value */ + double dval; /* Double value */ + float fval; /* Float value */ + char cval; /* Char value */ + + String *sval; /* String value */ + char *strval; /* char * value */ + Identifier *idval; /* Identifier */ + UTL_IdList *idlist; /* Identifier list */ +} YYSTYPE; +# define IDENTIFIER 257 +# define CONST 258 +# define MODULE 259 +# define INTERFACE 260 +# define TYPEDEF 261 +# define LONG 262 +# define SHORT 263 +# define UNSIGNED 264 +# define DOUBLE 265 +# define FLOAT 266 +# define CHAR 267 +# define WCHAR 268 +# define OCTET 269 +# define BOOLEAN 270 +# define ANY 271 +# define STRUCT 272 +# define UNION 273 +# define SWITCH 274 +# define ENUM 275 +# define SEQUENCE 276 +# define STRING 277 +# define WSTRING 278 +# define EXCEPTION 279 +# define CASE 280 +# define DEFAULT 281 +# define READONLY 282 +# define ATTRIBUTE 283 +# define ONEWAY 284 +# define IDEMPOTENT 285 +# define VOID 286 +# define IN 287 +# define OUT 288 +# define INOUT 289 +# define RAISES 290 +# define CONTEXT 291 +# define INTEGER_LITERAL 292 +# define STRING_LITERAL 293 +# define CHARACTER_LITERAL 294 +# define FLOATING_PT_LITERAL 295 +# define TRUETOK 296 +# define FALSETOK 297 +# define SCOPE_DELIMITOR 298 +# define LEFT_SHIFT 299 +# define RIGHT_SHIFT 300 + +#ifdef __STDC__ +#include <stdlib.h> +#include <string.h> +#else +#include <malloc.h> +#include <memory.h> +#endif + +#include <values.h> + +#ifdef __cplusplus + +#ifndef yyerror + void yyerror(const char *); +#endif + +#ifndef yylex +#ifdef __EXTERN_C__ + extern "C" { int yylex(void); } +#else + int yylex(void); +#endif +#endif + int yyparse(void); + +#endif +#define yyclearin yychar = -1 +#define yyerrok yyerrflag = 0 +extern int yychar; +extern int yyerrflag; +YYSTYPE yylval; +YYSTYPE yyval; +typedef int yytabelem; +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 150 +#endif +#if YYMAXDEPTH > 0 +int yy_yys[YYMAXDEPTH], *yys = yy_yys; +YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv; +#else /* user does initial allocation */ +int *yys; +YYSTYPE *yyv; +#endif +static int yymaxdepth = YYMAXDEPTH; +# define YYERRCODE 256 + +# line 2168 "idl.yy" + +/* programs */ + +/* + * ??? + */ +int +yywrap() +{ + return 1; +} + +/* + * Report an error situation discovered in a production + * + * This does not do anything since we report all error situations through + * idl_global->err() operations + */ +void +yyerror(char *) +{ +} +yytabelem yyexca[] ={ +-1, 0, + 0, 3, + -2, 0, +-1, 1, + 0, -1, + -2, 0, +-1, 3, + 0, 3, + 125, 3, + -2, 0, +-1, 23, + 123, 32, + -2, 57, +-1, 131, + 91, 224, + -2, 133, +-1, 146, + 257, 249, + 262, 249, + 263, 249, + 264, 249, + 265, 249, + 266, 249, + 267, 249, + 268, 249, + 269, 249, + 270, 249, + 271, 249, + 276, 249, + 277, 249, + 278, 249, + 283, 236, + 286, 249, + 298, 249, + 125, 25, + -2, 0, +-1, 178, + 125, 3, + -2, 0, +-1, 219, + 125, 240, + -2, 0, +-1, 263, + 125, 156, + -2, 0, +-1, 312, + 41, 252, + -2, 254, +-1, 346, + 125, 179, + -2, 0, + }; +# define YYNPROD 278 +# define YYLAST 501 +yytabelem yyact[]={ + + 68, 128, 152, 322, 334, 125, 51, 164, 127, 107, + 337, 224, 83, 227, 223, 204, 205, 74, 84, 85, + 72, 73, 75, 76, 78, 77, 79, 19, 20, 382, + 21, 86, 87, 88, 166, 98, 377, 100, 101, 102, + 55, 97, 341, 105, 319, 166, 83, 50, 161, 83, + 162, 236, 144, 69, 74, 84, 85, 72, 73, 75, + 76, 78, 77, 79, 19, 20, 63, 21, 86, 87, + 88, 62, 83, 324, 325, 326, 61, 74, 84, 85, + 72, 73, 75, 76, 78, 77, 79, 69, 339, 338, + 69, 86, 87, 88, 109, 115, 116, 110, 58, 13, + 92, 239, 13, 109, 138, 93, 83, 131, 228, 134, + 91, 299, 126, 69, 59, 99, 83, 159, 219, 140, + 151, 74, 84, 85, 72, 73, 75, 76, 78, 77, + 79, 163, 198, 83, 150, 86, 87, 88, 74, 84, + 85, 72, 73, 75, 76, 78, 77, 336, 90, 156, + 154, 259, 160, 87, 88, 83, 356, 69, 296, 158, + 295, 84, 85, 157, 6, 75, 76, 78, 77, 214, + 155, 339, 338, 21, 69, 5, 4, 285, 284, 283, + 229, 201, 217, 55, 189, 317, 14, 55, 145, 10, + 143, 142, 141, 103, 202, 306, 69, 199, 238, 55, + 19, 20, 111, 21, 2, 257, 256, 15, 25, 244, + 192, 218, 193, 194, 9, 139, 14, 18, 24, 10, + 112, 114, 113, 373, 360, 57, 12, 55, 307, 12, + 19, 20, 287, 21, 274, 56, 11, 15, 273, 11, + 272, 271, 131, 278, 270, 13, 269, 48, 277, 47, + 46, 83, 45, 44, 43, 375, 362, 173, 174, 41, + 380, 282, 83, 343, 206, 131, 207, 297, 196, 195, + 210, 55, 378, 286, 294, 208, 372, 13, 330, 320, + 209, 308, 298, 55, 255, 364, 167, 168, 169, 170, + 171, 172, 69, 342, 312, 225, 203, 167, 168, 169, + 170, 171, 172, 69, 381, 131, 371, 352, 60, 353, + 67, 186, 66, 310, 211, 212, 213, 309, 329, 355, + 332, 354, 185, 184, 331, 321, 252, 253, 254, 316, + 315, 222, 328, 291, 314, 311, 305, 276, 292, 344, + 55, 263, 94, 290, 96, 260, 95, 177, 119, 34, + 304, 357, 245, 247, 363, 55, 131, 367, 366, 365, + 361, 126, 359, 275, 280, 293, 250, 251, 248, 249, + 131, 374, 12, 246, 300, 279, 243, 149, 216, 137, + 82, 289, 11, 220, 215, 136, 81, 175, 117, 200, + 135, 303, 268, 267, 226, 181, 123, 38, 369, 370, + 351, 350, 348, 368, 12, 347, 346, 345, 333, 327, + 313, 302, 266, 180, 11, 122, 37, 265, 301, 264, + 262, 221, 179, 121, 36, 241, 106, 49, 32, 258, + 176, 118, 33, 133, 108, 240, 235, 234, 188, 233, + 187, 232, 231, 230, 183, 104, 42, 182, 146, 124, + 39, 17, 16, 261, 178, 120, 35, 31, 30, 8, + 29, 7, 28, 27, 26, 3, 1, 23, 190, 130, + 129, 191, 323, 53, 71, 70, 64, 89, 358, 165, + 153, 281, 22, 148, 349, 335, 242, 197, 318, 40, + 147, 379, 376, 340, 80, 237, 132, 288, 65, 54, + 52 }; +yytabelem yypact[]={ + + -42,-10000000,-10000000, -42,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, +-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, +-10000000,-10000000,-10000000, 201,-10000000,-10000000, 195, 194, 193, 191, + 190, 188, -208, -124, -151, -142, -151, -151, -151, 70, +-10000000,-10000000, -151,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, +-10000000,-10000000,-10000000,-10000000,-10000000, -289,-10000000,-10000000,-10000000,-10000000, +-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, +-10000000,-10000000,-10000000,-10000000, -168,-10000000,-10000000,-10000000,-10000000,-10000000, + 158, 162, 161,-10000000,-10000000, -167,-10000000,-10000000,-10000000,-10000000, +-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, -289,-10000000,-10000000, +-10000000,-10000000,-10000000,-10000000, -211,-10000000, -151,-10000000, -151,-10000000, +-10000000,-10000000,-10000000,-10000000,-10000000, -158,-10000000, 155, -151, 69, + 68, 67, -222, 65,-10000000,-10000000, -289,-10000000,-10000000,-10000000, +-10000000,-10000000,-10000000, -151,-10000000, 5, 5, 5,-10000000,-10000000, +-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, -72, 225, 224, 106, +-10000000,-10000000,-10000000, 57, 100, 258, -284, 221, 233,-10000000, +-10000000, -6, -6, -6, -289,-10000000, 5,-10000000,-10000000,-10000000, +-10000000,-10000000,-10000000,-10000000,-10000000, -141, 150,-10000000, -42, -245, + 255, -149, 55,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, + -232, -185,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, + 147, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5,-10000000,-10000000,-10000000, 243, 144, 143,-10000000,-10000000, -245, +-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, + 187, 185, 182, 181, 179, 175,-10000000,-10000000,-10000000,-10000000, + -211, -151, 106, 5,-10000000, 100, 258, -284, 221, 221, + 233, 233,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, 5,-10000000, + 54, 53, 52, -245, -151, 173, -102, 33, 223,-10000000, +-10000000,-10000000,-10000000,-10000000,-10000000, -141, -146, -289,-10000000,-10000000, +-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, +-10000000,-10000000,-10000000,-10000000, -289, -159,-10000000,-10000000,-10000000,-10000000, + 102, 169, 240, -149, -151, 254,-10000000,-10000000,-10000000,-10000000, +-10000000,-10000000,-10000000, 62, -246, 238, -214,-10000000,-10000000,-10000000, +-10000000, 237,-10000000,-10000000,-10000000,-10000000,-10000000, -109, -249, 253, +-10000000, 219, -141,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, +-10000000,-10000000,-10000000,-10000000,-10000000, 31, -109, -208, 165, -192, + 198, 5, 245, -211, -214, -151,-10000000,-10000000,-10000000,-10000000, +-10000000,-10000000,-10000000,-10000000,-10000000, 235,-10000000,-10000000, 164, -151, + 197, -257,-10000000,-10000000,-10000000,-10000000, 231,-10000000,-10000000, 216, +-10000000, -264,-10000000 }; +yytabelem yypgo[]={ + + 0, 14, 6, 500, 499, 498, 312, 235, 98, 497, + 225, 496, 495, 494, 310, 7, 493, 492, 491, 5, + 490, 489, 488, 487, 486, 485, 484, 8, 483, 482, + 481, 2, 480, 150, 170, 149, 163, 159, 117, 152, + 479, 120, 132, 10, 478, 477, 114, 76, 71, 308, + 476, 475, 474, 473, 66, 472, 471, 1, 470, 469, + 468, 467, 0, 466, 204, 465, 176, 464, 175, 463, + 164, 462, 461, 460, 459, 458, 457, 456, 455, 454, + 453, 452, 451, 450, 449, 448, 447, 446, 445, 444, + 443, 442, 441, 440, 439, 438, 437, 436, 435, 434, + 433, 432, 431, 430, 429, 428, 427, 426, 425, 424, + 423, 422, 421, 420, 151, 118, 419, 418, 417, 416, + 415, 413, 412, 411, 410, 409, 408, 407, 4, 406, + 405, 403, 402, 401, 400, 399, 398, 397, 396, 395, + 394, 393, 13, 392, 391, 390, 389, 388, 387, 386, + 385, 384, 380, 379, 378, 377, 376, 374, 363, 350, + 349, 348, 347, 345, 337, 336, 335, 334, 332, 330, + 329, 325, 3, 324, 321, 320, 319, 318, 309, 307, + 306, 304 }; +yytabelem yyr1[]={ + + 0, 63, 64, 64, 67, 65, 69, 65, 71, 65, + 73, 65, 75, 65, 76, 65, 77, 78, 79, 80, + 74, 72, 72, 83, 84, 86, 81, 87, 61, 29, + 88, 21, 21, 85, 85, 90, 89, 91, 89, 92, + 89, 94, 89, 96, 89, 97, 89, 19, 98, 20, + 20, 15, 99, 15, 100, 15, 62, 82, 101, 102, + 103, 104, 68, 45, 45, 45, 45, 45, 45, 45, + 45, 30, 31, 32, 32, 33, 33, 34, 34, 35, + 35, 35, 36, 36, 36, 37, 37, 37, 37, 38, + 38, 38, 38, 39, 39, 39, 40, 40, 40, 40, + 40, 40, 41, 105, 66, 66, 66, 66, 107, 106, + 1, 1, 2, 2, 2, 53, 53, 53, 53, 53, + 53, 4, 4, 4, 3, 3, 3, 27, 108, 28, + 28, 57, 57, 58, 59, 46, 46, 51, 51, 51, + 52, 52, 52, 49, 49, 49, 47, 47, 54, 48, + 50, 109, 110, 111, 113, 7, 112, 115, 115, 116, + 117, 114, 118, 114, 119, 120, 121, 122, 123, 124, + 125, 127, 10, 9, 9, 9, 9, 9, 9, 126, + 129, 129, 130, 131, 128, 132, 128, 25, 26, 26, + 133, 43, 134, 135, 43, 136, 44, 137, 138, 139, + 141, 8, 140, 144, 143, 143, 142, 145, 146, 5, + 5, 147, 148, 13, 150, 151, 6, 6, 149, 153, + 154, 14, 14, 152, 155, 11, 23, 24, 24, 156, + 157, 42, 158, 159, 93, 60, 60, 160, 161, 162, + 163, 70, 164, 165, 167, 168, 95, 56, 56, 56, + 12, 12, 169, 166, 170, 166, 171, 174, 173, 173, + 175, 176, 172, 55, 55, 55, 177, 178, 22, 22, + 179, 180, 16, 16, 17, 181, 18, 18 }; +yytabelem yyr2[]={ + + 0, 2, 4, 0, 1, 7, 1, 7, 1, 7, + 1, 7, 1, 7, 1, 7, 1, 1, 1, 1, + 19, 2, 2, 1, 1, 1, 15, 1, 7, 5, + 1, 7, 1, 4, 0, 1, 7, 1, 7, 1, + 7, 1, 7, 1, 7, 1, 7, 5, 1, 9, + 1, 3, 1, 7, 1, 9, 3, 3, 1, 1, + 1, 1, 19, 2, 2, 2, 2, 2, 3, 3, + 3, 2, 2, 2, 7, 2, 7, 2, 7, 2, + 7, 7, 2, 7, 7, 2, 7, 7, 7, 2, + 5, 5, 5, 3, 2, 7, 3, 3, 3, 3, + 3, 3, 3, 1, 6, 2, 2, 2, 1, 7, + 2, 2, 3, 2, 3, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 5, 1, 9, + 1, 2, 2, 3, 3, 2, 2, 3, 5, 3, + 5, 7, 5, 3, 3, 5, 3, 3, 3, 3, + 3, 1, 1, 1, 1, 19, 4, 4, 0, 1, + 1, 11, 1, 7, 1, 1, 1, 1, 1, 1, + 1, 1, 35, 3, 3, 3, 3, 2, 3, 4, + 4, 0, 1, 1, 11, 1, 7, 5, 5, 1, + 1, 7, 1, 1, 11, 1, 7, 1, 1, 1, + 1, 19, 4, 1, 8, 0, 3, 1, 1, 13, + 5, 1, 1, 11, 1, 1, 13, 3, 3, 1, + 1, 13, 3, 3, 1, 7, 5, 5, 1, 1, + 1, 11, 1, 1, 13, 3, 1, 1, 1, 1, + 1, 19, 1, 1, 1, 1, 21, 3, 3, 1, + 2, 3, 1, 7, 1, 9, 4, 1, 8, 0, + 1, 1, 11, 3, 3, 3, 1, 1, 13, 1, + 1, 1, 13, 1, 5, 1, 9, 1 }; +yytabelem yychk[]={ + +-10000000, -63, -64, -65, -66, -68, -70, -72, -74, 256, + 261, -7, -10, -8, 258, 279, -81, -82, 259, 272, + 273, 275, -29, -61, 260, -64, -67, -69, -71, -73, + -75, -76, -105, -101, -160, -77, -109, -119, -137, -83, + -21, 58, -87, 59, 59, 59, 59, 59, 59, -106, + -1, -2, -3, -53, -4, -15, -7, -10, -8, -46, + -49, -47, -48, -54, -50, -5, -6, -14, -62, 298, + -51, -52, 265, 266, 262, 267, 268, 270, 269, 271, + -13, -149, -152, 257, 263, 264, 276, 277, 278, -45, + -46, -47, -54, -48, -49, -6, -14, -15, -62, 257, + -62, -62, -62, 123, -88, -62, -107, 298, -99, 262, + 265, 44, 62, 60, 60, 262, 263, -147, -102, -161, + -78, -110, -120, -138, -84, -19, -15, -27, -57, -58, + -59, -62, -11, -100, -62, -145, -150, -153, 262, 60, + -62, 123, 123, 123, 274, 123, -85, -20, -28, -155, + -62, -41, -31, -32, -33, -34, -35, -36, -37, -38, + -39, 43, 45, 126, -15, -40, 40, 292, 293, 294, + 295, 296, 297, -41, -41, -148, -103, -162, -79, -111, + -121, -139, -86, -89, -66, -68, -70, -93, -95, 256, + -60, -56, 282, 284, 285, 44, 44, -23, -42, 91, + -146, 124, 94, 38, 299, 300, 43, 45, 42, 47, + 37, -39, -39, -39, -31, -151, -154, -2, 61, -115, + -64, -112, -114, -1, 256, 40, -140, -142, 257, 125, + -90, -91, -92, -94, -96, -97, 283, -12, -2, 286, + -98, -108, -24, -156, 62, -33, -34, -35, -36, -36, + -37, -37, -38, -38, -38, 41, 62, 62, -104, -114, + -163, -80, -113, -115, -116, -118, -122, -141, -143, 59, + 59, 59, 59, 59, 59, -158, -164, -15, -57, -42, + -41, -30, -31, 125, 125, 125, -27, 59, -9, -46, + -47, -54, -48, -8, -15, 262, 125, 44, -2, 257, + -157, -117, -123, -144, -159, -165, 93, 59, 41, -142, + -27, -166, 40, -124, -167, -169, -170, 123, -22, 290, + 41, -171, -172, -55, 287, 288, 289, -125, -168, -177, + 41, -173, -175, -126, -128, -25, 256, -43, 281, 280, + -16, 291, 40, 44, -2, -127, -129, -130, -132, -26, + -133, -134, -179, -178, -174, -176, 125, -128, -44, -1, + 59, -43, 58, -31, 40, -19, -172, -57, -131, -136, + -135, -180, 41, 59, -57, 58, -17, 293, 41, -18, + 44, -181, 293 }; +yytabelem yydef[]={ + + -2, -2, 1, -2, 4, 6, 8, 10, 12, 14, + 103, 105, 106, 107, 58, 237, 21, 22, 16, 151, + 164, 197, 23, -2, 27, 2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 29, 30, 0, 5, 7, 9, 11, 13, 15, 104, + 108, 110, 111, 112, 113, 114, 124, 125, 126, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 51, 52, + 135, 136, 143, 144, 137, 146, 147, 149, 148, 150, + 0, 217, 222, 56, 139, 0, 211, 218, 223, 59, + 63, 64, 65, 66, 67, 68, 69, 70, 238, 17, + 152, 165, 198, 24, 0, 28, 0, 54, 0, 138, + 145, 207, 210, 214, 219, 140, 142, 0, 0, 0, + 0, 0, 0, 0, 34, 31, 50, 109, 130, 131, + 132, -2, 134, 0, 53, 0, 0, 0, 141, 212, + 60, 239, 18, 153, 166, 199, -2, 47, 127, 0, + 55, 208, 102, 72, 73, 75, 77, 79, 82, 85, + 89, 0, 0, 0, 93, 94, 0, 96, 97, 98, + 99, 100, 101, 215, 220, 0, 0, 158, -2, 0, + 0, 0, 0, 33, 35, 37, 39, 41, 43, 45, + 0, 0, 235, 247, 248, 48, 128, 225, 228, 229, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 90, 91, 92, 0, 0, 0, 213, 61, -2, + 19, 154, 158, 159, 162, 167, 200, 205, 206, 26, + 0, 0, 0, 0, 0, 0, 232, 242, 250, 251, + 0, 0, 226, 0, 209, 74, 76, 78, 80, 81, + 83, 84, 86, 87, 88, 95, 216, 221, 0, 157, + 0, 0, 0, -2, 0, 0, 0, 0, 202, 36, + 38, 40, 42, 44, 46, 0, 0, 49, 129, 227, + 230, 62, 71, 241, 20, 155, 160, 163, 168, 173, + 174, 175, 176, 177, 178, 137, 201, 203, 233, 243, + 0, 0, 0, 0, 0, 0, 231, 161, 169, 204, + 234, 244, -2, 0, 269, 0, 0, 170, 245, 266, + 253, 0, 259, 260, 263, 264, 265, 0, 273, 0, + 255, 256, 0, 171, 181, 182, 185, 189, 190, 192, + 246, 270, 267, 257, 261, 0, -2, 0, 0, 187, + 0, 0, 0, 0, 0, 0, 172, 180, 183, 195, + 186, 188, 191, 193, 271, 0, 258, 262, 0, 0, + 0, 0, 268, 184, 196, 194, 0, 277, 272, 274, + 275, 0, 276 }; +typedef struct +#ifdef __cplusplus + yytoktype +#endif +{ char *t_name; int t_val; } yytoktype; +#ifndef YYDEBUG +# define YYDEBUG 1 /* allow debugging */ +#endif + +#if YYDEBUG + +yytoktype yytoks[] = +{ + "IDENTIFIER", 257, + "CONST", 258, + "MODULE", 259, + "INTERFACE", 260, + "TYPEDEF", 261, + "LONG", 262, + "SHORT", 263, + "UNSIGNED", 264, + "DOUBLE", 265, + "FLOAT", 266, + "CHAR", 267, + "WCHAR", 268, + "OCTET", 269, + "BOOLEAN", 270, + "ANY", 271, + "STRUCT", 272, + "UNION", 273, + "SWITCH", 274, + "ENUM", 275, + "SEQUENCE", 276, + "STRING", 277, + "WSTRING", 278, + "EXCEPTION", 279, + "CASE", 280, + "DEFAULT", 281, + "READONLY", 282, + "ATTRIBUTE", 283, + "ONEWAY", 284, + "IDEMPOTENT", 285, + "VOID", 286, + "IN", 287, + "OUT", 288, + "INOUT", 289, + "RAISES", 290, + "CONTEXT", 291, + "INTEGER_LITERAL", 292, + "STRING_LITERAL", 293, + "CHARACTER_LITERAL", 294, + "FLOATING_PT_LITERAL", 295, + "TRUETOK", 296, + "FALSETOK", 297, + "SCOPE_DELIMITOR", 298, + "LEFT_SHIFT", 299, + "RIGHT_SHIFT", 300, + "-unknown-", -1 /* ends search */ +}; + +char * yyreds[] = +{ + "-no such reduction-", + "start : definitions", + "definitions : definition definitions", + "definitions : /* empty */", + "definition : type_dcl", + "definition : type_dcl ';'", + "definition : const_dcl", + "definition : const_dcl ';'", + "definition : exception", + "definition : exception ';'", + "definition : interface_def", + "definition : interface_def ';'", + "definition : module", + "definition : module ';'", + "definition : error", + "definition : error ';'", + "module : MODULE", + "module : MODULE IDENTIFIER", + "module : MODULE IDENTIFIER '{'", + "module : MODULE IDENTIFIER '{' definitions", + "module : MODULE IDENTIFIER '{' definitions '}'", + "interface_def : interface", + "interface_def : forward", + "interface : interface_header", + "interface : interface_header '{'", + "interface : interface_header '{' exports", + "interface : interface_header '{' exports '}'", + "interface_decl : INTERFACE", + "interface_decl : INTERFACE id", + "interface_header : interface_decl inheritance_spec", + "inheritance_spec : ':'", + "inheritance_spec : ':' at_least_one_scoped_name", + "inheritance_spec : /* empty */", + "exports : exports export", + "exports : /* empty */", + "export : type_dcl", + "export : type_dcl ';'", + "export : const_dcl", + "export : const_dcl ';'", + "export : exception", + "export : exception ';'", + "export : attribute", + "export : attribute ';'", + "export : operation", + "export : operation ';'", + "export : error", + "export : error ';'", + "at_least_one_scoped_name : scoped_name scoped_names", + "scoped_names : scoped_names ','", + "scoped_names : scoped_names ',' scoped_name", + "scoped_names : /* empty */", + "scoped_name : id", + "scoped_name : SCOPE_DELIMITOR", + "scoped_name : SCOPE_DELIMITOR id", + "scoped_name : scoped_name SCOPE_DELIMITOR", + "scoped_name : scoped_name SCOPE_DELIMITOR id", + "id : IDENTIFIER", + "forward : interface_decl", + "const_dcl : CONST", + "const_dcl : CONST const_type", + "const_dcl : CONST const_type id", + "const_dcl : CONST const_type id '='", + "const_dcl : CONST const_type id '=' expression", + "const_type : integer_type", + "const_type : char_type", + "const_type : octet_type", + "const_type : boolean_type", + "const_type : floating_pt_type", + "const_type : string_type_spec", + "const_type : wstring_type_spec", + "const_type : scoped_name", + "expression : const_expr", + "const_expr : or_expr", + "or_expr : xor_expr", + "or_expr : or_expr '|' xor_expr", + "xor_expr : and_expr", + "xor_expr : xor_expr '^' and_expr", + "and_expr : shift_expr", + "and_expr : and_expr '&' shift_expr", + "shift_expr : add_expr", + "shift_expr : shift_expr LEFT_SHIFT add_expr", + "shift_expr : shift_expr RIGHT_SHIFT add_expr", + "add_expr : mult_expr", + "add_expr : add_expr '+' mult_expr", + "add_expr : add_expr '-' mult_expr", + "mult_expr : unary_expr", + "mult_expr : mult_expr '*' unary_expr", + "mult_expr : mult_expr '/' unary_expr", + "mult_expr : mult_expr '%' unary_expr", + "unary_expr : primary_expr", + "unary_expr : '+' primary_expr", + "unary_expr : '-' primary_expr", + "unary_expr : '~' primary_expr", + "primary_expr : scoped_name", + "primary_expr : literal", + "primary_expr : '(' const_expr ')'", + "literal : INTEGER_LITERAL", + "literal : STRING_LITERAL", + "literal : CHARACTER_LITERAL", + "literal : FLOATING_PT_LITERAL", + "literal : TRUETOK", + "literal : FALSETOK", + "positive_int_expr : const_expr", + "type_dcl : TYPEDEF", + "type_dcl : TYPEDEF type_declarator", + "type_dcl : struct_type", + "type_dcl : union_type", + "type_dcl : enum_type", + "type_declarator : type_spec", + "type_declarator : type_spec at_least_one_declarator", + "type_spec : simple_type_spec", + "type_spec : constructed_type_spec", + "simple_type_spec : base_type_spec", + "simple_type_spec : template_type_spec", + "simple_type_spec : scoped_name", + "base_type_spec : integer_type", + "base_type_spec : floating_pt_type", + "base_type_spec : char_type", + "base_type_spec : boolean_type", + "base_type_spec : octet_type", + "base_type_spec : any_type", + "template_type_spec : sequence_type_spec", + "template_type_spec : string_type_spec", + "template_type_spec : wstring_type_spec", + "constructed_type_spec : struct_type", + "constructed_type_spec : union_type", + "constructed_type_spec : enum_type", + "at_least_one_declarator : declarator declarators", + "declarators : declarators ','", + "declarators : declarators ',' declarator", + "declarators : /* empty */", + "declarator : simple_declarator", + "declarator : complex_declarator", + "simple_declarator : id", + "complex_declarator : array_declarator", + "integer_type : signed_int", + "integer_type : unsigned_int", + "signed_int : LONG", + "signed_int : LONG LONG", + "signed_int : SHORT", + "unsigned_int : UNSIGNED LONG", + "unsigned_int : UNSIGNED LONG LONG", + "unsigned_int : UNSIGNED SHORT", + "floating_pt_type : DOUBLE", + "floating_pt_type : FLOAT", + "floating_pt_type : LONG DOUBLE", + "char_type : CHAR", + "char_type : WCHAR", + "octet_type : OCTET", + "boolean_type : BOOLEAN", + "any_type : ANY", + "struct_type : STRUCT", + "struct_type : STRUCT id", + "struct_type : STRUCT id '{'", + "struct_type : STRUCT id '{' at_least_one_member", + "struct_type : STRUCT id '{' at_least_one_member '}'", + "at_least_one_member : member members", + "members : members member", + "members : /* empty */", + "member : type_spec", + "member : type_spec at_least_one_declarator", + "member : type_spec at_least_one_declarator ';'", + "member : error", + "member : error ';'", + "union_type : UNION", + "union_type : UNION id", + "union_type : UNION id SWITCH", + "union_type : UNION id SWITCH '('", + "union_type : UNION id SWITCH '(' switch_type_spec", + "union_type : UNION id SWITCH '(' switch_type_spec ')'", + "union_type : UNION id SWITCH '(' switch_type_spec ')' '{'", + "union_type : UNION id SWITCH '(' switch_type_spec ')' '{' at_least_one_case_branch", + "union_type : UNION id SWITCH '(' switch_type_spec ')' '{' at_least_one_case_branch '}'", + "switch_type_spec : integer_type", + "switch_type_spec : char_type", + "switch_type_spec : octet_type", + "switch_type_spec : boolean_type", + "switch_type_spec : enum_type", + "switch_type_spec : scoped_name", + "at_least_one_case_branch : case_branch case_branches", + "case_branches : case_branches case_branch", + "case_branches : /* empty */", + "case_branch : at_least_one_case_label", + "case_branch : at_least_one_case_label element_spec", + "case_branch : at_least_one_case_label element_spec ';'", + "case_branch : error", + "case_branch : error ';'", + "at_least_one_case_label : case_label case_labels", + "case_labels : case_labels case_label", + "case_labels : /* empty */", + "case_label : DEFAULT", + "case_label : DEFAULT ':'", + "case_label : CASE", + "case_label : CASE const_expr", + "case_label : CASE const_expr ':'", + "element_spec : type_spec", + "element_spec : type_spec declarator", + "enum_type : ENUM", + "enum_type : ENUM id", + "enum_type : ENUM id '{'", + "enum_type : ENUM id '{' at_least_one_enumerator", + "enum_type : ENUM id '{' at_least_one_enumerator '}'", + "at_least_one_enumerator : enumerator enumerators", + "enumerators : enumerators ','", + "enumerators : enumerators ',' enumerator", + "enumerators : /* empty */", + "enumerator : IDENTIFIER", + "sequence_type_spec : seq_head ','", + "sequence_type_spec : seq_head ',' positive_int_expr", + "sequence_type_spec : seq_head ',' positive_int_expr '>'", + "sequence_type_spec : seq_head '>'", + "seq_head : SEQUENCE", + "seq_head : SEQUENCE '<'", + "seq_head : SEQUENCE '<' simple_type_spec", + "string_type_spec : string_head '<'", + "string_type_spec : string_head '<' positive_int_expr", + "string_type_spec : string_head '<' positive_int_expr '>'", + "string_type_spec : string_head", + "string_head : STRING", + "wstring_type_spec : wstring_head '<'", + "wstring_type_spec : wstring_head '<' positive_int_expr", + "wstring_type_spec : wstring_head '<' positive_int_expr '>'", + "wstring_type_spec : wstring_head", + "wstring_head : WSTRING", + "array_declarator : id", + "array_declarator : id at_least_one_array_dim", + "at_least_one_array_dim : array_dim array_dims", + "array_dims : array_dims array_dim", + "array_dims : /* empty */", + "array_dim : '['", + "array_dim : '[' positive_int_expr", + "array_dim : '[' positive_int_expr ']'", + "attribute : opt_readonly ATTRIBUTE", + "attribute : opt_readonly ATTRIBUTE simple_type_spec", + "attribute : opt_readonly ATTRIBUTE simple_type_spec at_least_one_declarator", + "opt_readonly : READONLY", + "opt_readonly : /* empty */", + "exception : EXCEPTION", + "exception : EXCEPTION id", + "exception : EXCEPTION id '{'", + "exception : EXCEPTION id '{' members", + "exception : EXCEPTION id '{' members '}'", + "operation : opt_op_attribute op_type_spec", + "operation : opt_op_attribute op_type_spec IDENTIFIER", + "operation : opt_op_attribute op_type_spec IDENTIFIER parameter_list", + "operation : opt_op_attribute op_type_spec IDENTIFIER parameter_list opt_raises", + "operation : opt_op_attribute op_type_spec IDENTIFIER parameter_list opt_raises opt_context", + "opt_op_attribute : ONEWAY", + "opt_op_attribute : IDEMPOTENT", + "opt_op_attribute : /* empty */", + "op_type_spec : simple_type_spec", + "op_type_spec : VOID", + "parameter_list : '('", + "parameter_list : '(' ')'", + "parameter_list : '('", + "parameter_list : '(' at_least_one_parameter ')'", + "at_least_one_parameter : parameter parameters", + "parameters : parameters ','", + "parameters : parameters ',' parameter", + "parameters : /* empty */", + "parameter : direction", + "parameter : direction simple_type_spec", + "parameter : direction simple_type_spec declarator", + "direction : IN", + "direction : OUT", + "direction : INOUT", + "opt_raises : RAISES", + "opt_raises : RAISES '('", + "opt_raises : RAISES '(' at_least_one_scoped_name ')'", + "opt_raises : /* empty */", + "opt_context : CONTEXT", + "opt_context : CONTEXT '('", + "opt_context : CONTEXT '(' at_least_one_string_literal ')'", + "opt_context : /* empty */", + "at_least_one_string_literal : STRING_LITERAL string_literals", + "string_literals : string_literals ','", + "string_literals : string_literals ',' STRING_LITERAL", + "string_literals : /* empty */", +}; +#endif /* YYDEBUG */ +# line 1 "/usr/ccs/bin/yaccpar" +/* + * Copyright (c) 1993 by Sun Microsystems, Inc. + */ + +#pragma ident "@(#)yaccpar 6.12 93/06/07 SMI" + +/* +** Skeleton parser driver for yacc output +*/ + +/* +** yacc user known macros and defines +*/ +#define YYERROR goto yyerrlab +#define YYACCEPT return(0) +#define YYABORT return(1) +#define YYBACKUP( newtoken, newvalue )\ +{\ + if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\ + {\ + yyerror( "syntax error - cannot backup" );\ + goto yyerrlab;\ + }\ + yychar = newtoken;\ + yystate = *yyps;\ + yylval = newvalue;\ + goto yynewstate;\ +} +#define YYRECOVERING() (!!yyerrflag) +#define YYNEW(type) malloc(sizeof(type) * yynewmax) +#define YYCOPY(to, from, type) \ + (type *) memcpy(to, (char *) from, yynewmax * sizeof(type)) +#define YYENLARGE( from, type) \ + (type *) realloc((char *) from, yynewmax * sizeof(type)) +#ifndef YYDEBUG +# define YYDEBUG 1 /* make debugging available */ +#endif + +/* +** user known globals +*/ +int yydebug; /* set to 1 to get debugging */ + +/* +** driver internal defines +*/ +#define YYFLAG (-10000000) + +/* +** global variables used by the parser +*/ +YYSTYPE *yypv; /* top of value stack */ +int *yyps; /* top of state stack */ + +int yystate; /* current state */ +int yytmp; /* extra var (lasts between blocks) */ + +int yynerrs; /* number of errors */ +int yyerrflag; /* error recovery flag */ +int yychar; /* current input token number */ + + + +#ifdef YYNMBCHARS +#define YYLEX() yycvtok(yylex()) +/* +** yycvtok - return a token if i is a wchar_t value that exceeds 255. +** If i<255, i itself is the token. If i>255 but the neither +** of the 30th or 31st bit is on, i is already a token. +*/ +#if defined(__STDC__) || defined(__cplusplus) +int yycvtok(int i) +#else +int yycvtok(i) int i; +#endif +{ + int first = 0; + int last = YYNMBCHARS - 1; + int mid; + wchar_t j; + + if(i&0x60000000){/*Must convert to a token. */ + if( yymbchars[last].character < i ){ + return i;/*Giving up*/ + } + while ((last>=first)&&(first>=0)) {/*Binary search loop*/ + mid = (first+last)/2; + j = yymbchars[mid].character; + if( j==i ){/*Found*/ + return yymbchars[mid].tvalue; + }else if( j<i ){ + first = mid + 1; + }else{ + last = mid -1; + } + } + /*No entry in the table.*/ + return i;/* Giving up.*/ + }else{/* i is already a token. */ + return i; + } +} +#else/*!YYNMBCHARS*/ +#define YYLEX() yylex() +#endif/*!YYNMBCHARS*/ + +/* +** yyparse - return 0 if worked, 1 if syntax error not recovered from +*/ +#if defined(__STDC__) || defined(__cplusplus) +int yyparse(void) +#else +int yyparse() +#endif +{ + register YYSTYPE *yypvt; /* top of value stack for $vars */ + +#if defined(__cplusplus) || defined(lint) +/* + hacks to please C++ and lint - goto's inside switch should never be + executed; yypvt is set to 0 to avoid "used before set" warning. +*/ + static int __yaccpar_lint_hack__ = 0; + switch (__yaccpar_lint_hack__) + { + case 1: goto yyerrlab; + case 2: goto yynewstate; + } + yypvt = 0; +#endif + + /* + ** Initialize externals - yyparse may be called more than once + */ + yypv = &yyv[-1]; + yyps = &yys[-1]; + yystate = 0; + yytmp = 0; + yynerrs = 0; + yyerrflag = 0; + yychar = -1; + +#if YYMAXDEPTH <= 0 + if (yymaxdepth <= 0) + { + if ((yymaxdepth = YYEXPAND(0)) <= 0) + { + yyerror("yacc initialization error"); + YYABORT; + } + } +#endif + + { + register YYSTYPE *yy_pv; /* top of value stack */ + register int *yy_ps; /* top of state stack */ + register int yy_state; /* current state */ + register int yy_n; /* internal state number info */ + goto yystack; /* moved from 6 lines above to here to please C++ */ + + /* + ** get globals into registers. + ** branch to here only if YYBACKUP was called. + */ + yynewstate: + yy_pv = yypv; + yy_ps = yyps; + yy_state = yystate; + goto yy_newstate; + + /* + ** get globals into registers. + ** either we just started, or we just finished a reduction + */ + yystack: + yy_pv = yypv; + yy_ps = yyps; + yy_state = yystate; + + /* + ** top of for (;;) loop while no reductions done + */ + yy_stack: + /* + ** put a state and value onto the stacks + */ +#if YYDEBUG + /* + ** if debugging, look up token value in list of value vs. + ** name pairs. 0 and negative (-1) are special values. + ** Note: linear search is used since time is not a real + ** consideration while debugging. + */ + if ( yydebug ) + { + register int yy_i; + + printf( "State %d, token ", yy_state ); + if ( yychar == 0 ) + printf( "end-of-file\n" ); + else if ( yychar < 0 ) + printf( "-none-\n" ); + else + { + for ( yy_i = 0; yytoks[yy_i].t_val >= 0; + yy_i++ ) + { + if ( yytoks[yy_i].t_val == yychar ) + break; + } + printf( "%s\n", yytoks[yy_i].t_name ); + } + } +#endif /* YYDEBUG */ + if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */ + { + /* + ** reallocate and recover. Note that pointers + ** have to be reset, or bad things will happen + */ + int yyps_index = (yy_ps - yys); + int yypv_index = (yy_pv - yyv); + int yypvt_index = (yypvt - yyv); + int yynewmax; +#ifdef YYEXPAND + yynewmax = YYEXPAND(yymaxdepth); +#else + yynewmax = 2 * yymaxdepth; /* double table size */ + if (yymaxdepth == YYMAXDEPTH) /* first time growth */ + { + char *newyys = (char *)YYNEW(int); + char *newyyv = (char *)YYNEW(YYSTYPE); + if (newyys != 0 && newyyv != 0) + { + yys = YYCOPY(newyys, yys, int); + yyv = YYCOPY(newyyv, yyv, YYSTYPE); + } + else + yynewmax = 0; /* failed */ + } + else /* not first time */ + { + yys = YYENLARGE(yys, int); + yyv = YYENLARGE(yyv, YYSTYPE); + if (yys == 0 || yyv == 0) + yynewmax = 0; /* failed */ + } +#endif + if (yynewmax <= yymaxdepth) /* tables not expanded */ + { + yyerror( "yacc stack overflow" ); + YYABORT; + } + yymaxdepth = yynewmax; + + yy_ps = yys + yyps_index; + yy_pv = yyv + yypv_index; + yypvt = yyv + yypvt_index; + } + *yy_ps = yy_state; + *++yy_pv = yyval; + + /* + ** we have a new state - find out what to do + */ + yy_newstate: + if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG ) + goto yydefault; /* simple state */ +#if YYDEBUG + /* + ** if debugging, need to mark whether new token grabbed + */ + yytmp = yychar < 0; +#endif + if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) + yychar = 0; /* reached EOF */ +#if YYDEBUG + if ( yydebug && yytmp ) + { + register int yy_i; + + printf( "Received token " ); + if ( yychar == 0 ) + printf( "end-of-file\n" ); + else if ( yychar < 0 ) + printf( "-none-\n" ); + else + { + for ( yy_i = 0; yytoks[yy_i].t_val >= 0; + yy_i++ ) + { + if ( yytoks[yy_i].t_val == yychar ) + break; + } + printf( "%s\n", yytoks[yy_i].t_name ); + } + } +#endif /* YYDEBUG */ + if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) ) + goto yydefault; + if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/ + { + yychar = -1; + yyval = yylval; + yy_state = yy_n; + if ( yyerrflag > 0 ) + yyerrflag--; + goto yy_stack; + } + + yydefault: + if ( ( yy_n = yydef[ yy_state ] ) == -2 ) + { +#if YYDEBUG + yytmp = yychar < 0; +#endif + if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) + yychar = 0; /* reached EOF */ +#if YYDEBUG + if ( yydebug && yytmp ) + { + register int yy_i; + + printf( "Received token " ); + if ( yychar == 0 ) + printf( "end-of-file\n" ); + else if ( yychar < 0 ) + printf( "-none-\n" ); + else + { + for ( yy_i = 0; + yytoks[yy_i].t_val >= 0; + yy_i++ ) + { + if ( yytoks[yy_i].t_val + == yychar ) + { + break; + } + } + printf( "%s\n", yytoks[yy_i].t_name ); + } + } +#endif /* YYDEBUG */ + /* + ** look through exception table + */ + { + register int *yyxi = yyexca; + + while ( ( *yyxi != -1 ) || + ( yyxi[1] != yy_state ) ) + { + yyxi += 2; + } + while ( ( *(yyxi += 2) >= 0 ) && + ( *yyxi != yychar ) ) + ; + if ( ( yy_n = yyxi[1] ) < 0 ) + YYACCEPT; + } + } + + /* + ** check for syntax error + */ + if ( yy_n == 0 ) /* have an error */ + { + /* no worry about speed here! */ + switch ( yyerrflag ) + { + case 0: /* new error */ + yyerror( "syntax error" ); + goto skip_init; + yyerrlab: + /* + ** get globals into registers. + ** we have a user generated syntax type error + */ + yy_pv = yypv; + yy_ps = yyps; + yy_state = yystate; + skip_init: + yynerrs++; + /* FALLTHRU */ + case 1: + case 2: /* incompletely recovered error */ + /* try again... */ + yyerrflag = 3; + /* + ** find state where "error" is a legal + ** shift action + */ + while ( yy_ps >= yys ) + { + yy_n = yypact[ *yy_ps ] + YYERRCODE; + if ( yy_n >= 0 && yy_n < YYLAST && + yychk[yyact[yy_n]] == YYERRCODE) { + /* + ** simulate shift of "error" + */ + yy_state = yyact[ yy_n ]; + goto yy_stack; + } + /* + ** current state has no shift on + ** "error", pop stack + */ +#if YYDEBUG +# define _POP_ "Error recovery pops state %d, uncovers state %d\n" + if ( yydebug ) + printf( _POP_, *yy_ps, + yy_ps[-1] ); +# undef _POP_ +#endif + yy_ps--; + yy_pv--; + } + /* + ** there is no state on stack with "error" as + ** a valid shift. give up. + */ + YYABORT; + case 3: /* no shift yet; eat a token */ +#if YYDEBUG + /* + ** if debugging, look up token in list of + ** pairs. 0 and negative shouldn't occur, + ** but since timing doesn't matter when + ** debugging, it doesn't hurt to leave the + ** tests here. + */ + if ( yydebug ) + { + register int yy_i; + + printf( "Error recovery discards " ); + if ( yychar == 0 ) + printf( "token end-of-file\n" ); + else if ( yychar < 0 ) + printf( "token -none-\n" ); + else + { + for ( yy_i = 0; + yytoks[yy_i].t_val >= 0; + yy_i++ ) + { + if ( yytoks[yy_i].t_val + == yychar ) + { + break; + } + } + printf( "token %s\n", + yytoks[yy_i].t_name ); + } + } +#endif /* YYDEBUG */ + if ( yychar == 0 ) /* reached EOF. quit */ + YYABORT; + yychar = -1; + goto yy_newstate; + } + }/* end if ( yy_n == 0 ) */ + /* + ** reduction by production yy_n + ** put stack tops, etc. so things right after switch + */ +#if YYDEBUG + /* + ** if debugging, print the string that is the user's + ** specification of the reduction which is just about + ** to be done. + */ + if ( yydebug ) + printf( "Reduce by (%d) \"%s\"\n", + yy_n, yyreds[ yy_n ] ); +#endif + yytmp = yy_n; /* value to switch over */ + yypvt = yy_pv; /* $vars top of value stack */ + /* + ** Look in goto table for next state + ** Sorry about using yy_state here as temporary + ** register variable, but why not, if it works... + ** If yyr2[ yy_n ] doesn't have the low order bit + ** set, then there is no action to be done for + ** this reduction. So, no saving & unsaving of + ** registers done. The only difference between the + ** code just after the if and the body of the if is + ** the goto yy_stack in the body. This way the test + ** can be made before the choice of what to do is needed. + */ + { + /* length of production doubled with extra bit */ + register int yy_len = yyr2[ yy_n ]; + + if ( !( yy_len & 01 ) ) + { + yy_len >>= 1; + yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ + yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + + *( yy_ps -= yy_len ) + 1; + if ( yy_state >= YYLAST || + yychk[ yy_state = + yyact[ yy_state ] ] != -yy_n ) + { + yy_state = yyact[ yypgo[ yy_n ] ]; + } + goto yy_stack; + } + yy_len >>= 1; + yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ + yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + + *( yy_ps -= yy_len ) + 1; + if ( yy_state >= YYLAST || + yychk[ yy_state = yyact[ yy_state ] ] != -yy_n ) + { + yy_state = yyact[ yypgo[ yy_n ] ]; + } + } + /* save until reenter driver code */ + yystate = yy_state; + yyps = yy_ps; + yypv = yy_pv; + } + /* + ** code supplied by user is placed in this switch + */ + switch( yytmp ) + { + +case 4: +# line 228 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_TypeDeclSeen); + } break; +case 5: +# line 232 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } break; +case 6: +# line 236 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ConstDeclSeen); + } break; +case 7: +# line 240 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } break; +case 8: +# line 244 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptDeclSeen); + } break; +case 9: +# line 248 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } break; +case 10: +# line 252 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceDeclSeen); + } break; +case 11: +# line 256 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } break; +case 12: +# line 260 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ModuleDeclSeen); + } break; +case 13: +# line 264 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } break; +case 14: +# line 268 "idl.yy" +{ + idl_global->err()->syntax_error(idl_global->parse_state()); + } break; +case 15: +# line 272 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + yyerrok; + } break; +case 16: +# line 279 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ModuleSeen); + } break; +case 17: +# line 283 "idl.yy" +{ + UTL_ScopedName *n = + new UTL_ScopedName(new Identifier(yypvt[-0].strval, 1, 0, I_FALSE), NULL); + AST_Module *m = NULL; + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_StrList *p = idl_global->pragmas(); + + idl_global->set_parse_state(IDL_GlobalData::PS_ModuleIDSeen); + /* + * Make a new module and add it to the enclosing scope + */ + if (s != NULL) { + m = idl_global->gen()->create_module(n, p); + (void) s->fe_add_module(m); + } + /* + * Push it on the stack + */ + idl_global->scopes()->push(m); + } break; +case 18: +# line 304 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ModuleSqSeen); + } break; +case 19: +# line 308 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ModuleBodySeen); + } break; +case 20: +# line 312 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ModuleQsSeen); + /* + * Finished with this module - pop it from the scope stack + */ + idl_global->scopes()->pop(); + } break; +case 23: +# line 328 "idl.yy" +{ + UTL_Scope *s = idl_global->scopes()->top_non_null(); + AST_Interface *i = NULL; + AST_Decl *v = NULL; + UTL_StrList *p = idl_global->pragmas(); + AST_Decl *d = NULL; + AST_Interface *fd = NULL; + + /* + * Make a new interface node and add it to its enclosing scope + */ + if (s != NULL && yypvt[-0].ihval != NULL) { + i = idl_global->gen()->create_interface(yypvt[-0].ihval->interface_name(), + yypvt[-0].ihval->inherits(), + yypvt[-0].ihval->n_inherits(), + p); + if (i != NULL && + (d = s->lookup_by_name(i->name(), I_FALSE)) != NULL) { + /* + * See if we're defining a forward declared interface. + */ + if (d->node_type() == AST_Decl::NT_interface) { + /* + * Narrow to an interface + */ + fd = AST_Interface::narrow_from_decl(d); + /* + * Successful? + */ + if (fd == NULL) { + /* + * Should we give an error here? + */ + } + /* + * If it is a forward declared interface.. + */ + else if (!fd->is_defined()) { + /* + * Check if redefining in same scope + */ + if (fd->defined_in() != s) { + idl_global->err() + ->error3(UTL_Error::EIDL_SCOPE_CONFLICT, + i, + fd, + ScopeAsDecl(s)); + } + /* + * All OK, do the redefinition + */ + else { + fd->set_inherits(yypvt[-0].ihval->inherits()); + fd->set_n_inherits(yypvt[-0].ihval->n_inherits()); + /* + * Update place of definition + */ + fd->set_imported(idl_global->imported()); + fd->set_in_main_file(idl_global->in_main_file()); + fd->set_line(idl_global->lineno()); + fd->set_file_name(idl_global->filename()); + fd->add_pragmas(p); + /* + * Use full definition node + */ + delete i; + i = fd; + } + } + } + } + /* + * Add the interface to its definition scope + */ + (void) s->fe_add_interface(i); + } + /* + * Push it on the scope stack + */ + idl_global->scopes()->push(i); + } break; +case 24: +# line 410 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSqSeen); + } break; +case 25: +# line 414 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceBodySeen); + } break; +case 26: +# line 418 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceQsSeen); + /* + * Done with this interface - pop it off the scopes stack + */ + idl_global->scopes()->pop(); + } break; +case 27: +# line 429 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSeen); + } break; +case 28: +# line 433 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceIDSeen); + yyval.idval = yypvt[-0].idval; + } break; +case 29: +# line 441 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_InheritSpecSeen); + /* + * Create an AST representation of the information in the header + * part of an interface - this representation contains a computed + * list of all interfaces which this interface inherits from, + * recursively + */ + yyval.ihval = new FE_InterfaceHeader(new UTL_ScopedName(yypvt[-1].idval, NULL), yypvt[-0].nlval); + } break; +case 30: +# line 455 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_InheritColonSeen); + } break; +case 31: +# line 459 "idl.yy" +{ + yyval.nlval = yypvt[-0].nlval; + } break; +case 32: +# line 463 "idl.yy" +{ + yyval.nlval = NULL; + } break; +case 35: +# line 475 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_TypeDeclSeen); + } break; +case 36: +# line 479 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } break; +case 37: +# line 483 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ConstDeclSeen); + } break; +case 38: +# line 487 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } break; +case 39: +# line 491 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptDeclSeen); + } break; +case 40: +# line 495 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } break; +case 41: +# line 499 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_AttrDeclSeen); + } break; +case 42: +# line 503 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } break; +case 43: +# line 507 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpDeclSeen); + } break; +case 44: +# line 511 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } break; +case 45: +# line 515 "idl.yy" +{ + idl_global->err()->syntax_error(idl_global->parse_state()); + } break; +case 46: +# line 519 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + yyerrok; + } break; +case 47: +# line 527 "idl.yy" +{ + yyval.nlval = new UTL_NameList(yypvt[-1].idlist, yypvt[-0].nlval); + } break; +case 48: +# line 535 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_SNListCommaSeen); + } break; +case 49: +# line 539 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ScopedNameSeen); + + if (yypvt[-3].nlval == NULL) + yyval.nlval = new UTL_NameList(yypvt[-0].idlist, NULL); + else { + yypvt[-3].nlval->nconc(new UTL_NameList(yypvt[-0].idlist, NULL)); + yyval.nlval = yypvt[-3].nlval; + } + } break; +case 50: +# line 550 "idl.yy" +{ + yyval.nlval = NULL; + } break; +case 51: +# line 557 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); + + yyval.idlist = new UTL_IdList(yypvt[-0].idval, NULL); + } break; +case 52: +# line 563 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ScopeDelimSeen); + } break; +case 53: +# line 567 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); + + yyval.idlist = new UTL_IdList(new Identifier(yypvt[-2].strval, 1, 0, I_FALSE), + new UTL_IdList(yypvt[-0].idval, NULL)); + } break; +case 54: +# line 575 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ScopeDelimSeen); + } break; +case 55: +# line 579 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); + + yypvt[-3].idlist->nconc(new UTL_IdList(yypvt[-0].idval, NULL)); + yyval.idlist = yypvt[-3].idlist; + } break; +case 56: +# line 588 "idl.yy" +{ + yyval.idval = new Identifier(yypvt[-0].strval, 1, 0, I_FALSE); + } break; +case 57: +# line 595 "idl.yy" +{ + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_ScopedName *n = new UTL_ScopedName(yypvt[-0].idval, NULL); + AST_InterfaceFwd *f = NULL; + UTL_StrList *p = idl_global->pragmas(); + + idl_global->set_parse_state(IDL_GlobalData::PS_ForwardDeclSeen); + /* + * Create a node representing a forward declaration of an + * interface. Store it in the enclosing scope + */ + if (s != NULL) { + f = idl_global->gen()->create_interface_fwd(n, p); + (void) s->fe_add_interface_fwd(f); + } + } break; +case 58: +# line 615 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ConstSeen); + } break; +case 59: +# line 619 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ConstTypeSeen); + } break; +case 60: +# line 623 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ConstIDSeen); + } break; +case 61: +# line 627 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ConstAssignSeen); + } break; +case 62: +# line 631 "idl.yy" +{ + UTL_ScopedName *n = new UTL_ScopedName(yypvt[-4].idval, NULL); + UTL_Scope *s = idl_global->scopes()->top_non_null(); + AST_Constant *c = NULL; + UTL_StrList *p = idl_global->pragmas(); + AST_Decl *v = NULL; + + idl_global->set_parse_state(IDL_GlobalData::PS_ConstExprSeen); + /* + * Create a node representing a constant declaration. Store + * it in the enclosing scope + */ + if (yypvt[-0].exval != NULL && s != NULL) { + if (yypvt[-0].exval->coerce(yypvt[-6].etval) == NULL) + idl_global->err()->coercion_error(yypvt[-0].exval, yypvt[-6].etval); + else { + c = + idl_global->gen()->create_constant(yypvt[-6].etval, yypvt[-0].exval, n, p); + (void) s->fe_add_constant(c); + } + } + } break; +case 68: +# line 662 "idl.yy" +{ + yyval.etval = AST_Expression::EV_string; + } break; +case 69: +# line 666 "idl.yy" +{ + yyval.etval = AST_Expression::EV_wstring; + } break; +case 70: +# line 670 "idl.yy" +{ + UTL_Scope *s = idl_global->scopes()->top_non_null(); + AST_Decl *d = NULL; + AST_PredefinedType *c = NULL; + AST_Typedef *t = NULL; + + /* + * If the constant's type is a scoped name, it must resolve + * to a scalar constant type + */ + if (s != NULL && (d = s->lookup_by_name(yypvt[-0].idlist, I_TRUE)) != NULL) { + /* + * Look through typedefs + */ + while (d->node_type() == AST_Decl::NT_typedef) { + t = AST_Typedef::narrow_from_decl(d); + if (t == NULL) + break; + d = t->base_type(); + } + if (d == NULL) + yyval.etval = AST_Expression::EV_any; + else if (d->node_type() == AST_Decl::NT_pre_defined) { + c = AST_PredefinedType::narrow_from_decl(d); + if (c != NULL) { + yyval.etval = idl_global->PredefinedTypeToExprType(c->pt()); + } else { + yyval.etval = AST_Expression::EV_any; + } + } else + yyval.etval = AST_Expression::EV_any; + } else + yyval.etval = AST_Expression::EV_any; + } break; +case 74: +# line 712 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_or, yypvt[-2].exval, yypvt[-0].exval); + } break; +case 76: +# line 720 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_xor, yypvt[-2].exval, yypvt[-0].exval); + } break; +case 78: +# line 728 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_and, yypvt[-2].exval, yypvt[-0].exval); + } break; +case 80: +# line 736 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_right,yypvt[-2].exval,yypvt[-0].exval); + } break; +case 81: +# line 740 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_left,yypvt[-2].exval,yypvt[-0].exval); + } break; +case 83: +# line 748 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_add, yypvt[-2].exval, yypvt[-0].exval); + } break; +case 84: +# line 752 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_minus,yypvt[-2].exval,yypvt[-0].exval); + } break; +case 86: +# line 760 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_mul, yypvt[-2].exval, yypvt[-0].exval); + } break; +case 87: +# line 764 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_div, yypvt[-2].exval, yypvt[-0].exval); + } break; +case 88: +# line 768 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_mod, yypvt[-2].exval, yypvt[-0].exval); + } break; +case 90: +# line 776 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_u_plus, + yypvt[-0].exval, + NULL); + } break; +case 91: +# line 782 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_u_minus, + yypvt[-0].exval, + NULL); + } break; +case 92: +# line 788 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_bit_neg, + yypvt[-0].exval, + NULL); + } break; +case 93: +# line 797 "idl.yy" +{ + /* + * An expression which is a scoped name is not resolved now, + * but only when it is evaluated (such as when it is assigned + * as a constant value) + */ + yyval.exval = idl_global->gen()->create_expr(yypvt[-0].idlist); + } break; +case 95: +# line 807 "idl.yy" +{ + yyval.exval = yypvt[-1].exval; + } break; +case 96: +# line 814 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr(yypvt[-0].ival); + } break; +case 97: +# line 818 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr(yypvt[-0].sval); + } break; +case 98: +# line 822 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr(yypvt[-0].cval); + } break; +case 99: +# line 826 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr(yypvt[-0].dval); + } break; +case 100: +# line 830 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr((idl_bool) I_TRUE, + AST_Expression::EV_bool); + } break; +case 101: +# line 835 "idl.yy" +{ + yyval.exval = idl_global->gen()->create_expr((idl_bool) I_FALSE, + AST_Expression::EV_bool); + } break; +case 102: +# line 843 "idl.yy" +{ + yypvt[-0].exval->evaluate(AST_Expression::EK_const); + yyval.exval = idl_global->gen()->create_expr(yypvt[-0].exval, AST_Expression::EV_ulong); + } break; +case 103: +# line 851 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_TypedefSeen); + } break; +case 108: +# line 862 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_TypeSpecSeen); + } break; +case 109: +# line 866 "idl.yy" +{ + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_DecllistActiveIterator *l; + FE_Declarator *d = NULL; + AST_Typedef *t = NULL; + AST_Decl *v = NULL; + UTL_StrList *p = idl_global->pragmas(); + + idl_global->set_parse_state(IDL_GlobalData::PS_DeclaratorsSeen); + /* + * Create a list of type renamings. Add them to the + * enclosing scope + */ + if (s != NULL && yypvt[-2].dcval != NULL && yypvt[-0].dlval != NULL) { + l = new UTL_DecllistActiveIterator(yypvt[-0].dlval); + for (;!(l->is_done()); l->next()) { + d = l->item(); + if (d == NULL) + continue; + AST_Type * tp = d->compose(yypvt[-2].dcval); + if (tp == NULL) + continue; + t = idl_global->gen()->create_typedef(tp, d->name(), p); + (void) s->fe_add_typedef(t); + } + delete l; + } + } break; +case 112: +# line 903 "idl.yy" +{ + yyval.dcval = idl_global->scopes()->bottom()->lookup_primitive_type(yypvt[-0].etval); + } break; +case 114: +# line 908 "idl.yy" +{ + UTL_Scope *s = idl_global->scopes()->top_non_null(); + AST_Decl *d = NULL; + + if (s != NULL) + d = s->lookup_by_name(yypvt[-0].idlist, I_TRUE); + if (d == NULL) + idl_global->err()->lookup_error(yypvt[-0].idlist); + yyval.dcval = d; + } break; +case 127: +# line 943 "idl.yy" +{ + yyval.dlval = new UTL_DeclList(yypvt[-1].deval, yypvt[-0].dlval); + } break; +case 128: +# line 950 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_DeclsCommaSeen); + } break; +case 129: +# line 954 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_DeclsDeclSeen); + + if (yypvt[-3].dlval == NULL) + yyval.dlval = new UTL_DeclList(yypvt[-0].deval, NULL); + else { + yypvt[-3].dlval->nconc(new UTL_DeclList(yypvt[-0].deval, NULL)); + yyval.dlval = yypvt[-3].dlval; + } + } break; +case 130: +# line 965 "idl.yy" +{ + yyval.dlval = NULL; + } break; +case 133: +# line 977 "idl.yy" +{ + yyval.deval = new FE_Declarator(new UTL_ScopedName(yypvt[-0].idval, NULL), + FE_Declarator::FD_simple, NULL); + } break; +case 134: +# line 985 "idl.yy" +{ + yyval.deval = new FE_Declarator(new UTL_ScopedName(yypvt[-0].dcval->local_name(), NULL), + FE_Declarator::FD_complex, + yypvt[-0].dcval); + } break; +case 137: +# line 999 "idl.yy" +{ + yyval.etval = AST_Expression::EV_long; + } break; +case 138: +# line 1003 "idl.yy" +{ + yyval.etval = AST_Expression::EV_longlong; + } break; +case 139: +# line 1007 "idl.yy" +{ + yyval.etval = AST_Expression::EV_short; + } break; +case 140: +# line 1014 "idl.yy" +{ + yyval.etval = AST_Expression::EV_ulong; + } break; +case 141: +# line 1018 "idl.yy" +{ + yyval.etval = AST_Expression::EV_ulonglong; + } break; +case 142: +# line 1022 "idl.yy" +{ + yyval.etval = AST_Expression::EV_ushort; + } break; +case 143: +# line 1029 "idl.yy" +{ + yyval.etval = AST_Expression::EV_double; + } break; +case 144: +# line 1033 "idl.yy" +{ + yyval.etval = AST_Expression::EV_float; + } break; +case 145: +# line 1037 "idl.yy" +{ + yyval.etval = AST_Expression::EV_longdouble; + } break; +case 146: +# line 1044 "idl.yy" +{ + yyval.etval = AST_Expression::EV_char; + } break; +case 147: +# line 1048 "idl.yy" +{ + yyval.etval = AST_Expression::EV_wchar; + } break; +case 148: +# line 1055 "idl.yy" +{ + yyval.etval = AST_Expression::EV_octet; + } break; +case 149: +# line 1062 "idl.yy" +{ + yyval.etval = AST_Expression::EV_bool; + } break; +case 150: +# line 1069 "idl.yy" +{ + yyval.etval = AST_Expression::EV_any; + } break; +case 151: +# line 1076 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_StructSeen); + } break; +case 152: +# line 1080 "idl.yy" +{ + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_ScopedName *n = new UTL_ScopedName(yypvt[-0].idval, NULL); + AST_Structure *d = NULL; + UTL_StrList *p = idl_global->pragmas(); + AST_Decl *v = NULL; + + idl_global->set_parse_state(IDL_GlobalData::PS_StructIDSeen); + /* + * Create a node representing a struct declaration. Add it + * to the enclosing scope + */ + if (s != NULL) { + d = idl_global->gen()->create_structure(n, p); + (void) s->fe_add_structure(d); + } + /* + * Push the scope of the struct on the scopes stack + */ + idl_global->scopes()->push(d); + } break; +case 153: +# line 1102 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_StructSqSeen); + } break; +case 154: +# line 1106 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_StructBodySeen); + } break; +case 155: +# line 1110 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_StructQsSeen); + /* + * Done with this struct. Pop its scope off the scopes stack + */ + if (idl_global->scopes()->top() == NULL) + yyval.dcval = NULL; + else { + yyval.dcval = + AST_Structure::narrow_from_scope( + idl_global->scopes()->top_non_null()); + idl_global->scopes()->pop(); + } + } break; +case 159: +# line 1135 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_MemberTypeSeen); + } break; +case 160: +# line 1139 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_MemberDeclsSeen); + } break; +case 161: +# line 1143 "idl.yy" +{ + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_DecllistActiveIterator *l = NULL; + FE_Declarator *d = NULL; + AST_Field *f = NULL; + UTL_StrList *p = idl_global->pragmas(); + + idl_global->set_parse_state(IDL_GlobalData::PS_MemberDeclsCompleted); + /* + * Check for illegal recursive use of type + */ + if (yypvt[-4].dcval != NULL && AST_illegal_recursive_type(yypvt[-4].dcval)) + idl_global->err()->error1(UTL_Error::EIDL_RECURSIVE_TYPE, yypvt[-4].dcval); + /* + * Create a node representing a struct or exception member + * Add it to the enclosing scope + */ + else if (s != NULL && yypvt[-4].dcval != NULL && yypvt[-2].dlval != NULL) { + l = new UTL_DecllistActiveIterator(yypvt[-2].dlval); + for (;!(l->is_done()); l->next()) { + d = l->item(); + if (d == NULL) + continue; + AST_Type *tp = d->compose(yypvt[-4].dcval); + if (tp == NULL) + continue; + f = idl_global->gen()->create_field(tp, d->name(), p); + (void) s->fe_add_field(f); + } + delete l; + } + } break; +case 162: +# line 1176 "idl.yy" +{ + idl_global->err()->syntax_error(idl_global->parse_state()); + } break; +case 163: +# line 1180 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + yyerrok; + } break; +case 164: +# line 1188 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_UnionSeen); + } break; +case 165: +# line 1192 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_UnionIDSeen); + } break; +case 166: +# line 1196 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_SwitchSeen); + } break; +case 167: +# line 1200 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_SwitchOpenParSeen); + } break; +case 168: +# line 1204 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_SwitchTypeSeen); + } break; +case 169: +# line 1208 "idl.yy" +{ + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_ScopedName *n = new UTL_ScopedName(yypvt[-8].idval, NULL); + AST_Union *u = NULL; + AST_Decl *v = NULL; + UTL_StrList *p = idl_global->pragmas(); + + idl_global->set_parse_state(IDL_GlobalData::PS_SwitchCloseParSeen); + /* + * Create a node representing a union. Add it to its enclosing + * scope + */ + if (yypvt[-2].dcval != NULL && s != NULL) { + AST_ConcreteType *tp = AST_ConcreteType::narrow_from_decl(yypvt[-2].dcval); + if (tp == NULL) { + idl_global->err()->not_a_type(yypvt[-2].dcval); + } else { + u = idl_global->gen()->create_union(tp, n, p); + (void) s->fe_add_union(u); + } + } + /* + * Push the scope of the union on the scopes stack + */ + idl_global->scopes()->push(u); + } break; +case 170: +# line 1235 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_UnionSqSeen); + } break; +case 171: +# line 1239 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_UnionBodySeen); + } break; +case 172: +# line 1243 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_UnionQsSeen); + /* + * Done with this union. Pop its scope from the scopes stack + */ + if (idl_global->scopes()->top() == NULL) + yyval.dcval = NULL; + else { + yyval.dcval = + AST_Union::narrow_from_scope( + idl_global->scopes()->top_non_null()); + idl_global->scopes()->pop(); + } + } break; +case 173: +# line 1261 "idl.yy" +{ + yyval.dcval = idl_global->scopes()->bottom()->lookup_primitive_type(yypvt[-0].etval); + } break; +case 174: +# line 1265 "idl.yy" +{ + yyval.dcval = idl_global->scopes()->bottom()->lookup_primitive_type(yypvt[-0].etval); + } break; +case 175: +# line 1269 "idl.yy" +{ + yyval.dcval = idl_global->scopes()->bottom()->lookup_primitive_type(yypvt[-0].etval); + } break; +case 176: +# line 1273 "idl.yy" +{ + yyval.dcval = idl_global->scopes()->bottom()->lookup_primitive_type(yypvt[-0].etval); + } break; +case 178: +# line 1278 "idl.yy" +{ + UTL_Scope *s = idl_global->scopes()->top_non_null(); + AST_Decl *d = NULL; + AST_PredefinedType *p = NULL; + AST_Typedef *t = NULL; + long found = I_FALSE; + + /* + * The discriminator is a scoped name. Try to resolve to + * one of the scalar types or to an enum. Thread through + * typedef's to arrive at the base type at the end of the + * chain + */ + if (s != NULL && (d = s->lookup_by_name(yypvt[-0].idlist, I_TRUE)) != NULL) { + while (!found) { + switch (d->node_type()) { + case AST_Decl::NT_enum: + yyval.dcval = d; + found = I_TRUE; + break; + case AST_Decl::NT_pre_defined: + p = AST_PredefinedType::narrow_from_decl(d); + if (p != NULL) { + switch (p->pt()) { + case AST_PredefinedType::PT_long: + case AST_PredefinedType::PT_ulong: + case AST_PredefinedType::PT_longlong: + case AST_PredefinedType::PT_ulonglong: + case AST_PredefinedType::PT_short: + case AST_PredefinedType::PT_char: + case AST_PredefinedType::PT_wchar: + case AST_PredefinedType::PT_octet: + case AST_PredefinedType::PT_boolean: + yyval.dcval = p; + found = I_TRUE; + break; + default: + yyval.dcval = NULL; + found = I_TRUE; + break; + } + } + break; + case AST_Decl::NT_typedef: + t = AST_Typedef::narrow_from_decl(d); + if (t != NULL) d = t->base_type(); + break; + default: + yyval.dcval = NULL; + found = I_TRUE; + break; + } + } + } else + yyval.dcval = NULL; + + if (yyval.dcval == NULL) + idl_global->err()->lookup_error(yypvt[-0].idlist); + } break; +case 182: +# line 1348 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_UnionLabelSeen); + } break; +case 183: +# line 1352 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemSeen); + } break; +case 184: +# line 1356 "idl.yy" +{ + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_LabellistActiveIterator *l = NULL; + AST_UnionLabel *d = NULL; + AST_UnionBranch *b = NULL; + AST_Field *f = yypvt[-2].ffval; + + idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemCompleted); + /* + * Create several nodes representing branches of a union. + * Add them to the enclosing scope (the union scope) + */ + if (s != NULL && yypvt[-4].llval != NULL && yypvt[-2].ffval != NULL) { + l = new UTL_LabellistActiveIterator(yypvt[-4].llval); + for (;!(l->is_done()); l->next()) { + d = l->item(); + if (d == NULL) + continue; + b = idl_global->gen()->create_union_branch(d, + f->field_type(), + f->name(), + f->pragmas()); + (void) s->fe_add_union_branch(b); + } + delete l; + } + } break; +case 185: +# line 1384 "idl.yy" +{ + idl_global->err()->syntax_error(idl_global->parse_state()); + } break; +case 186: +# line 1388 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + yyerrok; + } break; +case 187: +# line 1396 "idl.yy" +{ + yyval.llval = new UTL_LabelList(yypvt[-1].ulval, yypvt[-0].llval); + } break; +case 188: +# line 1403 "idl.yy" +{ + if (yypvt[-1].llval == NULL) + yyval.llval = new UTL_LabelList(yypvt[-0].ulval, NULL); + else { + yypvt[-1].llval->nconc(new UTL_LabelList(yypvt[-0].ulval, NULL)); + yyval.llval = yypvt[-1].llval; + } + } break; +case 189: +# line 1412 "idl.yy" +{ + yyval.llval = NULL; + } break; +case 190: +# line 1419 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_DefaultSeen); + } break; +case 191: +# line 1423 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_LabelColonSeen); + + yyval.ulval = idl_global->gen()-> + create_union_label(AST_UnionLabel::UL_default, + NULL); + } break; +case 192: +# line 1431 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_CaseSeen); + } break; +case 193: +# line 1435 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_LabelExprSeen); + } break; +case 194: +# line 1439 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_LabelColonSeen); + + yyval.ulval = idl_global->gen()->create_union_label(AST_UnionLabel::UL_label, + yypvt[-2].exval); + } break; +case 195: +# line 1449 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemTypeSeen); + } break; +case 196: +# line 1453 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemDeclSeen); + /* + * Check for illegal recursive use of type + */ + if (yypvt[-2].dcval != NULL && AST_illegal_recursive_type(yypvt[-2].dcval)) + idl_global->err()->error1(UTL_Error::EIDL_RECURSIVE_TYPE, yypvt[-2].dcval); + /* + * Create a field in a union branch + */ + else if (yypvt[-2].dcval == NULL || yypvt[-0].deval == NULL) + yyval.ffval = NULL; + else { + AST_Type *tp = yypvt[-0].deval->compose(yypvt[-2].dcval); + if (tp == NULL) + yyval.ffval = NULL; + else + yyval.ffval = idl_global->gen()->create_field(tp, + yypvt[-0].deval->name(), + idl_global->pragmas()); + } + } break; +case 197: +# line 1479 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_EnumSeen); + } break; +case 198: +# line 1483 "idl.yy" +{ + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_ScopedName *n = new UTL_ScopedName(yypvt[-0].idval, NULL); + AST_Enum *e = NULL; + AST_Decl *v = NULL; + UTL_StrList *p = idl_global->pragmas(); + + idl_global->set_parse_state(IDL_GlobalData::PS_EnumIDSeen); + /* + * Create a node representing an enum and add it to its + * enclosing scope + */ + if (s != NULL) { + e = idl_global->gen()->create_enum(n, p); + /* + * Add it to its defining scope + */ + (void) s->fe_add_enum(e); + } + /* + * Push the enum scope on the scopes stack + */ + idl_global->scopes()->push(e); + } break; +case 199: +# line 1508 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_EnumSqSeen); + } break; +case 200: +# line 1512 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_EnumBodySeen); + } break; +case 201: +# line 1516 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_EnumQsSeen); + /* + * Done with this enum. Pop its scope from the scopes stack + */ + if (idl_global->scopes()->top() == NULL) + yyval.dcval = NULL; + else { + yyval.dcval = AST_Enum::narrow_from_scope(idl_global->scopes()->top_non_null()); + idl_global->scopes()->pop(); + } + } break; +case 203: +# line 1535 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_EnumCommaSeen); + } break; +case 206: +# line 1544 "idl.yy" +{ + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_ScopedName *n = + new UTL_ScopedName(new Identifier(yypvt[-0].strval, 1, 0, I_FALSE), NULL); + AST_EnumVal *e = NULL; + AST_Enum *c = NULL; + UTL_StrList *p = idl_global->pragmas(); + + /* + * Create a node representing one enumerator in an enum + * Add it to the enclosing scope (the enum scope) + */ + if (s != NULL && s->scope_node_type() == AST_Decl::NT_enum) { + c = AST_Enum::narrow_from_scope(s); + if (c != NULL) + e = idl_global->gen()->create_enum_val(c->next_enum_val(), n, p); + (void) s->fe_add_enum_val(e); + } + } break; +case 207: +# line 1568 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceCommaSeen); + } break; +case 208: +# line 1572 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceExprSeen); + } break; +case 209: +# line 1576 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceQsSeen); + /* + * Remove sequence marker from scopes stack + */ + if (idl_global->scopes()->top() == NULL) + idl_global->scopes()->pop(); + /* + * Create a node representing a sequence + */ + if (yypvt[-2].exval == NULL || yypvt[-2].exval->coerce(AST_Expression::EV_ulong) == NULL) { + idl_global->err()->coercion_error(yypvt[-2].exval, AST_Expression::EV_ulong); + yyval.dcval = NULL; + } else if (yypvt[-5].dcval == NULL) { + yyval.dcval = NULL; + } else { + AST_Type *tp = AST_Type::narrow_from_decl(yypvt[-5].dcval); + if (tp == NULL) + yyval.dcval = NULL; + else { + yyval.dcval = idl_global->gen()->create_sequence(yypvt[-2].exval, tp); + /* + * Add this AST_Sequence to the types defined in the global scope + */ + (void) idl_global->root() + ->fe_add_sequence(AST_Sequence::narrow_from_decl(yyval.dcval)); + } + } + } break; +case 210: +# line 1607 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceQsSeen); + /* + * Remove sequence marker from scopes stack + */ + if (idl_global->scopes()->top() == NULL) + idl_global->scopes()->pop(); + /* + * Create a node representing a sequence + */ + if (yypvt[-1].dcval == NULL) + yyval.dcval = NULL; + else { + AST_Type *tp = AST_Type::narrow_from_decl(yypvt[-1].dcval); + if (tp == NULL) + yyval.dcval = NULL; + else { + yyval.dcval = + idl_global->gen()->create_sequence( + idl_global->gen()->create_expr((unsigned long) 0), + tp); + /* + * Add this AST_Sequence to the types defined in the global scope + */ + (void) idl_global->root() + ->fe_add_sequence(AST_Sequence::narrow_from_decl(yyval.dcval)); + } + } + } break; +case 211: +# line 1640 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceSeen); + /* + * Push a sequence marker on scopes stack + */ + idl_global->scopes()->push(NULL); + } break; +case 212: +# line 1648 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceSqSeen); + } break; +case 213: +# line 1652 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceTypeSeen); + yyval.dcval = yypvt[-0].dcval; + } break; +case 214: +# line 1661 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_StringSqSeen); + } break; +case 215: +# line 1665 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_StringExprSeen); + } break; +case 216: +# line 1669 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_StringQsSeen); + /* + * Create a node representing a string + */ + if (yypvt[-2].exval == NULL || yypvt[-2].exval->coerce(AST_Expression::EV_ulong) == NULL) { + idl_global->err()->coercion_error(yypvt[-2].exval, AST_Expression::EV_ulong); + yyval.dcval = NULL; + } else { + yyval.dcval = idl_global->gen()->create_string(yypvt[-2].exval); + /* + * Add this AST_String to the types defined in the global scope + */ + (void) idl_global->root() + ->fe_add_string(AST_String::narrow_from_decl(yyval.dcval)); + } + } break; +case 217: +# line 1687 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_StringCompleted); + /* + * Create a node representing a string + */ + yyval.dcval = + idl_global->gen()->create_string( + idl_global->gen()->create_expr((unsigned long) 0)); + /* + * Add this AST_String to the types defined in the global scope + */ + (void) idl_global->root() + ->fe_add_string(AST_String::narrow_from_decl(yyval.dcval)); + } break; +case 218: +# line 1705 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_StringSeen); + } break; +case 219: +# line 1713 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_StringSqSeen); + } break; +case 220: +# line 1717 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_StringExprSeen); + } break; +case 221: +# line 1721 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_StringQsSeen); + /* + * Create a node representing a string + */ + if (yypvt[-2].exval == NULL || yypvt[-2].exval->coerce(AST_Expression::EV_ulong) == NULL) { + idl_global->err()->coercion_error(yypvt[-2].exval, AST_Expression::EV_ulong); + yyval.dcval = NULL; + } else { + yyval.dcval = idl_global->gen()->create_wstring(yypvt[-2].exval); + /* + * Add this AST_String to the types defined in the global scope + */ + (void) idl_global->root() + ->fe_add_string(AST_String::narrow_from_decl(yyval.dcval)); + } + } break; +case 222: +# line 1739 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_StringCompleted); + /* + * Create a node representing a string + */ + yyval.dcval = + idl_global->gen()->create_wstring( + idl_global->gen()->create_expr((unsigned long) 0)); + /* + * Add this AST_String to the types defined in the global scope + */ + (void) idl_global->root() + ->fe_add_string(AST_String::narrow_from_decl(yyval.dcval)); + } break; +case 223: +# line 1757 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_StringSeen); + } break; +case 224: +# line 1764 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ArrayIDSeen); + } break; +case 225: +# line 1768 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ArrayCompleted); + /* + * Create a node representing an array + */ + if (yypvt[-0].elval != NULL) { + yyval.dcval = idl_global->gen()->create_array(new UTL_ScopedName(yypvt[-2].idval, NULL), + yypvt[-0].elval->length(), yypvt[-0].elval); + } + } break; +case 226: +# line 1782 "idl.yy" +{ + yyval.elval = new UTL_ExprList(yypvt[-1].exval, yypvt[-0].elval); + } break; +case 227: +# line 1789 "idl.yy" +{ + if (yypvt[-1].elval == NULL) + yyval.elval = new UTL_ExprList(yypvt[-0].exval, NULL); + else { + yypvt[-1].elval->nconc(new UTL_ExprList(yypvt[-0].exval, NULL)); + yyval.elval = yypvt[-1].elval; + } + } break; +case 228: +# line 1798 "idl.yy" +{ + yyval.elval = NULL; + } break; +case 229: +# line 1805 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_DimSqSeen); + } break; +case 230: +# line 1809 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_DimExprSeen); + } break; +case 231: +# line 1813 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_DimQsSeen); + /* + * Array dimensions are expressions which must be coerced to + * positive integers + */ + if (yypvt[-2].exval == NULL || yypvt[-2].exval->coerce(AST_Expression::EV_ulong) == NULL) { + idl_global->err()->coercion_error(yypvt[-2].exval, AST_Expression::EV_ulong); + yyval.exval = NULL; + } else + yyval.exval = yypvt[-2].exval; + } break; +case 232: +# line 1830 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_AttrSeen); + } break; +case 233: +# line 1834 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_AttrTypeSeen); + } break; +case 234: +# line 1838 "idl.yy" +{ + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_DecllistActiveIterator *l = NULL; + AST_Attribute *a = NULL; + FE_Declarator *d = NULL; + UTL_StrList *p = idl_global->pragmas(); + + idl_global->set_parse_state(IDL_GlobalData::PS_AttrCompleted); + /* + * Create nodes representing attributes and add them to the + * enclosing scope + */ + if (s != NULL && yypvt[-2].dcval != NULL && yypvt[-0].dlval != NULL) { + l = new UTL_DecllistActiveIterator(yypvt[-0].dlval); + for (;!(l->is_done()); l->next()) { + d = l->item(); + if (d == NULL) + continue; + AST_Type *tp = d->compose(yypvt[-2].dcval); + if (tp == NULL) + continue; + a = idl_global->gen()->create_attribute(yypvt[-5].bval, tp, d->name(), p); + /* + * Add one attribute to the enclosing scope + */ + (void) s->fe_add_attribute(a); + } + delete l; + } + } break; +case 235: +# line 1872 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_AttrROSeen); + yyval.bval = I_TRUE; + } break; +case 236: +# line 1877 "idl.yy" +{ + yyval.bval = I_FALSE; + } break; +case 237: +# line 1884 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptSeen); + } break; +case 238: +# line 1888 "idl.yy" +{ + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_ScopedName *n = new UTL_ScopedName(yypvt[-0].idval, NULL); + AST_Exception *e = NULL; + UTL_StrList *p = idl_global->pragmas(); + AST_Decl *v = NULL; + + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptIDSeen); + /* + * Create a node representing an exception and add it to + * the enclosing scope + */ + if (s != NULL) { + e = idl_global->gen()->create_exception(n, p); + (void) s->fe_add_exception(e); + } + /* + * Push the exception scope on the scope stack + */ + idl_global->scopes()->push(e); + } break; +case 239: +# line 1910 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptSqSeen); + } break; +case 240: +# line 1914 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptBodySeen); + } break; +case 241: +# line 1918 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptQsSeen); + /* + * Done with this exception. Pop its scope from the scope stack + */ + idl_global->scopes()->pop(); + } break; +case 242: +# line 1930 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpTypeSeen); + } break; +case 243: +# line 1934 "idl.yy" +{ + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_ScopedName *n = + new UTL_ScopedName(new Identifier(yypvt[-0].strval, 1, 0, I_FALSE), NULL); + AST_Operation *o = NULL; + UTL_StrList *p = idl_global->pragmas(); + + idl_global->set_parse_state(IDL_GlobalData::PS_OpIDSeen); + /* + * Create a node representing an operation on an interface + * and add it to its enclosing scope + */ + if (s != NULL && yypvt[-2].dcval != NULL) { + AST_Type *tp = AST_Type::narrow_from_decl(yypvt[-2].dcval); + if (tp == NULL) { + idl_global->err()->not_a_type(yypvt[-2].dcval); + } else if (tp->node_type() == AST_Decl::NT_except) { + idl_global->err()->not_a_type(yypvt[-2].dcval); + } else { + o = idl_global->gen()->create_operation(tp, yypvt[-3].ofval, n, p); + (void) s->fe_add_operation(o); + } + } + /* + * Push the operation scope onto the scopes stack + */ + idl_global->scopes()->push(o); + } break; +case 244: +# line 1963 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpParsCompleted); + } break; +case 245: +# line 1967 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseCompleted); + } break; +case 246: +# line 1971 "idl.yy" +{ + UTL_Scope *s = idl_global->scopes()->top_non_null(); + AST_Operation *o = NULL; + + idl_global->set_parse_state(IDL_GlobalData::PS_OpCompleted); + /* + * Add exceptions and context to the operation + */ + if (s != NULL && s->scope_node_type() == AST_Decl::NT_op) { + o = AST_Operation::narrow_from_scope(s); + + if (yypvt[-2].nlval != NULL && o != NULL) + (void) o->fe_add_exceptions(yypvt[-2].nlval); + if (yypvt[-0].slval != NULL) + (void) o->fe_add_context(yypvt[-0].slval); + } + /* + * Done with this operation. Pop its scope from the scopes stack + */ + idl_global->scopes()->pop(); + } break; +case 247: +# line 1996 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpAttrSeen); + yyval.ofval = AST_Operation::OP_oneway; + } break; +case 248: +# line 2001 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpAttrSeen); + yyval.ofval = AST_Operation::OP_idempotent; + } break; +case 249: +# line 2006 "idl.yy" +{ + yyval.ofval = AST_Operation::OP_noflags; + } break; +case 251: +# line 2014 "idl.yy" +{ + yyval.dcval = + idl_global->scopes()->bottom() + ->lookup_primitive_type(AST_Expression::EV_void); + } break; +case 252: +# line 2023 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpSqSeen); + } break; +case 253: +# line 2027 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpQsSeen); + } break; +case 254: +# line 2031 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpSqSeen); + } break; +case 255: +# line 2036 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpQsSeen); + } break; +case 257: +# line 2046 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpParCommaSeen); + } break; +case 260: +# line 2055 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpParDirSeen); + } break; +case 261: +# line 2059 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpParTypeSeen); + } break; +case 262: +# line 2063 "idl.yy" +{ + UTL_Scope *s = idl_global->scopes()->top_non_null(); + AST_Argument *a = NULL; + UTL_StrList *p = idl_global->pragmas(); + + idl_global->set_parse_state(IDL_GlobalData::PS_OpParDeclSeen); + /* + * Create a node representing an argument to an operation + * Add it to the enclosing scope (the operation scope) + */ + if (yypvt[-2].dcval != NULL && yypvt[-0].deval != NULL && s != NULL) { + AST_Type *tp = yypvt[-0].deval->compose(yypvt[-2].dcval); + if (tp != NULL) { + a = idl_global->gen()->create_argument(yypvt[-4].dival, tp, yypvt[-0].deval->name(), p); + (void) s->fe_add_argument(a); + } + } + } break; +case 263: +# line 2085 "idl.yy" +{ + yyval.dival = AST_Argument::dir_IN; + } break; +case 264: +# line 2089 "idl.yy" +{ + yyval.dival = AST_Argument::dir_OUT; + } break; +case 265: +# line 2093 "idl.yy" +{ + yyval.dival = AST_Argument::dir_INOUT; + } break; +case 266: +# line 2100 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseSeen); + } break; +case 267: +# line 2104 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseSqSeen); + } break; +case 268: +# line 2109 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseQsSeen); + yyval.nlval = yypvt[-1].nlval; + } break; +case 269: +# line 2114 "idl.yy" +{ + yyval.nlval = NULL; + } break; +case 270: +# line 2121 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpContextSeen); + } break; +case 271: +# line 2125 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpContextSqSeen); + } break; +case 272: +# line 2130 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpContextQsSeen); + yyval.slval = yypvt[-1].slval; + } break; +case 273: +# line 2135 "idl.yy" +{ + yyval.slval = NULL; + } break; +case 274: +# line 2142 "idl.yy" +{ + yyval.slval = new UTL_StrList(yypvt[-1].sval, yypvt[-0].slval); + } break; +case 275: +# line 2150 "idl.yy" +{ + idl_global->set_parse_state(IDL_GlobalData::PS_OpContextCommaSeen); + } break; +case 276: +# line 2154 "idl.yy" +{ + if (yypvt[-3].slval == NULL) + yyval.slval = new UTL_StrList(yypvt[-0].sval, NULL); + else { + yypvt[-3].slval->nconc(new UTL_StrList(yypvt[-0].sval, NULL)); + yyval.slval = yypvt[-3].slval; + } + } break; +case 277: +# line 2163 "idl.yy" +{ + yyval.slval = NULL; + } break; +# line 532 "/usr/ccs/bin/yaccpar" + } + goto yystack; /* reset registers in driver code */ +} + diff --git a/TAO/TAO_IDL/fe/y.tab.h b/TAO/TAO_IDL/fe/y.tab.h new file mode 100644 index 00000000000..8df07d2632c --- /dev/null +++ b/TAO/TAO_IDL/fe/y.tab.h @@ -0,0 +1,76 @@ + +typedef union +#ifdef __cplusplus + YYSTYPE +#endif + { + AST_Decl *dcval; /* Decl value */ + UTL_StrList *slval; /* String list */ + UTL_NameList *nlval; /* Name list */ + UTL_ExprList *elval; /* Expression list */ + UTL_LabelList *llval; /* Label list */ + UTL_DeclList *dlval; /* Declaration list */ + FE_InterfaceHeader *ihval; /* Interface header */ + AST_Expression *exval; /* Expression value */ + AST_UnionLabel *ulval; /* Union label */ + AST_Field *ffval; /* Field value */ + AST_Expression::ExprType etval; /* Expression type */ + AST_Argument::Direction dival; /* Argument direction */ + AST_Operation::Flags ofval; /* Operation flags */ + FE_Declarator *deval; /* Declarator value */ + idl_bool bval; /* Boolean value */ + long ival; /* Long value */ + double dval; /* Double value */ + float fval; /* Float value */ + char cval; /* Char value */ + + String *sval; /* String value */ + char *strval; /* char * value */ + Identifier *idval; /* Identifier */ + UTL_IdList *idlist; /* Identifier list */ +} YYSTYPE; +extern YYSTYPE yylval; +# define IDENTIFIER 257 +# define CONST 258 +# define MODULE 259 +# define INTERFACE 260 +# define TYPEDEF 261 +# define LONG 262 +# define SHORT 263 +# define UNSIGNED 264 +# define DOUBLE 265 +# define FLOAT 266 +# define CHAR 267 +# define WCHAR 268 +# define OCTET 269 +# define BOOLEAN 270 +# define ANY 271 +# define STRUCT 272 +# define UNION 273 +# define SWITCH 274 +# define ENUM 275 +# define SEQUENCE 276 +# define STRING 277 +# define WSTRING 278 +# define EXCEPTION 279 +# define CASE 280 +# define DEFAULT 281 +# define READONLY 282 +# define ATTRIBUTE 283 +# define ONEWAY 284 +# define IDEMPOTENT 285 +# define VOID 286 +# define IN 287 +# define OUT 288 +# define INOUT 289 +# define RAISES 290 +# define CONTEXT 291 +# define INTEGER_LITERAL 292 +# define STRING_LITERAL 293 +# define CHARACTER_LITERAL 294 +# define FLOATING_PT_LITERAL 295 +# define TRUETOK 296 +# define FALSETOK 297 +# define SCOPE_DELIMITOR 298 +# define LEFT_SHIFT 299 +# define RIGHT_SHIFT 300 |