-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobject.h
56 lines (44 loc) · 1.18 KB
/
object.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// Created by fathi on 10/29/2024.
//
#ifndef TIGE_OBJECT_H
#define TIGE_OBJECT_H
#include "functions.h"
#include "uthash.h"
#include "value.h"
typedef struct TObject TObject;
typedef struct TObjectProperty TObjectProperty;
typedef struct TObjectMetadata TObjectMetadata;
typedef struct TObjectMethod TObjectMethod;
struct TObjectMethod
{
char *name;
Function* function;
UT_hash_handle hh;
};
struct TObjectMetadata
{
bool gc_marked;
};
struct TObjectProperty {
char* prop_name;
Value value;
};
struct TObjectPropMap {
TObjectProperty* properties;
};
struct TObject {
TObjectMetadata* metadata;
TObjectProperty* props;
};
TObject* object_new();
void object_free(const TObject* ptr);
void object_init(TObject* ptr);
// functions are just object without any property or access to this
TObject* make_function();
void object_add_property(TObject* ptr, TObjectProperty* property);
void object_add_method(TObject* ptr, TObjectMethod* method);
void object_set_method(TObject* ptr, TObjectMethod* method);
void object_set_property(TObject* ptr, TObjectProperty* property);
void object_remove_property(TObject* ptr, TObjectProperty* property);
#endif //TIGE_OBJECT_H