[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/engine int_proto.h, 1.78, 1.79 int_table
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/engine int_proto.h, 1.78, 1.79 int_table.c, 1.81, 1.82 lib_reflect.c, 1.49, 1.50 |
Date: |
Fri, 22 Aug 2003 21:47:30 -0400 |
Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv12830/engine
Modified Files:
int_proto.h int_table.c lib_reflect.c
Log Message:
New internalcalls for "Assembly"; implement "Module" internalcalls.
Index: int_proto.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_proto.h,v
retrieving revision 1.78
retrieving revision 1.79
diff -C2 -r1.78 -r1.79
*** int_proto.h 20 Aug 2003 11:02:12 -0000 1.78
--- int_proto.h 23 Aug 2003 01:47:27 -0000 1.79
***************
*** 295,298 ****
--- 295,299 ----
extern ILObject * _IL_Assembly_LoadFromFile(ILExecThread * _thread, ILString
* _p1, ILInt32 * error, ILObject * _p3);
extern ILString * _IL_Assembly_GetFullName(ILExecThread * _thread, ILObject *
_this);
+ extern ILObject * _IL_Assembly_GetModuleInternal(ILExecThread * _thread,
ILObject * _this, ILString * _p1);
extern ILObject * _IL_Assembly_GetEntryAssembly(ILExecThread * _thread);
extern System_Array * _IL_Assembly_GetExportedTypes(ILExecThread * _thread,
ILObject * _this);
***************
*** 307,310 ****
--- 308,313 ----
extern void _IL_Assembly_GetEntryPoint(ILExecThread * _thread, void *
_result, ILObject * _this);
extern ILString * _IL_Assembly_GetImageRuntimeVersion(ILExecThread * _thread,
ILObject * _this);
+ extern System_Array * _IL_Assembly_GetModules(ILExecThread * _thread,
ILObject * _this, ILBool _p1);
+ extern System_Array *
_IL_Assembly_GetReferencedAssembliesInternal(ILExecThread * _thread, ILObject *
_this);
extern ILObject * _IL_MethodBase_GetMethodFromHandle(ILExecThread * _thread,
void * _p1);
Index: int_table.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_table.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -C2 -r1.81 -r1.82
*** int_table.c 20 Aug 2003 11:02:13 -0000 1.81
--- int_table.c 23 Aug 2003 01:47:27 -0000 1.82
***************
*** 1567,1570 ****
--- 1567,1571 ----
IL_METHOD("LoadFromFile",
"(oSystem.String;&ioSystem.Reflection.Assembly;)oSystem.Reflection.Assembly;",
_IL_Assembly_LoadFromFile, marshal_ppppp)
IL_METHOD("GetFullName", "(T)oSystem.String;",
_IL_Assembly_GetFullName, marshal_ppp)
+ IL_METHOD("GetModuleInternal",
"(ToSystem.String;)oSystem.Reflection.Module;", _IL_Assembly_GetModuleInternal,
marshal_pppp)
IL_METHOD("GetEntryAssembly", "()oSystem.Reflection.Assembly;",
_IL_Assembly_GetEntryAssembly, marshal_pp)
IL_METHOD("GetExportedTypes", "(T)[oSystem.Type;",
_IL_Assembly_GetExportedTypes, marshal_ppp)
***************
*** 1579,1582 ****
--- 1580,1585 ----
IL_METHOD("GetEntryPoint", "(T)vSystem.RuntimeMethodHandle;",
_IL_Assembly_GetEntryPoint, marshal_vppp)
IL_METHOD("GetImageRuntimeVersion", "(T)oSystem.String;",
_IL_Assembly_GetImageRuntimeVersion, marshal_ppp)
+ IL_METHOD("GetModules", "(TZ)[oSystem.Reflection.Module;",
_IL_Assembly_GetModules, marshal_pppb)
+ IL_METHOD("GetReferencedAssembliesInternal",
"(T)[oSystem.Reflection.Assembly;",
_IL_Assembly_GetReferencedAssembliesInternal, marshal_ppp)
IL_METHOD_END
Index: lib_reflect.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_reflect.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -r1.49 -r1.50
*** lib_reflect.c 20 Aug 2003 11:02:13 -0000 1.49
--- lib_reflect.c 23 Aug 2003 01:47:27 -0000 1.50
***************
*** 1881,1884 ****
--- 1881,2040 ----
}
+ ILObject *_IL_Assembly_GetModuleInternal(ILExecThread *_thread,
+
ILObject *_this, ILString *name)
+ {
+ char *nameutf = ILStringToUTF8(_thread, name);
+ ILProgramItem *item = (ILProgramItem *)_ILClrFromObject(_thread, _this);
+ ILImage *image = ((item != 0) ? ILProgramItem_Image(item) : 0);
+ ILModule *module;
+ ILFileDecl *file;
+ if(nameutf && image)
+ {
+ /* Search the module table for the name */
+ module = 0;
+ while((module = (ILModule *)ILImageNextToken
+ (image, IL_META_TOKEN_MODULE, module)) != 0)
+ {
+ if(!ILStrICmp(ILModule_Name(module), nameutf))
+ {
+ return _ILClrToObject
+ (_thread, module,
"System.Reflection.Module");
+ }
+ }
+
+ /* Search the file table for the name */
+ file = 0;
+ while((file = (ILFileDecl *)ILImageNextToken
+ (image, IL_META_TOKEN_FILE, file)) != 0)
+ {
+ if(!ILStrICmp(ILFileDecl_Name(file), nameutf))
+ {
+ return _ILClrToObject
+ (_thread, file,
"System.Reflection.Module");
+ }
+ }
+ }
+ return 0;
+ }
+
+ System_Array *_IL_Assembly_GetModules(ILExecThread *_thread,
+
ILObject *_this,
+
ILBool getResourceModules)
+ {
+ ILProgramItem *item = (ILProgramItem *)_ILClrFromObject(_thread, _this);
+ ILImage *image = ((item != 0) ? ILProgramItem_Image(item) : 0);
+ unsigned long size;
+ ILModule *module;
+ ILFileDecl *file;
+ System_Array *array;
+ ILObject **buf;
+ if(image)
+ {
+ /* Count the number of relevant program items */
+ size = ILImageNumTokens(image, IL_META_TOKEN_MODULE);
+ file = 0;
+ while((file = (ILFileDecl *)ILImageNextToken
+ (image, IL_META_TOKEN_FILE, file)) != 0)
+ {
+ if(getResourceModules || ILFileDecl_HasMetaData(file))
+ {
+ ++size;
+ }
+ }
+
+ /* Allocate the module array */
+ array = (System_Array *)ILExecThreadNew
+ (_thread, "[oSystem.Reflection.Module;", "(Ti)V",
(ILVaInt)size);
+ if(!array)
+ {
+ return 0;
+ }
+ buf = (ILObject **)(ArrayToBuffer(array));
+
+ /* Fill the module array */
+ size = 0;
+ module = 0;
+ while((module = (ILModule *)ILImageNextToken
+ (image, IL_META_TOKEN_MODULE, module)) != 0)
+ {
+ buf[size] = _ILClrToObject
+ (_thread, module, "System.Reflection.Module");
+ if(!(buf[size]))
+ {
+ return 0;
+ }
+ ++size;
+ }
+ file = 0;
+ while((file = (ILFileDecl *)ILImageNextToken
+ (image, IL_META_TOKEN_FILE, file)) != 0)
+ {
+ if(getResourceModules || ILFileDecl_HasMetaData(file))
+ {
+ buf[size] = _ILClrToObject
+ (_thread, file,
"System.Reflection.Module");
+ if(!(buf[size]))
+ {
+ return 0;
+ }
+ ++size;
+ }
+ }
+
+ /* Return the array to the caller */
+ return array;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ System_Array *_IL_Assembly_GetReferencedAssembliesInternal
+ (ILExecThread *_thread, ILObject *_this)
+ {
+ ILProgramItem *item = (ILProgramItem *)_ILClrFromObject(_thread, _this);
+ ILImage *image = ((item != 0) ? ILProgramItem_Image(item) : 0);
+ unsigned long size;
+ ILAssembly *assem;
+ System_Array *array;
+ ILObject **buf;
+ if(image)
+ {
+ /* Get the number of assembly references */
+ size = ILImageNumTokens(image, IL_META_TOKEN_ASSEMBLY_REF);
+
+ /* Allocate the assembly array */
+ array = (System_Array *)ILExecThreadNew
+ (_thread, "[oSystem.Reflection.Assembly;", "(Ti)V",
(ILVaInt)size);
+ if(!array)
+ {
+ return 0;
+ }
+ buf = (ILObject **)(ArrayToBuffer(array));
+
+ /* Fill the assembly */
+ size = 0;
+ assem = 0;
+ while((assem = (ILAssembly *)ILImageNextToken
+ (image, IL_META_TOKEN_ASSEMBLY_REF, assem)) !=
0)
+ {
+ buf[size] = ImageToAssembly(_thread,
ILAssemblyToImage(assem));
+ if(!(buf[size]))
+ {
+ return 0;
+ }
+ ++size;
+ }
+
+ /* Return the array to the caller */
+ return array;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
#ifdef IL_CONFIG_REFLECTION
***************
*** 2789,2793 ****
ILBool ignoreCase)
{
! /* TODO */
return 0;
}
--- 2945,2960 ----
ILBool ignoreCase)
{
! ILProgramItem *item = (ILProgramItem *)_ILClrFromObject(_thread, _this);
! ILModule *module;
! ILFileDecl *file;
! if((module = ILProgramItemToModule(item)) != 0)
! {
! return _ILGetTypeFromImage(_thread, ILProgramItem_Image(module),
! name,
throwOnError, ignoreCase);
! }
! else if((file = ILProgramItemToFileDecl(item)) != 0)
! {
! /* TODO: metadata-based file modules */
! }
return 0;
}
***************
*** 2807,2812 ****
ILBool _IL_Module_IsResource(ILExecThread *_thread, ILObject *_this)
{
! /* TODO */
! return 0;
}
--- 2974,2987 ----
ILBool _IL_Module_IsResource(ILExecThread *_thread, ILObject *_this)
{
! ILProgramItem *item = (ILProgramItem *)_ILClrFromObject(_thread, _this);
! ILFileDecl *file = ILProgramItemToFileDecl(item);
! if(file != 0)
! {
! return !ILFileDecl_HasMetaData(file);
! }
! else
! {
! return 0;
! }
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/engine int_proto.h, 1.78, 1.79 int_table.c, 1.81, 1.82 lib_reflect.c, 1.49, 1.50,
Rhys Weatherley <address@hidden> <=