OSDN Git Service

__attribute__ ((constructor))
[pf3gnuchains/gcc-fork.git] / gcc / objc / objc-act.h
1 /* Declarations for objc-act.c.
2    Copyright (C) 1990 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
19
20
21 /*** Public Interface (procedures) ***/
22
23 /* used by yyparse */
24
25 void finish_file                                PROTO((void));
26 tree start_class                                PROTO((enum tree_code, tree, tree, tree));
27 tree continue_class                             PROTO((tree));
28 void finish_class                               PROTO((tree));
29 void start_method_def                           PROTO((tree));
30 void continue_method_def                        PROTO((void));
31 void finish_method_def                          PROTO((void));
32 tree start_protocol                             PROTO((enum tree_code, tree, tree));
33 void finish_protocol                            PROTO((tree));
34 void add_objc_decls                             PROTO((void));
35
36 tree is_ivar                                    PROTO((tree, tree));
37 int is_private                                  PROTO((tree));
38 int is_public                                   PROTO((tree, tree));
39 tree add_instance_variable                      PROTO((tree, int, tree, tree, tree));
40 tree add_class_method                           PROTO((tree, tree));
41 tree add_instance_method                        PROTO((tree, tree));
42 tree get_super_receiver                         PROTO((void));
43 tree get_class_ivars                            PROTO((tree));
44 tree get_class_reference                        PROTO((tree));
45 tree get_static_reference                       PROTO((tree, tree));
46 tree get_object_reference                       PROTO((tree));
47 tree build_message_expr                         PROTO((tree));
48 tree build_selector_expr                        PROTO((tree));
49 tree build_ivar_reference                       PROTO((tree));
50 tree build_keyword_decl                         PROTO((tree, tree, tree));
51 tree build_method_decl                          PROTO((enum tree_code, tree, tree, tree));
52 tree build_protocol_expr                        PROTO((tree));
53 tree build_objc_string_object                   PROTO((tree));
54
55 extern tree objc_ivar_chain;
56 extern tree objc_method_context;
57
58 void objc_declare_alias                         PROTO((tree, tree));
59 void objc_declare_class                         PROTO((tree));
60
61 extern int objc_receiver_context;
62
63 /* the following routines are used to implement statically typed objects */
64
65 int objc_comptypes                              PROTO((tree, tree, int));
66 void objc_check_decl                            PROTO((tree));
67
68 /* NeXT extensions */
69
70 tree build_encode_expr                          PROTO((tree));
71
72 /* Objective-C structures */
73
74 /* KEYWORD_DECL */
75 #define KEYWORD_KEY_NAME(DECL) ((DECL)->decl.name)
76 #define KEYWORD_ARG_NAME(DECL) ((DECL)->decl.arguments)
77
78 /* INSTANCE_METHOD_DECL, CLASS_METHOD_DECL */
79 #define METHOD_SEL_NAME(DECL) ((DECL)->decl.name)
80 #define METHOD_SEL_ARGS(DECL) ((DECL)->decl.arguments)
81 #define METHOD_ADD_ARGS(DECL) ((DECL)->decl.result)
82 #define METHOD_DEFINITION(DECL) ((DECL)->decl.initial)
83 #define METHOD_ENCODING(DECL) ((DECL)->decl.context)
84
85 /* CLASS_INTERFACE_TYPE, CLASS_IMPLEMENTATION_TYPE,
86    CATEGORY_INTERFACE_TYPE, CATEGORY_IMPLEMENTATION_TYPE,
87    PROTOCOL_INTERFACE_TYPE */
88 #define CLASS_NAME(CLASS) ((CLASS)->type.name)
89 #define CLASS_SUPER_NAME(CLASS) ((CLASS)->type.context)
90 #define CLASS_IVARS(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 0)
91 #define CLASS_RAW_IVARS(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 1)
92 #define CLASS_NST_METHODS(CLASS) ((CLASS)->type.minval)
93 #define CLASS_CLS_METHODS(CLASS) ((CLASS)->type.maxval)
94 #define CLASS_STATIC_TEMPLATE(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 2)
95 #define CLASS_CATEGORY_LIST(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 3)
96 #define CLASS_PROTOCOL_LIST(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 4)
97 #define PROTOCOL_NAME(CLASS) ((CLASS)->type.name)
98 #define PROTOCOL_LIST(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 0)
99 #define PROTOCOL_NST_METHODS(CLASS) ((CLASS)->type.minval)
100 #define PROTOCOL_CLS_METHODS(CLASS) ((CLASS)->type.maxval)
101 #define PROTOCOL_FORWARD_DECL(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 1)
102 #define TYPE_PROTOCOL_LIST(TYPE) ((TYPE)->type.context)
103
104 /* Define the Objective-C or Objective-C++ language-specific tree codes.  */
105
106 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
107 enum objc_tree_code {
108 #ifdef OBJCPLUS
109   dummy_tree_code = LAST_CPLUS_TREE_CODE,
110 #else
111   dummy_tree_code = LAST_AND_UNUSED_TREE_CODE,
112 #endif
113 #include "objc-tree.def"
114   LAST_OBJC_TREE_CODE
115 };
116 #undef DEFTREECODE