Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

hey

  • Loading branch information...
commit 1bd63df3c78dba64e8d44424df04076026c36529 1 parent ea6193c
@txus authored
Showing with 11 additions and 1 deletion.
  1. +9 −0 src/forkix/value.c
  2. +1 −0  src/forkix/value.h
  3. +1 −1  src/forkix/vm.c
View
9 src/forkix/value.c
@@ -64,6 +64,15 @@ Value_print(VALUE o)
#define DEFNATIVE(V, N, F) Value_set((V), (N), Closure_new(Function_native_new((F))))
VALUE
+Main_new()
+{
+ VALUE val = Value_new(MainType);
+ DEFNATIVE(val, "print", Primitive_print);
+ DEFNATIVE(val, "puts", Primitive_puts);
+ return val;
+}
+
+VALUE
Integer_new(int num)
{
VALUE val = Value_new(IntegerType);
View
1  src/forkix/value.h
@@ -24,6 +24,7 @@ VALUE Value_new(ValueType);
void Value_destroy(VALUE);
void Value_print(VALUE);
+VALUE Main_new();
VALUE Integer_new(int);
#define VAL2INT(o) (o->data.as_int)
View
2  src/forkix/vm.c
@@ -39,7 +39,7 @@ void VM_start(BytecodeFile *file)
{
STATE state = State_new(file->functions);
- VALUE main = Value_new(MainType); // toplevel object
+ VALUE main = Main_new(); // toplevel object
Runtime_init();
State_bootstrap(state);
Please sign in to comment.
Something went wrong with that request. Please try again.