aboutsummaryrefslogtreecommitdiff
path: root/gnu/usr.bin/cc/cc1obj
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/cc/cc1obj')
-rw-r--r--gnu/usr.bin/cc/cc1obj/Makefile22
-rw-r--r--gnu/usr.bin/cc/cc1obj/objc-act.c7636
-rw-r--r--gnu/usr.bin/cc/cc1obj/objc-act.h116
-rw-r--r--gnu/usr.bin/cc/cc1obj/objc-parse.c4626
-rw-r--r--gnu/usr.bin/cc/cc1obj/objc-tree.def36
5 files changed, 12436 insertions, 0 deletions
diff --git a/gnu/usr.bin/cc/cc1obj/Makefile b/gnu/usr.bin/cc/cc1obj/Makefile
new file mode 100644
index 000000000000..c505419ef6f2
--- /dev/null
+++ b/gnu/usr.bin/cc/cc1obj/Makefile
@@ -0,0 +1,22 @@
+PROG= gcc1obj
+BINDIR= /usr/libexec
+SRCS= objc-parse.c objc-act.c \
+ c-lex.c c-pragma.c c-decl.c c-typeck.c c-convert.c \
+ c-aux-info.c c-iterate.c
+CFLAGS+= -I. -I$(.CURDIR) -I$(.CURDIR)/../lib
+YFLAGS=
+NOMAN= noman
+.PATH: $(.CURDIR)/../cc1
+
+.if exists(${.CURDIR}/../lib/obj)
+LDADD= -L${.CURDIR}/../lib/obj -lgcc2
+DPADD= ${.CURDIR}/../lib/obj/libgcc2.a
+.else
+LDADD= -L${.CURDIR}/../lib/ -lgcc2
+DPADD= ${.CURDIR}/../lib/libgcc2.a
+.endif
+
+LDADD+= -lgnumalloc
+DPADD+= ${LIBGNUMALLOC}
+
+.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/cc/cc1obj/objc-act.c b/gnu/usr.bin/cc/cc1obj/objc-act.c
new file mode 100644
index 000000000000..a307b336be6d
--- /dev/null
+++ b/gnu/usr.bin/cc/cc1obj/objc-act.c
@@ -0,0 +1,7636 @@
+/* Implement classes and message passing for Objective C.
+ Copyright (C) 1992, 1993 Free Software Foundation, Inc.
+ Author: Steve Naroff.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* Purpose: This module implements the Objective-C 4.0 language.
+
+ compatibility issues (with the Stepstone translator):
+
+ - does not recognize the following 3.3 constructs.
+ @requires, @classes, @messages, = (...)
+ - methods with variable arguments must conform to ANSI standard.
+ - tagged structure definitions that appear in BOTH the interface
+ and implementation are not allowed.
+ - public/private: all instance variables are public within the
+ context of the implementation...I consider this to be a bug in
+ the translator.
+ - statically allocated objects are not supported. the user will
+ receive an error if this service is requested.
+
+ code generation `options':
+
+ - OBJC_INT_SELECTORS */
+
+#include <stdio.h>
+#include "config.h"
+#include "tree.h"
+#include "c-tree.h"
+#include "c-lex.h"
+#include "flags.h"
+#include "objc-act.h"
+#include "input.h"
+#include "function.h"
+
+/* This is the default way of generating a method name. */
+/* I am not sure it is really correct.
+ Perhaps there's a danger that it will make name conflicts
+ if method names contain underscores. -- rms. */
+#ifndef OBJC_GEN_METHOD_LABEL
+#define OBJC_GEN_METHOD_LABEL(BUF, IS_INST, CLASS_NAME, CAT_NAME, SEL_NAME, NUM) \
+ do { \
+ char *temp; \
+ sprintf ((BUF), "_%s_%s_%s_%s", \
+ ((IS_INST) ? "i" : "c"), \
+ (CLASS_NAME), \
+ ((CAT_NAME)? (CAT_NAME) : ""), \
+ (SEL_NAME)); \
+ for (temp = (BUF); *temp; temp++) \
+ if (*temp == ':') *temp = '_'; \
+ } while (0)
+#endif
+
+/* These need specifying. */
+#ifndef OBJC_FORWARDING_STACK_OFFSET
+#define OBJC_FORWARDING_STACK_OFFSET 0
+#endif
+
+#ifndef OBJC_FORWARDING_MIN_OFFSET
+#define OBJC_FORWARDING_MIN_OFFSET 0
+#endif
+
+/* Define the special tree codes that we use. */
+
+/* Table indexed by tree code giving a string containing a character
+ classifying the tree code. Possibilities are
+ t, d, s, c, r, <, 1 and 2. See objc-tree.def for details. */
+
+#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
+
+char *objc_tree_code_type[] = {
+ "x",
+#include "objc-tree.def"
+};
+#undef DEFTREECODE
+
+/* Table indexed by tree code giving number of expression
+ operands beyond the fixed part of the node structure.
+ Not used for types or decls. */
+
+#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
+
+int objc_tree_code_length[] = {
+ 0,
+#include "objc-tree.def"
+};
+#undef DEFTREECODE
+
+/* Names of tree components.
+ Used for printing out the tree and error messages. */
+#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
+
+char *objc_tree_code_name[] = {
+ "@@dummy",
+#include "objc-tree.def"
+};
+#undef DEFTREECODE
+
+/* Set up for use of obstacks. */
+
+#include "obstack.h"
+
+#define obstack_chunk_alloc xmalloc
+#define obstack_chunk_free free
+
+/* This obstack is used to accumulate the encoding of a data type. */
+static struct obstack util_obstack;
+/* This points to the beginning of obstack contents,
+ so we can free the whole contents. */
+char *util_firstobj;
+
+/* for encode_method_def */
+#include "rtl.h"
+#include "c-parse.h"
+
+#define OBJC_VERSION 5
+#define PROTOCOL_VERSION 2
+
+#define NULLT (tree) 0
+
+#define OBJC_ENCODE_INLINE_DEFS 0
+#define OBJC_ENCODE_DONT_INLINE_DEFS 1
+
+/*** Private Interface (procedures) ***/
+
+/* used by compile_file */
+
+static void init_objc PROTO((void));
+static void finish_objc PROTO((void));
+
+/* code generation */
+
+static void synth_module_prologue PROTO((void));
+static char *build_module_descriptor PROTO((void));
+static tree init_module_descriptor PROTO((void));
+static tree build_objc_method_call PROTO((int, tree, tree, tree, tree, tree));
+static void generate_strings PROTO((void));
+static void build_selector_translation_table PROTO((void));
+static tree build_ivar_chain PROTO((tree, int));
+
+static tree build_ivar_template PROTO((void));
+static tree build_method_template PROTO((void));
+static tree build_private_template PROTO((tree));
+static void build_class_template PROTO((void));
+static void build_category_template PROTO((void));
+static tree build_super_template PROTO((void));
+static tree build_category_initializer PROTO((tree, tree, tree, tree, tree));
+static tree build_protocol_initializer PROTO((tree, tree, tree, tree));
+
+static void synth_forward_declarations PROTO((void));
+static void generate_ivar_lists PROTO((void));
+static void generate_dispatch_tables PROTO((void));
+static void generate_shared_structures PROTO((void));
+static tree generate_protocol_list PROTO((tree));
+static void generate_forward_declaration_to_string_table PROTO((void));
+static void build_protocol_reference PROTO((tree));
+
+static tree init_selector PROTO((int));
+static tree build_keyword_selector PROTO((tree));
+static tree synth_id_with_class_suffix PROTO((char *, tree));
+
+/* misc. bookkeeping */
+
+typedef struct hashed_entry *hash;
+typedef struct hashed_attribute *attr;
+
+struct hashed_attribute
+{
+ attr next;
+ tree value;
+};
+struct hashed_entry
+{
+ attr list;
+ hash next;
+ tree key;
+};
+
+static void hash_init PROTO((void));
+static void hash_enter PROTO((hash *, tree));
+static hash hash_lookup PROTO((hash *, tree));
+static void hash_add_attr PROTO((hash, tree));
+static tree lookup_method PROTO((tree, tree));
+static tree lookup_instance_method_static PROTO((tree, tree));
+static tree lookup_class_method_static PROTO((tree, tree));
+static tree add_class PROTO((tree));
+static void add_category PROTO((tree, tree));
+
+enum string_section
+{
+ class_names, /* class, category, protocol, module names */
+ meth_var_names, /* method and variable names */
+ meth_var_types /* method and variable type descriptors */
+};
+
+static tree add_objc_string PROTO((tree, enum string_section));
+static tree build_objc_string_decl PROTO((tree, enum string_section));
+static tree build_selector_reference_decl PROTO((tree));
+
+/* protocol additions */
+
+static tree add_protocol PROTO((tree));
+static tree lookup_protocol PROTO((tree));
+static tree lookup_and_install_protocols PROTO((tree));
+
+/* type encoding */
+
+static void encode_type_qualifiers PROTO((tree));
+static void encode_pointer PROTO((tree, int, int));
+static void encode_array PROTO((tree, int, int));
+static void encode_aggregate PROTO((tree, int, int));
+static void encode_bitfield PROTO((int, int));
+static void encode_type PROTO((tree, int, int));
+static void encode_field_decl PROTO((tree, int, int));
+
+static void really_start_method PROTO((tree, tree));
+static int comp_method_with_proto PROTO((tree, tree));
+static int comp_proto_with_proto PROTO((tree, tree));
+static tree get_arg_type_list PROTO((tree, int, int));
+static tree expr_last PROTO((tree));
+
+/* utilities for debugging and error diagnostics: */
+
+static void warn_with_method PROTO((char *, int, tree));
+static void error_with_ivar PROTO((char *, tree, tree));
+static char *gen_method_decl PROTO((tree, char *));
+static char *gen_declaration PROTO((tree, char *));
+static char *gen_declarator PROTO((tree, char *, char *));
+static int is_complex_decl PROTO((tree));
+static void adorn_decl PROTO((tree, char *));
+static void dump_interface PROTO((FILE *, tree));
+
+/* everything else. */
+
+static void objc_fatal PROTO((void));
+static tree define_decl PROTO((tree, tree));
+static tree lookup_method_in_protocol_list PROTO((tree, tree, int));
+static tree lookup_protocol_in_reflist PROTO((tree, tree));
+static tree create_builtin_decl PROTO((enum tree_code, tree, char *));
+static tree my_build_string PROTO((int, char *));
+static void build_objc_symtab_template PROTO((void));
+static tree init_def_list PROTO((void));
+static tree init_objc_symtab PROTO((void));
+static void forward_declare_categories PROTO((void));
+static void generate_objc_symtab_decl PROTO((void));
+static tree build_selector PROTO((tree));
+static tree build_msg_pool_reference PROTO((int));
+static tree build_selector_reference PROTO((tree));
+static tree build_class_reference_decl PROTO((tree));
+static void add_class_reference PROTO((tree));
+static tree objc_copy_list PROTO((tree, tree *));
+static tree build_protocol_template PROTO((void));
+static tree build_descriptor_table_initializer PROTO((tree, int *));
+static tree build_method_prototype_list_template PROTO((tree, int));
+static tree build_method_prototype_template PROTO((void));
+static int forwarding_offset PROTO((tree));
+static tree encode_method_prototype PROTO((tree, tree));
+static tree generate_descriptor_table PROTO((tree, char *, int, tree, tree));
+static void generate_method_descriptors PROTO((tree));
+static tree build_tmp_function_decl PROTO((void));
+static void hack_method_prototype PROTO((tree, tree));
+static void generate_protocol_references PROTO((tree));
+static void generate_protocols PROTO((void));
+static void check_ivars PROTO((tree, tree));
+static tree build_ivar_list_template PROTO((tree, int));
+static tree build_method_list_template PROTO((tree, int));
+static tree build_ivar_list_initializer PROTO((tree, int *));
+static tree generate_ivars_list PROTO((tree, char *, int, tree));
+static tree build_dispatch_table_initializer PROTO((tree, int *));
+static tree generate_dispatch_table PROTO((tree, char *, int, tree));
+static tree build_shared_structure_initializer PROTO((tree, tree, tree, tree, int, tree, tree, tree));
+static void generate_category PROTO((tree));
+static int is_objc_type_qualifier PROTO((tree));
+static tree adjust_type_for_id_default PROTO((tree));
+static tree check_duplicates PROTO((hash));
+static tree receiver_is_class_object PROTO((tree));
+static int check_methods PROTO((tree, tree, int));
+static int conforms_to_protocol PROTO((tree, tree));
+static void check_protocols PROTO((tree, char *, char *));
+static tree encode_method_def PROTO((tree));
+static void gen_declspecs PROTO((tree, char *, int));
+static void generate_classref_translation_entry PROTO((tree));
+static void handle_class_ref PROTO((tree));
+
+/*** Private Interface (data) ***/
+
+/* reserved tag definitions: */
+
+#define TYPE_ID "id"
+#define TAG_OBJECT "objc_object"
+#define TAG_CLASS "objc_class"
+#define TAG_SUPER "objc_super"
+#define TAG_SELECTOR "objc_selector"
+
+#define UTAG_CLASS "_objc_class"
+#define UTAG_IVAR "_objc_ivar"
+#define UTAG_IVAR_LIST "_objc_ivar_list"
+#define UTAG_METHOD "_objc_method"
+#define UTAG_METHOD_LIST "_objc_method_list"
+#define UTAG_CATEGORY "_objc_category"
+#define UTAG_MODULE "_objc_module"
+#define UTAG_SYMTAB "_objc_symtab"
+#define UTAG_SUPER "_objc_super"
+
+#define UTAG_PROTOCOL "_objc_protocol"
+#define UTAG_PROTOCOL_LIST "_objc_protocol_list"
+#define UTAG_METHOD_PROTOTYPE "_objc_method_prototype"
+#define UTAG_METHOD_PROTOTYPE_LIST "_objc__method_prototype_list"
+
+#define STRING_OBJECT_CLASS_NAME "NXConstantString"
+#define PROTOCOL_OBJECT_CLASS_NAME "Protocol"
+
+static char* TAG_GETCLASS;
+static char* TAG_GETMETACLASS;
+static char* TAG_MSGSEND;
+static char* TAG_MSGSENDSUPER;
+static char* TAG_EXECCLASS;
+
+/* Set by `continue_class' and checked by `is_public'. */
+
+#define TREE_STATIC_TEMPLATE(record_type) (TREE_PUBLIC (record_type))
+#define TYPED_OBJECT(type) \
+ (TREE_CODE (type) == RECORD_TYPE && TREE_STATIC_TEMPLATE (type))
+
+/* Some commonly used instances of "identifier_node". */
+
+static tree self_id, ucmd_id;
+
+static tree self_decl, umsg_decl, umsg_super_decl;
+static tree objc_get_class_decl, objc_get_meta_class_decl;
+
+static tree super_type, selector_type, id_type, objc_class_type;
+static tree instance_type, protocol_type;
+
+/* Type checking macros. */
+
+#define IS_ID(TYPE) \
+ (TYPE_MAIN_VARIANT (TYPE) == TYPE_MAIN_VARIANT (id_type))
+#define IS_PROTOCOL_QUALIFIED_ID(TYPE) \
+ (IS_ID (TYPE) && TYPE_PROTOCOL_LIST (TYPE))
+#define IS_SUPER(TYPE) \
+ (super_type && TYPE_MAIN_VARIANT (TYPE) == TYPE_MAIN_VARIANT (super_type))
+
+static tree class_chain = NULLT;
+static tree alias_chain = NULLT;
+static tree interface_chain = NULLT;
+static tree protocol_chain = NULLT;
+
+/* chains to manage selectors that are referenced and defined in the module */
+
+static tree cls_ref_chain = NULLT; /* classes referenced */
+static tree sel_ref_chain = NULLT; /* selectors referenced */
+
+/* chains to manage uniquing of strings */
+
+static tree class_names_chain = NULLT;
+static tree meth_var_names_chain = NULLT;
+static tree meth_var_types_chain = NULLT;
+
+/* hash tables to manage the global pool of method prototypes */
+
+static hash *nst_method_hash_list = 0;
+static hash *cls_method_hash_list = 0;
+
+/* backend data declarations */
+
+static tree UOBJC_SYMBOLS_decl;
+static tree UOBJC_INSTANCE_VARIABLES_decl, UOBJC_CLASS_VARIABLES_decl;
+static tree UOBJC_INSTANCE_METHODS_decl, UOBJC_CLASS_METHODS_decl;
+static tree UOBJC_CLASS_decl, UOBJC_METACLASS_decl;
+static tree UOBJC_SELECTOR_TABLE_decl;
+static tree UOBJC_MODULES_decl;
+static tree UOBJC_STRINGS_decl;
+
+/* The following are used when compiling a class implementation.
+ implementation_template will normally be an interface, however if
+ none exists this will be equal to implementation_context...it is
+ set in start_class. */
+
+static tree implementation_context = NULLT,
+ implementation_template = NULLT;
+
+struct imp_entry
+{
+ struct imp_entry *next;
+ tree imp_context;
+ tree imp_template;
+ tree class_decl; /* _OBJC_CLASS_<my_name>; */
+ tree meta_decl; /* _OBJC_METACLASS_<my_name>; */
+};
+
+static void handle_impent PROTO((struct imp_entry *));
+
+static struct imp_entry *imp_list = 0;
+static int imp_count = 0; /* `@implementation' */
+static int cat_count = 0; /* `@category' */
+
+static tree objc_class_template, objc_category_template, uprivate_record;
+static tree objc_protocol_template;
+static tree ucls_super_ref, uucls_super_ref;
+
+static tree objc_method_template, objc_ivar_template;
+static tree objc_symtab_template, objc_module_template;
+static tree objc_super_template, objc_object_reference;
+
+static tree objc_object_id, objc_class_id, objc_id_id;
+static tree constant_string_id;
+static tree constant_string_type;
+static tree UOBJC_SUPER_decl;
+
+static tree method_context = NULLT;
+static int method_slot = 0; /* used by start_method_def */
+
+#define BUFSIZE 1024
+
+static char *errbuf; /* a buffer for error diagnostics */
+
+/* data imported from tree.c */
+
+extern struct obstack permanent_obstack, *current_obstack, *rtl_obstack;
+
+/* data imported from toplev.c */
+
+extern char *dump_base_name;
+
+/* Generate code for GNU or NeXT runtime environment. */
+
+#ifdef NEXT_OBJC_RUNTIME
+int flag_next_runtime = 1;
+#else
+int flag_next_runtime = 0;
+#endif
+
+/* Open and close the file for outputting class declarations, if requested. */
+
+int flag_gen_declaration = 0;
+
+FILE *gen_declaration_file;
+
+/* Warn if multiple methods are seen for the same selector, but with
+ different argument types. */
+
+int warn_selector = 0;
+
+/* Warn if methods required by a protocol are not implemented in the
+ class adopting it. When turned off, methods inherited to that
+ class are also considered implemented */
+
+int flag_warn_protocol = 1;
+
+/* tells "encode_pointer/encode_aggregate" whether we are generating
+ type descriptors for instance variables (as opposed to methods).
+ Type descriptors for instance variables contain more information
+ than methods (for static typing and embedded structures). This
+ was added to support features being planned for dbkit2. */
+
+static int generating_instance_variables = 0;
+
+void
+lang_init ()
+{
+ /* the beginning of the file is a new line; check for # */
+ /* With luck, we discover the real source file's name from that
+ and put it in input_filename. */
+ ungetc (check_newline (), finput);
+
+ /* If gen_declaration desired, open the output file. */
+ if (flag_gen_declaration)
+ {
+ int dump_base_name_length = strlen (dump_base_name);
+ register char *dumpname = (char *) xmalloc (dump_base_name_length + 7);
+ strcpy (dumpname, dump_base_name);
+ strcat (dumpname, ".decl");
+ gen_declaration_file = fopen (dumpname, "w");
+ if (gen_declaration_file == 0)
+ pfatal_with_name (dumpname);
+ }
+
+ if (flag_next_runtime)
+ {
+ TAG_GETCLASS = "objc_getClass";
+ TAG_GETMETACLASS = "objc_getMetaClass";
+ TAG_MSGSEND = "objc_msgSend";
+ TAG_MSGSENDSUPER = "objc_msgSendSuper";
+ TAG_EXECCLASS = "__objc_execClass";
+ }
+ else
+ {
+ TAG_GETCLASS = "objc_get_class";
+ TAG_GETMETACLASS = "objc_get_meta_class";
+ TAG_MSGSEND = "objc_msg_lookup";
+ TAG_MSGSENDSUPER = "objc_msg_lookup_super";
+ TAG_EXECCLASS = "__objc_exec_class";
+ }
+
+ if (doing_objc_thang)
+ init_objc ();
+}
+
+static void
+objc_fatal ()
+{
+ fatal ("Objective-C text in C source file");
+}
+
+void
+objc_finish ()
+{
+ if (doing_objc_thang)
+ finish_objc (); /* Objective-C finalization */
+
+ if (gen_declaration_file)
+ fclose (gen_declaration_file);
+}
+
+void
+lang_finish ()
+{
+}
+
+char *
+lang_identify ()
+{
+ return "objc";
+}
+
+int
+lang_decode_option (p)
+ char *p;
+{
+ if (!strcmp (p, "-lang-objc"))
+ doing_objc_thang = 1;
+ else if (!strcmp (p, "-gen-decls"))
+ flag_gen_declaration = 1;
+ else if (!strcmp (p, "-Wselector"))
+ warn_selector = 1;
+ else if (!strcmp (p, "-Wno-selector"))
+ warn_selector = 0;
+ else if (!strcmp (p, "-Wprotocol"))
+ flag_warn_protocol = 1;
+ else if (!strcmp (p, "-Wno-protocol"))
+ flag_warn_protocol = 0;
+ else if (!strcmp (p, "-fgnu-runtime"))
+ flag_next_runtime = 0;
+ else if (!strcmp (p, "-fno-next-runtime"))
+ flag_next_runtime = 0;
+ else if (!strcmp (p, "-fno-gnu-runtime"))
+ flag_next_runtime = 1;
+ else if (!strcmp (p, "-fnext-runtime"))
+ flag_next_runtime = 1;
+ else
+ return c_decode_option (p);
+
+ return 1;
+}
+
+static tree
+define_decl (declarator, declspecs)
+ tree declarator;
+ tree declspecs;
+{
+ tree decl = start_decl (declarator, declspecs, 0);
+ finish_decl (decl, NULLT, NULLT);
+ return decl;
+}
+
+/* Return 1 if LHS and RHS are compatible types for assignment or
+ various other operations. Return 0 if they are incompatible, and
+ return -1 if we choose to not decide. When the operation is
+ REFLEXIVE, check for compatibility in either direction.
+
+ For statically typed objects, an assignment of the form `a' = `b'
+ is permitted if:
+
+ `a' is of type "id",
+ `a' and `b' are the same class type, or
+ `a' and `b' are of class types A and B such that B is a descendant of A. */
+
+int
+maybe_objc_comptypes (lhs, rhs, reflexive)
+ tree lhs, rhs;
+ int reflexive;
+{
+ if (doing_objc_thang)
+ return objc_comptypes (lhs, rhs, reflexive);
+ return -1;
+}
+
+static tree
+lookup_method_in_protocol_list (rproto_list, sel_name, class_meth)
+ tree rproto_list;
+ tree sel_name;
+ int class_meth;
+{
+ tree rproto, p;
+ tree fnd = 0;
+
+ for (rproto = rproto_list; rproto; rproto = TREE_CHAIN (rproto))
+ {
+ p = TREE_VALUE (rproto);
+
+ if (TREE_CODE (p) == PROTOCOL_INTERFACE_TYPE)
+ {
+ if ((fnd = lookup_method (class_meth
+ ? PROTOCOL_CLS_METHODS (p)
+ : PROTOCOL_NST_METHODS (p), sel_name)))
+ ;
+ else if (PROTOCOL_LIST (p))
+ fnd = lookup_method_in_protocol_list (PROTOCOL_LIST (p), sel_name, class_meth);
+ }
+ else
+ ; /* an identifier...if we could not find a protocol. */
+
+ if (fnd)
+ return fnd;
+ }
+ return 0;
+}
+
+static tree
+lookup_protocol_in_reflist (rproto_list, lproto)
+ tree rproto_list;
+ tree lproto;
+{
+ tree rproto, p;
+
+ /* make sure the protocol is support by the object on the rhs */
+ if (TREE_CODE (lproto) == PROTOCOL_INTERFACE_TYPE)
+ {
+ tree fnd = 0;
+ for (rproto = rproto_list; rproto; rproto = TREE_CHAIN (rproto))
+ {
+ p = TREE_VALUE (rproto);
+
+ if (TREE_CODE (p) == PROTOCOL_INTERFACE_TYPE)
+ {
+ if (lproto == p)
+ fnd = lproto;
+
+ else if (PROTOCOL_LIST (p))
+ fnd = lookup_protocol_in_reflist (PROTOCOL_LIST (p), lproto);
+ }
+
+ if (fnd)
+ return fnd;
+ }
+ }
+ else
+ ; /* an identifier...if we could not find a protocol. */
+
+ return 0;
+}
+
+/* Return 1 if LHS and RHS are compatible types for assignment
+ or various other operations. Return 0 if they are incompatible,
+ and return -1 if we choose to not decide. When the operation
+ is REFLEXIVE, check for compatibility in either direction. */
+
+int
+objc_comptypes (lhs, rhs, reflexive)
+ tree lhs;
+ tree rhs;
+ int reflexive;
+{
+ /* new clause for protocols */
+
+ if (TREE_CODE (lhs) == POINTER_TYPE
+ && TREE_CODE (TREE_TYPE (lhs)) == RECORD_TYPE
+ && TREE_CODE (rhs) == POINTER_TYPE
+ && TREE_CODE (TREE_TYPE (rhs)) == RECORD_TYPE)
+ {
+ int lhs_is_proto = IS_PROTOCOL_QUALIFIED_ID (lhs);
+ int rhs_is_proto = IS_PROTOCOL_QUALIFIED_ID (rhs);
+
+ if (lhs_is_proto)
+ {
+ tree lproto, lproto_list = TYPE_PROTOCOL_LIST (lhs);
+ tree rproto, rproto_list;
+ tree p;
+
+ if (rhs_is_proto)
+ {
+ rproto_list = TYPE_PROTOCOL_LIST (rhs);
+
+ /* Make sure the protocol is supported by the object
+ on the rhs. */
+ for (lproto = lproto_list; lproto; lproto = TREE_CHAIN (lproto))
+ {
+ p = TREE_VALUE (lproto);
+ rproto = lookup_protocol_in_reflist (rproto_list, p);
+
+ if (!rproto)
+ warning ("object does not conform to the `%s' protocol",
+ IDENTIFIER_POINTER (PROTOCOL_NAME (p)));
+ }
+ }
+ else if (TYPED_OBJECT (TREE_TYPE (rhs)))
+ {
+ tree rname = TYPE_NAME (TREE_TYPE (rhs));
+ tree rinter;
+
+ /* Make sure the protocol is supported by the object
+ on the rhs. */
+ for (lproto = lproto_list; lproto; lproto = TREE_CHAIN (lproto))
+ {
+ p = TREE_VALUE (lproto);
+ rproto = 0;
+ rinter = lookup_interface (rname);
+
+ while (rinter && !rproto)
+ {
+ tree cat;
+
+ rproto_list = CLASS_PROTOCOL_LIST (rinter);
+ rproto = lookup_protocol_in_reflist (rproto_list, p);
+
+ /* NEW!!! */
+ /* Check for protocols adopted by categories. */
+ cat = CLASS_CATEGORY_LIST (rinter);
+ while (cat && !rproto)
+ {
+ rproto_list = CLASS_PROTOCOL_LIST (cat);
+ rproto = lookup_protocol_in_reflist (rproto_list, p);
+
+ cat = CLASS_CATEGORY_LIST (cat);
+ }
+
+ rinter = lookup_interface (CLASS_SUPER_NAME (rinter));
+ }
+ if (!rproto)
+ warning ("class `%s' does not implement the `%s' protocol",
+ IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (rhs))),
+ IDENTIFIER_POINTER (PROTOCOL_NAME (p)));
+ }
+ }
+
+ return 1; /* may change...based on whether there was any mismatch */
+ }
+ else if (rhs_is_proto)
+ {
+ /* lhs is not a protocol...warn if it is statically typed */
+
+ if (TYPED_OBJECT (TREE_TYPE (lhs)))
+ return 0;
+ else
+ return 1; /* one of the types is a protocol */
+ }
+ else
+ return -1; /* defer to comptypes */
+ }
+ else if (TREE_CODE (lhs) == RECORD_TYPE && TREE_CODE (rhs) == RECORD_TYPE)
+ ; /* fall thru...this is the case we have been handling all along */
+ else
+ return -1; /* defer to comptypes */
+
+ /* End of new protocol support. */
+
+ /* `id' = `<class> *', `<class> *' = `id' */
+
+ if ((TYPE_NAME (lhs) == objc_object_id && TYPED_OBJECT (rhs))
+ || (TYPE_NAME (rhs) == objc_object_id && TYPED_OBJECT (lhs)))
+ return 1;
+
+ /* `id' = `Class', `Class' = `id' */
+
+ else if ((TYPE_NAME (lhs) == objc_object_id
+ && TYPE_NAME (rhs) == objc_class_id)
+ || (TYPE_NAME (lhs) == objc_class_id
+ && TYPE_NAME (rhs) == objc_object_id))
+ return 1;
+
+ /* `<class> *' = `<class> *' */
+
+ else if (TYPED_OBJECT (lhs) && TYPED_OBJECT (rhs))
+ {
+ tree lname = TYPE_NAME (lhs);
+ tree rname = TYPE_NAME (rhs);
+ tree inter;
+
+ if (lname == rname)
+ return 1;
+
+ /* If the left hand side is a super class of the right hand side,
+ allow it. */
+ for (inter = lookup_interface (rname); inter;
+ inter = lookup_interface (CLASS_SUPER_NAME (inter)))
+ if (lname == CLASS_SUPER_NAME (inter))
+ return 1;
+
+ /* Allow the reverse when reflexive. */
+ if (reflexive)
+ for (inter = lookup_interface (lname); inter;
+ inter = lookup_interface (CLASS_SUPER_NAME (inter)))
+ if (rname == CLASS_SUPER_NAME (inter))
+ return 1;
+
+ return 0;
+ }
+ else
+ return -1; /* defer to comptypes */
+}
+
+/* Called from c-decl.c before all calls to rest_of_decl_compilation. */
+
+void
+objc_check_decl (decl)
+ tree decl;
+{
+ tree type = TREE_TYPE (decl);
+
+ if (TREE_CODE (type) == RECORD_TYPE
+ && TREE_STATIC_TEMPLATE (type)
+ && type != constant_string_type)
+ {
+ error_with_decl (decl, "`%s' cannot be statically allocated");
+ fatal ("statically allocated objects not supported");
+ }
+}
+
+void
+maybe_objc_check_decl (decl)
+ tree decl;
+{
+ if (doing_objc_thang)
+ objc_check_decl (decl);
+}
+
+/* Implement static typing. At this point, we know we have an interface. */
+
+tree
+get_static_reference (interface, protocols)
+ tree interface;
+ tree protocols;
+{
+ tree type = xref_tag (RECORD_TYPE, interface);
+
+ if (protocols)
+ {
+ tree t, m = TYPE_MAIN_VARIANT (type);
+ struct obstack *ambient_obstack = current_obstack;
+
+ current_obstack = &permanent_obstack;
+ t = copy_node (type);
+ TYPE_BINFO (t) = make_tree_vec (2);
+
+ /* Add this type to the chain of variants of TYPE. */
+ TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m);
+ TYPE_NEXT_VARIANT (m) = t;
+
+ current_obstack = ambient_obstack;
+
+ /* Look up protocols and install in lang specific list. */
+ TYPE_PROTOCOL_LIST (t) = lookup_and_install_protocols (protocols);
+
+ /* This forces a new pointer type to be created later
+ (in build_pointer_type)...so that the new template
+ we just created will actually be used...what a hack! */
+ if (TYPE_POINTER_TO (t))
+ TYPE_POINTER_TO (t) = NULL;
+
+ type = t;
+ }
+
+ return type;
+}
+
+tree
+get_object_reference (protocols)
+ tree protocols;
+{
+ tree type_decl = lookup_name (objc_id_id);
+ tree type;
+
+ if (type_decl && TREE_CODE (type_decl) == TYPE_DECL)
+ {
+ type = TREE_TYPE (type_decl);
+ if (TYPE_MAIN_VARIANT (type) != id_type)
+ warning ("Unexpected type for `id' (%s)",
+ gen_declaration (type, errbuf));
+ }
+ else
+ {
+ fatal ("Undefined type `id', please import <objc/objc.h>");
+ }
+
+ /* This clause creates a new pointer type that is qualified with
+ the protocol specification...this info is used later to do more
+ elaborate type checking. */
+ if (protocols)
+ {
+ tree t, m = TYPE_MAIN_VARIANT (type);
+ struct obstack *ambient_obstack = current_obstack;
+
+ current_obstack = &permanent_obstack;
+ t = copy_node (type);
+ TYPE_BINFO (t) = make_tree_vec (2);
+
+ /* Add this type to the chain of variants of TYPE. */
+ TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m);
+ TYPE_NEXT_VARIANT (m) = t;
+
+ current_obstack = ambient_obstack;
+
+ /* look up protocols...and install in lang specific list */
+ TYPE_PROTOCOL_LIST (t) = lookup_and_install_protocols (protocols);
+
+ /* This forces a new pointer type to be created later
+ (in build_pointer_type)...so that the new template
+ we just created will actually be used...what a hack! */
+ if (TYPE_POINTER_TO (t))
+ TYPE_POINTER_TO (t) = NULL;
+
+ type = t;
+ }
+ return type;
+}
+
+static tree
+lookup_and_install_protocols (protocols)
+ tree protocols;
+{
+ tree proto;
+ tree prev = NULL;
+ tree return_value = protocols;
+
+ for (proto = protocols; proto; proto = TREE_CHAIN (proto))
+ {
+ tree ident = TREE_VALUE (proto);
+ tree p = lookup_protocol (ident);
+
+ if (!p)
+ {
+ error ("Cannot find protocol declaration for `%s'",
+ IDENTIFIER_POINTER (ident));
+ if (prev)
+ TREE_CHAIN (prev) = TREE_CHAIN (proto);
+ else
+ return_value = TREE_CHAIN (proto);
+ }
+ else
+ {
+ /* replace identifier with actual protocol node */
+ TREE_VALUE (proto) = p;
+ prev = proto;
+ }
+ }
+ return return_value;
+}
+
+/* Create and push a decl for a built-in external variable or field NAME.
+ CODE says which.
+ TYPE is its data type. */
+
+static tree
+create_builtin_decl (code, type, name)
+ enum tree_code code;
+ tree type;
+ char *name;
+{
+ tree decl = build_decl (code, get_identifier (name), type);
+ if (code == VAR_DECL)
+ {
+ TREE_STATIC (decl) = 1;
+ make_decl_rtl (decl, 0, 1);
+ pushdecl (decl);
+ }
+ return decl;
+}
+
+/* purpose: "play" parser, creating/installing representations
+ of the declarations that are required by Objective-C.
+
+ model:
+
+ type_spec--------->sc_spec
+ (tree_list) (tree_list)
+ | |
+ | |
+ identifier_node identifier_node */
+
+static void
+synth_module_prologue ()
+{
+ tree temp_type;
+ tree super_p;
+
+ /* defined in `objc.h' */
+ objc_object_id = get_identifier (TAG_OBJECT);
+
+ objc_object_reference = xref_tag (RECORD_TYPE, objc_object_id);
+
+ id_type = build_pointer_type (objc_object_reference);
+
+ objc_id_id = get_identifier (TYPE_ID);
+ objc_class_id = get_identifier (TAG_CLASS);
+
+ objc_class_type = build_pointer_type (xref_tag (RECORD_TYPE, objc_class_id));
+ protocol_type = build_pointer_type (xref_tag (RECORD_TYPE,
+ get_identifier (PROTOCOL_OBJECT_CLASS_NAME)));
+
+ /* Declare type of selector-objects that represent an operation name. */
+
+#ifdef OBJC_INT_SELECTORS
+ /* `unsigned int' */
+ selector_type = unsigned_type_node;
+#else
+ /* `struct objc_selector *' */
+ selector_type
+ = build_pointer_type (xref_tag (RECORD_TYPE,
+ get_identifier (TAG_SELECTOR)));
+#endif /* not OBJC_INT_SELECTORS */
+
+ /* Forward declare type, or else the prototype for msgSendSuper will
+ complain. */
+
+ super_p = build_pointer_type (xref_tag (RECORD_TYPE,
+ get_identifier (TAG_SUPER)));
+
+
+ /* id objc_msgSend (id, SEL, ...); */
+
+ temp_type
+ = build_function_type (id_type,
+ tree_cons (NULL_TREE, id_type,
+ tree_cons (NULLT, selector_type, NULLT)));
+
+ if (! flag_next_runtime)
+ {
+ umsg_decl = build_decl (FUNCTION_DECL,
+ get_identifier (TAG_MSGSEND), temp_type);
+ DECL_EXTERNAL (umsg_decl) = 1;
+ TREE_PUBLIC (umsg_decl) = 1;
+ DECL_INLINE (umsg_decl) = 1;
+
+ if (flag_traditional && TAG_MSGSEND[0] != '_')
+ DECL_BUILT_IN_NONANSI (umsg_decl) = 1;
+
+ make_decl_rtl (umsg_decl, NULL_PTR, 1);
+ pushdecl (umsg_decl);
+ }
+ else
+ umsg_decl = builtin_function (TAG_MSGSEND, temp_type, NOT_BUILT_IN, 0);
+
+ /* id objc_msgSendSuper (struct objc_super *, SEL, ...); */
+
+ temp_type
+ = build_function_type (id_type,
+ tree_cons (NULL_TREE, super_p,
+ tree_cons (NULLT, selector_type, NULLT)));
+
+ umsg_super_decl = builtin_function (TAG_MSGSENDSUPER,
+ temp_type, NOT_BUILT_IN, 0);
+
+ /* id objc_getClass (const char *); */
+
+ temp_type = build_function_type (id_type,
+ tree_cons (NULLT,
+ const_string_type_node,
+ tree_cons (NULLT, void_type_node, NULLT)));
+
+ objc_get_class_decl
+ = builtin_function (TAG_GETCLASS, temp_type, NOT_BUILT_IN, 0);
+
+ /* id objc_getMetaClass (const char *); */
+
+ objc_get_meta_class_decl
+ = builtin_function (TAG_GETMETACLASS, temp_type, NOT_BUILT_IN, 0);
+
+ /* static SEL _OBJC_SELECTOR_TABLE[]; */
+
+ if (! flag_next_runtime)
+ UOBJC_SELECTOR_TABLE_decl
+ = create_builtin_decl (VAR_DECL, build_array_type (selector_type, NULLT),
+ "_OBJC_SELECTOR_TABLE");
+
+ generate_forward_declaration_to_string_table ();
+
+ /* Forward declare constant_string_id and constant_string_type. */
+ constant_string_id = get_identifier (STRING_OBJECT_CLASS_NAME);
+ constant_string_type = xref_tag (RECORD_TYPE, constant_string_id);
+}
+
+/* Custom build_string which sets TREE_TYPE! */
+
+static tree
+my_build_string (len, str)
+ int len;
+ char *str;
+{
+ int wide_flag = 0;
+ tree a_string = build_string (len, str);
+ /* Some code from combine_strings, which is local to c-parse.y. */
+ if (TREE_TYPE (a_string) == int_array_type_node)
+ wide_flag = 1;
+
+ TREE_TYPE (a_string) =
+ build_array_type (wide_flag ? integer_type_node : char_type_node,
+ build_index_type (build_int_2 (len - 1, 0)));
+
+ TREE_CONSTANT (a_string) = 1; /* puts string in the ".text" segment */
+ TREE_STATIC (a_string) = 1;
+
+ return a_string;
+}
+
+/* Return a newly constructed OBJC_STRING_CST node whose value is
+ the LEN characters at STR.
+ The TREE_TYPE is not initialized. */
+
+tree
+build_objc_string (len, str)
+ int len;
+ char *str;
+{
+ tree s = build_string (len, str);
+
+ TREE_SET_CODE (s, OBJC_STRING_CST);
+ return s;
+}
+
+/* Given a chain of OBJC_STRING_CST's, build a static instance of
+ NXConstantString which points at the concatenation of those strings.
+ We place the string object in the __string_objects section of the
+ __OBJC segment. The Objective-C runtime will initialize the isa
+ pointers of the string objects to point at the NXConstantString
+ class object. */
+
+tree
+build_objc_string_object (strings)
+ tree strings;
+{
+ tree string, initlist, constructor;
+ int length;
+
+ if (!doing_objc_thang)
+ objc_fatal ();
+
+ if (lookup_interface (constant_string_id) == NULLT)
+ {
+ error ("Cannot find interface declaration for `%s'",
+ IDENTIFIER_POINTER (constant_string_id));
+ return error_mark_node;
+ }
+
+ add_class_reference (constant_string_id);
+
+ /* combine_strings will work for OBJC_STRING_CST's too. */
+ string = combine_strings (strings);
+ TREE_SET_CODE (string, STRING_CST);
+ length = TREE_STRING_LENGTH (string) - 1;
+
+ /* & ((NXConstantString) {0, string, length}) */
+
+ initlist = build_tree_list (NULLT, build_int_2 (0, 0));
+ initlist = tree_cons (NULLT, build_unary_op (ADDR_EXPR, string, 1),
+ initlist);
+ initlist = tree_cons (NULLT, build_int_2 (length, 0), initlist);
+ constructor = build (CONSTRUCTOR, constant_string_type, NULLT,
+ nreverse (initlist));
+ TREE_CONSTANT (constructor) = 1;
+ TREE_STATIC (constructor) = 1;
+ TREE_READONLY (constructor) = 1;
+
+ return build_unary_op (ADDR_EXPR, constructor, 1);
+}
+
+/* Take care of defining and initializing _OBJC_SYMBOLS. */
+
+/* Predefine the following data type:
+
+ struct _objc_symtab
+ {
+ long sel_ref_cnt;
+ SEL *refs;
+ short cls_def_cnt;
+ short cat_def_cnt;
+ void *defs[cls_def_cnt + cat_def_cnt];
+ }; */
+
+static void
+build_objc_symtab_template ()
+{
+ tree field_decl, field_decl_chain, index;
+
+ objc_symtab_template = start_struct (RECORD_TYPE, get_identifier (UTAG_SYMTAB));
+
+ /* long sel_ref_cnt; */
+
+ field_decl = create_builtin_decl (FIELD_DECL,
+ long_integer_type_node,
+ "sel_ref_cnt");
+ field_decl_chain = field_decl;
+
+ /* SEL *refs; */
+
+ field_decl = create_builtin_decl (FIELD_DECL,
+ build_pointer_type (selector_type),
+ "refs");
+ chainon (field_decl_chain, field_decl);
+
+ /* short cls_def_cnt; */
+
+ field_decl = create_builtin_decl (FIELD_DECL,
+ short_integer_type_node,
+ "cls_def_cnt");
+ chainon (field_decl_chain, field_decl);
+
+ /* short cat_def_cnt; */
+
+ field_decl = create_builtin_decl (FIELD_DECL,
+ short_integer_type_node,
+ "cat_def_cnt");
+ chainon (field_decl_chain, field_decl);
+
+ /* void *defs[cls_def_cnt + cat_def_cnt]; */
+
+ index = build_index_type (build_int_2 (imp_count + cat_count - 1,
+ imp_count == 0 && cat_count == 0
+ ? -1 : 0));
+ field_decl = create_builtin_decl (FIELD_DECL,
+ build_array_type (ptr_type_node, index),
+ "defs");
+ chainon (field_decl_chain, field_decl);
+
+ finish_struct (objc_symtab_template, field_decl_chain);
+}
+
+/* Create the initial value for the `defs' field of _objc_symtab.
+ This is a CONSTRUCTOR. */
+
+static tree
+init_def_list ()
+{
+ tree expr, initlist = NULLT;
+ struct imp_entry *impent;
+
+ if (imp_count)
+ for (impent = imp_list; impent; impent = impent->next)
+ {
+ if (TREE_CODE (impent->imp_context) == CLASS_IMPLEMENTATION_TYPE)
+ {
+ expr = build_unary_op (ADDR_EXPR, impent->class_decl, 0);
+ initlist = tree_cons (NULLT, expr, initlist);
+ }
+ }
+
+ if (cat_count)
+ for (impent = imp_list; impent; impent = impent->next)
+ {
+ if (TREE_CODE (impent->imp_context) == CATEGORY_IMPLEMENTATION_TYPE)
+ {
+ expr = build_unary_op (ADDR_EXPR, impent->class_decl, 0);
+ initlist = tree_cons (NULLT, expr, initlist);
+ }
+ }
+ return build_nt (CONSTRUCTOR, NULLT, nreverse (initlist));
+}
+
+/* Construct the initial value for all of _objc_symtab. */
+
+static tree
+init_objc_symtab ()
+{
+ tree initlist;
+
+ /* sel_ref_cnt = { ..., 5, ... } */
+
+ initlist = build_tree_list (NULLT, build_int_2 (0, 0));
+
+ /* refs = { ..., _OBJC_SELECTOR_TABLE, ... } */
+
+ if (flag_next_runtime || ! sel_ref_chain)
+ initlist = tree_cons (NULLT, build_int_2 (0, 0), initlist);
+ else
+ initlist = tree_cons (NULLT, UOBJC_SELECTOR_TABLE_decl, initlist);
+
+ /* cls_def_cnt = { ..., 5, ... } */
+
+ initlist = tree_cons (NULLT, build_int_2 (imp_count, 0), initlist);
+
+ /* cat_def_cnt = { ..., 5, ... } */
+
+ initlist = tree_cons (NULLT, build_int_2 (cat_count, 0), initlist);
+
+ /* cls_def = { ..., { &Foo, &Bar, ...}, ... } */
+
+ if (imp_count || cat_count)
+ initlist = tree_cons (NULLT, init_def_list (), initlist);
+
+ return build_nt (CONSTRUCTOR, NULLT, nreverse (initlist));
+}
+
+/* Push forward-declarations of all the categories
+ so that init_def_list can use them in a CONSTRUCTOR. */
+
+static void
+forward_declare_categories ()
+{
+ struct imp_entry *impent;
+ tree sav = implementation_context;
+ for (impent = imp_list; impent; impent = impent->next)
+ {
+ if (TREE_CODE (impent->imp_context) == CATEGORY_IMPLEMENTATION_TYPE)
+ {
+ /* Set an invisible arg to synth_id_with_class_suffix. */
+ implementation_context = impent->imp_context;
+ impent->class_decl
+ = create_builtin_decl (VAR_DECL, objc_category_template,
+ IDENTIFIER_POINTER (synth_id_with_class_suffix ("_OBJC_CATEGORY", implementation_context)));
+ }
+ }
+ implementation_context = sav;
+}
+
+/* Create the declaration of _OBJC_SYMBOLS, with type `strict _objc_symtab'
+ and initialized appropriately. */
+
+static void
+generate_objc_symtab_decl ()
+{
+ tree sc_spec;
+
+ if (!objc_category_template)
+ build_category_template ();
+
+ /* forward declare categories */
+ if (cat_count)
+ forward_declare_categories ();
+
+ if (!objc_symtab_template)
+ build_objc_symtab_template ();
+
+ sc_spec = build_tree_list (NULLT, ridpointers[(int) RID_STATIC]);
+
+ UOBJC_SYMBOLS_decl = start_decl (get_identifier ("_OBJC_SYMBOLS"),
+ tree_cons (NULLT, objc_symtab_template, sc_spec), 1);
+
+ end_temporary_allocation (); /* start_decl trying to be smart about inits */
+ TREE_USED (UOBJC_SYMBOLS_decl) = 1;
+ DECL_IGNORED_P (UOBJC_SYMBOLS_decl) = 1;
+ finish_decl (UOBJC_SYMBOLS_decl, init_objc_symtab (), NULLT);
+}
+
+static tree
+init_module_descriptor ()
+{
+ tree initlist, expr;
+
+ /* version = { 1, ... } */
+
+ expr = build_int_2 (OBJC_VERSION, 0);
+ initlist = build_tree_list (NULLT, expr);
+
+ /* size = { ..., sizeof (struct objc_module), ... } */
+
+ expr = size_in_bytes (objc_module_template);
+ initlist = tree_cons (NULLT, expr, initlist);
+
+ /* name = { ..., "foo.m", ... } */
+
+ expr = add_objc_string (get_identifier (input_filename), class_names);
+ initlist = tree_cons (NULLT, expr, initlist);
+
+ /* symtab = { ..., _OBJC_SYMBOLS, ... } */
+
+ if (UOBJC_SYMBOLS_decl)
+ expr = build_unary_op (ADDR_EXPR, UOBJC_SYMBOLS_decl, 0);
+ else
+ expr = build_int_2 (0, 0);
+ initlist = tree_cons (NULLT, expr, initlist);
+
+ return build_nt (CONSTRUCTOR, NULLT, nreverse (initlist));
+}
+
+/* Write out the data structures to describe Objective C classes defined.
+ If appropriate, compile and output a setup function to initialize them.
+ Return a string which is the name of a function to call to initialize
+ the Objective C data structures for this file (and perhaps for other files
+ also).
+
+ struct objc_module { ... } _OBJC_MODULE = { ... };
+
+*/
+
+static char *
+build_module_descriptor ()
+{
+ tree decl_specs, field_decl, field_decl_chain;
+
+ objc_module_template = start_struct (RECORD_TYPE, get_identifier (UTAG_MODULE));
+
+ /* long version; */
+
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_LONG]);
+ field_decl = get_identifier ("version");
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ field_decl_chain = field_decl;
+
+ /* long size; */
+
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_LONG]);
+ field_decl = get_identifier ("size");
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* char *name; */
+
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_CHAR]);
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("name"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* struct objc_symtab *symtab; */
+
+ decl_specs = get_identifier (UTAG_SYMTAB);
+ decl_specs = build_tree_list (NULLT, xref_tag (RECORD_TYPE, decl_specs));
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("symtab"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ finish_struct (objc_module_template, field_decl_chain);
+
+ /* create an instance of "objc_module" */
+
+ decl_specs = tree_cons (NULLT, objc_module_template,
+ build_tree_list (NULLT, ridpointers[(int) RID_STATIC]));
+
+ UOBJC_MODULES_decl = start_decl (get_identifier ("_OBJC_MODULES"),
+ decl_specs, 1);
+
+ end_temporary_allocation (); /* start_decl trying to be smart about inits */
+ DECL_IGNORED_P (UOBJC_MODULES_decl) = 1;
+ finish_decl (UOBJC_MODULES_decl, init_module_descriptor (), NULLT);
+
+ /* Mark the decl to avoid "defined but not used" warning. */
+ DECL_IN_SYSTEM_HEADER (UOBJC_MODULES_decl) = 1;
+
+ /* Generate a constructor call for the module descriptor.
+ This code was generated by reading the grammar rules
+ of c-parse.y; Therefore, it may not be the most efficient
+ way of generating the requisite code. */
+
+ if (flag_next_runtime)
+ return 0;
+
+ {
+ tree parms, function_decl, decelerator, void_list_node;
+ tree function_type;
+ char *buf;
+ char *global_object_name = 0;
+ tree t;
+
+ /* Use a global object (which is already required to be unique over
+ the program) rather than the file name (which imposes extra
+ constraints). -- Raeburn@MIT.EDU, 10 Jan 1990. */
+
+ /* Find the name of some global object defined in this file. */
+ for (t = getdecls (); t; t = TREE_CHAIN (t))
+ if (TREE_PUBLIC (t) && !DECL_EXTERNAL (t) && DECL_INITIAL (t) != 0)
+ {
+ global_object_name = IDENTIFIER_POINTER (DECL_NAME (t));
+ break;
+ }
+
+ /* If none, use the name of the file. */
+ if (!global_object_name)
+ {
+ char *p, *q;
+ global_object_name
+ = (char *) alloca (strlen (main_input_filename) + 1);
+
+ p = main_input_filename;
+ q = global_object_name;
+
+ /* Replace any weird characters in the file name. */
+ for (; *p; p++)
+ if (! ((*p >= '0' && *p <= '9')
+ || (*p >= 'A' && *p <= 'Z')
+ || (*p >= 'a' && *p <= 'z')))
+ *q++ = '_';
+ else
+ *q++ = *p;
+ *q = 0;
+ }
+
+ /* Make the constructor name from the name we have found. */
+ buf = (char *) xmalloc (sizeof (CONSTRUCTOR_NAME_FORMAT)
+ + strlen (global_object_name));
+ sprintf (buf, CONSTRUCTOR_NAME_FORMAT, global_object_name);
+
+ /* Declare void __objc_execClass (void*); */
+
+ void_list_node = build_tree_list (NULL_TREE, void_type_node);
+ function_type
+ = build_function_type (void_type_node,
+ tree_cons (NULL_TREE, ptr_type_node,
+ void_list_node));
+ function_decl = build_decl (FUNCTION_DECL,
+ get_identifier (TAG_EXECCLASS),
+ function_type);
+ DECL_EXTERNAL (function_decl) = 1;
+ TREE_PUBLIC (function_decl) = 1;
+ pushdecl (function_decl);
+ rest_of_decl_compilation (function_decl, 0, 0, 0);
+
+ parms
+ = build_tree_list (NULLT,
+ build_unary_op (ADDR_EXPR, UOBJC_MODULES_decl, 0));
+ decelerator = build_function_call (function_decl, parms);
+
+ /* void _GLOBAL_$I$<gnyf> () {objc_execClass (&L_OBJC_MODULES);} */
+
+ start_function (void_list_node,
+ build_parse_node (CALL_EXPR, get_identifier (buf),
+ /* This has the format of the output
+ of get_parm_info. */
+ tree_cons (NULL_TREE, NULL_TREE,
+ void_list_node),
+ NULL_TREE),
+ 0);
+#if 0 /* This should be turned back on later
+ for the systems where collect is not needed. */
+ /* Make these functions nonglobal
+ so each file can use the same name. */
+ TREE_PUBLIC (current_function_decl) = 0;
+#endif
+ TREE_USED (current_function_decl) = 1;
+ store_parm_decls ();
+
+ assemble_external (function_decl);
+ c_expand_expr_stmt (decelerator);
+
+ finish_function (0);
+
+ /* Return the name of the constructor function. */
+ return buf;
+ }
+}
+
+/* extern const char _OBJC_STRINGS[]; */
+
+static void
+generate_forward_declaration_to_string_table ()
+{
+ tree sc_spec, decl_specs, expr_decl;
+
+ sc_spec = tree_cons (NULLT, ridpointers[(int) RID_EXTERN], NULLT);
+ decl_specs = tree_cons (NULLT, ridpointers[(int) RID_CHAR], sc_spec);
+
+ expr_decl = build_nt (ARRAY_REF, get_identifier ("_OBJC_STRINGS"), NULLT);
+
+ UOBJC_STRINGS_decl = define_decl (expr_decl, decl_specs);
+}
+
+/* Output all strings. */
+
+static void
+generate_strings ()
+{
+ tree sc_spec, decl_specs, expr_decl;
+ tree chain, string_expr;
+ tree string, decl;
+
+ for (chain = class_names_chain; chain; chain = TREE_CHAIN (chain))
+ {
+ string = TREE_VALUE (chain);
+ decl = TREE_PURPOSE (chain);
+ sc_spec = tree_cons (NULLT, ridpointers[(int) RID_STATIC], NULLT);
+ decl_specs = tree_cons (NULLT, ridpointers[(int) RID_CHAR], sc_spec);
+ expr_decl = build_nt (ARRAY_REF, DECL_NAME (decl), NULLT);
+ decl = start_decl (expr_decl, decl_specs, 1);
+ end_temporary_allocation ();
+ string_expr = my_build_string (IDENTIFIER_LENGTH (string) + 1,
+ IDENTIFIER_POINTER (string));
+ finish_decl (decl, string_expr, NULLT);
+ }
+
+ for (chain = meth_var_names_chain; chain; chain = TREE_CHAIN (chain))
+ {
+ string = TREE_VALUE (chain);
+ decl = TREE_PURPOSE (chain);
+ sc_spec = tree_cons (NULLT, ridpointers[(int) RID_STATIC], NULLT);
+ decl_specs = tree_cons (NULLT, ridpointers[(int) RID_CHAR], sc_spec);
+ expr_decl = build_nt (ARRAY_REF, DECL_NAME (decl), NULLT);
+ decl = start_decl (expr_decl, decl_specs, 1);
+ end_temporary_allocation ();
+ string_expr = my_build_string (IDENTIFIER_LENGTH (string) + 1,
+ IDENTIFIER_POINTER (string));
+ finish_decl (decl, string_expr, NULLT);
+ }
+
+ for (chain = meth_var_types_chain; chain; chain = TREE_CHAIN (chain))
+ {
+ string = TREE_VALUE (chain);
+ decl = TREE_PURPOSE (chain);
+ sc_spec = tree_cons (NULLT, ridpointers[(int) RID_STATIC], NULLT);
+ decl_specs = tree_cons (NULLT, ridpointers[(int) RID_CHAR], sc_spec);
+ expr_decl = build_nt (ARRAY_REF, DECL_NAME (decl), NULLT);
+ decl = start_decl (expr_decl, decl_specs, 1);
+ end_temporary_allocation ();
+ string_expr = my_build_string (IDENTIFIER_LENGTH (string) + 1,
+ IDENTIFIER_POINTER (string));
+ finish_decl (decl, string_expr, NULLT);
+ }
+}
+
+static tree
+build_selector_reference_decl (name)
+ tree name;
+{
+ tree decl, ident;
+ char buf[256];
+ struct obstack *save_current_obstack = current_obstack;
+ struct obstack *save_rtl_obstack = rtl_obstack;
+ static int idx = 0;
+
+ sprintf (buf, "_OBJC_SELECTOR_REFERENCES_%d", idx++);
+
+ /* new stuff */
+ rtl_obstack = current_obstack = &permanent_obstack;
+ ident = get_identifier (buf);
+
+ decl = build_decl (VAR_DECL, ident, selector_type);
+ DECL_EXTERNAL (decl) = 1;
+ TREE_PUBLIC (decl) = 1;
+ TREE_USED (decl) = 1;
+ TREE_READONLY (decl) = 1;
+
+ make_decl_rtl (decl, 0, 1); /* usually called from `rest_of_decl_compilation' */
+ pushdecl_top_level (decl); /* our `extended/custom' pushdecl in c-decl.c */
+
+ current_obstack = save_current_obstack;
+ rtl_obstack = save_rtl_obstack;
+
+ return decl;
+}
+
+/* Just a handy wrapper for add_objc_string. */
+
+static tree
+build_selector (ident)
+ tree ident;
+{
+ tree expr = add_objc_string (ident, meth_var_names);
+
+ return build_c_cast (selector_type, expr); /* cast! */
+}
+
+/* Synthesize the following expr: (char *)&_OBJC_STRINGS[<offset>]
+ The cast stops the compiler from issuing the following message:
+ grok.m: warning: initialization of non-const * pointer from const *
+ grok.m: warning: initialization between incompatible pointer types. */
+
+static tree
+build_msg_pool_reference (offset)
+ int offset;
+{
+ tree expr = build_int_2 (offset, 0);
+ tree cast;
+
+ expr = build_array_ref (UOBJC_STRINGS_decl, expr);
+ expr = build_unary_op (ADDR_EXPR, expr, 0);
+
+ cast = build_tree_list (build_tree_list (NULLT, ridpointers[(int) RID_CHAR]),
+ build1 (INDIRECT_REF, NULLT, NULLT));
+ TREE_TYPE (expr) = groktypename (cast);
+ return expr;
+}
+
+static tree
+init_selector (offset)
+ int offset;
+{
+ tree expr = build_msg_pool_reference (offset);
+ TREE_TYPE (expr) = selector_type; /* cast */
+ return expr;
+}
+
+static void
+build_selector_translation_table ()
+{
+ tree sc_spec, decl_specs;
+ tree chain, initlist = NULLT;
+ int offset = 0;
+ tree decl, var_decl, name;
+
+ /* The corresponding pop_obstacks is in finish_decl,
+ called at the end of this function. */
+ if (! flag_next_runtime)
+ push_obstacks_nochange ();
+
+ for (chain = sel_ref_chain; chain; chain = TREE_CHAIN (chain))
+ {
+ tree expr;
+
+ expr = build_selector (TREE_VALUE (chain));
+
+ if (flag_next_runtime)
+ {
+ name = DECL_NAME (TREE_PURPOSE (chain));
+
+ sc_spec = build_tree_list (NULLT, ridpointers[(int) RID_STATIC]);
+
+ /* static SEL _OBJC_SELECTOR_REFERENCES_n = ...; */
+ decl_specs = tree_cons (NULLT, selector_type, sc_spec);
+
+ var_decl = name;
+
+ /* the `decl' that is returned from start_decl is the one that we
+ forward declared in `build_selector_reference' */
+ decl = start_decl (var_decl, decl_specs, 1);
+ }
+
+ /* add one for the '\0' character */
+ offset += IDENTIFIER_LENGTH (TREE_VALUE (chain)) + 1;
+
+ if (flag_next_runtime)
+ {
+ end_temporary_allocation ();
+ finish_decl (decl, expr, NULLT);
+ }
+ else
+ initlist = tree_cons (NULLT, expr, initlist);
+ }
+
+ if (! flag_next_runtime)
+ {
+ /* Cause the variable and its initial value to be actually output. */
+ DECL_EXTERNAL (UOBJC_SELECTOR_TABLE_decl) = 0;
+ TREE_STATIC (UOBJC_SELECTOR_TABLE_decl) = 1;
+ /* NULL terminate the list and fix the decl for output. */
+ initlist = tree_cons (NULLT, build_int_2 (0, 0), initlist);
+ DECL_INITIAL (UOBJC_SELECTOR_TABLE_decl) = (tree) 1;
+ initlist = build_nt (CONSTRUCTOR, NULLT, nreverse (initlist));
+ finish_decl (UOBJC_SELECTOR_TABLE_decl, initlist, NULLT);
+ }
+}
+
+/* sel_ref_chain is a list whose "value" fields will be instances of
+ identifier_node that represent the selector. */
+
+static tree
+build_selector_reference (ident)
+ tree ident;
+{
+ tree *chain = &sel_ref_chain;
+ tree decl;
+ int index = 0;
+
+ while (*chain)
+ {
+ if (TREE_VALUE (*chain) == ident)
+ return (flag_next_runtime
+ ? TREE_PURPOSE (*chain)
+ : build_array_ref (UOBJC_SELECTOR_TABLE_decl,
+ build_int_2 (index, 0)));
+
+ index++;
+ chain = &TREE_CHAIN (*chain);
+ }
+
+ decl = build_selector_reference_decl (ident);
+
+ *chain = perm_tree_cons (decl, ident, NULLT);
+
+ return (flag_next_runtime
+ ? decl
+ : build_array_ref (UOBJC_SELECTOR_TABLE_decl,
+ build_int_2 (index, 0)));
+}
+
+static tree
+build_class_reference_decl (name)
+ tree name;
+{
+ tree decl, ident;
+ char buf[256];
+ struct obstack *save_current_obstack = current_obstack;
+ struct obstack *save_rtl_obstack = rtl_obstack;
+ static int idx = 0;
+
+ sprintf (buf, "_OBJC_CLASS_REFERENCES_%d", idx++);
+
+ /* new stuff */
+ rtl_obstack = current_obstack = &permanent_obstack;
+ ident = get_identifier (buf);
+
+ decl = build_decl (VAR_DECL, ident, objc_class_type);
+ DECL_EXTERNAL (decl) = 1;
+ TREE_PUBLIC (decl) = 1;
+ TREE_USED (decl) = 1;
+ TREE_READONLY (decl) = 1;
+
+ make_decl_rtl (decl, 0, 1); /* usually called from `rest_of_decl_compilation' */
+ pushdecl_top_level (decl); /* our `extended/custom' pushdecl in c-decl.c */
+
+ current_obstack = save_current_obstack;
+ rtl_obstack = save_rtl_obstack;
+
+ return decl;
+}
+
+/* Create a class reference, but don't create a variable to reference
+ it. */
+
+static void
+add_class_reference (ident)
+ tree ident;
+{
+ tree chain;
+
+ if ((chain = cls_ref_chain))
+ {
+ tree tail;
+ do
+ {
+ if (ident == TREE_VALUE (chain))
+ return;
+
+ tail = chain;
+ chain = TREE_CHAIN (chain);
+ }
+ while (chain);
+
+ /* append to the end of the list */
+ TREE_CHAIN (tail) = perm_tree_cons (NULLT, ident, NULLT);
+ }
+ else
+ cls_ref_chain = perm_tree_cons (NULLT, ident, NULLT);
+}
+
+/* Get a class reference, creating it if necessary. Also create the
+ reference variable. */
+
+tree
+get_class_reference (ident)
+ tree ident;
+{
+ if (flag_next_runtime)
+ {
+ tree *chain;
+ tree decl;
+
+ for (chain = &cls_ref_chain; *chain; chain = &TREE_CHAIN (*chain))
+ if (TREE_VALUE (*chain) == ident)
+ {
+ if (! TREE_PURPOSE (*chain))
+ TREE_PURPOSE (*chain) = build_class_reference_decl (ident);
+ return TREE_PURPOSE (*chain);
+ }
+
+ decl = build_class_reference_decl (ident);
+ *chain = perm_tree_cons (decl, ident, NULLT);
+ return decl;
+ }
+ else
+ {
+ tree params;
+
+ add_class_reference (ident);
+
+ params = build_tree_list (NULLT,
+ my_build_string (IDENTIFIER_LENGTH (ident) + 1,
+ IDENTIFIER_POINTER (ident)));
+
+ assemble_external (objc_get_class_decl);
+ return build_function_call (objc_get_class_decl, params);
+ }
+}
+
+/* sel_refdef_chain is a list whose "value" fields will be instances
+ of identifier_node that represent the selector. It returns the
+ offset of the selector from the beginning of the _OBJC_STRINGS
+ pool. This offset is typically used by init_selector during code
+ generation.
+
+ For each string section we have a chain which maps identifier nodes
+ to decls for the strings. */
+
+static tree
+add_objc_string (ident, section)
+ tree ident;
+ enum string_section section;
+{
+ tree *chain, decl;
+
+ if (section == class_names)
+ chain = &class_names_chain;
+ else if (section == meth_var_names)
+ chain = &meth_var_names_chain;
+ else if (section == meth_var_types)
+ chain = &meth_var_types_chain;
+
+ while (*chain)
+ {
+ if (TREE_VALUE (*chain) == ident)
+ return TREE_PURPOSE (*chain);
+
+ chain = &TREE_CHAIN (*chain);
+ }
+
+ decl = build_objc_string_decl (ident, section);
+
+ *chain = perm_tree_cons (decl, ident, NULLT);
+
+ return decl;
+}
+
+static tree
+build_objc_string_decl (name, section)
+ tree name;
+ enum string_section section;
+{
+ tree decl, ident;
+ char buf[256];
+ struct obstack *save_current_obstack = current_obstack;
+ struct obstack *save_rtl_obstack = rtl_obstack;
+ static int class_names_idx = 0;
+ static int meth_var_names_idx = 0;
+ static int meth_var_types_idx = 0;
+
+ if (section == class_names)
+ sprintf (buf, "_OBJC_CLASS_NAME_%d", class_names_idx++);
+ else if (section == meth_var_names)
+ sprintf (buf, "_OBJC_METH_VAR_NAME_%d", meth_var_names_idx++);
+ else if (section == meth_var_types)
+ sprintf (buf, "_OBJC_METH_VAR_TYPE_%d", meth_var_types_idx++);
+
+ rtl_obstack = current_obstack = &permanent_obstack;
+ ident = get_identifier (buf);
+
+ decl = build_decl (VAR_DECL, ident, build_array_type (char_type_node, 0));
+ DECL_EXTERNAL (decl) = 1;
+ TREE_PUBLIC (decl) = 1;
+ TREE_USED (decl) = 1;
+ TREE_READONLY (decl) = 1;
+ TREE_CONSTANT (decl) = 1;
+
+ make_decl_rtl (decl, 0, 1); /* usually called from `rest_of_decl_compilation */
+ pushdecl_top_level (decl); /* our `extended/custom' pushdecl in c-decl.c */
+
+ current_obstack = save_current_obstack;
+ rtl_obstack = save_rtl_obstack;
+
+ return decl;
+}
+
+
+void
+objc_declare_alias (alias_ident, class_ident)
+ tree alias_ident;
+ tree class_ident;
+{
+ if (!doing_objc_thang)
+ objc_fatal ();
+
+ if (is_class_name (class_ident) != class_ident)
+ warning ("Cannot find class `%s'", IDENTIFIER_POINTER (class_ident));
+ else if (is_class_name (alias_ident))
+ warning ("Class `%s' already exists", IDENTIFIER_POINTER (alias_ident));
+ else
+ alias_chain = tree_cons (class_ident, alias_ident, alias_chain);
+}
+
+void
+objc_declare_class (ident_list)
+ tree ident_list;
+{
+ tree list;
+
+ if (!doing_objc_thang)
+ objc_fatal ();
+
+ for (list = ident_list; list; list = TREE_CHAIN (list))
+ {
+ tree ident = TREE_VALUE (list);
+ tree decl;
+
+ if ((decl = lookup_name (ident)))
+ {
+ error ("`%s' redeclared as different kind of symbol",
+ IDENTIFIER_POINTER (ident));
+ error_with_decl (decl, "previous declaration of `%s'");
+ }
+
+ if (! is_class_name (ident))
+ {
+ tree record = xref_tag (RECORD_TYPE, ident);
+ TREE_STATIC_TEMPLATE (record) = 1;
+ class_chain = tree_cons (NULLT, ident, class_chain);
+ }
+ }
+}
+
+tree
+is_class_name (ident)
+ tree ident;
+{
+ tree chain;
+
+ if (lookup_interface (ident))
+ return ident;
+
+ for (chain = class_chain; chain; chain = TREE_CHAIN (chain))
+ {
+ if (ident == TREE_VALUE (chain))
+ return ident;
+ }
+
+ for (chain = alias_chain; chain; chain = TREE_CHAIN (chain))
+ {
+ if (ident == TREE_VALUE (chain))
+ return TREE_PURPOSE (chain);
+ }
+
+ return 0;
+}
+
+tree
+lookup_interface (ident)
+ tree ident;
+{
+ tree chain;
+
+ for (chain = interface_chain; chain; chain = TREE_CHAIN (chain))
+ {
+ if (ident == CLASS_NAME (chain))
+ return chain;
+ }
+ return NULLT;
+}
+
+static tree
+objc_copy_list (list, head)
+ tree list;
+ tree *head;
+{
+ tree newlist = NULL_TREE, tail = NULL_TREE;
+
+ while (list)
+ {
+ tail = copy_node (list);
+
+ /* The following statement fixes a bug when inheriting instance
+ variables that are declared to be bitfields. finish_struct
+ expects to find the width of the bitfield in DECL_INITIAL,
+ which it nulls out after processing the decl of the super
+ class...rather than change the way finish_struct works (which
+ is risky), I create the situation it expects...s.naroff
+ (7/23/89). */
+
+ if (DECL_BIT_FIELD (tail) && DECL_INITIAL (tail) == 0)
+ DECL_INITIAL (tail) = build_int_2 (DECL_FIELD_SIZE (tail), 0);
+
+ newlist = chainon (newlist, tail);
+ list = TREE_CHAIN (list);
+ }
+ *head = newlist;
+ return tail;
+}
+
+/* Used by: build_private_template, get_class_ivars, and
+ continue_class. COPY is 1 when called from @defs. In this case
+ copy all fields. Otherwise don't copy leaf ivars since we rely on
+ them being side-effected exactly once by finish_struct. */
+
+static tree
+build_ivar_chain (interface, copy)
+ tree interface;
+ int copy;
+{
+ tree my_name, super_name, ivar_chain;
+
+ my_name = CLASS_NAME (interface);
+ super_name = CLASS_SUPER_NAME (interface);
+
+ /* Possibly copy leaf ivars. */
+ if (copy)
+ objc_copy_list (CLASS_IVARS (interface), &ivar_chain);
+ else
+ ivar_chain = CLASS_IVARS (interface);
+
+ while (super_name)
+ {
+ tree op1;
+ tree super_interface = lookup_interface (super_name);
+
+ if (!super_interface)
+ {
+ /* fatal did not work with 2 args...should fix */
+ error ("Cannot find interface declaration for `%s', superclass of `%s'",
+ IDENTIFIER_POINTER (super_name),
+ IDENTIFIER_POINTER (my_name));
+ exit (34);
+ }
+ if (super_interface == interface)
+ {
+ fatal ("Circular inheritance in interface declaration for `%s'",
+ IDENTIFIER_POINTER (super_name));
+ }
+ interface = super_interface;
+ my_name = CLASS_NAME (interface);
+ super_name = CLASS_SUPER_NAME (interface);
+
+ op1 = CLASS_IVARS (interface);
+ if (op1)
+ {
+ tree head, tail = objc_copy_list (op1, &head);
+
+ /* Prepend super class ivars...make a copy of the list, we
+ do not want to alter the original. */
+ TREE_CHAIN (tail) = ivar_chain;
+ ivar_chain = head;
+ }
+ }
+ return ivar_chain;
+}
+
+/* struct <classname> {
+ struct objc_class *isa;
+ ...
+ }; */
+
+static tree
+build_private_template (class)
+ tree class;
+{
+ tree ivar_context;
+
+ if (CLASS_STATIC_TEMPLATE (class))
+ {
+ uprivate_record = CLASS_STATIC_TEMPLATE (class);
+ ivar_context = TYPE_FIELDS (CLASS_STATIC_TEMPLATE (class));
+ }
+ else
+ {
+ uprivate_record = start_struct (RECORD_TYPE, CLASS_NAME (class));
+
+ ivar_context = build_ivar_chain (class, 0);
+
+ finish_struct (uprivate_record, ivar_context);
+
+ CLASS_STATIC_TEMPLATE (class) = uprivate_record;
+
+ /* mark this record as class template - for class type checking */
+ TREE_STATIC_TEMPLATE (uprivate_record) = 1;
+ }
+ instance_type = groktypename (build_tree_list (build_tree_list (NULLT, uprivate_record),
+ build1 (INDIRECT_REF, NULLT, NULLT)));
+ return ivar_context;
+}
+
+/* Begin code generation for protocols... */
+
+/* struct objc_protocol {
+ char *protocol_name;
+ struct objc_protocol **protocol_list;
+ struct objc_method_desc *instance_methods;
+ struct objc_method_desc *class_methods;
+ }; */
+
+static tree
+build_protocol_template ()
+{
+ tree decl_specs, field_decl, field_decl_chain;
+ tree template;
+
+ template = start_struct (RECORD_TYPE, get_identifier (UTAG_PROTOCOL));
+
+ /* struct objc_class *isa; */
+
+ decl_specs = build_tree_list (NULLT, xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_CLASS)));
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("isa"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ field_decl_chain = field_decl;
+
+ /* char *protocol_name; */
+
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_CHAR]);
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("protocol_name"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* struct objc_protocol **protocol_list; */
+
+ decl_specs = build_tree_list (NULLT, template);
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("protocol_list"));
+ field_decl = build1 (INDIRECT_REF, NULLT, field_decl);
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* struct objc_method_list *instance_methods; */
+
+ decl_specs = build_tree_list (NULLT, xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_METHOD_PROTOTYPE_LIST)));
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("instance_methods"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* struct objc_method_list *class_methods; */
+
+ decl_specs = build_tree_list (NULLT, xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_METHOD_PROTOTYPE_LIST)));
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("class_methods"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ return finish_struct (template, field_decl_chain);
+}
+
+static tree
+build_descriptor_table_initializer (entries, size)
+ tree entries;
+ int *size;
+{
+ tree initlist = NULLT;
+
+ do
+ {
+ initlist = tree_cons (NULLT, build_selector (METHOD_SEL_NAME (entries)), initlist);
+
+ initlist = tree_cons (NULLT, add_objc_string (METHOD_ENCODING (entries), meth_var_types), initlist);
+
+ (*size)++;
+ entries = TREE_CHAIN (entries);
+ }
+ while (entries);
+
+ return build_nt (CONSTRUCTOR, NULLT, nreverse (initlist));
+}
+
+/* struct objc_method_prototype_list {
+ int count;
+ struct objc_method_prototype {
+ SEL name;
+ char *types;
+ } list[1];
+ }; */
+
+static tree
+build_method_prototype_list_template (list_type, size)
+ tree list_type;
+ int size;
+{
+ tree objc_ivar_list_record;
+ tree decl_specs, field_decl, field_decl_chain;
+
+ /* generate an unnamed struct definition */
+
+ objc_ivar_list_record = start_struct (RECORD_TYPE, NULLT);
+
+ /* int method_count; */
+
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_INT]);
+ field_decl = get_identifier ("method_count");
+
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ field_decl_chain = field_decl;
+
+ /* struct objc_method method_list[]; */
+
+ decl_specs = build_tree_list (NULLT, list_type);
+ field_decl = build_nt (ARRAY_REF, get_identifier ("method_list"),
+ build_int_2 (size, 0));
+
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ finish_struct (objc_ivar_list_record, field_decl_chain);
+
+ return objc_ivar_list_record;
+}
+
+static tree
+build_method_prototype_template ()
+{
+ tree proto_record;
+ tree decl_specs, field_decl, field_decl_chain;
+
+ proto_record = start_struct (RECORD_TYPE, get_identifier (UTAG_METHOD_PROTOTYPE));
+
+#ifdef OBJC_INT_SELECTORS
+ /* unsigned int _cmd; */
+ decl_specs = tree_cons (NULLT, ridpointers[(int) RID_UNSIGNED], NULLT);
+ decl_specs = tree_cons (NULLT, ridpointers[(int) RID_INT], decl_specs);
+ field_decl = get_identifier ("_cmd");
+#else /* OBJC_INT_SELECTORS */
+ /* struct objc_selector *_cmd; */
+ decl_specs = tree_cons (NULLT, xref_tag (RECORD_TYPE,
+ get_identifier (TAG_SELECTOR)), NULLT);
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("_cmd"));
+#endif /* OBJC_INT_SELECTORS */
+
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ field_decl_chain = field_decl;
+
+ decl_specs = tree_cons (NULLT, ridpointers[(int) RID_CHAR], NULLT);
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("method_types"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ finish_struct (proto_record, field_decl_chain);
+
+ return proto_record;
+}
+
+static int
+forwarding_offset (parm)
+ tree parm;
+{
+ int offset_in_bytes;
+
+ if (GET_CODE (DECL_INCOMING_RTL (parm)) == MEM)
+ {
+ rtx addr = XEXP (DECL_INCOMING_RTL (parm), 0);
+
+ /* ??? Here we assume that the parm address is indexed
+ off the frame pointer or arg pointer.
+ If that is not true, we produce meaningless results,
+ but do not crash. */
+ if (GET_CODE (addr) == PLUS
+ && GET_CODE (XEXP (addr, 1)) == CONST_INT)
+ offset_in_bytes = INTVAL (XEXP (addr, 1));
+ else
+ offset_in_bytes = 0;
+
+ offset_in_bytes += OBJC_FORWARDING_STACK_OFFSET;
+ }
+#ifdef OBJC_FORWARDING_REG_OFFSET
+ else if (GET_CODE (DECL_INCOMING_RTL (parm)) == REG)
+ {
+ int regno = REGNO (DECL_INCOMING_RTL (parm));
+
+ offset_in_bytes = 4 * (regno - OBJC_FORWARDING_FIRST_REG)
+ + OBJC_FORWARDING_REG_OFFSET;
+ }
+#endif /* OBJC_FORWARDING_REG_OFFSET */
+ else
+ return 0;
+
+ /* This is the case where the parm is passed as an int or double
+ and it is converted to a char, short or float and stored back
+ in the parmlist. In this case, describe the parm
+ with the variable's declared type, and adjust the address
+ if the least significant bytes (which we are using) are not
+ the first ones. */
+#if BYTES_BIG_ENDIAN
+ if (TREE_TYPE (parm) != DECL_ARG_TYPE (parm))
+ offset_in_bytes += (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parm)))
+ - GET_MODE_SIZE (GET_MODE (DECL_RTL (parm))));
+#endif
+
+ return offset_in_bytes;
+}
+
+static tree
+encode_method_prototype (method_decl, func_decl)
+ tree method_decl;
+ tree func_decl;
+{
+ tree parms;
+ int stack_size, i;
+ tree user_args;
+ int max_parm_end = 0;
+ char buf[40];
+ tree result;
+
+ /* `oneway' and 'bycopy', for remote object are the only method qualifiers */
+ encode_type_qualifiers (TREE_PURPOSE (TREE_TYPE (method_decl)));
+
+ /* C type */
+ encode_type (TREE_TYPE (TREE_TYPE (func_decl)),
+ obstack_object_size (&util_obstack),
+ OBJC_ENCODE_INLINE_DEFS);
+
+ /* stack size */
+ for (parms = DECL_ARGUMENTS (func_decl); parms;
+ parms = TREE_CHAIN (parms))
+ {
+ int parm_end = (forwarding_offset (parms)
+ + (TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (parms)))
+ / BITS_PER_UNIT));
+
+ if (parm_end > max_parm_end)
+ max_parm_end = parm_end;
+ }
+
+ stack_size = max_parm_end - OBJC_FORWARDING_MIN_OFFSET;
+
+ sprintf (buf, "%d", stack_size);
+ obstack_grow (&util_obstack, buf, strlen (buf));
+
+ user_args = METHOD_SEL_ARGS (method_decl);
+
+ /* argument types */
+ for (parms = DECL_ARGUMENTS (func_decl), i = 0; parms;
+ parms = TREE_CHAIN (parms), i++)
+ {
+ /* process argument qualifiers for user supplied arguments */
+ if (i > 1)
+ {
+ encode_type_qualifiers (TREE_PURPOSE (TREE_TYPE (user_args)));
+ user_args = TREE_CHAIN (user_args);
+ }
+
+ /* type */
+ encode_type (TREE_TYPE (parms),
+ obstack_object_size (&util_obstack),
+ OBJC_ENCODE_INLINE_DEFS);
+
+ /* compute offset */
+ sprintf (buf, "%d", forwarding_offset (parms));
+ obstack_grow (&util_obstack, buf, strlen (buf));
+ }
+
+ obstack_1grow (&util_obstack, '\0');
+ result = get_identifier (obstack_finish (&util_obstack));
+ obstack_free (&util_obstack, util_firstobj);
+ return result;
+}
+
+static tree
+generate_descriptor_table (type, name, size, list, proto)
+ tree type;
+ char *name;
+ int size;
+ tree list;
+ tree proto;
+{
+ tree sc_spec, decl_specs, decl, initlist;
+
+ sc_spec = tree_cons (NULLT, ridpointers[(int) RID_STATIC], NULLT);
+ decl_specs = tree_cons (NULLT, type, sc_spec);
+
+ decl = start_decl (synth_id_with_class_suffix (name, proto),
+ decl_specs, 1);
+ end_temporary_allocation ();
+
+ initlist = build_tree_list (NULLT, build_int_2 (size, 0));
+ initlist = tree_cons (NULLT, list, initlist);
+
+ finish_decl (decl, build_nt (CONSTRUCTOR, NULLT, nreverse (initlist)), NULLT);
+
+ return decl;
+}
+
+static void
+generate_method_descriptors (protocol) /* generate_dispatch_tables */
+ tree protocol;
+{
+ static tree objc_method_prototype_template;
+ tree initlist, chain, method_list_template;
+ tree cast, variable_length_type;
+ int size;
+
+ if (!objc_method_prototype_template)
+ objc_method_prototype_template = build_method_prototype_template ();
+
+ cast = build_tree_list (build_tree_list (NULLT, xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_METHOD_PROTOTYPE_LIST))), NULLT);
+ variable_length_type = groktypename (cast);
+
+ chain = PROTOCOL_CLS_METHODS (protocol);
+ if (chain)
+ {
+ size = 0;
+
+ initlist = build_descriptor_table_initializer (chain, &size);
+
+ method_list_template
+ = build_method_prototype_list_template (objc_method_prototype_template,
+ size);
+
+ UOBJC_CLASS_METHODS_decl
+ = generate_descriptor_table (method_list_template,
+ "_OBJC_PROTOCOL_CLASS_METHODS",
+ size, initlist, protocol);
+ /* cast! */
+ TREE_TYPE (UOBJC_CLASS_METHODS_decl) = variable_length_type;
+ }
+ else
+ UOBJC_CLASS_METHODS_decl = 0;
+
+ chain = PROTOCOL_NST_METHODS (protocol);
+ if (chain)
+ {
+ size = 0;
+ initlist = build_descriptor_table_initializer (chain, &size);
+
+ method_list_template
+ = build_method_prototype_list_template (objc_method_prototype_template,
+ size);
+
+ UOBJC_INSTANCE_METHODS_decl
+ = generate_descriptor_table (method_list_template,
+ "_OBJC_PROTOCOL_INSTANCE_METHODS",
+ size, initlist, protocol);
+ /* cast! */
+ TREE_TYPE (UOBJC_INSTANCE_METHODS_decl) = variable_length_type;
+ }
+ else
+ UOBJC_INSTANCE_METHODS_decl = 0;
+}
+
+static tree
+build_tmp_function_decl ()
+{
+ tree decl_specs, expr_decl, parms;
+
+ /* struct objc_object *objc_xxx (id, SEL, ...); */
+ pushlevel (0);
+ decl_specs = build_tree_list (NULLT, objc_object_reference);
+ push_parm_decl (build_tree_list (decl_specs,
+ build1 (INDIRECT_REF, NULLT, NULLT)));
+
+ decl_specs = build_tree_list (NULLT, xref_tag (RECORD_TYPE,
+ get_identifier (TAG_SELECTOR)));
+ expr_decl = build1 (INDIRECT_REF, NULLT, NULLT);
+
+ push_parm_decl (build_tree_list (decl_specs, expr_decl));
+ parms = get_parm_info (0);
+ poplevel (0, 0, 0);
+
+ decl_specs = build_tree_list (NULLT, objc_object_reference);
+ expr_decl = build_nt (CALL_EXPR, get_identifier ("objc_xxx"), parms, NULLT);
+ expr_decl = build1 (INDIRECT_REF, NULLT, expr_decl);
+
+ return define_decl (expr_decl, decl_specs);
+}
+
+static void
+hack_method_prototype (nst_methods, tmp_decl)
+ tree nst_methods;
+ tree tmp_decl;
+{
+ tree parms;
+
+ /* Hack to avoid problem with static typing of self arg. */
+ TREE_SET_CODE (nst_methods, CLASS_METHOD_DECL);
+ start_method_def (nst_methods);
+ TREE_SET_CODE (nst_methods, INSTANCE_METHOD_DECL);
+
+ if (METHOD_ADD_ARGS (nst_methods) == (tree) 1)
+ parms = get_parm_info (0); /* we have a `, ...' */
+ else
+ parms = get_parm_info (1); /* place a `void_at_end' */
+
+ poplevel (0, 0, 0); /* Must be called BEFORE start_function. */
+
+ /* Usually called from store_parm_decls -> init_function_start. */
+
+ init_emit (); /* needed to make assign_parms work (with -O). */
+
+ DECL_ARGUMENTS (tmp_decl) = TREE_PURPOSE (parms);
+
+ {
+ /* Code taken from start_function. */
+ tree restype = TREE_TYPE (TREE_TYPE (tmp_decl));
+ /* Promote the value to int before returning it. */
+ if (TREE_CODE (restype) == INTEGER_TYPE
+ && TYPE_PRECISION (restype) < TYPE_PRECISION (integer_type_node))
+ restype = integer_type_node;
+ DECL_RESULT (tmp_decl) = build_decl (RESULT_DECL, 0, restype);
+ }
+
+ /* Typically called from expand_function_start for function definitions. */
+ assign_parms (tmp_decl, 0);
+
+ /* install return type */
+ TREE_TYPE (TREE_TYPE (tmp_decl)) = groktypename (TREE_TYPE (nst_methods));
+}
+
+static void
+generate_protocol_references (plist)
+ tree plist;
+{
+ tree lproto;
+
+ /* forward declare protocols referenced */
+ for (lproto = plist; lproto; lproto = TREE_CHAIN (lproto))
+ {
+ tree proto = TREE_VALUE (lproto);
+
+ if (TREE_CODE (proto) == PROTOCOL_INTERFACE_TYPE
+ && PROTOCOL_NAME (proto))
+ {
+ if (! PROTOCOL_FORWARD_DECL (proto))
+ build_protocol_reference (proto);
+
+ if (PROTOCOL_LIST (proto))
+ generate_protocol_references (PROTOCOL_LIST (proto));
+ }
+ }
+}
+
+static void
+generate_protocols ()
+{
+ tree p, tmp_decl, encoding;
+ tree sc_spec, decl_specs, decl;
+ tree initlist, protocol_name_expr, refs_decl, refs_expr;
+ tree cast_type2 = 0;
+
+ tmp_decl = build_tmp_function_decl ();
+
+ if (! objc_protocol_template)
+ objc_protocol_template = build_protocol_template ();
+
+ /* if a protocol was directly referenced, pull in indirect references */
+ for (p = protocol_chain; p; p = TREE_CHAIN (p))
+ if (PROTOCOL_FORWARD_DECL (p) && PROTOCOL_LIST (p))
+ generate_protocol_references (PROTOCOL_LIST (p));
+
+ for (p = protocol_chain; p; p = TREE_CHAIN (p))
+ {
+ tree nst_methods = PROTOCOL_NST_METHODS (p);
+ tree cls_methods = PROTOCOL_CLS_METHODS (p);
+
+ /* if protocol wasn't referenced, don't generate any code */
+ if (! PROTOCOL_FORWARD_DECL (p))
+ continue;
+
+ /* Make sure we link in the Protocol class. */
+ add_class_reference (get_identifier (PROTOCOL_OBJECT_CLASS_NAME));
+
+ while (nst_methods)
+ {
+ hack_method_prototype (nst_methods, tmp_decl);
+ encoding = encode_method_prototype (nst_methods, tmp_decl);
+ METHOD_ENCODING (nst_methods) = encoding;
+
+ nst_methods = TREE_CHAIN (nst_methods);
+ }
+
+ while (cls_methods)
+ {
+ hack_method_prototype (cls_methods, tmp_decl);
+ encoding = encode_method_prototype (cls_methods, tmp_decl);
+ METHOD_ENCODING (cls_methods) = encoding;
+
+ cls_methods = TREE_CHAIN (cls_methods);
+ }
+ generate_method_descriptors (p);
+
+ if (PROTOCOL_LIST (p))
+ refs_decl = generate_protocol_list (p);
+ else
+ refs_decl = 0;
+
+ /* static struct objc_protocol _OBJC_PROTOCOL_<mumble>; */
+
+ sc_spec = tree_cons (NULLT, ridpointers[(int) RID_STATIC], NULLT);
+ decl_specs = tree_cons (NULLT, objc_protocol_template, sc_spec);
+
+ decl = start_decl (synth_id_with_class_suffix ("_OBJC_PROTOCOL", p),
+ decl_specs, 1);
+ end_temporary_allocation ();
+
+ protocol_name_expr = add_objc_string (PROTOCOL_NAME (p), class_names);
+
+ if (refs_decl)
+ {
+ if (!cast_type2)
+ cast_type2
+ = groktypename (build_tree_list (build_tree_list (NULLT, objc_protocol_template),
+ build1 (INDIRECT_REF, NULLT,
+ build1 (INDIRECT_REF, NULLT, NULLT))));
+
+ refs_expr = build_unary_op (ADDR_EXPR, refs_decl, 0);
+ TREE_TYPE (refs_expr) = cast_type2;
+ }
+ else
+ refs_expr = build_int_2 (0, 0);
+
+ /* UOBJC_INSTANCE_METHODS_decl/UOBJC_CLASS_METHODS_decl are set
+ by generate_method_descriptors, which is called above. */
+ initlist = build_protocol_initializer (protocol_name_expr, refs_expr,
+ UOBJC_INSTANCE_METHODS_decl,
+ UOBJC_CLASS_METHODS_decl);
+ finish_decl (decl, initlist, NULLT);
+
+ /* Mark the decl as used to avoid "defined but not used" warning. */
+ TREE_USED (decl) = 1;
+ }
+}
+
+static tree
+build_protocol_initializer (protocol_name, protocol_list,
+ instance_methods, class_methods)
+ tree protocol_name;
+ tree protocol_list;
+ tree instance_methods;
+ tree class_methods;
+{
+ tree initlist = NULLT, expr;
+ static tree cast_type = 0;
+
+ if (!cast_type)
+ cast_type
+ = groktypename (build_tree_list
+ (build_tree_list (NULLT,
+ xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_CLASS))),
+ build1 (INDIRECT_REF, NULLT, NULLT)));
+
+ /* filling the "isa" in with one allows the runtime system to
+ detect that the version change...should remove before final release */
+
+ expr = build_int_2 (PROTOCOL_VERSION, 0);
+ TREE_TYPE (expr) = cast_type;
+ initlist = tree_cons (NULLT, expr, initlist);
+ initlist = tree_cons (NULLT, protocol_name, initlist);
+ initlist = tree_cons (NULLT, protocol_list, initlist);
+
+ if (!instance_methods)
+ initlist = tree_cons (NULLT, build_int_2 (0, 0), initlist);
+ else
+ {
+ expr = build_unary_op (ADDR_EXPR, instance_methods, 0);
+ initlist = tree_cons (NULLT, expr, initlist);
+ }
+ if (!class_methods)
+ initlist = tree_cons (NULLT, build_int_2 (0, 0), initlist);
+ else
+ {
+ expr = build_unary_op (ADDR_EXPR, class_methods, 0);
+ initlist = tree_cons (NULLT, expr, initlist);
+ }
+ return build_nt (CONSTRUCTOR, NULLT, nreverse (initlist));
+}
+/* end code generation for protocols... */
+
+/* struct objc_category {
+ char *category_name;
+ char *class_name;
+ struct objc_method_list *instance_methods;
+ struct objc_method_list *class_methods;
+ struct objc_protocol_list *protocols;
+ }; */
+
+static void
+build_category_template ()
+{
+ tree decl_specs, field_decl, field_decl_chain;
+
+ objc_category_template = start_struct (RECORD_TYPE,
+ get_identifier (UTAG_CATEGORY));
+ /* char *category_name; */
+
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_CHAR]);
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("category_name"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ field_decl_chain = field_decl;
+
+ /* char *class_name; */
+
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_CHAR]);
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("class_name"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* struct objc_method_list *instance_methods; */
+
+ decl_specs = build_tree_list (NULLT, xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_METHOD_LIST)));
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("instance_methods"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* struct objc_method_list *class_methods; */
+
+ decl_specs = build_tree_list (NULLT, xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_METHOD_LIST)));
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("class_methods"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* struct objc_protocol **protocol_list; */
+
+ decl_specs = build_tree_list (NULLT, xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_PROTOCOL)));
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("protocol_list"));
+ field_decl = build1 (INDIRECT_REF, NULLT, field_decl);
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT)
+;
+ chainon (field_decl_chain, field_decl);
+
+ finish_struct (objc_category_template, field_decl_chain);
+}
+
+/* struct objc_class {
+ struct objc_class *isa;
+ struct objc_class *super_class;
+ char *name;
+ long version;
+ long info;
+ long instance_size;
+ struct objc_ivar_list *ivars;
+ struct objc_method_list *methods;
+ if (flag_next_runtime)
+ struct objc_cache *cache;
+ else {
+ struct sarray *dtable;
+ struct objc_class *subclass_list;
+ struct objc_class *sibling_class;
+ }
+ struct objc_protocol_list *protocols;
+ }; */
+
+static void
+build_class_template ()
+{
+ tree decl_specs, field_decl, field_decl_chain;
+
+ objc_class_template = start_struct (RECORD_TYPE, get_identifier (UTAG_CLASS));
+
+ /* struct objc_class *isa; */
+
+ decl_specs = build_tree_list (NULLT, objc_class_template);
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("isa"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ field_decl_chain = field_decl;
+
+ /* struct objc_class *super_class; */
+
+ decl_specs = build_tree_list (NULLT, objc_class_template);
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("super_class"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* char *name; */
+
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_CHAR]);
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("name"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* long version; */
+
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_LONG]);
+ field_decl = get_identifier ("version");
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* long info; */
+
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_LONG]);
+ field_decl = get_identifier ("info");
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* long instance_size; */
+
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_LONG]);
+ field_decl = get_identifier ("instance_size");
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* struct objc_ivar_list *ivars; */
+
+ decl_specs = build_tree_list (NULLT, xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_IVAR_LIST)));
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("ivars"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* struct objc_method_list *methods; */
+
+ decl_specs = build_tree_list (NULLT, xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_METHOD_LIST)));
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("methods"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ if (flag_next_runtime)
+ {
+ /* struct objc_cache *cache; */
+
+ decl_specs = build_tree_list (NULLT, xref_tag (RECORD_TYPE,
+ get_identifier ("objc_cache")));
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("cache"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+ }
+ else
+ {
+ /* struct sarray *dtable; */
+
+ decl_specs = build_tree_list (NULLT, xref_tag (RECORD_TYPE,
+ get_identifier ("sarray")));
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("dtable"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* struct objc_class *subclass_list; */
+
+ decl_specs = build_tree_list (NULLT, objc_class_template);
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("subclass_list"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* struct objc_class *sibling_class; */
+
+ decl_specs = build_tree_list (NULLT, objc_class_template);
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("sibling_class"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+ }
+
+ /* struct objc_protocol **protocol_list; */
+
+ decl_specs = build_tree_list (NULLT, xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_PROTOCOL)));
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("protocol_list"));
+ field_decl = build1 (INDIRECT_REF, NULLT, field_decl);
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+
+ finish_struct (objc_class_template, field_decl_chain);
+}
+
+/* Generate appropriate forward declarations for an implementation. */
+
+static void
+synth_forward_declarations ()
+{
+ tree sc_spec, decl_specs, an_id;
+
+ /* extern struct objc_class _OBJC_CLASS_<my_name>; */
+
+ an_id = synth_id_with_class_suffix ("_OBJC_CLASS", implementation_context);
+
+ sc_spec = build_tree_list (NULLT, ridpointers[(int) RID_EXTERN]);
+ decl_specs = tree_cons (NULLT, objc_class_template, sc_spec);
+ UOBJC_CLASS_decl = define_decl (an_id, decl_specs);
+ TREE_USED (UOBJC_CLASS_decl) = 1;
+
+ /* extern struct objc_class _OBJC_METACLASS_<my_name>; */
+
+ an_id = synth_id_with_class_suffix ("_OBJC_METACLASS",
+ implementation_context);
+
+ UOBJC_METACLASS_decl = define_decl (an_id, decl_specs);
+ TREE_USED (UOBJC_METACLASS_decl) = 1;
+
+ /* pre-build the following entities - for speed/convenience. */
+
+ an_id = get_identifier ("super_class");
+ ucls_super_ref = build_component_ref (UOBJC_CLASS_decl, an_id);
+ uucls_super_ref = build_component_ref (UOBJC_METACLASS_decl, an_id);
+}
+
+static void
+error_with_ivar (message, decl, rawdecl)
+ char *message;
+ tree decl;
+ tree rawdecl;
+{
+ count_error (0);
+
+ report_error_function (DECL_SOURCE_FILE (decl));
+
+ fprintf (stderr, "%s:%d: ",
+ DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
+ bzero (errbuf, BUFSIZE);
+ fprintf (stderr, "%s `%s'\n", message, gen_declaration (rawdecl, errbuf));
+}
+
+#define USERTYPE(t) (TREE_CODE (t) == RECORD_TYPE || \
+ TREE_CODE (t) == UNION_TYPE || \
+ TREE_CODE (t) == ENUMERAL_TYPE)
+
+static void
+check_ivars (inter, imp)
+ tree inter;
+ tree imp;
+{
+ tree intdecls = CLASS_IVARS (inter);
+ tree impdecls = CLASS_IVARS (imp);
+ tree rawintdecls = CLASS_RAW_IVARS (inter);
+ tree rawimpdecls = CLASS_RAW_IVARS (imp);
+
+ while (1)
+ {
+ tree t1, t2;
+
+ if (intdecls == 0 && impdecls == 0)
+ break;
+ if (intdecls == 0 || impdecls == 0)
+ {
+ error ("inconsistent instance variable specification");
+ break;
+ }
+ t1 = TREE_TYPE (intdecls); t2 = TREE_TYPE (impdecls);
+
+ if (!comptypes (t1, t2))
+ {
+ if (DECL_NAME (intdecls) == DECL_NAME (impdecls))
+ {
+ error_with_ivar ("conflicting instance variable type",
+ impdecls, rawimpdecls);
+ error_with_ivar ("previous declaration of",
+ intdecls, rawintdecls);
+ }
+ else /* both the type and the name don't match */
+ {
+ error ("inconsistent instance variable specification");
+ break;
+ }
+ }
+ else if (DECL_NAME (intdecls) != DECL_NAME (impdecls))
+ {
+ error_with_ivar ("conflicting instance variable name",
+ impdecls, rawimpdecls);
+ error_with_ivar ("previous declaration of",
+ intdecls, rawintdecls);
+ }
+ intdecls = TREE_CHAIN (intdecls);
+ impdecls = TREE_CHAIN (impdecls);
+ rawintdecls = TREE_CHAIN (rawintdecls);
+ rawimpdecls = TREE_CHAIN (rawimpdecls);
+ }
+}
+
+/* Set super_type to the data type node for struct objc_super *,
+ first defining struct objc_super itself.
+ This needs to be done just once per compilation. */
+
+static tree
+build_super_template ()
+{
+ tree record, decl_specs, field_decl, field_decl_chain;
+
+ record = start_struct (RECORD_TYPE, get_identifier (UTAG_SUPER));
+
+ /* struct objc_object *self; */
+
+ decl_specs = build_tree_list (NULLT, objc_object_reference);
+ field_decl = get_identifier ("self");
+ field_decl = build1 (INDIRECT_REF, NULLT, field_decl);
+ field_decl = grokfield (input_filename, lineno,
+ field_decl, decl_specs, NULLT);
+ field_decl_chain = field_decl;
+
+ /* struct objc_class *class; */
+
+ decl_specs = get_identifier (UTAG_CLASS);
+ decl_specs = build_tree_list (NULLT, xref_tag (RECORD_TYPE, decl_specs));
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("class"));
+
+ field_decl = grokfield (input_filename, lineno,
+ field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ finish_struct (record, field_decl_chain);
+
+ /* `struct objc_super *' */
+ super_type = groktypename (build_tree_list (build_tree_list (NULLT, record),
+ build1 (INDIRECT_REF,
+ NULLT, NULLT)));
+ return record;
+}
+
+/* struct objc_ivar {
+ char *ivar_name;
+ char *ivar_type;
+ int ivar_offset;
+ }; */
+
+static tree
+build_ivar_template ()
+{
+ tree objc_ivar_id, objc_ivar_record;
+ tree decl_specs, field_decl, field_decl_chain;
+
+ objc_ivar_id = get_identifier (UTAG_IVAR);
+ objc_ivar_record = start_struct (RECORD_TYPE, objc_ivar_id);
+
+ /* char *ivar_name; */
+
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_CHAR]);
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("ivar_name"));
+
+ field_decl = grokfield (input_filename, lineno, field_decl,
+ decl_specs, NULLT);
+ field_decl_chain = field_decl;
+
+ /* char *ivar_type; */
+
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_CHAR]);
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("ivar_type"));
+
+ field_decl = grokfield (input_filename, lineno, field_decl,
+ decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* int ivar_offset; */
+
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_INT]);
+ field_decl = get_identifier ("ivar_offset");
+
+ field_decl = grokfield (input_filename, lineno, field_decl,
+ decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ finish_struct (objc_ivar_record, field_decl_chain);
+
+ return objc_ivar_record;
+}
+
+/* struct {
+ int ivar_count;
+ struct objc_ivar ivar_list[ivar_count];
+ }; */
+
+static tree
+build_ivar_list_template (list_type, size)
+ tree list_type;
+ int size;
+{
+ tree objc_ivar_list_record;
+ tree decl_specs, field_decl, field_decl_chain;
+
+ objc_ivar_list_record = start_struct (RECORD_TYPE, NULLT);
+
+ /* int ivar_count; */
+
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_INT]);
+ field_decl = get_identifier ("ivar_count");
+
+ field_decl = grokfield (input_filename, lineno, field_decl,
+ decl_specs, NULLT);
+ field_decl_chain = field_decl;
+
+ /* struct objc_ivar ivar_list[]; */
+
+ decl_specs = build_tree_list (NULLT, list_type);
+ field_decl = build_nt (ARRAY_REF, get_identifier ("ivar_list"),
+ build_int_2 (size, 0));
+
+ field_decl = grokfield (input_filename, lineno,
+ field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ finish_struct (objc_ivar_list_record, field_decl_chain);
+
+ return objc_ivar_list_record;
+}
+
+/* struct {
+ int method_next;
+ int method_count;
+ struct objc_method method_list[method_count];
+ }; */
+
+static tree
+build_method_list_template (list_type, size)
+ tree list_type;
+ int size;
+{
+ tree objc_ivar_list_record;
+ tree decl_specs, field_decl, field_decl_chain;
+
+ objc_ivar_list_record = start_struct (RECORD_TYPE, NULLT);
+
+ /* int method_next; */
+
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_INT]);
+ field_decl = get_identifier ("method_next");
+
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ field_decl_chain = field_decl;
+
+ /* int method_count; */
+
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_INT]);
+ field_decl = get_identifier ("method_count");
+
+ field_decl = grokfield (input_filename, lineno,
+ field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* struct objc_method method_list[]; */
+
+ decl_specs = build_tree_list (NULLT, list_type);
+ field_decl = build_nt (ARRAY_REF, get_identifier ("method_list"),
+ build_int_2 (size, 0));
+
+ field_decl = grokfield (input_filename, lineno,
+ field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ finish_struct (objc_ivar_list_record, field_decl_chain);
+
+ return objc_ivar_list_record;
+}
+
+static tree
+build_ivar_list_initializer (field_decl, size)
+ tree field_decl;
+ int *size;
+{
+ tree initlist = NULLT;
+
+ do
+ {
+ /* set name */
+ if (DECL_NAME (field_decl))
+ initlist = tree_cons (NULLT,
+ add_objc_string (DECL_NAME (field_decl),
+ meth_var_names),
+ initlist);
+ else
+ /* unnamed bit-field ivar (yuck). */
+ initlist = tree_cons (NULLT, build_int_2 (0, 0), initlist);
+
+ /* set type */
+ encode_field_decl (field_decl,
+ obstack_object_size (&util_obstack),
+ OBJC_ENCODE_DONT_INLINE_DEFS);
+ obstack_1grow (&util_obstack, 0); /* null terminate string */
+ initlist
+ = tree_cons
+ (NULLT,
+ add_objc_string (get_identifier (obstack_finish (&util_obstack)),
+ meth_var_types),
+ initlist);
+ obstack_free (&util_obstack, util_firstobj);
+
+ /* set offset */
+ initlist
+ = tree_cons
+ (NULLT,
+ build_int_2 ((TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field_decl))
+ / BITS_PER_UNIT),
+ 0),
+ initlist);
+ (*size)++;
+ field_decl = TREE_CHAIN (field_decl);
+ }
+ while (field_decl);
+
+ return build_nt (CONSTRUCTOR, NULLT, nreverse (initlist));
+}
+
+static tree
+generate_ivars_list (type, name, size, list)
+ tree type;
+ char *name;
+ int size;
+ tree list;
+{
+ tree sc_spec, decl_specs, decl, initlist;
+
+ sc_spec = tree_cons (NULLT, ridpointers[(int) RID_STATIC], NULLT);
+ decl_specs = tree_cons (NULLT, type, sc_spec);
+
+ decl = start_decl (synth_id_with_class_suffix (name, implementation_context),
+ decl_specs, 1);
+ end_temporary_allocation ();
+
+ initlist = build_tree_list (NULLT, build_int_2 (size, 0));
+ initlist = tree_cons (NULLT, list, initlist);
+
+ finish_decl (decl, build_nt (CONSTRUCTOR, NULLT, nreverse (initlist)), NULLT);
+
+ return decl;
+}
+
+static void
+generate_ivar_lists ()
+{
+ tree initlist, ivar_list_template, chain;
+ tree cast, variable_length_type;
+ int size;
+
+ generating_instance_variables = 1;
+
+ if (!objc_ivar_template)
+ objc_ivar_template = build_ivar_template ();
+
+ cast
+ = build_tree_list
+ (build_tree_list (NULLT, xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_IVAR_LIST))),
+ NULLT);
+ variable_length_type = groktypename (cast);
+
+ /* only generate class variables for the root of the inheritance
+ hierarchy since these will be the same for every class */
+
+ if (CLASS_SUPER_NAME (implementation_template) == NULLT
+ && (chain = TYPE_FIELDS (objc_class_template)))
+ {
+ size = 0;
+ initlist = build_ivar_list_initializer (chain, &size);
+
+ ivar_list_template = build_ivar_list_template (objc_ivar_template, size);
+
+ UOBJC_CLASS_VARIABLES_decl =
+ generate_ivars_list (ivar_list_template, "_OBJC_CLASS_VARIABLES",
+ size, initlist);
+ /* cast! */
+ TREE_TYPE (UOBJC_CLASS_VARIABLES_decl) = variable_length_type;
+ }
+ else
+ UOBJC_CLASS_VARIABLES_decl = 0;
+
+ chain = CLASS_IVARS (implementation_template);
+ if (chain)
+ {
+ size = 0;
+ initlist = build_ivar_list_initializer (chain, &size);
+
+ ivar_list_template = build_ivar_list_template (objc_ivar_template, size);
+
+ UOBJC_INSTANCE_VARIABLES_decl =
+ generate_ivars_list (ivar_list_template, "_OBJC_INSTANCE_VARIABLES",
+ size, initlist);
+ /* cast! */
+ TREE_TYPE (UOBJC_INSTANCE_VARIABLES_decl) = variable_length_type;
+ }
+ else
+ UOBJC_INSTANCE_VARIABLES_decl = 0;
+
+ generating_instance_variables = 0;
+}
+
+static tree
+build_dispatch_table_initializer (entries, size)
+ tree entries;
+ int *size;
+{
+ tree initlist = NULLT;
+
+ do
+ {
+ initlist = tree_cons (NULLT, build_selector (METHOD_SEL_NAME (entries)),
+ initlist);
+
+ initlist = tree_cons (NULLT, add_objc_string (METHOD_ENCODING (entries),
+ meth_var_types),
+ initlist);
+
+ initlist = tree_cons (NULLT, METHOD_DEFINITION (entries), initlist);
+
+ (*size)++;
+ entries = TREE_CHAIN (entries);
+ }
+ while (entries);
+
+ return build_nt (CONSTRUCTOR, NULLT, nreverse (initlist));
+}
+
+/* To accomplish method prototyping without generating all kinds of
+ inane warnings, the definition of the dispatch table entries were
+ changed from:
+
+ struct objc_method { SEL _cmd; id (*_imp)(); };
+ to:
+ struct objc_method { SEL _cmd; void *_imp; }; */
+
+static tree
+build_method_template ()
+{
+ tree _SLT_record;
+ tree decl_specs, field_decl, field_decl_chain;
+
+ _SLT_record = start_struct (RECORD_TYPE, get_identifier (UTAG_METHOD));
+
+#ifdef OBJC_INT_SELECTORS
+ /* unsigned int _cmd; */
+ decl_specs = tree_cons (NULLT, ridpointers[(int) RID_UNSIGNED], NULLT);
+ decl_specs = tree_cons (NULLT, ridpointers[(int) RID_INT], decl_specs);
+ field_decl = get_identifier ("_cmd");
+#else /* not OBJC_INT_SELECTORS */
+ /* struct objc_selector *_cmd; */
+ decl_specs = tree_cons (NULLT,
+ xref_tag (RECORD_TYPE,
+ get_identifier (TAG_SELECTOR)),
+ NULLT);
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("_cmd"));
+#endif /* not OBJC_INT_SELECTORS */
+
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ field_decl_chain = field_decl;
+
+ decl_specs = tree_cons (NULLT, ridpointers[(int) RID_CHAR], NULLT);
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("method_types"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ /* void *_imp; */
+
+ decl_specs = tree_cons (NULLT, ridpointers[(int) RID_VOID], NULLT);
+ field_decl = build1 (INDIRECT_REF, NULLT, get_identifier ("_imp"));
+ field_decl = grokfield (input_filename, lineno, field_decl, decl_specs, NULLT);
+ chainon (field_decl_chain, field_decl);
+
+ finish_struct (_SLT_record, field_decl_chain);
+
+ return _SLT_record;
+}
+
+
+static tree
+generate_dispatch_table (type, name, size, list)
+ tree type;
+ char *name;
+ int size;
+ tree list;
+{
+ tree sc_spec, decl_specs, decl, initlist;
+
+ sc_spec = tree_cons (NULLT, ridpointers[(int) RID_STATIC], NULLT);
+ decl_specs = tree_cons (NULLT, type, sc_spec);
+
+ decl = start_decl (synth_id_with_class_suffix (name, implementation_context),
+ decl_specs, 1);
+ end_temporary_allocation ();
+
+ initlist = build_tree_list (NULLT, build_int_2 (0, 0));
+ initlist = tree_cons (NULLT, build_int_2 (size, 0), initlist);
+ initlist = tree_cons (NULLT, list, initlist);
+
+ finish_decl (decl, build_nt (CONSTRUCTOR, NULLT, nreverse (initlist)), NULLT);
+
+ return decl;
+}
+
+static void
+generate_dispatch_tables ()
+{
+ tree initlist, chain, method_list_template;
+ tree cast, variable_length_type;
+ int size;
+
+ if (!objc_method_template)
+ objc_method_template = build_method_template ();
+
+ cast
+ = build_tree_list
+ (build_tree_list (NULLT, xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_METHOD_LIST))),
+ NULLT);
+ variable_length_type = groktypename (cast);
+
+ chain = CLASS_CLS_METHODS (implementation_context);
+ if (chain)
+ {
+ size = 0;
+ initlist = build_dispatch_table_initializer (chain, &size);
+
+ method_list_template = build_method_list_template (objc_method_template,
+ size);
+
+ UOBJC_CLASS_METHODS_decl
+ = generate_dispatch_table (method_list_template,
+ ((TREE_CODE (implementation_context)
+ == CLASS_IMPLEMENTATION_TYPE)
+ ? "_OBJC_CLASS_METHODS"
+ : "_OBJC_CATEGORY_CLASS_METHODS"),
+ size, initlist);
+ /* cast! */
+ TREE_TYPE (UOBJC_CLASS_METHODS_decl) = variable_length_type;
+ }
+ else
+ UOBJC_CLASS_METHODS_decl = 0;
+
+ chain = CLASS_NST_METHODS (implementation_context);
+ if (chain)
+ {
+ size = 0;
+ initlist = build_dispatch_table_initializer (chain, &size);
+
+ method_list_template = build_method_list_template (objc_method_template,
+ size);
+ if (TREE_CODE (implementation_context) == CLASS_IMPLEMENTATION_TYPE)
+ UOBJC_INSTANCE_METHODS_decl =
+ generate_dispatch_table (method_list_template,
+ "_OBJC_INSTANCE_METHODS",
+ size, initlist);
+ else
+ /* we have a category */
+ UOBJC_INSTANCE_METHODS_decl =
+ generate_dispatch_table (method_list_template,
+ "_OBJC_CATEGORY_INSTANCE_METHODS",
+ size, initlist);
+ /* cast! */
+ TREE_TYPE (UOBJC_INSTANCE_METHODS_decl) = variable_length_type;
+ }
+ else
+ UOBJC_INSTANCE_METHODS_decl = 0;
+}
+
+static tree
+generate_protocol_list (i_or_p)
+ tree i_or_p;
+{
+ static tree cast_type = 0;
+ tree initlist, decl_specs, sc_spec;
+ tree refs_decl, expr_decl, lproto, e, plist;
+ int size = 0;
+
+ if (TREE_CODE (i_or_p) == CLASS_INTERFACE_TYPE
+ || TREE_CODE (i_or_p) == CATEGORY_INTERFACE_TYPE)
+ plist = CLASS_PROTOCOL_LIST (i_or_p);
+ else if (TREE_CODE (i_or_p) == PROTOCOL_INTERFACE_TYPE)
+ plist = PROTOCOL_LIST (i_or_p);
+ else
+ abort ();
+
+ if (!cast_type)
+ cast_type
+ = groktypename
+ (build_tree_list
+ (build_tree_list (NULLT,
+ xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_PROTOCOL))),
+ build1 (INDIRECT_REF, NULLT, NULLT)));
+
+ /* compute size */
+ for (lproto = plist; lproto; lproto = TREE_CHAIN (lproto))
+ if (TREE_CODE (TREE_VALUE (lproto)) == PROTOCOL_INTERFACE_TYPE
+ && PROTOCOL_FORWARD_DECL (TREE_VALUE (lproto)))
+ size++;
+
+ /* build initializer */
+ initlist = tree_cons (NULLT, build_int_2 (0, 0), NULLT);
+
+ e = build_int_2 (size, 0);
+ TREE_TYPE (e) = cast_type;
+ initlist = tree_cons (NULLT, e, initlist);
+
+ for (lproto = plist; lproto; lproto = TREE_CHAIN (lproto))
+ {
+ tree pval = TREE_VALUE (lproto);
+
+ if (TREE_CODE (pval) == PROTOCOL_INTERFACE_TYPE
+ && PROTOCOL_FORWARD_DECL (pval))
+ {
+ e = build_unary_op (ADDR_EXPR, PROTOCOL_FORWARD_DECL (pval), 0);
+ initlist = tree_cons (NULLT, e, initlist);
+ }
+ }
+
+ /* static struct objc_protocol *refs[n]; */
+
+ sc_spec = tree_cons (NULLT, ridpointers[(int) RID_STATIC], NULLT);
+ decl_specs = tree_cons (NULLT, xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_PROTOCOL)),
+ sc_spec);
+
+ if (TREE_CODE (i_or_p) == PROTOCOL_INTERFACE_TYPE)
+ expr_decl = build_nt (ARRAY_REF,
+ synth_id_with_class_suffix ("_OBJC_PROTOCOL_REFS",
+ i_or_p),
+ build_int_2 (size + 2, 0));
+ else if (TREE_CODE (i_or_p) == CLASS_INTERFACE_TYPE)
+ expr_decl = build_nt (ARRAY_REF,
+ synth_id_with_class_suffix ("_OBJC_CLASS_PROTOCOLS",
+ i_or_p),
+ build_int_2 (size + 2, 0));
+ else if (TREE_CODE (i_or_p) == CATEGORY_INTERFACE_TYPE)
+ expr_decl = build_nt (ARRAY_REF,
+ synth_id_with_class_suffix ("_OBJC_CATEGORY_PROTOCOLS",
+ i_or_p),
+ build_int_2 (size + 2, 0));
+
+ expr_decl = build1 (INDIRECT_REF, NULLT, expr_decl);
+
+ refs_decl = start_decl (expr_decl, decl_specs, 1);
+ end_temporary_allocation ();
+
+ finish_decl (refs_decl, build_nt (CONSTRUCTOR, NULLT,
+ nreverse (initlist)), NULLT);
+
+ return refs_decl;
+}
+
+static tree
+build_category_initializer (cat_name, class_name,
+ instance_methods, class_methods, protocol_list)
+ tree cat_name;
+ tree class_name;
+ tree instance_methods;
+ tree class_methods;
+ tree protocol_list;
+{
+ tree initlist = NULLT, expr;
+
+ initlist = tree_cons (NULLT, cat_name, initlist);
+ initlist = tree_cons (NULLT, class_name, initlist);
+
+ if (!instance_methods)
+ initlist = tree_cons (NULLT, build_int_2 (0, 0), initlist);
+ else
+ {
+ expr = build_unary_op (ADDR_EXPR, instance_methods, 0);
+ initlist = tree_cons (NULLT, expr, initlist);
+ }
+ if (!class_methods)
+ initlist = tree_cons (NULLT, build_int_2 (0, 0), initlist);
+ else
+ {
+ expr = build_unary_op (ADDR_EXPR, class_methods, 0);
+ initlist = tree_cons (NULLT, expr, initlist);
+ }
+
+ /* protocol_list = */
+ if (!protocol_list)
+ initlist = tree_cons (NULLT, build_int_2 (0, 0), initlist);
+ else
+ {
+ static tree cast_type2;
+
+ if (!cast_type2)
+ cast_type2
+ = groktypename
+ (build_tree_list
+ (build_tree_list (NULLT,
+ xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_PROTOCOL))),
+ build1 (INDIRECT_REF, NULLT,
+ build1 (INDIRECT_REF, NULLT, NULLT))));
+
+ expr = build_unary_op (ADDR_EXPR, protocol_list, 0);
+ TREE_TYPE (expr) = cast_type2;
+ initlist = tree_cons (NULLT, expr, initlist);
+ }
+
+ return build_nt (CONSTRUCTOR, NULLT, nreverse (initlist));
+}
+
+/* struct objc_class {
+ struct objc_class *isa;
+ struct objc_class *super_class;
+ char *name;
+ long version;
+ long info;
+ long instance_size;
+ struct objc_ivar_list *ivars;
+ struct objc_method_list *methods;
+ if (flag_next_runtime)
+ struct objc_cache *cache;
+ else {
+ struct sarray *dtable;
+ struct objc_class *subclass_list;
+ struct objc_class *sibling_class;
+ }
+ struct objc_protocol_list *protocols;
+ }; */
+
+static tree
+build_shared_structure_initializer (isa, super, name, size, status,
+ dispatch_table, ivar_list, protocol_list)
+ tree isa;
+ tree super;
+ tree name;
+ tree size;
+ int status;
+ tree dispatch_table;
+ tree ivar_list;
+ tree protocol_list;
+{
+ tree initlist = NULLT, expr;
+
+ /* isa = */
+ initlist = tree_cons (NULLT, isa, initlist);
+
+ /* super_class = */
+ initlist = tree_cons (NULLT, super, initlist);
+
+ /* name = */
+ initlist = tree_cons (NULLT, name, initlist);
+
+ /* version = */
+ initlist = tree_cons (NULLT, build_int_2 (0, 0), initlist);
+
+ /* info = */
+ initlist = tree_cons (NULLT, build_int_2 (status, 0), initlist);
+
+ /* instance_size = */
+ initlist = tree_cons (NULLT, size, initlist);
+
+ /* objc_ivar_list = */
+ if (!ivar_list)
+ initlist = tree_cons (NULLT, build_int_2 (0, 0), initlist);
+ else
+ {
+ expr = build_unary_op (ADDR_EXPR, ivar_list, 0);
+ initlist = tree_cons (NULLT, expr, initlist);
+ }
+
+ /* objc_method_list = */
+ if (!dispatch_table)
+ initlist = tree_cons (NULLT, build_int_2 (0, 0), initlist);
+ else
+ {
+ expr = build_unary_op (ADDR_EXPR, dispatch_table, 0);
+ initlist = tree_cons (NULLT, expr, initlist);
+ }
+
+ if (flag_next_runtime)
+ /* method_cache = */
+ initlist = tree_cons (NULLT, build_int_2 (0, 0), initlist);
+ else
+ {
+ /* dtable = */
+ initlist = tree_cons (NULLT, build_int_2 (0, 0), initlist);
+
+ /* subclass_list = */
+ initlist = tree_cons (NULLT, build_int_2 (0, 0), initlist);
+
+ /* sibling_class = */
+ initlist = tree_cons (NULLT, build_int_2 (0, 0), initlist);
+ }
+
+ /* protocol_list = */
+ if (! protocol_list)
+ initlist = tree_cons (NULLT, build_int_2 (0, 0), initlist);
+ else
+ {
+ static tree cast_type2;
+
+ if (!cast_type2)
+ cast_type2
+ = groktypename
+ (build_tree_list
+ (build_tree_list (NULLT,
+ xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_PROTOCOL))),
+ build1 (INDIRECT_REF, NULLT,
+ build1 (INDIRECT_REF, NULLT, NULLT))));
+
+ expr = build_unary_op (ADDR_EXPR, protocol_list, 0);
+ TREE_TYPE (expr) = cast_type2;
+ initlist = tree_cons (NULLT, expr, initlist);
+ }
+
+ return build_nt (CONSTRUCTOR, NULLT, nreverse (initlist));
+}
+
+/* static struct objc_category _OBJC_CATEGORY_<name> = { ... }; */
+static void
+generate_category (cat)
+ tree cat;
+{
+ tree sc_spec, decl_specs, decl;
+ tree initlist, cat_name_expr, class_name_expr;
+ tree protocol_decl, category;
+
+ add_class_reference (CLASS_NAME (cat));
+ cat_name_expr = add_objc_string (CLASS_SUPER_NAME (cat), class_names);
+
+ class_name_expr = add_objc_string (CLASS_NAME (cat), class_names);
+
+ category = CLASS_CATEGORY_LIST (implementation_template);
+
+ /* find the category interface from the class it is associated with */
+ while (category)
+ {
+ if (CLASS_SUPER_NAME (cat) == CLASS_SUPER_NAME (category))
+ break;
+ category = CLASS_CATEGORY_LIST (category);
+ }
+
+ if (category && CLASS_PROTOCOL_LIST (category))
+ {
+ generate_protocol_references (CLASS_PROTOCOL_LIST (category));
+ protocol_decl = generate_protocol_list (category);
+ }
+ else
+ protocol_decl = 0;
+
+ sc_spec = tree_cons (NULLT, ridpointers[(int) RID_STATIC], NULLT);
+ decl_specs = tree_cons (NULLT, objc_category_template, sc_spec);
+
+ decl = start_decl (synth_id_with_class_suffix ("_OBJC_CATEGORY",
+ implementation_context),
+ decl_specs, 1);
+ end_temporary_allocation ();
+
+ initlist = build_category_initializer (cat_name_expr, class_name_expr,
+ UOBJC_INSTANCE_METHODS_decl,
+ UOBJC_CLASS_METHODS_decl,
+ protocol_decl);
+
+ TREE_USED (decl) = 1;
+ finish_decl (decl, initlist, NULLT);
+}
+
+/* static struct objc_class _OBJC_METACLASS_Foo={ ... };
+ static struct objc_class _OBJC_CLASS_Foo={ ... }; */
+
+static void
+generate_shared_structures ()
+{
+ tree sc_spec, decl_specs, decl;
+ tree name_expr, super_expr, root_expr;
+ tree my_root_id = NULLT, my_super_id = NULLT;
+ tree cast_type, initlist, protocol_decl;
+
+ my_super_id = CLASS_SUPER_NAME (implementation_template);
+ if (my_super_id)
+ {
+ add_class_reference (my_super_id);
+
+ /* Compute "my_root_id" - this is required for code generation.
+ the "isa" for all meta class structures points to the root of
+ the inheritance hierarchy (e.g. "__Object")... */
+ my_root_id = my_super_id;
+ do
+ {
+ tree my_root_int = lookup_interface (my_root_id);
+
+ if (my_root_int && CLASS_SUPER_NAME (my_root_int))
+ my_root_id = CLASS_SUPER_NAME (my_root_int);
+ else
+ break;
+ }
+ while (1);
+ }
+ else /* no super class */
+ {
+ my_root_id = CLASS_NAME (implementation_template);
+ }
+
+ cast_type
+ = groktypename (build_tree_list (build_tree_list (NULLT,
+ objc_class_template),
+ build1 (INDIRECT_REF, NULLT, NULLT)));
+
+ name_expr = add_objc_string (CLASS_NAME (implementation_template),
+ class_names);
+
+ /* install class `isa' and `super' pointers at runtime */
+ if (my_super_id)
+ {
+ super_expr = add_objc_string (my_super_id, class_names);
+ super_expr = build_c_cast (cast_type, super_expr); /* cast! */
+ }
+ else
+ super_expr = build_int_2 (0, 0);
+
+ root_expr = add_objc_string (my_root_id, class_names);
+ root_expr = build_c_cast (cast_type, root_expr); /* cast! */
+
+ if (CLASS_PROTOCOL_LIST (implementation_template))
+ {
+ generate_protocol_references (CLASS_PROTOCOL_LIST (implementation_template));
+ protocol_decl = generate_protocol_list (implementation_template);
+ }
+ else
+ protocol_decl = 0;
+
+ /* static struct objc_class _OBJC_METACLASS_Foo = { ... }; */
+
+ sc_spec = build_tree_list (NULLT, ridpointers[(int) RID_STATIC]);
+ decl_specs = tree_cons (NULLT, objc_class_template, sc_spec);
+
+ decl = start_decl (DECL_NAME (UOBJC_METACLASS_decl), decl_specs, 1);
+ end_temporary_allocation ();
+
+ initlist
+ = build_shared_structure_initializer
+ (root_expr, super_expr, name_expr,
+ build_int_2 ((TREE_INT_CST_LOW (TYPE_SIZE (objc_class_template))
+ / BITS_PER_UNIT),
+ 0),
+ 2 /*CLS_META*/,
+ UOBJC_CLASS_METHODS_decl,
+ UOBJC_CLASS_VARIABLES_decl,
+ protocol_decl);
+
+ finish_decl (decl, initlist, NULLT);
+
+ /* static struct objc_class _OBJC_CLASS_Foo={ ... }; */
+
+ decl = start_decl (DECL_NAME (UOBJC_CLASS_decl), decl_specs, 1);
+ end_temporary_allocation ();
+
+ initlist
+ = build_shared_structure_initializer
+ (build_unary_op (ADDR_EXPR, UOBJC_METACLASS_decl, 0),
+ super_expr, name_expr,
+ build_int_2 ((TREE_INT_CST_LOW (TYPE_SIZE (CLASS_STATIC_TEMPLATE (implementation_template)))
+ / BITS_PER_UNIT),
+ 0),
+ 1 /*CLS_FACTORY*/,
+ UOBJC_INSTANCE_METHODS_decl,
+ UOBJC_INSTANCE_VARIABLES_decl,
+ protocol_decl);
+
+ finish_decl (decl, initlist, NULLT);
+}
+
+static tree
+synth_id_with_class_suffix (preamble, ctxt)
+ char *preamble;
+ tree ctxt;
+{
+ char *string;
+ if (TREE_CODE (ctxt) == CLASS_IMPLEMENTATION_TYPE
+ || TREE_CODE (ctxt) == CLASS_INTERFACE_TYPE)
+ {
+ char *class_name
+ = IDENTIFIER_POINTER (CLASS_NAME (implementation_context));
+ string = (char *) alloca (strlen (preamble) + strlen (class_name) + 3);
+ sprintf (string, "%s_%s", preamble,
+ IDENTIFIER_POINTER (CLASS_NAME (ctxt)));
+ }
+ else if (TREE_CODE (ctxt) == CATEGORY_IMPLEMENTATION_TYPE
+ || TREE_CODE (ctxt) == CATEGORY_INTERFACE_TYPE)
+ {
+ /* we have a category */
+ char *class_name
+ = IDENTIFIER_POINTER (CLASS_NAME (implementation_context));
+ char *class_super_name
+ = IDENTIFIER_POINTER (CLASS_SUPER_NAME (implementation_context));
+ string = (char *) alloca (strlen (preamble)
+ + strlen (class_name)
+ + strlen (class_super_name)
+ + 3);
+ sprintf (string, "%s_%s_%s", preamble, class_name, class_super_name);
+ }
+ else if (TREE_CODE (ctxt) == PROTOCOL_INTERFACE_TYPE)
+ {
+ char *protocol_name = IDENTIFIER_POINTER (PROTOCOL_NAME (ctxt));
+ string = (char *) alloca (strlen (preamble) + strlen (protocol_name) + 3);
+ sprintf (string, "%s_%s", preamble, protocol_name);
+ }
+ return get_identifier (string);
+}
+
+static int
+is_objc_type_qualifier (node)
+ tree node;
+{
+ return (TREE_CODE (node) == IDENTIFIER_NODE
+ && (node == ridpointers [(int) RID_CONST]
+ || node == ridpointers [(int) RID_VOLATILE]
+ || node == ridpointers [(int) RID_IN]
+ || node == ridpointers [(int) RID_OUT]
+ || node == ridpointers [(int) RID_INOUT]
+ || node == ridpointers [(int) RID_BYCOPY]
+ || node == ridpointers [(int) RID_ONEWAY]));
+}
+
+/* If type is empty or only type qualifiers are present, add default
+ type of id (otherwise grokdeclarator will default to int). */
+
+static tree
+adjust_type_for_id_default (type)
+ tree type;
+{
+ tree declspecs, chain;
+
+ if (!type)
+ return build_tree_list (build_tree_list (NULLT, objc_object_reference),
+ build1 (INDIRECT_REF, NULLT, NULLT));
+
+ declspecs = TREE_PURPOSE (type);
+
+ /* Determine if a typespec is present. */
+ for (chain = declspecs;
+ chain;
+ chain = TREE_CHAIN (chain))
+ {
+ if (!is_objc_type_qualifier (TREE_VALUE (chain)))
+ return type;
+ }
+
+ return build_tree_list (tree_cons (NULLT, objc_object_reference, declspecs),
+ build1 (INDIRECT_REF, NULLT, NULLT));
+}
+
+/* usage:
+ keyworddecl:
+ selector ':' '(' typename ')' identifier
+
+ purpose:
+ transform an Objective-C keyword argument into
+ the C equivalent parameter declarator.
+
+ in: key_name, an "identifier_node" (optional).
+ arg_type, a "tree_list" (optional).
+ arg_name, an "identifier_node".
+
+ note: it would be really nice to strongly type the preceding
+ arguments in the function prototype; however, then i
+ could not use the "accessor" macros defined in "tree.h".
+
+ out: an instance of "keyword_decl". */
+
+tree
+build_keyword_decl (key_name, arg_type, arg_name)
+ tree key_name;
+ tree arg_type;
+ tree arg_name;
+{
+ tree keyword_decl;
+
+ /* if no type is specified, default to "id" */
+ arg_type = adjust_type_for_id_default (arg_type);
+
+ keyword_decl = make_node (KEYWORD_DECL);
+
+ TREE_TYPE (keyword_decl) = arg_type;
+ KEYWORD_ARG_NAME (keyword_decl) = arg_name;
+ KEYWORD_KEY_NAME (keyword_decl) = key_name;
+
+ return keyword_decl;
+}
+
+/* Given a chain of keyword_decl's, synthesize the full keyword selector. */
+static tree
+build_keyword_selector (selector)
+ tree selector;
+{
+ int len = 0;
+ tree key_chain, key_name;
+ char *buf;
+
+ for (key_chain = selector; key_chain; key_chain = TREE_CHAIN (key_chain))
+ {
+ if (TREE_CODE (selector) == KEYWORD_DECL)
+ key_name = KEYWORD_KEY_NAME (key_chain);
+ else if (TREE_CODE (selector) == TREE_LIST)
+ key_name = TREE_PURPOSE (key_chain);
+
+ if (key_name)
+ len += IDENTIFIER_LENGTH (key_name) + 1;
+ else /* just a ':' arg */
+ len++;
+ }
+ buf = (char *)alloca (len + 1);
+ bzero (buf, len + 1);
+
+ for (key_chain = selector; key_chain; key_chain = TREE_CHAIN (key_chain))
+ {
+ if (TREE_CODE (selector) == KEYWORD_DECL)
+ key_name = KEYWORD_KEY_NAME (key_chain);
+ else if (TREE_CODE (selector) == TREE_LIST)
+ key_name = TREE_PURPOSE (key_chain);
+
+ if (key_name)
+ strcat (buf, IDENTIFIER_POINTER (key_name));
+ strcat (buf, ":");
+ }
+ return get_identifier (buf);
+}
+
+/* used for declarations and definitions */
+
+tree
+build_method_decl (code, ret_type, selector, add_args)
+ enum tree_code code;
+ tree ret_type;
+ tree selector;
+ tree add_args;
+{
+ tree method_decl;
+
+ /* if no type is specified, default to "id" */
+ ret_type = adjust_type_for_id_default (ret_type);
+
+ method_decl = make_node (code);
+ TREE_TYPE (method_decl) = ret_type;
+
+ /* If we have a keyword selector, create an identifier_node that
+ represents the full selector name (`:' included)... */
+ if (TREE_CODE (selector) == KEYWORD_DECL)
+ {
+ METHOD_SEL_NAME (method_decl) = build_keyword_selector (selector);
+ METHOD_SEL_ARGS (method_decl) = selector;
+ METHOD_ADD_ARGS (method_decl) = add_args;
+ }
+ else
+ {
+ METHOD_SEL_NAME (method_decl) = selector;
+ METHOD_SEL_ARGS (method_decl) = NULLT;
+ METHOD_ADD_ARGS (method_decl) = NULLT;
+ }
+
+ return method_decl;
+}
+
+#define METHOD_DEF 0
+#define METHOD_REF 1
+
+/* Used by `build_message_expr' and `comp_method_types'. Return an
+ argument list for method METH. CONTEXT is either METHOD_DEF or
+ METHOD_REF, saying whether we are trying to define a method or call
+ one. SUPERFLAG says this is for a send to super; this makes a
+ difference for the NeXT calling sequence in which the lookup and
+ the method call are done together. */
+
+static tree
+get_arg_type_list (meth, context, superflag)
+ tree meth;
+ int context;
+ int superflag;
+{
+ tree arglist, akey;
+
+ /* receiver type */
+ if (flag_next_runtime && superflag)
+ arglist = build_tree_list (NULLT, super_type);
+ else if (context == METHOD_DEF)
+ arglist = build_tree_list (NULLT, TREE_TYPE (self_decl));
+ else
+ arglist = build_tree_list (NULLT, id_type);
+
+ /* selector type - will eventually change to `int' */
+ chainon (arglist, build_tree_list (NULLT, selector_type));
+
+ /* build a list of argument types */
+ for (akey = METHOD_SEL_ARGS (meth); akey; akey = TREE_CHAIN (akey))
+ {
+ tree arg_decl = groktypename_in_parm_context (TREE_TYPE (akey));
+ chainon (arglist, build_tree_list (NULLT, TREE_TYPE (arg_decl)));
+ }
+
+ if (METHOD_ADD_ARGS (meth) == (tree)1)
+ /* We have a `, ...' immediately following the selector,
+ finalize the arglist...simulate get_parm_info (0). */
+ ;
+ else if (METHOD_ADD_ARGS (meth))
+ {
+ /* we have a variable length selector */
+ tree add_arg_list = TREE_CHAIN (METHOD_ADD_ARGS (meth));
+ chainon (arglist, add_arg_list);
+ }
+ else
+ /* finalize the arglist...simulate get_parm_info (1) */
+ chainon (arglist, build_tree_list (NULLT, void_type_node));
+
+ return arglist;
+}
+
+static tree
+check_duplicates (hsh)
+ hash hsh;
+{
+ tree meth = NULLT;
+
+ if (hsh)
+ {
+ meth = hsh->key;
+
+ if (hsh->list)
+ {
+ /* we have two methods with the same name and different types */
+ attr loop;
+ char type = (TREE_CODE (meth) == INSTANCE_METHOD_DECL) ? '-' : '+';
+
+ warning ("multiple declarations for method `%s'",
+ IDENTIFIER_POINTER (METHOD_SEL_NAME (meth)));
+
+ warn_with_method ("using", type, meth);
+ for (loop = hsh->list; loop; loop = loop->next)
+ warn_with_method ("also found", type, loop->value);
+ }
+ }
+ return meth;
+}
+
+/* If RECEIVER is a class reference, return the identifier node for the
+ referenced class. RECEIVER is created by get_class_reference, so we
+ check the exact form created depending on which runtimes are used. */
+
+static tree
+receiver_is_class_object (receiver)
+ tree receiver;
+{
+ tree chain, exp, arg;
+ if (flag_next_runtime)
+ {
+ /* The receiver is a variable created by build_class_reference_decl. */
+ if (TREE_CODE (receiver) == VAR_DECL
+ && TREE_TYPE (receiver) == objc_class_type)
+ /* Look up the identifier. */
+ for (chain = cls_ref_chain; chain; chain = TREE_CHAIN (chain))
+ if (TREE_PURPOSE (chain) == receiver)
+ return TREE_VALUE (chain);
+ }
+ else
+ {
+ /* The receiver is a function call that returns an id. Check if
+ it is a call to objc_getClass, if so, pick up the class name. */
+ if ((exp = TREE_OPERAND (receiver, 0))
+ && TREE_CODE (exp) == ADDR_EXPR
+ && (exp = TREE_OPERAND (exp, 0))
+ && TREE_CODE (exp) == FUNCTION_DECL
+ && exp == objc_get_class_decl
+ /* we have a call to objc_getClass! */
+ && (arg = TREE_OPERAND (receiver, 1))
+ && TREE_CODE (arg) == TREE_LIST
+ && (arg = TREE_VALUE (arg)))
+ {
+ STRIP_NOPS (arg);
+ if (TREE_CODE (arg) == ADDR_EXPR
+ && (arg = TREE_OPERAND (arg, 0))
+ && TREE_CODE (arg) == STRING_CST)
+ /* finally, we have the class name */
+ return get_identifier (TREE_STRING_POINTER (arg));
+ }
+ }
+ return 0;
+}
+
+/* If we are currently building a message expr, this holds
+ the identifier of the selector of the message. This is
+ used when printing warnings about argument mismatches. */
+
+static tree building_objc_message_expr = 0;
+
+tree
+maybe_building_objc_message_expr ()
+{
+ return building_objc_message_expr;
+}
+
+/* Construct an expression for sending a message.
+ MESS has the object to send to in TREE_PURPOSE
+ and the argument list (including selector) in TREE_VALUE.
+
+ (*(<abstract_decl>(*)())_msg)(receiver, selTransTbl[n], ...);
+ (*(<abstract_decl>(*)())_msgSuper)(receiver, selTransTbl[n], ...); */
+
+tree
+build_message_expr (mess)
+ tree mess;
+{
+ tree receiver = TREE_PURPOSE (mess);
+ tree selector, self_object;
+ tree rtype, sel_name;
+ tree args = TREE_VALUE (mess);
+ tree method_params = NULLT;
+ tree method_prototype = NULLT;
+ tree retval;
+ int statically_typed = 0, statically_allocated = 0;
+ tree class_ident = 0;
+
+ /* 1 if this is sending to the superclass. */
+ int super;
+
+ if (!doing_objc_thang)
+ objc_fatal ();
+
+ if (TREE_CODE (receiver) == ERROR_MARK)
+ return error_mark_node;
+
+ /* determine receiver type */
+ rtype = TREE_TYPE (receiver);
+ super = IS_SUPER (rtype);
+
+ if (! super)
+ {
+ if (TREE_STATIC_TEMPLATE (rtype))
+ statically_allocated = 1;
+ else if (TREE_CODE (rtype) == POINTER_TYPE
+ && TREE_STATIC_TEMPLATE (TREE_TYPE (rtype)))
+ statically_typed = 1;
+ else if ((flag_next_runtime
+ || (TREE_CODE (receiver) == CALL_EXPR && IS_ID (rtype)))
+ && (class_ident = receiver_is_class_object (receiver)))
+ ;
+ else if (! IS_ID (rtype)
+ /* Allow any type that matches objc_class_type. */
+ && ! comptypes (rtype, objc_class_type))
+ {
+ bzero (errbuf, BUFSIZE);
+ warning ("invalid receiver type `%s'",
+ gen_declaration (rtype, errbuf));
+ }
+ if (statically_allocated)
+ receiver = build_unary_op (ADDR_EXPR, receiver, 0);
+
+ /* Don't evaluate the receiver twice. */
+ receiver = save_expr (receiver);
+ self_object = receiver;
+ }
+ else
+ /* If sending to `super', use current self as the object. */
+ self_object = self_decl;
+
+ /* Obtain the full selector name. */
+
+ if (TREE_CODE (args) == IDENTIFIER_NODE)
+ /* a unary selector */
+ sel_name = args;
+ else if (TREE_CODE (args) == TREE_LIST)
+ sel_name = build_keyword_selector (args);
+
+ /* Build the parameters list for looking up the method.
+ These are the object itself and the selector. */
+
+ selector = build_selector_reference (sel_name);
+
+ /* Build the parameter list to give to the method. */
+
+ method_params = NULLT;
+ if (TREE_CODE (args) == TREE_LIST)
+ {
+ tree chain = args, prev = NULLT;
+
+ /* We have a keyword selector--check for comma expressions. */
+ while (chain)
+ {
+ tree element = TREE_VALUE (chain);
+
+ /* We have a comma expression, must collapse... */
+ if (TREE_CODE (element) == TREE_LIST)
+ {
+ if (prev)
+ TREE_CHAIN (prev) = element;
+ else
+ args = element;
+ }
+ prev = chain;
+ chain = TREE_CHAIN (chain);
+ }
+ method_params = args;
+ }
+
+ /* Determine operation return type. */
+
+ if (IS_SUPER (rtype))
+ {
+ tree iface;
+
+ if (CLASS_SUPER_NAME (implementation_template))
+ {
+ iface = lookup_interface (CLASS_SUPER_NAME (implementation_template));
+
+ if (TREE_CODE (method_context) == INSTANCE_METHOD_DECL)
+ method_prototype = lookup_instance_method_static (iface, sel_name);
+ else
+ method_prototype = lookup_class_method_static (iface, sel_name);
+
+ if (iface && !method_prototype)
+ warning ("`%s' does not respond to `%s'",
+ IDENTIFIER_POINTER (CLASS_SUPER_NAME (implementation_template)),
+ IDENTIFIER_POINTER (sel_name));
+ }
+ else
+ {
+ error ("no super class declared in interface for `%s'",
+ IDENTIFIER_POINTER (CLASS_NAME (implementation_template)));
+ return error_mark_node;
+ }
+
+ }
+ else if (statically_allocated)
+ {
+ tree ctype = TREE_TYPE (rtype);
+ tree iface = lookup_interface (TYPE_NAME (rtype));
+
+ if (iface)
+ method_prototype = lookup_instance_method_static (iface, sel_name);
+
+ /* NEW!!! */
+ if (! method_prototype && TYPE_PROTOCOL_LIST (ctype))
+ method_prototype
+ = lookup_method_in_protocol_list (TYPE_PROTOCOL_LIST (ctype),
+ sel_name, 0);
+
+ if (!method_prototype)
+ warning ("`%s' does not respond to `%s'",
+ IDENTIFIER_POINTER (TYPE_NAME (rtype)),
+ IDENTIFIER_POINTER (sel_name));
+ }
+ else if (statically_typed)
+ {
+ tree ctype = TREE_TYPE (rtype);
+
+ /* `self' is now statically_typed...all methods should be visible
+ within the context of the implementation... */
+ if (implementation_context
+ && CLASS_NAME (implementation_context) == TYPE_NAME (ctype))
+ {
+ method_prototype = lookup_instance_method_static (implementation_template, sel_name);
+
+ /* NEW!!! */
+ if (! method_prototype && TYPE_PROTOCOL_LIST (ctype))
+ method_prototype
+ = lookup_method_in_protocol_list (TYPE_PROTOCOL_LIST (ctype),
+ sel_name, 0);
+
+ if (! method_prototype
+ && implementation_template != implementation_context)
+ /* the method is not published in the interface...check locally */
+ method_prototype
+ = lookup_method (CLASS_NST_METHODS (implementation_context),
+ sel_name);
+ }
+ else
+ {
+ tree iface;
+
+ if ((iface = lookup_interface (TYPE_NAME (ctype))))
+ method_prototype = lookup_instance_method_static (iface, sel_name);
+
+ if (! method_prototype)
+ {
+ tree protocol_list = TYPE_PROTOCOL_LIST (ctype);
+ if (protocol_list)
+ method_prototype
+ = lookup_method_in_protocol_list (protocol_list, sel_name, 0);
+ }
+ }
+
+ if (!method_prototype)
+ warning ("`%s' does not respond to `%s'",
+ IDENTIFIER_POINTER (TYPE_NAME (ctype)),
+ IDENTIFIER_POINTER (sel_name));
+ }
+ else if (class_ident)
+ {
+ if (implementation_context
+ && CLASS_NAME (implementation_context) == class_ident)
+ {
+ method_prototype
+ = lookup_class_method_static (implementation_template, sel_name);
+
+ if (!method_prototype
+ && implementation_template != implementation_context)
+ /* the method is not published in the interface...check locally */
+ method_prototype
+ = lookup_method (CLASS_CLS_METHODS (implementation_context),
+ sel_name);
+ }
+ else
+ {
+ tree iface;
+
+ if ((iface = lookup_interface (class_ident)))
+ method_prototype = lookup_class_method_static (iface, sel_name);
+ }
+
+ if (!method_prototype)
+ {
+ warning ("cannot find class (factory) method.");
+ warning ("return type for `%s' defaults to id",
+ IDENTIFIER_POINTER (sel_name));
+ }
+ }
+ else if (IS_PROTOCOL_QUALIFIED_ID (rtype))
+ {
+ /* An anonymous object that has been qualified with a protocol. */
+
+ tree protocol_list = TYPE_PROTOCOL_LIST (rtype);
+
+ method_prototype = lookup_method_in_protocol_list (protocol_list,
+ sel_name, 0);
+
+ if (!method_prototype)
+ {
+ hash hsh;
+
+ warning ("method `%s' not implemented by protocol.",
+ IDENTIFIER_POINTER (sel_name));
+
+ /* try and find the method signiture in the global pools! */
+
+ if (!(hsh = hash_lookup (nst_method_hash_list, sel_name)))
+ hsh = hash_lookup (cls_method_hash_list, sel_name);
+
+ if (!(method_prototype = check_duplicates (hsh)))
+ warning ("return type defaults to id");
+ }
+ }
+ else
+ {
+ hash hsh;
+
+ /* we think we have an instance...loophole: extern id Object; */
+ hsh = hash_lookup (nst_method_hash_list, sel_name);
+ if (!hsh)
+ /* for various loopholes...like sending messages to self in a
+ factory context... */
+ hsh = hash_lookup (cls_method_hash_list, sel_name);
+
+ method_prototype = check_duplicates (hsh);
+ if (!method_prototype)
+ {
+ warning ("cannot find method.");
+ warning ("return type for `%s' defaults to id",
+ IDENTIFIER_POINTER (sel_name));
+ }
+ }
+
+ /* Save the selector name for printing error messages. */
+ building_objc_message_expr = sel_name;
+
+ retval = build_objc_method_call (super, method_prototype,
+ receiver, self_object,
+ selector, method_params);
+
+ building_objc_message_expr = 0;
+
+ return retval;
+}
+
+/* Build a tree expression to send OBJECT the operation SELECTOR,
+ looking up the method on object LOOKUP_OBJECT (often same as OBJECT),
+ assuming the method has prototype METHOD_PROTOTYPE.
+ (That is an INSTANCE_METHOD_DECL or CLASS_METHOD_DECL.)
+ Use METHOD_PARAMS as list of args to pass to the method.
+ If SUPER_FLAG is nonzero, we look up the superclass's method. */
+
+static tree
+build_objc_method_call (super_flag, method_prototype, lookup_object, object,
+ selector, method_params)
+ int super_flag;
+ tree method_prototype, lookup_object, object, selector, method_params;
+{
+ tree sender = (super_flag ? umsg_super_decl : umsg_decl);
+ tree rcv_p = (super_flag
+ ? build_pointer_type (xref_tag (RECORD_TYPE,
+ get_identifier (TAG_SUPER)))
+ : id_type);
+
+ if (flag_next_runtime)
+ {
+ if (! method_prototype)
+ {
+ method_params = tree_cons (NULLT, lookup_object,
+ tree_cons (NULLT, selector,
+ method_params));
+ assemble_external (sender);
+ return build_function_call (sender, method_params);
+ }
+ else
+ {
+ /* This is a real kludge, but it is used only for the Next.
+ Clobber the data type of SENDER temporarily to accept
+ all the arguments for this operation, and to return
+ whatever this operation returns. */
+ tree arglist = NULLT;
+ tree retval;
+
+ /* Save the proper contents of SENDER's data type. */
+ tree savarg = TYPE_ARG_TYPES (TREE_TYPE (sender));
+ tree savret = TREE_TYPE (TREE_TYPE (sender));
+
+ /* Install this method's argument types. */
+ arglist = get_arg_type_list (method_prototype, METHOD_REF,
+ super_flag);
+ TYPE_ARG_TYPES (TREE_TYPE (sender)) = arglist;
+
+ /* Install this method's return type. */
+ TREE_TYPE (TREE_TYPE (sender))
+ = groktypename (TREE_TYPE (method_prototype));
+
+ /* Call SENDER with all the parameters. This will do type
+ checking using the arg types for this method. */
+ method_params = tree_cons (NULLT, lookup_object,
+ tree_cons (NULLT, selector,
+ method_params));
+ assemble_external (sender);
+ retval = build_function_call (sender, method_params);
+
+ /* Restore SENDER's return/argument types. */
+ TYPE_ARG_TYPES (TREE_TYPE (sender)) = savarg;
+ TREE_TYPE (TREE_TYPE (sender)) = savret;
+ return retval;
+ }
+ }
+ else
+ {
+ /* This is the portable way.
+ First call the lookup function to get a pointer to the method,
+ then cast the pointer, then call it with the method arguments. */
+ tree method;
+
+ /* Avoid trouble since we may evaluate each of these twice. */
+ object = save_expr (object);
+ selector = save_expr (selector);
+
+ lookup_object = build_c_cast (rcv_p, lookup_object); /* cast! */
+
+ assemble_external (sender);
+ method
+ = build_function_call (sender,
+ tree_cons (NULLT, lookup_object,
+ tree_cons (NULLT, selector, NULLT)));
+
+ /* If we have a method prototype, construct the data type this
+ method needs, and cast what we got from SENDER into a pointer
+ to that type. */
+ if (method_prototype)
+ {
+ tree arglist = get_arg_type_list (method_prototype, METHOD_REF,
+ super_flag);
+ tree valtype = groktypename (TREE_TYPE (method_prototype));
+ tree fake_function_type = build_function_type (valtype, arglist);
+ TREE_TYPE (method) = build_pointer_type (fake_function_type);
+ }
+ else
+ TREE_TYPE (method)
+ = build_pointer_type (build_function_type (ptr_type_node, NULLT));
+
+ /* Pass the object to the method. */
+ assemble_external (method);
+ return build_function_call (method,
+ tree_cons (NULLT, object,
+ tree_cons (NULLT, selector,
+ method_params)));
+ }
+}
+
+static void
+build_protocol_reference (p)
+ tree p;
+{
+ tree decl, ident, ptype;
+ struct obstack *save_current_obstack = current_obstack;
+ struct obstack *save_rtl_obstack = rtl_obstack;
+
+ rtl_obstack = current_obstack = &permanent_obstack;
+
+ /* extern struct objc_protocol _OBJC_PROTOCOL_<mumble>; */
+
+ ident = synth_id_with_class_suffix ("_OBJC_PROTOCOL", p);
+ ptype
+ = groktypename (build_tree_list (build_tree_list (NULLT,
+ objc_protocol_template),
+ NULLT));
+
+ if (IDENTIFIER_GLOBAL_VALUE (ident))
+ decl = IDENTIFIER_GLOBAL_VALUE (ident); /* Set by pushdecl. */
+ else
+ {
+ decl = build_decl (VAR_DECL, ident, ptype);
+ DECL_EXTERNAL (decl) = 1;
+ TREE_PUBLIC (decl) = 1;
+ TREE_USED (decl) = 1;
+
+ /* usually called from `rest_of_decl_compilation' */
+ make_decl_rtl (decl, 0, 1);
+ /* our `extended/custom' pushdecl in c-decl.c */
+ pushdecl_top_level (decl);
+ }
+ current_obstack = save_current_obstack;
+ rtl_obstack = save_rtl_obstack;
+
+ PROTOCOL_FORWARD_DECL (p) = decl;
+}
+
+tree
+build_protocol_expr (protoname)
+ tree protoname;
+{
+ tree expr;
+ tree p;
+
+ if (!doing_objc_thang)
+ objc_fatal ();
+
+ p = lookup_protocol (protoname);
+
+ if (!p)
+ {
+ error ("Cannot find protocol declaration for `%s'",
+ IDENTIFIER_POINTER (protoname));
+ return error_mark_node;
+ }
+
+ if (!PROTOCOL_FORWARD_DECL (p))
+ build_protocol_reference (p);
+
+ expr = build_unary_op (ADDR_EXPR, PROTOCOL_FORWARD_DECL (p), 0);
+
+ TREE_TYPE (expr) = protocol_type;
+
+ return expr;
+}
+
+tree
+build_selector_expr (selnamelist)
+ tree selnamelist;
+{
+ tree selname;
+
+ if (!doing_objc_thang)
+ objc_fatal ();
+
+ /* obtain the full selector name */
+ if (TREE_CODE (selnamelist) == IDENTIFIER_NODE)
+ /* a unary selector */
+ selname = selnamelist;
+ else if (TREE_CODE (selnamelist) == TREE_LIST)
+ selname = build_keyword_selector (selnamelist);
+
+ return build_selector_reference (selname);
+}
+
+tree
+build_encode_expr (type)
+ tree type;
+{
+ tree result;
+ char *string;
+
+ if (!doing_objc_thang)
+ objc_fatal ();
+
+ encode_type (type, obstack_object_size (&util_obstack),
+ OBJC_ENCODE_INLINE_DEFS);
+ obstack_1grow (&util_obstack, 0); /* null terminate string */
+ string = obstack_finish (&util_obstack);
+
+ /* synthesize a string that represents the encoded struct/union */
+ result = my_build_string (strlen (string) + 1, string);
+ obstack_free (&util_obstack, util_firstobj);
+ return result;
+}
+
+tree
+build_ivar_reference (id)
+ tree id;
+{
+ if (TREE_CODE (method_context) == CLASS_METHOD_DECL)
+ {
+ /* Historically, a class method that produced objects (factory
+ method) would assign `self' to the instance that it
+ allocated. This would effectively turn the class method into
+ an instance method. Following this assignment, the instance
+ variables could be accessed. That practice, while safe,
+ violates the simple rule that a class method should not refer
+ to an instance variable. It's better to catch the cases
+ where this is done unknowingly than to support the above
+ paradigm. */
+ warning ("instance variable `%s' accessed in class method",
+ IDENTIFIER_POINTER (id));
+ TREE_TYPE (self_decl) = instance_type; /* cast */
+ }
+
+ return build_component_ref (build_indirect_ref (self_decl, "->"), id);
+}
+
+#define HASH_ALLOC_LIST_SIZE 170
+#define ATTR_ALLOC_LIST_SIZE 170
+#define SIZEHASHTABLE 257
+
+/* make positive */
+#define HASHFUNCTION(key) ((HOST_WIDE_INT) key & 0x7fffffff)
+
+static void
+hash_init ()
+{
+ nst_method_hash_list = (hash *)xmalloc (SIZEHASHTABLE * sizeof (hash));
+ cls_method_hash_list = (hash *)xmalloc (SIZEHASHTABLE * sizeof (hash));
+
+ if (!nst_method_hash_list || !cls_method_hash_list)
+ perror ("unable to allocate space in objc-tree.c");
+ else
+ {
+ int i;
+
+ for (i = 0; i < SIZEHASHTABLE; i++)
+ {
+ nst_method_hash_list[i] = 0;
+ cls_method_hash_list[i] = 0;
+ }
+ }
+}
+
+static void
+hash_enter (hashlist, method)
+ hash *hashlist;
+ tree method;
+{
+ static hash hash_alloc_list = 0;
+ static int hash_alloc_index = 0;
+ hash obj;
+ int slot = HASHFUNCTION (METHOD_SEL_NAME (method)) % SIZEHASHTABLE;
+
+ if (! hash_alloc_list || hash_alloc_index >= HASH_ALLOC_LIST_SIZE)
+ {
+ hash_alloc_index = 0;
+ hash_alloc_list = (hash) xmalloc (sizeof (struct hashed_entry)
+ * HASH_ALLOC_LIST_SIZE);
+ if (! hash_alloc_list)
+ perror ("unable to allocate in objc-tree.c");
+ }
+ obj = &hash_alloc_list[hash_alloc_index++];
+ obj->list = 0;
+ obj->next = hashlist[slot];
+ obj->key = method;
+
+ hashlist[slot] = obj; /* append to front */
+}
+
+static hash
+hash_lookup (hashlist, sel_name)
+ hash *hashlist;
+ tree sel_name;
+{
+ hash target;
+
+ target = hashlist[HASHFUNCTION (sel_name) % SIZEHASHTABLE];
+
+ while (target)
+ {
+ if (sel_name == METHOD_SEL_NAME (target->key))
+ return target;
+
+ target = target->next;
+ }
+ return 0;
+}
+
+static void
+hash_add_attr (entry, value)
+ hash entry;
+ tree value;
+{
+ static attr attr_alloc_list = 0;
+ static int attr_alloc_index = 0;
+ attr obj;
+
+ if (! attr_alloc_list || attr_alloc_index >= ATTR_ALLOC_LIST_SIZE)
+ {
+ attr_alloc_index = 0;
+ attr_alloc_list = (attr) xmalloc (sizeof (struct hashed_attribute)
+ * ATTR_ALLOC_LIST_SIZE);
+ if (! attr_alloc_list)
+ perror ("unable to allocate in objc-tree.c");
+ }
+ obj = &attr_alloc_list[attr_alloc_index++];
+ obj->next = entry->list;
+ obj->value = value;
+
+ entry->list = obj; /* append to front */
+}
+
+static tree
+lookup_method (mchain, method)
+ tree mchain;
+ tree method;
+{
+ tree key;
+
+ if (TREE_CODE (method) == IDENTIFIER_NODE)
+ key = method;
+ else
+ key = METHOD_SEL_NAME (method);
+
+ while (mchain)
+ {
+ if (METHOD_SEL_NAME (mchain) == key)
+ return mchain;
+ mchain = TREE_CHAIN (mchain);
+ }
+ return NULLT;
+}
+
+static tree
+lookup_instance_method_static (interface, ident)
+ tree interface;
+ tree ident;
+{
+ tree inter = interface;
+ tree chain = CLASS_NST_METHODS (inter);
+ tree meth = NULLT;
+
+ do
+ {
+ if ((meth = lookup_method (chain, ident)))
+ return meth;
+
+ if (CLASS_CATEGORY_LIST (inter))
+ {
+ tree category = CLASS_CATEGORY_LIST (inter);
+ chain = CLASS_NST_METHODS (category);
+
+ do
+ {
+ if ((meth = lookup_method (chain, ident)))
+ return meth;
+
+ /* NEW!!! */
+ /* Check for instance methods in protocols in categories. */
+ if (CLASS_PROTOCOL_LIST (category))
+ {
+ if ((meth = (lookup_method_in_protocol_list
+ (CLASS_PROTOCOL_LIST (category), ident, 0))))
+ return meth;
+ }
+
+ if ((category = CLASS_CATEGORY_LIST (category)))
+ chain = CLASS_NST_METHODS (category);
+ }
+ while (category);
+ }
+
+ if (CLASS_PROTOCOL_LIST (inter))
+ {
+ if ((meth = (lookup_method_in_protocol_list
+ (CLASS_PROTOCOL_LIST (inter), ident, 0))))
+ return meth;
+ }
+
+ if ((inter = lookup_interface (CLASS_SUPER_NAME (inter))))
+ chain = CLASS_NST_METHODS (inter);
+ }
+ while (inter);
+
+ return meth;
+}
+
+static tree
+lookup_class_method_static (interface, ident)
+ tree interface;
+ tree ident;
+{
+ tree inter = interface;
+ tree chain = CLASS_CLS_METHODS (inter);
+ tree meth = NULLT;
+ tree root_inter = NULLT;
+
+ do
+ {
+ if ((meth = lookup_method (chain, ident)))
+ return meth;
+
+ if (CLASS_CATEGORY_LIST (inter))
+ {
+ tree category = CLASS_CATEGORY_LIST (inter);
+ chain = CLASS_CLS_METHODS (category);
+
+ do
+ {
+ if ((meth = lookup_method (chain, ident)))
+ return meth;
+
+ /* NEW!!! */
+ /* Check for class methods in protocols in categories. */
+ if (CLASS_PROTOCOL_LIST (category))
+ {
+ if ((meth = (lookup_method_in_protocol_list
+ (CLASS_PROTOCOL_LIST (category), ident, 1))))
+ return meth;
+ }
+
+ if ((category = CLASS_CATEGORY_LIST (category)))
+ chain = CLASS_CLS_METHODS (category);
+ }
+ while (category);
+ }
+
+ /* NEW!!! */
+ /* Check for class methods in protocols. */
+ if (CLASS_PROTOCOL_LIST (inter))
+ {
+ if ((meth = (lookup_method_in_protocol_list
+ (CLASS_PROTOCOL_LIST (inter), ident, 1))))
+ return meth;
+ }
+
+ root_inter = inter;
+ if ((inter = lookup_interface (CLASS_SUPER_NAME (inter))))
+ chain = CLASS_CLS_METHODS (inter);
+ }
+ while (inter);
+
+/* NEW!!! */
+ /* Simulate wrap around. */
+ return lookup_instance_method_static (root_inter, ident);
+}
+
+tree
+add_class_method (class, method)
+ tree class;
+ tree method;
+{
+ tree mth;
+ hash hsh;
+
+ /* We will have allocated the method parameter declarations on the
+ maybepermanent_obstack. Need to make sure they stick around! */
+ preserve_data ();
+
+ if (!(mth = lookup_method (CLASS_CLS_METHODS (class), method)))
+ {
+ /* put method on list in reverse order */
+ TREE_CHAIN (method) = CLASS_CLS_METHODS (class);
+ CLASS_CLS_METHODS (class) = method;
+ }
+ else
+ {
+ if (TREE_CODE (class) == CLASS_IMPLEMENTATION_TYPE)
+ error ("duplicate definition of class method `%s'.",
+ IDENTIFIER_POINTER (METHOD_SEL_NAME (mth)));
+ else
+ {
+ /* check types, if different complain */
+ if (!comp_proto_with_proto (method, mth))
+ error ("duplicate declaration of class method `%s'.",
+ IDENTIFIER_POINTER (METHOD_SEL_NAME (mth)));
+ }
+ }
+
+ if (!(hsh = hash_lookup (cls_method_hash_list, METHOD_SEL_NAME (method))))
+ {
+ /* install on a global chain */
+ hash_enter (cls_method_hash_list, method);
+ }
+ else
+ {
+ /* check types, if different add to a list */
+ if (!comp_proto_with_proto (method, hsh->key))
+ hash_add_attr (hsh, method);
+ }
+ return method;
+}
+
+tree
+add_instance_method (class, method)
+ tree class;
+ tree method;
+{
+ tree mth;
+ hash hsh;
+
+ /* We will have allocated the method parameter declarations on the
+ maybepermanent_obstack. Need to make sure they stick around! */
+ preserve_data ();
+
+ if (!(mth = lookup_method (CLASS_NST_METHODS (class), method)))
+ {
+ /* put method on list in reverse order */
+ TREE_CHAIN (method) = CLASS_NST_METHODS (class);
+ CLASS_NST_METHODS (class) = method;
+ }
+ else
+ {
+ if (TREE_CODE (class) == CLASS_IMPLEMENTATION_TYPE)
+ error ("duplicate definition of instance method `%s'.",
+ IDENTIFIER_POINTER (METHOD_SEL_NAME (mth)));
+ else
+ {
+ /* check types, if different complain */
+ if (!comp_proto_with_proto (method, mth))
+ error ("duplicate declaration of instance method `%s'.",
+ IDENTIFIER_POINTER (METHOD_SEL_NAME (mth)));
+ }
+ }
+
+ if (!(hsh = hash_lookup (nst_method_hash_list, METHOD_SEL_NAME (method))))
+ {
+ /* install on a global chain */
+ hash_enter (nst_method_hash_list, method);
+ }
+ else
+ {
+ /* check types, if different add to a list */
+ if (!comp_proto_with_proto (method, hsh->key))
+ hash_add_attr (hsh, method);
+ }
+ return method;
+}
+
+static tree
+add_class (class)
+ tree class;
+{
+ /* put interfaces on list in reverse order */
+ TREE_CHAIN (class) = interface_chain;
+ interface_chain = class;
+ return interface_chain;
+}
+
+static void
+add_category (class, category)
+ tree class;
+ tree category;
+{
+ /* put categories on list in reverse order */
+
+ tree cat = CLASS_CATEGORY_LIST (class);
+ while (cat)
+ {
+ if (CLASS_SUPER_NAME (cat) == CLASS_SUPER_NAME (category))
+ warning ("duplicate interface declaration for category `%s(%s)'",
+ IDENTIFIER_POINTER (CLASS_NAME (class)),
+ IDENTIFIER_POINTER (CLASS_SUPER_NAME (category)));
+ cat = CLASS_CATEGORY_LIST (cat);
+ }
+
+ CLASS_CATEGORY_LIST (category) = CLASS_CATEGORY_LIST (class);
+ CLASS_CATEGORY_LIST (class) = category;
+}
+
+/* Called after parsing each instance variable declaration. Necessary to
+ preserve typedefs and implement public/private...
+
+ PUBLIC is 1 for public, 0 for protected, and 2 for private. */
+
+tree
+add_instance_variable (class, public, declarator, declspecs, width)
+ tree class;
+ int public;
+ tree declarator;
+ tree declspecs;
+ tree width;
+{
+ tree field_decl, raw_decl;
+
+ raw_decl = build_tree_list (declspecs /*purpose*/, declarator/*value*/);
+
+ if (CLASS_RAW_IVARS (class))
+ chainon (CLASS_RAW_IVARS (class), raw_decl);
+ else
+ CLASS_RAW_IVARS (class) = raw_decl;
+
+ field_decl = grokfield (input_filename, lineno,
+ declarator, declspecs, width);
+
+ /* overload the public attribute, it is not used for FIELD_DECL's */
+ switch (public)
+ {
+ case 0:
+ TREE_PUBLIC (field_decl) = 0;
+ TREE_PRIVATE (field_decl) = 0;
+ TREE_PROTECTED (field_decl) = 1;
+ break;
+
+ case 1:
+ TREE_PUBLIC (field_decl) = 1;
+ TREE_PRIVATE (field_decl) = 0;
+ TREE_PROTECTED (field_decl) = 0;
+ break;
+
+ case 2:
+ TREE_PUBLIC (field_decl) = 0;
+ TREE_PRIVATE (field_decl) = 1;
+ TREE_PROTECTED (field_decl) = 0;
+ break;
+
+ }
+
+ if (CLASS_IVARS (class))
+ chainon (CLASS_IVARS (class), field_decl);
+ else
+ CLASS_IVARS (class) = field_decl;
+
+ return class;
+}
+
+tree
+is_ivar (decl_chain, ident)
+ tree decl_chain;
+ tree ident;
+{
+ for ( ; decl_chain; decl_chain = TREE_CHAIN (decl_chain))
+ if (DECL_NAME (decl_chain) == ident)
+ return decl_chain;
+ return NULL_TREE;
+}
+
+/* True if the ivar is private and we are not in its implementation. */
+
+int
+is_private (decl)
+ tree decl;
+{
+ if (TREE_PRIVATE (decl)
+ && ! is_ivar (CLASS_IVARS (implementation_template), DECL_NAME (decl)))
+ {
+ error ("instance variable `%s' is declared private",
+ IDENTIFIER_POINTER (DECL_NAME (decl)));
+ return 1;
+ }
+ else
+ return 0;
+}
+
+/* we have an instance variable reference, check to see if it is public...*/
+
+int
+is_public (expr, identifier)
+ tree expr;
+ tree identifier;
+{
+ tree basetype = TREE_TYPE (expr);
+ enum tree_code code = TREE_CODE (basetype);
+ tree decl;
+
+ if (code == RECORD_TYPE)
+ {
+ if (TREE_STATIC_TEMPLATE (basetype))
+ {
+ if (!lookup_interface (TYPE_NAME (basetype)))
+ {
+ error ("Cannot find interface declaration for `%s'",
+ IDENTIFIER_POINTER (TYPE_NAME (basetype)));
+ return 0;
+ }
+
+ if ((decl = is_ivar (TYPE_FIELDS (basetype), identifier)))
+ {
+ if (TREE_PUBLIC (decl))
+ return 1;
+
+ /* important difference between the Stepstone translator:
+ all instance variables should be public within the context
+ of the implementation. */
+ if (implementation_context
+ && (((TREE_CODE (implementation_context)
+ == CLASS_IMPLEMENTATION_TYPE)
+ || (TREE_CODE (implementation_context)
+ == CATEGORY_IMPLEMENTATION_TYPE))
+ && (CLASS_NAME (implementation_context)
+ == TYPE_NAME (basetype))))
+ return ! is_private (decl);
+
+ error ("instance variable `%s' is declared %s",
+ IDENTIFIER_POINTER (identifier),
+ TREE_PRIVATE (decl) ? "private" : "protected");
+ return 0;
+ }
+ }
+ else if (implementation_context && (basetype == objc_object_reference))
+ {
+ TREE_TYPE (expr) = uprivate_record;
+ warning ("static access to object of type `id'");
+ }
+ }
+ return 1;
+}
+
+/* implement @defs (<classname>) within struct bodies. */
+
+tree
+get_class_ivars (interface)
+ tree interface;
+{
+ if (!doing_objc_thang)
+ objc_fatal ();
+
+ return build_ivar_chain (interface, 1);
+}
+
+/* make sure all entries in "chain" are also in "list" */
+
+static int
+check_methods (chain, list, mtype)
+ tree chain;
+ tree list;
+ int mtype;
+{
+ int first = 1;
+
+ while (chain)
+ {
+ if (!lookup_method (list, chain))
+ {
+ if (first)
+ {
+ if (TREE_CODE (implementation_context) == CLASS_IMPLEMENTATION_TYPE)
+ warning ("incomplete implementation of class `%s'",
+ IDENTIFIER_POINTER (CLASS_NAME (implementation_context)));
+ else if (TREE_CODE (implementation_context) == CATEGORY_IMPLEMENTATION_TYPE)
+ warning ("incomplete implementation of category `%s'",
+ IDENTIFIER_POINTER (CLASS_SUPER_NAME (implementation_context)));
+ first = 0;
+ }
+ warning ("method definition for `%c%s' not found",
+ mtype, IDENTIFIER_POINTER (METHOD_SEL_NAME (chain)));
+ }
+ chain = TREE_CHAIN (chain);
+ }
+ return first;
+}
+
+static int
+conforms_to_protocol (class, protocol)
+tree class;
+tree protocol;
+{
+ while (protocol)
+ {
+ tree p = CLASS_PROTOCOL_LIST (class);
+ while (p && TREE_VALUE (p) != TREE_VALUE (protocol))
+ p = TREE_CHAIN (p);
+ if (!p)
+ {
+ tree super = (CLASS_SUPER_NAME (class)
+ ? lookup_interface (CLASS_SUPER_NAME (class))
+ : NULL_TREE);
+ int tmp = super ? conforms_to_protocol (super, protocol) : 0;
+ if (!tmp)
+ return 0;
+ }
+ protocol = TREE_CHAIN (protocol);
+ }
+ return 1;
+}
+
+/* Make sure all methods in CHAIN are accessible as MTYPE methods in
+ CONTEXT. This is one of two mechanisms to check protocol integrity
+*/
+
+static int
+check_methods_accessible (chain, context, mtype)
+ tree chain;
+ tree context; /* implementation_context */
+ int mtype;
+{
+ int first = 1;
+ tree list;
+
+ while (chain)
+ {
+ while (context)
+ {
+ if (mtype == '+')
+ list = CLASS_CLS_METHODS (context);
+ else
+ list = CLASS_NST_METHODS (context);
+
+ if (lookup_method (list, chain))
+ break;
+
+ else if (TREE_CODE (context) == CLASS_IMPLEMENTATION_TYPE
+ || TREE_CODE (context) == CLASS_INTERFACE_TYPE)
+ context = (CLASS_SUPER_NAME (context)
+ ? lookup_interface (CLASS_SUPER_NAME (context))
+ : NULL_TREE);
+
+ else if (TREE_CODE (context) == CATEGORY_IMPLEMENTATION_TYPE
+ || TREE_CODE (context) == CATEGORY_INTERFACE_TYPE)
+ context = (CLASS_NAME (context)
+ ? lookup_interface (CLASS_NAME (context))
+ : NULL_TREE);
+ else
+ abort ();
+ }
+
+ if (context == NULL_TREE)
+ {
+ if (first)
+ {
+ if (TREE_CODE (implementation_context)
+ == CLASS_IMPLEMENTATION_TYPE)
+ warning ("incomplete implementation of class `%s'",
+ IDENTIFIER_POINTER
+ (CLASS_NAME (implementation_context)));
+ else if (TREE_CODE (implementation_context)
+ == CATEGORY_IMPLEMENTATION_TYPE)
+ warning ("incomplete implementation of category `%s'",
+ IDENTIFIER_POINTER
+ (CLASS_SUPER_NAME (implementation_context)));
+ first = 0;
+ }
+ warning ("method definition for `%c%s' not found",
+ mtype, IDENTIFIER_POINTER (METHOD_SEL_NAME (chain)));
+ }
+
+ chain = TREE_CHAIN (chain); /* next method... */
+ }
+ return first;
+}
+
+static void
+check_protocols (proto_list, type, name)
+ tree proto_list;
+ char *type;
+ char *name;
+{
+ for ( ; proto_list; proto_list = TREE_CHAIN (proto_list))
+ {
+ tree p = TREE_VALUE (proto_list);
+
+ if (TREE_CODE (p) == PROTOCOL_INTERFACE_TYPE)
+ {
+ int f1, f2;
+
+ /* Ensure that all protocols have bodies! */
+ if (flag_warn_protocol) {
+ f1 = check_methods (PROTOCOL_CLS_METHODS (p),
+ CLASS_CLS_METHODS (implementation_context),
+ '+');
+ f2 = check_methods (PROTOCOL_NST_METHODS (p),
+ CLASS_NST_METHODS (implementation_context),
+ '-');
+ } else {
+ f1 = check_methods_accessible (PROTOCOL_CLS_METHODS (p),
+ implementation_context,
+ '+');
+ f2 = check_methods_accessible (PROTOCOL_NST_METHODS (p),
+ implementation_context,
+ '-');
+ }
+
+ if (!f1 || !f2)
+ warning ("%s `%s' does not fully implement the `%s' protocol",
+ type, name, IDENTIFIER_POINTER (PROTOCOL_NAME (p)));
+
+ }
+ else
+ ; /* an identifier...if we could not find a protocol. */
+
+ /* Check protocols recursively. */
+ if (PROTOCOL_LIST (p))
+ {
+ tree super_class
+ = lookup_interface (CLASS_SUPER_NAME (implementation_template));
+ if (! conforms_to_protocol (super_class, PROTOCOL_LIST (p)))
+ check_protocols (PROTOCOL_LIST (p), type, name);
+ }
+ }
+}
+
+/* Make sure that the class CLASS_NAME is defined
+ CODE says which kind of thing CLASS_NAME ought to be.
+ It can be CLASS_INTERFACE_TYPE, CLASS_IMPLEMENTATION_TYPE,
+ CATEGORY_INTERFACE_TYPE, or CATEGORY_IMPLEMENTATION_TYPE.
+
+ If CODE is CLASS_INTERFACE_TYPE, we also do a push_obstacks_nochange
+ whose matching pop is in continue_class. */
+
+tree
+start_class (code, class_name, super_name, protocol_list)
+ enum tree_code code;
+ tree class_name;
+ tree super_name;
+ tree protocol_list;
+{
+ tree class, decl;
+
+ if (code == CLASS_INTERFACE_TYPE)
+ {
+ push_obstacks_nochange ();
+ end_temporary_allocation ();
+ }
+
+ if (!doing_objc_thang)
+ objc_fatal ();
+
+ class = make_node (code);
+ TYPE_BINFO (class) = make_tree_vec (5);
+
+ CLASS_NAME (class) = class_name;
+ CLASS_SUPER_NAME (class) = super_name;
+ CLASS_CLS_METHODS (class) = NULL_TREE;
+
+ if (! is_class_name (class_name) && (decl = lookup_name (class_name)))
+ {
+ error ("`%s' redeclared as different kind of symbol",
+ IDENTIFIER_POINTER (class_name));
+ error_with_decl (decl, "previous declaration of `%s'");
+ }
+
+ if (code == CLASS_IMPLEMENTATION_TYPE)
+ {
+ {
+ static tree implemented_classes = 0;
+ tree chain = implemented_classes;
+ for (chain = implemented_classes; chain; chain = TREE_CHAIN (chain))
+ if (TREE_VALUE (chain) == class_name)
+ {
+ error ("reimplementation of class `%s'",
+ IDENTIFIER_POINTER (class_name));
+ return error_mark_node;
+ }
+ implemented_classes = perm_tree_cons (NULLT, class_name,
+ implemented_classes);
+ }
+
+ /* pre-build the following entities - for speed/convenience. */
+ if (!self_id)
+ self_id = get_identifier ("self");
+ if (!ucmd_id)
+ ucmd_id = get_identifier ("_cmd");
+
+ if (!objc_super_template)
+ objc_super_template = build_super_template ();
+
+ method_slot = 0; /* reset for multiple classes per file */
+
+ implementation_context = class;
+
+ /* lookup the interface for this implementation. */
+
+ if (!(implementation_template = lookup_interface (class_name)))
+ {
+ warning ("Cannot find interface declaration for `%s'",
+ IDENTIFIER_POINTER (class_name));
+ add_class (implementation_template = implementation_context);
+ }
+
+ /* if a super class has been specified in the implementation,
+ insure it conforms to the one specified in the interface */
+
+ if (super_name
+ && (super_name != CLASS_SUPER_NAME (implementation_template)))
+ {
+ tree previous_name = CLASS_SUPER_NAME (implementation_template);
+ char *name = previous_name ? IDENTIFIER_POINTER (previous_name) : "";
+ error ("conflicting super class name `%s'",
+ IDENTIFIER_POINTER (super_name));
+ error ("previous declaration of `%s'", name);
+ }
+ else if (! super_name)
+ {
+ CLASS_SUPER_NAME (implementation_context)
+ = CLASS_SUPER_NAME (implementation_template);
+ }
+ }
+ else if (code == CLASS_INTERFACE_TYPE)
+ {
+ if (lookup_interface (class_name))
+ warning ("duplicate interface declaration for class `%s'",
+ IDENTIFIER_POINTER (class_name));
+ else
+ add_class (class);
+
+ if (protocol_list)
+ CLASS_PROTOCOL_LIST (class)
+ = lookup_and_install_protocols (protocol_list);
+ }
+ else if (code == CATEGORY_INTERFACE_TYPE)
+ {
+ tree class_category_is_assoc_with;
+
+ /* for a category, class_name is really the name of the class that
+ the following set of methods will be associated with...we must
+ find the interface so that can derive the objects template */
+
+ if (!(class_category_is_assoc_with = lookup_interface (class_name)))
+ {
+ error ("Cannot find interface declaration for `%s'",
+ IDENTIFIER_POINTER (class_name));
+ exit (1);
+ }
+ else
+ add_category (class_category_is_assoc_with, class);
+
+ if (protocol_list)
+ CLASS_PROTOCOL_LIST (class)
+ = lookup_and_install_protocols (protocol_list);
+ }
+ else if (code == CATEGORY_IMPLEMENTATION_TYPE)
+ {
+ /* pre-build the following entities - for speed/convenience. */
+ if (!self_id)
+ self_id = get_identifier ("self");
+ if (!ucmd_id)
+ ucmd_id = get_identifier ("_cmd");
+
+ if (!objc_super_template)
+ objc_super_template = build_super_template ();
+
+ method_slot = 0; /* reset for multiple classes per file */
+
+ implementation_context = class;
+
+ /* for a category, class_name is really the name of the class that
+ the following set of methods will be associated with...we must
+ find the interface so that can derive the objects template */
+
+ if (!(implementation_template = lookup_interface (class_name)))
+ {
+ error ("Cannot find interface declaration for `%s'",
+ IDENTIFIER_POINTER (class_name));
+ exit (1);
+ }
+ }
+ return class;
+}
+
+tree
+continue_class (class)
+ tree class;
+{
+ if (TREE_CODE (class) == CLASS_IMPLEMENTATION_TYPE
+ || TREE_CODE (class) == CATEGORY_IMPLEMENTATION_TYPE)
+ {
+ struct imp_entry *imp_entry;
+ tree ivar_context;
+
+ /* check consistency of the instance variables. */
+
+ if (CLASS_IVARS (class))
+ check_ivars (implementation_template, class);
+
+ /* code generation */
+
+ ivar_context = build_private_template (implementation_template);
+
+ if (!objc_class_template)
+ build_class_template ();
+
+ if (!(imp_entry = (struct imp_entry *) xmalloc (sizeof (struct imp_entry))))
+ perror ("unable to allocate in objc-tree.c");
+
+ imp_entry->next = imp_list;
+ imp_entry->imp_context = class;
+ imp_entry->imp_template = implementation_template;
+
+ synth_forward_declarations ();
+ imp_entry->class_decl = UOBJC_CLASS_decl;
+ imp_entry->meta_decl = UOBJC_METACLASS_decl;
+
+ /* append to front and increment count */
+ imp_list = imp_entry;
+ if (TREE_CODE (class) == CLASS_IMPLEMENTATION_TYPE)
+ imp_count++;
+ else
+ cat_count++;
+
+ return ivar_context;
+ }
+ else if (TREE_CODE (class) == CLASS_INTERFACE_TYPE)
+ {
+ tree record = xref_tag (RECORD_TYPE, CLASS_NAME (class));
+
+ if (!TYPE_FIELDS (record))
+ {
+ finish_struct (record, build_ivar_chain (class, 0));
+ CLASS_STATIC_TEMPLATE (class) = record;
+
+ /* mark this record as a class template - for static typing */
+ TREE_STATIC_TEMPLATE (record) = 1;
+ }
+ return NULLT;
+ }
+ else
+ return error_mark_node;
+}
+
+/* This is called once we see the "@end" in an interface/implementation. */
+
+void
+finish_class (class)
+ tree class;
+{
+ if (TREE_CODE (class) == CLASS_IMPLEMENTATION_TYPE)
+ {
+ /* all code generation is done in finish_objc */
+
+ if (implementation_template != implementation_context)
+ {
+ /* ensure that all method listed in the interface contain bodies! */
+ check_methods (CLASS_CLS_METHODS (implementation_template),
+ CLASS_CLS_METHODS (implementation_context), '+');
+ check_methods (CLASS_NST_METHODS (implementation_template),
+ CLASS_NST_METHODS (implementation_context), '-');
+
+ if (CLASS_PROTOCOL_LIST (implementation_template))
+ check_protocols (CLASS_PROTOCOL_LIST (implementation_template),
+ "class",
+ IDENTIFIER_POINTER (CLASS_NAME (implementation_context)));
+ }
+ }
+ else if (TREE_CODE (class) == CATEGORY_IMPLEMENTATION_TYPE)
+ {
+ tree category = CLASS_CATEGORY_LIST (implementation_template);
+
+ /* find the category interface from the class it is associated with */
+ while (category)
+ {
+ if (CLASS_SUPER_NAME (class) == CLASS_SUPER_NAME (category))
+ break;
+ category = CLASS_CATEGORY_LIST (category);
+ }
+
+ if (category)
+ {
+ /* ensure that all method listed in the interface contain bodies! */
+ check_methods (CLASS_CLS_METHODS (category),
+ CLASS_CLS_METHODS (implementation_context), '+');
+ check_methods (CLASS_NST_METHODS (category),
+ CLASS_NST_METHODS (implementation_context), '-');
+
+ if (CLASS_PROTOCOL_LIST (category))
+ check_protocols (CLASS_PROTOCOL_LIST (category),
+ "category",
+ IDENTIFIER_POINTER (CLASS_SUPER_NAME (implementation_context)));
+ }
+ }
+ else if (TREE_CODE (class) == CLASS_INTERFACE_TYPE)
+ {
+ tree decl_specs;
+ char *class_name = IDENTIFIER_POINTER (CLASS_NAME (class));
+ char *string = (char *) alloca (strlen (class_name) + 3);
+
+ /* extern struct objc_object *_<my_name>; */
+
+ sprintf (string, "_%s", class_name);
+
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_EXTERN]);
+ decl_specs = tree_cons (NULLT, objc_object_reference, decl_specs);
+ define_decl (build1 (INDIRECT_REF, NULLT, get_identifier (string)),
+ decl_specs);
+ }
+}
+
+static tree
+add_protocol (protocol)
+ tree protocol;
+{
+ /* put protocol on list in reverse order */
+ TREE_CHAIN (protocol) = protocol_chain;
+ protocol_chain = protocol;
+ return protocol_chain;
+}
+
+static tree
+lookup_protocol (ident)
+ tree ident;
+{
+ tree chain;
+
+ for (chain = protocol_chain; chain; chain = TREE_CHAIN (chain))
+ {
+ if (ident == PROTOCOL_NAME (chain))
+ return chain;
+ }
+ return NULLT;
+}
+
+tree
+start_protocol (code, name, list)
+ enum tree_code code;
+ tree name;
+ tree list;
+{
+ tree protocol;
+
+ if (!doing_objc_thang)
+ objc_fatal ();
+
+ /* This is as good a place as any. Need to invoke push_tag_toplevel. */
+ if (!objc_protocol_template)
+ objc_protocol_template = build_protocol_template ();
+
+ protocol = make_node (code);
+ TYPE_BINFO (protocol) = make_tree_vec (2);
+
+ PROTOCOL_NAME (protocol) = name;
+ PROTOCOL_LIST (protocol) = list;
+
+ lookup_and_install_protocols (list);
+
+ if (lookup_protocol (name))
+ warning ("duplicate declaration for protocol `%s'",
+ IDENTIFIER_POINTER (name));
+ else
+ add_protocol (protocol);
+
+ PROTOCOL_FORWARD_DECL (protocol) = NULL_TREE;
+
+ return protocol;
+}
+
+void
+finish_protocol (protocol)
+ tree protocol;
+{
+}
+
+
+/* "Encode" a data type into a string, which grows in util_obstack.
+ ??? What is the FORMAT? Someone please document this! */
+
+static void
+encode_type_qualifiers (declspecs)
+ tree declspecs;
+{
+ tree spec;
+
+ for (spec = declspecs; spec; spec = TREE_CHAIN (spec))
+ {
+ if (ridpointers[RID_CONST] == TREE_VALUE (spec))
+ obstack_1grow (&util_obstack, 'r');
+ else if (ridpointers[RID_IN] == TREE_VALUE (spec))
+ obstack_1grow (&util_obstack, 'n');
+ else if (ridpointers[RID_INOUT] == TREE_VALUE (spec))
+ obstack_1grow (&util_obstack, 'N');
+ else if (ridpointers[RID_OUT] == TREE_VALUE (spec))
+ obstack_1grow (&util_obstack, 'o');
+ else if (ridpointers[RID_BYCOPY] == TREE_VALUE (spec))
+ obstack_1grow (&util_obstack, 'O');
+ else if (ridpointers[RID_ONEWAY] == TREE_VALUE (spec))
+ obstack_1grow (&util_obstack, 'V');
+ }
+}
+
+/* Encode a pointer type. */
+
+static void
+encode_pointer (type, curtype, format)
+ tree type;
+ int curtype;
+ int format;
+{
+ tree pointer_to = TREE_TYPE (type);
+
+ if (TREE_CODE (pointer_to) == RECORD_TYPE)
+ {
+ if (TYPE_NAME (pointer_to)
+ && TREE_CODE (TYPE_NAME (pointer_to)) == IDENTIFIER_NODE)
+ {
+ char *name = IDENTIFIER_POINTER (TYPE_NAME (pointer_to));
+
+ if (strcmp (name, TAG_OBJECT) == 0) /* '@' */
+ {
+ obstack_1grow (&util_obstack, '@');
+ return;
+ }
+ else if (TREE_STATIC_TEMPLATE (pointer_to))
+ {
+ if (generating_instance_variables)
+ {
+ obstack_1grow (&util_obstack, '@');
+ obstack_1grow (&util_obstack, '"');
+ obstack_grow (&util_obstack, name, strlen (name));
+ obstack_1grow (&util_obstack, '"');
+ return;
+ }
+ else
+ {
+ obstack_1grow (&util_obstack, '@');
+ return;
+ }
+ }
+ else if (strcmp (name, TAG_CLASS) == 0) /* '#' */
+ {
+ obstack_1grow (&util_obstack, '#');
+ return;
+ }
+#ifndef OBJC_INT_SELECTORS
+ else if (strcmp (name, TAG_SELECTOR) == 0) /* ':' */
+ {
+ obstack_1grow (&util_obstack, ':');
+ return;
+ }
+#endif /* OBJC_INT_SELECTORS */
+ }
+ }
+ else if (TREE_CODE (pointer_to) == INTEGER_TYPE
+ && TYPE_MODE (pointer_to) == QImode)
+ {
+ obstack_1grow (&util_obstack, '*');
+ return;
+ }
+
+ /* we have a type that does not get special treatment... */
+
+ /* NeXT extension */
+ obstack_1grow (&util_obstack, '^');
+ encode_type (pointer_to, curtype, format);
+}
+
+static void
+encode_array (type, curtype, format)
+ tree type;
+ int curtype;
+ int format;
+{
+ tree an_int_cst = TYPE_SIZE (type);
+ tree array_of = TREE_TYPE (type);
+ char buffer[40];
+
+ /* An incomplete array is treated like a pointer. */
+ if (an_int_cst == NULL)
+ {
+ /* split for obvious reasons. North-Keys 30 Mar 1991 */
+ encode_pointer (type, curtype, format);
+ return;
+ }
+
+ sprintf (buffer, "[%d",
+ (TREE_INT_CST_LOW (an_int_cst)
+ / TREE_INT_CST_LOW (TYPE_SIZE (array_of))));
+ obstack_grow (&util_obstack, buffer, strlen (buffer));
+ encode_type (array_of, curtype, format);
+ obstack_1grow (&util_obstack, ']');
+ return;
+}
+
+static void
+encode_aggregate (type, curtype, format)
+ tree type;
+ int curtype;
+ int format;
+{
+ enum tree_code code = TREE_CODE (type);
+
+ switch (code)
+ {
+ case RECORD_TYPE:
+ {
+ if (obstack_object_size (&util_obstack) > 0
+ && *(obstack_next_free (&util_obstack) - 1) == '^')
+ {
+ tree name = TYPE_NAME (type);
+
+ /* we have a reference - this is a NeXT extension */
+
+ if (obstack_object_size (&util_obstack) - curtype == 1
+ && format == OBJC_ENCODE_INLINE_DEFS)
+ {
+ /* output format of struct for first level only! */
+
+ tree fields = TYPE_FIELDS (type);
+
+ if (name && TREE_CODE (name) == IDENTIFIER_NODE)
+ {
+ obstack_1grow (&util_obstack, '{');
+ obstack_grow (&util_obstack,
+ IDENTIFIER_POINTER (name),
+ strlen (IDENTIFIER_POINTER (name)));
+ obstack_1grow (&util_obstack, '=');
+ }
+ else
+ obstack_grow (&util_obstack, "{?=", 3);
+
+ for ( ; fields; fields = TREE_CHAIN (fields))
+ encode_field_decl (fields, curtype, format);
+ obstack_1grow (&util_obstack, '}');
+ }
+ else if (name && TREE_CODE (name) == IDENTIFIER_NODE)
+ {
+ obstack_1grow (&util_obstack, '{');
+ obstack_grow (&util_obstack,
+ IDENTIFIER_POINTER (name),
+ strlen (IDENTIFIER_POINTER (name)));
+ obstack_1grow (&util_obstack, '}');
+ }
+ else /* we have an untagged structure or a typedef */
+ obstack_grow (&util_obstack, "{?}", 3);
+ }
+ else
+ {
+ tree name = TYPE_NAME (type);
+ tree fields = TYPE_FIELDS (type);
+
+ if (format == OBJC_ENCODE_INLINE_DEFS
+ || generating_instance_variables)
+ {
+ obstack_1grow (&util_obstack, '{');
+ if (name && TREE_CODE (name) == IDENTIFIER_NODE)
+ obstack_grow (&util_obstack,
+ IDENTIFIER_POINTER (name),
+ strlen (IDENTIFIER_POINTER (name)));
+ else
+ obstack_1grow (&util_obstack, '?');
+
+ obstack_1grow (&util_obstack, '=');
+
+ for (; fields; fields = TREE_CHAIN (fields))
+ {
+ if (generating_instance_variables)
+ {
+ tree fname = DECL_NAME (fields);
+
+ obstack_1grow (&util_obstack, '"');
+ if (fname && TREE_CODE (fname) == IDENTIFIER_NODE)
+ {
+ obstack_grow (&util_obstack,
+ IDENTIFIER_POINTER (fname),
+ strlen (IDENTIFIER_POINTER (fname)));
+ }
+ obstack_1grow (&util_obstack, '"');
+ }
+ encode_field_decl (fields, curtype, format);
+ }
+ obstack_1grow (&util_obstack, '}');
+ }
+ else
+ {
+ obstack_1grow (&util_obstack, '{');
+ if (name && TREE_CODE (name) == IDENTIFIER_NODE)
+ obstack_grow (&util_obstack,
+ IDENTIFIER_POINTER (name),
+ strlen (IDENTIFIER_POINTER (name)));
+ else /* we have an untagged structure or a typedef */
+ obstack_1grow (&util_obstack, '?');
+ obstack_1grow (&util_obstack, '}');
+ }
+ }
+ break;
+ }
+ case UNION_TYPE:
+ {
+ if (*obstack_next_free (&util_obstack) == '^'
+ || format != OBJC_ENCODE_INLINE_DEFS)
+ {
+ /* we have a reference - this is a NeXT extension--
+ or we don't want the details. */
+ if (TYPE_NAME (type)
+ && TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
+ {
+ obstack_1grow (&util_obstack, '(');
+ obstack_grow (&util_obstack,
+ IDENTIFIER_POINTER (TYPE_NAME (type)),
+ strlen (IDENTIFIER_POINTER (TYPE_NAME (type))));
+ obstack_1grow (&util_obstack, ')');
+ }
+ else /* we have an untagged structure or a typedef */
+ obstack_grow (&util_obstack, "(?)", 3);
+ }
+ else
+ {
+ tree fields = TYPE_FIELDS (type);
+ obstack_1grow (&util_obstack, '(');
+ for ( ; fields; fields = TREE_CHAIN (fields))
+ encode_field_decl (fields, curtype, format);
+ obstack_1grow (&util_obstack, ')');
+ }
+ break;
+ }
+
+ case ENUMERAL_TYPE:
+ obstack_1grow (&util_obstack, 'i');
+ break;
+ }
+}
+
+/* Support bitfields, the current version of Objective-C does not support
+ them. the string will consist of one or more "b:n"'s where n is an
+ integer describing the width of the bitfield. Currently, classes in
+ the kit implement a method "-(char *)describeBitfieldStruct:" that
+ simulates this...if they do not implement this method, the archiver
+ assumes the bitfield is 16 bits wide (padded if necessary) and packed
+ according to the GNU compiler. After looking at the "kit", it appears
+ that all classes currently rely on this default behavior, rather than
+ hand generating this string (which is tedious). */
+
+static void
+encode_bitfield (width, format)
+ int width;
+ int format;
+{
+ char buffer[40];
+ sprintf (buffer, "b%d", width);
+ obstack_grow (&util_obstack, buffer, strlen (buffer));
+}
+
+/* FORMAT will be OBJC_ENCODE_INLINE_DEFS or OBJC_ENCODE_DONT_INLINE_DEFS. */
+
+static void
+encode_type (type, curtype, format)
+ tree type;
+ int curtype;
+ int format;
+{
+ enum tree_code code = TREE_CODE (type);
+
+ if (code == INTEGER_TYPE)
+ {
+ if (TREE_INT_CST_LOW (TYPE_MIN_VALUE (type)) == 0
+ && TREE_INT_CST_HIGH (TYPE_MIN_VALUE (type)) == 0)
+ {
+ /* unsigned integer types */
+
+ if (TYPE_MODE (type) == QImode) /* 'C' */
+ obstack_1grow (&util_obstack, 'C');
+ else if (TYPE_MODE (type) == HImode) /* 'S' */
+ obstack_1grow (&util_obstack, 'S');
+ else if (TYPE_MODE (type) == SImode)
+ {
+ if (type == long_unsigned_type_node)
+ obstack_1grow (&util_obstack, 'L'); /* 'L' */
+ else
+ obstack_1grow (&util_obstack, 'I'); /* 'I' */
+ }
+ else if (TYPE_MODE (type) == DImode) /* 'Q' */
+ obstack_1grow (&util_obstack, 'Q');
+ }
+ else /* signed integer types */
+ {
+ if (TYPE_MODE (type) == QImode) /* 'c' */
+ obstack_1grow (&util_obstack, 'c');
+ else if (TYPE_MODE (type) == HImode) /* 's' */
+ obstack_1grow (&util_obstack, 's');
+ else if (TYPE_MODE (type) == SImode) /* 'i' */
+ {
+ if (type == long_integer_type_node)
+ obstack_1grow (&util_obstack, 'l'); /* 'l' */
+ else
+ obstack_1grow (&util_obstack, 'i'); /* 'i' */
+ }
+ else if (TYPE_MODE (type) == DImode) /* 'q' */
+ obstack_1grow (&util_obstack, 'q');
+ }
+ }
+ else if (code == REAL_TYPE)
+ {
+ /* floating point types */
+
+ if (TYPE_MODE (type) == SFmode) /* 'f' */
+ obstack_1grow (&util_obstack, 'f');
+ else if (TYPE_MODE (type) == DFmode
+ || TYPE_MODE (type) == TFmode) /* 'd' */
+ obstack_1grow (&util_obstack, 'd');
+ }
+
+ else if (code == VOID_TYPE) /* 'v' */
+ obstack_1grow (&util_obstack, 'v');
+
+ else if (code == ARRAY_TYPE)
+ encode_array (type, curtype, format);
+
+ else if (code == POINTER_TYPE)
+ encode_pointer (type, curtype, format);
+
+ else if (code == RECORD_TYPE || code == UNION_TYPE || code == ENUMERAL_TYPE)
+ encode_aggregate (type, curtype, format);
+
+ else if (code == FUNCTION_TYPE) /* '?' */
+ obstack_1grow (&util_obstack, '?');
+}
+
+static void
+encode_field_decl (field_decl, curtype, format)
+ tree field_decl;
+ int curtype;
+ int format;
+{
+ tree type;
+
+ /* If this field is obviously a bitfield, or is a bitfield that has been
+ clobbered to look like a ordinary integer mode, go ahead and generate
+ the bitfield typing information. */
+ type = TREE_TYPE (field_decl);
+ if (DECL_BIT_FIELD (field_decl))
+ encode_bitfield (DECL_FIELD_SIZE (field_decl), format);
+ else if (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
+ && DECL_FIELD_SIZE (field_decl)
+ && TYPE_MODE (type) > DECL_MODE (field_decl))
+ encode_bitfield (DECL_FIELD_SIZE (field_decl), format);
+ else
+ encode_type (TREE_TYPE (field_decl), curtype, format);
+}
+
+static tree
+expr_last (complex_expr)
+ tree complex_expr;
+{
+ tree next;
+
+ if (complex_expr)
+ while ((next = TREE_OPERAND (complex_expr, 0)))
+ complex_expr = next;
+ return complex_expr;
+}
+
+/* The selector of the current method,
+ or NULL if we aren't compiling a method. */
+
+tree
+maybe_objc_method_name (decl)
+ tree decl;
+{
+ if (method_context)
+ return METHOD_SEL_NAME (method_context);
+ else
+ return 0;
+}
+
+/* Transform a method definition into a function definition as follows:
+ - synthesize the first two arguments, "self" and "_cmd". */
+
+void
+start_method_def (method)
+ tree method;
+{
+ tree decl_specs;
+
+ /* Required to implement _msgSuper. */
+ method_context = method;
+ UOBJC_SUPER_decl = NULLT;
+
+ pushlevel (0); /* Must be called BEFORE start_function. */
+
+ /* Generate prototype declarations for arguments..."new-style". */
+
+ if (TREE_CODE (method_context) == INSTANCE_METHOD_DECL)
+ decl_specs = build_tree_list (NULLT, uprivate_record);
+ else
+ /* really a `struct objc_class *'...however we allow people to
+ assign to self...which changes its type midstream. */
+ decl_specs = build_tree_list (NULLT, objc_object_reference);
+
+ push_parm_decl (build_tree_list (decl_specs,
+ build1 (INDIRECT_REF, NULLT, self_id)));
+
+#ifdef OBJC_INT_SELECTORS
+ decl_specs = build_tree_list (NULLT, ridpointers[(int) RID_UNSIGNED]);
+ decl_specs = tree_cons (NULLT, ridpointers[(int) RID_INT], decl_specs);
+ push_parm_decl (build_tree_list (decl_specs, ucmd_id));
+#else /* not OBJC_INT_SELECTORS */
+ decl_specs = build_tree_list (NULLT,
+ xref_tag (RECORD_TYPE,
+ get_identifier (TAG_SELECTOR)));
+ push_parm_decl (build_tree_list (decl_specs,
+ build1 (INDIRECT_REF, NULLT, ucmd_id)));
+#endif /* not OBJC_INT_SELECTORS */
+
+ /* generate argument declarations if a keyword_decl */
+ if (METHOD_SEL_ARGS (method))
+ {
+ tree arglist = METHOD_SEL_ARGS (method);
+ do
+ {
+ tree arg_spec = TREE_PURPOSE (TREE_TYPE (arglist));
+ tree arg_decl = TREE_VALUE (TREE_TYPE (arglist));
+
+ if (arg_decl)
+ {
+ tree last_expr = expr_last (arg_decl);
+
+ /* unite the abstract decl with its name */
+ TREE_OPERAND (last_expr, 0) = KEYWORD_ARG_NAME (arglist);
+ push_parm_decl (build_tree_list (arg_spec, arg_decl));
+ /* unhook...restore the abstract declarator */
+ TREE_OPERAND (last_expr, 0) = NULLT;
+ }
+ else
+ push_parm_decl (build_tree_list (arg_spec,
+ KEYWORD_ARG_NAME (arglist)));
+
+ arglist = TREE_CHAIN (arglist);
+ }
+ while (arglist);
+ }
+
+ if (METHOD_ADD_ARGS (method) > (tree)1)
+ {
+ /* we have a variable length selector - in "prototype" format */
+ tree akey = TREE_PURPOSE (METHOD_ADD_ARGS (method));
+ while (akey)
+ {
+ /* This must be done prior to calling pushdecl. pushdecl is
+ going to change our chain on us. */
+ tree nextkey = TREE_CHAIN (akey);
+ pushdecl (akey);
+ akey = nextkey;
+ }
+ }
+}
+
+static void
+warn_with_method (message, mtype, method)
+ char *message;
+ char mtype;
+ tree method;
+{
+ if (count_error (1) == 0)
+ return;
+
+ report_error_function (DECL_SOURCE_FILE (method));
+
+ fprintf (stderr, "%s:%d: warning: ",
+ DECL_SOURCE_FILE (method), DECL_SOURCE_LINE (method));
+ bzero (errbuf, BUFSIZE);
+ fprintf (stderr, "%s `%c%s'\n",
+ message, mtype, gen_method_decl (method, errbuf));
+}
+
+/* return 1 if `method' is consistent with `proto' */
+
+static int
+comp_method_with_proto (method, proto)
+ tree method, proto;
+{
+ static tree function_type = 0;
+
+ /* create a function_type node once */
+ if (!function_type)
+ {
+ struct obstack *ambient_obstack = current_obstack;
+
+ current_obstack = &permanent_obstack;
+ function_type = make_node (FUNCTION_TYPE);
+ current_obstack = ambient_obstack;
+ }
+
+ /* Install argument types - normally set by build_function_type. */
+ TYPE_ARG_TYPES (function_type) = get_arg_type_list (proto, METHOD_DEF, 0);
+
+ /* install return type */
+ TREE_TYPE (function_type) = groktypename (TREE_TYPE (proto));
+
+ return comptypes (TREE_TYPE (METHOD_DEFINITION (method)), function_type);
+}
+
+/* return 1 if `proto1' is consistent with `proto2' */
+
+static int
+comp_proto_with_proto (proto1, proto2)
+ tree proto1, proto2;
+{
+ static tree function_type1 = 0, function_type2 = 0;
+
+ /* create a couple function_type node's once */
+ if (!function_type1)
+ {
+ struct obstack *ambient_obstack = current_obstack;
+
+ current_obstack = &permanent_obstack;
+ function_type1 = make_node (FUNCTION_TYPE);
+ function_type2 = make_node (FUNCTION_TYPE);
+ current_obstack = ambient_obstack;
+ }
+
+ /* Install argument types - normally set by build_function_type. */
+ TYPE_ARG_TYPES (function_type1) = get_arg_type_list (proto1, METHOD_REF, 0);
+ TYPE_ARG_TYPES (function_type2) = get_arg_type_list (proto2, METHOD_REF, 0);
+
+ /* install return type */
+ TREE_TYPE (function_type1) = groktypename (TREE_TYPE (proto1));
+ TREE_TYPE (function_type2) = groktypename (TREE_TYPE (proto2));
+
+ return comptypes (function_type1, function_type2);
+}
+
+/* - generate an identifier for the function. the format is "_n_cls",
+ where 1 <= n <= nMethods, and cls is the name the implementation we
+ are processing.
+ - install the return type from the method declaration.
+ - if we have a prototype, check for type consistency. */
+
+static void
+really_start_method (method, parmlist)
+ tree method, parmlist;
+{
+ tree sc_spec, ret_spec, ret_decl, decl_specs;
+ tree method_decl, method_id;
+ char *buf, *sel_name, *class_name, *cat_name;
+
+ /* synth the storage class & assemble the return type */
+ sc_spec = tree_cons (NULLT, ridpointers[(int) RID_STATIC], NULLT);
+ ret_spec = TREE_PURPOSE (TREE_TYPE (method));
+ decl_specs = chainon (sc_spec, ret_spec);
+
+ sel_name = IDENTIFIER_POINTER (METHOD_SEL_NAME (method));
+ class_name = IDENTIFIER_POINTER (CLASS_NAME (implementation_context));
+ cat_name = ((TREE_CODE (implementation_context)
+ == CLASS_IMPLEMENTATION_TYPE)
+ ? NULL
+ : IDENTIFIER_POINTER (CLASS_SUPER_NAME (implementation_context)));
+ method_slot++;
+ /* Make sure this is big enough for any plausible method label. */
+ buf = (char *) alloca (50 + strlen (sel_name) + strlen (class_name)
+ + (cat_name ? strlen (cat_name) : 0));
+
+ OBJC_GEN_METHOD_LABEL (buf, TREE_CODE (method) == INSTANCE_METHOD_DECL,
+ class_name, cat_name, sel_name, method_slot);
+
+ method_id = get_identifier (buf);
+
+ method_decl = build_nt (CALL_EXPR, method_id, parmlist, NULLT);
+
+ /* check the declarator portion of the return type for the method */
+ if ((ret_decl = TREE_VALUE (TREE_TYPE (method))))
+ {
+ /* unite the complex decl (specified in the abstract decl) with the
+ function decl just synthesized..(int *), (int (*)()), (int (*)[]). */
+ tree save_expr = expr_last (ret_decl);
+
+ TREE_OPERAND (save_expr, 0) = method_decl;
+ method_decl = ret_decl;
+ /* fool the parser into thinking it is starting a function */
+ start_function (decl_specs, method_decl, 0);
+ /* unhook...this has the effect of restoring the abstract declarator */
+ TREE_OPERAND (save_expr, 0) = NULLT;
+ }
+ else
+ {
+ TREE_VALUE (TREE_TYPE (method)) = method_decl;
+ /* fool the parser into thinking it is starting a function */
+ start_function (decl_specs, method_decl, 0);
+ /* unhook...this has the effect of restoring the abstract declarator */
+ TREE_VALUE (TREE_TYPE (method)) = NULLT;
+ }
+
+ METHOD_DEFINITION (method) = current_function_decl;
+
+ /* Check consistency...start_function, pushdecl, duplicate_decls. */
+
+ if (implementation_template != implementation_context)
+ {
+ tree proto;
+
+ if (TREE_CODE (method) == INSTANCE_METHOD_DECL)
+ proto = lookup_instance_method_static (implementation_template,
+ METHOD_SEL_NAME (method));
+ else
+ proto = lookup_class_method_static (implementation_template,
+ METHOD_SEL_NAME (method));
+
+ if (proto && ! comp_method_with_proto (method, proto))
+ {
+ char type = (TREE_CODE (method) == INSTANCE_METHOD_DECL ? '-' : '+');
+
+ warn_with_method ("conflicting types for", type, method);
+ warn_with_method ("previous declaration of", type, proto);
+ }
+ }
+}
+
+/* The following routine is always called...this "architecture" is to
+ accommodate "old-style" variable length selectors.
+
+ - a:a b:b // prototype ; id c; id d; // old-style. */
+
+void
+continue_method_def ()
+{
+ tree parmlist;
+
+ if (METHOD_ADD_ARGS (method_context) == (tree)1)
+ /* We have a `, ...' immediately following the selector. */
+ parmlist = get_parm_info (0);
+ else
+ parmlist = get_parm_info (1); /* place a `void_at_end' */
+
+ /* Set self_decl from the first argument...this global is used by
+ build_ivar_reference calling build_indirect_ref. */
+ self_decl = TREE_PURPOSE (parmlist);
+
+ poplevel (0, 0, 0); /* must be called BEFORE start_function. */
+
+ really_start_method (method_context, parmlist);
+
+ store_parm_decls (); /* must be called AFTER start_function. */
+}
+
+/* Called by the parser, from the `pushlevel' production. */
+
+void
+add_objc_decls ()
+{
+ if (!UOBJC_SUPER_decl)
+ {
+ UOBJC_SUPER_decl = start_decl (get_identifier (UTAG_SUPER),
+ build_tree_list (NULLT,
+ objc_super_template),
+ 0);
+
+ finish_decl (UOBJC_SUPER_decl, NULLT, NULLT);
+
+ /* this prevents `unused variable' warnings when compiling with -Wall. */
+ DECL_IN_SYSTEM_HEADER (UOBJC_SUPER_decl) = 1;
+ }
+}
+
+/* _n_Method (id self, SEL sel, ...)
+ {
+ struct objc_super _S;
+ _msgSuper ((_S.self = self, _S.class = _cls, &_S), ...);
+ } */
+
+tree
+get_super_receiver ()
+{
+ if (method_context)
+ {
+ tree super_expr, super_expr_list;
+
+ /* set receiver to self */
+ super_expr = build_component_ref (UOBJC_SUPER_decl, self_id);
+ super_expr = build_modify_expr (super_expr, NOP_EXPR, self_decl);
+ super_expr_list = build_tree_list (NULLT, super_expr);
+
+ /* set class to begin searching */
+ super_expr = build_component_ref (UOBJC_SUPER_decl,
+ get_identifier ("class"));
+
+ if (TREE_CODE (implementation_context) == CLASS_IMPLEMENTATION_TYPE)
+ {
+ /* [_cls, __cls]Super are "pre-built" in
+ synth_forward_declarations. */
+
+ super_expr = build_modify_expr (super_expr, NOP_EXPR,
+ ((TREE_CODE (method_context)
+ == INSTANCE_METHOD_DECL)
+ ? ucls_super_ref
+ : uucls_super_ref));
+ }
+ else /* we have a category... */
+ {
+ tree super_name = CLASS_SUPER_NAME (implementation_template);
+ tree super_class;
+
+ if (!super_name) /* Barf if super used in a category of Object. */
+ {
+ error ("no super class declared in interface for `%s'",
+ IDENTIFIER_POINTER (CLASS_NAME (implementation_template)));
+ return error_mark_node;
+ }
+
+ if (flag_next_runtime)
+ {
+ super_class = get_class_reference (super_name);
+ if (TREE_CODE (method_context) == CLASS_METHOD_DECL)
+ super_class
+ = build_component_ref (build_indirect_ref (super_class, "->"),
+ get_identifier ("isa"));
+ }
+ else
+ {
+ add_class_reference (super_name);
+ super_class = (TREE_CODE (method_context) == INSTANCE_METHOD_DECL
+ ? objc_get_class_decl : objc_get_meta_class_decl);
+ assemble_external (super_class);
+ super_class
+ = build_function_call
+ (super_class,
+ build_tree_list (NULLT,
+ my_build_string (IDENTIFIER_LENGTH (super_name) + 1,
+ IDENTIFIER_POINTER (super_name))));
+ }
+
+ /* cast! */
+ TREE_TYPE (super_class) = TREE_TYPE (ucls_super_ref);
+ super_expr = build_modify_expr (super_expr, NOP_EXPR, super_class);
+ }
+ chainon (super_expr_list, build_tree_list (NULL_TREE, super_expr));
+
+ super_expr = build_unary_op (ADDR_EXPR, UOBJC_SUPER_decl, 0);
+ chainon (super_expr_list, build_tree_list (NULL_TREE, super_expr));
+
+ return build_compound_expr (super_expr_list);
+ }
+ else
+ {
+ error ("[super ...] must appear in a method context");
+ return error_mark_node;
+ }
+}
+
+static tree
+encode_method_def (func_decl)
+ tree func_decl;
+{
+ tree parms;
+ int stack_size;
+ int max_parm_end = 0;
+ char buffer[40];
+ tree result;
+
+ /* return type */
+ encode_type (TREE_TYPE (TREE_TYPE (func_decl)),
+ obstack_object_size (&util_obstack),
+ OBJC_ENCODE_INLINE_DEFS);
+ /* stack size */
+ for (parms = DECL_ARGUMENTS (func_decl); parms;
+ parms = TREE_CHAIN (parms))
+ {
+ int parm_end = (forwarding_offset (parms)
+ + (TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (parms)))
+ / BITS_PER_UNIT));
+
+ if (parm_end > max_parm_end)
+ max_parm_end = parm_end;
+ }
+
+ stack_size = max_parm_end - OBJC_FORWARDING_MIN_OFFSET;
+
+ sprintf (buffer, "%d", stack_size);
+ obstack_grow (&util_obstack, buffer, strlen (buffer));
+
+ /* argument types */
+ for (parms = DECL_ARGUMENTS (func_decl); parms;
+ parms = TREE_CHAIN (parms))
+ {
+ /* type */
+ encode_type (TREE_TYPE (parms),
+ obstack_object_size (&util_obstack),
+ OBJC_ENCODE_INLINE_DEFS);
+
+ /* compute offset */
+ sprintf (buffer, "%d", forwarding_offset (parms));
+ obstack_grow (&util_obstack, buffer, strlen (buffer));
+ }
+
+ obstack_1grow (&util_obstack, 0); /* null terminate string */
+ result = get_identifier (obstack_finish (&util_obstack));
+ obstack_free (&util_obstack, util_firstobj);
+ return result;
+}
+
+void
+finish_method_def ()
+{
+ METHOD_ENCODING (method_context) = encode_method_def (current_function_decl);
+
+ finish_function (0);
+
+ /* this must be done AFTER finish_function, since the optimizer may
+ find "may be used before set" errors. */
+ method_context = NULLT; /* required to implement _msgSuper. */
+}
+
+int
+lang_report_error_function (decl)
+ tree decl;
+{
+ if (method_context)
+ {
+ fprintf (stderr, "In method `%s'\n",
+ IDENTIFIER_POINTER (METHOD_SEL_NAME (method_context)));
+ return 1;
+ }
+ else
+ return 0;
+}
+
+static int
+is_complex_decl (type)
+ tree type;
+{
+ return (TREE_CODE (type) == ARRAY_TYPE
+ || TREE_CODE (type) == FUNCTION_TYPE
+ || (TREE_CODE (type) == POINTER_TYPE && ! IS_ID (type)));
+}
+
+
+/* Code to convert a decl node into text for a declaration in C. */
+
+static char tmpbuf[256];
+
+static void
+adorn_decl (decl, str)
+ tree decl;
+ char *str;
+{
+ enum tree_code code = TREE_CODE (decl);
+
+ if (code == ARRAY_REF)
+ {
+ tree an_int_cst = TREE_OPERAND (decl, 1);
+
+ if (an_int_cst && TREE_CODE (an_int_cst) == INTEGER_CST)
+ sprintf (str + strlen (str), "[%d]", TREE_INT_CST_LOW (an_int_cst));
+ else
+ strcat (str, "[]");
+ }
+ else if (code == ARRAY_TYPE)
+ {
+ tree an_int_cst = TYPE_SIZE (decl);
+ tree array_of = TREE_TYPE (decl);
+
+ if (an_int_cst && TREE_CODE (an_int_cst) == INTEGER_TYPE)
+ sprintf (str + strlen (str), "[%d]",
+ (TREE_INT_CST_LOW (an_int_cst)
+ / TREE_INT_CST_LOW (TYPE_SIZE (array_of))));
+ else
+ strcat (str, "[]");
+ }
+ else if (code == CALL_EXPR)
+ {
+ tree chain = TREE_PURPOSE (TREE_OPERAND (decl, 1));
+
+ strcat (str, "(");
+ while (chain)
+ {
+ gen_declaration (chain, str);
+ chain = TREE_CHAIN (chain);
+ if (chain)
+ strcat (str, ", ");
+ }
+ strcat (str, ")");
+ }
+ else if (code == FUNCTION_TYPE)
+ {
+ tree chain = TYPE_ARG_TYPES (decl); /* a list of types */
+
+ strcat (str, "(");
+ while (chain && TREE_VALUE (chain) != void_type_node)
+ {
+ gen_declaration (TREE_VALUE (chain), str);
+ chain = TREE_CHAIN (chain);
+ if (chain && TREE_VALUE (chain) != void_type_node)
+ strcat (str, ", ");
+ }
+ strcat (str, ")");
+ }
+ else if (code == INDIRECT_REF)
+ {
+ strcpy (tmpbuf, "*");
+ if (TREE_TYPE (decl) && TREE_CODE (TREE_TYPE (decl)) == TREE_LIST)
+ {
+ tree chain;
+
+ for (chain = nreverse (copy_list (TREE_TYPE (decl)));
+ chain;
+ chain = TREE_CHAIN (chain))
+ {
+ if (TREE_CODE (TREE_VALUE (chain)) == IDENTIFIER_NODE)
+ {
+ strcat (tmpbuf, " ");
+ strcat (tmpbuf, IDENTIFIER_POINTER (TREE_VALUE (chain)));
+ }
+ }
+ if (str[0])
+ strcat (tmpbuf, " ");
+ }
+ strcat (tmpbuf, str);
+ strcpy (str, tmpbuf);
+ }
+ else if (code == POINTER_TYPE)
+ {
+ strcpy (tmpbuf, "*");
+ if (TREE_READONLY (decl) || TYPE_VOLATILE (decl))
+ {
+ if (TREE_READONLY (decl))
+ strcat (tmpbuf, " const");
+ if (TYPE_VOLATILE (decl))
+ strcat (tmpbuf, " volatile");
+ if (str[0])
+ strcat (tmpbuf, " ");
+ }
+ strcat (tmpbuf, str);
+ strcpy (str, tmpbuf);
+ }
+}
+
+static char *
+gen_declarator (decl, buf, name)
+ tree decl;
+ char *buf;
+ char *name;
+{
+ if (decl)
+ {
+ enum tree_code code = TREE_CODE (decl);
+ char *str;
+ tree op;
+ int wrap = 0;
+
+ switch (code)
+ {
+ case ARRAY_REF:
+ case INDIRECT_REF:
+ case CALL_EXPR:
+ op = TREE_OPERAND (decl, 0);
+
+ /* we have a pointer to a function or array...(*)(), (*)[] */
+ if ((code == ARRAY_REF || code == CALL_EXPR)
+ && op && TREE_CODE (op) == INDIRECT_REF)
+ wrap = 1;
+
+ str = gen_declarator (op, buf, name);
+
+ if (wrap)
+ {
+ strcpy (tmpbuf, "(");
+ strcat (tmpbuf, str);
+ strcat (tmpbuf, ")");
+ strcpy (str, tmpbuf);
+ }
+
+ adorn_decl (decl, str);
+ break;
+
+ case ARRAY_TYPE:
+ case FUNCTION_TYPE:
+ case POINTER_TYPE:
+ strcpy (buf, name);
+ str = buf;
+
+ /* this clause is done iteratively...rather than recursively */
+ do
+ {
+ op = (is_complex_decl (TREE_TYPE (decl))
+ ? TREE_TYPE (decl) : NULLT);
+
+ adorn_decl (decl, str);
+
+ /* we have a pointer to a function or array...(*)(), (*)[] */
+ if (code == POINTER_TYPE
+ && op && (TREE_CODE (op) == FUNCTION_TYPE
+ || TREE_CODE (op) == ARRAY_TYPE))
+ {
+ strcpy (tmpbuf, "(");
+ strcat (tmpbuf, str);
+ strcat (tmpbuf, ")");
+ strcpy (str, tmpbuf);
+ }
+
+ decl = (is_complex_decl (TREE_TYPE (decl))
+ ? TREE_TYPE (decl) : NULLT);
+ }
+ while (decl && (code = TREE_CODE (decl)));
+
+ break;
+
+ case IDENTIFIER_NODE:
+ /* will only happen if we are processing a "raw" expr-decl. */
+ strcpy (buf, IDENTIFIER_POINTER (decl));
+ return buf;
+ }
+
+ return str;
+ }
+ else /* we have an abstract declarator or a _DECL node */
+ {
+ strcpy (buf, name);
+ return buf;
+ }
+}
+
+static void
+gen_declspecs (declspecs, buf, raw)
+ tree declspecs;
+ char *buf;
+ int raw;
+{
+ if (raw)
+ {
+ tree chain;
+
+ for (chain = nreverse (copy_list (declspecs));
+ chain; chain = TREE_CHAIN (chain))
+ {
+ tree aspec = TREE_VALUE (chain);
+
+ if (TREE_CODE (aspec) == IDENTIFIER_NODE)
+ strcat (buf, IDENTIFIER_POINTER (aspec));
+ else if (TREE_CODE (aspec) == RECORD_TYPE)
+ {
+ if (TYPE_NAME (aspec))
+ {
+ tree protocol_list = TYPE_PROTOCOL_LIST (aspec);
+
+ if (! TREE_STATIC_TEMPLATE (aspec))
+ strcat (buf, "struct ");
+ strcat (buf, IDENTIFIER_POINTER (TYPE_NAME (aspec)));
+
+ /* NEW!!! */
+ if (protocol_list)
+ {
+ tree chain = protocol_list;
+
+ strcat (buf, " <");
+ while (chain)
+ {
+ strcat (buf, IDENTIFIER_POINTER (PROTOCOL_NAME (TREE_VALUE (chain))));
+ chain = TREE_CHAIN (chain);
+ if (chain)
+ strcat (buf, ", ");
+ }
+ strcat (buf, ">");
+ }
+ }
+ else
+ strcat (buf, "untagged struct");
+ }
+ else if (TREE_CODE (aspec) == UNION_TYPE)
+ {
+ if (TYPE_NAME (aspec))
+ {
+ if (! TREE_STATIC_TEMPLATE (aspec))
+ strcat (buf, "union ");
+ strcat (buf, IDENTIFIER_POINTER (TYPE_NAME (aspec)));
+ }
+ else
+ strcat (buf, "untagged union");
+ }
+ else if (TREE_CODE (aspec) == ENUMERAL_TYPE)
+ {
+ if (TYPE_NAME (aspec))
+ {
+ if (! TREE_STATIC_TEMPLATE (aspec))
+ strcat (buf, "enum ");
+ strcat (buf, IDENTIFIER_POINTER (TYPE_NAME (aspec)));
+ }
+ else
+ strcat (buf, "untagged enum");
+ }
+ else if (TREE_CODE (aspec) == TYPE_DECL && DECL_NAME (aspec))
+ {
+ strcat (buf, IDENTIFIER_POINTER (DECL_NAME (aspec)));
+ }
+ /* NEW!!! */
+ else if (IS_ID (aspec))
+ {
+ tree protocol_list = TYPE_PROTOCOL_LIST (aspec);
+
+ strcat (buf, "id");
+ if (protocol_list)
+ {
+ tree chain = protocol_list;
+
+ strcat (buf, " <");
+ while (chain)
+ {
+ strcat (buf, IDENTIFIER_POINTER (PROTOCOL_NAME (TREE_VALUE (chain))));
+ chain = TREE_CHAIN (chain);
+ if (chain)
+ strcat (buf, ", ");
+ }
+ strcat (buf, ">");
+ }
+ }
+ if (TREE_CHAIN (chain))
+ strcat (buf, " ");
+ }
+ }
+ else
+ {
+ /* type qualifiers */
+
+ if (TREE_READONLY (declspecs))
+ strcat (buf, "const ");
+ if (TYPE_VOLATILE (declspecs))
+ strcat (buf, "volatile ");
+
+ switch (TREE_CODE (declspecs))
+ {
+ /* type specifiers */
+
+ case INTEGER_TYPE: /* signed integer types */
+ declspecs = TYPE_MAIN_VARIANT (declspecs);
+
+ if (declspecs == short_integer_type_node) /* 's' */
+ strcat (buf, "short int ");
+ else if (declspecs == integer_type_node) /* 'i' */
+ strcat (buf, "int ");
+ else if (declspecs == long_integer_type_node) /* 'l' */
+ strcat (buf, "long int ");
+ else if (declspecs == long_long_integer_type_node) /* 'l' */
+ strcat (buf, "long long int ");
+ else if (declspecs == signed_char_type_node /* 'c' */
+ || declspecs == char_type_node)
+ strcat (buf, "char ");
+
+ /* unsigned integer types */
+
+ else if (declspecs == short_unsigned_type_node) /* 'S' */
+ strcat (buf, "unsigned short ");
+ else if (declspecs == unsigned_type_node) /* 'I' */
+ strcat (buf, "unsigned int ");
+ else if (declspecs == long_unsigned_type_node) /* 'L' */
+ strcat (buf, "unsigned long ");
+ else if (declspecs == long_long_unsigned_type_node) /* 'L' */
+ strcat (buf, "unsigned long long ");
+ else if (declspecs == unsigned_char_type_node) /* 'C' */
+ strcat (buf, "unsigned char ");
+ break;
+
+ case REAL_TYPE: /* floating point types */
+ declspecs = TYPE_MAIN_VARIANT (declspecs);
+
+ if (declspecs == float_type_node) /* 'f' */
+ strcat (buf, "float ");
+ else if (declspecs == double_type_node) /* 'd' */
+ strcat (buf, "double ");
+ else if (declspecs == long_double_type_node) /* 'd' */
+ strcat (buf, "long double ");
+ break;
+
+ case RECORD_TYPE:
+ if (TYPE_NAME (declspecs)
+ && TREE_CODE (TYPE_NAME (declspecs)) == IDENTIFIER_NODE)
+ {
+ tree protocol_list = TYPE_PROTOCOL_LIST (declspecs);
+
+ if (! TREE_STATIC_TEMPLATE (declspecs))
+ strcat (buf, "struct ");
+ strcat (buf, IDENTIFIER_POINTER (TYPE_NAME (declspecs)));
+ /* NEW!!! */
+ if (protocol_list)
+ {
+ tree chain = protocol_list;
+
+ strcat (buf, " <");
+ while (chain)
+ {
+ strcat (buf, IDENTIFIER_POINTER (PROTOCOL_NAME (TREE_VALUE (chain))));
+ chain = TREE_CHAIN (chain);
+ if (chain)
+ strcat (buf, ", ");
+ }
+ strcat (buf, ">");
+ }
+ }
+ else
+ strcat (buf, "untagged struct");
+
+ strcat (buf, " ");
+ break;
+
+ case UNION_TYPE:
+ if (TYPE_NAME (declspecs)
+ && TREE_CODE (TYPE_NAME (declspecs)) == IDENTIFIER_NODE)
+ {
+ strcat (buf, "union ");
+ strcat (buf, IDENTIFIER_POINTER (TYPE_NAME (declspecs)));
+ strcat (buf, " ");
+ }
+ else
+ strcat (buf, "untagged union ");
+ break;
+
+ case ENUMERAL_TYPE:
+ if (TYPE_NAME (declspecs)
+ && TREE_CODE (TYPE_NAME (declspecs)) == IDENTIFIER_NODE)
+ {
+ strcat (buf, "enum ");
+ strcat (buf, IDENTIFIER_POINTER (TYPE_NAME (declspecs)));
+ strcat (buf, " ");
+ }
+ else
+ strcat (buf, "untagged enum ");
+ break;
+
+ case VOID_TYPE:
+ strcat (buf, "void ");
+ break;
+
+ /* NEW!!! */
+ case POINTER_TYPE:
+ {
+ tree protocol_list = TYPE_PROTOCOL_LIST (declspecs);
+
+ strcat (buf, "id");
+ if (protocol_list)
+ {
+ tree chain = protocol_list;
+
+ strcat (buf, " <");
+ while (chain)
+ {
+ strcat (buf, IDENTIFIER_POINTER (PROTOCOL_NAME (TREE_VALUE (chain))));
+ chain = TREE_CHAIN (chain);
+ if (chain)
+ strcat (buf, ", ");
+ }
+ strcat (buf, ">");
+ }
+ }
+ }
+ }
+}
+
+static char *
+gen_declaration (atype_or_adecl, buf)
+ tree atype_or_adecl;
+ char *buf;
+{
+ char declbuf[256];
+
+ if (TREE_CODE (atype_or_adecl) == TREE_LIST)
+ {
+ tree declspecs; /* "identifier_node", "record_type" */
+ tree declarator; /* "array_ref", "indirect_ref", "call_expr"... */
+
+ /* we have a "raw", abstract declarator (typename) */
+ declarator = TREE_VALUE (atype_or_adecl);
+ declspecs = TREE_PURPOSE (atype_or_adecl);
+
+ gen_declspecs (declspecs, buf, 1);
+ if (declarator)
+ {
+ strcat (buf, " ");
+ strcat (buf, gen_declarator (declarator, declbuf, ""));
+ }
+ }
+ else
+ {
+ tree atype;
+ tree declspecs; /* "integer_type", "real_type", "record_type"... */
+ tree declarator; /* "array_type", "function_type", "pointer_type". */
+
+ if (TREE_CODE (atype_or_adecl) == FIELD_DECL
+ || TREE_CODE (atype_or_adecl) == PARM_DECL
+ || TREE_CODE (atype_or_adecl) == FUNCTION_DECL)
+ atype = TREE_TYPE (atype_or_adecl);
+ else
+ atype = atype_or_adecl; /* assume we have a *_type node */
+
+ if (is_complex_decl (atype))
+ {
+ tree chain;
+
+ /* get the declaration specifier...it is at the end of the list */
+ declarator = chain = atype;
+ do
+ chain = TREE_TYPE (chain); /* not TREE_CHAIN (chain); */
+ while (is_complex_decl (chain));
+ declspecs = chain;
+ }
+ else
+ {
+ declspecs = atype;
+ declarator = NULLT;
+ }
+
+ gen_declspecs (declspecs, buf, 0);
+
+ if (TREE_CODE (atype_or_adecl) == FIELD_DECL
+ || TREE_CODE (atype_or_adecl) == PARM_DECL
+ || TREE_CODE (atype_or_adecl) == FUNCTION_DECL)
+ {
+ char *decl_name = (DECL_NAME (atype_or_adecl)
+ ? IDENTIFIER_POINTER (DECL_NAME (atype_or_adecl))
+ : "");
+
+ if (declarator)
+ {
+ strcat (buf, " ");
+ strcat (buf, gen_declarator (declarator, declbuf, decl_name));
+ }
+ else if (decl_name[0])
+ {
+ strcat (buf, " ");
+ strcat (buf, decl_name);
+ }
+ }
+ else if (declarator)
+ {
+ strcat (buf, " ");
+ strcat (buf, gen_declarator (declarator, declbuf, ""));
+ }
+ }
+ return buf;
+}
+
+#define RAW_TYPESPEC(meth) (TREE_VALUE (TREE_PURPOSE (TREE_TYPE (meth))))
+
+static char *
+gen_method_decl (method, buf)
+ tree method;
+ char *buf;
+{
+ tree chain;
+
+ if (RAW_TYPESPEC (method) != objc_object_reference)
+ {
+ strcpy (buf, "(");
+ gen_declaration (TREE_TYPE (method), buf);
+ strcat (buf, ")");
+ }
+
+ chain = METHOD_SEL_ARGS (method);
+ if (chain)
+ { /* we have a chain of keyword_decls */
+ do
+ {
+ if (KEYWORD_KEY_NAME (chain))
+ strcat (buf, IDENTIFIER_POINTER (KEYWORD_KEY_NAME (chain)));
+
+ strcat (buf, ":");
+ if (RAW_TYPESPEC (chain) != objc_object_reference)
+ {
+ strcat (buf, "(");
+ gen_declaration (TREE_TYPE (chain), buf);
+ strcat (buf, ")");
+ }
+ strcat (buf, IDENTIFIER_POINTER (KEYWORD_ARG_NAME (chain)));
+ if ((chain = TREE_CHAIN (chain)))
+ strcat (buf, " ");
+ }
+ while (chain);
+
+ if (METHOD_ADD_ARGS (method) == (tree)1)
+ strcat (buf, ", ...");
+ else if (METHOD_ADD_ARGS (method))
+ {
+ /* we have a tree list node as generate by get_parm_info. */
+ chain = TREE_PURPOSE (METHOD_ADD_ARGS (method));
+ /* know we have a chain of parm_decls */
+ while (chain)
+ {
+ strcat (buf, ", ");
+ gen_declaration (chain, buf);
+ chain = TREE_CHAIN (chain);
+ }
+ }
+ }
+ else /* we have a unary selector */
+ strcat (buf, IDENTIFIER_POINTER (METHOD_SEL_NAME (method)));
+
+ return buf;
+}
+
+/* debug info... */
+
+static void
+dump_interface (fp, chain)
+ FILE *fp;
+ tree chain;
+{
+ char *buf = (char *)xmalloc (256);
+ char *my_name = IDENTIFIER_POINTER (CLASS_NAME (chain));
+ tree ivar_decls = CLASS_RAW_IVARS (chain);
+ tree nst_methods = CLASS_NST_METHODS (chain);
+ tree cls_methods = CLASS_CLS_METHODS (chain);
+
+ fprintf (fp, "\n@interface %s", my_name);
+
+ if (CLASS_SUPER_NAME (chain))
+ {
+ char *super_name = IDENTIFIER_POINTER (CLASS_SUPER_NAME (chain));
+ fprintf (fp, " : %s\n", super_name);
+ }
+ else
+ fprintf (fp, "\n");
+
+ if (ivar_decls)
+ {
+ fprintf (fp, "{\n");
+ do
+ {
+ bzero (buf, 256);
+ fprintf (fp, "\t%s;\n", gen_declaration (ivar_decls, buf));
+ ivar_decls = TREE_CHAIN (ivar_decls);
+ }
+ while (ivar_decls);
+ fprintf (fp, "}\n");
+ }
+
+ while (nst_methods)
+ {
+ bzero (buf, 256);
+ fprintf (fp, "- %s;\n", gen_method_decl (nst_methods, buf));
+ nst_methods = TREE_CHAIN (nst_methods);
+ }
+
+ while (cls_methods)
+ {
+ bzero (buf, 256);
+ fprintf (fp, "+ %s;\n", gen_method_decl (cls_methods, buf));
+ cls_methods = TREE_CHAIN (cls_methods);
+ }
+ fprintf (fp, "\n@end");
+}
+
+static void
+init_objc ()
+{
+ /* Add the special tree codes of Objective C to the tables. */
+
+#define LAST_CODE LAST_AND_UNUSED_TREE_CODE
+
+ gcc_obstack_init (&util_obstack);
+ util_firstobj = (char *) obstack_finish (&util_obstack);
+
+ tree_code_type
+ = (char **) xrealloc (tree_code_type,
+ sizeof (char *) * LAST_OBJC_TREE_CODE);
+ tree_code_length
+ = (int *) xrealloc (tree_code_length,
+ sizeof (int) * LAST_OBJC_TREE_CODE);
+ tree_code_name
+ = (char **) xrealloc (tree_code_name,
+ sizeof (char *) * LAST_OBJC_TREE_CODE);
+ bcopy (objc_tree_code_type,
+ tree_code_type + (int) LAST_CODE,
+ (((int) LAST_OBJC_TREE_CODE - (int) LAST_CODE)
+ * sizeof (char *)));
+ bcopy (objc_tree_code_length,
+ tree_code_length + (int) LAST_CODE,
+ (((int) LAST_OBJC_TREE_CODE - (int) LAST_CODE)
+ * sizeof (int)));
+ bcopy (objc_tree_code_name,
+ tree_code_name + (int) LAST_CODE,
+ (((int) LAST_OBJC_TREE_CODE - (int) LAST_CODE)
+ * sizeof (char *)));
+
+ errbuf = (char *)xmalloc (BUFSIZE);
+ hash_init ();
+ synth_module_prologue ();
+}
+
+static void
+finish_objc ()
+{
+ struct imp_entry *impent;
+ tree chain;
+ /* The internally generated initializers appear to have missing braces.
+ Don't warn about this. */
+ int save_warn_missing_braces = warn_missing_braces;
+ warn_missing_braces = 0;
+
+ generate_forward_declaration_to_string_table ();
+
+#ifdef OBJC_PROLOGUE
+ OBJC_PROLOGUE;
+#endif
+
+ if (implementation_context || class_names_chain
+ || meth_var_names_chain || meth_var_types_chain || sel_ref_chain)
+ generate_objc_symtab_decl ();
+
+ for (impent = imp_list; impent; impent = impent->next)
+ {
+ implementation_context = impent->imp_context;
+ implementation_template = impent->imp_template;
+
+ UOBJC_CLASS_decl = impent->class_decl;
+ UOBJC_METACLASS_decl = impent->meta_decl;
+
+ if (TREE_CODE (implementation_context) == CLASS_IMPLEMENTATION_TYPE)
+ {
+ /* all of the following reference the string pool... */
+ generate_ivar_lists ();
+ generate_dispatch_tables ();
+ generate_shared_structures ();
+ }
+ else
+ {
+ generate_dispatch_tables ();
+ generate_category (implementation_context);
+ }
+ }
+
+ /* If we are using an array of selectors, we must always
+ finish up the array decl even if no selectors were used. */
+ if (! flag_next_runtime || sel_ref_chain)
+ build_selector_translation_table ();
+
+ if (protocol_chain)
+ generate_protocols ();
+
+ if (implementation_context || class_names_chain
+ || meth_var_names_chain || meth_var_types_chain || sel_ref_chain)
+ {
+ /* Arrange for Objc data structures to be initialized at run time. */
+ char *init_name = build_module_descriptor ();
+ if (init_name)
+ assemble_constructor (init_name);
+ }
+
+ /* dump the class references...this forces the appropriate classes
+ to be linked into the executable image, preserving unix archive
+ semantics...this can be removed when we move to a more dynamically
+ linked environment. */
+ for (chain = cls_ref_chain; chain; chain = TREE_CHAIN (chain))
+ {
+ handle_class_ref (chain);
+ if (TREE_PURPOSE (chain))
+ generate_classref_translation_entry (chain);
+ }
+
+ for (impent = imp_list; impent; impent = impent->next)
+ handle_impent (impent);
+
+ /* dump the string table last */
+
+ generate_strings ();
+
+ if (flag_gen_declaration)
+ {
+ add_class (implementation_context);
+ dump_interface (gen_declaration_file, implementation_context);
+ }
+
+ if (warn_selector)
+ {
+ int slot;
+ hash hsh;
+
+ /* Run through the selector hash tables and print a warning for any
+ selector which has multiple methods. */
+
+ for (slot = 0; slot < SIZEHASHTABLE; slot++)
+ for (hsh = cls_method_hash_list[slot]; hsh; hsh = hsh->next)
+ if (hsh->list)
+ {
+ tree meth = hsh->key;
+ char type = (TREE_CODE (meth) == INSTANCE_METHOD_DECL
+ ? '-' : '+');
+ attr loop;
+
+ warning ("potential selector conflict for method `%s'",
+ IDENTIFIER_POINTER (METHOD_SEL_NAME (meth)));
+ warn_with_method ("found", type, meth);
+ for (loop = hsh->list; loop; loop = loop->next)
+ warn_with_method ("found", type, loop->value);
+ }
+
+ for (slot = 0; slot < SIZEHASHTABLE; slot++)
+ for (hsh = nst_method_hash_list[slot]; hsh; hsh = hsh->next)
+ if (hsh->list)
+ {
+ tree meth = hsh->key;
+ char type = (TREE_CODE (meth) == INSTANCE_METHOD_DECL
+ ? '-' : '+');
+ attr loop;
+
+ warning ("potential selector conflict for method `%s'",
+ IDENTIFIER_POINTER (METHOD_SEL_NAME (meth)));
+ warn_with_method ("found", type, meth);
+ for (loop = hsh->list; loop; loop = loop->next)
+ warn_with_method ("found", type, loop->value);
+ }
+ }
+
+ warn_missing_braces = save_warn_missing_braces;
+}
+
+/* Subroutines of finish_objc. */
+
+static void
+generate_classref_translation_entry (chain)
+ tree chain;
+{
+ tree expr, name, decl_specs, decl, sc_spec;
+ tree type;
+
+ type = TREE_TYPE (TREE_PURPOSE (chain));
+
+ expr = add_objc_string (TREE_VALUE (chain), class_names);
+ expr = build_c_cast (type, expr); /* cast! */
+
+ name = DECL_NAME (TREE_PURPOSE (chain));
+
+ sc_spec = build_tree_list (NULLT, ridpointers[(int) RID_STATIC]);
+
+ /* static struct objc_class * _OBJC_CLASS_REFERENCES_n = ...; */
+ decl_specs = tree_cons (NULLT, type, sc_spec);
+
+ /* the `decl' that is returned from start_decl is the one that we
+ forward declared in `build_class_reference'. */
+ decl = start_decl (name, decl_specs, 1);
+ end_temporary_allocation ();
+ finish_decl (decl, expr, NULLT);
+ return;
+}
+
+static void
+handle_class_ref (chain)
+ tree chain;
+{
+ char *name = IDENTIFIER_POINTER (TREE_VALUE (chain));
+ if (! flag_next_runtime)
+ {
+ tree decl;
+ char *string = (char *) alloca (strlen (name) + 30);
+ tree exp;
+
+ sprintf (string, "%sobjc_class_name_%s",
+ (flag_next_runtime ? "." : "__"), name);
+
+ /* Make a decl for this name, so we can use its address in a tree. */
+ decl = build_decl (VAR_DECL, get_identifier (string), char_type_node);
+ DECL_EXTERNAL (decl) = 1;
+ TREE_PUBLIC (decl) = 1;
+
+ pushdecl (decl);
+ rest_of_decl_compilation (decl, 0, 0, 0);
+
+ /* Make following constant read-only (why not)? */
+ readonly_data_section ();
+
+ exp = build1 (ADDR_EXPR, string_type_node, decl);
+
+ /* Align the section properly. */
+ assemble_constant_align (exp);
+
+ /* Inform the assembler about this new external thing. */
+ assemble_external (decl);
+
+ /* Output a constant to reference this address. */
+ output_constant (exp, int_size_in_bytes (string_type_node));
+ }
+ else
+ {
+ /* This overreliance on our assembler (i.e. lack of portability)
+ should be dealt with at some point. The GNU strategy (above)
+ won't work either, but it is a start. */
+ char *string = (char *) alloca (strlen (name) + 30);
+ sprintf (string, ".reference .objc_class_name_%s", name);
+ assemble_asm (my_build_string (strlen (string) + 1, string));
+ }
+}
+
+static void
+handle_impent (impent)
+ struct imp_entry *impent;
+{
+ implementation_context = impent->imp_context;
+ implementation_template = impent->imp_template;
+
+ if (TREE_CODE (impent->imp_context) == CLASS_IMPLEMENTATION_TYPE)
+ {
+ char *class_name = IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context));
+ char *string = (char *) alloca (strlen (class_name) + 30);
+
+ if (flag_next_runtime)
+ {
+ /* Grossly unportable.
+ People should know better than to assume
+ such things about assembler syntax! */
+ sprintf (string, ".objc_class_name_%s=0", class_name);
+ assemble_asm (my_build_string (strlen (string) + 1, string));
+
+ sprintf (string, ".globl .objc_class_name_%s", class_name);
+ assemble_asm (my_build_string (strlen (string) + 1, string));
+ }
+ else
+ {
+ sprintf (string, "%sobjc_class_name_%s",
+ (flag_next_runtime ? "." : "__"), class_name);
+ assemble_global (string);
+ assemble_label (string);
+ }
+ }
+ else if (TREE_CODE (impent->imp_context) == CATEGORY_IMPLEMENTATION_TYPE)
+ {
+ char *class_name = IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context));
+ char *class_super_name
+ = IDENTIFIER_POINTER (CLASS_SUPER_NAME (impent->imp_context));
+ char *string = (char *) alloca (strlen (class_name)
+ + strlen (class_super_name) + 30);
+
+ /* Do the same for categories. Even though no references to these
+ symbols are generated automatically by the compiler, it gives
+ you a handle to pull them into an archive by hand. */
+ if (flag_next_runtime)
+ {
+ /* Grossly unportable. */
+ sprintf (string, ".objc_category_name_%s_%s=0",
+ class_name, class_super_name);
+ assemble_asm (my_build_string (strlen (string) + 1, string));
+
+ sprintf (string, ".globl .objc_category_name_%s_%s",
+ class_name, class_super_name);
+ assemble_asm (my_build_string (strlen (string) + 1, string));
+ }
+ else
+ {
+ sprintf (string, "%sobjc_category_name_%s_%s",
+ (flag_next_runtime ? "." : "__"),
+ class_name, class_super_name);
+ assemble_global (string);
+ assemble_label (string);
+ }
+ }
+}
+
+#ifdef DEBUG
+
+static void
+objc_debug (fp)
+ FILE *fp;
+{
+ char *buf = (char *)xmalloc (256);
+
+ { /* dump function prototypes */
+ tree loop = UOBJC_MODULES_decl;
+
+ fprintf (fp, "\n\nfunction prototypes:\n");
+ while (loop)
+ {
+ if (TREE_CODE (loop) == FUNCTION_DECL && DECL_INITIAL (loop))
+ {
+ /* we have a function definition - generate prototype */
+ bzero (errbuf, BUFSIZE);
+ gen_declaration (loop, errbuf);
+ fprintf (fp, "%s;\n", errbuf);
+ }
+ loop = TREE_CHAIN (loop);
+ }
+ }
+ { /* dump global chains */
+ tree loop;
+ int i, index = 0, offset = 0;
+ hash hashlist;
+
+ for (i = 0; i < SIZEHASHTABLE; i++)
+ {
+ if (hashlist = nst_method_hash_list[i])
+ {
+ fprintf (fp, "\n\nnst_method_hash_list[%d]:\n", i);
+ do
+ {
+ bzero (buf, 256);
+ fprintf (fp, "-%s;\n", gen_method_decl (hashlist->key, buf));
+ hashlist = hashlist->next;
+ }
+ while (hashlist);
+ }
+ }
+ for (i = 0; i < SIZEHASHTABLE; i++)
+ {
+ if (hashlist = cls_method_hash_list[i])
+ {
+ fprintf (fp, "\n\ncls_method_hash_list[%d]:\n", i);
+ do
+ {
+ bzero (buf, 256);
+ fprintf (fp, "-%s;\n", gen_method_decl (hashlist->key, buf));
+ hashlist = hashlist->next;
+ }
+ while (hashlist);
+ }
+ }
+ fprintf (fp, "\nsel_refdef_chain:\n");
+ for (loop = sel_refdef_chain; loop; loop = TREE_CHAIN (loop))
+ {
+ fprintf (fp, "(index: %4d offset: %4d) %s\n", index, offset,
+ IDENTIFIER_POINTER (TREE_VALUE (loop)));
+ index++;
+ /* add one for the '\0' character */
+ offset += IDENTIFIER_LENGTH (TREE_VALUE (loop)) + 1;
+ }
+ fprintf (fp, "\n (max_selector_index: %4d.\n", max_selector_index);
+ }
+}
+#endif
+
+void
+print_lang_statistics ()
+{
+}
diff --git a/gnu/usr.bin/cc/cc1obj/objc-act.h b/gnu/usr.bin/cc/cc1obj/objc-act.h
new file mode 100644
index 000000000000..e6765d9168df
--- /dev/null
+++ b/gnu/usr.bin/cc/cc1obj/objc-act.h
@@ -0,0 +1,116 @@
+/* Declarations for objc-act.c.
+ Copyright (C) 1990 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+
+/*** Public Interface (procedures) ***/
+
+/* used by yyparse */
+
+void objc_finish PROTO((void));
+tree start_class PROTO((enum tree_code, tree, tree, tree));
+tree continue_class PROTO((tree));
+void finish_class PROTO((tree));
+void start_method_def PROTO((tree));
+void continue_method_def PROTO((void));
+void finish_method_def PROTO((void));
+tree start_protocol PROTO((enum tree_code, tree, tree));
+void finish_protocol PROTO((tree));
+void add_objc_decls PROTO((void));
+
+tree is_ivar PROTO((tree, tree));
+int is_private PROTO((tree));
+int is_public PROTO((tree, tree));
+tree add_instance_variable PROTO((tree, int, tree, tree, tree));
+tree add_class_method PROTO((tree, tree));
+tree add_instance_method PROTO((tree, tree));
+tree get_super_receiver PROTO((void));
+tree get_class_ivars PROTO((tree));
+tree get_class_reference PROTO((tree));
+tree get_static_reference PROTO((tree, tree));
+tree get_object_reference PROTO((tree));
+tree build_message_expr PROTO((tree));
+tree build_selector_expr PROTO((tree));
+tree build_ivar_reference PROTO((tree));
+tree build_keyword_decl PROTO((tree, tree, tree));
+tree build_method_decl PROTO((enum tree_code, tree, tree, tree));
+tree build_protocol_expr PROTO((tree));
+tree build_objc_string_object PROTO((tree));
+
+extern tree objc_ivar_chain;
+extern tree objc_method_context;
+
+void objc_declare_alias PROTO((tree, tree));
+void objc_declare_class PROTO((tree));
+
+extern int objc_receiver_context;
+
+/* the following routines are used to implement statically typed objects */
+
+int objc_comptypes PROTO((tree, tree, int));
+void objc_check_decl PROTO((tree));
+
+/* NeXT extensions */
+
+tree build_encode_expr PROTO((tree));
+
+/* Objective-C structures */
+
+/* KEYWORD_DECL */
+#define KEYWORD_KEY_NAME(DECL) ((DECL)->decl.name)
+#define KEYWORD_ARG_NAME(DECL) ((DECL)->decl.arguments)
+
+/* INSTANCE_METHOD_DECL, CLASS_METHOD_DECL */
+#define METHOD_SEL_NAME(DECL) ((DECL)->decl.name)
+#define METHOD_SEL_ARGS(DECL) ((DECL)->decl.arguments)
+#define METHOD_ADD_ARGS(DECL) ((DECL)->decl.result)
+#define METHOD_DEFINITION(DECL) ((DECL)->decl.initial)
+#define METHOD_ENCODING(DECL) ((DECL)->decl.context)
+
+/* CLASS_INTERFACE_TYPE, CLASS_IMPLEMENTATION_TYPE,
+ CATEGORY_INTERFACE_TYPE, CATEGORY_IMPLEMENTATION_TYPE,
+ PROTOCOL_INTERFACE_TYPE */
+#define CLASS_NAME(CLASS) ((CLASS)->type.name)
+#define CLASS_SUPER_NAME(CLASS) ((CLASS)->type.context)
+#define CLASS_IVARS(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 0)
+#define CLASS_RAW_IVARS(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 1)
+#define CLASS_NST_METHODS(CLASS) ((CLASS)->type.minval)
+#define CLASS_CLS_METHODS(CLASS) ((CLASS)->type.maxval)
+#define CLASS_STATIC_TEMPLATE(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 2)
+#define CLASS_CATEGORY_LIST(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 3)
+#define CLASS_PROTOCOL_LIST(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 4)
+#define PROTOCOL_NAME(CLASS) ((CLASS)->type.name)
+#define PROTOCOL_LIST(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 0)
+#define PROTOCOL_NST_METHODS(CLASS) ((CLASS)->type.minval)
+#define PROTOCOL_CLS_METHODS(CLASS) ((CLASS)->type.maxval)
+#define PROTOCOL_FORWARD_DECL(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 1)
+#define TYPE_PROTOCOL_LIST(TYPE) ((TYPE)->type.context)
+
+/* Define the Objective-C or Objective-C++ language-specific tree codes. */
+
+#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
+enum objc_tree_code {
+#ifdef OBJCPLUS
+ dummy_tree_code = LAST_CPLUS_TREE_CODE,
+#else
+ dummy_tree_code = LAST_AND_UNUSED_TREE_CODE,
+#endif
+#include "objc-tree.def"
+ LAST_OBJC_TREE_CODE
+};
+#undef DEFTREECODE
diff --git a/gnu/usr.bin/cc/cc1obj/objc-parse.c b/gnu/usr.bin/cc/cc1obj/objc-parse.c
new file mode 100644
index 000000000000..46676c062df9
--- /dev/null
+++ b/gnu/usr.bin/cc/cc1obj/objc-parse.c
@@ -0,0 +1,4626 @@
+
+/* A Bison parser, made from objc-parse.y */
+
+#define YYBISON 1 /* Identify Bison output. */
+
+#define IDENTIFIER 258
+#define TYPENAME 259
+#define SCSPEC 260
+#define TYPESPEC 261
+#define TYPE_QUAL 262
+#define CONSTANT 263
+#define STRING 264
+#define ELLIPSIS 265
+#define SIZEOF 266
+#define ENUM 267
+#define STRUCT 268
+#define UNION 269
+#define IF 270
+#define ELSE 271
+#define WHILE 272
+#define DO 273
+#define FOR 274
+#define SWITCH 275
+#define CASE 276
+#define DEFAULT 277
+#define BREAK 278
+#define CONTINUE 279
+#define RETURN 280
+#define GOTO 281
+#define ASM_KEYWORD 282
+#define TYPEOF 283
+#define ALIGNOF 284
+#define ALIGN 285
+#define ATTRIBUTE 286
+#define EXTENSION 287
+#define LABEL 288
+#define REALPART 289
+#define IMAGPART 290
+#define ASSIGN 291
+#define OROR 292
+#define ANDAND 293
+#define EQCOMPARE 294
+#define ARITHCOMPARE 295
+#define LSHIFT 296
+#define RSHIFT 297
+#define UNARY 298
+#define PLUSPLUS 299
+#define MINUSMINUS 300
+#define HYPERUNARY 301
+#define POINTSAT 302
+#define INTERFACE 303
+#define IMPLEMENTATION 304
+#define END 305
+#define SELECTOR 306
+#define DEFS 307
+#define ENCODE 308
+#define CLASSNAME 309
+#define PUBLIC 310
+#define PRIVATE 311
+#define PROTECTED 312
+#define PROTOCOL 313
+#define OBJECTNAME 314
+#define CLASS 315
+#define ALIAS 316
+#define OBJC_STRING 317
+
+#line 31 "objc-parse.y"
+
+#include <stdio.h>
+#include <errno.h>
+#include <setjmp.h>
+
+#include "config.h"
+#include "tree.h"
+#include "input.h"
+#include "c-lex.h"
+#include "c-tree.h"
+#include "flags.h"
+
+#ifdef MULTIBYTE_CHARS
+#include <stdlib.h>
+#include <locale.h>
+#endif
+
+#include "objc-act.h"
+
+/* Since parsers are distinct for each language, put the language string
+ definition here. */
+char *language_string = "GNU Obj-C";
+
+#ifndef errno
+extern int errno;
+#endif
+
+void yyerror ();
+
+/* Like YYERROR but do call yyerror. */
+#define YYERROR1 { yyerror ("syntax error"); YYERROR; }
+
+/* Cause the `yydebug' variable to be defined. */
+#define YYDEBUG 1
+
+#line 69 "objc-parse.y"
+typedef union {long itype; tree ttype; enum tree_code code;
+ char *filename; int lineno; } YYSTYPE;
+#line 190 "objc-parse.y"
+
+/* Number of statements (loosely speaking) seen so far. */
+static int stmt_count;
+
+/* Input file and line number of the end of the body of last simple_if;
+ used by the stmt-rule immediately after simple_if returns. */
+static char *if_stmt_file;
+static int if_stmt_line;
+
+/* List of types and structure classes of the current declaration. */
+static tree current_declspecs;
+
+/* Stack of saved values of current_declspecs. */
+static tree declspec_stack;
+
+/* 1 if we explained undeclared var errors. */
+static int undeclared_variable_notice;
+
+/* Objective-C specific information */
+
+tree objc_interface_context;
+tree objc_implementation_context;
+tree objc_method_context;
+tree objc_ivar_chain;
+tree objc_ivar_context;
+enum tree_code objc_inherit_code;
+int objc_receiver_context;
+int objc_public_flag;
+
+
+/* Tell yyparse how to print a token's value, if yydebug is set. */
+
+#define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
+extern void yyprint ();
+
+#ifndef YYLTYPE
+typedef
+ struct yyltype
+ {
+ int timestamp;
+ int first_line;
+ int first_column;
+ int last_line;
+ int last_column;
+ char *text;
+ }
+ yyltype;
+
+#define YYLTYPE yyltype
+#endif
+
+#include <stdio.h>
+
+#ifndef __STDC__
+#define const
+#endif
+
+
+
+#define YYFINAL 865
+#define YYFLAG -32768
+#define YYNTBASE 85
+
+#define YYTRANSLATE(x) ((unsigned)(x) <= 317 ? yytranslate[x] : 281)
+
+static const char yytranslate[] = { 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 81, 2, 2, 2, 53, 44, 2, 60,
+ 77, 51, 49, 82, 50, 59, 52, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 39, 78, 2,
+ 37, 2, 38, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 61, 2, 84, 43, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 83, 42, 79, 80, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+ 36, 40, 41, 45, 46, 47, 48, 54, 55, 56,
+ 57, 58, 62, 63, 64, 65, 66, 67, 68, 69,
+ 70, 71, 72, 73, 74, 75, 76
+};
+
+static const short yyprhs[] = { 0,
+ 0, 1, 3, 4, 7, 8, 12, 14, 16, 18,
+ 24, 28, 33, 38, 41, 44, 47, 50, 52, 53,
+ 54, 62, 67, 68, 69, 77, 82, 83, 84, 91,
+ 95, 97, 99, 101, 103, 105, 107, 109, 111, 113,
+ 115, 117, 119, 120, 122, 124, 128, 130, 133, 134,
+ 138, 141, 144, 147, 152, 155, 160, 163, 166, 168,
+ 173, 181, 183, 187, 191, 195, 199, 203, 207, 211,
+ 215, 219, 223, 227, 231, 235, 239, 245, 249, 253,
+ 255, 257, 259, 263, 267, 268, 273, 278, 283, 287,
+ 291, 294, 297, 299, 301, 303, 305, 307, 309, 312,
+ 314, 317, 318, 320, 323, 327, 329, 331, 334, 337,
+ 342, 347, 350, 353, 357, 359, 361, 364, 367, 368,
+ 373, 378, 382, 386, 389, 392, 395, 399, 400, 403,
+ 406, 408, 410, 413, 416, 419, 423, 424, 427, 429,
+ 431, 433, 436, 439, 444, 449, 451, 453, 455, 457,
+ 461, 463, 467, 468, 473, 474, 481, 485, 486, 493,
+ 497, 498, 505, 507, 511, 513, 518, 523, 532, 534,
+ 537, 541, 546, 548, 550, 554, 558, 564, 565, 569,
+ 570, 574, 576, 578, 582, 586, 591, 595, 599, 601,
+ 603, 607, 612, 616, 620, 622, 626, 630, 634, 639,
+ 643, 645, 646, 653, 658, 661, 662, 669, 674, 677,
+ 678, 686, 687, 694, 697, 698, 700, 701, 703, 705,
+ 708, 709, 713, 716, 721, 725, 727, 731, 733, 735,
+ 737, 741, 746, 753, 759, 761, 765, 767, 771, 774,
+ 777, 778, 780, 782, 785, 786, 789, 793, 797, 800,
+ 804, 809, 813, 816, 820, 823, 825, 828, 831, 832,
+ 834, 837, 838, 839, 841, 843, 846, 850, 852, 855,
+ 858, 865, 871, 877, 880, 883, 888, 889, 894, 895,
+ 896, 900, 905, 909, 911, 913, 915, 917, 920, 921,
+ 926, 928, 932, 933, 934, 942, 948, 951, 952, 953,
+ 954, 967, 968, 975, 978, 981, 984, 988, 995, 1004,
+ 1015, 1028, 1032, 1037, 1039, 1041, 1042, 1049, 1053, 1059,
+ 1062, 1065, 1066, 1068, 1069, 1071, 1072, 1074, 1076, 1080,
+ 1085, 1087, 1091, 1092, 1095, 1098, 1099, 1104, 1107, 1108,
+ 1110, 1112, 1116, 1118, 1122, 1125, 1128, 1131, 1134, 1137,
+ 1138, 1141, 1143, 1146, 1148, 1152, 1154, 1158, 1160, 1162,
+ 1164, 1166, 1168, 1170, 1172, 1176, 1180, 1185, 1186, 1187,
+ 1198, 1199, 1206, 1207, 1208, 1221, 1222, 1231, 1232, 1239,
+ 1242, 1243, 1252, 1257, 1258, 1268, 1274, 1275, 1282, 1283,
+ 1287, 1291, 1293, 1295, 1297, 1299, 1300, 1304, 1307, 1311,
+ 1315, 1317, 1318, 1320, 1324, 1326, 1330, 1333, 1334, 1335,
+ 1336, 1344, 1345, 1346, 1347, 1355, 1356, 1357, 1360, 1362,
+ 1364, 1367, 1368, 1372, 1374, 1376, 1377, 1378, 1384, 1385,
+ 1386, 1392, 1397, 1399, 1405, 1408, 1409, 1412, 1413, 1415,
+ 1417, 1419, 1422, 1425, 1430, 1433, 1436, 1438, 1442, 1444,
+ 1446, 1448, 1449, 1452, 1453, 1457, 1459, 1461, 1464, 1466,
+ 1468, 1470, 1472, 1474, 1476, 1478, 1480, 1482, 1484, 1486,
+ 1488, 1490, 1492, 1494, 1496, 1498, 1500, 1502, 1504, 1506,
+ 1508, 1510, 1512, 1514, 1521, 1525, 1531, 1534, 1536, 1538,
+ 1540, 1543, 1545, 1549, 1552, 1554, 1556, 1557, 1558, 1565,
+ 1567, 1569, 1571, 1574, 1577, 1579, 1584, 1589
+};
+
+static const short yyrhs[] = { -1,
+ 86, 0, 0, 87, 89, 0, 0, 86, 88, 89,
+ 0, 91, 0, 90, 0, 213, 0, 27, 60, 100,
+ 77, 78, 0, 117, 127, 78, 0, 121, 117, 127,
+ 78, 0, 119, 117, 126, 78, 0, 121, 78, 0,
+ 119, 78, 0, 1, 78, 0, 1, 79, 0, 78,
+ 0, 0, 0, 119, 117, 142, 92, 111, 93, 172,
+ 0, 119, 117, 142, 1, 0, 0, 0, 121, 117,
+ 145, 94, 111, 95, 172, 0, 121, 117, 145, 1,
+ 0, 0, 0, 117, 145, 96, 111, 97, 172, 0,
+ 117, 145, 1, 0, 3, 0, 4, 0, 73, 0,
+ 68, 0, 44, 0, 50, 0, 49, 0, 55, 0,
+ 56, 0, 80, 0, 81, 0, 102, 0, 0, 102,
+ 0, 106, 0, 102, 82, 106, 0, 107, 0, 51,
+ 105, 0, 0, 32, 104, 105, 0, 99, 105, 0,
+ 41, 98, 0, 11, 103, 0, 11, 60, 160, 77,
+ 0, 29, 103, 0, 29, 60, 160, 77, 0, 34,
+ 105, 0, 35, 105, 0, 103, 0, 60, 160, 77,
+ 105, 0, 60, 160, 77, 83, 137, 151, 79, 0,
+ 105, 0, 106, 49, 106, 0, 106, 50, 106, 0,
+ 106, 51, 106, 0, 106, 52, 106, 0, 106, 53,
+ 106, 0, 106, 47, 106, 0, 106, 48, 106, 0,
+ 106, 46, 106, 0, 106, 45, 106, 0, 106, 44,
+ 106, 0, 106, 42, 106, 0, 106, 43, 106, 0,
+ 106, 41, 106, 0, 106, 40, 106, 0, 106, 38,
+ 196, 39, 106, 0, 106, 37, 106, 0, 106, 36,
+ 106, 0, 3, 0, 8, 0, 109, 0, 60, 100,
+ 77, 0, 60, 1, 77, 0, 0, 60, 108, 173,
+ 77, 0, 107, 60, 101, 77, 0, 107, 61, 100,
+ 84, 0, 107, 59, 98, 0, 107, 58, 98, 0,
+ 107, 55, 0, 107, 56, 0, 272, 0, 278, 0,
+ 279, 0, 280, 0, 110, 0, 9, 0, 109, 9,
+ 0, 76, 0, 110, 76, 0, 0, 113, 0, 113,
+ 10, 0, 178, 179, 114, 0, 112, 0, 167, 0,
+ 113, 112, 0, 112, 167, 0, 119, 117, 126, 78,
+ 0, 121, 117, 127, 78, 0, 119, 78, 0, 121,
+ 78, 0, 178, 179, 118, 0, 115, 0, 167, 0,
+ 116, 115, 0, 115, 167, 0, 0, 119, 117, 126,
+ 78, 0, 121, 117, 127, 78, 0, 119, 117, 138,
+ 0, 121, 117, 140, 0, 119, 78, 0, 121, 78,
+ 0, 124, 120, 0, 121, 124, 120, 0, 0, 120,
+ 125, 0, 120, 5, 0, 7, 0, 5, 0, 121,
+ 7, 0, 121, 5, 0, 124, 123, 0, 162, 124,
+ 123, 0, 0, 123, 125, 0, 6, 0, 146, 0,
+ 4, 0, 68, 229, 0, 73, 229, 0, 28, 60,
+ 100, 77, 0, 28, 60, 160, 77, 0, 6, 0,
+ 7, 0, 146, 0, 129, 0, 126, 82, 129, 0,
+ 131, 0, 127, 82, 129, 0, 0, 27, 60, 109,
+ 77, 0, 0, 142, 128, 133, 37, 130, 136, 0,
+ 142, 128, 133, 0, 0, 145, 128, 133, 37, 132,
+ 136, 0, 145, 128, 133, 0, 0, 31, 60, 60,
+ 134, 77, 77, 0, 135, 0, 134, 82, 135, 0,
+ 3, 0, 3, 60, 3, 77, 0, 3, 60, 8,
+ 77, 0, 3, 60, 3, 82, 8, 82, 8, 77,
+ 0, 106, 0, 83, 79, 0, 83, 137, 79, 0,
+ 83, 137, 82, 79, 0, 1, 0, 136, 0, 137,
+ 82, 136, 0, 98, 39, 136, 0, 137, 82, 98,
+ 39, 136, 0, 0, 142, 139, 173, 0, 0, 145,
+ 141, 173, 0, 143, 0, 145, 0, 60, 143, 77,
+ 0, 143, 60, 208, 0, 143, 61, 100, 84, 0,
+ 143, 61, 84, 0, 51, 163, 143, 0, 4, 0,
+ 73, 0, 144, 60, 208, 0, 144, 61, 100, 84,
+ 0, 144, 61, 84, 0, 51, 163, 144, 0, 4,
+ 0, 145, 60, 208, 0, 60, 145, 77, 0, 51,
+ 163, 145, 0, 145, 61, 100, 84, 0, 145, 61,
+ 84, 0, 3, 0, 0, 13, 98, 83, 147, 153,
+ 79, 0, 13, 83, 153, 79, 0, 13, 98, 0,
+ 0, 14, 98, 83, 148, 153, 79, 0, 14, 83,
+ 153, 79, 0, 14, 98, 0, 0, 12, 98, 83,
+ 149, 158, 152, 79, 0, 0, 12, 83, 150, 158,
+ 152, 79, 0, 12, 98, 0, 0, 82, 0, 0,
+ 82, 0, 154, 0, 154, 155, 0, 0, 154, 155,
+ 78, 0, 154, 78, 0, 66, 60, 68, 77, 0,
+ 122, 117, 156, 0, 122, 0, 162, 117, 156, 0,
+ 162, 0, 1, 0, 157, 0, 156, 82, 157, 0,
+ 178, 179, 142, 133, 0, 178, 179, 142, 39, 106,
+ 133, 0, 178, 179, 39, 106, 133, 0, 159, 0,
+ 158, 82, 159, 0, 98, 0, 98, 37, 106, 0,
+ 122, 161, 0, 162, 161, 0, 0, 164, 0, 7,
+ 0, 162, 7, 0, 0, 163, 7, 0, 60, 164,
+ 77, 0, 51, 163, 164, 0, 51, 163, 0, 164,
+ 60, 201, 0, 164, 61, 100, 84, 0, 164, 61,
+ 84, 0, 60, 201, 0, 61, 100, 84, 0, 61,
+ 84, 0, 181, 0, 165, 181, 0, 165, 167, 0,
+ 0, 165, 0, 1, 78, 0, 0, 0, 170, 0,
+ 171, 0, 170, 171, 0, 33, 212, 78, 0, 173,
+ 0, 1, 173, 0, 83, 79, 0, 83, 168, 169,
+ 116, 166, 79, 0, 83, 168, 169, 1, 79, 0,
+ 83, 168, 169, 165, 79, 0, 175, 180, 0, 175,
+ 1, 0, 15, 60, 100, 77, 0, 0, 18, 177,
+ 180, 17, 0, 0, 0, 178, 179, 183, 0, 178,
+ 179, 194, 180, 0, 178, 179, 182, 0, 183, 0,
+ 194, 0, 173, 0, 191, 0, 100, 78, 0, 0,
+ 174, 16, 184, 180, 0, 174, 0, 174, 16, 1,
+ 0, 0, 0, 17, 185, 60, 100, 77, 186, 180,
+ 0, 176, 60, 100, 77, 78, 0, 176, 1, 0,
+ 0, 0, 0, 19, 60, 196, 78, 187, 196, 78,
+ 188, 196, 77, 189, 180, 0, 0, 20, 60, 100,
+ 77, 190, 180, 0, 23, 78, 0, 24, 78, 0,
+ 25, 78, 0, 25, 100, 78, 0, 27, 195, 60,
+ 100, 77, 78, 0, 27, 195, 60, 100, 39, 197,
+ 77, 78, 0, 27, 195, 60, 100, 39, 197, 39,
+ 197, 77, 78, 0, 27, 195, 60, 100, 39, 197,
+ 39, 197, 39, 200, 77, 78, 0, 26, 98, 78,
+ 0, 26, 51, 100, 78, 0, 78, 0, 192, 0,
+ 0, 19, 60, 107, 77, 193, 180, 0, 21, 106,
+ 39, 0, 21, 106, 10, 106, 39, 0, 22, 39,
+ 0, 98, 39, 0, 0, 7, 0, 0, 100, 0,
+ 0, 198, 0, 199, 0, 198, 82, 199, 0, 9,
+ 60, 100, 77, 0, 109, 0, 200, 82, 109, 0,
+ 0, 202, 203, 0, 205, 77, 0, 0, 206, 78,
+ 204, 203, 0, 1, 77, 0, 0, 10, 0, 206,
+ 0, 206, 82, 10, 0, 207, 0, 206, 82, 207,
+ 0, 119, 144, 0, 119, 145, 0, 119, 161, 0,
+ 121, 145, 0, 121, 161, 0, 0, 209, 210, 0,
+ 203, 0, 211, 77, 0, 3, 0, 211, 82, 3,
+ 0, 98, 0, 212, 82, 98, 0, 217, 0, 215,
+ 0, 216, 0, 227, 0, 236, 0, 64, 0, 98,
+ 0, 214, 82, 98, 0, 74, 214, 78, 0, 75,
+ 98, 98, 78, 0, 0, 0, 62, 98, 229, 83,
+ 218, 230, 79, 219, 243, 64, 0, 0, 62, 98,
+ 229, 220, 243, 64, 0, 0, 0, 62, 98, 39,
+ 98, 229, 83, 221, 230, 79, 222, 243, 64, 0,
+ 0, 62, 98, 39, 98, 229, 223, 243, 64, 0,
+ 0, 63, 98, 83, 224, 230, 79, 0, 63, 98,
+ 0, 0, 63, 98, 39, 98, 83, 225, 230, 79,
+ 0, 63, 98, 39, 98, 0, 0, 62, 98, 60,
+ 98, 77, 229, 226, 243, 64, 0, 63, 98, 60,
+ 98, 77, 0, 0, 72, 98, 229, 228, 243, 64,
+ 0, 0, 46, 214, 46, 0, 230, 231, 232, 0,
+ 232, 0, 70, 0, 71, 0, 69, 0, 0, 232,
+ 233, 78, 0, 232, 78, 0, 122, 117, 234, 0,
+ 162, 117, 234, 0, 1, 0, 0, 235, 0, 234,
+ 82, 235, 0, 142, 0, 142, 39, 106, 0, 39,
+ 106, 0, 0, 0, 0, 49, 237, 253, 238, 254,
+ 239, 172, 0, 0, 0, 0, 50, 240, 253, 241,
+ 254, 242, 172, 0, 0, 0, 244, 245, 0, 248,
+ 0, 90, 0, 245, 248, 0, 0, 245, 246, 90,
+ 0, 78, 0, 1, 0, 0, 0, 49, 249, 253,
+ 250, 247, 0, 0, 0, 50, 251, 253, 252, 247,
+ 0, 60, 160, 77, 262, 0, 262, 0, 60, 160,
+ 77, 263, 260, 0, 263, 260, 0, 0, 78, 255,
+ 0, 0, 256, 0, 257, 0, 167, 0, 256, 257,
+ 0, 257, 167, 0, 119, 117, 258, 78, 0, 119,
+ 78, 0, 121, 78, 0, 259, 0, 258, 82, 259,
+ 0, 144, 0, 145, 0, 161, 0, 0, 82, 10,
+ 0, 0, 82, 261, 205, 0, 264, 0, 266, 0,
+ 263, 266, 0, 3, 0, 4, 0, 73, 0, 265,
+ 0, 12, 0, 13, 0, 14, 0, 15, 0, 16,
+ 0, 17, 0, 18, 0, 19, 0, 20, 0, 21,
+ 0, 22, 0, 23, 0, 24, 0, 25, 0, 26,
+ 0, 27, 0, 11, 0, 28, 0, 29, 0, 6,
+ 0, 7, 0, 264, 39, 60, 160, 77, 98, 0,
+ 264, 39, 98, 0, 39, 60, 160, 77, 98, 0,
+ 39, 98, 0, 264, 0, 268, 0, 270, 0, 268,
+ 270, 0, 102, 0, 264, 39, 269, 0, 39, 269,
+ 0, 100, 0, 68, 0, 0, 0, 61, 273, 271,
+ 274, 267, 84, 0, 264, 0, 276, 0, 277, 0,
+ 276, 277, 0, 264, 39, 0, 39, 0, 65, 60,
+ 275, 77, 0, 72, 60, 98, 77, 0, 67, 60,
+ 160, 77, 0
+};
+
+#if YYDEBUG != 0
+static const short yyrline[] = { 0,
+ 227, 232, 246, 248, 248, 249, 251, 253, 254, 255,
+ 265, 271, 273, 275, 277, 279, 280, 281, 286, 292,
+ 294, 295, 297, 302, 304, 305, 307, 312, 314, 315,
+ 319, 321, 322, 323, 326, 328, 330, 332, 334, 336,
+ 338, 342, 346, 349, 352, 355, 359, 361, 364, 367,
+ 370, 374, 400, 405, 407, 409, 411, 413, 417, 419,
+ 422, 447, 449, 451, 453, 455, 457, 459, 461, 463,
+ 465, 467, 469, 471, 473, 475, 477, 479, 482, 488,
+ 650, 651, 653, 659, 661, 675, 693, 695, 697, 709,
+ 723, 725, 727, 729, 731, 733, 735, 740, 742, 748,
+ 750, 754, 756, 757, 767, 772, 774, 775, 776, 779,
+ 784, 788, 791, 799, 804, 806, 807, 808, 815, 823,
+ 828, 832, 836, 840, 842, 850, 853, 857, 859, 861,
+ 872, 876, 878, 881, 894, 897, 901, 903, 911, 912,
+ 913, 917, 919, 921, 923, 929, 930, 931, 934, 936,
+ 939, 941, 944, 947, 953, 958, 960, 966, 971, 973,
+ 980, 983, 988, 990, 995, 1000, 1010, 1021, 1039, 1041,
+ 1045, 1047, 1049, 1055, 1058, 1063, 1065, 1069, 1086, 1090,
+ 1107, 1114, 1116, 1121, 1124, 1129, 1131, 1133, 1135, 1136,
+ 1144, 1150, 1152, 1154, 1156, 1162, 1168, 1170, 1172, 1174,
+ 1176, 1179, 1184, 1188, 1191, 1193, 1195, 1197, 1200, 1202,
+ 1205, 1208, 1211, 1214, 1218, 1220, 1223, 1225, 1229, 1232,
+ 1237, 1239, 1241, 1245, 1269, 1275, 1280, 1285, 1290, 1294,
+ 1296, 1300, 1304, 1308, 1318, 1320, 1325, 1328, 1332, 1335,
+ 1339, 1342, 1345, 1348, 1352, 1355, 1359, 1363, 1365, 1367,
+ 1369, 1371, 1373, 1375, 1377, 1385, 1387, 1388, 1391, 1393,
+ 1396, 1399, 1412, 1414, 1419, 1421, 1424, 1438, 1441, 1444,
+ 1446, 1451, 1456, 1464, 1469, 1472, 1485, 1493, 1497, 1501,
+ 1505, 1511, 1515, 1520, 1522, 1533, 1536, 1537, 1542, 1547,
+ 1550, 1558, 1560, 1570, 1580, 1581, 1589, 1592, 1604, 1608,
+ 1625, 1632, 1641, 1643, 1648, 1653, 1657, 1661, 1672, 1679,
+ 1686, 1693, 1704, 1708, 1711, 1716, 1739, 1770, 1794, 1822,
+ 1837, 1848, 1851, 1855, 1858, 1863, 1865, 1868, 1870, 1874,
+ 1879, 1882, 1888, 1893, 1898, 1900, 1909, 1910, 1916, 1918,
+ 1923, 1925, 1929, 1932, 1938, 1941, 1943, 1945, 1947, 1954,
+ 1959, 1964, 1966, 1975, 1978, 1983, 1986, 1992, 1994, 1995,
+ 1996, 1997, 1998, 2012, 2015, 2019, 2025, 2031, 2038, 2043,
+ 2049, 2056, 2062, 2068, 2073, 2079, 2086, 2092, 2098, 2104,
+ 2112, 2118, 2124, 2132, 2139, 2145, 2154, 2161, 2169, 2174,
+ 2183, 2185, 2188, 2190, 2191, 2194, 2199, 2200, 2217, 2223,
+ 2228, 2232, 2235, 2236, 2239, 2247, 2253, 2262, 2272, 2279,
+ 2283, 2288, 2297, 2304, 2308, 2318, 2320, 2321, 2323, 2325,
+ 2326, 2327, 2328, 2330, 2332, 2335, 2341, 2346, 2346, 2351,
+ 2355, 2357, 2363, 2368, 2373, 2382, 2384, 2390, 2392, 2395,
+ 2397, 2398, 2399, 2402, 2405, 2407, 2411, 2414, 2421, 2424,
+ 2426, 2430, 2435, 2440, 2445, 2452, 2456, 2459, 2465, 2467,
+ 2468, 2469, 2472, 2474, 2475, 2476, 2477, 2478, 2479, 2480,
+ 2481, 2482, 2483, 2484, 2485, 2486, 2487, 2488, 2489, 2490,
+ 2491, 2492, 2492, 2495, 2501, 2506, 2511, 2517, 2519, 2522,
+ 2524, 2531, 2543, 2548, 2554, 2556, 2562, 2566, 2567, 2573,
+ 2575, 2578, 2580, 2586, 2591, 2597, 2604, 2613
+};
+
+static const char * const yytname[] = { "$","error","$illegal.","IDENTIFIER",
+"TYPENAME","SCSPEC","TYPESPEC","TYPE_QUAL","CONSTANT","STRING","ELLIPSIS","SIZEOF",
+"ENUM","STRUCT","UNION","IF","ELSE","WHILE","DO","FOR","SWITCH","CASE","DEFAULT",
+"BREAK","CONTINUE","RETURN","GOTO","ASM_KEYWORD","TYPEOF","ALIGNOF","ALIGN",
+"ATTRIBUTE","EXTENSION","LABEL","REALPART","IMAGPART","ASSIGN","'='","'?'","':'",
+"OROR","ANDAND","'|'","'^'","'&'","EQCOMPARE","ARITHCOMPARE","LSHIFT","RSHIFT",
+"'+'","'-'","'*'","'/'","'%'","UNARY","PLUSPLUS","MINUSMINUS","HYPERUNARY","POINTSAT",
+"'.'","'('","'['","INTERFACE","IMPLEMENTATION","END","SELECTOR","DEFS","ENCODE",
+"CLASSNAME","PUBLIC","PRIVATE","PROTECTED","PROTOCOL","OBJECTNAME","CLASS","ALIAS",
+"OBJC_STRING","')'","';'","'}'","'~'","'!'","','","'{'","']'","program","extdefs",
+"@1","@2","extdef","datadef","fndef","@3","@4","@5","@6","@7","@8","identifier",
+"unop","expr","exprlist","nonnull_exprlist","unary_expr","@9","cast_expr","expr_no_commas",
+"primary","@10","string","objc_string","xdecls","lineno_datadecl","datadecls",
+"datadecl","lineno_decl","decls","setspecs","decl","typed_declspecs","reserved_declspecs",
+"declmods","typed_typespecs","reserved_typespecquals","typespec","typespecqual_reserved",
+"initdecls","notype_initdecls","maybeasm","initdcl","@11","notype_initdcl","@12",
+"maybe_attribute","attribute_list","attrib","init","initlist","nested_function",
+"@13","notype_nested_function","@14","declarator","after_type_declarator","parm_declarator",
+"notype_declarator","structsp","@15","@16","@17","@18","maybecomma","maybecomma_warn",
+"component_decl_list","component_decl_list2","component_decl","components","component_declarator",
+"enumlist","enumerator","typename","absdcl","nonempty_type_quals","type_quals",
+"absdcl1","stmts","xstmts","errstmt","pushlevel","maybe_label_decls","label_decls",
+"label_decl","compstmt_or_error","compstmt","simple_if","if_prefix","do_stmt_start",
+"@19","save_filename","save_lineno","lineno_labeled_stmt","lineno_stmt_or_label",
+"stmt_or_label","stmt","@20","@21","@22","@23","@24","@25","@26","all_iter_stmt",
+"all_iter_stmt_simple","@27","label","maybe_type_qual","xexpr","asm_operands",
+"nonnull_asm_operands","asm_operand","asm_clobbers","parmlist","@28","parmlist_1",
+"@29","parmlist_2","parms","parm","parmlist_or_identifiers","@30","parmlist_or_identifiers_1",
+"identifiers","identifiers_or_typenames","objcdef","identifier_list","classdecl",
+"aliasdecl","classdef","@31","@32","@33","@34","@35","@36","@37","@38","@39",
+"protocoldef","@40","protocolrefs","ivar_decl_list","visibility_spec","ivar_decls",
+"ivar_decl","ivars","ivar_declarator","methoddef","@41","@42","@43","@44","@45",
+"@46","methodprotolist","@47","methodprotolist2","@48","semi_or_error","methodproto",
+"@49","@50","@51","@52","methoddecl","optarglist","myxdecls","mydecls","mydecl",
+"myparms","myparm","optparmlist","@53","unaryselector","keywordselector","selector",
+"reservedwords","keyworddecl","messageargs","keywordarglist","keywordexpr","keywordarg",
+"receiver","objcmessageexpr","@54","@55","selectorarg","keywordnamelist","keywordname",
+"objcselectorexpr","objcprotocolexpr","objcencodeexpr",""
+};
+#endif
+
+static const short yyr1[] = { 0,
+ 85, 85, 87, 86, 88, 86, 89, 89, 89, 89,
+ 90, 90, 90, 90, 90, 90, 90, 90, 92, 93,
+ 91, 91, 94, 95, 91, 91, 96, 97, 91, 91,
+ 98, 98, 98, 98, 99, 99, 99, 99, 99, 99,
+ 99, 100, 101, 101, 102, 102, 103, 103, 104, 103,
+ 103, 103, 103, 103, 103, 103, 103, 103, 105, 105,
+ 105, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 107,
+ 107, 107, 107, 107, 108, 107, 107, 107, 107, 107,
+ 107, 107, 107, 107, 107, 107, 107, 109, 109, 110,
+ 110, 111, 111, 111, 112, 113, 113, 113, 113, 114,
+ 114, 114, 114, 115, 116, 116, 116, 116, 117, 118,
+ 118, 118, 118, 118, 118, 119, 119, 120, 120, 120,
+ 121, 121, 121, 121, 122, 122, 123, 123, 124, 124,
+ 124, 124, 124, 124, 124, 125, 125, 125, 126, 126,
+ 127, 127, 128, 128, 130, 129, 129, 132, 131, 131,
+ 133, 133, 134, 134, 135, 135, 135, 135, 136, 136,
+ 136, 136, 136, 137, 137, 137, 137, 139, 138, 141,
+ 140, 142, 142, 143, 143, 143, 143, 143, 143, 143,
+ 144, 144, 144, 144, 144, 145, 145, 145, 145, 145,
+ 145, 147, 146, 146, 146, 148, 146, 146, 146, 149,
+ 146, 150, 146, 146, 151, 151, 152, 152, 153, 153,
+ 154, 154, 154, 154, 155, 155, 155, 155, 155, 156,
+ 156, 157, 157, 157, 158, 158, 159, 159, 160, 160,
+ 161, 161, 162, 162, 163, 163, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 165, 165, 165, 166, 166,
+ 167, 168, 169, 169, 170, 170, 171, 172, 172, 173,
+ 173, 173, 173, 174, 174, 175, 177, 176, 178, 179,
+ 180, 180, 181, 182, 182, 183, 183, 183, 184, 183,
+ 183, 183, 185, 186, 183, 183, 183, 187, 188, 189,
+ 183, 190, 183, 183, 183, 183, 183, 183, 183, 183,
+ 183, 183, 183, 183, 191, 193, 192, 194, 194, 194,
+ 194, 195, 195, 196, 196, 197, 197, 198, 198, 199,
+ 200, 200, 202, 201, 203, 204, 203, 203, 205, 205,
+ 205, 205, 206, 206, 207, 207, 207, 207, 207, 209,
+ 208, 210, 210, 211, 211, 212, 212, 213, 213, 213,
+ 213, 213, 213, 214, 214, 215, 216, 218, 219, 217,
+ 220, 217, 221, 222, 217, 223, 217, 224, 217, 217,
+ 225, 217, 217, 226, 217, 217, 228, 227, 229, 229,
+ 230, 230, 231, 231, 231, 232, 232, 232, 233, 233,
+ 233, 234, 234, 234, 235, 235, 235, 237, 238, 239,
+ 236, 240, 241, 242, 236, 243, 244, 243, 245, 245,
+ 245, 246, 245, 247, 247, 249, 250, 248, 251, 252,
+ 248, 253, 253, 253, 253, 254, 254, 255, 255, 256,
+ 256, 256, 256, 257, 257, 257, 258, 258, 259, 259,
+ 259, 260, 260, 261, 260, 262, 263, 263, 264, 264,
+ 264, 264, 265, 265, 265, 265, 265, 265, 265, 265,
+ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
+ 265, 265, 265, 266, 266, 266, 266, 267, 267, 268,
+ 268, 269, 270, 270, 271, 271, 273, 274, 272, 275,
+ 275, 276, 276, 277, 277, 278, 279, 280
+};
+
+static const short yyr2[] = { 0,
+ 0, 1, 0, 2, 0, 3, 1, 1, 1, 5,
+ 3, 4, 4, 2, 2, 2, 2, 1, 0, 0,
+ 7, 4, 0, 0, 7, 4, 0, 0, 6, 3,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 0, 1, 1, 3, 1, 2, 0, 3,
+ 2, 2, 2, 4, 2, 4, 2, 2, 1, 4,
+ 7, 1, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 5, 3, 3, 1,
+ 1, 1, 3, 3, 0, 4, 4, 4, 3, 3,
+ 2, 2, 1, 1, 1, 1, 1, 1, 2, 1,
+ 2, 0, 1, 2, 3, 1, 1, 2, 2, 4,
+ 4, 2, 2, 3, 1, 1, 2, 2, 0, 4,
+ 4, 3, 3, 2, 2, 2, 3, 0, 2, 2,
+ 1, 1, 2, 2, 2, 3, 0, 2, 1, 1,
+ 1, 2, 2, 4, 4, 1, 1, 1, 1, 3,
+ 1, 3, 0, 4, 0, 6, 3, 0, 6, 3,
+ 0, 6, 1, 3, 1, 4, 4, 8, 1, 2,
+ 3, 4, 1, 1, 3, 3, 5, 0, 3, 0,
+ 3, 1, 1, 3, 3, 4, 3, 3, 1, 1,
+ 3, 4, 3, 3, 1, 3, 3, 3, 4, 3,
+ 1, 0, 6, 4, 2, 0, 6, 4, 2, 0,
+ 7, 0, 6, 2, 0, 1, 0, 1, 1, 2,
+ 0, 3, 2, 4, 3, 1, 3, 1, 1, 1,
+ 3, 4, 6, 5, 1, 3, 1, 3, 2, 2,
+ 0, 1, 1, 2, 0, 2, 3, 3, 2, 3,
+ 4, 3, 2, 3, 2, 1, 2, 2, 0, 1,
+ 2, 0, 0, 1, 1, 2, 3, 1, 2, 2,
+ 6, 5, 5, 2, 2, 4, 0, 4, 0, 0,
+ 3, 4, 3, 1, 1, 1, 1, 2, 0, 4,
+ 1, 3, 0, 0, 7, 5, 2, 0, 0, 0,
+ 12, 0, 6, 2, 2, 2, 3, 6, 8, 10,
+ 12, 3, 4, 1, 1, 0, 6, 3, 5, 2,
+ 2, 0, 1, 0, 1, 0, 1, 1, 3, 4,
+ 1, 3, 0, 2, 2, 0, 4, 2, 0, 1,
+ 1, 3, 1, 3, 2, 2, 2, 2, 2, 0,
+ 2, 1, 2, 1, 3, 1, 3, 1, 1, 1,
+ 1, 1, 1, 1, 3, 3, 4, 0, 0, 10,
+ 0, 6, 0, 0, 12, 0, 8, 0, 6, 2,
+ 0, 8, 4, 0, 9, 5, 0, 6, 0, 3,
+ 3, 1, 1, 1, 1, 0, 3, 2, 3, 3,
+ 1, 0, 1, 3, 1, 3, 2, 0, 0, 0,
+ 7, 0, 0, 0, 7, 0, 0, 2, 1, 1,
+ 2, 0, 3, 1, 1, 0, 0, 5, 0, 0,
+ 5, 4, 1, 5, 2, 0, 2, 0, 1, 1,
+ 1, 2, 2, 4, 2, 2, 1, 3, 1, 1,
+ 1, 0, 2, 0, 3, 1, 1, 2, 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, 6, 3, 5, 2, 1, 1, 1,
+ 2, 1, 3, 2, 1, 1, 0, 0, 6, 1,
+ 1, 1, 2, 2, 1, 4, 4, 4
+};
+
+static const short yydefact[] = { 3,
+ 5, 0, 0, 0, 141, 132, 139, 131, 0, 0,
+ 0, 0, 0, 408, 412, 0, 0, 363, 389, 0,
+ 389, 0, 0, 18, 4, 8, 7, 0, 119, 119,
+ 128, 140, 9, 359, 360, 358, 361, 362, 6, 16,
+ 17, 31, 32, 34, 33, 212, 214, 221, 205, 221,
+ 209, 0, 0, 0, 0, 389, 380, 0, 142, 389,
+ 143, 364, 0, 0, 201, 245, 0, 0, 151, 0,
+ 15, 0, 134, 133, 14, 0, 128, 126, 0, 210,
+ 0, 0, 0, 202, 0, 206, 80, 81, 98, 0,
+ 0, 49, 0, 0, 0, 35, 37, 36, 0, 38,
+ 39, 0, 497, 0, 0, 0, 100, 40, 41, 0,
+ 0, 42, 59, 62, 45, 47, 82, 97, 93, 94,
+ 95, 96, 243, 0, 241, 137, 0, 241, 459, 460,
+ 482, 483, 479, 463, 464, 465, 466, 467, 468, 469,
+ 470, 471, 472, 473, 474, 475, 476, 477, 478, 480,
+ 481, 0, 0, 461, 409, 433, 452, 456, 462, 457,
+ 413, 0, 0, 371, 0, 0, 378, 0, 387, 366,
+ 0, 0, 0, 0, 11, 0, 30, 0, 350, 0,
+ 0, 161, 189, 245, 0, 190, 0, 149, 0, 182,
+ 183, 0, 0, 127, 130, 146, 147, 129, 148, 237,
+ 217, 235, 0, 0, 204, 229, 223, 119, 220, 119,
+ 221, 208, 221, 0, 53, 0, 55, 0, 57, 58,
+ 52, 48, 0, 0, 0, 0, 0, 0, 0, 0,
+ 51, 0, 0, 0, 0, 324, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 91, 92, 0, 0, 43, 0, 99, 101, 144, 245,
+ 333, 0, 239, 242, 135, 145, 244, 137, 240, 0,
+ 487, 0, 436, 454, 435, 0, 458, 0, 436, 389,
+ 0, 368, 417, 383, 0, 396, 390, 417, 365, 367,
+ 246, 198, 197, 152, 153, 0, 196, 0, 200, 0,
+ 0, 28, 0, 279, 107, 280, 0, 160, 0, 0,
+ 13, 0, 22, 0, 161, 350, 0, 12, 26, 0,
+ 0, 218, 0, 217, 0, 279, 222, 279, 0, 0,
+ 0, 0, 50, 84, 83, 262, 0, 0, 496, 495,
+ 498, 505, 500, 0, 501, 502, 0, 0, 10, 46,
+ 79, 78, 325, 0, 76, 75, 73, 74, 72, 71,
+ 70, 68, 69, 63, 64, 65, 66, 67, 90, 89,
+ 0, 44, 0, 249, 0, 253, 0, 255, 0, 333,
+ 0, 138, 136, 0, 0, 0, 410, 453, 339, 0,
+ 485, 414, 376, 389, 396, 0, 0, 381, 386, 0,
+ 0, 0, 0, 0, 354, 340, 241, 241, 352, 0,
+ 341, 343, 351, 0, 199, 261, 0, 109, 104, 108,
+ 0, 0, 158, 188, 184, 150, 20, 157, 185, 187,
+ 0, 24, 238, 236, 213, 0, 224, 225, 230, 280,
+ 227, 203, 207, 54, 56, 270, 263, 86, 0, 60,
+ 0, 504, 506, 0, 503, 508, 507, 0, 87, 88,
+ 248, 247, 334, 254, 250, 252, 0, 0, 432, 452,
+ 119, 0, 441, 437, 439, 0, 0, 455, 341, 0,
+ 0, 373, 417, 384, 0, 372, 426, 429, 420, 0,
+ 119, 119, 422, 419, 396, 395, 393, 394, 379, 396,
+ 401, 398, 119, 119, 0, 388, 154, 338, 195, 245,
+ 333, 345, 346, 347, 245, 348, 349, 335, 336, 0,
+ 353, 0, 0, 29, 268, 105, 119, 119, 0, 0,
+ 0, 155, 186, 0, 211, 279, 0, 0, 0, 264,
+ 265, 173, 80, 0, 0, 169, 174, 215, 0, 488,
+ 0, 489, 490, 77, 251, 486, 434, 445, 241, 446,
+ 442, 443, 411, 0, 415, 396, 0, 417, 369, 0,
+ 0, 153, 0, 0, 0, 421, 0, 0, 402, 402,
+ 397, 249, 350, 0, 249, 0, 342, 344, 355, 269,
+ 112, 0, 113, 0, 165, 0, 163, 159, 21, 0,
+ 25, 231, 0, 161, 356, 0, 0, 0, 279, 0,
+ 116, 280, 256, 266, 170, 0, 0, 0, 0, 492,
+ 494, 0, 499, 0, 491, 449, 450, 451, 0, 447,
+ 484, 0, 377, 0, 417, 427, 430, 423, 382, 0,
+ 405, 399, 403, 400, 194, 191, 193, 0, 337, 0,
+ 0, 0, 0, 0, 156, 161, 0, 232, 267, 0,
+ 272, 118, 117, 0, 0, 273, 258, 280, 257, 0,
+ 171, 0, 176, 0, 175, 61, 493, 444, 241, 374,
+ 385, 0, 0, 0, 407, 0, 0, 192, 110, 111,
+ 0, 0, 162, 164, 234, 161, 357, 271, 0, 141,
+ 0, 293, 277, 0, 0, 0, 0, 0, 0, 0,
+ 0, 322, 389, 389, 314, 0, 0, 114, 119, 119,
+ 286, 291, 0, 0, 283, 284, 287, 315, 285, 172,
+ 0, 448, 417, 370, 425, 424, 428, 431, 406, 404,
+ 166, 0, 167, 233, 0, 0, 279, 324, 0, 0,
+ 320, 304, 305, 306, 0, 0, 0, 323, 0, 321,
+ 288, 124, 0, 125, 0, 0, 275, 280, 274, 297,
+ 0, 177, 0, 0, 0, 0, 0, 47, 0, 0,
+ 0, 318, 307, 0, 312, 0, 0, 122, 153, 0,
+ 123, 153, 292, 279, 0, 0, 375, 0, 276, 0,
+ 278, 316, 298, 302, 0, 313, 0, 120, 0, 121,
+ 0, 290, 281, 279, 0, 0, 294, 279, 324, 279,
+ 319, 326, 0, 179, 181, 282, 296, 168, 279, 317,
+ 0, 303, 0, 0, 327, 328, 308, 295, 299, 0,
+ 326, 0, 0, 324, 0, 0, 309, 329, 0, 330,
+ 0, 0, 300, 331, 0, 310, 279, 0, 0, 301,
+ 311, 332, 0, 0, 0
+};
+
+static const short yydefgoto[] = { 863,
+ 1, 2, 3, 25, 26, 27, 314, 531, 320, 534,
+ 181, 417, 200, 110, 353, 371, 112, 113, 218, 114,
+ 115, 116, 225, 117, 118, 302, 303, 304, 526, 608,
+ 609, 28, 718, 407, 78, 408, 125, 265, 31, 198,
+ 187, 68, 182, 188, 600, 69, 530, 308, 596, 597,
+ 547, 548, 788, 809, 791, 811, 295, 190, 626, 191,
+ 32, 211, 213, 203, 79, 619, 323, 82, 83, 209,
+ 438, 439, 201, 202, 127, 628, 128, 173, 264, 610,
+ 665, 305, 447, 539, 540, 541, 524, 525, 722, 723,
+ 724, 747, 768, 421, 769, 613, 725, 726, 794, 746,
+ 829, 819, 844, 857, 820, 727, 728, 818, 729, 759,
+ 354, 834, 835, 836, 855, 376, 377, 409, 586, 410,
+ 411, 412, 297, 298, 413, 414, 606, 33, 63, 34,
+ 35, 36, 395, 635, 283, 566, 733, 483, 286, 495,
+ 568, 37, 288, 59, 400, 500, 401, 505, 642, 643,
+ 38, 54, 273, 477, 55, 279, 481, 396, 397, 493,
+ 575, 737, 494, 570, 683, 571, 684, 155, 387, 474,
+ 475, 476, 629, 630, 275, 389, 156, 157, 158, 159,
+ 160, 551, 552, 621, 553, 341, 119, 227, 451, 344,
+ 345, 346, 120, 121, 122
+};
+
+static const short yypact[] = { 95,
+ 112, 2755, 2755, 203,-32768,-32768,-32768,-32768, 169, 177,
+ 191, 33, 73,-32768,-32768, 199, 199,-32768, 89, 199,
+ 89, 199, 199,-32768,-32768,-32768,-32768, 181, 65, 767,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768, 40, 97, 107, 97,
+ 115, 2540, 2375, 2999, 2999, 194, 39, 199,-32768, 89,
+-32768,-32768, 26, 199,-32768,-32768, 181, 104,-32768, 1688,
+-32768, 59,-32768,-32768,-32768, 181,-32768, 626, 199,-32768,
+ 148, 121, 373,-32768, 137,-32768,-32768,-32768,-32768, 2574,
+ 2629,-32768, 2540, 2540, 199,-32768,-32768,-32768, 2540,-32768,
+-32768, 1279,-32768, 176, 186, 215,-32768,-32768,-32768, 2540,
+ 207, 208,-32768,-32768, 3291, 613, 321, 256,-32768,-32768,
+-32768,-32768,-32768, 257, 178,-32768, 264, 3135,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768, 252, 2229,-32768,-32768,-32768, 2341, 253,-32768,-32768,
+-32768, 199, 199, 268, 199, 199,-32768, 45,-32768,-32768,
+ 199, 304, 114, 219,-32768, 59,-32768, 357,-32768, 1782,
+ 709, 364,-32768,-32768, 59,-32768, 246,-32768, 568, 393,
+ 428, 320, 1768, 626,-32768,-32768,-32768,-32768,-32768, 387,
+ 337,-32768, 199, 362,-32768,-32768,-32768, 434, 367, 602,
+ 97,-32768, 97, 1279,-32768, 1279,-32768, 2540,-32768,-32768,
+-32768,-32768, 385, 403, 408, 418, 2430, 3028, 2229, 199,
+-32768, 381, 2540, 2540, 2540, 2540, 2540, 2540, 2540, 2540,
+ 2540, 2540, 2540, 2540, 2540, 2540, 2540, 2540, 2540, 2540,
+-32768,-32768, 199, 199, 2540, 2540,-32768,-32768,-32768,-32768,
+ 178, 1862,-32768, 454, 571,-32768,-32768,-32768,-32768, 2229,
+-32768, 423, 430, 500,-32768, 253,-32768, 267, 430, 89,
+ 442,-32768, 467, 455, 460,-32768,-32768, 467,-32768,-32768,
+-32768, 428,-32768,-32768, 513, 535,-32768, 1871,-32768, 464,
+ 471,-32768, 69, 88,-32768,-32768, 490, 515, 282, 289,
+-32768, 59,-32768, 709, 364,-32768, 1922,-32768,-32768, 709,
+ 2540, 199, 474, 337, 480,-32768,-32768,-32768, 479, 481,
+ 485, 486,-32768,-32768,-32768, 487, 488, 2260,-32768,-32768,
+-32768,-32768, 529, 493, 3028,-32768, 494, 511,-32768, 3291,
+ 3291, 3291,-32768, 550, 1253, 1411, 1491, 575, 703, 1569,
+ 678, 319, 319, 433, 433,-32768,-32768,-32768,-32768,-32768,
+ 514, 208, 509, 376, 336,-32768, 2883,-32768, 517,-32768,
+ 1982,-32768, 571, 520, 3067, 756,-32768,-32768, 3152, 2229,
+-32768,-32768, 524, 89,-32768, 534, 2831,-32768,-32768, 363,
+ 2707, 546, 52, 540,-32768,-32768, 360, 3124,-32768, 557,
+ 347,-32768,-32768, 241,-32768,-32768, 56,-32768,-32768,-32768,
+ 3217, 551,-32768, 393,-32768,-32768,-32768, 598,-32768,-32768,
+ 528,-32768, 3291,-32768,-32768, 558,-32768, 560,-32768,-32768,
+ 560,-32768,-32768,-32768,-32768,-32768, 610,-32768, 1603,-32768,
+ 3096,-32768,-32768, 529,-32768,-32768,-32768, 2540,-32768,-32768,
+ 454,-32768,-32768,-32768,-32768,-32768, 561, 199,-32768, 2341,
+ 566, 2901,-32768,-32768, 3217, 1796, 56,-32768, 567, 576,
+ 56,-32768, 467,-32768, 378,-32768,-32768,-32768,-32768, 181,
+ 65, 767, 37,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768, 2454, 570,-32768,-32768,-32768,-32768,-32768,
+ 407, 456, 428,-32768,-32768, 428,-32768,-32768,-32768, 3200,
+-32768, 649, 408,-32768,-32768,-32768, 578, 2920, 651, 1679,
+ 56,-32768,-32768, 56,-32768,-32768, 349, 199, 874, 610,
+-32768,-32768, 618, 1360, 620, 3291,-32768, 580, 2540, 625,
+ 582, 3096,-32768, 1332,-32768,-32768,-32768,-32768, 360,-32768,
+-32768,-32768,-32768, 199,-32768,-32768, 612, 467,-32768, 2999,
+ 2999, 216, 59, 181, 2850,-32768, 457, 2724, 355, 355,
+-32768, 227,-32768, 2042, 405, 2883,-32768,-32768,-32768,-32768,
+-32768, 59,-32768, 181, 619, 249,-32768,-32768,-32768, 1679,
+-32768,-32768, 2540, 53,-32768, 353, 451, 793, 603, 955,
+-32768,-32768,-32768,-32768,-32768, 187, 1679, 1441, 604, 208,
+-32768, 2540,-32768, 625,-32768, 456, 428,-32768, 361,-32768,
+-32768, 476,-32768, 621, 467,-32768,-32768,-32768,-32768, 2540,
+ 645, 606,-32768, 606, 456,-32768,-32768, 607,-32768, 382,
+ 391, 335, 609, 651,-32768, 3206, 2540,-32768,-32768, 199,
+-32768,-32768,-32768, 1036, 611,-32768,-32768,-32768,-32768, 2124,
+-32768, 1522,-32768, 653,-32768,-32768,-32768,-32768, 360,-32768,
+-32768, 637, 63, 63, 3291, 2540, 355,-32768,-32768,-32768,
+ 283, 630,-32768,-32768,-32768, 3206,-32768,-32768, 2205, 663,
+ 648,-32768,-32768, 652, 658, 2540, 670, 633, 642, 2485,
+ 141, 726, 189, 212,-32768, 696, 660,-32768, 661, 2931,
+-32768, 720, 1117, 64,-32768,-32768,-32768,-32768,-32768,-32768,
+ 1679,-32768, 467,-32768,-32768,-32768,-32768,-32768, 3291,-32768,
+-32768, 732,-32768,-32768, 2540, 681,-32768, 2540, 2540, 3255,
+-32768,-32768,-32768,-32768, 664, 2540, 666,-32768, 685,-32768,
+-32768,-32768, 59,-32768, 181, 1198,-32768,-32768,-32768,-32768,
+ 2540,-32768, 694, 677, 687, 2540, 748, 443, 689, 698,
+ 2540,-32768,-32768, 700,-32768, 2540, 396,-32768, 93, 399,
+-32768, 42,-32768,-32768, 2205, 699,-32768, 775,-32768, 708,
+-32768,-32768,-32768,-32768, 3273,-32768, 41,-32768, 408,-32768,
+ 408,-32768,-32768,-32768, 711, 710,-32768,-32768, 2540,-32768,
+-32768, 777, 715,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+ 725,-32768, 749, 77, 741,-32768,-32768,-32768,-32768, 2540,
+ 777, 752, 777, 2540, 754, 140,-32768,-32768, 755,-32768,
+ 535, 758,-32768, 321, 322,-32768,-32768, 760, 535,-32768,
+-32768, 321, 826, 833,-32768
+};
+
+static const short yypgoto[] = {-32768,
+-32768,-32768,-32768, 843, -353,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768, -5,-32768, -52,-32768, -230, 444,-32768, -22,
+ 60, 99,-32768, -272,-32768, -57, 547,-32768,-32768, 243,
+-32768, -21,-32768, 17, 773, 19, -55, 587, -17, -214,
+ -545, -69, -186, -124,-32768,-32768,-32768, -289,-32768, 202,
+ -487, 313,-32768,-32768,-32768,-32768, -58, -131, -362, -18,
+ -38,-32768,-32768,-32768,-32768,-32768, 538, 10,-32768,-32768,
+ 531, 327, 665, 542, -46, -86, -54, -154, -228, 258,
+-32768, -271,-32768,-32768,-32768, 330, -381, -209,-32768,-32768,
+-32768,-32768, -113, -406, -680, -505,-32768, 109,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 110,-32768,
+ -693, 43,-32768, 47,-32768, 527,-32768, -339,-32768, 521,
+ 522, 392, -270,-32768,-32768,-32768,-32768,-32768, 855,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768, -19, -347,-32768, 414,-32768, 339, 229,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768, -257,-32768,-32768,
+-32768, 233, 427,-32768,-32768,-32768,-32768, -28, 643,-32768,
+-32768, 446,-32768, 247, 458,-32768, 548, 552, -134,-32768,
+ -122,-32768,-32768, 305, 379,-32768,-32768,-32768,-32768,-32768,
+-32768, 591,-32768,-32768,-32768
+};
+
+
+#define YYLAST 3344
+
+
+static const short yytable[] = { 111,
+ 124, 61, 315, 47, 49, 51, 192, 72, 76, 70,
+ 56, 57, 77, 189, 60, 337, 62, 64, 29, 29,
+ 30, 30, 276, 403, 372, 428, 161, 208, 210, 309,
+ 402, 418, 375, 537, 277, 126, 164, 463, 263, 199,
+ 169, 269, 598, 489, 512, 429, 650, 485, 174, 224,
+ 382, 294, 62, 310, 779, 226, 523, 193, 172, 85,
+ 257, 65, 183, 735, 770, 126, 777, 306, 178, 301,
+ 219, 220, -106, -106, -106, -106, 222, 165, -106, 822,
+ -106, -106, -106, 307, 126, 487, 488, 231, -103, 221,
+ 287, 657, 52, 343, -1, 563, -106, 419, 166, 565,
+ -418, 179, 180, 170, 669, 374, 272, 171, 315, 184,
+ 268, -2, 655, 812, 473, 841, 65, 823, 185, 178,
+ 291, 167, 80, 771, -180, 831, 171, 300, 507, 673,
+ 675, 186, 53, 826, 58, 126, -106, 830, 336, 832,
+ 736, -106, 71, 42, 43, 461, 271, 577, 838, 599,
+ 849, -106, 601, 842, 292, 199, 280, 281, 669, 284,
+ 285, 224, 81, 224, 66, 289, 174, 331, 382, 332,
+ -103, 42, 43, 67, 340, -178, 860, 424, 851, 42,
+ 43, 175, 347, 65, 675, 176, 326, 426, 328, 84,
+ 306, 756, 268, 42, 43, 333, 126, 86, 126, 205,
+ 306, 42, 43, 373, 562, 670, 306, 204, 44, 379,
+ 454, 126, 440, 45, 440, 212, 852, 787, 632, 645,
+ 329, 638, 330, 384, 348, 567, 199, -34, 260, 65,
+ 509, 66, 162, 291, 58, 228, 44, 261, 262, 58,
+ 67, 45, 178, 772, 44, 229, 649, 369, 370, 45,
+ -33, 46, 126, 163, 42, 43, 427, 58, 44, 48,
+ 393, 699, 432, 45, 431, 671, 44, 611, 672, 42,
+ 43, 45, 391, 50, 230, 179, 180, 510, 179, 180,
+ 40, 41, 375, 232, 65, 183, 511, 262, 291, 233,
+ 292, 278, 350, 351, 352, 293, 355, 356, 357, 358,
+ 359, 360, 361, 362, 363, 364, 365, 366, 367, 368,
+ 634, 270, 646, 590, 658, 450, 550, 521, 620, 44,
+ 514, 517, 522, 311, 45, 653, 390, 312, 467, 257,
+ 654, 258, 184, 259, 44, 276, 662, 691, 667, 45,
+ 266, 185, 692, 480, 199, 503, 504, 277, 316, 317,
+ 282, 65, 183, 461, 186, 582, 461, 65, 183, 741,
+ 585, 795, 65, 509, 742, 425, 695, 246, 247, 248,
+ 249, 250, 126, 206, 484, 490, 5, 682, 7, 123,
+ 433, 290, 291, 126, 9, 10, 11, 603, 513, 516,
+ 77, 620, 667, 640, 307, 380, 381, 318, 858, 184,
+ 13, 176, 471, 859, 472, 184, 744, 65, 185, 65,
+ 510, 291, 462, 491, 185, 492, 296, 624, 322, 511,
+ 262, 186, 440, 321, 519, 612, 260, 186, 520, 325,
+ 659, 496, 497, 498, 660, 261, 262, 527, 678, 528,
+ 19, 499, 679, 545, 327, 21, 496, 497, 498, 559,
+ 207, -219, 316, 317, 77, 515, 569, 515, 349, 689,
+ 721, 334, 556, 312, 511, 262, 511, 262, 690, 573,
+ 574, 572, 176, 808, 77, 773, 810, 312, 604, 335,
+ 176, 579, 580, 248, 249, 250, 268, 179, 180, 721,
+ 336, 471, 174, 472, 338, 612, 668, 251, 252, 385,
+ 253, 254, 255, 256, 192, 592, 594, 386, 546, 388,
+ 77, -226, -226, 380, 381, 583, 584, 554, 394, 802,
+ 641, 641, 503, 504, 651, 496, 497, 498, 416, 661,
+ -416, 648, 605, 215, 217, 639, 399, 398, 545, 178,
+ 627, 636, 637, 89, 496, 497, 498, 415, 416, 422,
+ 668, 423, 435, 490, 680, 572, 437, 442, 631, 443,
+ 126, 444, 445, 292, 448, 446, 292, 452, 313, 453,
+ 456, -19, -19, -19, -19, 572, 196, 197, 854, -19,
+ -19, -19, 9, 10, 11, 721, 862, 457, 458, 546,
+ 459, 491, 460, 492, 178, -19, 468, 486, -153, 824,
+ 464, 825, 315, 546, -153, 5, 482, 7, 267, 506,
+ 529, 533, 674, 9, 10, 11, 508, 717, 241, 242,
+ 243, 244, 245, 246, 247, 248, 249, 250, 641, 13,
+ 195, 196, 197, 518, 532, -19, 535, 9, 10, 11,
+ -19, 536, 538, 558, 555, -153, 717, 581, 520, -153,
+ -19, 589, 564, 595, 697, 591, -31, 755, 617, 546,
+ 627, 618, 656, 622, 716, 623, 674, 251, 252, 19,
+ 253, 254, 255, 256, 21, 633, 546, 546, 652, -228,
+ -228, -259, 676, 686, 681, 693, 719, 687, 720, 698,
+ 688, 731, 775, 716, 61, 790, 780, 763, 765, 685,
+ 734, -32, 77, 784, 789, 757, 743, 745, 751, 301,
+ 752, 748, -279, -279, -279, -279, 696, 749, 796, 753,
+ -279, -279, -279, 800, 244, 245, 246, 247, 248, 249,
+ 250, 546, 758, 807, 760, 766, -279, 761, 762, 774,
+ 776, 783, 717, 785, 786, 739, 792, 242, 243, 244,
+ 245, 246, 247, 248, 249, 250, 301, 797, 798, 5,
+ 6, 7, 8, 799, 801, 750, 803, 9, 10, 11,
+ 5, 73, 7, 74, 804, 815, -279, 806, 9, 10,
+ 11, -279, 816, 13, 817, 833, 828, 845, 827, 716,
+ 546, -102, 837, 301, 13, -115, -115, -115, -115, -115,
+ -115, -115, 839, -115, -115, -115, -115, -115, 840, -115,
+ -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,
+ -115, -115, 843, 19, -115, 864, -115, -115, 21, 847,
+ 850, 853, 865, -115, 19, 856, -115, 861, -438, 21,
+ 805, -115, -115, -115, 75, 39, 778, -115, -115, 194,
+ 420, 663, -115, -115, 383, 694, 616, -115, 441, -115,
+ -115, 436, 602, 434, -115, -115, 664, 324, -115, 614,
+ -115, -115, -115, -115, 607, -115, -279, -279, -279, -279,
+ -279, -279, -279, 846, -279, -279, -279, -279, -279, 848,
+ -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,
+ -279, -279, -279, 813, 814, -279, 465, -279, -279, 478,
+ 479, 588, 168, 578, -279, 740, 738, -279, 644, 576,
+ 561, 392, -279, -279, -279, 732, 677, 557, -279, -279,
+ 625, 0, 469, -279, -279, 455, 470, 0, -279, 0,
+ -279, -279, 0, 0, 0, -279, -279, 0, 0, -279,
+ 0, -279, 0, -279, -279, 301, -279, -279, -279, 0,
+ 0, 0, -279, -279, 0, -279, 0, 0, 0, -279,
+ 0, -279, -279, -279, -279, -279, -279, -279, -279, -279,
+ -279, -279, 0, -279, 0, 0, -279, 0, -279, -279,
+ 0, 0, 0, 0, 0, -279, 0, 0, -279, 0,
+ 0, 0, 0, -279, -279, -279, 0, 0, 0, -279,
+ -279, 0, 0, 0, -279, -279, 0, 0, 0, -279,
+ 0, -279, -279, 0, 0, 0, -279, -279, 0, 0,
+ -279, 0, -279, 666, -279, -279, 301, -279, -279, -279,
+ 0, 0, 0, -279, -279, 0, -279, 0, 0, 0,
+ -279, 0, -279, -279, -279, -279, -279, -279, -279, -279,
+ -279, -279, -279, 0, -279, 0, 0, -279, 0, -279,
+ -279, 0, 0, 0, 0, 0, -279, 0, 0, -279,
+ 0, 0, 0, 0, -279, -279, -279, 0, 0, 0,
+ -279, -279, 0, 0, 0, -279, -279, 0, 0, 0,
+ -279, 0, -279, -279, 0, 0, 0, -279, -279, 0,
+ 0, -279, 0, -279, -260, -279, -279, 767, -279, -279,
+ -279, 0, 0, 0, -279, -279, 0, -279, 0, 0,
+ 0, -279, 0, -279, -279, -279, -279, -279, -279, -279,
+ -279, -279, -279, -279, 0, -279, 0, 0, -279, 0,
+ -279, -279, 0, 0, 0, 0, 0, -279, 0, 0,
+ -279, 0, 0, 0, 0, -279, -279, -279, 0, 0,
+ 0, -279, -279, 0, 0, 0, -279, -279, 0, 0,
+ 0, -279, 0, -279, -279, 0, 0, 0, -279, -279,
+ 0, 0, -279, 0, -279, 0, -279, -279, 793, -279,
+ -289, -289, 0, 0, 0, -289, -289, 0, -289, 0,
+ 0, 0, -289, 0, -289, -289, -289, -289, -289, -289,
+ -289, -289, -289, -289, -289, 0, -289, 0, 0, -289,
+ 0, -289, -289, 0, 0, 0, 0, 0, -289, 0,
+ 0, -289, 0, 0, 0, 0, -289, -289, -289, 0,
+ 0, 0, -289, -289, 0, 0, 0, -289, -289, 0,
+ 0, 0, -289, 0, -289, -289, 0, 0, 0, -289,
+ -289, 0, 0, -289, 0, -289, 0, -289, -289, 223,
+ -289, 87, 5, 0, 7, 123, 88, 89, 0, 90,
+ 9, 10, 11, 238, 239, 240, 241, 242, 243, 244,
+ 245, 246, 247, 248, 249, 250, 13, 91, 0, 0,
+ 92, 0, 93, 94, 0, 0, 0, 0, 0, 95,
+ 0, 0, 96, 0, 0, 0, 0, 97, 98, 99,
+ 0, 0, 0, 100, 101, 0, 0, 0, 102, 103,
+ 0, 0, 0, 104, 0, 105, 19, 0, 0, 0,
+ 106, 21, 0, 0, 107, 0, 0, 0, 108, 109,
+ 542, -85, 543, 43, 0, 0, 0, 88, 89, 236,
+ 90, 237, 238, 239, 240, 241, 242, 243, 244, 245,
+ 246, 247, 248, 249, 250, 0, 0, 0, 91, 0,
+ 0, 92, 0, 93, 94, 0, 0, 0, 0, 0,
+ 95, 0, 0, 96, 0, 0, 0, 0, 97, 98,
+ 99, 0, 0, 0, 100, 101, 0, 0, 0, 102,
+ 103, 0, 0, 0, 104, 0, 105, 44, 0, 0,
+ 0, 106, 45, 0, 0, 107, 0, 0, 615, 108,
+ 109, 542, 544, 543, 43, 0, 0, 0, 88, 89,
+ 0, 90, 239, 240, 241, 242, 243, 244, 245, 246,
+ 247, 248, 249, 250, 0, 0, 0, 0, 0, 91,
+ 0, 0, 92, 0, 93, 94, 0, 0, 0, 0,
+ 0, 95, 0, 0, 96, 0, 0, 0, 0, 97,
+ 98, 99, 0, 0, 0, 100, 101, 0, 0, 0,
+ 102, 103, 0, 0, 0, 104, 0, 105, 44, 0,
+ 0, 0, 106, 45, 0, 0, 107, 0, 0, -216,
+ 108, 109, 542, 544, 543, 43, 0, 0, 0, 88,
+ 89, 0, 90, 240, 241, 242, 243, 244, 245, 246,
+ 247, 248, 249, 250, 0, 0, 0, 0, 0, 0,
+ 91, 0, 0, 92, 0, 93, 94, 0, 0, 0,
+ 0, 0, 95, 0, 0, 96, 0, 0, 0, 0,
+ 97, 98, 99, 0, 0, 0, 100, 101, 0, 0,
+ 0, 102, 103, 0, 0, 0, 104, 0, 105, 44,
+ 0, 0, 0, 106, 45, 0, 0, 107, 0, 0,
+ 730, 108, 109, 542, 544, 543, 43, 0, 0, 0,
+ 88, 89, 0, 90, 243, 244, 245, 246, 247, 248,
+ 249, 250, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 91, 0, 0, 92, 0, 93, 94, 0, 0,
+ 0, 0, 0, 95, 0, 0, 96, 0, 0, 0,
+ 0, 97, 98, 99, 0, 0, 0, 100, 101, 0,
+ 0, 0, 102, 103, 0, 0, 0, 104, 0, 105,
+ 44, 0, 0, 0, 106, 45, 0, 0, 107, 542,
+ 0, 87, 108, 109, 0, 544, 88, 89, 177, 90,
+ 0, -27, -27, -27, -27, 0, 0, 0, 0, -27,
+ -27, -27, 0, 0, 0, 0, 0, 91, 0, 0,
+ 92, 0, 93, 94, 178, -27, 0, 0, -153, 95,
+ 0, 0, 96, 0, -153, 0, 0, 97, 98, 99,
+ 0, 0, 0, 100, 101, 0, 0, 0, 102, 103,
+ 0, 0, 0, 104, 0, 105, 0, 179, 180, 0,
+ 106, 0, 0, 0, 107, -27, 0, 0, 108, 109,
+ -27, 544, 0, 0, 0, -153, 0, 0, 319, -153,
+ -27, -23, -23, -23, -23, 0, 0, 0, 0, -23,
+ -23, -23, 0, 0, 87, 0, 0, 0, 0, 88,
+ 89, 0, 90, 0, 178, -23, 301, 0, -153, -440,
+ -440, -440, -440, 0, -153, 0, 0, -440, -440, -440,
+ 91, 0, 0, 92, 0, 93, 94, 0, 0, 0,
+ 0, 0, 95, -440, 0, 96, 0, 179, 180, 0,
+ 97, 98, 99, 0, 0, -23, 100, 101, 0, 0,
+ -23, 102, 103, 0, 0, -153, 104, 0, 105, -153,
+ -23, 0, 0, 106, 0, 0, 0, 107, 0, 0,
+ 0, 108, 109, -440, 87, 299, 0, 0, -440, 88,
+ 89, 404, 90, 405, 5, 6, 7, 8, -440, 0,
+ 406, 0, 9, 10, 11, 0, 0, 0, 0, 0,
+ 91, 0, 0, 92, 0, 93, 94, 0, 13, 0,
+ 0, 0, 95, 0, 0, 96, 0, 0, 0, 0,
+ 97, 98, 99, 0, 0, 0, 100, 101, 0, 0,
+ 0, 102, 103, 0, 87, 0, 104, 0, 105, 88,
+ 89, 0, 90, 106, 0, 0, 0, 107, 19, 0,
+ 0, 108, 109, 21, 0, 378, 0, -339, 0, 0,
+ 91, 0, 0, 92, 0, 93, 94, 0, 0, 0,
+ 0, 0, 95, 0, 0, 96, 0, 0, 0, 0,
+ 97, 98, 99, 0, 0, 0, 100, 101, 0, 0,
+ 0, 102, 103, 0, 87, 0, 104, 0, 105, 88,
+ 89, 0, 90, 106, 0, 0, 0, 107, 0, 0,
+ 0, 108, 109, 0, 0, 430, 0, 0, 0, 0,
+ 91, 0, 0, 92, 0, 93, 94, 0, 0, 0,
+ 0, 0, 95, 0, 0, 96, 0, 0, 0, 0,
+ 97, 98, 99, 0, 0, 0, 100, 101, 0, 0,
+ 0, 102, 103, 0, 87, 0, 104, 0, 105, 88,
+ 89, 0, 90, 106, 0, 0, 0, 107, 0, 0,
+ 0, 108, 109, 0, 0, 466, 0, 0, 0, 0,
+ 91, 0, 0, 92, 0, 93, 94, 0, 0, 0,
+ 0, 0, 95, 0, 0, 96, 0, 0, 0, 0,
+ 97, 98, 99, 0, 0, 0, 100, 101, 0, 0,
+ 0, 102, 103, 0, 0, 0, 104, 0, 105, 0,
+ 0, 0, 0, 106, 0, 0, 0, 107, 0, 0,
+ 0, 108, 109, 0, 0, 647, 543, 700, 6, 7,
+ 8, 88, 89, 0, 90, 9, 10, 11, 701, 0,
+ 702, 703, 704, 705, 706, 707, 708, 709, 710, 711,
+ 712, 13, 91, 0, 0, 92, 0, 93, 94, 0,
+ 0, 0, 0, 0, 95, 0, 0, 96, 0, 0,
+ 0, 0, 97, 98, 99, 0, 0, 0, 100, 101,
+ 0, 0, 0, 102, 103, 0, 0, 0, 104, 0,
+ 105, 713, 0, 0, 0, 106, 714, 0, 0, 107,
+ 0, 715, 0, 108, 109, 0, 336, 543, 43, 0,
+ 0, 0, 88, 89, 0, 90, 0, 0, 0, 701,
+ 0, 702, 703, 704, 705, 706, 707, 708, 709, 710,
+ 711, 712, 5, 91, 7, 123, 92, 0, 93, 94,
+ 9, 10, 11, 0, 0, 95, 0, 0, 96, 0,
+ 0, 0, 0, 97, 98, 99, 13, 0, 0, 100,
+ 101, 0, 87, 0, 102, 103, 0, 88, 89, 104,
+ 90, 105, 44, 0, 0, 0, 106, 45, 0, 0,
+ 107, 0, 715, 0, 108, 109, 0, 336, 91, 0,
+ 0, 92, 0, 93, 94, 0, 19, 0, 0, 0,
+ 95, 21, 0, 96, 0, 0, 0, 0, 97, 98,
+ 99, 0, 0, 0, 100, 101, 0, 0, 0, 102,
+ 103, 0, 0, 0, 104, 0, 105, 0, 0, 0,
+ 0, 106, 0, 0, 0, 107, 0, 0, 0, 108,
+ 109, 0, 449, 129, 130, 0, 131, 132, 0, 0,
+ 0, 133, 134, 135, 136, 137, 138, 139, 140, 141,
+ 142, 143, 144, 145, 146, 147, 148, 149, 150, 151,
+ 0, 0, 0, 0, 0, 0, 0, 87, 5, 152,
+ 7, 123, 88, 89, 0, 90, 9, 10, 11, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 13, 91, 0, 0, 92, 0, 93, 94,
+ 0, 0, 0, 154, 0, 95, 0, 0, 96, 0,
+ 0, 0, 274, 97, 98, 99, 0, 0, 0, 100,
+ 101, 0, 87, 0, 102, 103, 0, 88, 89, 104,
+ 90, 105, 19, 0, 0, 0, 106, 21, 0, 0,
+ 107, 0, 0, 0, 108, 109, 0, 5, 91, 7,
+ 267, 92, 0, 93, 94, 9, 10, 11, 0, 0,
+ 95, 0, 0, 96, 0, 0, 0, 0, 97, 98,
+ 99, 13, 0, 0, 100, 101, 0, 87, 0, 102,
+ 103, 0, 88, 89, 104, 90, 105, 339, 0, 0,
+ 0, 106, 0, 0, 0, 107, 0, 0, 0, 108,
+ 109, 0, 0, 91, 0, 0, 92, 0, 93, 94,
+ 0, 19, 0, 0, 0, 95, 21, 0, 96, 0,
+ 0, 0, 0, 97, 98, 99, 0, 0, 0, 100,
+ 101, 0, 87, 0, 102, 103, 0, 88, 89, 104,
+ 90, 105, 0, 0, 0, 0, 106, 0, 0, 0,
+ 107, 0, 754, 0, 108, 109, 0, 0, 91, 0,
+ 0, 92, 0, 93, 94, 0, 87, 0, 0, 0,
+ 95, 88, 89, 96, 90, 0, 0, 0, 97, 98,
+ 99, 0, 0, 0, 100, 101, 0, 0, 0, 102,
+ 103, 0, 91, 0, 104, 92, 105, 93, 94, 0,
+ 0, 106, 0, 0, 95, 107, 0, 96, 0, 108,
+ 109, 0, 97, 98, 99, 0, 0, 0, 100, 101,
+ 0, 87, 0, 214, 103, 0, 88, 89, 104, 90,
+ 105, 0, 0, 0, 0, 106, 0, 0, 0, 107,
+ 0, 0, 0, 108, 109, 0, 0, 91, 0, 0,
+ 92, 0, 93, 94, 0, 0, 0, 0, 0, 95,
+ 0, 0, 96, 0, 0, 0, 0, 97, 98, 99,
+ 0, 0, 0, 100, 101, 0, 0, 0, 216, 103,
+ 0, 0, 0, 104, 0, 105, 0, 0, 0, 0,
+ 106, 0, 0, 0, 107, 0, 0, 501, 108, 109,
+ 5, 0, 7, 123, 0, 0, 0, 0, 9, 10,
+ 11, 0, 0, 0, 501, 0, 0, 5, 0, 7,
+ 123, 0, 0, 0, 13, 9, 10, 11, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 13, 0, 0, 0, 4, 0, -119, 5, 6,
+ 7, 8, 0, 0, 0, 0, 9, 10, 11, 0,
+ 0, 0, 0, 0, 19, -392, -392, -392, 0, 21,
+ 0, 12, 13, 0, 502, -392, 0, 0, 0, 0,
+ 0, 19, -391, -391, -391, 0, 21, 0, 0, 0,
+ 0, 502, -391, 14, 15, -119, 0, 0, 0, 0,
+ 0, 0, 0, 0, -119, 0, 16, 17, 18, 0,
+ 0, 0, 19, 0, 0, 0, 20, 21, 22, 23,
+ 0, 4, 24, -119, 5, 6, 7, 8, 0, 0,
+ 0, 0, 9, 10, 11, 0, 0, 0, 0, 0,
+ 4, 0, -119, 5, 6, 7, 8, 0, 13, 0,
+ 0, 9, 10, 11, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 13, 0, 487,
+ 488, -119, 0, 404, 0, 0, 5, 6, 7, 8,
+ -119, 0, 406, 0, 9, 10, 11, 0, 19, 0,
+ -119, 0, 0, 21, 5, 73, 7, 74, 24, -119,
+ 13, 0, 9, 10, 11, 0, 0, 19, 0, 0,
+ 0, 0, 21, 5, 73, 7, 74, 24, 13, 0,
+ 0, 9, 10, 11, 5, 73, 7, 74, 0, 0,
+ 0, 0, 9, 10, 11, 0, 0, 13, 0, 0,
+ 19, 0, 0, 0, 0, 21, 0, 0, 13, -339,
+ 0, 0, 0, 0, 0, 0, 0, 0, 19, 0,
+ 0, 0, 0, 21, 0, 0, 0, 0, 560, 0,
+ 0, 0, 0, 0, 0, 0, 0, 19, 0, 0,
+ 0, 0, 21, 0, 0, 0, 0, 593, 19, 0,
+ 0, 129, 130, 21, 131, 132, 0, 0, 764, 133,
+ 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
+ 144, 145, 146, 147, 148, 149, 150, 151, 0, 0,
+ 129, 130, 0, 131, 132, 0, 0, 152, 133, 134,
+ 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
+ 145, 146, 147, 148, 149, 150, 151, 0, 153, 0,
+ 0, 0, 0, 0, 0, 0, 342, 0, 0, 129,
+ 130, 154, 131, 132, 0, 0, 0, 133, 134, 135,
+ 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
+ 146, 147, 148, 149, 150, 151, 0, 0, 129, 130,
+ 154, 131, 132, 0, 0, 152, 133, 134, 135, 136,
+ 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
+ 147, 148, 149, 150, 151, 0, 65, 5, 73, 7,
+ 74, 0, 0, 0, 549, 9, 10, 11, 5, 154,
+ 7, 267, 0, 0, 0, 0, 9, 10, 11, 0,
+ 0, 13, 0, 0, 0, 5, 6, 7, 8, 0,
+ 0, 406, 13, 9, 10, 11, 0, 0, 154, 0,
+ 0, 0, 0, 0, 515, 0, 0, 0, 0, 13,
+ 0, 0, 0, 511, 262, 260, 0, 0, 0, 0,
+ 0, 19, 0, 0, 261, 262, 21, 0, 0, 0,
+ 0, 0, 19, 5, 6, 7, 8, 21, 0, 587,
+ 0, 9, 10, 11, 0, 0, 0, 0, 0, 19,
+ 5, 6, 7, 8, 21, 0, 0, 13, 9, 10,
+ 11, 0, 0, 0, 0, 0, 307, 0, 0, 0,
+ 0, 234, 235, 236, 13, 237, 238, 239, 240, 241,
+ 242, 243, 244, 245, 246, 247, 248, 249, 250, 0,
+ 0, 0, 0, 0, 781, 0, 0, 19, 0, 0,
+ 0, 0, 21, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 19, 0, 0, 0, 0, 21,
+ 234, 235, 236, 782, 237, 238, 239, 240, 241, 242,
+ 243, 244, 245, 246, 247, 248, 249, 250, 234, 235,
+ 236, 821, 237, 238, 239, 240, 241, 242, 243, 244,
+ 245, 246, 247, 248, 249, 250, 234, 235, 236, 0,
+ 237, 238, 239, 240, 241, 242, 243, 244, 245, 246,
+ 247, 248, 249, 250
+};
+
+static const short yycheck[] = { 52,
+ 53, 21, 189, 9, 10, 11, 76, 29, 30, 28,
+ 16, 17, 30, 72, 20, 225, 22, 23, 2, 3,
+ 2, 3, 157, 296, 255, 315, 55, 83, 83, 184,
+ 288, 303, 261, 440, 157, 53, 56, 377, 125, 78,
+ 60, 128, 530, 397, 407, 316, 592, 395, 67, 102,
+ 265, 176, 58, 185, 748, 102, 1, 76, 64, 50,
+ 9, 3, 4, 1, 1, 83, 747, 181, 27, 1,
+ 93, 94, 4, 5, 6, 7, 99, 39, 10, 39,
+ 12, 13, 14, 31, 102, 49, 50, 110, 1, 95,
+ 46, 39, 60, 228, 0, 477, 28, 10, 60, 481,
+ 64, 60, 61, 78, 610, 260, 153, 82, 295, 51,
+ 128, 0, 600, 794, 386, 39, 3, 77, 60, 27,
+ 7, 83, 83, 60, 83, 819, 82, 180, 77, 617,
+ 618, 73, 60, 814, 46, 153, 68, 818, 83, 820,
+ 78, 73, 78, 3, 4, 374, 152, 495, 829, 531,
+ 844, 83, 534, 77, 173, 194, 162, 163, 664, 165,
+ 166, 214, 66, 216, 51, 171, 185, 214, 383, 216,
+ 83, 3, 4, 60, 227, 83, 857, 309, 39, 3,
+ 4, 78, 229, 3, 672, 82, 208, 312, 210, 83,
+ 304, 51, 210, 3, 4, 218, 214, 83, 216, 79,
+ 314, 3, 4, 256, 476, 612, 320, 60, 68, 262,
+ 345, 229, 326, 73, 328, 79, 77, 763, 566, 582,
+ 211, 575, 213, 270, 230, 483, 265, 39, 51, 3,
+ 4, 51, 39, 7, 46, 60, 68, 60, 61, 46,
+ 60, 73, 27, 731, 68, 60, 586, 253, 254, 73,
+ 39, 83, 270, 60, 3, 4, 314, 46, 68, 83,
+ 280, 668, 320, 73, 317, 79, 68, 539, 82, 3,
+ 4, 73, 278, 83, 60, 60, 61, 51, 60, 61,
+ 78, 79, 511, 77, 3, 4, 60, 61, 7, 82,
+ 309, 39, 233, 234, 235, 77, 237, 238, 239, 240,
+ 241, 242, 243, 244, 245, 246, 247, 248, 249, 250,
+ 568, 60, 583, 523, 604, 338, 451, 77, 549, 68,
+ 407, 408, 82, 78, 73, 77, 60, 82, 381, 9,
+ 82, 76, 51, 77, 68, 470, 608, 3, 610, 73,
+ 77, 60, 8, 390, 383, 401, 401, 470, 60, 61,
+ 83, 3, 4, 582, 73, 510, 585, 3, 4, 77,
+ 515, 768, 3, 4, 82, 77, 656, 49, 50, 51,
+ 52, 53, 390, 1, 394, 397, 4, 635, 6, 7,
+ 321, 78, 7, 401, 12, 13, 14, 39, 407, 408,
+ 408, 622, 664, 39, 31, 60, 61, 78, 77, 51,
+ 28, 82, 386, 82, 386, 51, 696, 3, 60, 3,
+ 51, 7, 77, 397, 60, 397, 60, 552, 82, 60,
+ 61, 73, 536, 37, 78, 539, 51, 73, 82, 68,
+ 78, 69, 70, 71, 82, 60, 61, 421, 78, 421,
+ 68, 79, 82, 449, 78, 73, 69, 70, 71, 471,
+ 78, 79, 60, 61, 472, 51, 79, 51, 78, 78,
+ 670, 77, 468, 82, 60, 61, 60, 61, 78, 491,
+ 492, 490, 82, 78, 492, 733, 78, 82, 537, 77,
+ 82, 503, 504, 51, 52, 53, 504, 60, 61, 699,
+ 83, 475, 511, 475, 77, 609, 610, 55, 56, 77,
+ 58, 59, 60, 61, 574, 527, 528, 78, 449, 10,
+ 528, 78, 79, 60, 61, 60, 61, 458, 77, 77,
+ 579, 580, 578, 578, 594, 69, 70, 71, 78, 79,
+ 64, 584, 538, 90, 91, 79, 77, 83, 544, 27,
+ 559, 570, 571, 9, 69, 70, 71, 84, 78, 60,
+ 664, 37, 79, 575, 79, 574, 77, 79, 564, 79,
+ 578, 77, 77, 582, 77, 79, 585, 39, 1, 77,
+ 77, 4, 5, 6, 7, 594, 6, 7, 851, 12,
+ 13, 14, 12, 13, 14, 795, 859, 77, 39, 530,
+ 77, 575, 84, 575, 27, 28, 77, 64, 31, 809,
+ 84, 811, 789, 544, 37, 4, 83, 6, 7, 64,
+ 60, 84, 618, 12, 13, 14, 77, 670, 44, 45,
+ 46, 47, 48, 49, 50, 51, 52, 53, 687, 28,
+ 5, 6, 7, 77, 37, 68, 79, 12, 13, 14,
+ 73, 82, 33, 78, 84, 78, 699, 78, 82, 82,
+ 83, 3, 77, 3, 660, 78, 39, 710, 39, 600,
+ 679, 82, 603, 39, 670, 84, 672, 55, 56, 68,
+ 58, 59, 60, 61, 73, 64, 617, 618, 60, 78,
+ 79, 79, 79, 39, 64, 77, 670, 82, 670, 79,
+ 84, 39, 745, 699, 714, 765, 749, 719, 720, 640,
+ 64, 39, 720, 756, 763, 711, 77, 60, 39, 1,
+ 78, 60, 4, 5, 6, 7, 657, 60, 771, 78,
+ 12, 13, 14, 776, 47, 48, 49, 50, 51, 52,
+ 53, 672, 7, 786, 39, 16, 28, 78, 78, 8,
+ 60, 78, 795, 78, 60, 686, 765, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 1, 64, 82, 4,
+ 5, 6, 7, 77, 17, 706, 78, 12, 13, 14,
+ 4, 5, 6, 7, 77, 77, 68, 78, 12, 13,
+ 14, 73, 8, 28, 77, 9, 77, 840, 78, 795,
+ 731, 83, 78, 1, 28, 3, 4, 5, 6, 7,
+ 8, 9, 78, 11, 12, 13, 14, 15, 60, 17,
+ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+ 28, 29, 82, 68, 32, 0, 34, 35, 73, 78,
+ 77, 77, 0, 41, 68, 78, 44, 78, 83, 73,
+ 781, 49, 50, 51, 78, 3, 748, 55, 56, 77,
+ 304, 609, 60, 61, 268, 654, 544, 65, 328, 67,
+ 68, 324, 536, 322, 72, 73, 609, 203, 76, 540,
+ 78, 79, 80, 81, 1, 83, 3, 4, 5, 6,
+ 7, 8, 9, 841, 11, 12, 13, 14, 15, 843,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 795, 795, 32, 380, 34, 35, 389,
+ 389, 520, 58, 500, 41, 687, 684, 44, 580, 493,
+ 475, 279, 49, 50, 51, 679, 622, 470, 55, 56,
+ 552, -1, 385, 60, 61, 345, 385, -1, 65, -1,
+ 67, 68, -1, -1, -1, 72, 73, -1, -1, 76,
+ -1, 78, -1, 80, 81, 1, 83, 3, 4, -1,
+ -1, -1, 8, 9, -1, 11, -1, -1, -1, 15,
+ -1, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, -1, 29, -1, -1, 32, -1, 34, 35,
+ -1, -1, -1, -1, -1, 41, -1, -1, 44, -1,
+ -1, -1, -1, 49, 50, 51, -1, -1, -1, 55,
+ 56, -1, -1, -1, 60, 61, -1, -1, -1, 65,
+ -1, 67, 68, -1, -1, -1, 72, 73, -1, -1,
+ 76, -1, 78, 79, 80, 81, 1, 83, 3, 4,
+ -1, -1, -1, 8, 9, -1, 11, -1, -1, -1,
+ 15, -1, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, -1, 29, -1, -1, 32, -1, 34,
+ 35, -1, -1, -1, -1, -1, 41, -1, -1, 44,
+ -1, -1, -1, -1, 49, 50, 51, -1, -1, -1,
+ 55, 56, -1, -1, -1, 60, 61, -1, -1, -1,
+ 65, -1, 67, 68, -1, -1, -1, 72, 73, -1,
+ -1, 76, -1, 78, 79, 80, 81, 1, 83, 3,
+ 4, -1, -1, -1, 8, 9, -1, 11, -1, -1,
+ -1, 15, -1, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, -1, 29, -1, -1, 32, -1,
+ 34, 35, -1, -1, -1, -1, -1, 41, -1, -1,
+ 44, -1, -1, -1, -1, 49, 50, 51, -1, -1,
+ -1, 55, 56, -1, -1, -1, 60, 61, -1, -1,
+ -1, 65, -1, 67, 68, -1, -1, -1, 72, 73,
+ -1, -1, 76, -1, 78, -1, 80, 81, 1, 83,
+ 3, 4, -1, -1, -1, 8, 9, -1, 11, -1,
+ -1, -1, 15, -1, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, -1, 29, -1, -1, 32,
+ -1, 34, 35, -1, -1, -1, -1, -1, 41, -1,
+ -1, 44, -1, -1, -1, -1, 49, 50, 51, -1,
+ -1, -1, 55, 56, -1, -1, -1, 60, 61, -1,
+ -1, -1, 65, -1, 67, 68, -1, -1, -1, 72,
+ 73, -1, -1, 76, -1, 78, -1, 80, 81, 1,
+ 83, 3, 4, -1, 6, 7, 8, 9, -1, 11,
+ 12, 13, 14, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 28, 29, -1, -1,
+ 32, -1, 34, 35, -1, -1, -1, -1, -1, 41,
+ -1, -1, 44, -1, -1, -1, -1, 49, 50, 51,
+ -1, -1, -1, 55, 56, -1, -1, -1, 60, 61,
+ -1, -1, -1, 65, -1, 67, 68, -1, -1, -1,
+ 72, 73, -1, -1, 76, -1, -1, -1, 80, 81,
+ 1, 83, 3, 4, -1, -1, -1, 8, 9, 38,
+ 11, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, -1, -1, -1, 29, -1,
+ -1, 32, -1, 34, 35, -1, -1, -1, -1, -1,
+ 41, -1, -1, 44, -1, -1, -1, -1, 49, 50,
+ 51, -1, -1, -1, 55, 56, -1, -1, -1, 60,
+ 61, -1, -1, -1, 65, -1, 67, 68, -1, -1,
+ -1, 72, 73, -1, -1, 76, -1, -1, 79, 80,
+ 81, 1, 83, 3, 4, -1, -1, -1, 8, 9,
+ -1, 11, 42, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, -1, -1, -1, -1, -1, 29,
+ -1, -1, 32, -1, 34, 35, -1, -1, -1, -1,
+ -1, 41, -1, -1, 44, -1, -1, -1, -1, 49,
+ 50, 51, -1, -1, -1, 55, 56, -1, -1, -1,
+ 60, 61, -1, -1, -1, 65, -1, 67, 68, -1,
+ -1, -1, 72, 73, -1, -1, 76, -1, -1, 79,
+ 80, 81, 1, 83, 3, 4, -1, -1, -1, 8,
+ 9, -1, 11, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, -1, -1, -1, -1, -1, -1,
+ 29, -1, -1, 32, -1, 34, 35, -1, -1, -1,
+ -1, -1, 41, -1, -1, 44, -1, -1, -1, -1,
+ 49, 50, 51, -1, -1, -1, 55, 56, -1, -1,
+ -1, 60, 61, -1, -1, -1, 65, -1, 67, 68,
+ -1, -1, -1, 72, 73, -1, -1, 76, -1, -1,
+ 79, 80, 81, 1, 83, 3, 4, -1, -1, -1,
+ 8, 9, -1, 11, 46, 47, 48, 49, 50, 51,
+ 52, 53, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 29, -1, -1, 32, -1, 34, 35, -1, -1,
+ -1, -1, -1, 41, -1, -1, 44, -1, -1, -1,
+ -1, 49, 50, 51, -1, -1, -1, 55, 56, -1,
+ -1, -1, 60, 61, -1, -1, -1, 65, -1, 67,
+ 68, -1, -1, -1, 72, 73, -1, -1, 76, 1,
+ -1, 3, 80, 81, -1, 83, 8, 9, 1, 11,
+ -1, 4, 5, 6, 7, -1, -1, -1, -1, 12,
+ 13, 14, -1, -1, -1, -1, -1, 29, -1, -1,
+ 32, -1, 34, 35, 27, 28, -1, -1, 31, 41,
+ -1, -1, 44, -1, 37, -1, -1, 49, 50, 51,
+ -1, -1, -1, 55, 56, -1, -1, -1, 60, 61,
+ -1, -1, -1, 65, -1, 67, -1, 60, 61, -1,
+ 72, -1, -1, -1, 76, 68, -1, -1, 80, 81,
+ 73, 83, -1, -1, -1, 78, -1, -1, 1, 82,
+ 83, 4, 5, 6, 7, -1, -1, -1, -1, 12,
+ 13, 14, -1, -1, 3, -1, -1, -1, -1, 8,
+ 9, -1, 11, -1, 27, 28, 1, -1, 31, 4,
+ 5, 6, 7, -1, 37, -1, -1, 12, 13, 14,
+ 29, -1, -1, 32, -1, 34, 35, -1, -1, -1,
+ -1, -1, 41, 28, -1, 44, -1, 60, 61, -1,
+ 49, 50, 51, -1, -1, 68, 55, 56, -1, -1,
+ 73, 60, 61, -1, -1, 78, 65, -1, 67, 82,
+ 83, -1, -1, 72, -1, -1, -1, 76, -1, -1,
+ -1, 80, 81, 68, 3, 84, -1, -1, 73, 8,
+ 9, 1, 11, 3, 4, 5, 6, 7, 83, -1,
+ 10, -1, 12, 13, 14, -1, -1, -1, -1, -1,
+ 29, -1, -1, 32, -1, 34, 35, -1, 28, -1,
+ -1, -1, 41, -1, -1, 44, -1, -1, -1, -1,
+ 49, 50, 51, -1, -1, -1, 55, 56, -1, -1,
+ -1, 60, 61, -1, 3, -1, 65, -1, 67, 8,
+ 9, -1, 11, 72, -1, -1, -1, 76, 68, -1,
+ -1, 80, 81, 73, -1, 84, -1, 77, -1, -1,
+ 29, -1, -1, 32, -1, 34, 35, -1, -1, -1,
+ -1, -1, 41, -1, -1, 44, -1, -1, -1, -1,
+ 49, 50, 51, -1, -1, -1, 55, 56, -1, -1,
+ -1, 60, 61, -1, 3, -1, 65, -1, 67, 8,
+ 9, -1, 11, 72, -1, -1, -1, 76, -1, -1,
+ -1, 80, 81, -1, -1, 84, -1, -1, -1, -1,
+ 29, -1, -1, 32, -1, 34, 35, -1, -1, -1,
+ -1, -1, 41, -1, -1, 44, -1, -1, -1, -1,
+ 49, 50, 51, -1, -1, -1, 55, 56, -1, -1,
+ -1, 60, 61, -1, 3, -1, 65, -1, 67, 8,
+ 9, -1, 11, 72, -1, -1, -1, 76, -1, -1,
+ -1, 80, 81, -1, -1, 84, -1, -1, -1, -1,
+ 29, -1, -1, 32, -1, 34, 35, -1, -1, -1,
+ -1, -1, 41, -1, -1, 44, -1, -1, -1, -1,
+ 49, 50, 51, -1, -1, -1, 55, 56, -1, -1,
+ -1, 60, 61, -1, -1, -1, 65, -1, 67, -1,
+ -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
+ -1, 80, 81, -1, -1, 84, 3, 4, 5, 6,
+ 7, 8, 9, -1, 11, 12, 13, 14, 15, -1,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, -1, -1, 32, -1, 34, 35, -1,
+ -1, -1, -1, -1, 41, -1, -1, 44, -1, -1,
+ -1, -1, 49, 50, 51, -1, -1, -1, 55, 56,
+ -1, -1, -1, 60, 61, -1, -1, -1, 65, -1,
+ 67, 68, -1, -1, -1, 72, 73, -1, -1, 76,
+ -1, 78, -1, 80, 81, -1, 83, 3, 4, -1,
+ -1, -1, 8, 9, -1, 11, -1, -1, -1, 15,
+ -1, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, 4, 29, 6, 7, 32, -1, 34, 35,
+ 12, 13, 14, -1, -1, 41, -1, -1, 44, -1,
+ -1, -1, -1, 49, 50, 51, 28, -1, -1, 55,
+ 56, -1, 3, -1, 60, 61, -1, 8, 9, 65,
+ 11, 67, 68, -1, -1, -1, 72, 73, -1, -1,
+ 76, -1, 78, -1, 80, 81, -1, 83, 29, -1,
+ -1, 32, -1, 34, 35, -1, 68, -1, -1, -1,
+ 41, 73, -1, 44, -1, -1, -1, -1, 49, 50,
+ 51, -1, -1, -1, 55, 56, -1, -1, -1, 60,
+ 61, -1, -1, -1, 65, -1, 67, -1, -1, -1,
+ -1, 72, -1, -1, -1, 76, -1, -1, -1, 80,
+ 81, -1, 83, 3, 4, -1, 6, 7, -1, -1,
+ -1, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ -1, -1, -1, -1, -1, -1, -1, 3, 4, 39,
+ 6, 7, 8, 9, -1, 11, 12, 13, 14, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 28, 29, -1, -1, 32, -1, 34, 35,
+ -1, -1, -1, 73, -1, 41, -1, -1, 44, -1,
+ -1, -1, 82, 49, 50, 51, -1, -1, -1, 55,
+ 56, -1, 3, -1, 60, 61, -1, 8, 9, 65,
+ 11, 67, 68, -1, -1, -1, 72, 73, -1, -1,
+ 76, -1, -1, -1, 80, 81, -1, 4, 29, 6,
+ 7, 32, -1, 34, 35, 12, 13, 14, -1, -1,
+ 41, -1, -1, 44, -1, -1, -1, -1, 49, 50,
+ 51, 28, -1, -1, 55, 56, -1, 3, -1, 60,
+ 61, -1, 8, 9, 65, 11, 67, 68, -1, -1,
+ -1, 72, -1, -1, -1, 76, -1, -1, -1, 80,
+ 81, -1, -1, 29, -1, -1, 32, -1, 34, 35,
+ -1, 68, -1, -1, -1, 41, 73, -1, 44, -1,
+ -1, -1, -1, 49, 50, 51, -1, -1, -1, 55,
+ 56, -1, 3, -1, 60, 61, -1, 8, 9, 65,
+ 11, 67, -1, -1, -1, -1, 72, -1, -1, -1,
+ 76, -1, 78, -1, 80, 81, -1, -1, 29, -1,
+ -1, 32, -1, 34, 35, -1, 3, -1, -1, -1,
+ 41, 8, 9, 44, 11, -1, -1, -1, 49, 50,
+ 51, -1, -1, -1, 55, 56, -1, -1, -1, 60,
+ 61, -1, 29, -1, 65, 32, 67, 34, 35, -1,
+ -1, 72, -1, -1, 41, 76, -1, 44, -1, 80,
+ 81, -1, 49, 50, 51, -1, -1, -1, 55, 56,
+ -1, 3, -1, 60, 61, -1, 8, 9, 65, 11,
+ 67, -1, -1, -1, -1, 72, -1, -1, -1, 76,
+ -1, -1, -1, 80, 81, -1, -1, 29, -1, -1,
+ 32, -1, 34, 35, -1, -1, -1, -1, -1, 41,
+ -1, -1, 44, -1, -1, -1, -1, 49, 50, 51,
+ -1, -1, -1, 55, 56, -1, -1, -1, 60, 61,
+ -1, -1, -1, 65, -1, 67, -1, -1, -1, -1,
+ 72, -1, -1, -1, 76, -1, -1, 1, 80, 81,
+ 4, -1, 6, 7, -1, -1, -1, -1, 12, 13,
+ 14, -1, -1, -1, 1, -1, -1, 4, -1, 6,
+ 7, -1, -1, -1, 28, 12, 13, 14, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 28, -1, -1, -1, 1, -1, 3, 4, 5,
+ 6, 7, -1, -1, -1, -1, 12, 13, 14, -1,
+ -1, -1, -1, -1, 68, 69, 70, 71, -1, 73,
+ -1, 27, 28, -1, 78, 79, -1, -1, -1, -1,
+ -1, 68, 69, 70, 71, -1, 73, -1, -1, -1,
+ -1, 78, 79, 49, 50, 51, -1, -1, -1, -1,
+ -1, -1, -1, -1, 60, -1, 62, 63, 64, -1,
+ -1, -1, 68, -1, -1, -1, 72, 73, 74, 75,
+ -1, 1, 78, 3, 4, 5, 6, 7, -1, -1,
+ -1, -1, 12, 13, 14, -1, -1, -1, -1, -1,
+ 1, -1, 3, 4, 5, 6, 7, -1, 28, -1,
+ -1, 12, 13, 14, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 28, -1, 49,
+ 50, 51, -1, 1, -1, -1, 4, 5, 6, 7,
+ 60, -1, 10, -1, 12, 13, 14, -1, 68, -1,
+ 51, -1, -1, 73, 4, 5, 6, 7, 78, 60,
+ 28, -1, 12, 13, 14, -1, -1, 68, -1, -1,
+ -1, -1, 73, 4, 5, 6, 7, 78, 28, -1,
+ -1, 12, 13, 14, 4, 5, 6, 7, -1, -1,
+ -1, -1, 12, 13, 14, -1, -1, 28, -1, -1,
+ 68, -1, -1, -1, -1, 73, -1, -1, 28, 77,
+ -1, -1, -1, -1, -1, -1, -1, -1, 68, -1,
+ -1, -1, -1, 73, -1, -1, -1, -1, 78, -1,
+ -1, -1, -1, -1, -1, -1, -1, 68, -1, -1,
+ -1, -1, 73, -1, -1, -1, -1, 78, 68, -1,
+ -1, 3, 4, 73, 6, 7, -1, -1, 78, 11,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, -1, -1,
+ 3, 4, -1, 6, 7, -1, -1, 39, 11, 12,
+ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 28, 29, -1, 60, -1,
+ -1, -1, -1, -1, -1, -1, 39, -1, -1, 3,
+ 4, 73, 6, 7, -1, -1, -1, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, -1, -1, 3, 4,
+ 73, 6, 7, -1, -1, 39, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, -1, 3, 4, 5, 6,
+ 7, -1, -1, -1, 39, 12, 13, 14, 4, 73,
+ 6, 7, -1, -1, -1, -1, 12, 13, 14, -1,
+ -1, 28, -1, -1, -1, 4, 5, 6, 7, -1,
+ -1, 10, 28, 12, 13, 14, -1, -1, 73, -1,
+ -1, -1, -1, -1, 51, -1, -1, -1, -1, 28,
+ -1, -1, -1, 60, 61, 51, -1, -1, -1, -1,
+ -1, 68, -1, -1, 60, 61, 73, -1, -1, -1,
+ -1, -1, 68, 4, 5, 6, 7, 73, -1, 10,
+ -1, 12, 13, 14, -1, -1, -1, -1, -1, 68,
+ 4, 5, 6, 7, 73, -1, -1, 28, 12, 13,
+ 14, -1, -1, -1, -1, -1, 31, -1, -1, -1,
+ -1, 36, 37, 38, 28, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, -1,
+ -1, -1, -1, -1, 10, -1, -1, 68, -1, -1,
+ -1, -1, 73, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 68, -1, -1, -1, -1, 73,
+ 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
+ 46, 47, 48, 49, 50, 51, 52, 53, 36, 37,
+ 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 36, 37, 38, -1,
+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53
+};
+/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
+#line 3 "bison.simple"
+
+/* Skeleton output parser for bison,
+ Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+
+#ifndef alloca
+#ifdef __GNUC__
+#define alloca __builtin_alloca
+#else /* not GNU C. */
+#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__)
+#include <alloca.h>
+#else /* not sparc */
+#if defined (MSDOS) && !defined (__TURBOC__)
+#include <malloc.h>
+#else /* not MSDOS, or __TURBOC__ */
+#if defined(_AIX)
+#include <malloc.h>
+ #pragma alloca
+#endif /* not _AIX */
+#endif /* not MSDOS, or __TURBOC__ */
+#endif /* not sparc. */
+#endif /* not GNU C. */
+#endif /* alloca not defined. */
+
+/* This is the parser code that is written into each bison parser
+ when the %semantic_parser declaration is not specified in the grammar.
+ It was written by Richard Stallman by simplifying the hairy parser
+ used when %semantic_parser is specified. */
+
+/* Note: there must be only one dollar sign in this file.
+ It is replaced by the list of actions, each action
+ as one case of the switch. */
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY -2
+#define YYEOF 0
+#define YYACCEPT return(0)
+#define YYABORT return(1)
+#define YYERROR goto yyerrlab1
+/* Like YYERROR except do call yyerror.
+ This remains here temporarily to ease the
+ transition to the new meaning of YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. */
+#define YYFAIL goto yyerrlab
+#define YYRECOVERING() (!!yyerrstatus)
+#define YYBACKUP(token, value) \
+do \
+ if (yychar == YYEMPTY && yylen == 1) \
+ { yychar = (token), yylval = (value); \
+ yychar1 = YYTRANSLATE (yychar); \
+ YYPOPSTACK; \
+ goto yybackup; \
+ } \
+ else \
+ { yyerror ("syntax error: cannot back up"); YYERROR; } \
+while (0)
+
+#define YYTERROR 1
+#define YYERRCODE 256
+
+#ifndef YYPURE
+#define YYLEX yylex()
+#endif
+
+#ifdef YYPURE
+#ifdef YYLSP_NEEDED
+#define YYLEX yylex(&yylval, &yylloc)
+#else
+#define YYLEX yylex(&yylval)
+#endif
+#endif
+
+/* If nonreentrant, generate the variables here */
+
+#ifndef YYPURE
+
+int yychar; /* the lookahead symbol */
+YYSTYPE yylval; /* the semantic value of the */
+ /* lookahead symbol */
+
+#ifdef YYLSP_NEEDED
+YYLTYPE yylloc; /* location data for the lookahead */
+ /* symbol */
+#endif
+
+int yynerrs; /* number of parse errors so far */
+#endif /* not YYPURE */
+
+#if YYDEBUG != 0
+int yydebug; /* nonzero means print parse trace */
+/* Since this is uninitialized, it does not stop multiple parsers
+ from coexisting. */
+#endif
+
+/* YYINITDEPTH indicates the initial size of the parser's stacks */
+
+#ifndef YYINITDEPTH
+#define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH is the maximum size the stacks can grow to
+ (effective only if the built-in stack extension method is used). */
+
+#if YYMAXDEPTH == 0
+#undef YYMAXDEPTH
+#endif
+
+#ifndef YYMAXDEPTH
+#define YYMAXDEPTH 10000
+#endif
+
+#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
+#define __yy_bcopy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)
+#else /* not GNU C or C++ */
+#ifndef __cplusplus
+
+/* This is the most reliable way to avoid incompatibilities
+ in available built-in functions on various systems. */
+static void
+__yy_bcopy (from, to, count)
+ char *from;
+ char *to;
+ int count;
+{
+ register char *f = from;
+ register char *t = to;
+ register int i = count;
+
+ while (i-- > 0)
+ *t++ = *f++;
+}
+
+#else /* __cplusplus */
+
+/* This is the most reliable way to avoid incompatibilities
+ in available built-in functions on various systems. */
+static void
+__yy_bcopy (char *from, char *to, int count)
+{
+ register char *f = from;
+ register char *t = to;
+ register int i = count;
+
+ while (i-- > 0)
+ *t++ = *f++;
+}
+
+#endif
+#endif
+
+#line 169 "bison.simple"
+int
+yyparse()
+{
+ register int yystate;
+ register int yyn;
+ register short *yyssp;
+ register YYSTYPE *yyvsp;
+ int yyerrstatus; /* number of tokens to shift before error messages enabled */
+ int yychar1; /* lookahead token as an internal (translated) token number */
+
+ short yyssa[YYINITDEPTH]; /* the state stack */
+ YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
+
+ short *yyss = yyssa; /* refer to the stacks thru separate pointers */
+ YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
+
+#ifdef YYLSP_NEEDED
+ YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
+ YYLTYPE *yyls = yylsa;
+ YYLTYPE *yylsp;
+
+#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
+#else
+#define YYPOPSTACK (yyvsp--, yyssp--)
+#endif
+
+ int yystacksize = YYINITDEPTH;
+
+#ifdef YYPURE
+ int yychar;
+ YYSTYPE yylval;
+ int yynerrs;
+#ifdef YYLSP_NEEDED
+ YYLTYPE yylloc;
+#endif
+#endif
+
+ YYSTYPE yyval; /* the variable used to return */
+ /* semantic values from the action */
+ /* routines */
+
+ int yylen;
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Starting parse\n");
+#endif
+
+ yystate = 0;
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+
+ /* Initialize stack pointers.
+ Waste one element of value and location stack
+ so that they stay on the same level as the state stack. */
+
+ yyssp = yyss - 1;
+ yyvsp = yyvs;
+#ifdef YYLSP_NEEDED
+ yylsp = yyls;
+#endif
+
+/* Push a new state, which is found in yystate . */
+/* In all cases, when you get here, the value and location stacks
+ have just been pushed. so pushing a state here evens the stacks. */
+yynewstate:
+
+ *++yyssp = yystate;
+
+ if (yyssp >= yyss + yystacksize - 1)
+ {
+ /* Give user a chance to reallocate the stack */
+ /* Use copies of these so that the &'s don't force the real ones into memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ short *yyss1 = yyss;
+#ifdef YYLSP_NEEDED
+ YYLTYPE *yyls1 = yyls;
+#endif
+
+ /* Get the current used size of the three stacks, in elements. */
+ int size = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+ /* Each stack pointer address is followed by the size of
+ the data in use in that stack, in bytes. */
+ yyoverflow("parser stack overflow",
+ &yyss1, size * sizeof (*yyssp),
+ &yyvs1, size * sizeof (*yyvsp),
+#ifdef YYLSP_NEEDED
+ &yyls1, size * sizeof (*yylsp),
+#endif
+ &yystacksize);
+
+ yyss = yyss1; yyvs = yyvs1;
+#ifdef YYLSP_NEEDED
+ yyls = yyls1;
+#endif
+#else /* no yyoverflow */
+ /* Extend the stack our own way. */
+ if (yystacksize >= YYMAXDEPTH)
+ {
+ yyerror("parser stack overflow");
+ return 2;
+ }
+ yystacksize *= 2;
+ if (yystacksize > YYMAXDEPTH)
+ yystacksize = YYMAXDEPTH;
+ yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
+ __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
+ yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
+ __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
+#ifdef YYLSP_NEEDED
+ yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
+ __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
+#endif
+#endif /* no yyoverflow */
+
+ yyssp = yyss + size - 1;
+ yyvsp = yyvs + size - 1;
+#ifdef YYLSP_NEEDED
+ yylsp = yyls + size - 1;
+#endif
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Stack size increased to %d\n", yystacksize);
+#endif
+
+ if (yyssp >= yyss + yystacksize - 1)
+ YYABORT;
+ }
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Entering state %d\n", yystate);
+#endif
+
+ yybackup:
+
+/* Do appropriate processing given the current state. */
+/* Read a lookahead token if we need one and don't already have one. */
+/* yyresume: */
+
+ /* First try to decide what to do without reference to lookahead token. */
+
+ yyn = yypact[yystate];
+ if (yyn == YYFLAG)
+ goto yydefault;
+
+ /* Not known => get a lookahead token if don't already have one. */
+
+ /* yychar is either YYEMPTY or YYEOF
+ or a valid token in external form. */
+
+ if (yychar == YYEMPTY)
+ {
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Reading a token: ");
+#endif
+ yychar = YYLEX;
+ }
+
+ /* Convert token to internal form (in yychar1) for indexing tables with */
+
+ if (yychar <= 0) /* This means end of input. */
+ {
+ yychar1 = 0;
+ yychar = YYEOF; /* Don't call YYLEX any more */
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Now at end of input.\n");
+#endif
+ }
+ else
+ {
+ yychar1 = YYTRANSLATE(yychar);
+
+#if YYDEBUG != 0
+ if (yydebug)
+ {
+ fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
+ /* Give the individual parser a way to print the precise meaning
+ of a token, for further debugging info. */
+#ifdef YYPRINT
+ YYPRINT (stderr, yychar, yylval);
+#endif
+ fprintf (stderr, ")\n");
+ }
+#endif
+ }
+
+ yyn += yychar1;
+ if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
+ goto yydefault;
+
+ yyn = yytable[yyn];
+
+ /* yyn is what to do for this token type in this state.
+ Negative => reduce, -yyn is rule number.
+ Positive => shift, yyn is new state.
+ New state is final state => don't bother to shift,
+ just return success.
+ 0, or most negative number => error. */
+
+ if (yyn < 0)
+ {
+ if (yyn == YYFLAG)
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+ else if (yyn == 0)
+ goto yyerrlab;
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+ /* Shift the lookahead token. */
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
+#endif
+
+ /* Discard the token being shifted unless it is eof. */
+ if (yychar != YYEOF)
+ yychar = YYEMPTY;
+
+ *++yyvsp = yylval;
+#ifdef YYLSP_NEEDED
+ *++yylsp = yylloc;
+#endif
+
+ /* count tokens shifted since error; after three, turn off error status. */
+ if (yyerrstatus) yyerrstatus--;
+
+ yystate = yyn;
+ goto yynewstate;
+
+/* Do the default action for the current state. */
+yydefault:
+
+ yyn = yydefact[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+
+/* Do a reduction. yyn is the number of a rule to reduce with. */
+yyreduce:
+ yylen = yyr2[yyn];
+ yyval = yyvsp[1-yylen]; /* implement default value of the action */
+
+#if YYDEBUG != 0
+ if (yydebug)
+ {
+ int i;
+
+ fprintf (stderr, "Reducing via rule %d (line %d), ",
+ yyn, yyrline[yyn]);
+
+ /* Print the symboles being reduced, and their result. */
+ for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
+ fprintf (stderr, "%s ", yytname[yyrhs[i]]);
+ fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
+ }
+#endif
+
+
+ switch (yyn) {
+
+case 1:
+#line 228 "objc-parse.y"
+{ if (pedantic)
+ pedwarn ("ANSI C forbids an empty source file");
+ objc_finish ();
+ ;
+ break;}
+case 2:
+#line 233 "objc-parse.y"
+{
+ /* In case there were missing closebraces,
+ get us back to the global binding level. */
+ while (! global_bindings_p ())
+ poplevel (0, 0, 0);
+ objc_finish ();
+ ;
+ break;}
+case 3:
+#line 247 "objc-parse.y"
+{yyval.ttype = NULL_TREE; ;
+ break;}
+case 5:
+#line 248 "objc-parse.y"
+{yyval.ttype = NULL_TREE; ;
+ break;}
+case 10:
+#line 256 "objc-parse.y"
+{ STRIP_NOPS (yyvsp[-2].ttype);
+ if ((TREE_CODE (yyvsp[-2].ttype) == ADDR_EXPR
+ && TREE_CODE (TREE_OPERAND (yyvsp[-2].ttype, 0)) == STRING_CST)
+ || TREE_CODE (yyvsp[-2].ttype) == STRING_CST)
+ assemble_asm (yyvsp[-2].ttype);
+ else
+ error ("argument of `asm' is not a constant string"); ;
+ break;}
+case 11:
+#line 267 "objc-parse.y"
+{ if (pedantic)
+ error ("ANSI C forbids data definition with no type or storage class");
+ else if (!flag_traditional)
+ warning ("data definition has no type or storage class"); ;
+ break;}
+case 12:
+#line 272 "objc-parse.y"
+{;
+ break;}
+case 13:
+#line 274 "objc-parse.y"
+{;
+ break;}
+case 14:
+#line 276 "objc-parse.y"
+{ pedwarn ("empty declaration"); ;
+ break;}
+case 15:
+#line 278 "objc-parse.y"
+{ shadow_tag (yyvsp[-1].ttype); ;
+ break;}
+case 18:
+#line 282 "objc-parse.y"
+{ if (pedantic)
+ pedwarn ("ANSI C does not allow extra `;' outside of a function"); ;
+ break;}
+case 19:
+#line 288 "objc-parse.y"
+{ if (! start_function (yyvsp[-2].ttype, yyvsp[0].ttype, 0))
+ YYERROR1;
+ reinit_parse_for_function (); ;
+ break;}
+case 20:
+#line 292 "objc-parse.y"
+{ store_parm_decls (); ;
+ break;}
+case 21:
+#line 294 "objc-parse.y"
+{ finish_function (0); ;
+ break;}
+case 22:
+#line 296 "objc-parse.y"
+{ ;
+ break;}
+case 23:
+#line 298 "objc-parse.y"
+{ if (! start_function (yyvsp[-2].ttype, yyvsp[0].ttype, 0))
+ YYERROR1;
+ reinit_parse_for_function (); ;
+ break;}
+case 24:
+#line 302 "objc-parse.y"
+{ store_parm_decls (); ;
+ break;}
+case 25:
+#line 304 "objc-parse.y"
+{ finish_function (0); ;
+ break;}
+case 26:
+#line 306 "objc-parse.y"
+{ ;
+ break;}
+case 27:
+#line 308 "objc-parse.y"
+{ if (! start_function (NULL_TREE, yyvsp[0].ttype, 0))
+ YYERROR1;
+ reinit_parse_for_function (); ;
+ break;}
+case 28:
+#line 312 "objc-parse.y"
+{ store_parm_decls (); ;
+ break;}
+case 29:
+#line 314 "objc-parse.y"
+{ finish_function (0); ;
+ break;}
+case 30:
+#line 316 "objc-parse.y"
+{ ;
+ break;}
+case 35:
+#line 327 "objc-parse.y"
+{ yyval.code = ADDR_EXPR; ;
+ break;}
+case 36:
+#line 329 "objc-parse.y"
+{ yyval.code = NEGATE_EXPR; ;
+ break;}
+case 37:
+#line 331 "objc-parse.y"
+{ yyval.code = CONVERT_EXPR; ;
+ break;}
+case 38:
+#line 333 "objc-parse.y"
+{ yyval.code = PREINCREMENT_EXPR; ;
+ break;}
+case 39:
+#line 335 "objc-parse.y"
+{ yyval.code = PREDECREMENT_EXPR; ;
+ break;}
+case 40:
+#line 337 "objc-parse.y"
+{ yyval.code = BIT_NOT_EXPR; ;
+ break;}
+case 41:
+#line 339 "objc-parse.y"
+{ yyval.code = TRUTH_NOT_EXPR; ;
+ break;}
+case 42:
+#line 343 "objc-parse.y"
+{ yyval.ttype = build_compound_expr (yyvsp[0].ttype); ;
+ break;}
+case 43:
+#line 348 "objc-parse.y"
+{ yyval.ttype = NULL_TREE; ;
+ break;}
+case 45:
+#line 354 "objc-parse.y"
+{ yyval.ttype = build_tree_list (NULL_TREE, yyvsp[0].ttype); ;
+ break;}
+case 46:
+#line 356 "objc-parse.y"
+{ chainon (yyvsp[-2].ttype, build_tree_list (NULL_TREE, yyvsp[0].ttype)); ;
+ break;}
+case 48:
+#line 362 "objc-parse.y"
+{ yyval.ttype = build_indirect_ref (yyvsp[0].ttype, "unary *"); ;
+ break;}
+case 49:
+#line 365 "objc-parse.y"
+{ yyvsp[0].itype = pedantic;
+ pedantic = 0; ;
+ break;}
+case 50:
+#line 368 "objc-parse.y"
+{ yyval.ttype = yyvsp[0].ttype;
+ pedantic = yyvsp[-2].itype; ;
+ break;}
+case 51:
+#line 371 "objc-parse.y"
+{ yyval.ttype = build_unary_op (yyvsp[-1].code, yyvsp[0].ttype, 0);
+ overflow_warning (yyval.ttype); ;
+ break;}
+case 52:
+#line 375 "objc-parse.y"
+{ tree label = lookup_label (yyvsp[0].ttype);
+ if (label == 0)
+ yyval.ttype = null_pointer_node;
+ else
+ {
+ TREE_USED (label) = 1;
+ yyval.ttype = build1 (ADDR_EXPR, ptr_type_node, label);
+ TREE_CONSTANT (yyval.ttype) = 1;
+ }
+ ;
+ break;}
+case 53:
+#line 401 "objc-parse.y"
+{ if (TREE_CODE (yyvsp[0].ttype) == COMPONENT_REF
+ && DECL_BIT_FIELD (TREE_OPERAND (yyvsp[0].ttype, 1)))
+ error ("`sizeof' applied to a bit-field");
+ yyval.ttype = c_sizeof (TREE_TYPE (yyvsp[0].ttype)); ;
+ break;}
+case 54:
+#line 406 "objc-parse.y"
+{ yyval.ttype = c_sizeof (groktypename (yyvsp[-1].ttype)); ;
+ break;}
+case 55:
+#line 408 "objc-parse.y"
+{ yyval.ttype = c_alignof_expr (yyvsp[0].ttype); ;
+ break;}
+case 56:
+#line 410 "objc-parse.y"
+{ yyval.ttype = c_alignof (groktypename (yyvsp[-1].ttype)); ;
+ break;}
+case 57:
+#line 412 "objc-parse.y"
+{ yyval.ttype = build_unary_op (REALPART_EXPR, yyvsp[0].ttype, 0); ;
+ break;}
+case 58:
+#line 414 "objc-parse.y"
+{ yyval.ttype = build_unary_op (IMAGPART_EXPR, yyvsp[0].ttype, 0); ;
+ break;}
+case 60:
+#line 420 "objc-parse.y"
+{ tree type = groktypename (yyvsp[-2].ttype);
+ yyval.ttype = build_c_cast (type, yyvsp[0].ttype); ;
+ break;}
+case 61:
+#line 423 "objc-parse.y"
+{ tree type = groktypename (yyvsp[-5].ttype);
+ char *name;
+ if (pedantic)
+ pedwarn ("ANSI C forbids constructor expressions");
+ if (TYPE_NAME (type) != 0)
+ {
+ if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
+ name = IDENTIFIER_POINTER (TYPE_NAME (type));
+ else
+ name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
+ }
+ else
+ name = "";
+ yyval.ttype = digest_init (type, build_nt (CONSTRUCTOR, NULL_TREE, nreverse (yyvsp[-2].ttype)),
+ NULL_PTR, 0, 0, name);
+ if (TREE_CODE (type) == ARRAY_TYPE && TYPE_SIZE (type) == 0)
+ {
+ int failure = complete_array_type (type, yyval.ttype, 1);
+ if (failure)
+ abort ();
+ }
+ ;
+ break;}
+case 63:
+#line 450 "objc-parse.y"
+{ yyval.ttype = parser_build_binary_op (yyvsp[-1].code, yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 64:
+#line 452 "objc-parse.y"
+{ yyval.ttype = parser_build_binary_op (yyvsp[-1].code, yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 65:
+#line 454 "objc-parse.y"
+{ yyval.ttype = parser_build_binary_op (yyvsp[-1].code, yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 66:
+#line 456 "objc-parse.y"
+{ yyval.ttype = parser_build_binary_op (yyvsp[-1].code, yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 67:
+#line 458 "objc-parse.y"
+{ yyval.ttype = parser_build_binary_op (yyvsp[-1].code, yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 68:
+#line 460 "objc-parse.y"
+{ yyval.ttype = parser_build_binary_op (yyvsp[-1].code, yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 69:
+#line 462 "objc-parse.y"
+{ yyval.ttype = parser_build_binary_op (yyvsp[-1].code, yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 70:
+#line 464 "objc-parse.y"
+{ yyval.ttype = parser_build_binary_op (yyvsp[-1].code, yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 71:
+#line 466 "objc-parse.y"
+{ yyval.ttype = parser_build_binary_op (yyvsp[-1].code, yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 72:
+#line 468 "objc-parse.y"
+{ yyval.ttype = parser_build_binary_op (yyvsp[-1].code, yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 73:
+#line 470 "objc-parse.y"
+{ yyval.ttype = parser_build_binary_op (yyvsp[-1].code, yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 74:
+#line 472 "objc-parse.y"
+{ yyval.ttype = parser_build_binary_op (yyvsp[-1].code, yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 75:
+#line 474 "objc-parse.y"
+{ yyval.ttype = parser_build_binary_op (TRUTH_ANDIF_EXPR, yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 76:
+#line 476 "objc-parse.y"
+{ yyval.ttype = parser_build_binary_op (TRUTH_ORIF_EXPR, yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 77:
+#line 478 "objc-parse.y"
+{ yyval.ttype = build_conditional_expr (yyvsp[-4].ttype, yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 78:
+#line 480 "objc-parse.y"
+{ yyval.ttype = build_modify_expr (yyvsp[-2].ttype, NOP_EXPR, yyvsp[0].ttype);
+ C_SET_EXP_ORIGINAL_CODE (yyval.ttype, MODIFY_EXPR); ;
+ break;}
+case 79:
+#line 483 "objc-parse.y"
+{ yyval.ttype = build_modify_expr (yyvsp[-2].ttype, yyvsp[-1].code, yyvsp[0].ttype);
+ /* This inhibits warnings in truthvalue_conversion. */
+ C_SET_EXP_ORIGINAL_CODE (yyval.ttype, ERROR_MARK); ;
+ break;}
+case 80:
+#line 490 "objc-parse.y"
+{
+ tree context;
+
+ yyval.ttype = lastiddecl;
+ if (!yyval.ttype || yyval.ttype == error_mark_node)
+ {
+ if (yychar == YYEMPTY)
+ yychar = YYLEX;
+ if (yychar == '(')
+ {
+ tree decl;
+
+ if (objc_receiver_context
+ && ! (objc_receiver_context
+ && strcmp (IDENTIFIER_POINTER (yyvsp[0].ttype), "super")))
+ /* we have a message to super */
+ yyval.ttype = get_super_receiver ();
+ else if (objc_method_context
+ && (decl = is_ivar (objc_ivar_chain, yyvsp[0].ttype)))
+ {
+ if (is_private (decl))
+ yyval.ttype = error_mark_node;
+ else
+ yyval.ttype = build_ivar_reference (yyvsp[0].ttype);
+ }
+ else
+ {
+ /* Ordinary implicit function declaration. */
+ yyval.ttype = implicitly_declare (yyvsp[0].ttype);
+ assemble_external (yyval.ttype);
+ TREE_USED (yyval.ttype) = 1;
+ }
+ }
+ else if (current_function_decl == 0)
+ {
+ error ("`%s' undeclared here (not in a function)",
+ IDENTIFIER_POINTER (yyvsp[0].ttype));
+ yyval.ttype = error_mark_node;
+ }
+ else
+ {
+ tree decl;
+
+ if (objc_receiver_context
+ && ! strcmp (IDENTIFIER_POINTER (yyvsp[0].ttype), "super"))
+ /* we have a message to super */
+ yyval.ttype = get_super_receiver ();
+ else if (objc_method_context
+ && (decl = is_ivar (objc_ivar_chain, yyvsp[0].ttype)))
+ {
+ if (is_private (decl))
+ yyval.ttype = error_mark_node;
+ else
+ yyval.ttype = build_ivar_reference (yyvsp[0].ttype);
+ }
+ else
+ {
+ if (IDENTIFIER_GLOBAL_VALUE (yyvsp[0].ttype) != error_mark_node
+ || IDENTIFIER_ERROR_LOCUS (yyvsp[0].ttype) != current_function_decl)
+ {
+ error ("`%s' undeclared (first use this function)",
+ IDENTIFIER_POINTER (yyvsp[0].ttype));
+
+ if (! undeclared_variable_notice)
+ {
+ error ("(Each undeclared identifier is reported only once");
+ error ("for each function it appears in.)");
+ undeclared_variable_notice = 1;
+ }
+ }
+ yyval.ttype = error_mark_node;
+ /* Prevent repeated error messages. */
+ IDENTIFIER_GLOBAL_VALUE (yyvsp[0].ttype) = error_mark_node;
+ IDENTIFIER_ERROR_LOCUS (yyvsp[0].ttype) = current_function_decl;
+ }
+ }
+ }
+ else if (TREE_TYPE (yyval.ttype) == error_mark_node)
+ yyval.ttype = error_mark_node;
+ else if (C_DECL_ANTICIPATED (yyval.ttype))
+ {
+ /* The first time we see a build-in function used,
+ if it has not been declared. */
+ C_DECL_ANTICIPATED (yyval.ttype) = 0;
+ if (yychar == YYEMPTY)
+ yychar = YYLEX;
+ if (yychar == '(')
+ {
+ /* Omit the implicit declaration we
+ would ordinarily do, so we don't lose
+ the actual built in type.
+ But print a diagnostic for the mismatch. */
+ if (objc_method_context
+ && is_ivar (objc_ivar_chain, yyvsp[0].ttype))
+ error ("Instance variable `%s' implicitly declared as function",
+ IDENTIFIER_POINTER (DECL_NAME (yyval.ttype)));
+ else
+ if (TREE_CODE (yyval.ttype) != FUNCTION_DECL)
+ error ("`%s' implicitly declared as function",
+ IDENTIFIER_POINTER (DECL_NAME (yyval.ttype)));
+ else if ((TYPE_MODE (TREE_TYPE (TREE_TYPE (yyval.ttype)))
+ != TYPE_MODE (integer_type_node))
+ && (TREE_TYPE (TREE_TYPE (yyval.ttype))
+ != void_type_node))
+ pedwarn ("type mismatch in implicit declaration for built-in function `%s'",
+ IDENTIFIER_POINTER (DECL_NAME (yyval.ttype)));
+ /* If it really returns void, change that to int. */
+ if (TREE_TYPE (TREE_TYPE (yyval.ttype)) == void_type_node)
+ TREE_TYPE (yyval.ttype)
+ = build_function_type (integer_type_node,
+ TYPE_ARG_TYPES (TREE_TYPE (yyval.ttype)));
+ }
+ else
+ pedwarn ("built-in function `%s' used without declaration",
+ IDENTIFIER_POINTER (DECL_NAME (yyval.ttype)));
+
+ /* Do what we would ordinarily do when a fn is used. */
+ assemble_external (yyval.ttype);
+ TREE_USED (yyval.ttype) = 1;
+ }
+ else
+ {
+ assemble_external (yyval.ttype);
+ TREE_USED (yyval.ttype) = 1;
+ /* we have a definition - still check if iVariable */
+
+ if (!objc_receiver_context
+ || (objc_receiver_context
+ && strcmp (IDENTIFIER_POINTER (yyvsp[0].ttype), "super")))
+ {
+ tree decl;
+
+ if (objc_method_context
+ && (decl = is_ivar (objc_ivar_chain, yyvsp[0].ttype)))
+ {
+ if (IDENTIFIER_LOCAL_VALUE (yyvsp[0].ttype))
+ warning ("local declaration of `%s' hides instance variable",
+ IDENTIFIER_POINTER (yyvsp[0].ttype));
+ else
+ {
+ if (is_private (decl))
+ yyval.ttype = error_mark_node;
+ else
+ yyval.ttype = build_ivar_reference (yyvsp[0].ttype);
+ }
+ }
+ }
+ else /* we have a message to super */
+ yyval.ttype = get_super_receiver ();
+ }
+
+ if (TREE_CODE (yyval.ttype) == CONST_DECL)
+ {
+ yyval.ttype = DECL_INITIAL (yyval.ttype);
+ /* This is to prevent an enum whose value is 0
+ from being considered a null pointer constant. */
+ yyval.ttype = build1 (NOP_EXPR, TREE_TYPE (yyval.ttype), yyval.ttype);
+ TREE_CONSTANT (yyval.ttype) = 1;
+ }
+ ;
+ break;}
+case 82:
+#line 652 "objc-parse.y"
+{ yyval.ttype = combine_strings (yyvsp[0].ttype); ;
+ break;}
+case 83:
+#line 654 "objc-parse.y"
+{ char class = TREE_CODE_CLASS (TREE_CODE (yyvsp[-1].ttype));
+ if (class == 'e' || class == '1'
+ || class == '2' || class == '<')
+ C_SET_EXP_ORIGINAL_CODE (yyvsp[-1].ttype, ERROR_MARK);
+ yyval.ttype = yyvsp[-1].ttype; ;
+ break;}
+case 84:
+#line 660 "objc-parse.y"
+{ yyval.ttype = error_mark_node; ;
+ break;}
+case 85:
+#line 662 "objc-parse.y"
+{ if (current_function_decl == 0)
+ {
+ error ("braced-group within expression allowed only inside a function");
+ YYERROR;
+ }
+ /* We must force a BLOCK for this level
+ so that, if it is not expanded later,
+ there is a way to turn off the entire subtree of blocks
+ that are contained in it. */
+ keep_next_level ();
+ push_iterator_stack ();
+ push_label_level ();
+ yyval.ttype = expand_start_stmt_expr (); ;
+ break;}
+case 86:
+#line 676 "objc-parse.y"
+{ tree rtl_exp;
+ if (pedantic)
+ pedwarn ("ANSI C forbids braced-groups within expressions");
+ pop_iterator_stack ();
+ pop_label_level ();
+ rtl_exp = expand_end_stmt_expr (yyvsp[-2].ttype);
+ /* The statements have side effects, so the group does. */
+ TREE_SIDE_EFFECTS (rtl_exp) = 1;
+
+ /* Make a BIND_EXPR for the BLOCK already made. */
+ yyval.ttype = build (BIND_EXPR, TREE_TYPE (rtl_exp),
+ NULL_TREE, rtl_exp, yyvsp[-1].ttype);
+ /* Remove the block from the tree at this point.
+ It gets put back at the proper place
+ when the BIND_EXPR is expanded. */
+ delete_block (yyvsp[-1].ttype);
+ ;
+ break;}
+case 87:
+#line 694 "objc-parse.y"
+{ yyval.ttype = build_function_call (yyvsp[-3].ttype, yyvsp[-1].ttype); ;
+ break;}
+case 88:
+#line 696 "objc-parse.y"
+{ yyval.ttype = build_array_ref (yyvsp[-3].ttype, yyvsp[-1].ttype); ;
+ break;}
+case 89:
+#line 698 "objc-parse.y"
+{
+ if (doing_objc_thang)
+ {
+ if (is_public (yyvsp[-2].ttype, yyvsp[0].ttype))
+ yyval.ttype = build_component_ref (yyvsp[-2].ttype, yyvsp[0].ttype);
+ else
+ yyval.ttype = error_mark_node;
+ }
+ else
+ yyval.ttype = build_component_ref (yyvsp[-2].ttype, yyvsp[0].ttype);
+ ;
+ break;}
+case 90:
+#line 710 "objc-parse.y"
+{
+ tree expr = build_indirect_ref (yyvsp[-2].ttype, "->");
+
+ if (doing_objc_thang)
+ {
+ if (is_public (expr, yyvsp[0].ttype))
+ yyval.ttype = build_component_ref (expr, yyvsp[0].ttype);
+ else
+ yyval.ttype = error_mark_node;
+ }
+ else
+ yyval.ttype = build_component_ref (expr, yyvsp[0].ttype);
+ ;
+ break;}
+case 91:
+#line 724 "objc-parse.y"
+{ yyval.ttype = build_unary_op (POSTINCREMENT_EXPR, yyvsp[-1].ttype, 0); ;
+ break;}
+case 92:
+#line 726 "objc-parse.y"
+{ yyval.ttype = build_unary_op (POSTDECREMENT_EXPR, yyvsp[-1].ttype, 0); ;
+ break;}
+case 93:
+#line 728 "objc-parse.y"
+{ yyval.ttype = build_message_expr (yyvsp[0].ttype); ;
+ break;}
+case 94:
+#line 730 "objc-parse.y"
+{ yyval.ttype = build_selector_expr (yyvsp[0].ttype); ;
+ break;}
+case 95:
+#line 732 "objc-parse.y"
+{ yyval.ttype = build_protocol_expr (yyvsp[0].ttype); ;
+ break;}
+case 96:
+#line 734 "objc-parse.y"
+{ yyval.ttype = build_encode_expr (yyvsp[0].ttype); ;
+ break;}
+case 97:
+#line 736 "objc-parse.y"
+{ yyval.ttype = build_objc_string_object (yyvsp[0].ttype); ;
+ break;}
+case 99:
+#line 743 "objc-parse.y"
+{ yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype); ;
+ break;}
+case 101:
+#line 751 "objc-parse.y"
+{ yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype); ;
+ break;}
+case 104:
+#line 759 "objc-parse.y"
+{ c_mark_varargs ();
+ if (pedantic)
+ pedwarn ("ANSI C does not permit use of `varargs.h'"); ;
+ break;}
+case 105:
+#line 769 "objc-parse.y"
+{ ;
+ break;}
+case 110:
+#line 781 "objc-parse.y"
+{ current_declspecs = TREE_VALUE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary (yyvsp[-2].itype); ;
+ break;}
+case 111:
+#line 785 "objc-parse.y"
+{ current_declspecs = TREE_VALUE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary (yyvsp[-2].itype); ;
+ break;}
+case 112:
+#line 789 "objc-parse.y"
+{ shadow_tag_warned (yyvsp[-1].ttype, 1);
+ pedwarn ("empty declaration"); ;
+ break;}
+case 113:
+#line 792 "objc-parse.y"
+{ pedwarn ("empty declaration"); ;
+ break;}
+case 114:
+#line 801 "objc-parse.y"
+{ ;
+ break;}
+case 119:
+#line 816 "objc-parse.y"
+{ yyval.itype = suspend_momentary ();
+ pending_xref_error ();
+ declspec_stack = tree_cons (NULL_TREE, current_declspecs,
+ declspec_stack);
+ current_declspecs = yyvsp[0].ttype; ;
+ break;}
+case 120:
+#line 825 "objc-parse.y"
+{ current_declspecs = TREE_VALUE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary (yyvsp[-2].itype); ;
+ break;}
+case 121:
+#line 829 "objc-parse.y"
+{ current_declspecs = TREE_VALUE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary (yyvsp[-2].itype); ;
+ break;}
+case 122:
+#line 833 "objc-parse.y"
+{ current_declspecs = TREE_VALUE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary (yyvsp[-1].itype); ;
+ break;}
+case 123:
+#line 837 "objc-parse.y"
+{ current_declspecs = TREE_VALUE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary (yyvsp[-1].itype); ;
+ break;}
+case 124:
+#line 841 "objc-parse.y"
+{ shadow_tag (yyvsp[-1].ttype); ;
+ break;}
+case 125:
+#line 843 "objc-parse.y"
+{ pedwarn ("empty declaration"); ;
+ break;}
+case 126:
+#line 852 "objc-parse.y"
+{ yyval.ttype = tree_cons (NULL_TREE, yyvsp[-1].ttype, yyvsp[0].ttype); ;
+ break;}
+case 127:
+#line 854 "objc-parse.y"
+{ yyval.ttype = chainon (yyvsp[0].ttype, tree_cons (NULL_TREE, yyvsp[-1].ttype, yyvsp[-2].ttype)); ;
+ break;}
+case 128:
+#line 858 "objc-parse.y"
+{ yyval.ttype = NULL_TREE; ;
+ break;}
+case 129:
+#line 860 "objc-parse.y"
+{ yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ;
+ break;}
+case 130:
+#line 862 "objc-parse.y"
+{ if (extra_warnings)
+ warning ("`%s' is not at beginning of declaration",
+ IDENTIFIER_POINTER (yyvsp[0].ttype));
+ yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ;
+ break;}
+case 131:
+#line 874 "objc-parse.y"
+{ yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, NULL_TREE);
+ TREE_STATIC (yyval.ttype) = 1; ;
+ break;}
+case 132:
+#line 877 "objc-parse.y"
+{ yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, NULL_TREE); ;
+ break;}
+case 133:
+#line 879 "objc-parse.y"
+{ yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype);
+ TREE_STATIC (yyval.ttype) = 1; ;
+ break;}
+case 134:
+#line 882 "objc-parse.y"
+{ if (extra_warnings && TREE_STATIC (yyvsp[-1].ttype))
+ warning ("`%s' is not at beginning of declaration",
+ IDENTIFIER_POINTER (yyvsp[0].ttype));
+ yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype);
+ TREE_STATIC (yyval.ttype) = TREE_STATIC (yyvsp[-1].ttype); ;
+ break;}
+case 135:
+#line 896 "objc-parse.y"
+{ yyval.ttype = tree_cons (NULL_TREE, yyvsp[-1].ttype, yyvsp[0].ttype); ;
+ break;}
+case 136:
+#line 898 "objc-parse.y"
+{ yyval.ttype = chainon (yyvsp[0].ttype, tree_cons (NULL_TREE, yyvsp[-1].ttype, yyvsp[-2].ttype)); ;
+ break;}
+case 137:
+#line 902 "objc-parse.y"
+{ yyval.ttype = NULL_TREE; ;
+ break;}
+case 138:
+#line 904 "objc-parse.y"
+{ yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ;
+ break;}
+case 141:
+#line 914 "objc-parse.y"
+{ /* For a typedef name, record the meaning, not the name.
+ In case of `foo foo, bar;'. */
+ yyval.ttype = lookup_name (yyvsp[0].ttype); ;
+ break;}
+case 142:
+#line 918 "objc-parse.y"
+{ yyval.ttype = get_static_reference (yyvsp[-1].ttype, yyvsp[0].ttype); ;
+ break;}
+case 143:
+#line 920 "objc-parse.y"
+{ yyval.ttype = get_object_reference (yyvsp[0].ttype); ;
+ break;}
+case 144:
+#line 922 "objc-parse.y"
+{ yyval.ttype = TREE_TYPE (yyvsp[-1].ttype); ;
+ break;}
+case 145:
+#line 924 "objc-parse.y"
+{ yyval.ttype = groktypename (yyvsp[-1].ttype); ;
+ break;}
+case 153:
+#line 946 "objc-parse.y"
+{ yyval.ttype = NULL_TREE; ;
+ break;}
+case 154:
+#line 948 "objc-parse.y"
+{ if (TREE_CHAIN (yyvsp[-1].ttype)) yyvsp[-1].ttype = combine_strings (yyvsp[-1].ttype);
+ yyval.ttype = yyvsp[-1].ttype;
+ ;
+ break;}
+case 155:
+#line 955 "objc-parse.y"
+{ yyval.ttype = start_decl (yyvsp[-3].ttype, current_declspecs, 1); ;
+ break;}
+case 156:
+#line 958 "objc-parse.y"
+{ decl_attributes (yyvsp[-1].ttype, yyvsp[-3].ttype);
+ finish_decl (yyvsp[-1].ttype, yyvsp[0].ttype, yyvsp[-4].ttype); ;
+ break;}
+case 157:
+#line 961 "objc-parse.y"
+{ tree d = start_decl (yyvsp[-2].ttype, current_declspecs, 0);
+ decl_attributes (d, yyvsp[0].ttype);
+ finish_decl (d, NULL_TREE, yyvsp[-1].ttype); ;
+ break;}
+case 158:
+#line 968 "objc-parse.y"
+{ yyval.ttype = start_decl (yyvsp[-3].ttype, current_declspecs, 1); ;
+ break;}
+case 159:
+#line 971 "objc-parse.y"
+{ decl_attributes (yyvsp[-1].ttype, yyvsp[-3].ttype);
+ finish_decl (yyvsp[-1].ttype, yyvsp[0].ttype, yyvsp[-4].ttype); ;
+ break;}
+case 160:
+#line 974 "objc-parse.y"
+{ tree d = start_decl (yyvsp[-2].ttype, current_declspecs, 0);
+ decl_attributes (d, yyvsp[0].ttype);
+ finish_decl (d, NULL_TREE, yyvsp[-1].ttype); ;
+ break;}
+case 161:
+#line 982 "objc-parse.y"
+{ yyval.ttype = NULL_TREE; ;
+ break;}
+case 162:
+#line 984 "objc-parse.y"
+{ yyval.ttype = yyvsp[-2].ttype; ;
+ break;}
+case 163:
+#line 989 "objc-parse.y"
+{ yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, NULL_TREE); ;
+ break;}
+case 164:
+#line 991 "objc-parse.y"
+{ yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-2].ttype); ;
+ break;}
+case 165:
+#line 996 "objc-parse.y"
+{ if (strcmp (IDENTIFIER_POINTER (yyvsp[0].ttype), "packed"))
+ warning ("`%s' attribute directive ignored",
+ IDENTIFIER_POINTER (yyvsp[0].ttype));
+ yyval.ttype = yyvsp[0].ttype; ;
+ break;}
+case 166:
+#line 1001 "objc-parse.y"
+{ /* If not "mode (m)", then issue warning. */
+ if (strcmp (IDENTIFIER_POINTER (yyvsp[-3].ttype), "mode") != 0)
+ {
+ warning ("`%s' attribute directive ignored",
+ IDENTIFIER_POINTER (yyvsp[-3].ttype));
+ yyval.ttype = yyvsp[-3].ttype;
+ }
+ else
+ yyval.ttype = tree_cons (yyvsp[-3].ttype, yyvsp[-1].ttype, NULL_TREE); ;
+ break;}
+case 167:
+#line 1011 "objc-parse.y"
+{ /* if not "aligned(n)", then issue warning */
+ if (strcmp (IDENTIFIER_POINTER (yyvsp[-3].ttype), "aligned") != 0
+ || TREE_CODE (yyvsp[-1].ttype) != INTEGER_CST)
+ {
+ warning ("`%s' attribute directive ignored",
+ IDENTIFIER_POINTER (yyvsp[-3].ttype));
+ yyval.ttype = yyvsp[-3].ttype;
+ }
+ else
+ yyval.ttype = tree_cons (yyvsp[-3].ttype, yyvsp[-1].ttype, NULL_TREE); ;
+ break;}
+case 168:
+#line 1022 "objc-parse.y"
+{ /* if not "format(...)", then issue warning */
+ if (strcmp (IDENTIFIER_POINTER (yyvsp[-7].ttype), "format") != 0
+ || TREE_CODE (yyvsp[-3].ttype) != INTEGER_CST
+ || TREE_CODE (yyvsp[-1].ttype) != INTEGER_CST)
+ {
+ warning ("`%s' attribute directive ignored",
+ IDENTIFIER_POINTER (yyvsp[-7].ttype));
+ yyval.ttype = yyvsp[-7].ttype;
+ }
+ else
+ yyval.ttype = tree_cons (yyvsp[-7].ttype,
+ tree_cons (yyvsp[-5].ttype,
+ tree_cons (yyvsp[-3].ttype, yyvsp[-1].ttype, NULL_TREE),
+ NULL_TREE),
+ NULL_TREE); ;
+ break;}
+case 170:
+#line 1042 "objc-parse.y"
+{ yyval.ttype = build_nt (CONSTRUCTOR, NULL_TREE, NULL_TREE);
+ if (pedantic)
+ pedwarn ("ANSI C forbids empty initializer braces"); ;
+ break;}
+case 171:
+#line 1046 "objc-parse.y"
+{ yyval.ttype = build_nt (CONSTRUCTOR, NULL_TREE, nreverse (yyvsp[-1].ttype)); ;
+ break;}
+case 172:
+#line 1048 "objc-parse.y"
+{ yyval.ttype = build_nt (CONSTRUCTOR, NULL_TREE, nreverse (yyvsp[-2].ttype)); ;
+ break;}
+case 173:
+#line 1050 "objc-parse.y"
+{ yyval.ttype = NULL_TREE; ;
+ break;}
+case 174:
+#line 1057 "objc-parse.y"
+{ yyval.ttype = build_tree_list (NULL_TREE, yyvsp[0].ttype); ;
+ break;}
+case 175:
+#line 1059 "objc-parse.y"
+{ yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-2].ttype); ;
+ break;}
+case 176:
+#line 1064 "objc-parse.y"
+{ yyval.ttype = build_tree_list (yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 177:
+#line 1066 "objc-parse.y"
+{ yyval.ttype = tree_cons (yyvsp[-2].ttype, yyvsp[0].ttype, yyvsp[-4].ttype); ;
+ break;}
+case 178:
+#line 1071 "objc-parse.y"
+{ push_c_function_context ();
+ if (! start_function (current_declspecs, yyvsp[0].ttype, 1))
+ {
+ pop_c_function_context ();
+ YYERROR1;
+ }
+ reinit_parse_for_function ();
+ store_parm_decls (); ;
+ break;}
+case 179:
+#line 1086 "objc-parse.y"
+{ finish_function (1);
+ pop_c_function_context (); ;
+ break;}
+case 180:
+#line 1092 "objc-parse.y"
+{ push_c_function_context ();
+ if (! start_function (current_declspecs, yyvsp[0].ttype, 1))
+ {
+ pop_c_function_context ();
+ YYERROR1;
+ }
+ reinit_parse_for_function ();
+ store_parm_decls (); ;
+ break;}
+case 181:
+#line 1107 "objc-parse.y"
+{ finish_function (1);
+ pop_c_function_context (); ;
+ break;}
+case 184:
+#line 1123 "objc-parse.y"
+{ yyval.ttype = yyvsp[-1].ttype; ;
+ break;}
+case 185:
+#line 1125 "objc-parse.y"
+{ yyval.ttype = build_nt (CALL_EXPR, yyvsp[-2].ttype, yyvsp[0].ttype, NULL_TREE); ;
+ break;}
+case 186:
+#line 1130 "objc-parse.y"
+{ yyval.ttype = build_nt (ARRAY_REF, yyvsp[-3].ttype, yyvsp[-1].ttype); ;
+ break;}
+case 187:
+#line 1132 "objc-parse.y"
+{ yyval.ttype = build_nt (ARRAY_REF, yyvsp[-2].ttype, NULL_TREE); ;
+ break;}
+case 188:
+#line 1134 "objc-parse.y"
+{ yyval.ttype = make_pointer_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); ;
+ break;}
+case 191:
+#line 1146 "objc-parse.y"
+{ yyval.ttype = build_nt (CALL_EXPR, yyvsp[-2].ttype, yyvsp[0].ttype, NULL_TREE); ;
+ break;}
+case 192:
+#line 1151 "objc-parse.y"
+{ yyval.ttype = build_nt (ARRAY_REF, yyvsp[-3].ttype, yyvsp[-1].ttype); ;
+ break;}
+case 193:
+#line 1153 "objc-parse.y"
+{ yyval.ttype = build_nt (ARRAY_REF, yyvsp[-2].ttype, NULL_TREE); ;
+ break;}
+case 194:
+#line 1155 "objc-parse.y"
+{ yyval.ttype = make_pointer_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); ;
+ break;}
+case 196:
+#line 1164 "objc-parse.y"
+{ yyval.ttype = build_nt (CALL_EXPR, yyvsp[-2].ttype, yyvsp[0].ttype, NULL_TREE); ;
+ break;}
+case 197:
+#line 1169 "objc-parse.y"
+{ yyval.ttype = yyvsp[-1].ttype; ;
+ break;}
+case 198:
+#line 1171 "objc-parse.y"
+{ yyval.ttype = make_pointer_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); ;
+ break;}
+case 199:
+#line 1173 "objc-parse.y"
+{ yyval.ttype = build_nt (ARRAY_REF, yyvsp[-3].ttype, yyvsp[-1].ttype); ;
+ break;}
+case 200:
+#line 1175 "objc-parse.y"
+{ yyval.ttype = build_nt (ARRAY_REF, yyvsp[-2].ttype, NULL_TREE); ;
+ break;}
+case 202:
+#line 1181 "objc-parse.y"
+{ yyval.ttype = start_struct (RECORD_TYPE, yyvsp[-1].ttype);
+ /* Start scope of tag before parsing components. */
+ ;
+ break;}
+case 203:
+#line 1185 "objc-parse.y"
+{ yyval.ttype = finish_struct (yyvsp[-2].ttype, yyvsp[-1].ttype);
+ /* Really define the structure. */
+ ;
+ break;}
+case 204:
+#line 1189 "objc-parse.y"
+{ yyval.ttype = finish_struct (start_struct (RECORD_TYPE, NULL_TREE),
+ yyvsp[-1].ttype); ;
+ break;}
+case 205:
+#line 1192 "objc-parse.y"
+{ yyval.ttype = xref_tag (RECORD_TYPE, yyvsp[0].ttype); ;
+ break;}
+case 206:
+#line 1194 "objc-parse.y"
+{ yyval.ttype = start_struct (UNION_TYPE, yyvsp[-1].ttype); ;
+ break;}
+case 207:
+#line 1196 "objc-parse.y"
+{ yyval.ttype = finish_struct (yyvsp[-2].ttype, yyvsp[-1].ttype); ;
+ break;}
+case 208:
+#line 1198 "objc-parse.y"
+{ yyval.ttype = finish_struct (start_struct (UNION_TYPE, NULL_TREE),
+ yyvsp[-1].ttype); ;
+ break;}
+case 209:
+#line 1201 "objc-parse.y"
+{ yyval.ttype = xref_tag (UNION_TYPE, yyvsp[0].ttype); ;
+ break;}
+case 210:
+#line 1203 "objc-parse.y"
+{ yyvsp[0].itype = suspend_momentary ();
+ yyval.ttype = start_enum (yyvsp[-1].ttype); ;
+ break;}
+case 211:
+#line 1206 "objc-parse.y"
+{ yyval.ttype = finish_enum (yyvsp[-3].ttype, nreverse (yyvsp[-2].ttype));
+ resume_momentary (yyvsp[-4].itype); ;
+ break;}
+case 212:
+#line 1209 "objc-parse.y"
+{ yyvsp[0].itype = suspend_momentary ();
+ yyval.ttype = start_enum (NULL_TREE); ;
+ break;}
+case 213:
+#line 1212 "objc-parse.y"
+{ yyval.ttype = finish_enum (yyvsp[-3].ttype, nreverse (yyvsp[-2].ttype));
+ resume_momentary (yyvsp[-4].itype); ;
+ break;}
+case 214:
+#line 1215 "objc-parse.y"
+{ yyval.ttype = xref_tag (ENUMERAL_TYPE, yyvsp[0].ttype); ;
+ break;}
+case 218:
+#line 1226 "objc-parse.y"
+{ if (pedantic) pedwarn ("comma at end of enumerator list"); ;
+ break;}
+case 219:
+#line 1231 "objc-parse.y"
+{ yyval.ttype = yyvsp[0].ttype; ;
+ break;}
+case 220:
+#line 1233 "objc-parse.y"
+{ yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype);
+ pedwarn ("no semicolon at end of struct or union"); ;
+ break;}
+case 221:
+#line 1238 "objc-parse.y"
+{ yyval.ttype = NULL_TREE; ;
+ break;}
+case 222:
+#line 1240 "objc-parse.y"
+{ yyval.ttype = chainon (yyvsp[-2].ttype, yyvsp[-1].ttype); ;
+ break;}
+case 223:
+#line 1242 "objc-parse.y"
+{ if (pedantic)
+ pedwarn ("extra semicolon in struct or union specified"); ;
+ break;}
+case 224:
+#line 1246 "objc-parse.y"
+{
+ tree interface = lookup_interface (yyvsp[-1].ttype);
+
+ if (interface)
+ yyval.ttype = get_class_ivars (interface);
+ else
+ {
+ error ("Cannot find interface declaration for `%s'",
+ IDENTIFIER_POINTER (yyvsp[-1].ttype));
+ yyval.ttype = NULL_TREE;
+ }
+ ;
+ break;}
+case 225:
+#line 1271 "objc-parse.y"
+{ yyval.ttype = yyvsp[0].ttype;
+ current_declspecs = TREE_VALUE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary (yyvsp[-1].itype); ;
+ break;}
+case 226:
+#line 1276 "objc-parse.y"
+{ if (pedantic)
+ pedwarn ("ANSI C forbids member declarations with no members");
+ shadow_tag(yyvsp[0].ttype);
+ yyval.ttype = NULL_TREE; ;
+ break;}
+case 227:
+#line 1281 "objc-parse.y"
+{ yyval.ttype = yyvsp[0].ttype;
+ current_declspecs = TREE_VALUE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary (yyvsp[-1].itype); ;
+ break;}
+case 228:
+#line 1286 "objc-parse.y"
+{ if (pedantic)
+ pedwarn ("ANSI C forbids member declarations with no members");
+ shadow_tag(yyvsp[0].ttype);
+ yyval.ttype = NULL_TREE; ;
+ break;}
+case 229:
+#line 1291 "objc-parse.y"
+{ yyval.ttype = NULL_TREE; ;
+ break;}
+case 231:
+#line 1297 "objc-parse.y"
+{ yyval.ttype = chainon (yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 232:
+#line 1302 "objc-parse.y"
+{ yyval.ttype = grokfield (yyvsp[-3].filename, yyvsp[-2].lineno, yyvsp[-1].ttype, current_declspecs, NULL_TREE);
+ decl_attributes (yyval.ttype, yyvsp[0].ttype); ;
+ break;}
+case 233:
+#line 1306 "objc-parse.y"
+{ yyval.ttype = grokfield (yyvsp[-5].filename, yyvsp[-4].lineno, yyvsp[-3].ttype, current_declspecs, yyvsp[-1].ttype);
+ decl_attributes (yyval.ttype, yyvsp[0].ttype); ;
+ break;}
+case 234:
+#line 1309 "objc-parse.y"
+{ yyval.ttype = grokfield (yyvsp[-4].filename, yyvsp[-3].lineno, NULL_TREE, current_declspecs, yyvsp[-1].ttype);
+ decl_attributes (yyval.ttype, yyvsp[0].ttype); ;
+ break;}
+case 236:
+#line 1321 "objc-parse.y"
+{ yyval.ttype = chainon (yyvsp[0].ttype, yyvsp[-2].ttype); ;
+ break;}
+case 237:
+#line 1327 "objc-parse.y"
+{ yyval.ttype = build_enumerator (yyvsp[0].ttype, NULL_TREE); ;
+ break;}
+case 238:
+#line 1329 "objc-parse.y"
+{ yyval.ttype = build_enumerator (yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 239:
+#line 1334 "objc-parse.y"
+{ yyval.ttype = build_tree_list (yyvsp[-1].ttype, yyvsp[0].ttype); ;
+ break;}
+case 240:
+#line 1336 "objc-parse.y"
+{ yyval.ttype = build_tree_list (yyvsp[-1].ttype, yyvsp[0].ttype); ;
+ break;}
+case 241:
+#line 1341 "objc-parse.y"
+{ yyval.ttype = NULL_TREE; ;
+ break;}
+case 243:
+#line 1347 "objc-parse.y"
+{ yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, NULL_TREE); ;
+ break;}
+case 244:
+#line 1349 "objc-parse.y"
+{ yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ;
+ break;}
+case 245:
+#line 1354 "objc-parse.y"
+{ yyval.ttype = NULL_TREE; ;
+ break;}
+case 246:
+#line 1356 "objc-parse.y"
+{ yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ;
+ break;}
+case 247:
+#line 1361 "objc-parse.y"
+{ yyval.ttype = yyvsp[-1].ttype; ;
+ break;}
+case 248:
+#line 1364 "objc-parse.y"
+{ yyval.ttype = make_pointer_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); ;
+ break;}
+case 249:
+#line 1366 "objc-parse.y"
+{ yyval.ttype = make_pointer_declarator (yyvsp[0].ttype, NULL_TREE); ;
+ break;}
+case 250:
+#line 1368 "objc-parse.y"
+{ yyval.ttype = build_nt (CALL_EXPR, yyvsp[-2].ttype, yyvsp[0].ttype, NULL_TREE); ;
+ break;}
+case 251:
+#line 1370 "objc-parse.y"
+{ yyval.ttype = build_nt (ARRAY_REF, yyvsp[-3].ttype, yyvsp[-1].ttype); ;
+ break;}
+case 252:
+#line 1372 "objc-parse.y"
+{ yyval.ttype = build_nt (ARRAY_REF, yyvsp[-2].ttype, NULL_TREE); ;
+ break;}
+case 253:
+#line 1374 "objc-parse.y"
+{ yyval.ttype = build_nt (CALL_EXPR, NULL_TREE, yyvsp[0].ttype, NULL_TREE); ;
+ break;}
+case 254:
+#line 1376 "objc-parse.y"
+{ yyval.ttype = build_nt (ARRAY_REF, NULL_TREE, yyvsp[-1].ttype); ;
+ break;}
+case 255:
+#line 1378 "objc-parse.y"
+{ yyval.ttype = build_nt (ARRAY_REF, NULL_TREE, NULL_TREE); ;
+ break;}
+case 262:
+#line 1400 "objc-parse.y"
+{ emit_line_note (input_filename, lineno);
+ pushlevel (0);
+ clear_last_expr ();
+ push_momentary ();
+ expand_start_bindings (0);
+ if (objc_method_context)
+ add_objc_decls ();
+ ;
+ break;}
+case 264:
+#line 1415 "objc-parse.y"
+{ if (pedantic)
+ pedwarn ("ANSI C forbids label declarations"); ;
+ break;}
+case 267:
+#line 1426 "objc-parse.y"
+{ tree link;
+ for (link = yyvsp[-1].ttype; link; link = TREE_CHAIN (link))
+ {
+ tree label = shadow_label (TREE_VALUE (link));
+ C_DECLARED_LABEL_FLAG (label) = 1;
+ declare_nonlocal_label (label);
+ }
+ ;
+ break;}
+case 268:
+#line 1440 "objc-parse.y"
+{;
+ break;}
+case 270:
+#line 1445 "objc-parse.y"
+{ yyval.ttype = convert (void_type_node, integer_zero_node); ;
+ break;}
+case 271:
+#line 1447 "objc-parse.y"
+{ emit_line_note (input_filename, lineno);
+ expand_end_bindings (getdecls (), 1, 0);
+ yyval.ttype = poplevel (1, 1, 0);
+ pop_momentary (); ;
+ break;}
+case 272:
+#line 1452 "objc-parse.y"
+{ emit_line_note (input_filename, lineno);
+ expand_end_bindings (getdecls (), kept_level_p (), 0);
+ yyval.ttype = poplevel (kept_level_p (), 0, 0);
+ pop_momentary (); ;
+ break;}
+case 273:
+#line 1457 "objc-parse.y"
+{ emit_line_note (input_filename, lineno);
+ expand_end_bindings (getdecls (), kept_level_p (), 0);
+ yyval.ttype = poplevel (kept_level_p (), 0, 0);
+ pop_momentary (); ;
+ break;}
+case 276:
+#line 1474 "objc-parse.y"
+{ emit_line_note (yyvsp[-5].filename, yyvsp[-4].lineno);
+ expand_start_cond (truthvalue_conversion (yyvsp[-1].ttype), 0);
+ yyvsp[-3].itype = stmt_count;
+ if_stmt_file = yyvsp[-5].filename;
+ if_stmt_line = yyvsp[-4].lineno;
+ position_after_white_space (); ;
+ break;}
+case 277:
+#line 1487 "objc-parse.y"
+{ stmt_count++;
+ emit_line_note (yyvsp[-2].filename, yyvsp[-1].lineno);
+ /* See comment in `while' alternative, above. */
+ emit_nop ();
+ expand_start_loop_continue_elsewhere (1);
+ position_after_white_space (); ;
+ break;}
+case 278:
+#line 1494 "objc-parse.y"
+{ expand_loop_continue_here (); ;
+ break;}
+case 279:
+#line 1498 "objc-parse.y"
+{ yyval.filename = input_filename; ;
+ break;}
+case 280:
+#line 1502 "objc-parse.y"
+{ yyval.lineno = lineno; ;
+ break;}
+case 281:
+#line 1507 "objc-parse.y"
+{ ;
+ break;}
+case 282:
+#line 1512 "objc-parse.y"
+{ ;
+ break;}
+case 283:
+#line 1517 "objc-parse.y"
+{ ;
+ break;}
+case 285:
+#line 1523 "objc-parse.y"
+{ int next;
+ position_after_white_space ();
+ next = getc (finput);
+ ungetc (next, finput);
+ if (pedantic && next == '}')
+ pedwarn ("ANSI C forbids label at end of compound statement");
+ ;
+ break;}
+case 286:
+#line 1535 "objc-parse.y"
+{ stmt_count++; ;
+ break;}
+case 288:
+#line 1538 "objc-parse.y"
+{ stmt_count++;
+ emit_line_note (yyvsp[-3].filename, yyvsp[-2].lineno);
+ iterator_expand (yyvsp[-1].ttype);
+ clear_momentary (); ;
+ break;}
+case 289:
+#line 1543 "objc-parse.y"
+{ expand_start_else ();
+ yyvsp[-1].itype = stmt_count;
+ position_after_white_space (); ;
+ break;}
+case 290:
+#line 1547 "objc-parse.y"
+{ expand_end_cond ();
+ if (extra_warnings && stmt_count == yyvsp[-3].itype)
+ warning ("empty body in an else-statement"); ;
+ break;}
+case 291:
+#line 1551 "objc-parse.y"
+{ expand_end_cond ();
+ if (extra_warnings && stmt_count == yyvsp[0].itype)
+ warning_with_file_and_line (if_stmt_file, if_stmt_line,
+ "empty body in an if-statement"); ;
+ break;}
+case 292:
+#line 1559 "objc-parse.y"
+{ expand_end_cond (); ;
+ break;}
+case 293:
+#line 1561 "objc-parse.y"
+{ stmt_count++;
+ emit_line_note (yyvsp[-2].filename, yyvsp[-1].lineno);
+ /* The emit_nop used to come before emit_line_note,
+ but that made the nop seem like part of the preceding line.
+ And that was confusing when the preceding line was
+ inside of an if statement and was not really executed.
+ I think it ought to work to put the nop after the line number.
+ We will see. --rms, July 15, 1991. */
+ emit_nop (); ;
+ break;}
+case 294:
+#line 1571 "objc-parse.y"
+{ /* Don't start the loop till we have succeeded
+ in parsing the end test. This is to make sure
+ that we end every loop we start. */
+ expand_start_loop (1);
+ emit_line_note (input_filename, lineno);
+ expand_exit_loop_if_false (NULL_PTR,
+ truthvalue_conversion (yyvsp[-1].ttype));
+ position_after_white_space (); ;
+ break;}
+case 295:
+#line 1580 "objc-parse.y"
+{ expand_end_loop (); ;
+ break;}
+case 296:
+#line 1583 "objc-parse.y"
+{ emit_line_note (input_filename, lineno);
+ expand_exit_loop_if_false (NULL_PTR,
+ truthvalue_conversion (yyvsp[-2].ttype));
+ expand_end_loop ();
+ clear_momentary (); ;
+ break;}
+case 297:
+#line 1590 "objc-parse.y"
+{ expand_end_loop ();
+ clear_momentary (); ;
+ break;}
+case 298:
+#line 1594 "objc-parse.y"
+{ stmt_count++;
+ emit_line_note (yyvsp[-5].filename, yyvsp[-4].lineno);
+ /* See comment in `while' alternative, above. */
+ emit_nop ();
+ if (yyvsp[-1].ttype) c_expand_expr_stmt (yyvsp[-1].ttype);
+ /* Next step is to call expand_start_loop_continue_elsewhere,
+ but wait till after we parse the entire for (...).
+ Otherwise, invalid input might cause us to call that
+ fn without calling expand_end_loop. */
+ ;
+ break;}
+case 299:
+#line 1606 "objc-parse.y"
+{ yyvsp[0].lineno = lineno;
+ yyval.filename = input_filename; ;
+ break;}
+case 300:
+#line 1609 "objc-parse.y"
+{
+ /* Start the loop. Doing this after parsing
+ all the expressions ensures we will end the loop. */
+ expand_start_loop_continue_elsewhere (1);
+ /* Emit the end-test, with a line number. */
+ emit_line_note (yyvsp[-2].filename, yyvsp[-3].lineno);
+ if (yyvsp[-4].ttype)
+ expand_exit_loop_if_false (NULL_PTR,
+ truthvalue_conversion (yyvsp[-4].ttype));
+ /* Don't let the tree nodes for $9 be discarded by
+ clear_momentary during the parsing of the next stmt. */
+ push_momentary ();
+ yyvsp[-3].lineno = lineno;
+ yyvsp[-2].filename = input_filename;
+ position_after_white_space (); ;
+ break;}
+case 301:
+#line 1625 "objc-parse.y"
+{ /* Emit the increment expression, with a line number. */
+ emit_line_note (yyvsp[-4].filename, yyvsp[-5].lineno);
+ expand_loop_continue_here ();
+ if (yyvsp[-3].ttype)
+ c_expand_expr_stmt (yyvsp[-3].ttype);
+ pop_momentary ();
+ expand_end_loop (); ;
+ break;}
+case 302:
+#line 1633 "objc-parse.y"
+{ stmt_count++;
+ emit_line_note (yyvsp[-5].filename, yyvsp[-4].lineno);
+ c_expand_start_case (yyvsp[-1].ttype);
+ /* Don't let the tree nodes for $3 be discarded by
+ clear_momentary during the parsing of the next stmt. */
+ push_momentary ();
+ position_after_white_space (); ;
+ break;}
+case 303:
+#line 1641 "objc-parse.y"
+{ expand_end_case (yyvsp[-3].ttype);
+ pop_momentary (); ;
+ break;}
+case 304:
+#line 1644 "objc-parse.y"
+{ stmt_count++;
+ emit_line_note (yyvsp[-3].filename, yyvsp[-2].lineno);
+ if ( ! expand_exit_something ())
+ error ("break statement not within loop or switch"); ;
+ break;}
+case 305:
+#line 1649 "objc-parse.y"
+{ stmt_count++;
+ emit_line_note (yyvsp[-3].filename, yyvsp[-2].lineno);
+ if (! expand_continue_loop (NULL_PTR))
+ error ("continue statement not within a loop"); ;
+ break;}
+case 306:
+#line 1654 "objc-parse.y"
+{ stmt_count++;
+ emit_line_note (yyvsp[-3].filename, yyvsp[-2].lineno);
+ c_expand_return (NULL_TREE); ;
+ break;}
+case 307:
+#line 1658 "objc-parse.y"
+{ stmt_count++;
+ emit_line_note (yyvsp[-4].filename, yyvsp[-3].lineno);
+ c_expand_return (yyvsp[-1].ttype); ;
+ break;}
+case 308:
+#line 1662 "objc-parse.y"
+{ stmt_count++;
+ emit_line_note (yyvsp[-7].filename, yyvsp[-6].lineno);
+ STRIP_NOPS (yyvsp[-2].ttype);
+ if ((TREE_CODE (yyvsp[-2].ttype) == ADDR_EXPR
+ && TREE_CODE (TREE_OPERAND (yyvsp[-2].ttype, 0)) == STRING_CST)
+ || TREE_CODE (yyvsp[-2].ttype) == STRING_CST)
+ expand_asm (yyvsp[-2].ttype);
+ else
+ error ("argument of `asm' is not a constant string"); ;
+ break;}
+case 309:
+#line 1673 "objc-parse.y"
+{ stmt_count++;
+ emit_line_note (yyvsp[-9].filename, yyvsp[-8].lineno);
+ c_expand_asm_operands (yyvsp[-4].ttype, yyvsp[-2].ttype, NULL_TREE, NULL_TREE,
+ yyvsp[-6].ttype == ridpointers[(int)RID_VOLATILE],
+ input_filename, lineno); ;
+ break;}
+case 310:
+#line 1680 "objc-parse.y"
+{ stmt_count++;
+ emit_line_note (yyvsp[-11].filename, yyvsp[-10].lineno);
+ c_expand_asm_operands (yyvsp[-6].ttype, yyvsp[-4].ttype, yyvsp[-2].ttype, NULL_TREE,
+ yyvsp[-8].ttype == ridpointers[(int)RID_VOLATILE],
+ input_filename, lineno); ;
+ break;}
+case 311:
+#line 1688 "objc-parse.y"
+{ stmt_count++;
+ emit_line_note (yyvsp[-13].filename, yyvsp[-12].lineno);
+ c_expand_asm_operands (yyvsp[-8].ttype, yyvsp[-6].ttype, yyvsp[-4].ttype, yyvsp[-2].ttype,
+ yyvsp[-10].ttype == ridpointers[(int)RID_VOLATILE],
+ input_filename, lineno); ;
+ break;}
+case 312:
+#line 1694 "objc-parse.y"
+{ tree decl;
+ stmt_count++;
+ emit_line_note (yyvsp[-4].filename, yyvsp[-3].lineno);
+ decl = lookup_label (yyvsp[-1].ttype);
+ if (decl != 0)
+ {
+ TREE_USED (decl) = 1;
+ expand_goto (decl);
+ }
+ ;
+ break;}
+case 313:
+#line 1705 "objc-parse.y"
+{ stmt_count++;
+ emit_line_note (yyvsp[-5].filename, yyvsp[-4].lineno);
+ expand_computed_goto (convert (ptr_type_node, yyvsp[-1].ttype)); ;
+ break;}
+case 316:
+#line 1718 "objc-parse.y"
+{
+ /* The value returned by this action is */
+ /* 1 if everything is OK */
+ /* 0 in case of error or already bound iterator */
+
+ yyval.itype = 0;
+ if (TREE_CODE (yyvsp[-1].ttype) != VAR_DECL)
+ error ("invalid `for (ITERATOR)' syntax");
+ if (! ITERATOR_P (yyvsp[-1].ttype))
+ error ("`%s' is not an iterator",
+ IDENTIFIER_POINTER (DECL_NAME (yyvsp[-1].ttype)));
+ else if (ITERATOR_BOUND_P (yyvsp[-1].ttype))
+ error ("`for (%s)' inside expansion of same iterator",
+ IDENTIFIER_POINTER (DECL_NAME (yyvsp[-1].ttype)));
+ else
+ {
+ yyval.itype = 1;
+ iterator_for_loop_start (yyvsp[-1].ttype);
+ }
+ ;
+ break;}
+case 317:
+#line 1739 "objc-parse.y"
+{
+ if (yyvsp[-1].itype)
+ iterator_for_loop_end (yyvsp[-3].ttype);
+ ;
+ break;}
+case 318:
+#line 1771 "objc-parse.y"
+{ register tree value = check_case_value (yyvsp[-1].ttype);
+ register tree label
+ = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
+
+ stmt_count++;
+
+ if (value != error_mark_node)
+ {
+ tree duplicate;
+ int success = pushcase (value, label, &duplicate);
+ if (success == 1)
+ error ("case label not within a switch statement");
+ else if (success == 2)
+ {
+ error ("duplicate case value");
+ error_with_decl (duplicate, "this is the first entry for that value");
+ }
+ else if (success == 3)
+ warning ("case value out of range");
+ else if (success == 5)
+ error ("case label within scope of cleanup or variable array");
+ }
+ position_after_white_space (); ;
+ break;}
+case 319:
+#line 1795 "objc-parse.y"
+{ register tree value1 = check_case_value (yyvsp[-3].ttype);
+ register tree value2 = check_case_value (yyvsp[-1].ttype);
+ register tree label
+ = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
+
+ stmt_count++;
+
+ if (value1 != error_mark_node && value2 != error_mark_node)
+ {
+ tree duplicate;
+ int success = pushcase_range (value1, value2, label,
+ &duplicate);
+ if (success == 1)
+ error ("case label not within a switch statement");
+ else if (success == 2)
+ {
+ error ("duplicate case value");
+ error_with_decl (duplicate, "this is the first entry for that value");
+ }
+ else if (success == 3)
+ warning ("case value out of range");
+ else if (success == 4)
+ warning ("empty case range");
+ else if (success == 5)
+ error ("case label within scope of cleanup or variable array");
+ }
+ position_after_white_space (); ;
+ break;}
+case 320:
+#line 1823 "objc-parse.y"
+{
+ tree duplicate;
+ register tree label
+ = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
+ int success = pushcase (NULL_TREE, label, &duplicate);
+ stmt_count++;
+ if (success == 1)
+ error ("default label not within a switch statement");
+ else if (success == 2)
+ {
+ error ("multiple default labels in one switch");
+ error_with_decl (duplicate, "this is the first default label");
+ }
+ position_after_white_space (); ;
+ break;}
+case 321:
+#line 1838 "objc-parse.y"
+{ tree label = define_label (input_filename, lineno, yyvsp[-1].ttype);
+ stmt_count++;
+ emit_nop ();
+ if (label)
+ expand_label (label);
+ position_after_white_space (); ;
+ break;}
+case 322:
+#line 1850 "objc-parse.y"
+{ emit_line_note (input_filename, lineno); ;
+ break;}
+case 323:
+#line 1852 "objc-parse.y"
+{ emit_line_note (input_filename, lineno); ;
+ break;}
+case 324:
+#line 1857 "objc-parse.y"
+{ yyval.ttype = NULL_TREE; ;
+ break;}
+case 326:
+#line 1864 "objc-parse.y"
+{ yyval.ttype = NULL_TREE; ;
+ break;}
+case 329:
+#line 1871 "objc-parse.y"
+{ yyval.ttype = chainon (yyvsp[-2].ttype, yyvsp[0].ttype); ;
+ break;}
+case 330:
+#line 1876 "objc-parse.y"
+{ yyval.ttype = build_tree_list (yyvsp[-3].ttype, yyvsp[-1].ttype); ;
+ break;}
+case 331:
+#line 1881 "objc-parse.y"
+{ yyval.ttype = tree_cons (NULL_TREE, combine_strings (yyvsp[0].ttype), NULL_TREE); ;
+ break;}
+case 332:
+#line 1883 "objc-parse.y"
+{ yyval.ttype = tree_cons (NULL_TREE, combine_strings (yyvsp[0].ttype), yyvsp[-2].ttype); ;
+ break;}
+case 333:
+#line 1889 "objc-parse.y"
+{ pushlevel (0);
+ clear_parm_order ();
+ declare_parm_level (0); ;
+ break;}
+case 334:
+#line 1893 "objc-parse.y"
+{ yyval.ttype = yyvsp[0].ttype;
+ parmlist_tags_warning ();
+ poplevel (0, 0, 0); ;
+ break;}
+case 336:
+#line 1901 "objc-parse.y"
+{ tree parm;
+ if (pedantic)
+ pedwarn ("ANSI C forbids forward parameter declarations");
+ /* Mark the forward decls as such. */
+ for (parm = getdecls (); parm; parm = TREE_CHAIN (parm))
+ TREE_ASM_WRITTEN (parm) = 1;
+ clear_parm_order (); ;
+ break;}
+case 337:
+#line 1909 "objc-parse.y"
+{ yyval.ttype = yyvsp[0].ttype; ;
+ break;}
+case 338:
+#line 1911 "objc-parse.y"
+{ yyval.ttype = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); ;
+ break;}
+case 339:
+#line 1917 "objc-parse.y"
+{ yyval.ttype = get_parm_info (0); ;
+ break;}
+case 340:
+#line 1919 "objc-parse.y"
+{ yyval.ttype = get_parm_info (0);
+ if (pedantic)
+ pedwarn ("ANSI C requires a named argument before `...'");
+ ;
+ break;}
+case 341:
+#line 1924 "objc-parse.y"
+{ yyval.ttype = get_parm_info (1); ;
+ break;}
+case 342:
+#line 1926 "objc-parse.y"
+{ yyval.ttype = get_parm_info (0); ;
+ break;}
+case 343:
+#line 1931 "objc-parse.y"
+{ push_parm_decl (yyvsp[0].ttype); ;
+ break;}
+case 344:
+#line 1933 "objc-parse.y"
+{ push_parm_decl (yyvsp[0].ttype); ;
+ break;}
+case 345:
+#line 1940 "objc-parse.y"
+{ yyval.ttype = build_tree_list (yyvsp[-1].ttype, yyvsp[0].ttype) ; ;
+ break;}
+case 346:
+#line 1942 "objc-parse.y"
+{ yyval.ttype = build_tree_list (yyvsp[-1].ttype, yyvsp[0].ttype) ; ;
+ break;}
+case 347:
+#line 1944 "objc-parse.y"
+{ yyval.ttype = build_tree_list (yyvsp[-1].ttype, yyvsp[0].ttype); ;
+ break;}
+case 348:
+#line 1946 "objc-parse.y"
+{ yyval.ttype = build_tree_list (yyvsp[-1].ttype, yyvsp[0].ttype) ; ;
+ break;}
+case 349:
+#line 1948 "objc-parse.y"
+{ yyval.ttype = build_tree_list (yyvsp[-1].ttype, yyvsp[0].ttype); ;
+ break;}
+case 350:
+#line 1955 "objc-parse.y"
+{ pushlevel (0);
+ clear_parm_order ();
+ declare_parm_level (1); ;
+ break;}
+case 351:
+#line 1959 "objc-parse.y"
+{ yyval.ttype = yyvsp[0].ttype;
+ parmlist_tags_warning ();
+ poplevel (0, 0, 0); ;
+ break;}
+case 353:
+#line 1967 "objc-parse.y"
+{ tree t;
+ for (t = yyvsp[-1].ttype; t; t = TREE_CHAIN (t))
+ if (TREE_VALUE (t) == NULL_TREE)
+ error ("`...' in old-style identifier list");
+ yyval.ttype = tree_cons (NULL_TREE, NULL_TREE, yyvsp[-1].ttype); ;
+ break;}
+case 354:
+#line 1977 "objc-parse.y"
+{ yyval.ttype = build_tree_list (NULL_TREE, yyvsp[0].ttype); ;
+ break;}
+case 355:
+#line 1979 "objc-parse.y"
+{ yyval.ttype = chainon (yyvsp[-2].ttype, build_tree_list (NULL_TREE, yyvsp[0].ttype)); ;
+ break;}
+case 356:
+#line 1985 "objc-parse.y"
+{ yyval.ttype = build_tree_list (NULL_TREE, yyvsp[0].ttype); ;
+ break;}
+case 357:
+#line 1987 "objc-parse.y"
+{ yyval.ttype = chainon (yyvsp[-2].ttype, build_tree_list (NULL_TREE, yyvsp[0].ttype)); ;
+ break;}
+case 363:
+#line 1999 "objc-parse.y"
+{
+ if (objc_implementation_context)
+ {
+ finish_class (objc_implementation_context);
+ objc_ivar_chain = NULL_TREE;
+ objc_implementation_context = NULL_TREE;
+ }
+ else
+ warning ("`@end' must appear in an implementation context");
+ ;
+ break;}
+case 364:
+#line 2014 "objc-parse.y"
+{ yyval.ttype = build_tree_list (NULL_TREE, yyvsp[0].ttype); ;
+ break;}
+case 365:
+#line 2016 "objc-parse.y"
+{ yyval.ttype = chainon (yyvsp[-2].ttype, build_tree_list (NULL_TREE, yyvsp[0].ttype)); ;
+ break;}
+case 366:
+#line 2021 "objc-parse.y"
+{
+ objc_declare_class (yyvsp[-1].ttype);
+ ;
+ break;}
+case 367:
+#line 2027 "objc-parse.y"
+{
+ objc_declare_alias (yyvsp[-2].ttype, yyvsp[-1].ttype);
+ ;
+ break;}
+case 368:
+#line 2033 "objc-parse.y"
+{
+ objc_interface_context = objc_ivar_context
+ = start_class (CLASS_INTERFACE_TYPE, yyvsp[-2].ttype, NULL_TREE, yyvsp[-1].ttype);
+ objc_public_flag = 0;
+ ;
+ break;}
+case 369:
+#line 2039 "objc-parse.y"
+{
+ continue_class (objc_interface_context);
+ ;
+ break;}
+case 370:
+#line 2044 "objc-parse.y"
+{
+ finish_class (objc_interface_context);
+ objc_interface_context = NULL_TREE;
+ ;
+ break;}
+case 371:
+#line 2050 "objc-parse.y"
+{
+ objc_interface_context
+ = start_class (CLASS_INTERFACE_TYPE, yyvsp[-1].ttype, NULL_TREE, yyvsp[0].ttype);
+ continue_class (objc_interface_context);
+ ;
+ break;}
+case 372:
+#line 2057 "objc-parse.y"
+{
+ finish_class (objc_interface_context);
+ objc_interface_context = NULL_TREE;
+ ;
+ break;}
+case 373:
+#line 2063 "objc-parse.y"
+{
+ objc_interface_context = objc_ivar_context
+ = start_class (CLASS_INTERFACE_TYPE, yyvsp[-4].ttype, yyvsp[-2].ttype, yyvsp[-1].ttype);
+ objc_public_flag = 0;
+ ;
+ break;}
+case 374:
+#line 2069 "objc-parse.y"
+{
+ continue_class (objc_interface_context);
+ ;
+ break;}
+case 375:
+#line 2074 "objc-parse.y"
+{
+ finish_class (objc_interface_context);
+ objc_interface_context = NULL_TREE;
+ ;
+ break;}
+case 376:
+#line 2080 "objc-parse.y"
+{
+ objc_interface_context
+ = start_class (CLASS_INTERFACE_TYPE, yyvsp[-3].ttype, yyvsp[-1].ttype, yyvsp[0].ttype);
+ continue_class (objc_interface_context);
+ ;
+ break;}
+case 377:
+#line 2087 "objc-parse.y"
+{
+ finish_class (objc_interface_context);
+ objc_interface_context = NULL_TREE;
+ ;
+ break;}
+case 378:
+#line 2093 "objc-parse.y"
+{
+ objc_implementation_context = objc_ivar_context
+ = start_class (CLASS_IMPLEMENTATION_TYPE, yyvsp[-1].ttype, NULL_TREE, NULL_TREE);
+ objc_public_flag = 0;
+ ;
+ break;}
+case 379:
+#line 2099 "objc-parse.y"
+{
+ objc_ivar_chain
+ = continue_class (objc_implementation_context);
+ ;
+ break;}
+case 380:
+#line 2105 "objc-parse.y"
+{
+ objc_implementation_context
+ = start_class (CLASS_IMPLEMENTATION_TYPE, yyvsp[0].ttype, NULL_TREE, NULL_TREE);
+ objc_ivar_chain
+ = continue_class (objc_implementation_context);
+ ;
+ break;}
+case 381:
+#line 2113 "objc-parse.y"
+{
+ objc_implementation_context = objc_ivar_context
+ = start_class (CLASS_IMPLEMENTATION_TYPE, yyvsp[-3].ttype, yyvsp[-1].ttype, NULL_TREE);
+ objc_public_flag = 0;
+ ;
+ break;}
+case 382:
+#line 2119 "objc-parse.y"
+{
+ objc_ivar_chain
+ = continue_class (objc_implementation_context);
+ ;
+ break;}
+case 383:
+#line 2125 "objc-parse.y"
+{
+ objc_implementation_context
+ = start_class (CLASS_IMPLEMENTATION_TYPE, yyvsp[-2].ttype, yyvsp[0].ttype, NULL_TREE);
+ objc_ivar_chain
+ = continue_class (objc_implementation_context);
+ ;
+ break;}
+case 384:
+#line 2133 "objc-parse.y"
+{
+ objc_interface_context
+ = start_class (CATEGORY_INTERFACE_TYPE, yyvsp[-4].ttype, yyvsp[-2].ttype, yyvsp[0].ttype);
+ continue_class (objc_interface_context);
+ ;
+ break;}
+case 385:
+#line 2140 "objc-parse.y"
+{
+ finish_class (objc_interface_context);
+ objc_interface_context = NULL_TREE;
+ ;
+ break;}
+case 386:
+#line 2146 "objc-parse.y"
+{
+ objc_implementation_context
+ = start_class (CATEGORY_IMPLEMENTATION_TYPE, yyvsp[-3].ttype, yyvsp[-1].ttype, NULL_TREE);
+ objc_ivar_chain
+ = continue_class (objc_implementation_context);
+ ;
+ break;}
+case 387:
+#line 2156 "objc-parse.y"
+{
+ remember_protocol_qualifiers ();
+ objc_interface_context
+ = start_protocol(PROTOCOL_INTERFACE_TYPE, yyvsp[-1].ttype, yyvsp[0].ttype);
+ ;
+ break;}
+case 388:
+#line 2162 "objc-parse.y"
+{
+ forget_protocol_qualifiers();
+ finish_protocol(objc_interface_context);
+ objc_interface_context = NULL_TREE;
+ ;
+ break;}
+case 389:
+#line 2171 "objc-parse.y"
+{
+ yyval.ttype = NULL_TREE;
+ ;
+ break;}
+case 390:
+#line 2175 "objc-parse.y"
+{
+ if (yyvsp[-2].code == LT_EXPR && yyvsp[0].code == GT_EXPR)
+ yyval.ttype = yyvsp[-1].ttype;
+ else
+ YYERROR1;
+ ;
+ break;}
+case 393:
+#line 2189 "objc-parse.y"
+{ objc_public_flag = 2; ;
+ break;}
+case 394:
+#line 2190 "objc-parse.y"
+{ objc_public_flag = 0; ;
+ break;}
+case 395:
+#line 2191 "objc-parse.y"
+{ objc_public_flag = 1; ;
+ break;}
+case 396:
+#line 2196 "objc-parse.y"
+{
+ yyval.ttype = NULL_TREE;
+ ;
+ break;}
+case 398:
+#line 2201 "objc-parse.y"
+{
+ if (pedantic)
+ pedwarn ("extra semicolon in struct or union specified");
+ ;
+ break;}
+case 399:
+#line 2219 "objc-parse.y"
+{
+ yyval.ttype = yyvsp[0].ttype;
+ resume_momentary (yyvsp[-1].itype);
+ ;
+ break;}
+case 400:
+#line 2224 "objc-parse.y"
+{
+ yyval.ttype = yyvsp[0].ttype;
+ resume_momentary (yyvsp[-1].itype);
+ ;
+ break;}
+case 401:
+#line 2229 "objc-parse.y"
+{ yyval.ttype = NULL_TREE; ;
+ break;}
+case 402:
+#line 2234 "objc-parse.y"
+{ yyval.ttype = NULL_TREE; ;
+ break;}
+case 405:
+#line 2241 "objc-parse.y"
+{
+ yyval.ttype = add_instance_variable (objc_ivar_context,
+ objc_public_flag,
+ yyvsp[0].ttype, current_declspecs,
+ NULL_TREE);
+ ;
+ break;}
+case 406:
+#line 2248 "objc-parse.y"
+{
+ yyval.ttype = add_instance_variable (objc_ivar_context,
+ objc_public_flag,
+ yyvsp[-2].ttype, current_declspecs, yyvsp[0].ttype);
+ ;
+ break;}
+case 407:
+#line 2254 "objc-parse.y"
+{
+ yyval.ttype = add_instance_variable (objc_ivar_context,
+ objc_public_flag,
+ NULL_TREE,
+ current_declspecs, yyvsp[0].ttype);
+ ;
+ break;}
+case 408:
+#line 2264 "objc-parse.y"
+{
+ remember_protocol_qualifiers ();
+ if (objc_implementation_context)
+ objc_inherit_code = CLASS_METHOD_DECL;
+ else
+ fatal ("method definition not in class context");
+ ;
+ break;}
+case 409:
+#line 2272 "objc-parse.y"
+{
+ forget_protocol_qualifiers ();
+ add_class_method (objc_implementation_context, yyvsp[0].ttype);
+ start_method_def (yyvsp[0].ttype);
+ objc_method_context = yyvsp[0].ttype;
+ ;
+ break;}
+case 410:
+#line 2279 "objc-parse.y"
+{
+ continue_method_def ();
+ ;
+ break;}
+case 411:
+#line 2283 "objc-parse.y"
+{
+ finish_method_def ();
+ objc_method_context = NULL_TREE;
+ ;
+ break;}
+case 412:
+#line 2289 "objc-parse.y"
+{
+ remember_protocol_qualifiers ();
+ if (objc_implementation_context)
+ objc_inherit_code = INSTANCE_METHOD_DECL;
+ else
+ fatal ("method definition not in class context");
+ ;
+ break;}
+case 413:
+#line 2297 "objc-parse.y"
+{
+ forget_protocol_qualifiers ();
+ add_instance_method (objc_implementation_context, yyvsp[0].ttype);
+ start_method_def (yyvsp[0].ttype);
+ objc_method_context = yyvsp[0].ttype;
+ ;
+ break;}
+case 414:
+#line 2304 "objc-parse.y"
+{
+ continue_method_def ();
+ ;
+ break;}
+case 415:
+#line 2308 "objc-parse.y"
+{
+ finish_method_def ();
+ objc_method_context = NULL_TREE;
+ ;
+ break;}
+case 417:
+#line 2320 "objc-parse.y"
+{yyval.ttype = NULL_TREE; ;
+ break;}
+case 422:
+#line 2327 "objc-parse.y"
+{yyval.ttype = NULL_TREE; ;
+ break;}
+case 426:
+#line 2337 "objc-parse.y"
+{
+ objc_inherit_code = CLASS_METHOD_DECL;
+ ;
+ break;}
+case 427:
+#line 2341 "objc-parse.y"
+{
+ add_class_method (objc_interface_context, yyvsp[0].ttype);
+ ;
+ break;}
+case 429:
+#line 2347 "objc-parse.y"
+{
+ objc_inherit_code = INSTANCE_METHOD_DECL;
+ ;
+ break;}
+case 430:
+#line 2351 "objc-parse.y"
+{
+ add_instance_method (objc_interface_context, yyvsp[0].ttype);
+ ;
+ break;}
+case 432:
+#line 2359 "objc-parse.y"
+{
+ yyval.ttype = build_method_decl (objc_inherit_code, yyvsp[-2].ttype, yyvsp[0].ttype, NULL_TREE);
+ ;
+ break;}
+case 433:
+#line 2364 "objc-parse.y"
+{
+ yyval.ttype = build_method_decl (objc_inherit_code, NULL_TREE, yyvsp[0].ttype, NULL_TREE);
+ ;
+ break;}
+case 434:
+#line 2369 "objc-parse.y"
+{
+ yyval.ttype = build_method_decl (objc_inherit_code, yyvsp[-3].ttype, yyvsp[-1].ttype, yyvsp[0].ttype);
+ ;
+ break;}
+case 435:
+#line 2374 "objc-parse.y"
+{
+ yyval.ttype = build_method_decl (objc_inherit_code, NULL_TREE, yyvsp[-1].ttype, yyvsp[0].ttype);
+ ;
+ break;}
+case 444:
+#line 2404 "objc-parse.y"
+{ resume_momentary (yyvsp[-2].itype); ;
+ break;}
+case 445:
+#line 2406 "objc-parse.y"
+{ shadow_tag (yyvsp[-1].ttype); ;
+ break;}
+case 446:
+#line 2408 "objc-parse.y"
+{ pedwarn ("empty declaration"); ;
+ break;}
+case 447:
+#line 2413 "objc-parse.y"
+{ push_parm_decl (yyvsp[0].ttype); ;
+ break;}
+case 448:
+#line 2415 "objc-parse.y"
+{ push_parm_decl (yyvsp[0].ttype); ;
+ break;}
+case 449:
+#line 2423 "objc-parse.y"
+{ yyval.ttype = build_tree_list (current_declspecs, yyvsp[0].ttype) ; ;
+ break;}
+case 450:
+#line 2425 "objc-parse.y"
+{ yyval.ttype = build_tree_list (current_declspecs, yyvsp[0].ttype) ; ;
+ break;}
+case 451:
+#line 2427 "objc-parse.y"
+{ yyval.ttype = build_tree_list (current_declspecs, yyvsp[0].ttype) ; ;
+ break;}
+case 452:
+#line 2432 "objc-parse.y"
+{
+ yyval.ttype = NULL_TREE;
+ ;
+ break;}
+case 453:
+#line 2436 "objc-parse.y"
+{
+ /* oh what a kludge! */
+ yyval.ttype = (tree)1;
+ ;
+ break;}
+case 454:
+#line 2441 "objc-parse.y"
+{
+ pushlevel (0);
+ ;
+ break;}
+case 455:
+#line 2445 "objc-parse.y"
+{
+ /* returns a tree list node generated by get_parm_info */
+ yyval.ttype = yyvsp[0].ttype;
+ poplevel (0, 0, 0);
+ ;
+ break;}
+case 458:
+#line 2460 "objc-parse.y"
+{
+ yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype);
+ ;
+ break;}
+case 463:
+#line 2473 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 464:
+#line 2474 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 465:
+#line 2475 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 466:
+#line 2476 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 467:
+#line 2477 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 468:
+#line 2478 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 469:
+#line 2479 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 470:
+#line 2480 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 471:
+#line 2481 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 472:
+#line 2482 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 473:
+#line 2483 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 474:
+#line 2484 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 475:
+#line 2485 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 476:
+#line 2486 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 477:
+#line 2487 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 478:
+#line 2488 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 479:
+#line 2489 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 480:
+#line 2490 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 481:
+#line 2491 "objc-parse.y"
+{ yyval.ttype = get_identifier (token_buffer); ;
+ break;}
+case 484:
+#line 2497 "objc-parse.y"
+{
+ yyval.ttype = build_keyword_decl (yyvsp[-5].ttype, yyvsp[-2].ttype, yyvsp[0].ttype);
+ ;
+ break;}
+case 485:
+#line 2502 "objc-parse.y"
+{
+ yyval.ttype = build_keyword_decl (yyvsp[-2].ttype, NULL_TREE, yyvsp[0].ttype);
+ ;
+ break;}
+case 486:
+#line 2507 "objc-parse.y"
+{
+ yyval.ttype = build_keyword_decl (NULL_TREE, yyvsp[-2].ttype, yyvsp[0].ttype);
+ ;
+ break;}
+case 487:
+#line 2512 "objc-parse.y"
+{
+ yyval.ttype = build_keyword_decl (NULL_TREE, NULL_TREE, yyvsp[0].ttype);
+ ;
+ break;}
+case 491:
+#line 2525 "objc-parse.y"
+{
+ yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype);
+ ;
+ break;}
+case 492:
+#line 2533 "objc-parse.y"
+{
+ if (TREE_CHAIN (yyvsp[0].ttype) == NULL_TREE)
+ /* just return the expr., remove a level of indirection */
+ yyval.ttype = TREE_VALUE (yyvsp[0].ttype);
+ else
+ /* we have a comma expr., we will collapse later */
+ yyval.ttype = yyvsp[0].ttype;
+ ;
+ break;}
+case 493:
+#line 2545 "objc-parse.y"
+{
+ yyval.ttype = build_tree_list (yyvsp[-2].ttype, yyvsp[0].ttype);
+ ;
+ break;}
+case 494:
+#line 2549 "objc-parse.y"
+{
+ yyval.ttype = build_tree_list (NULL_TREE, yyvsp[0].ttype);
+ ;
+ break;}
+case 496:
+#line 2557 "objc-parse.y"
+{
+ yyval.ttype = get_class_reference (yyvsp[0].ttype);
+ ;
+ break;}
+case 497:
+#line 2564 "objc-parse.y"
+{ objc_receiver_context = 1; ;
+ break;}
+case 498:
+#line 2566 "objc-parse.y"
+{ objc_receiver_context = 0; ;
+ break;}
+case 499:
+#line 2568 "objc-parse.y"
+{
+ yyval.ttype = build_tree_list (yyvsp[-3].ttype, yyvsp[-1].ttype);
+ ;
+ break;}
+case 503:
+#line 2581 "objc-parse.y"
+{
+ yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype);
+ ;
+ break;}
+case 504:
+#line 2588 "objc-parse.y"
+{
+ yyval.ttype = build_tree_list (yyvsp[-1].ttype, NULL_TREE);
+ ;
+ break;}
+case 505:
+#line 2592 "objc-parse.y"
+{
+ yyval.ttype = build_tree_list (NULL_TREE, NULL_TREE);
+ ;
+ break;}
+case 506:
+#line 2599 "objc-parse.y"
+{
+ yyval.ttype = yyvsp[-1].ttype;
+ ;
+ break;}
+case 507:
+#line 2606 "objc-parse.y"
+{
+ yyval.ttype = yyvsp[-1].ttype;
+ ;
+ break;}
+case 508:
+#line 2615 "objc-parse.y"
+{
+ yyval.ttype = groktypename (yyvsp[-1].ttype);
+ ;
+ break;}
+}
+ /* the action file gets copied in in place of this dollarsign */
+#line 440 "bison.simple"
+
+ yyvsp -= yylen;
+ yyssp -= yylen;
+#ifdef YYLSP_NEEDED
+ yylsp -= yylen;
+#endif
+
+#if YYDEBUG != 0
+ if (yydebug)
+ {
+ short *ssp1 = yyss - 1;
+ fprintf (stderr, "state stack now");
+ while (ssp1 != yyssp)
+ fprintf (stderr, " %d", *++ssp1);
+ fprintf (stderr, "\n");
+ }
+#endif
+
+ *++yyvsp = yyval;
+
+#ifdef YYLSP_NEEDED
+ yylsp++;
+ if (yylen == 0)
+ {
+ yylsp->first_line = yylloc.first_line;
+ yylsp->first_column = yylloc.first_column;
+ yylsp->last_line = (yylsp-1)->last_line;
+ yylsp->last_column = (yylsp-1)->last_column;
+ yylsp->text = 0;
+ }
+ else
+ {
+ yylsp->last_line = (yylsp+yylen-1)->last_line;
+ yylsp->last_column = (yylsp+yylen-1)->last_column;
+ }
+#endif
+
+ /* Now "shift" the result of the reduction.
+ Determine what state that goes to,
+ based on the state we popped back to
+ and the rule number reduced by. */
+
+ yyn = yyr1[yyn];
+
+ yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
+ if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+ yystate = yytable[yystate];
+ else
+ yystate = yydefgoto[yyn - YYNTBASE];
+
+ goto yynewstate;
+
+yyerrlab: /* here on detecting error */
+
+ if (! yyerrstatus)
+ /* If not already recovering from an error, report this error. */
+ {
+ ++yynerrs;
+
+#ifdef YYERROR_VERBOSE
+ yyn = yypact[yystate];
+
+ if (yyn > YYFLAG && yyn < YYLAST)
+ {
+ int size = 0;
+ char *msg;
+ int x, count;
+
+ count = 0;
+ for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
+ if (yycheck[x + yyn] == x)
+ size += strlen(yytname[x]) + 15, count++;
+ msg = (char *) malloc(size + 15);
+ if (msg != 0)
+ {
+ strcpy(msg, "parse error");
+
+ if (count < 5)
+ {
+ count = 0;
+ for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
+ if (yycheck[x + yyn] == x)
+ {
+ strcat(msg, count == 0 ? ", expecting `" : " or `");
+ strcat(msg, yytname[x]);
+ strcat(msg, "'");
+ count++;
+ }
+ }
+ yyerror(msg);
+ free(msg);
+ }
+ else
+ yyerror ("parse error; also virtual memory exceeded");
+ }
+ else
+#endif /* YYERROR_VERBOSE */
+ yyerror("parse error");
+ }
+
+yyerrlab1: /* here on error raised explicitly by an action */
+
+ if (yyerrstatus == 3)
+ {
+ /* if just tried and failed to reuse lookahead token after an error, discard it. */
+
+ /* return failure if at end of input */
+ if (yychar == YYEOF)
+ YYABORT;
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
+#endif
+
+ yychar = YYEMPTY;
+ }
+
+ /* Else will try to reuse lookahead token
+ after shifting the error token. */
+
+ yyerrstatus = 3; /* Each real token shifted decrements this */
+
+ goto yyerrhandle;
+
+yyerrdefault: /* current state does not do anything special for the error token. */
+
+#if 0
+ /* This is wrong; only states that explicitly want error tokens
+ should shift them. */
+ yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
+ if (yyn) goto yydefault;
+#endif
+
+yyerrpop: /* pop the current state because it cannot handle the error token */
+
+ if (yyssp == yyss) YYABORT;
+ yyvsp--;
+ yystate = *--yyssp;
+#ifdef YYLSP_NEEDED
+ yylsp--;
+#endif
+
+#if YYDEBUG != 0
+ if (yydebug)
+ {
+ short *ssp1 = yyss - 1;
+ fprintf (stderr, "Error: state stack now");
+ while (ssp1 != yyssp)
+ fprintf (stderr, " %d", *++ssp1);
+ fprintf (stderr, "\n");
+ }
+#endif
+
+yyerrhandle:
+
+ yyn = yypact[yystate];
+ if (yyn == YYFLAG)
+ goto yyerrdefault;
+
+ yyn += YYTERROR;
+ if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
+ goto yyerrdefault;
+
+ yyn = yytable[yyn];
+ if (yyn < 0)
+ {
+ if (yyn == YYFLAG)
+ goto yyerrpop;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+ else if (yyn == 0)
+ goto yyerrpop;
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Shifting error token, ");
+#endif
+
+ *++yyvsp = yylval;
+#ifdef YYLSP_NEEDED
+ *++yylsp = yylloc;
+#endif
+
+ yystate = yyn;
+ goto yynewstate;
+}
+#line 2620 "objc-parse.y"
+
diff --git a/gnu/usr.bin/cc/cc1obj/objc-tree.def b/gnu/usr.bin/cc/cc1obj/objc-tree.def
new file mode 100644
index 000000000000..d7d38622d515
--- /dev/null
+++ b/gnu/usr.bin/cc/cc1obj/objc-tree.def
@@ -0,0 +1,36 @@
+/* This file contains the definitions and documentation for the
+ additional tree codes used in the Objective C front end (see tree.def
+ for the standard codes).
+ Copyright (C) 1990 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+
+/* Objective-C types. */
+DEFTREECODE (CLASS_INTERFACE_TYPE, "class_interface_type", "t", 0)
+DEFTREECODE (CLASS_IMPLEMENTATION_TYPE, "class_implementation_type", "t", 0)
+DEFTREECODE (CATEGORY_INTERFACE_TYPE, "category_interface_type", "t", 0)
+DEFTREECODE (CATEGORY_IMPLEMENTATION_TYPE,"category_implementation_type","t",0)
+DEFTREECODE (PROTOCOL_INTERFACE_TYPE, "protocol_interface_type", "t", 0)
+
+/* Objective-C decls. */
+DEFTREECODE (KEYWORD_DECL, "keyword_decl", "d", 0)
+DEFTREECODE (INSTANCE_METHOD_DECL, "instance_method_decl", "d", 0)
+DEFTREECODE (CLASS_METHOD_DECL, "class_method_decl", "d", 0)
+
+/* Objective-C constants. */
+DEFTREECODE (OBJC_STRING_CST, "objc_string_cst", "c", 3)