Mercurial > repos > rhope
comparison 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 |
comparison
equal
deleted
inserted
replaced
11:3021dac0d8f5 | 12:31f8182f3433 |
---|---|
1 #include "builtin.h" | 1 #include "builtin.h" |
2 #include "object.h" | 2 #include "object.h" |
3 #include "integer.h" | 3 #include "integer.h" |
4 #include "bool.h" | |
4 #include <stddef.h> | 5 #include <stddef.h> |
5 | 6 |
6 void register_builtin_type(uint32_t type) | 7 void register_builtin_type(uint32_t type) |
7 { | 8 { |
8 blueprint * bp; | 9 blueprint * bp; |
10 { | 11 { |
11 case TYPE_INT32: | 12 case TYPE_INT32: |
12 bp = register_type_byid(TYPE_INT32, sizeof(int32_t), NULL, NULL, NULL); | 13 bp = register_type_byid(TYPE_INT32, sizeof(int32_t), NULL, NULL, NULL); |
13 add_method(bp, METHOD_ADD, MethodName(_PL_,Int32)); | 14 add_method(bp, METHOD_ADD, MethodName(_PL_,Int32)); |
14 add_method(bp, METHOD_SUB, MethodName(_MN_,Int32)); | 15 add_method(bp, METHOD_SUB, MethodName(_MN_,Int32)); |
16 add_method(bp, METHOD_LESS, MethodName(_LT_,Int32)); | |
17 add_method(bp, METHOD_GREATER, MethodName(_GT_,Int32)); | |
18 break; | |
19 case TYPE_BOOLEAN: | |
20 bp = register_type_byid(TYPE_BOOLEAN, sizeof(int32_t), NULL, NULL, NULL); | |
21 add_method(bp, METHOD_IF, MethodName(If,Boolean)); | |
22 val_yes = (t_Boolean *)new_object(TYPE_BOOLEAN); | |
23 val_yes->val = 1; | |
24 val_no = (t_Boolean *)new_object(TYPE_BOOLEAN); | |
25 val_no->val = 0; | |
15 break; | 26 break; |
16 } | 27 } |
17 } | 28 } |
18 | 29 |
19 void register_builtin_types() | 30 void register_builtin_types() |