wip: begin dynamic library loading dev
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
/// Converts integer [value] to string
|
||||
extern fn itos(int value) str;
|
||||
|
||||
/// Converts string [value] to integer
|
||||
extern fn stoi(str value) int;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
/// Get the minimum of specified values
|
||||
extern fn min([]int ...values) int;
|
||||
|
||||
/// Get the maximum of specified values
|
||||
extern fn max([]int ...values) int;
|
||||
|
||||
+13
-8
@@ -28,14 +28,16 @@ fzl_vm_t *fzl_mkvm(const char *filepath)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
vm->consts = NULL;
|
||||
vm->consts_count = 0;
|
||||
vm->ops = NULL;
|
||||
vm->ops_count = 0;
|
||||
vm->ip = 0;
|
||||
vm->dtop = 0;
|
||||
vm->ctop = 0;
|
||||
vm->etop = 0;
|
||||
vm->consts = NULL;
|
||||
vm->consts_count = 0;
|
||||
vm->ops = NULL;
|
||||
vm->ops_count = 0;
|
||||
vm->externs = NULL;
|
||||
vm->externs_count = 0;
|
||||
vm->ip = 0;
|
||||
vm->dtop = 0;
|
||||
vm->ctop = 0;
|
||||
vm->etop = 0;
|
||||
|
||||
memset(vm->dstack, 0, sizeof(vm->dstack));
|
||||
memset(vm->cstack, 0, sizeof(vm->cstack));
|
||||
@@ -63,6 +65,7 @@ fzl_vm_t *fzl_mkvm(const char *filepath)
|
||||
size_t consts_count, ops_count;
|
||||
fread(&consts_count, sizeof(size_t), 1, fd);
|
||||
fread(&ops_count, sizeof(size_t), 1, fd);
|
||||
// TODO: read externs count
|
||||
|
||||
if (ops_count < 1)
|
||||
{
|
||||
@@ -116,6 +119,8 @@ fzl_vm_t *fzl_mkvm(const char *filepath)
|
||||
fread(&op, sizeof(uint64_t), 1, fd);
|
||||
vm->ops[i] = op;
|
||||
}
|
||||
|
||||
// TODO: read externs
|
||||
fclose(fd);
|
||||
|
||||
return vm;
|
||||
|
||||
Reference in New Issue
Block a user