[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.62,1.63 int_table.
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/engine int_proto.h,1.62,1.63 int_table.c,1.64,1.65 lib_marshal.c,1.3,1.4 |
Date: |
Tue, 03 Jun 2003 23:57:46 -0400 |
Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv29512/engine
Modified Files:
int_proto.h int_table.c lib_marshal.c
Log Message:
New internalcall interface for System.Runtime.InteropServices.Marshal.
Index: int_proto.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_proto.h,v
retrieving revision 1.62
retrieving revision 1.63
diff -C2 -r1.62 -r1.63
*** int_proto.h 28 May 2003 02:14:25 -0000 1.62
--- int_proto.h 4 Jun 2003 03:57:44 -0000 1.63
***************
*** 252,258 ****
extern void _IL_Marshal_CopyUM(ILExecThread * _thread, ILNativeInt _p1,
ILObject * _p2, ILInt32 _p3, ILInt32 _p4);
extern void _IL_Marshal_FreeHGlobal(ILExecThread * _thread, ILNativeInt _p1);
! extern ILNativeInt _IL_Marshal_OffsetOf(ILExecThread * _thread, ILObject *
_p1, ILString * _p2);
! extern ILString * _IL_Marshal_PtrToStringAnsi_j(ILExecThread * _thread,
ILNativeInt _p1);
! extern ILString * _IL_Marshal_PtrToStringAnsi_ji(ILExecThread * _thread,
ILNativeInt _p1, ILInt32 _p2);
extern ILNativeInt _IL_Marshal_ObjectToPtr(ILExecThread * _thread, ILObject *
_p1);
extern ILUInt8 _IL_Marshal_ReadByte(ILExecThread * _thread, ILNativeInt _p1,
ILInt32 _p2);
--- 252,262 ----
extern void _IL_Marshal_CopyUM(ILExecThread * _thread, ILNativeInt _p1,
ILObject * _p2, ILInt32 _p3, ILInt32 _p4);
extern void _IL_Marshal_FreeHGlobal(ILExecThread * _thread, ILNativeInt _p1);
! extern ILNativeInt _IL_Marshal_OffsetOfInternal(ILExecThread * _thread,
ILObject * _p1, ILString * _p2);
! extern ILString * _IL_Marshal_PtrToStringAnsiInternal(ILExecThread * _thread,
ILNativeInt _p1, ILInt32 _p2);
! extern ILString * _IL_Marshal_PtrToStringAutoInternal(ILExecThread * _thread,
ILNativeInt _p1, ILInt32 _p2);
! extern ILString * _IL_Marshal_PtrToStringUniInternal(ILExecThread * _thread,
ILNativeInt _p1, ILInt32 _p2);
! extern ILBool _IL_Marshal_PtrToStructureInternal(ILExecThread * _thread,
ILNativeInt _p1, ILObject * _p2, ILBool _p3);
! extern ILBool _IL_Marshal_DestroyStructureInternal(ILExecThread * _thread,
ILNativeInt _p1, ILObject * _p2);
! extern ILBool _IL_Marshal_StructureToPtrInternal(ILExecThread * _thread,
ILObject * _p1, ILNativeInt _p2);
extern ILNativeInt _IL_Marshal_ObjectToPtr(ILExecThread * _thread, ILObject *
_p1);
extern ILUInt8 _IL_Marshal_ReadByte(ILExecThread * _thread, ILNativeInt _p1,
ILInt32 _p2);
***************
*** 262,267 ****
extern ILNativeInt _IL_Marshal_ReadIntPtr(ILExecThread * _thread, ILNativeInt
_p1, ILInt32 _p2);
extern ILNativeInt _IL_Marshal_ReAllocHGlobal(ILExecThread * _thread,
ILNativeInt _p1, ILNativeInt _p2);
! extern ILInt32 _IL_Marshal_SizeOf(ILExecThread * _thread, ILObject * _p1);
extern ILNativeInt _IL_Marshal_StringToHGlobalAnsi(ILExecThread * _thread,
ILString * _p1);
extern ILNativeInt _IL_Marshal_UnsafeAddrOfPinnedArrayElement(ILExecThread *
_thread, ILObject * _p1, ILInt32 _p2);
extern void _IL_Marshal_WriteByte(ILExecThread * _thread, ILNativeInt _p1,
ILInt32 _p2, ILUInt8 _p3);
--- 266,273 ----
extern ILNativeInt _IL_Marshal_ReadIntPtr(ILExecThread * _thread, ILNativeInt
_p1, ILInt32 _p2);
extern ILNativeInt _IL_Marshal_ReAllocHGlobal(ILExecThread * _thread,
ILNativeInt _p1, ILNativeInt _p2);
! extern ILInt32 _IL_Marshal_SizeOfInternal(ILExecThread * _thread, ILObject *
_p1);
extern ILNativeInt _IL_Marshal_StringToHGlobalAnsi(ILExecThread * _thread,
ILString * _p1);
+ extern ILNativeInt _IL_Marshal_StringToHGlobalAuto(ILExecThread * _thread,
ILString * _p1);
+ extern ILNativeInt _IL_Marshal_StringToHGlobalUni(ILExecThread * _thread,
ILString * _p1);
extern ILNativeInt _IL_Marshal_UnsafeAddrOfPinnedArrayElement(ILExecThread *
_thread, ILObject * _p1, ILInt32 _p2);
extern void _IL_Marshal_WriteByte(ILExecThread * _thread, ILNativeInt _p1,
ILInt32 _p2, ILUInt8 _p3);
***************
*** 270,274 ****
extern void _IL_Marshal_WriteInt64(ILExecThread * _thread, ILNativeInt _p1,
ILInt32 _p2, ILInt64 _p3);
extern void _IL_Marshal_WriteIntPtr(ILExecThread * _thread, ILNativeInt _p1,
ILInt32 _p2, ILNativeInt _p3);
- extern void _IL_Marshal_PtrToStructureInternal(ILExecThread * _thread,
ILNativeInt _p1, ILObject * _p2);
extern void _IL_RuntimeHelpers_InitializeArray(ILExecThread * _thread,
ILObject * _p1, void * _p2);
--- 276,279 ----
Index: int_table.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_table.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -r1.64 -r1.65
*** int_table.c 28 May 2003 02:14:25 -0000 1.64
--- int_table.c 4 Jun 2003 03:57:44 -0000 1.65
***************
*** 1339,1345 ****
#if !defined(HAVE_LIBFFI)
! static void marshal_ppj(void (*fn)(), void *rvalue, void **avalue)
{
! *((void * *)rvalue) = (*(void * (*)(void *, ILNativeUInt))fn)(*((void *
*)(avalue[0])), *((ILNativeUInt *)(avalue[1])));
}
--- 1339,1345 ----
#if !defined(HAVE_LIBFFI)
! static void marshal_ppji(void (*fn)(), void *rvalue, void **avalue)
{
! *((void * *)rvalue) = (*(void * (*)(void *, ILNativeUInt,
ILInt32))fn)(*((void * *)(avalue[0])), *((ILNativeUInt *)(avalue[1])),
*((ILInt32 *)(avalue[2])));
}
***************
*** 1348,1354 ****
#if !defined(HAVE_LIBFFI)
! static void marshal_ppji(void (*fn)(), void *rvalue, void **avalue)
{
! *((void * *)rvalue) = (*(void * (*)(void *, ILNativeUInt,
ILInt32))fn)(*((void * *)(avalue[0])), *((ILNativeUInt *)(avalue[1])),
*((ILInt32 *)(avalue[2])));
}
--- 1348,1372 ----
#if !defined(HAVE_LIBFFI)
! static void marshal_bpjpb(void (*fn)(), void *rvalue, void **avalue)
{
! *((ILNativeInt *)rvalue) = (*(ILInt8 (*)(void *, ILNativeUInt, void *,
ILInt8))fn)(*((void * *)(avalue[0])), *((ILNativeUInt *)(avalue[1])), *((void *
*)(avalue[2])), *((ILInt8 *)(avalue[3])));
! }
!
! #endif
!
! #if !defined(HAVE_LIBFFI)
!
! static void marshal_bpjp(void (*fn)(), void *rvalue, void **avalue)
! {
! *((ILNativeInt *)rvalue) = (*(ILInt8 (*)(void *, ILNativeUInt, void
*))fn)(*((void * *)(avalue[0])), *((ILNativeUInt *)(avalue[1])), *((void *
*)(avalue[2])));
! }
!
! #endif
!
! #if !defined(HAVE_LIBFFI)
!
! static void marshal_bppj(void (*fn)(), void *rvalue, void **avalue)
! {
! *((ILNativeInt *)rvalue) = (*(ILInt8 (*)(void *, void *,
ILNativeUInt))fn)(*((void * *)(avalue[0])), *((void * *)(avalue[1])),
*((ILNativeUInt *)(avalue[2])));
}
***************
*** 1463,1475 ****
#endif
- #if !defined(HAVE_LIBFFI)
-
- static void marshal_vpjp(void (*fn)(), void *rvalue, void **avalue)
- {
- (*(void (*)(void *, ILNativeUInt, void *))fn)(*((void * *)(avalue[0])),
*((ILNativeUInt *)(avalue[1])), *((void * *)(avalue[2])));
- }
-
- #endif
-
#ifndef _IL_Marshal_suppressed
--- 1481,1484 ----
***************
*** 1479,1485 ****
IL_METHOD("CopyUM", "(joSystem.Array;ii)V", _IL_Marshal_CopyUM,
marshal_vpjpii)
IL_METHOD("FreeHGlobal", "(j)V", _IL_Marshal_FreeHGlobal, marshal_vpj)
! IL_METHOD("OffsetOf", "(oSystem.Type;oSystem.String;)j",
_IL_Marshal_OffsetOf, marshal_jppp)
! IL_METHOD("PtrToStringAnsi", "(j)oSystem.String;",
_IL_Marshal_PtrToStringAnsi_j, marshal_ppj)
! IL_METHOD("PtrToStringAnsi", "(ji)oSystem.String;",
_IL_Marshal_PtrToStringAnsi_ji, marshal_ppji)
IL_METHOD("ObjectToPtr", "(oSystem.Object;)j", _IL_Marshal_ObjectToPtr,
marshal_jpp)
IL_METHOD("ReadByte", "(ji)B", _IL_Marshal_ReadByte, marshal_Bpji)
--- 1488,1498 ----
IL_METHOD("CopyUM", "(joSystem.Array;ii)V", _IL_Marshal_CopyUM,
marshal_vpjpii)
IL_METHOD("FreeHGlobal", "(j)V", _IL_Marshal_FreeHGlobal, marshal_vpj)
! IL_METHOD("OffsetOfInternal", "(oSystem.Type;oSystem.String;)j",
_IL_Marshal_OffsetOfInternal, marshal_jppp)
! IL_METHOD("PtrToStringAnsiInternal", "(ji)oSystem.String;",
_IL_Marshal_PtrToStringAnsiInternal, marshal_ppji)
! IL_METHOD("PtrToStringAutoInternal", "(ji)oSystem.String;",
_IL_Marshal_PtrToStringAutoInternal, marshal_ppji)
! IL_METHOD("PtrToStringUniInternal", "(ji)oSystem.String;",
_IL_Marshal_PtrToStringUniInternal, marshal_ppji)
! IL_METHOD("PtrToStructureInternal", "(joSystem.Object;Z)Z",
_IL_Marshal_PtrToStructureInternal, marshal_bpjpb)
! IL_METHOD("DestroyStructureInternal", "(joSystem.Type;)Z",
_IL_Marshal_DestroyStructureInternal, marshal_bpjp)
! IL_METHOD("StructureToPtrInternal", "(oSystem.Object;j)Z",
_IL_Marshal_StructureToPtrInternal, marshal_bppj)
IL_METHOD("ObjectToPtr", "(oSystem.Object;)j", _IL_Marshal_ObjectToPtr,
marshal_jpp)
IL_METHOD("ReadByte", "(ji)B", _IL_Marshal_ReadByte, marshal_Bpji)
***************
*** 1489,1494 ****
IL_METHOD("ReadIntPtr", "(ji)j", _IL_Marshal_ReadIntPtr, marshal_jpji)
IL_METHOD("ReAllocHGlobal", "(jj)j", _IL_Marshal_ReAllocHGlobal,
marshal_jpjj)
! IL_METHOD("SizeOf", "(oSystem.Type;)i", _IL_Marshal_SizeOf, marshal_ipp)
IL_METHOD("StringToHGlobalAnsi", "(oSystem.String;)j",
_IL_Marshal_StringToHGlobalAnsi, marshal_jpp)
IL_METHOD("UnsafeAddrOfPinnedArrayElement", "(oSystem.Array;i)j",
_IL_Marshal_UnsafeAddrOfPinnedArrayElement, marshal_jppi)
IL_METHOD("WriteByte", "(jiB)V", _IL_Marshal_WriteByte, marshal_vpjiB)
--- 1502,1509 ----
IL_METHOD("ReadIntPtr", "(ji)j", _IL_Marshal_ReadIntPtr, marshal_jpji)
IL_METHOD("ReAllocHGlobal", "(jj)j", _IL_Marshal_ReAllocHGlobal,
marshal_jpjj)
! IL_METHOD("SizeOfInternal", "(oSystem.Type;)i",
_IL_Marshal_SizeOfInternal, marshal_ipp)
IL_METHOD("StringToHGlobalAnsi", "(oSystem.String;)j",
_IL_Marshal_StringToHGlobalAnsi, marshal_jpp)
+ IL_METHOD("StringToHGlobalAuto", "(oSystem.String;)j",
_IL_Marshal_StringToHGlobalAuto, marshal_jpp)
+ IL_METHOD("StringToHGlobalUni", "(oSystem.String;)j",
_IL_Marshal_StringToHGlobalUni, marshal_jpp)
IL_METHOD("UnsafeAddrOfPinnedArrayElement", "(oSystem.Array;i)j",
_IL_Marshal_UnsafeAddrOfPinnedArrayElement, marshal_jppi)
IL_METHOD("WriteByte", "(jiB)V", _IL_Marshal_WriteByte, marshal_vpjiB)
***************
*** 1497,1501 ****
IL_METHOD("WriteInt64", "(jil)V", _IL_Marshal_WriteInt64, marshal_vpjil)
IL_METHOD("WriteIntPtr", "(jij)V", _IL_Marshal_WriteIntPtr,
marshal_vpjij)
- IL_METHOD("PtrToStructureInternal", "(joSystem.Object;)V",
_IL_Marshal_PtrToStructureInternal, marshal_vpjp)
IL_METHOD_END
--- 1512,1515 ----
***************
*** 1654,1657 ****
--- 1668,1680 ----
#if !defined(HAVE_LIBFFI)
+ static void marshal_ppj(void (*fn)(), void *rvalue, void **avalue)
+ {
+ *((void * *)rvalue) = (*(void * (*)(void *, ILNativeUInt))fn)(*((void *
*)(avalue[0])), *((ILNativeUInt *)(avalue[1])));
+ }
+
+ #endif
+
+ #if !defined(HAVE_LIBFFI)
+
static void marshal_vppppipp(void (*fn)(), void *rvalue, void **avalue)
{
***************
*** 1849,1852 ****
--- 1872,1884 ----
#if !defined(HAVE_LIBFFI)
+ static void marshal_vpjp(void (*fn)(), void *rvalue, void **avalue)
+ {
+ (*(void (*)(void *, ILNativeUInt, void *))fn)(*((void * *)(avalue[0])),
*((ILNativeUInt *)(avalue[1])), *((void * *)(avalue[2])));
+ }
+
+ #endif
+
+ #if !defined(HAVE_LIBFFI)
+
static void marshal_ipjj(void (*fn)(), void *rvalue, void **avalue)
{
***************
*** 2400,2412 ****
#if !defined(HAVE_LIBFFI)
- static void marshal_bppj(void (*fn)(), void *rvalue, void **avalue)
- {
- *((ILNativeInt *)rvalue) = (*(ILInt8 (*)(void *, void *,
ILNativeUInt))fn)(*((void * *)(avalue[0])), *((void * *)(avalue[1])),
*((ILNativeUInt *)(avalue[2])));
- }
-
- #endif
-
- #if !defined(HAVE_LIBFFI)
-
static void marshal_bpppiii(void (*fn)(), void *rvalue, void **avalue)
{
--- 2432,2435 ----
***************
*** 2598,2610 ****
{
*((ILNativeInt *)rvalue) = (*(ILInt8 (*)(void *, ILInt32, ILInt32,
ILInt32, void *))fn)(*((void * *)(avalue[0])), *((ILInt32 *)(avalue[1])),
*((ILInt32 *)(avalue[2])), *((ILInt32 *)(avalue[3])), *((void * *)(avalue[4])));
- }
-
- #endif
-
- #if !defined(HAVE_LIBFFI)
-
- static void marshal_bpjp(void (*fn)(), void *rvalue, void **avalue)
- {
- *((ILNativeInt *)rvalue) = (*(ILInt8 (*)(void *, ILNativeUInt, void
*))fn)(*((void * *)(avalue[0])), *((ILNativeUInt *)(avalue[1])), *((void *
*)(avalue[2])));
}
--- 2621,2624 ----
Index: lib_marshal.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_marshal.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** lib_marshal.c 5 Dec 2002 18:49:38 -0000 1.3
--- lib_marshal.c 4 Jun 2003 03:57:44 -0000 1.4
***************
*** 109,116 ****
/*
! * public static IntPtr OffsetOf(Type t, String fieldName);
*/
! ILNativeInt _IL_Marshal_OffsetOf(ILExecThread *_thread, ILObject *t,
! ILString
*fieldName)
{
char *name;
--- 109,116 ----
/*
! * private static IntPtr OffsetOfInternal(Type t, String fieldName);
*/
! ILNativeInt _IL_Marshal_OffsetOfInternal(ILExecThread *_thread, ILObject *t,
!
ILString *fieldName)
{
char *name;
***************
*** 125,129 ****
if(!classInfo)
{
! return 0;
}
--- 125,129 ----
if(!classInfo)
{
! return -1;
}
***************
*** 132,136 ****
if(!name)
{
! return 0;
}
--- 132,136 ----
if(!name)
{
! return -1;
}
***************
*** 140,144 ****
{
IL_METADATA_UNLOCK(_thread);
! return 0;
}
--- 140,144 ----
{
IL_METADATA_UNLOCK(_thread);
! return -1;
}
***************
*** 163,173 ****
IL_METADATA_UNLOCK(_thread);
}
! return 0;
}
/*
! * public static String PtrToStringAnsi(IntPtr ptr);
*/
! ILString *_IL_Marshal_PtrToStringAnsi_j(ILExecThread *_thread, ILNativeInt
ptr)
{
if(UnmanagedOK(_thread))
--- 163,174 ----
IL_METADATA_UNLOCK(_thread);
}
! return -1;
}
/*
! * private static String PtrToStringAnsiInternal(IntPtr ptr, int len);
*/
! ILString *_IL_Marshal_PtrToStringAnsiInternal(ILExecThread *_thread,
!
ILNativeInt ptr, ILInt32 len)
{
if(UnmanagedOK(_thread))
***************
*** 175,181 ****
if(ptr)
{
! return ILStringCreate(_thread, (const char *)ptr);
}
- ILExecThreadThrowArgNull(_thread, "ptr");
}
return 0;
--- 176,188 ----
if(ptr)
{
! if(len < 0)
! {
! return ILStringCreate(_thread, (const char
*)ptr);
! }
! else
! {
! return ILStringCreateLen(_thread, (const char
*)ptr, len);
! }
}
}
return 0;
***************
*** 183,190 ****
/*
! * public static String PtrToStringAnsi(IntPtr ptr, int len);
*/
! ILString *_IL_Marshal_PtrToStringAnsi_ji(ILExecThread *_thread,
!
ILNativeInt ptr, ILInt32 len)
{
if(UnmanagedOK(_thread))
--- 190,197 ----
/*
! * private static String PtrToStringAutoInternal(IntPtr ptr, int len);
*/
! ILString *_IL_Marshal_PtrToStringAutoInternal(ILExecThread *_thread,
!
ILNativeInt ptr, ILInt32 len)
{
if(UnmanagedOK(_thread))
***************
*** 192,208 ****
if(ptr)
{
! if(len >= 0)
{
! return ILStringCreateLen(_thread, (const char
*)ptr, len);
}
else
{
! ILExecThreadThrowSystem
! (_thread, "System.ArgumentException",
0);
}
}
! else
{
! ILExecThreadThrowArgNull(_thread, "ptr");
}
}
--- 199,233 ----
if(ptr)
{
! if(len < 0)
{
! return ILStringCreateUTF8(_thread, (const char
*)ptr);
}
else
{
! return ILStringCreateUTF8Len(_thread, (const
char *)ptr, len);
}
}
! }
! return 0;
! }
!
! /*
! * private static String PtrToStringUniInternal(IntPtr ptr, int len);
! */
! ILString *_IL_Marshal_PtrToStringUniInternal(ILExecThread *_thread,
!
ILNativeInt ptr, ILInt32 len)
! {
! if(UnmanagedOK(_thread))
! {
! if(ptr)
{
! if(len < 0)
! {
! return ILStringWCreate(_thread, (const ILUInt16
*)ptr);
! }
! else
! {
! return ILStringWCreateLen(_thread, (const
ILUInt16 *)ptr, len);
! }
}
}
***************
*** 317,323 ****
/*
! * public static int SizeOf(Type t);
*/
! ILInt32 _IL_Marshal_SizeOf(ILExecThread * _thread, ILObject *t)
{
ILClass *classInfo;
--- 342,348 ----
/*
! * private static int SizeOfInternal(Type t);
*/
! ILInt32 _IL_Marshal_SizeOfInternal(ILExecThread * _thread, ILObject *t)
{
ILClass *classInfo;
***************
*** 333,336 ****
--- 358,362 ----
/* Get the size of the type and return it */
+ /* TODO: this should return the native size, not the managed
size */
return (ILInt32)(ILSizeOfType
(_thread,
ILType_FromValueType(classInfo)));
***************
*** 370,373 ****
--- 396,478 ----
/*
+ * public static IntPtr StringToHGlobalAuto(String s);
+ */
+ ILNativeInt _IL_Marshal_StringToHGlobalAuto(ILExecThread *_thread, ILString
*s)
+ {
+ ILUInt16 *buffer;
+ ILInt32 length;
+ ILInt32 utf8Len;
+ char *newStr;
+ char *temp;
+ int posn;
+
+ /* Bail out immediately if the string is NULL */
+ if(!UnmanagedOK(_thread) || !s)
+ {
+ return 0;
+ }
+
+ /* Determine the length of the string in UTF-8 characters */
+ buffer = StringToBuffer(s);
+ length = ((System_String *)s)->length;
+ posn = 0;
+ utf8Len = 0;
+ while(posn < (int)length)
+ {
+ utf8Len += ILUTF8WriteChar
+ (0, ILUTF16ReadChar(buffer, (int)length, &posn));
+ }
+
+ /* Allocate space within the garbage-collected heap */
+ newStr = (char *)malloc(utf8Len + 1);
+ if(!newStr)
+ {
+ ILExecThreadThrowOutOfMemory(_thread);
+ return 0;
+ }
+
+ /* Copy the characters into the allocated buffer */
+ temp = newStr;
+ posn = 0;
+ while(posn < (int)length)
+ {
+ temp += ILUTF8WriteChar
+ (temp, ILUTF16ReadChar(buffer, (int)length, &posn));
+ }
+ *temp = '\0';
+
+ /* Done */
+ return (ILNativeInt)newStr;
+ }
+
+ /*
+ * public static IntPtr StringToHGlobalUni(String s);
+ */
+ ILNativeInt _IL_Marshal_StringToHGlobalUni(ILExecThread *_thread, ILString *s)
+ {
+ if(UnmanagedOK(_thread) && s)
+ {
+ ILUInt16 *buf = StringToBuffer(s);
+ ILInt32 len = ((System_String *)s)->length;
+ ILUInt16 *newStr = (ILUInt16 *)malloc((len + 1) *
sizeof(ILUInt16));
+ if(!newStr)
+ {
+ ILExecThreadThrowOutOfMemory(_thread);
+ return 0;
+ }
+ if(len > 0)
+ {
+ ILMemCpy(newStr, buf, len * sizeof(ILUInt16));
+ }
+ newStr[len] = (ILUInt16)0;
+ return (ILNativeInt)newStr;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ /*
* public static IntPtr UnsafeAddrOfPinnedArrayElement(Array arr, int index);
*/
***************
*** 459,468 ****
}
! /*
! * public static void PtrToStructureInternal(IntPtr ptr, Object structure);
! */
! void _IL_Marshal_PtrToStructureInternal(ILExecThread * _thread,
! ILNativeInt ptr,ILObject * structure)
{
ILClass *classInfo;
ILInt32 size;
--- 564,573 ----
}
! ILBool _IL_Marshal_PtrToStructureInternal(ILExecThread *_thread,
!
ILNativeInt ptr,
!
ILObject *structure,
!
ILBool allowValueTypes)
{
+ /* TODO: this isn't correct */
ILClass *classInfo;
ILInt32 size;
***************
*** 473,489 ****
if(!classInfo)
{
! return;
}
/* Get the size of the type */
! size=(ILInt32)(ILSizeOfType
! (_thread,
ILType_FromValueType(classInfo)));
ILMemCpy(structure,(void*)ptr,size);
! return;
! }
! else if(!ptr)
! {
! ILExecThreadThrowArgNull(_thread, "ptr");
}
}
--- 578,607 ----
if(!classInfo)
{
! return 0;
}
/* Get the size of the type */
! size = (ILInt32)(ILSizeOfType
! (_thread, ILType_FromValueType(classInfo)));
ILMemCpy(structure,(void*)ptr,size);
! return 1;
}
+ return 0;
+ }
+
+ ILBool _IL_Marshal_DestroyStructureInternal(ILExecThread *_thread,
+
ILNativeInt ptr,
+
ILObject *structureType)
+ {
+ /* TODO */
+ return 0;
+ }
+
+ ILBool _IL_Marshal_StructureToPtrInternal(ILExecThread *_thread,
+
ILObject *structure,
+
ILNativeInt ptr)
+ {
+ /* TODO */
+ return 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/engine int_proto.h,1.62,1.63 int_table.c,1.64,1.65 lib_marshal.c,1.3,1.4,
Rhys Weatherley <address@hidden> <=