move non essential opcodes to primitives and add userdata
This commit is contained in:
parent
e654143a90
commit
45e2c0d406
17 changed files with 234 additions and 37 deletions
21
src/userdata.h
Normal file
21
src/userdata.h
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef USERDATA_H
|
||||
#define USERDATA_H
|
||||
|
||||
#include "common.h"
|
||||
#include "object.h"
|
||||
#include "vm.h"
|
||||
|
||||
typedef struct Ut {
|
||||
const char *name;
|
||||
V (*finalizer)(V *);
|
||||
} Ut;
|
||||
|
||||
typedef struct Ud {
|
||||
Ut *kind;
|
||||
V *data;
|
||||
} Ud;
|
||||
|
||||
O userdata_make(Vm *, V *, Ut *);
|
||||
Ud *userdata_unwrap(O, Ut *);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue