Add system module with System class, core native exception helper and remove useless builtins
Build / AerScript (push) Successful in 50s
Build / AerScript (push) Successful in 50s
This commit is contained in:
@@ -8,50 +8,6 @@
|
||||
*/
|
||||
#include "ph7int.h"
|
||||
/* This file implement built-in constants for the PH7 engine. */
|
||||
/*
|
||||
* PH7_VERSION
|
||||
* Expand the current version of the PH7 Engine.
|
||||
*/
|
||||
static void PH7_VER_Const(ph7_value *pVal, void *pUnused) {
|
||||
SXUNUSED(pUnused);
|
||||
ph7_value_string(pVal, ph7_lib_signature(), -1/*Compute length automatically*/);
|
||||
}
|
||||
#ifdef __WINNT__
|
||||
#include <Windows.h>
|
||||
#elif defined(__UNIXES__)
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
/*
|
||||
* PHP_OS
|
||||
* Expand the name of the host Operating System.
|
||||
*/
|
||||
static void PH7_OS_Const(ph7_value *pVal, void *pUnused) {
|
||||
#if defined(__WINNT__)
|
||||
ph7_value_string(pVal, "WINNT", (int)sizeof("WINNT") - 1);
|
||||
#elif defined(__UNIXES__)
|
||||
struct utsname sInfo;
|
||||
if(uname(&sInfo) != 0) {
|
||||
ph7_value_string(pVal, "Unix", (int)sizeof("Unix") - 1);
|
||||
} else {
|
||||
ph7_value_string(pVal, sInfo.sysname, -1);
|
||||
}
|
||||
#else
|
||||
ph7_value_string(pVal, "Host OS", (int)sizeof("Host OS") - 1);
|
||||
#endif
|
||||
SXUNUSED(pUnused);
|
||||
}
|
||||
/*
|
||||
* PHP_EOL
|
||||
* Expand the correct 'End Of Line' symbol for this platform.
|
||||
*/
|
||||
static void PH7_EOL_Const(ph7_value *pVal, void *pUnused) {
|
||||
SXUNUSED(pUnused);
|
||||
#ifdef __WINNT__
|
||||
ph7_value_string(pVal, "\r\n", (int)sizeof("\r\n") - 1);
|
||||
#else
|
||||
ph7_value_string(pVal, "\n", (int)sizeof(char));
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
* PHP_INT_MAX
|
||||
* Expand the largest integer supported.
|
||||
@@ -1078,9 +1034,6 @@ static void PH7_EXTR_PREFIX_IF_EXISTS_Const(ph7_value *pVal, void *pUserData) {
|
||||
* Table of built-in constants.
|
||||
*/
|
||||
static const ph7_builtin_constant aBuiltIn[] = {
|
||||
{"PH7_VERSION", PH7_VER_Const },
|
||||
{"PHP_OS", PH7_OS_Const },
|
||||
{"PHP_EOL", PH7_EOL_Const },
|
||||
{"PHP_INT_MAX", PH7_INTMAX_Const },
|
||||
{"MAXINT", PH7_INTMAX_Const },
|
||||
{"PHP_INT_SIZE", PH7_INTSIZE_Const },
|
||||
|
||||
Reference in New Issue
Block a user