diff runtime/builtin.c @ 12:31f8182f3433

Finished fib test and did some small work on the c backend
author Mike Pavone <pavone@retrodev.com>
date Mon, 25 May 2009 23:34:36 -0400
parents d61550e2c001
children 914ad38f9b59
line wrap: on
line diff
--- a/runtime/builtin.c	Tue May 19 23:29:55 2009 -0400
+++ b/runtime/builtin.c	Mon May 25 23:34:36 2009 -0400
@@ -1,6 +1,7 @@
 #include "builtin.h"
 #include "object.h"
 #include "integer.h"
+#include "bool.h"
 #include <stddef.h>
 
 void register_builtin_type(uint32_t type)
@@ -12,6 +13,16 @@
 		bp = register_type_byid(TYPE_INT32, sizeof(int32_t), NULL, NULL, NULL);
 		add_method(bp, METHOD_ADD, MethodName(_PL_,Int32));
 		add_method(bp, METHOD_SUB, MethodName(_MN_,Int32));
+		add_method(bp, METHOD_LESS, MethodName(_LT_,Int32));
+		add_method(bp, METHOD_GREATER, MethodName(_GT_,Int32));
+		break;
+	case TYPE_BOOLEAN:
+		bp = register_type_byid(TYPE_BOOLEAN, sizeof(int32_t), NULL, NULL, NULL);
+		add_method(bp, METHOD_IF, MethodName(If,Boolean));
+		val_yes = (t_Boolean *)new_object(TYPE_BOOLEAN);
+		val_yes->val = 1;
+		val_no = (t_Boolean *)new_object(TYPE_BOOLEAN);
+		val_no->val = 0;
 		break;
 	}
 }