2 * typedef.c: Handling of TypeDefs.
5 * Miguel de Icaza (miguel@ximian.com)
7 * (C) 2001 Ximian, Inc.
10 #include <mono/metadata/typedef.h>
13 * mono_typedef_decode:
14 * @image: image to decode from
15 * @tidx: typedef number
17 * Decodes the TypeDef whose index is @tidx in @image
20 mono_typedef_decode (MonoImage *image, guint32 tidx, MonoTypedef *ret)
22 MonoMetadata *m = &image->metadata;
23 MonoTableInfo *tt = m->tables [MONO_TABLE_TYPEDEF];
25 guint32 cols_next [MONO_TYPEDEF_SIZE];
28 g_assert (typedef_token < tt->rows);
30 mono_metadata_decode_row (tt, typedef_idx, &ret->cols, CSIZE (ret->cols));
33 * Get the field and method range
35 ret->field.first = ret->cols [MONO_TYPEREF_FIELD_LIST] - 1;
36 ret->method.first = ret->cols [MONO_TYPEDEF_METHOD_LIST] - 1;
38 if (tt->rows > typedef_idx + 1){
39 mono_metadata_decode_row (tt, typedef_idx + 1, cols_next, CSIZE (cols_next));
40 ret->field.last = cols_next [MONO_TYPEREF_FIELD_LIST] - 1;
41 ret->method.last = cols_next [MONO_TYPEREF_FIELD_LIST] - 1;
43 ret->field.last = m->tables [MONO_TABLE_FIELD].rows;
44 ret->field.method = m->tables [MONO_TABLE_METHOD].rows;
48 * Get the method range