dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] pnet/engine int_proto.h, 1.92, 1.93 int_table.c, 1


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] pnet/engine int_proto.h, 1.92, 1.93 int_table.c, 1.95, 1.96 lib_file.c, 1.11, 1.12
Date: Tue, 02 Dec 2003 02:16:37 +0000

Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv27830/engine

Modified Files:
        int_proto.h int_table.c lib_file.c 
Log Message:


Add internalcalls to "FileMethods" to support symbolic links.


Index: lib_file.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_file.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** lib_file.c  19 Aug 2003 05:09:14 -0000      1.11
--- lib_file.c  2 Dec 2003 02:16:35 -0000       1.12
***************
*** 26,29 ****
--- 26,39 ----
  #include "il_sysio.h"
  #include "il_errno.h"
+ #if HAVE_SYS_TYPES_H
+       #include <sys/types.h>
+ #endif
+ #if HAVE_SYS_STAT_H
+       #include <sys/stat.h>
+ #endif
+ #if HAVE_UNISTD_H
+       #include <unistd.h>
+ #endif
+ #include <errno.h>
  
  char *ILStringToPathname(ILExecThread *thread, ILString *str)
***************
*** 329,331 ****
--- 339,404 ----
        /* TODO */
        return IL_ERRNO_EPERM;
+ }
+ 
+ /*
+  * public static Errno ReadLink(String path, out String contents);
+  */
+ ILInt32 _IL_FileMethods_ReadLink(ILExecThread *_thread, ILString *path,
+                                                                ILString 
**contents)
+ {
+ #ifdef HAVE_READLINK
+       char *pathAnsi = ILStringToPathname(_thread, path);
+       char buf[1024];
+       int len;
+       if(!pathAnsi)
+       {
+               return IL_ERRNO_ENOMEM;
+       }
+       len = readlink(pathAnsi, buf, sizeof(buf) - 1);
+       if(len >= 0)
+       {
+               buf[len] = '\0';
+               *contents = ILStringCreate(_thread, buf);
+               return IL_ERRNO_Success;
+       }
+       else if(errno == EINVAL)
+       {
+               *contents = 0;
+               return IL_ERRNO_Success;
+       }
+       else
+       {
+               *contents = 0;
+               return ILSysIOGetErrno();
+       }
+ #else
+       *contents = 0;
+       return IL_ERRNO_Success;
+ #endif
+ }
+ 
+ /*
+  * public static Errno CreateLink(String oldpath, String newpath);
+  */
+ ILInt32 _IL_FileMethods_CreateLink(ILExecThread *_thread, ILString *oldpath,
+                                                                  ILString 
*newpath)
+ {
+ #ifdef HAVE_SYMLINK
+       char *path1 = ILStringToPathname(_thread, oldpath);
+       char *path2 = ILStringToPathname(_thread, newpath);
+       if(!path1 || !path2)
+       {
+               return IL_ERRNO_ENOMEM;
+       }
+       if(symlink(path1, path2) >= 0)
+       {
+               return IL_ERRNO_Success;
+       }
+       else
+       {
+               return ILSysIOGetErrno();
+       }
+ #else
+       return IL_ERRNO_EPERM;
+ #endif
  }

Index: int_proto.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_proto.h,v
retrieving revision 1.92
retrieving revision 1.93
diff -C2 -d -r1.92 -r1.93
*** int_proto.h 20 Nov 2003 05:51:30 -0000      1.92
--- int_proto.h 2 Dec 2003 02:16:34 -0000       1.93
***************
*** 298,301 ****
--- 298,302 ----
  extern ILObject * _IL_Assembly_GetExecutingAssembly(ILExecThread * _thread);
  extern ILObject * _IL_Assembly_GetType(ILExecThread * _thread, ILObject * 
_this, ILString * typeName, ILBool throwOnError, ILBool ignoreCase);
+ extern ILObject * _IL_Assembly_GetEntryAssembly(ILExecThread * _thread);
  extern ILObject * _IL_Assembly_GetCallingAssembly(ILExecThread * _thread);
  extern ILObject * _IL_Assembly_LoadFromBytes(ILExecThread * _thread, 
System_Array * bytes, ILInt32 * error, ILObject * parent);
***************
*** 304,310 ****
  extern ILObject * _IL_Assembly_LoadFromFile(ILExecThread * _thread, ILString 
* name, ILInt32 * error, ILObject * parent);
  extern System_Array * _IL_Assembly_GetTypes(ILExecThread * _thread, ILObject 
* _this);
  extern ILString * _IL_Assembly_GetFullName(ILExecThread * _thread, ILObject * 
_this);
  extern ILObject * _IL_Assembly_GetModuleInternal(ILExecThread * _thread, 
ILObject * _this, ILString * name);
- extern ILObject * _IL_Assembly_GetEntryAssembly(ILExecThread * _thread);
  extern System_Array * _IL_Assembly_GetExportedTypes(ILExecThread * _thread, 
ILObject * _this);
  extern ILObject * _IL_Assembly_GetFile(ILExecThread * _thread, ILObject * 
_this, ILString * name);
--- 305,311 ----
  extern ILObject * _IL_Assembly_LoadFromFile(ILExecThread * _thread, ILString 
* name, ILInt32 * error, ILObject * parent);
  extern System_Array * _IL_Assembly_GetTypes(ILExecThread * _thread, ILObject 
* _this);
+ extern ILString * _IL_Assembly_GetLocation(ILExecThread * _thread, ILObject * 
_this);
  extern ILString * _IL_Assembly_GetFullName(ILExecThread * _thread, ILObject * 
_this);
  extern ILObject * _IL_Assembly_GetModuleInternal(ILExecThread * _thread, 
ILObject * _this, ILString * name);
  extern System_Array * _IL_Assembly_GetExportedTypes(ILExecThread * _thread, 
ILObject * _this);
  extern ILObject * _IL_Assembly_GetFile(ILExecThread * _thread, ILObject * 
_this, ILString * name);
***************
*** 313,317 ****
  extern System_Array * _IL_Assembly_GetManifestResourceNames(ILExecThread * 
_thread, ILObject * _this);
  extern ILObject * _IL_Assembly_LoadFromName(ILExecThread * _thread, ILString 
* name, ILInt32 * error, ILObject * parent);
- extern ILString * _IL_Assembly_GetLocation(ILExecThread * _thread, ILObject * 
_this);
  extern void _IL_Assembly_FillAssemblyName(ILExecThread * _thread, ILObject * 
_this, ILObject * nameInfo);
  extern void _IL_Assembly_GetEntryPoint(ILExecThread * _thread, void * 
_result, ILObject * _this);
--- 314,317 ----
***************
*** 560,563 ****
--- 560,565 ----
  extern ILInt32 _IL_FileMethods_SetAttributes(ILExecThread * _thread, ILString 
* path, ILInt32 attrs);
  extern ILInt32 _IL_FileMethods_GetLength(ILExecThread * _thread, ILString * 
path, ILInt64 * length);
+ extern ILInt32 _IL_FileMethods_ReadLink(ILExecThread * _thread, ILString * 
path, ILString * * contents);
+ extern ILInt32 _IL_FileMethods_CreateLink(ILExecThread * _thread, ILString * 
oldpath, ILString * newpath);
  extern ILBool _IL_FileMethods_HasAsync(ILExecThread * _thread);
  extern ILBool _IL_FileMethods_CheckHandleAccess(ILExecThread * _thread, 
ILNativeInt handle, ILInt32 access);
***************
*** 576,585 ****
  extern ILString * _IL_InfoMethods_GetGlobalConfigDir(ILExecThread * _thread);
  
- extern ILNativeInt _IL_RegexpMethods_CompileWithSyntaxInternal(ILExecThread * 
_thread, ILString * pattern, ILInt32 syntax);
- extern void _IL_RegexpMethods_FreeInternal(ILExecThread * _thread, 
ILNativeInt compiled);
- extern ILInt32 _IL_RegexpMethods_ExecInternal(ILExecThread * _thread, 
ILNativeInt compiled, ILString * input, ILInt32 flags);
- extern ILObject * _IL_RegexpMethods_MatchInternal(ILExecThread * _thread, 
ILNativeInt compiled, ILString * input, ILInt32 maxMatches, ILInt32 flags, 
ILObject * elemType);
- extern ILNativeInt _IL_RegexpMethods_CompileInternal(ILExecThread * _thread, 
ILString * pattern, ILInt32 flags);
- 
  extern ILBool _IL_CryptoMethods_IsSemiWeakKey(ILExecThread * _thread, 
System_Array * key, ILInt32 offset);
  extern ILBool _IL_CryptoMethods_IsWeakKey(ILExecThread * _thread, 
System_Array * key, ILInt32 offset);
--- 578,581 ----
***************
*** 607,610 ****
--- 603,612 ----
  extern void _IL_CryptoMethods_Encrypt(ILExecThread * _thread, ILNativeInt 
state, System_Array * inBuffer, ILInt32 inOffset, System_Array * outBuffer, 
ILInt32 outOffset);
  extern void _IL_CryptoMethods_StoreKey(ILExecThread * _thread, ILInt32 
algorithm, ILString * name, System_Array * key);
+ 
+ extern ILNativeInt _IL_RegexpMethods_CompileWithSyntaxInternal(ILExecThread * 
_thread, ILString * pattern, ILInt32 syntax);
+ extern void _IL_RegexpMethods_FreeInternal(ILExecThread * _thread, 
ILNativeInt compiled);
+ extern ILInt32 _IL_RegexpMethods_ExecInternal(ILExecThread * _thread, 
ILNativeInt compiled, ILString * input, ILInt32 flags);
+ extern ILObject * _IL_RegexpMethods_MatchInternal(ILExecThread * _thread, 
ILNativeInt compiled, ILString * input, ILInt32 maxMatches, ILInt32 flags, 
ILObject * elemType);
+ extern ILNativeInt _IL_RegexpMethods_CompileInternal(ILExecThread * _thread, 
ILString * pattern, ILInt32 flags);
  
  extern ILInt32 _IL_Process_GetHandleCount(ILExecThread * _thread, ILNativeInt 
processHandle);

Index: int_table.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_table.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -C2 -d -r1.95 -r1.96
*** int_table.c 20 Nov 2003 05:51:30 -0000      1.95
--- int_table.c 2 Dec 2003 02:16:34 -0000       1.96
***************
*** 1582,1585 ****
--- 1582,1586 ----
        IL_METHOD("GetExecutingAssembly", "()oSystem.Reflection.Assembly;", 
_IL_Assembly_GetExecutingAssembly, marshal_pp)
        IL_METHOD("GetType", "(ToSystem.String;ZZ)oSystem.Type;", 
_IL_Assembly_GetType, marshal_ppppbb)
+       IL_METHOD("GetEntryAssembly", "()oSystem.Reflection.Assembly;", 
_IL_Assembly_GetEntryAssembly, marshal_pp)
        IL_METHOD("GetCallingAssembly", "()oSystem.Reflection.Assembly;", 
_IL_Assembly_GetCallingAssembly, marshal_pp)
        IL_METHOD("LoadFromBytes", 
"([B&ioSystem.Reflection.Assembly;)oSystem.Reflection.Assembly;", 
_IL_Assembly_LoadFromBytes, marshal_ppppp)
***************
*** 1588,1594 ****
        IL_METHOD("LoadFromFile", 
"(oSystem.String;&ioSystem.Reflection.Assembly;)oSystem.Reflection.Assembly;", 
_IL_Assembly_LoadFromFile, marshal_ppppp)
        IL_METHOD("GetTypes", "(T)[oSystem.Type;", _IL_Assembly_GetTypes, 
marshal_ppp)
        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)
        IL_METHOD("GetFile", "(ToSystem.String;)oSystem.IO.FileStream;", 
_IL_Assembly_GetFile, marshal_pppp)
--- 1589,1595 ----
        IL_METHOD("LoadFromFile", 
"(oSystem.String;&ioSystem.Reflection.Assembly;)oSystem.Reflection.Assembly;", 
_IL_Assembly_LoadFromFile, marshal_ppppp)
        IL_METHOD("GetTypes", "(T)[oSystem.Type;", _IL_Assembly_GetTypes, 
marshal_ppp)
+       IL_METHOD("GetLocation", "(T)oSystem.String;", 
_IL_Assembly_GetLocation, marshal_ppp)
        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("GetExportedTypes", "(T)[oSystem.Type;", 
_IL_Assembly_GetExportedTypes, marshal_ppp)
        IL_METHOD("GetFile", "(ToSystem.String;)oSystem.IO.FileStream;", 
_IL_Assembly_GetFile, marshal_pppp)
***************
*** 1597,1601 ****
        IL_METHOD("GetManifestResourceNames", "(T)[oSystem.String;", 
_IL_Assembly_GetManifestResourceNames, marshal_ppp)
        IL_METHOD("LoadFromName", 
"(oSystem.String;&ioSystem.Reflection.Assembly;)oSystem.Reflection.Assembly;", 
_IL_Assembly_LoadFromName, marshal_ppppp)
-       IL_METHOD("GetLocation", "(T)oSystem.String;", 
_IL_Assembly_GetLocation, marshal_ppp)
        IL_METHOD("FillAssemblyName", "(ToSystem.Reflection.AssemblyName;)V", 
_IL_Assembly_FillAssemblyName, marshal_vppp)
        IL_METHOD("GetEntryPoint", "(T)vSystem.RuntimeMethodHandle;", 
_IL_Assembly_GetEntryPoint, marshal_vppp)
--- 1598,1601 ----
***************
*** 2552,2555 ****
--- 2552,2557 ----
        IL_METHOD("SetAttributes", "(oSystem.String;i)vPlatform.Errno;", 
_IL_FileMethods_SetAttributes, marshal_ippi)
        IL_METHOD("GetLength", "(oSystem.String;&l)vPlatform.Errno;", 
_IL_FileMethods_GetLength, marshal_ippp)
+       IL_METHOD("ReadLink", 
"(oSystem.String;&oSystem.String;)vPlatform.Errno;", _IL_FileMethods_ReadLink, 
marshal_ippp)
+       IL_METHOD("CreateLink", 
"(oSystem.String;oSystem.String;)vPlatform.Errno;", _IL_FileMethods_CreateLink, 
marshal_ippp)
        IL_METHOD("HasAsync", "()Z", _IL_FileMethods_HasAsync, marshal_bp)
        IL_METHOD("CheckHandleAccess", "(jvSystem.IO.FileAccess;)Z", 
_IL_FileMethods_CheckHandleAccess, marshal_bpji)
***************
*** 2579,2612 ****
  #if !defined(HAVE_LIBFFI)
  
- static void marshal_ipjpi(void (*fn)(), void *rvalue, void **avalue)
- {
-       *((ILNativeInt *)rvalue) = (*(ILInt32 (*)(void *, ILNativeUInt, void *, 
ILInt32))fn)(*((void * *)(avalue[0])), *((ILNativeUInt *)(avalue[1])), *((void 
* *)(avalue[2])), *((ILInt32 *)(avalue[3])));
- }
- 
- #endif
- 
- #if !defined(HAVE_LIBFFI)
- 
- static void marshal_ppjpiip(void (*fn)(), void *rvalue, void **avalue)
- {
-       *((void * *)rvalue) = (*(void * (*)(void *, ILNativeUInt, void *, 
ILInt32, ILInt32, void *))fn)(*((void * *)(avalue[0])), *((ILNativeUInt 
*)(avalue[1])), *((void * *)(avalue[2])), *((ILInt32 *)(avalue[3])), *((ILInt32 
*)(avalue[4])), *((void * *)(avalue[5])));
- }
- 
- #endif
- 
- #ifndef _IL_RegexpMethods_suppressed
- 
- IL_METHOD_BEGIN(RegexpMethods_Methods)
-       IL_METHOD("CompileWithSyntaxInternal", "(oSystem.String;i)j", 
_IL_RegexpMethods_CompileWithSyntaxInternal, marshal_jppi)
-       IL_METHOD("FreeInternal", "(j)V", _IL_RegexpMethods_FreeInternal, 
marshal_vpj)
-       IL_METHOD("ExecInternal", "(joSystem.String;i)i", 
_IL_RegexpMethods_ExecInternal, marshal_ipjpi)
-       IL_METHOD("MatchInternal", 
"(joSystem.String;iioSystem.Type;)oSystem.Array;", 
_IL_RegexpMethods_MatchInternal, marshal_ppjpiip)
-       IL_METHOD("CompileInternal", "(oSystem.String;i)j", 
_IL_RegexpMethods_CompileInternal, marshal_jppi)
- IL_METHOD_END
- 
- #endif
- 
- #if !defined(HAVE_LIBFFI)
- 
  static void marshal_jpip(void (*fn)(), void *rvalue, void **avalue)
  {
--- 2581,2584 ----
***************
*** 2671,2674 ****
--- 2643,2676 ----
        IL_METHOD("Encrypt", "(j[Bi[Bi)V", _IL_CryptoMethods_Encrypt, 
marshal_vpjpipi)
        IL_METHOD("StoreKey", "(ioSystem.String;[B)V", 
_IL_CryptoMethods_StoreKey, marshal_vpipp)
+ IL_METHOD_END
+ 
+ #endif
+ 
+ #if !defined(HAVE_LIBFFI)
+ 
+ static void marshal_ipjpi(void (*fn)(), void *rvalue, void **avalue)
+ {
+       *((ILNativeInt *)rvalue) = (*(ILInt32 (*)(void *, ILNativeUInt, void *, 
ILInt32))fn)(*((void * *)(avalue[0])), *((ILNativeUInt *)(avalue[1])), *((void 
* *)(avalue[2])), *((ILInt32 *)(avalue[3])));
+ }
+ 
+ #endif
+ 
+ #if !defined(HAVE_LIBFFI)
+ 
+ static void marshal_ppjpiip(void (*fn)(), void *rvalue, void **avalue)
+ {
+       *((void * *)rvalue) = (*(void * (*)(void *, ILNativeUInt, void *, 
ILInt32, ILInt32, void *))fn)(*((void * *)(avalue[0])), *((ILNativeUInt 
*)(avalue[1])), *((void * *)(avalue[2])), *((ILInt32 *)(avalue[3])), *((ILInt32 
*)(avalue[4])), *((void * *)(avalue[5])));
+ }
+ 
+ #endif
+ 
+ #ifndef _IL_RegexpMethods_suppressed
+ 
+ IL_METHOD_BEGIN(RegexpMethods_Methods)
+       IL_METHOD("CompileWithSyntaxInternal", "(oSystem.String;i)j", 
_IL_RegexpMethods_CompileWithSyntaxInternal, marshal_jppi)
+       IL_METHOD("FreeInternal", "(j)V", _IL_RegexpMethods_FreeInternal, 
marshal_vpj)
+       IL_METHOD("ExecInternal", "(joSystem.String;i)i", 
_IL_RegexpMethods_ExecInternal, marshal_ipjpi)
+       IL_METHOD("MatchInternal", 
"(joSystem.String;iioSystem.Type;)oSystem.Array;", 
_IL_RegexpMethods_MatchInternal, marshal_ppjpiip)
+       IL_METHOD("CompileInternal", "(oSystem.String;i)j", 
_IL_RegexpMethods_CompileInternal, marshal_jppi)
  IL_METHOD_END
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]