Merged revisions 8245-8298 via svnmerge from
[cacao.git] / src / vmcore / annotation.h
1 /* src/vmcore/annotation.h - class annotations
2
3    Copyright (C) 2006, 2007 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4    R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5    C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6    Institut f. Computersprachen - TU Wien
7
8    This file is part of CACAO.
9
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation; either version 2, or (at
13    your option) any later version.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23    02110-1301, USA.
24
25 */
26
27
28 #ifndef _ANNOTATION_H
29 #define _ANNOTATION_H
30
31 /* forward typedefs ***********************************************************/
32
33 typedef struct annotation_bytearray_t annotation_bytearray_t;
34 typedef struct annotation_t           annotation_t;
35 typedef struct element_value_t        element_value_t;
36 typedef struct annotation_bytearrays_t annotation_bytearrays_t;
37
38 #include "config.h"
39 #include "vm/types.h"
40
41 #include "vm/global.h"
42
43 #include "vmcore/class.h"
44 #include "vmcore/field.h"
45 #include "vmcore/method.h"
46 #include "vmcore/loader.h"
47 #include "vmcore/utf8.h"
48
49
50 /* annotation_bytearray *******************************************************/
51
52 struct annotation_bytearray_t {
53         uint32_t size;
54         uint8_t  data[1];
55 };
56
57 /* annotation_bytearrays ******************************************************/
58
59 struct annotation_bytearrays_t {
60         uint32_t size;
61         annotation_bytearray_t *data[1];
62 };
63
64 /* annotation *****************************************************************/
65
66 struct annotation_t {
67         utf             *type;
68         s4               element_valuescount;
69         element_value_t *element_values;
70 };
71
72 /* element_value **************************************************************/
73
74 struct element_value_t {
75         utf *name;
76         u1   tag;
77 };
78
79
80 /* function prototypes ********************************************************/
81
82 annotation_bytearray_t *annotation_bytearray_new(uint32_t size);
83
84 void annotation_bytearray_free(annotation_bytearray_t *ba);
85
86 annotation_bytearrays_t *annotation_bytearrays_new(uint32_t size);
87
88 bool annotation_bytearrays_resize(annotation_bytearrays_t **bas,
89         uint32_t size);
90
91 bool annotation_bytearrays_insert(annotation_bytearrays_t **bas,
92         uint32_t index, annotation_bytearray_t *ba);
93
94 void annotation_bytearrays_free(annotation_bytearrays_t *bas);
95
96 bool annotation_load_class_attribute_runtimevisibleannotations(
97         classbuffer *cb);
98
99 bool annotation_load_class_attribute_runtimeinvisibleannotations(
100         classbuffer *cb);
101
102 bool annotation_load_method_attribute_runtimevisibleannotations(
103         classbuffer *cb, methodinfo *m);
104
105 bool annotation_load_method_attribute_runtimeinvisibleannotations(
106         classbuffer *cb, methodinfo *m);
107
108 bool annotation_load_field_attribute_runtimevisibleannotations(
109         classbuffer *cb, fieldinfo *f);
110
111 bool annotation_load_field_attribute_runtimeinvisibleannotations(
112         classbuffer *cb, fieldinfo *f);
113
114 bool annotation_load_method_attribute_annotationdefault(
115         classbuffer *cb, methodinfo *m);
116
117 bool annotation_load_method_attribute_runtimevisibleparameterannotations(
118         classbuffer *cb, methodinfo *m);
119
120 bool annotation_load_method_attribute_runtimeinvisibleparameterannotations(
121         classbuffer *cb, methodinfo *m);
122
123 #endif /* _ANNOTATION_H */
124
125
126 /*
127  * These are local overrides for various environment variables in Emacs.
128  * Please do not remove this and leave it at the end of the file, where
129  * Emacs will automagically detect them.
130  * ---------------------------------------------------------------------
131  * Local variables:
132  * mode: c
133  * indent-tabs-mode: t
134  * c-basic-offset: 4
135  * tab-width: 4
136  * End:
137  * vim:noexpandtab:sw=4:ts=4:
138  */