Cleanup. Split the code into various files.
[picobit/chj.git] / debug.c
blob286bddfae052b647b106c37c42beb421c6388322
1 /* file: "debug.c" */
3 /*
4 * Copyright 2004-2009 by Marc Feeley and Vincent St-Amour, All Rights Reserved.
5 */
7 // debugging functions
9 #include "picobit-vm.h"
10 // needs some memory access functions defined above
11 #include "objects.h"
13 #ifdef WORKSTATION
14 void show_type (obj o) // for debugging purposes
16 printf("%d : ", o);
17 if (o == OBJ_FALSE) printf("#f");
18 else if (o == OBJ_TRUE) printf("#t");
19 else if (o == OBJ_NULL) printf("()");
20 else if (o < MIN_ROM_ENCODING) printf("fixnum");
21 else if (IN_RAM (o))
23 if (RAM_BIGNUM(o)) printf("ram bignum");
24 else if (RAM_PAIR(o)) printf("ram pair");
25 else if (RAM_SYMBOL(o)) printf("ram symbol");
26 else if (RAM_STRING(o)) printf("ram string");
27 else if (RAM_VECTOR(o)) printf("ram vector");
28 else if (RAM_CONTINUATION(o)) printf("ram continuation");
29 else if (RAM_CLOSURE(o)) printf("ram closure");
31 else // ROM
33 if (ROM_BIGNUM(o)) printf("rom bignum");
34 else if (ROM_PAIR(o)) printf("rom pair");
35 else if (ROM_SYMBOL(o)) printf("rom symbol");
36 else if (ROM_STRING(o)) printf("rom string");
37 else if (ROM_VECTOR(o)) printf("rom vector");
38 else if (ROM_CONTINUATION(o)) printf("rom continuation");
39 else if (RAM_CLOSURE(o)) printf("rom closure");
41 printf("\n");
43 #endif