[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/engine lib_reflect.c,1.26,1.27
From: |
Gopal.V <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/engine lib_reflect.c,1.26,1.27 |
Date: |
Tue, 07 Jan 2003 04:30:56 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv31151/engine
Modified Files:
lib_reflect.c
Log Message:
Bug 2149 for Enum.GetValues()
Index: lib_reflect.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_reflect.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** lib_reflect.c 4 Jan 2003 11:29:37 -0000 1.26
--- lib_reflect.c 7 Jan 2003 09:30:53 -0000 1.27
***************
*** 1355,1358 ****
--- 1355,1413 ----
/*
+ * Unpack a constant into the correct boxed type
+ */
+ ILObject* UnpackConstant(ILExecThread *thread,ILConstant* constant,
+ ILType *type)
+ {
+ unsigned long len;
+ ILInt32 intValue;
+ ILUInt32 uintValue;
+ ILInt64 longValue;
+ ILUInt64 ulongValue;
+ ILFloat floatValue;
+ ILDouble doubleValue;
+ const char* strValue;
+ switch(ILConstantGetElemType(constant))
+ {
+ case IL_META_ELEMTYPE_BOOLEAN:
+ case IL_META_ELEMTYPE_CHAR:
+ case IL_META_ELEMTYPE_I1:
+ case IL_META_ELEMTYPE_I2:
+ case IL_META_ELEMTYPE_I4:
+ intValue =
*((ILInt32*)(ILConstantGetValue(constant,&(len))));
+ return ILExecThreadBox(thread,type,&(intValue));
+ break;
+ case IL_META_ELEMTYPE_U1:
+ case IL_META_ELEMTYPE_U2:
+ case IL_META_ELEMTYPE_U4:
+ uintValue =
*((ILUInt32*)(ILConstantGetValue(constant,&(len))));
+ return ILExecThreadBox(thread,type,&(uintValue));
+ break;
+ case IL_META_ELEMTYPE_I8:
+ longValue =
*((ILInt64*)(ILConstantGetValue(constant,&(len))));
+ return ILExecThreadBox(thread,type,&(longValue));
+ break;
+ case IL_META_ELEMTYPE_U8:
+ ulongValue =
*((ILInt64*)(ILConstantGetValue(constant,&(len))));
+ return ILExecThreadBox(thread,type,&(ulongValue));
+ break;
+ case IL_META_ELEMTYPE_R4:
+ floatValue =
*((ILFloat*)(ILConstantGetValue(constant,&(len))));
+ return ILExecThreadBox(thread,type,&(floatValue));
+ break;
+ case IL_META_ELEMTYPE_R8:
+ doubleValue =
*((ILDouble*)(ILConstantGetValue(constant,&(len))));
+ return ILExecThreadBox(thread,type,&(doubleValue));
+ break;
+ case IL_META_ELEMTYPE_STRING:
+ strValue = (const char *)(ILConstantGetValue(constant,
&len));
+ return
(ILObject*)((System_String*)ILStringCreateLen(thread,
+
strValue,len));
+ /* TODO : implement the object unpacking ? */
+ }
+ return 0;
+ }
+
+ /*
* public override Object GetValue(Object obj);
*/
***************
*** 1363,1366 ****
--- 1418,1422 ----
ILType *type;
void *ptr;
+ ILConstant *constant;
/* Get the program item for the field reference */
***************
*** 1382,1387 ****
if(ILField_IsLiteral(field))
{
! /* TODO: unpack the constant and return it */
! return 0;
}
else if(ILField_IsStatic(field))
--- 1438,1444 ----
if(ILField_IsLiteral(field))
{
! constant=ILConstantGetFromOwner((ILProgramItem*)field);
! if(!constant)return 0;
! return UnpackConstant(thread,constant,ILField_Type(field));
}
else if(ILField_IsStatic(field))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/engine lib_reflect.c,1.26,1.27,
Gopal.V <address@hidden> <=