summaryrefslogtreecommitdiff
path: root/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test.c')
-rw-r--r--test.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/test.c b/test.c
index 2d814e0..f41ae64 100644
--- a/test.c
+++ b/test.c
@@ -1,6 +1,31 @@
#include <stdio.h>
+#define fixnum_mask 3
+#define fixnum_tag 0
+#define fixnum_shift 2
+#define char_mask 255
+#define char_shift 8
+#define char_tag 15
+#define boolean_mask 127
+#define boolean_shift 7
+#define boolean_tag 31
+#define empty_list 47
+
int main(int argc, char** argv) {
- printf("%d\n", scheme_entry());
+ int val = scheme_entry();
+
+ if((val & fixnum_mask) == fixnum_tag) {
+ printf("%d\n", val >> fixnum_shift);
+ } else if((val & char_mask) == char_tag) {
+ printf("%c\n", val >> char_shift);
+ } else if((val & boolean_mask) == boolean_tag) {
+ if((val >> boolean_shift) == 1) {
+ printf("#t\n");
+ } else {
+ printf("#f\n");
+ }
+ } else if(val == empty_list) {
+ printf("()\n");
+ }
return 0;
}