Merge pull request #2408 from tastywheattasteslikechicken/MoreInterfaceSupport
[mono.git] / mono / metadata / metadata.h
1
2 #ifndef __MONO_METADATA_H__
3 #define __MONO_METADATA_H__
4
5 #include <mono/utils/mono-publib.h>
6
7 #include <mono/metadata/blob.h>
8 #include <mono/metadata/row-indexes.h>
9 #include <mono/metadata/image.h>
10
11 MONO_BEGIN_DECLS
12
13 #define MONO_TYPE_ISSTRUCT(t) mono_type_is_struct (t)
14 #define MONO_TYPE_IS_VOID(t) mono_type_is_void (t)
15 #define MONO_TYPE_IS_POINTER(t) mono_type_is_pointer (t)
16 #define MONO_TYPE_IS_REFERENCE(t) mono_type_is_reference (t)
17
18 #define MONO_CLASS_IS_INTERFACE(c) ((mono_class_get_flags (c) & TYPE_ATTRIBUTE_INTERFACE) || (c->byval_arg.type == MONO_TYPE_VAR) || (c->byval_arg.type == MONO_TYPE_MVAR))
19
20 #define MONO_CLASS_IS_IMPORT(c) ((mono_class_get_flags (c) & TYPE_ATTRIBUTE_IMPORT))
21
22 typedef struct _MonoClass MonoClass;
23 typedef struct _MonoDomain MonoDomain;
24 typedef struct _MonoMethod MonoMethod;
25
26 typedef enum {
27         MONO_EXCEPTION_CLAUSE_NONE,
28         MONO_EXCEPTION_CLAUSE_FILTER,
29         MONO_EXCEPTION_CLAUSE_FINALLY,
30         MONO_EXCEPTION_CLAUSE_FAULT = 4
31 } MonoExceptionEnum;
32
33 typedef enum {
34         MONO_CALL_DEFAULT,
35         MONO_CALL_C,
36         MONO_CALL_STDCALL,
37         MONO_CALL_THISCALL,
38         MONO_CALL_FASTCALL,
39         MONO_CALL_VARARG
40 } MonoCallConvention;
41
42 /* ECMA lamespec: the old spec had more info... */
43 typedef enum {
44         MONO_NATIVE_BOOLEAN = 0x02, /* 4 bytes, 0 is false, != 0 is true */
45         MONO_NATIVE_I1 = 0x03,
46         MONO_NATIVE_U1 = 0x04,
47         MONO_NATIVE_I2 = 0x05,
48         MONO_NATIVE_U2 = 0x06,
49         MONO_NATIVE_I4 = 0x07,
50         MONO_NATIVE_U4 = 0x08,
51         MONO_NATIVE_I8 = 0x09,
52         MONO_NATIVE_U8 = 0x0a,
53         MONO_NATIVE_R4 = 0x0b,
54         MONO_NATIVE_R8 = 0x0c,
55         MONO_NATIVE_CURRENCY = 0x0f,
56         MONO_NATIVE_BSTR = 0x13, /* prefixed length, Unicode */
57         MONO_NATIVE_LPSTR = 0x14, /* ANSI, null terminated */
58         MONO_NATIVE_LPWSTR = 0x15, /* UNICODE, null terminated */
59         MONO_NATIVE_LPTSTR = 0x16, /* plattform dep., null terminated */
60         MONO_NATIVE_BYVALTSTR = 0x17,
61         MONO_NATIVE_IUNKNOWN = 0x19,
62         MONO_NATIVE_IDISPATCH = 0x1a,
63         MONO_NATIVE_STRUCT = 0x1b,
64         MONO_NATIVE_INTERFACE = 0x1c,
65         MONO_NATIVE_SAFEARRAY = 0x1d,
66         MONO_NATIVE_BYVALARRAY = 0x1e,
67         MONO_NATIVE_INT   = 0x1f,
68         MONO_NATIVE_UINT  = 0x20,
69         MONO_NATIVE_VBBYREFSTR  = 0x22,
70         MONO_NATIVE_ANSIBSTR  = 0x23,  /* prefixed length, ANSI */
71         MONO_NATIVE_TBSTR  = 0x24, /* prefixed length, plattform dep. */
72         MONO_NATIVE_VARIANTBOOL  = 0x25,
73         MONO_NATIVE_FUNC  = 0x26,
74         MONO_NATIVE_ASANY = 0x28,
75         MONO_NATIVE_LPARRAY = 0x2a,
76         MONO_NATIVE_LPSTRUCT = 0x2b,
77         MONO_NATIVE_CUSTOM = 0x2c,
78         MONO_NATIVE_ERROR = 0x2d,
79         // TODO: MONO_NATIVE_IINSPECTABLE = 0x2e
80         // TODO: MONO_NATIVE_HSTRING = 0x2f
81         MONO_NATIVE_UTF8STR = 0x30,
82         MONO_NATIVE_MAX = 0x50 /* no info */
83 } MonoMarshalNative;
84
85 /* Used only in context of SafeArray */
86 typedef enum {
87         MONO_VARIANT_EMPTY = 0x00,
88         MONO_VARIANT_NULL = 0x01,
89         MONO_VARIANT_I2 = 0x02,
90         MONO_VARIANT_I4 = 0x03,
91         MONO_VARIANT_R4 = 0x04,
92         MONO_VARIANT_R8 = 0x05,
93         MONO_VARIANT_CY = 0x06,
94         MONO_VARIANT_DATE = 0x07,
95         MONO_VARIANT_BSTR = 0x08,
96         MONO_VARIANT_DISPATCH = 0x09,
97         MONO_VARIANT_ERROR = 0x0a,
98         MONO_VARIANT_BOOL = 0x0b,
99         MONO_VARIANT_VARIANT = 0x0c,
100         MONO_VARIANT_UNKNOWN = 0x0d,
101         MONO_VARIANT_DECIMAL = 0x0e,
102         MONO_VARIANT_I1 = 0x10,
103         MONO_VARIANT_UI1 = 0x11,
104         MONO_VARIANT_UI2 = 0x12,
105         MONO_VARIANT_UI4 = 0x13,
106         MONO_VARIANT_I8 = 0x14,
107         MONO_VARIANT_UI8 = 0x15,
108         MONO_VARIANT_INT = 0x16,
109         MONO_VARIANT_UINT = 0x17,
110         MONO_VARIANT_VOID = 0x18,
111         MONO_VARIANT_HRESULT = 0x19,
112         MONO_VARIANT_PTR = 0x1a,
113         MONO_VARIANT_SAFEARRAY = 0x1b,
114         MONO_VARIANT_CARRAY = 0x1c,
115         MONO_VARIANT_USERDEFINED = 0x1d,
116         MONO_VARIANT_LPSTR = 0x1e,
117         MONO_VARIANT_LPWSTR = 0x1f,
118         MONO_VARIANT_RECORD = 0x24,
119         MONO_VARIANT_FILETIME = 0x40,
120         MONO_VARIANT_BLOB = 0x41,
121         MONO_VARIANT_STREAM = 0x42,
122         MONO_VARIANT_STORAGE = 0x43,
123         MONO_VARIANT_STREAMED_OBJECT = 0x44,
124         MONO_VARIANT_STORED_OBJECT = 0x45,
125         MONO_VARIANT_BLOB_OBJECT = 0x46,
126         MONO_VARIANT_CF = 0x47,
127         MONO_VARIANT_CLSID = 0x48,
128         MONO_VARIANT_VECTOR = 0x1000,
129         MONO_VARIANT_ARRAY = 0x2000,
130         MONO_VARIANT_BYREF = 0x4000
131 } MonoMarshalVariant;
132
133 typedef enum {
134         MONO_MARSHAL_CONV_NONE,
135         MONO_MARSHAL_CONV_BOOL_VARIANTBOOL,
136         MONO_MARSHAL_CONV_BOOL_I4,
137         MONO_MARSHAL_CONV_STR_BSTR,
138         MONO_MARSHAL_CONV_STR_LPSTR,
139         MONO_MARSHAL_CONV_LPSTR_STR,
140         MONO_MARSHAL_CONV_LPTSTR_STR,
141         MONO_MARSHAL_CONV_STR_LPWSTR,
142         MONO_MARSHAL_CONV_LPWSTR_STR,
143         MONO_MARSHAL_CONV_STR_LPTSTR,
144         MONO_MARSHAL_CONV_STR_ANSIBSTR,
145         MONO_MARSHAL_CONV_STR_TBSTR,
146         MONO_MARSHAL_CONV_STR_BYVALSTR,
147         MONO_MARSHAL_CONV_STR_BYVALWSTR,
148         MONO_MARSHAL_CONV_SB_LPSTR,
149         MONO_MARSHAL_CONV_SB_LPTSTR,
150         MONO_MARSHAL_CONV_SB_LPWSTR,
151         MONO_MARSHAL_CONV_LPSTR_SB,
152         MONO_MARSHAL_CONV_LPTSTR_SB,
153         MONO_MARSHAL_CONV_LPWSTR_SB,
154         MONO_MARSHAL_CONV_ARRAY_BYVALARRAY,
155         MONO_MARSHAL_CONV_ARRAY_BYVALCHARARRAY,
156         MONO_MARSHAL_CONV_ARRAY_SAVEARRAY,
157         MONO_MARSHAL_CONV_ARRAY_LPARRAY,
158         MONO_MARSHAL_FREE_LPARRAY,
159         MONO_MARSHAL_CONV_OBJECT_INTERFACE,
160         MONO_MARSHAL_CONV_OBJECT_IDISPATCH,
161         MONO_MARSHAL_CONV_OBJECT_IUNKNOWN,
162         MONO_MARSHAL_CONV_OBJECT_STRUCT,
163         MONO_MARSHAL_CONV_DEL_FTN,
164         MONO_MARSHAL_CONV_FTN_DEL,
165         MONO_MARSHAL_FREE_ARRAY,
166         MONO_MARSHAL_CONV_BSTR_STR,
167         MONO_MARSHAL_CONV_SAFEHANDLE,
168         MONO_MARSHAL_CONV_HANDLEREF,
169         MONO_MARSHAL_CONV_STR_UTF8STR,
170         MONO_MARSHAL_CONV_SB_UTF8STR,
171         MONO_MARSHAL_CONV_UTF8STR_STR,
172         MONO_MARSHAL_CONV_UTF8STR_SB,
173 } MonoMarshalConv;
174
175 #define MONO_MARSHAL_CONV_INVALID ((MonoMarshalConv)-1)
176
177 typedef struct {
178         MonoMarshalNative native;
179         union {
180                 struct {
181                         MonoMarshalNative elem_type;
182                         int32_t num_elem; /* -1 if not set */
183                         int16_t param_num; /* -1 if not set */
184                         int16_t elem_mult; /* -1 if not set */
185                 } array_data;
186                 struct {
187                         char *custom_name;
188                         char *cookie;
189                         MonoImage *image;
190                 } custom_data;
191                 struct {
192                         MonoMarshalVariant elem_type;
193                         int32_t num_elem;
194                 } safearray_data;
195         } data;
196 } MonoMarshalSpec;
197
198 MONO_API void         mono_metadata_init (void);
199
200 MONO_API void         mono_metadata_decode_row (const MonoTableInfo   *t,
201                                        int                    idx,
202                                        uint32_t               *res,
203                                        int                    res_size);
204
205 MONO_API uint32_t      mono_metadata_decode_row_col (const MonoTableInfo *t, 
206                                            int            idx, 
207                                            unsigned int          col);
208
209 /*
210  * This macro is used to extract the size of the table encoded in
211  * the size_bitfield of MonoTableInfo.
212  */
213 #define mono_metadata_table_size(bitfield,table) ((((bitfield) >> ((table)*2)) & 0x3) + 1)
214 #define mono_metadata_table_count(bitfield) ((bitfield) >> 24)
215
216 MONO_API int mono_metadata_compute_size (MonoImage   *meta,
217                                 int             tableindex,
218                                 uint32_t        *result_bitfield);
219
220 /*
221  *
222  */
223 MONO_API const char    *mono_metadata_locate        (MonoImage *meta, int table, int idx);
224 MONO_API const char    *mono_metadata_locate_token  (MonoImage *meta, uint32_t token);
225                                            
226 MONO_API const char    *mono_metadata_string_heap   (MonoImage *meta, uint32_t table_index);
227 MONO_API const char    *mono_metadata_blob_heap     (MonoImage *meta, uint32_t table_index);
228 MONO_API const char    *mono_metadata_user_string   (MonoImage *meta, uint32_t table_index);
229 MONO_API const char    *mono_metadata_guid_heap     (MonoImage *meta, uint32_t table_index);
230
231 MONO_API uint32_t mono_metadata_typedef_from_field  (MonoImage *meta, uint32_t table_index);
232 MONO_API uint32_t mono_metadata_typedef_from_method (MonoImage *meta, uint32_t table_index);
233 MONO_API uint32_t mono_metadata_nested_in_typedef   (MonoImage *meta, uint32_t table_index);
234 MONO_API uint32_t mono_metadata_nesting_typedef     (MonoImage *meta, uint32_t table_index, uint32_t start_index);
235
236 MONO_API MonoClass** mono_metadata_interfaces_from_typedef (MonoImage *meta, uint32_t table_index, unsigned int *count);
237
238 MONO_API uint32_t     mono_metadata_events_from_typedef     (MonoImage *meta, uint32_t table_index, unsigned int *end_idx);
239 MONO_API uint32_t     mono_metadata_methods_from_event      (MonoImage *meta, uint32_t table_index, unsigned int *end);
240 MONO_API uint32_t     mono_metadata_properties_from_typedef (MonoImage *meta, uint32_t table_index, unsigned int *end);
241 MONO_API uint32_t     mono_metadata_methods_from_property   (MonoImage *meta, uint32_t table_index, unsigned int *end);
242 MONO_API uint32_t     mono_metadata_packing_from_typedef    (MonoImage *meta, uint32_t table_index, uint32_t *packing, uint32_t *size);
243 MONO_API const char* mono_metadata_get_marshal_info        (MonoImage *meta, uint32_t idx, mono_bool is_field);
244 MONO_API uint32_t     mono_metadata_custom_attrs_from_index (MonoImage *meta, uint32_t cattr_index);
245
246 MONO_API MonoMarshalSpec *mono_metadata_parse_marshal_spec (MonoImage *image, const char *ptr);
247
248 MONO_API void mono_metadata_free_marshal_spec (MonoMarshalSpec *spec);
249
250 MONO_API uint32_t     mono_metadata_implmap_from_method     (MonoImage *meta, uint32_t method_idx);
251
252 MONO_API void        mono_metadata_field_info (MonoImage *meta, 
253                                       uint32_t       table_index,
254                                       uint32_t      *offset,
255                                       uint32_t      *rva,
256                                       MonoMarshalSpec **marshal_spec);
257
258 MONO_API uint32_t     mono_metadata_get_constant_index (MonoImage *meta, uint32_t token, uint32_t hint);
259
260 /*
261  * Functions to extract information from the Blobs
262  */
263 MONO_API uint32_t mono_metadata_decode_value     (const char            *ptr,
264                                         const char           **rptr);
265 MONO_API int32_t mono_metadata_decode_signed_value (const char *ptr, const char **rptr);
266
267 MONO_API uint32_t mono_metadata_decode_blob_size (const char            *ptr,
268                                         const char           **rptr);
269
270 MONO_API void mono_metadata_encode_value (uint32_t value, char *bug, char **endbuf);
271
272 #define MONO_OFFSET_IN_CLAUSE(clause,offset) \
273         ((clause)->try_offset <= (offset) && (offset) < ((clause)->try_offset + (clause)->try_len))
274 #define MONO_OFFSET_IN_HANDLER(clause,offset) \
275         ((clause)->handler_offset <= (offset) && (offset) < ((clause)->handler_offset + (clause)->handler_len))
276 #define MONO_OFFSET_IN_FILTER(clause,offset) \
277         ((clause)->flags == MONO_EXCEPTION_CLAUSE_FILTER && (clause)->data.filter_offset <= (offset) && (offset) < ((clause)->handler_offset))
278
279 typedef struct {
280         uint32_t flags;
281         uint32_t try_offset;
282         uint32_t try_len;
283         uint32_t handler_offset;
284         uint32_t handler_len;
285         union {
286                 uint32_t filter_offset;
287                 MonoClass *catch_class;
288         } data;
289 } MonoExceptionClause;
290
291 typedef struct _MonoType MonoType;
292 typedef struct _MonoGenericInst MonoGenericInst;
293 typedef struct _MonoGenericClass MonoGenericClass;
294 typedef struct _MonoGenericContext MonoGenericContext;
295 typedef struct _MonoGenericContainer MonoGenericContainer;
296 typedef struct _MonoGenericParam MonoGenericParam;
297 typedef struct _MonoArrayType MonoArrayType;
298 typedef struct _MonoMethodSignature MonoMethodSignature;
299
300 /* FIXME: Keeping this name alive for now, since it is part of the exposed API, even though no entrypoint uses it.  */
301 typedef struct invalid_name MonoGenericMethod;
302
303 typedef struct {
304         unsigned int required : 1;
305         unsigned int token    : 31;
306 } MonoCustomMod;
307
308 struct _MonoArrayType {
309         MonoClass *eklass;
310         // Number of dimensions of the array
311         uint8_t rank;
312
313         // Arrays recording known upper and lower index bounds for each dimension
314         uint8_t numsizes;
315         uint8_t numlobounds;
316         int *sizes;
317         int *lobounds;
318 };
319
320 typedef struct _MonoMethodHeader MonoMethodHeader;
321
322 typedef enum {
323         MONO_PARSE_TYPE,
324         MONO_PARSE_MOD_TYPE,
325         MONO_PARSE_LOCAL,
326         MONO_PARSE_PARAM,
327         MONO_PARSE_RET,
328         MONO_PARSE_FIELD
329 } MonoParseTypeMode;
330
331 MONO_API mono_bool
332 mono_type_is_byref       (MonoType *type);
333
334 MONO_API int
335 mono_type_get_type       (MonoType *type);
336
337 /* For MONO_TYPE_FNPTR */
338 MONO_API MonoMethodSignature*
339 mono_type_get_signature  (MonoType *type);
340
341 /* For MONO_TYPE_CLASS, VALUETYPE */
342 MONO_API MonoClass*
343 mono_type_get_class      (MonoType *type);
344
345 MONO_API MonoArrayType*
346 mono_type_get_array_type (MonoType *type);
347
348 /* For MONO_TYPE_PTR */
349 MONO_API MonoType*
350 mono_type_get_ptr_type (MonoType *type);
351
352 MONO_API MonoClass*
353 mono_type_get_modifiers  (MonoType *type, mono_bool *is_required, void **iter);
354
355 MONO_API mono_bool mono_type_is_struct    (MonoType *type);
356 MONO_API mono_bool mono_type_is_void      (MonoType *type);
357 MONO_API mono_bool mono_type_is_pointer   (MonoType *type);
358 MONO_API mono_bool mono_type_is_reference (MonoType *type);
359 mono_bool mono_type_is_generic_parameter (MonoType *type);
360
361 MONO_API MonoType*
362 mono_signature_get_return_type (MonoMethodSignature *sig);
363
364 MONO_API MonoType*
365 mono_signature_get_params      (MonoMethodSignature *sig, void **iter);
366
367 MONO_API uint32_t
368 mono_signature_get_param_count (MonoMethodSignature *sig);
369
370 MONO_API uint32_t
371 mono_signature_get_call_conv   (MonoMethodSignature *sig);
372
373 MONO_API int
374 mono_signature_vararg_start    (MonoMethodSignature *sig);
375
376 MONO_API mono_bool
377 mono_signature_is_instance     (MonoMethodSignature *sig);
378
379 MONO_API mono_bool
380 mono_signature_explicit_this   (MonoMethodSignature *sig);
381
382 MONO_API mono_bool
383 mono_signature_param_is_out    (MonoMethodSignature *sig, int param_num);
384
385 MONO_API uint32_t     mono_metadata_parse_typedef_or_ref (MonoImage      *m,
386                                                 const char      *ptr,
387                                                 const char     **rptr);
388 MONO_API int            mono_metadata_parse_custom_mod  (MonoImage      *m,
389                                                 MonoCustomMod   *dest,
390                                                 const char      *ptr,
391                                                 const char     **rptr);
392 MONO_RT_EXTERNAL_ONLY
393 MONO_API MonoArrayType *mono_metadata_parse_array       (MonoImage      *m,
394                                                 const char      *ptr,
395                                                 const char     **rptr);
396 MONO_API void           mono_metadata_free_array        (MonoArrayType     *array);
397 MONO_RT_EXTERNAL_ONLY
398 MONO_API MonoType      *mono_metadata_parse_type        (MonoImage      *m,
399                                                 MonoParseTypeMode  mode,
400                                                 short              opt_attrs,
401                                                 const char        *ptr,
402                                                 const char       **rptr);
403 MONO_RT_EXTERNAL_ONLY
404 MONO_API MonoType      *mono_metadata_parse_param       (MonoImage      *m,
405                                                 const char      *ptr,
406                                                 const char      **rptr);
407 MONO_API MonoType      *mono_metadata_parse_ret_type    (MonoImage      *m,
408                                                 const char      *ptr,
409                                                 const char      **rptr);
410 MONO_RT_EXTERNAL_ONLY
411 MONO_API MonoType      *mono_metadata_parse_field_type  (MonoImage      *m,
412                                                 short            field_flags,
413                                                 const char      *ptr,
414                                                 const char      **rptr);
415 MONO_API MonoType      *mono_type_create_from_typespec  (MonoImage        *image, 
416                                                 uint32_t           type_spec);
417 MONO_API void           mono_metadata_free_type         (MonoType        *type);
418 MONO_API int            mono_type_size                  (MonoType        *type, 
419                                                 int             *alignment);
420 MONO_API int            mono_type_stack_size            (MonoType        *type, 
421                                                 int             *alignment);
422
423 MONO_API mono_bool       mono_type_generic_inst_is_valuetype      (MonoType *type);
424 MONO_API mono_bool       mono_metadata_generic_class_is_valuetype (MonoGenericClass *gclass);
425 MONO_API unsigned int          mono_metadata_generic_class_hash  (MonoGenericClass *gclass);
426 MONO_API mono_bool       mono_metadata_generic_class_equal (MonoGenericClass *g1, MonoGenericClass *g2);
427
428 MONO_API unsigned int          mono_metadata_type_hash         (MonoType *t1);
429 MONO_API mono_bool       mono_metadata_type_equal        (MonoType *t1, MonoType *t2);
430
431 MONO_API MonoMethodSignature  *mono_metadata_signature_alloc (MonoImage *image, uint32_t nparams);
432
433 MONO_API MonoMethodSignature  *mono_metadata_signature_dup (MonoMethodSignature *sig);
434
435 MONO_RT_EXTERNAL_ONLY
436 MONO_API MonoMethodSignature  *mono_metadata_parse_signature (MonoImage *image, 
437                                                      uint32_t    token);
438
439 MONO_API MonoMethodSignature  *mono_metadata_parse_method_signature (MonoImage            *m,
440                                                             int                    def,
441                                                             const char            *ptr,
442                                                             const char           **rptr);
443 MONO_API void                  mono_metadata_free_method_signature  (MonoMethodSignature   *method);
444
445 MONO_API mono_bool          mono_metadata_signature_equal (MonoMethodSignature *sig1, 
446                                                  MonoMethodSignature *sig2);
447
448 MONO_API unsigned int             mono_signature_hash (MonoMethodSignature *sig);
449
450 MONO_RT_EXTERNAL_ONLY
451 MONO_API MonoMethodHeader *mono_metadata_parse_mh (MonoImage *m, const char *ptr);
452 MONO_API void              mono_metadata_free_mh  (MonoMethodHeader *mh);
453
454 /* MonoMethodHeader acccessors */
455 MONO_API const unsigned char*
456 mono_method_header_get_code (MonoMethodHeader *header, uint32_t* code_size, uint32_t* max_stack);
457
458 MONO_API MonoType**
459 mono_method_header_get_locals (MonoMethodHeader *header, uint32_t* num_locals, mono_bool *init_locals);
460
461 MONO_API int
462 mono_method_header_get_num_clauses (MonoMethodHeader *header);
463
464 MONO_API int
465 mono_method_header_get_clauses (MonoMethodHeader *header, MonoMethod *method, void **iter, MonoExceptionClause *clause);
466
467 MONO_API uint32_t 
468 mono_type_to_unmanaged (MonoType *type, MonoMarshalSpec *mspec, 
469                         mono_bool as_field, mono_bool unicode, MonoMarshalConv *conv);
470
471 /*
472  * Makes a token based on a table and an index
473  */
474 #define mono_metadata_make_token(table,idx) (((table) << 24)| (idx))
475
476 /*
477  * Returns the table index that this token encodes.
478  */
479 #define mono_metadata_token_table(token) ((token) >> 24)
480
481  /*
482  * Returns the index that a token refers to
483  */
484 #define mono_metadata_token_index(token) ((token & 0xffffff))
485
486
487 #define mono_metadata_token_code(token) ((token & 0xff000000))
488
489 MONO_API uint32_t mono_metadata_token_from_dor (uint32_t dor_index);
490
491 MONO_API char *mono_guid_to_string (const uint8_t *guid);
492
493 MONO_API char *mono_guid_to_string_minimal (const uint8_t *guid);
494
495 MONO_API uint32_t mono_metadata_declsec_from_index (MonoImage *meta, uint32_t idx);
496
497 MONO_API uint32_t mono_metadata_translate_token_index (MonoImage *image, int table, uint32_t idx);
498
499 MONO_API void    mono_metadata_decode_table_row (MonoImage *image, int table,
500                                        int                    idx,
501                                        uint32_t               *res,
502                                        int                    res_size);
503
504 MONO_API uint32_t      mono_metadata_decode_table_row_col (MonoImage *image, int table,
505                                            int            idx, 
506                                            unsigned int          col);
507
508 MONO_END_DECLS
509
510 #endif /* __MONO_METADATA_H__ */