[TT #592][docs] Add docs about assigning to registers in docs/debugger.pod
[parrot.git] / include / parrot / oo.h
blobe5942edf85fbc00f7796d7ed0127b90a82345af4
1 /* objects.h
2 * Copyright (C) 2007-2008, Parrot Foundation.
3 * SVN Info
4 * $Id$
5 * Overview:
6 * Parrot class and object header stuff
7 * Data Structure and Algorithms:
8 * History:
9 * Notes:
10 * References:
13 #ifndef PARROT_OO_H_GUARD
14 #define PARROT_OO_H_GUARD
16 #include "parrot/parrot.h"
18 typedef enum {
19 PCD_PARENTS, /* An array of immediate parents */
20 PCD_CLASS_NAME, /* A String PMC */
21 PCD_ATTRIBUTES, /* class::attrib => offset hash */
22 PCD_CLASS_ATTRIBUTES, /* Class attribute array */
23 PCD_OBJECT_VTABLE, /* Vtable PMC that holds the vtable for objects of this class */
24 PCD_MAX
25 } PARROT_CLASS_DATA_ENUM;
29 * The active destroy flag is necessary to free the malloced array.
31 #define SLOTTYPE PMC*
32 #define get_attrib_num(x, y) ((PMC **)(x))[(y)]
33 #define set_attrib_num(o, x, y, z) \
34 do { \
35 Parrot_gc_write_barrier(interp, (o), ((PMC **)(x))[y], (z)); \
36 ((PMC **)(x))[(y)] = (z); \
37 } while (0)
40 * class macros
43 #define GET_CLASS(obj) (obj)->vtable->pmc_class
45 /* HEADERIZER BEGIN: src/oo.c */
46 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
48 PARROT_EXPORT
49 void Parrot_ComposeRole(PARROT_INTERP,
50 ARGIN(PMC *role),
51 ARGIN(PMC *exclude),
52 int got_exclude,
53 ARGIN(PMC *alias),
54 int got_alias,
55 ARGIN(PMC *methods_hash),
56 ARGIN(PMC *roles_list))
57 __attribute__nonnull__(1)
58 __attribute__nonnull__(2)
59 __attribute__nonnull__(3)
60 __attribute__nonnull__(5)
61 __attribute__nonnull__(7)
62 __attribute__nonnull__(8);
64 PARROT_EXPORT
65 PARROT_WARN_UNUSED_RESULT
66 PARROT_CAN_RETURN_NULL
67 PMC* Parrot_ComputeMRO_C3(PARROT_INTERP, ARGIN(PMC *_class))
68 __attribute__nonnull__(1)
69 __attribute__nonnull__(2);
71 PARROT_EXPORT
72 PARROT_CAN_RETURN_NULL
73 PARROT_WARN_UNUSED_RESULT
74 PMC * Parrot_find_method_direct(PARROT_INTERP,
75 ARGIN(PMC *_class),
76 ARGIN(STRING *method_name))
77 __attribute__nonnull__(1)
78 __attribute__nonnull__(2)
79 __attribute__nonnull__(3);
81 PARROT_EXPORT
82 PARROT_CAN_RETURN_NULL
83 PARROT_WARN_UNUSED_RESULT
84 PMC * Parrot_find_method_with_cache(PARROT_INTERP,
85 ARGIN(PMC *_class),
86 ARGIN(STRING *method_name))
87 __attribute__nonnull__(1)
88 __attribute__nonnull__(2)
89 __attribute__nonnull__(3);
91 PARROT_EXPORT
92 INTVAL Parrot_get_vtable_index(PARROT_INTERP, ARGIN(const STRING *name))
93 __attribute__nonnull__(1)
94 __attribute__nonnull__(2);
96 PARROT_EXPORT
97 PARROT_PURE_FUNCTION
98 PARROT_CAN_RETURN_NULL
99 const char * Parrot_get_vtable_name(SHIM_INTERP, INTVAL idx);
101 PARROT_EXPORT
102 void Parrot_invalidate_method_cache(PARROT_INTERP,
103 ARGIN_NULLOK(STRING *_class))
104 __attribute__nonnull__(1);
106 PARROT_EXPORT
107 PARROT_CAN_RETURN_NULL
108 PARROT_WARN_UNUSED_RESULT
109 PMC * Parrot_oo_find_vtable_override(PARROT_INTERP,
110 ARGIN(PMC *classobj),
111 ARGIN(STRING *name))
112 __attribute__nonnull__(1)
113 __attribute__nonnull__(2)
114 __attribute__nonnull__(3);
116 PARROT_EXPORT
117 PARROT_CAN_RETURN_NULL
118 PARROT_WARN_UNUSED_RESULT
119 PMC * Parrot_oo_find_vtable_override_for_class(PARROT_INTERP,
120 ARGIN(PMC *classobj),
121 ARGIN(STRING *name))
122 __attribute__nonnull__(1)
123 __attribute__nonnull__(2)
124 __attribute__nonnull__(3);
126 PARROT_EXPORT
127 PARROT_CAN_RETURN_NULL
128 PARROT_WARN_UNUSED_RESULT
129 PMC * Parrot_oo_get_class(PARROT_INTERP, ARGIN(PMC *key))
130 __attribute__nonnull__(1)
131 __attribute__nonnull__(2);
133 PARROT_EXPORT
134 PARROT_CAN_RETURN_NULL
135 PARROT_WARN_UNUSED_RESULT
136 PMC * Parrot_oo_get_class_str(PARROT_INTERP, ARGIN(STRING *name))
137 __attribute__nonnull__(1)
138 __attribute__nonnull__(2);
140 void destroy_object_cache(PARROT_INTERP)
141 __attribute__nonnull__(1);
143 void init_object_cache(PARROT_INTERP)
144 __attribute__nonnull__(1);
146 void mark_object_cache(PARROT_INTERP)
147 __attribute__nonnull__(1);
149 PARROT_CANNOT_RETURN_NULL
150 PMC * Parrot_oo_clone_object(PARROT_INTERP,
151 ARGIN(PMC *pmc),
152 ARGMOD_NULLOK(PMC *class_),
153 ARGMOD_NULLOK(PMC *dest))
154 __attribute__nonnull__(1)
155 __attribute__nonnull__(2)
156 FUNC_MODIFIES(*class_)
157 FUNC_MODIFIES(*dest);
159 void Parrot_oo_extract_methods_from_namespace(PARROT_INTERP,
160 ARGIN(PMC *self),
161 ARGIN(PMC *ns))
162 __attribute__nonnull__(1)
163 __attribute__nonnull__(2)
164 __attribute__nonnull__(3);
166 PARROT_CAN_RETURN_NULL
167 PARROT_WARN_UNUSED_RESULT
168 PMC * Parrot_oo_get_namespace(SHIM_INTERP, ARGIN(const PMC *classobj))
169 __attribute__nonnull__(2);
171 PARROT_CAN_RETURN_NULL
172 PARROT_WARN_UNUSED_RESULT
173 PMC * Parrot_oo_newclass_from_str(PARROT_INTERP, ARGIN(STRING *name))
174 __attribute__nonnull__(1)
175 __attribute__nonnull__(2);
177 PARROT_WARN_UNUSED_RESULT
178 INTVAL Parrot_oo_register_type(PARROT_INTERP,
179 ARGIN(PMC *name),
180 ARGIN(PMC *_namespace))
181 __attribute__nonnull__(1)
182 __attribute__nonnull__(2)
183 __attribute__nonnull__(3);
185 #define ASSERT_ARGS_Parrot_ComposeRole __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
186 PARROT_ASSERT_ARG(interp) \
187 , PARROT_ASSERT_ARG(role) \
188 , PARROT_ASSERT_ARG(exclude) \
189 , PARROT_ASSERT_ARG(alias) \
190 , PARROT_ASSERT_ARG(methods_hash) \
191 , PARROT_ASSERT_ARG(roles_list))
192 #define ASSERT_ARGS_Parrot_ComputeMRO_C3 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
193 PARROT_ASSERT_ARG(interp) \
194 , PARROT_ASSERT_ARG(_class))
195 #define ASSERT_ARGS_Parrot_find_method_direct __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
196 PARROT_ASSERT_ARG(interp) \
197 , PARROT_ASSERT_ARG(_class) \
198 , PARROT_ASSERT_ARG(method_name))
199 #define ASSERT_ARGS_Parrot_find_method_with_cache __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
200 PARROT_ASSERT_ARG(interp) \
201 , PARROT_ASSERT_ARG(_class) \
202 , PARROT_ASSERT_ARG(method_name))
203 #define ASSERT_ARGS_Parrot_get_vtable_index __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
204 PARROT_ASSERT_ARG(interp) \
205 , PARROT_ASSERT_ARG(name))
206 #define ASSERT_ARGS_Parrot_get_vtable_name __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
207 #define ASSERT_ARGS_Parrot_invalidate_method_cache \
208 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
209 PARROT_ASSERT_ARG(interp))
210 #define ASSERT_ARGS_Parrot_oo_find_vtable_override \
211 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
212 PARROT_ASSERT_ARG(interp) \
213 , PARROT_ASSERT_ARG(classobj) \
214 , PARROT_ASSERT_ARG(name))
215 #define ASSERT_ARGS_Parrot_oo_find_vtable_override_for_class \
216 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
217 PARROT_ASSERT_ARG(interp) \
218 , PARROT_ASSERT_ARG(classobj) \
219 , PARROT_ASSERT_ARG(name))
220 #define ASSERT_ARGS_Parrot_oo_get_class __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
221 PARROT_ASSERT_ARG(interp) \
222 , PARROT_ASSERT_ARG(key))
223 #define ASSERT_ARGS_Parrot_oo_get_class_str __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
224 PARROT_ASSERT_ARG(interp) \
225 , PARROT_ASSERT_ARG(name))
226 #define ASSERT_ARGS_destroy_object_cache __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
227 PARROT_ASSERT_ARG(interp))
228 #define ASSERT_ARGS_init_object_cache __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
229 PARROT_ASSERT_ARG(interp))
230 #define ASSERT_ARGS_mark_object_cache __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
231 PARROT_ASSERT_ARG(interp))
232 #define ASSERT_ARGS_Parrot_oo_clone_object __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
233 PARROT_ASSERT_ARG(interp) \
234 , PARROT_ASSERT_ARG(pmc))
235 #define ASSERT_ARGS_Parrot_oo_extract_methods_from_namespace \
236 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
237 PARROT_ASSERT_ARG(interp) \
238 , PARROT_ASSERT_ARG(self) \
239 , PARROT_ASSERT_ARG(ns))
240 #define ASSERT_ARGS_Parrot_oo_get_namespace __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
241 PARROT_ASSERT_ARG(classobj))
242 #define ASSERT_ARGS_Parrot_oo_newclass_from_str __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
243 PARROT_ASSERT_ARG(interp) \
244 , PARROT_ASSERT_ARG(name))
245 #define ASSERT_ARGS_Parrot_oo_register_type __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
246 PARROT_ASSERT_ARG(interp) \
247 , PARROT_ASSERT_ARG(name) \
248 , PARROT_ASSERT_ARG(_namespace))
249 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
250 /* HEADERIZER END: src/oo.c */
252 #endif /* PARROT_OO_H_GUARD */
255 * Local variables:
256 * c-file-style: "parrot"
257 * End:
258 * vim: expandtab shiftwidth=4: