This commit is contained in:
cozis
2022-08-16 18:54:49 +02:00
parent 4d4e365002
commit 3209afb513
5 changed files with 55 additions and 52 deletions
+17
View File
@@ -56,6 +56,23 @@ struct xRuntime {
Heap *heap;
};
const char *Runtime_GetCurrentScriptAbsolutePath(Runtime *runtime)
{
Executable *exe = Runtime_GetCurrentExecutable(runtime);
assert(exe != NULL);
Source *src = Executable_GetSource(exe);
if(src == NULL)
return NULL;
const char *path = Source_GetAbsolutePath(src);
if(path == NULL)
return NULL;
assert(path[0] != '\0');
return path;
}
Stack *Runtime_GetStack(Runtime *runtime)
{
return Stack_Copy(runtime->stack, 1);
+1
View File
@@ -51,6 +51,7 @@ Object* Runtime_GetBuiltins(Runtime *runtime);
void Runtime_SetBuiltins(Runtime *runtime, Object *builtins);
int Runtime_GetCurrentIndex(Runtime *runtime);
Executable *Runtime_GetCurrentExecutable(Runtime *runtime);
const char *Runtime_GetCurrentScriptAbsolutePath(Runtime *runtime);
Snapshot *Snapshot_New(Runtime *runtime);
void Snapshot_Free(Snapshot *snapshot);
void Snapshot_Print(Snapshot *snapshot, FILE *fp);