[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/engine lib_info.c,NONE,1.1 Makefile.am,1
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/engine lib_info.c,NONE,1.1 Makefile.am,1.49,1.50 int_proto.h,1.32,1.33 int_table.c,1.35,1.36 lib_dir.c,1.9,1.10 lib_task.c,1.3,1.4 |
Date: |
Thu, 28 Nov 2002 17:56:56 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv7666/engine
Modified Files:
Makefile.am int_proto.h int_table.c lib_dir.c lib_task.c
Added Files:
lib_info.c
Log Message:
Introduce the "Platform.InfoMethods" class for random environment information.
--- NEW FILE ---
/*
* lib_info.c - Internalcall methods for the "Platform.InfoMethods" class.
*
* Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "engine.h"
#include "lib_defs.h"
#include "il_utils.h"
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* public static String GetRuntimeVersion();
*/
ILString *_IL_InfoMethods_GetRuntimeVersion(ILExecThread *thread)
{
return ILStringCreate(thread, VERSION);
}
/*
* public static String GetNetBIOSMachineName();
*/
ILString *_IL_InfoMethods_GetNetBIOSMachineName(ILExecThread *thread)
{
/* TODO */
return 0;
}
/*
* public static OperatingSystem GetOSVersion();
*/
ILObject *_IL_InfoMethods_GetOSVersion(ILExecThread *thread)
{
/* TODO: recognise Windows versions */
return 0;
}
/*
* public static String GetUserDomainName();
*/
ILString *_IL_InfoMethods_GetUserDomainName(ILExecThread *thread)
{
/* TODO */
return 0;
}
/*
* public static bool IsUserInteractive();
*/
ILBool _IL_InfoMethods_IsUserInteractive(ILExecThread * _thread)
{
#if HAVE_ISATTY
return (isatty(0) && isatty(1));
#else
return 0;
#endif
}
/*
* public static String GetUserName();
*/
ILString *_IL_InfoMethods_GetUserName(ILExecThread *thread)
{
if(!ILImageIsSecure(_ILClrCallerImage(thread)))
{
/* We don't trust the caller, so don't tell them who the user
is */
return ILStringCreate(thread, "nobody");
}
else
{
char *env;
#if HAVE_GETLOGIN
char *login = getlogin();
if(login && *login != '\0')
{
return ILStringCreate(thread, login);
}
#endif
env = getenv("USER");
if(env && *env != '\0')
{
return ILStringCreate(thread, env);
}
return ILStringCreate(thread, "nobody");
}
}
/*
* public static long GetWorkingSet();
*/
ILInt64 _IL_InfoMethods_GetWorkingSet(ILExecThread *thread)
{
/* There is no reliable way to determine the working set */
return 0;
}
/*
* public static String GetSpecialFolder(Environment.SpecialFolder f);
*/
ILString *_IL_InfoMethods_GetSpecialFolder(ILExecThread * _thread, ILInt32 f)
{
/* Special folders are security-sensitive, so don't return them */
return 0;
}
#ifdef __cplusplus
};
#endif
Index: Makefile.am
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/Makefile.am,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -r1.49 -r1.50
*** Makefile.am 22 Nov 2002 00:39:19 -0000 1.49
--- Makefile.am 28 Nov 2002 22:56:54 -0000 1.50
***************
*** 26,29 ****
--- 26,30 ----
lib_gc.c \
lib_helpers.c \
+ lib_info.c \
lib_marshal.c \
lib_math.c \
Index: int_proto.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_proto.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -r1.32 -r1.33
*** int_proto.h 28 Nov 2002 04:57:32 -0000 1.32
--- int_proto.h 28 Nov 2002 22:56:54 -0000 1.33
***************
*** 274,282 ****
extern ILObject * _IL_Assembly_GetExecutingAssembly(ILExecThread * _thread);
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_GetType(ILExecThread * _thread, ILObject *
_this, ILString * typeName, ILBool throwOnError, ILBool ignoreCase);
extern ILObject * _IL_Assembly_GetEntryAssembly(ILExecThread * _thread);
extern System_Array * _IL_Assembly_GetExportedTypes(ILExecThread * _thread,
ILObject * _this);
--- 274,282 ----
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_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);
extern System_Array * _IL_Assembly_GetExportedTypes(ILExecThread * _thread,
ILObject * _this);
***************
*** 375,378 ****
--- 375,379 ----
extern ILString * _IL_DirMethods_GetSystemDirectory(ILExecThread * _thread);
+ extern System_Array * _IL_DirMethods_GetLogicalDrives(ILExecThread * _thread);
extern void _IL_DirMethods_GetPathInfo(ILExecThread * _thread, void *
_result);
extern ILString * _IL_DirMethods_GetCurrentDirectory(ILExecThread * _thread);
***************
*** 390,398 ****
extern ILInt32 _IL_Stdio_StdRead_iacii(ILExecThread * _thread, ILInt32 fd,
System_Array * value, ILInt32 index, ILInt32 count);
extern void _IL_Stdio_StdFlush(ILExecThread * _thread, ILInt32 fd);
extern void _IL_Stdio_StdWrite_ic(ILExecThread * _thread, ILInt32 fd,
ILUInt16 value);
extern void _IL_Stdio_StdWrite_iacii(ILExecThread * _thread, ILInt32 fd,
System_Array * value, ILInt32 index, ILInt32 count);
extern void _IL_Stdio_StdWrite_iString(ILExecThread * _thread, ILInt32 fd,
ILString * value);
- extern ILInt32 _IL_Stdio_StdRead_iaBii(ILExecThread * _thread, ILInt32 fd,
System_Array * value, ILInt32 index, ILInt32 count);
- extern void _IL_Stdio_StdWrite_iaBii(ILExecThread * _thread, ILInt32 fd,
System_Array * value, ILInt32 index, ILInt32 count);
extern ILDouble _IL_SysCharInfo_GetNumericValue(ILExecThread * _thread,
ILUInt16 ch);
--- 391,399 ----
extern ILInt32 _IL_Stdio_StdRead_iacii(ILExecThread * _thread, ILInt32 fd,
System_Array * value, ILInt32 index, ILInt32 count);
extern void _IL_Stdio_StdFlush(ILExecThread * _thread, ILInt32 fd);
+ extern ILInt32 _IL_Stdio_StdRead_iaBii(ILExecThread * _thread, ILInt32 fd,
System_Array * value, ILInt32 index, ILInt32 count);
+ extern void _IL_Stdio_StdWrite_iaBii(ILExecThread * _thread, ILInt32 fd,
System_Array * value, ILInt32 index, ILInt32 count);
extern void _IL_Stdio_StdWrite_ic(ILExecThread * _thread, ILInt32 fd,
ILUInt16 value);
extern void _IL_Stdio_StdWrite_iacii(ILExecThread * _thread, ILInt32 fd,
System_Array * value, ILInt32 index, ILInt32 count);
extern void _IL_Stdio_StdWrite_iString(ILExecThread * _thread, ILInt32 fd,
ILString * value);
extern ILDouble _IL_SysCharInfo_GetNumericValue(ILExecThread * _thread,
ILUInt16 ch);
***************
*** 402,406 ****
extern void _IL_TaskMethods_Exit(ILExecThread * _thread, ILInt32 exitCode);
extern void _IL_TaskMethods_SetExitCode(ILExecThread * _thread, ILInt32
exitCode);
- extern ILString * _IL_TaskMethods_GetRuntimeVersion(ILExecThread * _thread);
extern System_Array * _IL_TaskMethods_GetCommandLineArgs(ILExecThread *
_thread);
extern ILString * _IL_TaskMethods_GetEnvironmentVariable(ILExecThread *
_thread, ILString * variable);
--- 403,406 ----
***************
*** 434,437 ****
--- 434,446 ----
extern ILObject * _IL_Security_GetSecurityManager(ILExecThread * _thread);
extern void _IL_Security_SetSecurityManager(ILExecThread * _thread, ILObject
* mgr);
+
+ extern ILString * _IL_InfoMethods_GetRuntimeVersion(ILExecThread * _thread);
+ extern ILString * _IL_InfoMethods_GetNetBIOSMachineName(ILExecThread *
_thread);
+ extern ILObject * _IL_InfoMethods_GetOSVersion(ILExecThread * _thread);
+ extern ILString * _IL_InfoMethods_GetUserDomainName(ILExecThread * _thread);
+ extern ILBool _IL_InfoMethods_IsUserInteractive(ILExecThread * _thread);
+ extern ILString * _IL_InfoMethods_GetUserName(ILExecThread * _thread);
+ extern ILInt64 _IL_InfoMethods_GetWorkingSet(ILExecThread * _thread);
+ extern ILString * _IL_InfoMethods_GetSpecialFolder(ILExecThread * _thread,
ILInt32 f);
extern ILNativeInt _IL_RegexpMethods_CompileInternal(ILExecThread * _thread,
ILString * pattern, ILInt32 flags);
Index: int_table.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_table.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -r1.35 -r1.36
*** int_table.c 28 Nov 2002 04:57:32 -0000 1.35
--- int_table.c 28 Nov 2002 22:56:54 -0000 1.36
***************
*** 1480,1488 ****
IL_METHOD_BEGIN(Assembly_Methods)
IL_METHOD("GetExecutingAssembly", "()oSystem.Reflection.Assembly;",
_IL_Assembly_GetExecutingAssembly, marshal_pp)
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("GetType", "(ToSystem.String;ZZ)oSystem.Type;",
_IL_Assembly_GetType, marshal_ppppbb)
IL_METHOD("GetEntryAssembly", "()oSystem.Reflection.Assembly;",
_IL_Assembly_GetEntryAssembly, marshal_pp)
IL_METHOD("GetExportedTypes", "(T)[oSystem.Type;",
_IL_Assembly_GetExportedTypes, marshal_ppp)
--- 1480,1488 ----
IL_METHOD_BEGIN(Assembly_Methods)
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("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)
IL_METHOD("GetExportedTypes", "(T)[oSystem.Type;",
_IL_Assembly_GetExportedTypes, marshal_ppp)
***************
*** 1863,1866 ****
--- 1863,1867 ----
IL_METHOD_BEGIN(DirMethods_Methods)
IL_METHOD("GetSystemDirectory", "()oSystem.String;",
_IL_DirMethods_GetSystemDirectory, marshal_pp)
+ IL_METHOD("GetLogicalDrives", "()[oSystem.String;",
_IL_DirMethods_GetLogicalDrives, marshal_pp)
IL_METHOD("GetPathInfo", "()vPlatform.PathInfo;",
_IL_DirMethods_GetPathInfo, marshal_vpp)
IL_METHOD("GetCurrentDirectory", "()oSystem.String;",
_IL_DirMethods_GetCurrentDirectory, marshal_pp)
***************
*** 1887,1893 ****
#if !defined(HAVE_LIBFFI)
! static void marshal_vpiS(void (*fn)(), void *rvalue, void **avalue)
{
! (*(void (*)(void *, ILInt32, ILUInt16))fn)(*((void * *)(avalue[0])),
*((ILInt32 *)(avalue[1])), *((ILUInt16 *)(avalue[2])));
}
--- 1888,1894 ----
#if !defined(HAVE_LIBFFI)
! static void marshal_vpipii(void (*fn)(), void *rvalue, void **avalue)
{
! (*(void (*)(void *, ILInt32, void *, ILInt32, ILInt32))fn)(*((void *
*)(avalue[0])), *((ILInt32 *)(avalue[1])), *((void * *)(avalue[2])), *((ILInt32
*)(avalue[3])), *((ILInt32 *)(avalue[4])));
}
***************
*** 1896,1902 ****
#if !defined(HAVE_LIBFFI)
! static void marshal_vpipii(void (*fn)(), void *rvalue, void **avalue)
{
! (*(void (*)(void *, ILInt32, void *, ILInt32, ILInt32))fn)(*((void *
*)(avalue[0])), *((ILInt32 *)(avalue[1])), *((void * *)(avalue[2])), *((ILInt32
*)(avalue[3])), *((ILInt32 *)(avalue[4])));
}
--- 1897,1903 ----
#if !defined(HAVE_LIBFFI)
! static void marshal_vpiS(void (*fn)(), void *rvalue, void **avalue)
{
! (*(void (*)(void *, ILInt32, ILUInt16))fn)(*((void * *)(avalue[0])),
*((ILInt32 *)(avalue[1])), *((ILUInt16 *)(avalue[2])));
}
***************
*** 1911,1919 ****
IL_METHOD("StdRead", "(i[cii)i", _IL_Stdio_StdRead_iacii,
marshal_ipipii)
IL_METHOD("StdFlush", "(i)V", _IL_Stdio_StdFlush, marshal_vpi)
IL_METHOD("StdWrite", "(ic)V", _IL_Stdio_StdWrite_ic, marshal_vpiS)
IL_METHOD("StdWrite", "(i[cii)V", _IL_Stdio_StdWrite_iacii,
marshal_vpipii)
IL_METHOD("StdWrite", "(ioSystem.String;)V",
_IL_Stdio_StdWrite_iString, marshal_vpip)
- IL_METHOD("StdRead", "(i[Bii)i", _IL_Stdio_StdRead_iaBii,
marshal_ipipii)
- IL_METHOD("StdWrite", "(i[Bii)V", _IL_Stdio_StdWrite_iaBii,
marshal_vpipii)
IL_METHOD_END
--- 1912,1920 ----
IL_METHOD("StdRead", "(i[cii)i", _IL_Stdio_StdRead_iacii,
marshal_ipipii)
IL_METHOD("StdFlush", "(i)V", _IL_Stdio_StdFlush, marshal_vpi)
+ IL_METHOD("StdRead", "(i[Bii)i", _IL_Stdio_StdRead_iaBii,
marshal_ipipii)
+ IL_METHOD("StdWrite", "(i[Bii)V", _IL_Stdio_StdWrite_iaBii,
marshal_vpipii)
IL_METHOD("StdWrite", "(ic)V", _IL_Stdio_StdWrite_ic, marshal_vpiS)
IL_METHOD("StdWrite", "(i[cii)V", _IL_Stdio_StdWrite_iacii,
marshal_vpipii)
IL_METHOD("StdWrite", "(ioSystem.String;)V",
_IL_Stdio_StdWrite_iString, marshal_vpip)
IL_METHOD_END
***************
*** 1953,1957 ****
IL_METHOD("Exit", "(i)V", _IL_TaskMethods_Exit, marshal_vpi)
IL_METHOD("SetExitCode", "(i)V", _IL_TaskMethods_SetExitCode,
marshal_vpi)
- IL_METHOD("GetRuntimeVersion", "()oSystem.String;",
_IL_TaskMethods_GetRuntimeVersion, marshal_pp)
IL_METHOD("GetCommandLineArgs", "()[oSystem.String;",
_IL_TaskMethods_GetCommandLineArgs, marshal_pp)
IL_METHOD("GetEnvironmentVariable", "(oSystem.String;)oSystem.String;",
_IL_TaskMethods_GetEnvironmentVariable, marshal_ppp)
--- 1954,1957 ----
***************
*** 2094,2097 ****
--- 2094,2112 ----
#endif
+ #ifndef _IL_InfoMethods_suppressed
+
+ IL_METHOD_BEGIN(InfoMethods_Methods)
+ IL_METHOD("GetRuntimeVersion", "()oSystem.String;",
_IL_InfoMethods_GetRuntimeVersion, marshal_pp)
+ IL_METHOD("GetNetBIOSMachineName", "()oSystem.String;",
_IL_InfoMethods_GetNetBIOSMachineName, marshal_pp)
+ IL_METHOD("GetOSVersion", "()oSystem.OperatingSystem;",
_IL_InfoMethods_GetOSVersion, marshal_pp)
+ IL_METHOD("GetUserDomainName", "()oSystem.String;",
_IL_InfoMethods_GetUserDomainName, marshal_pp)
+ IL_METHOD("IsUserInteractive", "()Z",
_IL_InfoMethods_IsUserInteractive, marshal_bp)
+ IL_METHOD("GetUserName", "()oSystem.String;",
_IL_InfoMethods_GetUserName, marshal_pp)
+ IL_METHOD("GetWorkingSet", "()l", _IL_InfoMethods_GetWorkingSet,
marshal_lp)
+ IL_METHOD("GetSpecialFolder", "(vSpecialFolder;)oSystem.String;",
_IL_InfoMethods_GetSpecialFolder, marshal_ppi)
+ IL_METHOD_END
+
+ #endif
+
#if !defined(HAVE_LIBFFI)
***************
*** 2435,2438 ****
--- 2450,2456 ----
#ifndef _IL_IPAddress_suppressed
{"IPAddress", "System.Net", IPAddress_Methods},
+ #endif
+ #ifndef _IL_InfoMethods_suppressed
+ {"InfoMethods", "Platform", InfoMethods_Methods},
#endif
#ifndef _IL_Interlocked_suppressed
Index: lib_dir.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_dir.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** lib_dir.c 22 Nov 2002 10:25:43 -0000 1.9
--- lib_dir.c 28 Nov 2002 22:56:54 -0000 1.10
***************
*** 241,244 ****
--- 241,255 ----
return ILSysIOConvertErrno(errno);
}
+
+ /*
+ * public static String[] GetLogicalDrives();
+ */
+ System_Array *_IL_DirMethods_GetLogicalDrives(ILExecThread *thread)
+ {
+ /* TODO: handle Windows drive lists */
+ return (System_Array *)ILExecThreadNew
+ (thread, "[oSystem.String;", "(Ti)V", (ILVaInt)0);
+ }
+
#ifdef __cplusplus
};
Index: lib_task.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_task.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** lib_task.c 28 Nov 2002 04:57:32 -0000 1.3
--- lib_task.c 28 Nov 2002 22:56:54 -0000 1.4
***************
*** 143,154 ****
}
- /*
- * public static String GetRuntimeVersion();
- */
- ILString *_IL_TaskMethods_GetRuntimeVersion(ILExecThread *thread)
- {
- return ILStringCreate(thread, VERSION);
- }
-
#ifdef __cplusplus
};
--- 143,146 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/engine lib_info.c,NONE,1.1 Makefile.am,1.49,1.50 int_proto.h,1.32,1.33 int_table.c,1.35,1.36 lib_dir.c,1.9,1.10 lib_task.c,1.3,1.4,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnet ChangeLog,1.1912,1.1913
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnet ChangeLog,1.1913,1.1914 configure.in,1.90,1.91
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnet ChangeLog,1.1912,1.1913
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnet ChangeLog,1.1913,1.1914 configure.in,1.90,1.91
- Index(es):