write runtime object bootstrap
This commit is contained in:
@@ -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));
|
||||
}
|
||||
@@ -10,8 +10,7 @@
|
||||
|
||||
extern ArgonObject *ARGON_STRING_TYPE;
|
||||
|
||||
void init_string_type();
|
||||
|
||||
ArgonObject *init_string_object(char*data, size_t length);
|
||||
ArgonObject *new_string_object(char*data, size_t length);
|
||||
|
||||
ArgonObject *new_string_object_null_terminated(char*data);
|
||||
#endif // STRING_OBJ_H
|
||||
Reference in New Issue
Block a user