add nil stuff

This commit is contained in:
Yuichi Nishiwaki 2013-10-10 17:08:54 +09:00
parent 9038939bd1
commit 0fad63f22a
3 changed files with 13 additions and 1 deletions

View File

@ -1,7 +1,7 @@
all: build run all: build run
build: build:
gcc -o bin/picrin -I./include src/main.c src/state.c gcc -o bin/picrin -I./include src/main.c src/state.c src/gc.c
clean: clean:
rm bin/picrin rm bin/picrin

View File

@ -2,6 +2,7 @@
#define VALUE_H__ #define VALUE_H__
enum pic_vtype { enum pic_vtype {
PIC_VTYPE_NIL,
PIC_VTYPE_HEAP PIC_VTYPE_HEAP
}; };
@ -35,6 +36,7 @@ struct pic_symbol {
char *name; char *name;
}; };
pic_value pic_nil_value();
pic_value pic_obj_value(struct pic_object *obj); pic_value pic_obj_value(struct pic_object *obj);
#endif #endif

View File

@ -1,5 +1,15 @@
#include "picrin.h" #include "picrin.h"
pic_value
pic_nil_value()
{
pic_value v;
v.vtype = PIC_VTYPE_NIL;
v.u.data = NULL;
return v;
}
pic_value pic_value
pic_obj_value(struct pic_object *obj) pic_obj_value(struct pic_object *obj)
{ {