1 // Debugging support for dynamic typing.
15 // The default printer function.
16 void cl_dprint_unknown (cl_heap* pointer)
18 fprint(cl_debugout, "<unknown @0x");
19 fprinthexadecimal(cl_debugout, (unsigned long) pointer);
20 fprint(cl_debugout, " refcount=");
21 fprintdecimal(cl_debugout, pointer->refcount);
22 fprint(cl_debugout, " type=");
23 fprinthexadecimal(cl_debugout, (unsigned long) pointer->type);
24 fprint(cl_debugout, ">");
27 static void cl_dprint_unknown_immediate (cl_heap* pointer)
29 fprint(cl_debugout, "<unknown @0x");
30 fprinthexadecimal(cl_debugout, (unsigned long) pointer);
31 fprint(cl_debugout, ">");
34 // Print an object. This function is callable from the debugger.
35 extern "C" void* cl_print (cl_uint word);
36 void* cl_print (cl_uint word)
38 var cl_heap* pointer = (cl_heap*)word;
39 if (cl_pointer_p(word)) {
40 var const cl_class* type = pointer->type;
42 type->dprint(pointer);
44 cl_dprint_unknown(pointer);
46 var const cl_class* type = cl_immediate_classes[cl_tag(word)];
47 if (type && type->dprint)
48 type->dprint(pointer);
50 cl_dprint_unknown_immediate(pointer);
53 cl_debugout << endl; // newline and flush output
55 fprint(cl_debugout, "\n");
60 void cl_gcobject::debug_print () const
65 void cl_gcpointer::debug_print () const
70 void cl_rcobject::debug_print () const
75 void cl_rcpointer::debug_print () const