write runtime object bootstrap

This commit is contained in:
2025-08-03 01:48:41 +01:00
parent a7d7ded803
commit 417d66faf3
15 changed files with 69 additions and 91 deletions

View File

@@ -8,19 +8,20 @@
#include <stdint.h>
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include "string.h"
ArgonObject *ARGON_STRING_TYPE = NULL;
void init_string_type() {
ARGON_STRING_TYPE = init_argon_class("String");
}
ArgonObject *init_string_object(char*data, size_t length) {
ArgonObject * object = init_child_argon_object(ARGON_STRING_TYPE);
ArgonObject *new_string_object(char*data, size_t length) {
ArgonObject * object = new_object();
add_field(object, "__class__", ARGON_STRING_TYPE);
object->type = TYPE_STRING;
object->value.as_str.data = data;
object->value.as_str.length = length;
return object;
}
ArgonObject *new_string_object_null_terminated(char*data) {
return new_string_object(data, strlen(data));
}