Add system module with System class, core native exception helper and remove useless builtins
Build / AerScript (push) Successful in 50s

This commit is contained in:
2026-11-24 09:34:27 +01:00
parent cb894f66fd
commit 1db842fe0f
20 changed files with 1050 additions and 1145 deletions
+11 -4
View File
@@ -705,7 +705,7 @@ struct ph7_constant_info {
SySet *pConsCode;
};
/*
* Each registered constant [i.e: __TIME__, __DATE__, PHP_OS, INT_MAX, etc.] is stored
* Each registered constant [i.e: __TIME__, __DATE__, PATH_SEPARATOR, INT_MAX, etc.] is stored
* in an instance of the following structure.
* Please refer to the official documentation for more information
* on how to create/install foreign constants.
@@ -1449,8 +1449,8 @@ enum iErrCode {
*/
enum ph7_vm_op {
PH7_OP_DONE = 1, /* Done */
PH7_OP_HALT, /* Halt */
PH7_OP_IMPORT, /* Import AerScript module */
/* 2 was PH7_OP_HALT (retired exit construct); gap kept so opcode values do not shift. */
PH7_OP_IMPORT = 3, /* Import AerScript module */
PH7_OP_INCLUDE, /* Include another source file */
PH7_OP_DECLARE, /* Declare a variable */
PH7_OP_LOADV, /* Load variable */
@@ -1651,7 +1651,7 @@ enum ph7_expr_id {
#define PH7_KEYWORD_CLASS 32 /* class */
#define PH7_KEYWORD_IN 33 /* in */
#define PH7_KEYWORD_CONTINUE 34 /* continue */
#define PH7_KEYWORD_EXIT 35 /* exit */
/* 35 was PH7_KEYWORD_EXIT (retired exit construct); gap kept so keyword IDs do not shift. */
#define PH7_KEYWORD_FINALLY 36 /* finally */
#define PH7_KEYWORD_IMPLEMENTS 39 /* implements */
#define PH7_KEYWORD_INCLUDE 41 /* include */
@@ -1798,6 +1798,13 @@ PH7_PRIVATE sxi32 PH7_VmThrowError(ph7_vm *pVm, sxi32 iErr, const char *zMessage
/* classes.c: publish a core IOException instance as a pending exception.
* Returns PH7_EXCEPTION on success, PH7_ABORT on allocation failure. */
PH7_PRIVATE sxi32 PH7_VmThrowIoException(ph7_context *pCtx, int nCode, const char *zMsg);
/* classes.c: publish an instance of the named exception class as a pending
* exception. The constructor receives (message, code); file/line are stamped
* from the first non-[NATIVE] script frame. Returns PH7_EXCEPTION on success,
* PH7_ABORT when the class is missing or allocation fails, and the constructor
* result on constructor failure. */
PH7_PRIVATE sxi32 PH7_VmThrowNativeException(ph7_context *pCtx, const char *zClass,
int nCode, const char *zMessage);
/* vm.c: per-VM, per-module opaque state (C13). Lookups are by module name. */
PH7_PRIVATE void *PH7_VmModuleData(ph7_vm *pVm, const char *zModule);
PH7_PRIVATE sxi32 PH7_VmSetModuleData(ph7_vm *pVm, const char *zModule,