2004-05-25 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mono / metadata / reflection.h
index 766074e94cdce5158e75c51444e0d50f7d63905b..d31deae81772b73955842cde8eb6c3a16d97c9d0 100644 (file)
@@ -86,6 +86,7 @@ typedef struct {
 typedef struct {
        MonoObject object;
        MonoAssembly *assembly;
+       MonoObject *resolve_event_holder;
 } MonoReflectionAssembly;
 
 typedef struct {
@@ -111,7 +112,8 @@ typedef struct {
 } MonoPropertyInfo;
 
 typedef struct {
-       MonoReflectionType *parent;
+       MonoReflectionType *declaring_type;
+       MonoReflectionType *reflected_type;
        MonoString *name;
        MonoReflectionMethod *add_method;
        MonoReflectionMethod *remove_method;
@@ -165,6 +167,7 @@ typedef struct {
        MonoObject object;
        MonoReflectionType *type;
        MonoString *name;
+       MonoBoolean is_pinned;
 } MonoReflectionLocalBuilder;
 
 typedef struct {
@@ -204,6 +207,7 @@ typedef struct {
        MonoBoolean init_locals;
        MonoArray *param_modreq;
        MonoArray *param_modopt;
+       MonoArray *permissions;
 } MonoReflectionCtorBuilder;
 
 typedef struct {
@@ -232,6 +236,7 @@ typedef struct {
        MonoArray *return_modopt;
        MonoArray *param_modreq;
        MonoArray *param_modopt;
+       MonoArray *permissions;
 } MonoReflectionMethodBuilder;
 
 typedef struct {
@@ -245,15 +250,6 @@ typedef struct {
        guint32 call_conv;
 } MonoReflectionArrayMethod;
 
-/* 
- * Information which isn't in the MonoMethod structure is stored here for
- * dynamic methods.
- */
-typedef struct {
-       char **param_names;
-       MonoMarshalSpec **param_marshall;
-} MonoReflectionMethodAux;
-
 enum {
        MONO_SECTION_TEXT,
        MONO_SECTION_RSRC,
@@ -286,6 +282,7 @@ typedef struct {
                guint32 offset;
                guint32 attrs;
        } sections [MONO_SECTION_MAX];
+       GHashTable *typespec;
        GHashTable *typeref;
        GHashTable *handleref;
        MonoGHashTable *tokens;
@@ -299,6 +296,8 @@ typedef struct {
        gboolean save;
        char *strong_name;
        guint32 strong_name_size;
+       char *win32_res;
+       guint32 win32_res_size;
        MonoDynamicStream pefile;
        MonoDynamicStream sheap;
        MonoDynamicStream code; /* used to store method headers and bytecode */
@@ -315,12 +314,25 @@ typedef struct {
        MonoString *name;
        MonoString *filename;
        guint32 attrs;
+       guint32 offset;
 } MonoReflectionResource;
 
+typedef struct {
+       guint32 res_type;
+       guint32 res_id;
+       guint32 lang_id;
+       MonoArray *res_data;
+} MonoReflectionWin32Resource;
+
+typedef struct {
+       guint32 action;
+       MonoString *pset;
+} MonoReflectionPermissionSet;
+
 typedef struct {
        MonoReflectionAssembly assembly;
        MonoDynamicAssembly *dynamic_assembly;
-       MonoReflectionMethodBuilder *entry_point;
+       MonoReflectionMethod *entry_point;
        MonoArray *modules;
        MonoString *name;
        MonoString *dir;
@@ -334,7 +346,8 @@ typedef struct {
        guint32 pekind;
        MonoBoolean delay_sign;
        guint32 access;
-       gpointer main_module;
+       MonoArray *loaded_modules;
+       MonoArray *win32_resources;
 } MonoReflectionAssemblyBuilder;
 
 typedef struct {
@@ -380,6 +393,7 @@ typedef struct {
 typedef struct {
        MonoReflectionModule module;
        MonoDynamicImage *dynamic_image;
+       gint32     num_types;
        MonoArray *types;
        MonoArray *cattrs;
        MonoArray *guid;
@@ -388,6 +402,7 @@ typedef struct {
        MonoArray *global_methods;
        MonoArray *global_fields;
        gboolean is_main;
+       MonoArray *resources;
 } MonoReflectionModuleBuilder;
 
 typedef struct {
@@ -397,9 +412,11 @@ typedef struct {
        MonoReflectionType *parent;
        MonoReflectionType *nesting_type;
        MonoArray *interfaces;
+       gint32     num_methods;
        MonoArray *methods;
        MonoArray *ctors;
        MonoArray *properties;
+       gint32     num_fields;
        MonoArray *fields;
        MonoArray *events;
        MonoArray *cattrs;
@@ -410,44 +427,29 @@ typedef struct {
        gint32 class_size;
        gint32 packing_size;
        MonoArray *generic_params;
+       MonoArray *permissions;
 } MonoReflectionTypeBuilder;
 
 typedef struct {
-       MonoObject obj;
-       MonoGenericParam *param;
-       MonoReflectionType *type;
+       MonoReflectionType type;
+       MonoReflectionTypeBuilder *tbuilder;
+       MonoReflectionMethodBuilder *mbuilder;
        MonoString *name;
-       guint32 flags;
-       MonoArray *constraints;
+       guint32 index;
+       MonoReflectionType *base_type;
+       MonoArray *iface_constraints;
+       MonoBoolean has_ctor_constraint;
+       MonoBoolean has_reference_type;
+       MonoBoolean has_value_type;
 } MonoReflectionGenericParam;
 
 typedef struct _MonoReflectionGenericInst MonoReflectionGenericInst;
 struct _MonoReflectionGenericInst {
        MonoReflectionType type;
-       MonoClass *klass;
-       MonoReflectionGenericInst *parent;
        MonoReflectionType *generic_type;
-       MonoArray *interfaces;
-       MonoArray *methods;
-       MonoArray *ctors;
-       MonoArray *fields;
+       guint32 initialized;
 };
 
-typedef struct {
-       MonoReflectionMethod rmethod;
-       MonoReflectionMethod *declaring;
-       MonoReflectionGenericInst *declaring_type;
-       MonoReflectionGenericInst *reflected_type;
-       MonoGenericInst *ginst;
-} MonoReflectionInflatedMethod;
-
-typedef struct {
-       MonoReflectionField rfield;
-       MonoClassField *declaring;
-       MonoReflectionGenericInst *declaring_type;
-       MonoReflectionGenericInst *reflected_type;
-} MonoReflectionInflatedField;
-
 typedef struct {
        MonoObject  obj;
        MonoString *name;
@@ -497,8 +499,8 @@ typedef struct {
        guint32 attrs;
        guint32 call_conv;
        MonoReflectionModule *module;
-       gboolean skip_visibility;
-       gboolean init_locals;
+       MonoBoolean skip_visibility;
+       MonoBoolean init_locals;
        MonoReflectionILGen *ilgen;
        gint32 nrefs;
        MonoArray *refs;
@@ -536,6 +538,16 @@ typedef struct {
        MonoCustomAttrEntry attrs [MONO_ZERO_LEN_ARRAY];
 } MonoCustomAttrInfo;
 
+/* 
+ * Information which isn't in the MonoMethod structure is stored here for
+ * dynamic methods.
+ */
+typedef struct {
+       char **param_names;
+       MonoMarshalSpec **param_marshall;
+       MonoCustomAttrInfo **param_cattr;
+} MonoReflectionMethodAux;
+
 enum {
        RESOURCE_LOCATION_EMBEDDED = 1,
        RESOURCE_LOCATION_ANOTHER_ASSEMBLY = 2,
@@ -555,6 +567,7 @@ MonoType*     mono_reflection_type_from_name (char *name, MonoImage *image);
 
 void          mono_image_create_pefile (MonoReflectionModuleBuilder *module);
 void          mono_image_basic_init (MonoReflectionAssemblyBuilder *assembly);
+MonoReflectionModule * mono_image_load_module (MonoReflectionAssemblyBuilder *assembly, MonoString *file_name);
 guint32       mono_image_insert_string (MonoReflectionModuleBuilder *module, MonoString *str);
 guint32       mono_image_create_token  (MonoDynamicImage *assembly, MonoObject *obj);
 void          mono_image_module_basic_init (MonoReflectionModuleBuilder *module);
@@ -594,16 +607,17 @@ MonoReflectionType* mono_reflection_create_runtime_class  (MonoReflectionTypeBui
 
 void mono_reflection_create_dynamic_method (MonoReflectionDynamicMethod *m);
 
-MonoReflectionType *mono_reflection_define_generic_parameter (MonoReflectionTypeBuilder *tb, MonoReflectionMethodBuilder *mb, guint32 index, MonoReflectionGenericParam *gparam);
+void        mono_reflection_initialize_generic_parameter (MonoReflectionGenericParam *gparam);
 
-MonoReflectionGenericInst*
-mono_reflection_bind_generic_parameters (MonoReflectionType *type, MonoArray *types);
-MonoReflectionInflatedMethod*
+MonoType*
+mono_reflection_bind_generic_parameters (MonoReflectionType *type, int type_argc, MonoType **types);
+MonoReflectionMethod*
 mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *method, MonoArray *types);
-MonoReflectionInflatedMethod*
-mono_reflection_inflate_method_or_ctor (MonoReflectionGenericInst *declaring_type, MonoReflectionGenericInst *reflected_type, MonoObject *obj);
-MonoReflectionInflatedField*
-mono_reflection_inflate_field (MonoReflectionGenericInst *declaring_type, MonoReflectionGenericInst *reflected_type, MonoObject *obj);
+void
+mono_reflection_generic_inst_initialize (MonoReflectionGenericInst *type, MonoArray *methods, MonoArray *ctors, MonoArray *fields, MonoArray *properties, MonoArray *events);
+MonoReflectionEvent *
+mono_reflection_event_builder_get_event_info (MonoReflectionTypeBuilder *tb, MonoReflectionEventBuilder *eb);
+
 
 MonoArray  *mono_reflection_sighelper_get_signature_local (MonoReflectionSigHelper *sig);