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

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

[Dotgnu-pnet-commits] CVS: pnet/engine int_proto.h,1.37,1.38 int_table.


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/engine int_proto.h,1.37,1.38 int_table.c,1.40,1.41 lib_reflect.c,1.23,1.24
Date: Tue, 10 Dec 2002 19:44:15 -0500

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

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


Add the "Assembly.GetSatellitePath" internalcall.


Index: int_proto.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_proto.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -r1.37 -r1.38
*** int_proto.h 8 Dec 2002 01:10:08 -0000       1.37
--- int_proto.h 11 Dec 2002 00:44:12 -0000      1.38
***************
*** 281,286 ****
  extern ILObject * _IL_Assembly_GetType(ILExecThread * _thread, ILObject * 
_this, ILString * typeName, ILBool throwOnError, ILBool ignoreCase);
  extern ILObject * _IL_Assembly_GetManifestResourceStream(ILExecThread * 
_thread, ILObject * _this, ILString * name);
! extern ILObject * _IL_Assembly_GetCallingAssembly(ILExecThread * _thread);
  extern ILObject * _IL_Assembly_LoadFromFile(ILExecThread * _thread, ILString 
* name, ILInt32 * error, ILObject * parent);
  extern ILObject * _IL_Assembly_LoadFromName(ILExecThread * _thread, ILString 
* name, ILInt32 * error, ILObject * parent);
  extern ILObject * _IL_Assembly_GetEntryAssembly(ILExecThread * _thread);
--- 281,287 ----
  extern ILObject * _IL_Assembly_GetType(ILExecThread * _thread, ILObject * 
_this, ILString * typeName, ILBool throwOnError, ILBool ignoreCase);
  extern ILObject * _IL_Assembly_GetManifestResourceStream(ILExecThread * 
_thread, ILObject * _this, ILString * name);
! extern ILString * _IL_Assembly_GetSatellitePath(ILExecThread * _thread, 
ILObject * _this, ILString * filename);
  extern ILObject * _IL_Assembly_LoadFromFile(ILExecThread * _thread, ILString 
* name, ILInt32 * error, ILObject * parent);
+ extern ILObject * _IL_Assembly_GetCallingAssembly(ILExecThread * _thread);
  extern ILObject * _IL_Assembly_LoadFromName(ILExecThread * _thread, ILString 
* name, ILInt32 * error, ILObject * parent);
  extern ILObject * _IL_Assembly_GetEntryAssembly(ILExecThread * _thread);

Index: int_table.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_table.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -r1.40 -r1.41
*** int_table.c 8 Dec 2002 01:10:08 -0000       1.40
--- int_table.c 11 Dec 2002 00:44:12 -0000      1.41
***************
*** 1520,1525 ****
        IL_METHOD("GetType", "(ToSystem.String;ZZ)oSystem.Type;", 
_IL_Assembly_GetType, marshal_ppppbb)
        IL_METHOD("GetManifestResourceStream", 
"(ToSystem.String;)oSystem.IO.Stream;", _IL_Assembly_GetManifestResourceStream, 
marshal_pppp)
!       IL_METHOD("GetCallingAssembly", "()oSystem.Reflection.Assembly;", 
_IL_Assembly_GetCallingAssembly, marshal_pp)
        IL_METHOD("LoadFromFile", 
"(oSystem.String;&ioSystem.Reflection.Assembly;)oSystem.Reflection.Assembly;", 
_IL_Assembly_LoadFromFile, marshal_ppppp)
        IL_METHOD("LoadFromName", 
"(oSystem.String;&ioSystem.Reflection.Assembly;)oSystem.Reflection.Assembly;", 
_IL_Assembly_LoadFromName, marshal_ppppp)
        IL_METHOD("GetEntryAssembly", "()oSystem.Reflection.Assembly;", 
_IL_Assembly_GetEntryAssembly, marshal_pp)
--- 1520,1526 ----
        IL_METHOD("GetType", "(ToSystem.String;ZZ)oSystem.Type;", 
_IL_Assembly_GetType, marshal_ppppbb)
        IL_METHOD("GetManifestResourceStream", 
"(ToSystem.String;)oSystem.IO.Stream;", _IL_Assembly_GetManifestResourceStream, 
marshal_pppp)
!       IL_METHOD("GetSatellitePath", "(ToSystem.String;)oSystem.String;", 
_IL_Assembly_GetSatellitePath, marshal_pppp)
        IL_METHOD("LoadFromFile", 
"(oSystem.String;&ioSystem.Reflection.Assembly;)oSystem.Reflection.Assembly;", 
_IL_Assembly_LoadFromFile, marshal_ppppp)
+       IL_METHOD("GetCallingAssembly", "()oSystem.Reflection.Assembly;", 
_IL_Assembly_GetCallingAssembly, marshal_pp)
        IL_METHOD("LoadFromName", 
"(oSystem.String;&ioSystem.Reflection.Assembly;)oSystem.Reflection.Assembly;", 
_IL_Assembly_LoadFromName, marshal_ppppp)
        IL_METHOD("GetEntryAssembly", "()oSystem.Reflection.Assembly;", 
_IL_Assembly_GetEntryAssembly, marshal_pp)

Index: lib_reflect.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_reflect.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** lib_reflect.c       2 Dec 2002 19:08:33 -0000       1.23
--- lib_reflect.c       11 Dec 2002 00:44:12 -0000      1.24
***************
*** 1093,1098 ****
  
  /*
!  * private static Assembly LoadFromFile(String name, out int error,
!  *                                                                            
Assembly parent);
   */
  ILObject *_IL_Assembly_LoadFromFile(ILExecThread *thread,
--- 1093,1098 ----
  
  /*
!  * internal static Assembly LoadFromFile(String name, out int error,
!  *                                                                            
 Assembly parent);
   */
  ILObject *_IL_Assembly_LoadFromFile(ILExecThread *thread,
***************
*** 1193,1196 ****
--- 1193,1250 ----
        {
                *((void **)result) = 0;
+       }
+ }
+ 
+ ILString *_IL_Assembly_GetSatellitePath(ILExecThread *thread,
+                                                                               
ILObject *_this,
+                                                                               
ILString *filename)
+ {
+       ILProgramItem *item = (ILProgramItem *)_ILClrFromObject(thread, _this);
+       ILImage *image = ((item != 0) ? ILProgramItem_Image(item) : 0);
+       char *str = ILStringToAnsi(thread, filename);
+       char *fullname;
+       int len;
+       ILString *fullstr;
+ 
+       if(image && str)
+       {
+               /* Bail out if the image does not have a filename */
+               if(!(image->filename))
+               {
+                       return 0;
+               }
+ 
+               /* Strip the base name off the image's filename */
+               len = strlen(image->filename);
+               while(len > 0 && image->filename[len - 1] != '/' &&
+                     image->filename[len - 1] != '\\')
+               {
+                       --len;
+               }
+ 
+               /* Construct the full pathname */
+               fullname = (char *)ILMalloc(len + strlen(str) + 1);
+               if(!fullname)
+               {
+                       return 0;
+               }
+               strncpy(fullname, image->filename, len);
+               strcpy(fullname + len, str);
+ 
+               /* Check that the file actually exists */
+               if(!ILFileExists(fullname, (char **)0))
+               {
+                       ILFree(fullname);
+                       return 0;
+               }
+ 
+               /* Return the filename to the caller */
+               fullstr = ILStringCreate(thread, fullname);
+               ILFree(fullname);
+               return fullstr;
+       }
+       else
+       {
+               return 0;
        }
  }




reply via email to

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