Skip to content
Snippets Groups Projects
Commit a5e333d2 authored by dtc's avatar dtc
Browse files

Update the object printing so that it works in the presence of signed

arrays, complex floats, complex float arrays, and the scavenger hook.
parent cfe94c2e
No related branches found
No related tags found
No related merge requests found
/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/print.c,v 1.5 1997/08/26 02:22:21 dtc Exp $ */
/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/print.c,v 1.6 1997/11/23 08:55:22 dtc Exp $ */
#include <stdio.h>
#include "print.h"
......@@ -37,6 +37,12 @@ char *subtype_Names[] = {
"single float",
"double float",
"complex",
#ifdef type_ComplexSingleFloat
"complex single float",
#endif
#ifdef type_ComplexDoubleFloat
"complex double float",
#endif
"simple-array",
"simple-string",
"simple-bit-vector",
......@@ -46,8 +52,26 @@ char *subtype_Names[] = {
"(simple-array (unsigned-byte 8) (*))",
"(simple-array (unsigned-byte 16) (*))",
"(simple-array (unsigned-byte 32) (*))",
#ifdef type_SimpleArraySignedByte8
"(simple-array (signed-byte 8) (*))",
#endif
#ifdef type_SimpleArraySignedByte16
"(simple-array (signed-byte 16) (*))",
#endif
#ifdef type_SimpleArraySignedByte30
"(simple-array fixnum (*))",
#endif
#ifdef type_SimpleArraySignedByte32
"(simple-array (signed-byte 32) (*))",
#endif
"(simple-array single-float (*))",
"(simple-array double-float (*))",
#ifdef type_SimpleArrayComplexSingleFloat
"(simple-array (complex single-float) (*))",
#endif
#ifdef type_SimpleArrayComplexDoubleFloat
"(simple-array (complex double-float) (*))",
#endif
"complex-string",
"complex-bit-vector",
"(array * (*))",
......@@ -69,6 +93,9 @@ char *subtype_Names[] = {
"weak pointer",
"instance header",
"fdefn"
#ifdef type_ScavengerHook
,"scavenger hook"
#endif
};
static void indent(int in)
......@@ -350,6 +377,9 @@ static char *fn_slots[] = {"self: ", "next: ", "name: ", "arglist: ", "type: ",
static char *closure_slots[] = {"fn: ", NULL};
static char *weak_pointer_slots[] = {"value: ", NULL};
static char *fdefn_slots[] = {"name: ", "function: ", "raw_addr: ", NULL};
#ifdef type_ScavengerHook
static char *scavenger_hook_slots[] = {"value: ", "function: ", "next: ", NULL};
#endif
static void print_otherptr(lispobj obj)
{
......@@ -417,6 +447,24 @@ static void print_otherptr(lispobj obj)
printf("%g", ((struct double_float *)PTR(obj))->value);
break;
#ifdef type_ComplexSingleFloat
case type_ComplexSingleFloat:
NEWLINE;
printf("%g", ((struct complex_single_float *)PTR(obj))->real);
NEWLINE;
printf("%g", ((struct complex_single_float *)PTR(obj))->imag);
break;
#endif
#ifdef type_ComplexDoubleFloat
case type_ComplexDoubleFloat:
NEWLINE;
printf("%g", ((struct complex_double_float *)PTR(obj))->real);
NEWLINE;
printf("%g", ((struct complex_double_float *)PTR(obj))->imag);
break;
#endif
case type_SimpleString:
NEWLINE;
cptr = (char *)(ptr+1);
......@@ -445,8 +493,26 @@ static void print_otherptr(lispobj obj)
case type_SimpleArrayUnsignedByte8:
case type_SimpleArrayUnsignedByte16:
case type_SimpleArrayUnsignedByte32:
#ifdef type_SimpleArraySignedByte8
case type_SimpleArraySignedByte8:
#endif
#ifdef type_SimpleArraySignedByte16
case type_SimpleArraySignedByte16:
#endif
#ifdef type_SimpleArraySignedByte30
case type_SimpleArraySignedByte30:
#endif
#ifdef type_SimpleArraySignedByte32
case type_SimpleArraySignedByte32:
#endif
case type_SimpleArraySingleFloat:
case type_SimpleArrayDoubleFloat:
#ifdef type_SimpleArrayComplexSingleFloat
case type_SimpleArrayComplexSingleFloat:
#endif
#ifdef type_SimpleArrayComplexDoubleFloat
case type_SimpleArrayComplexDoubleFloat:
#endif
case type_ComplexString:
case type_ComplexBitVector:
case type_ComplexVector:
......@@ -489,10 +555,16 @@ static void print_otherptr(lispobj obj)
printf("pointer to an immediate?");
break;
case type_Fdefn:
case type_Fdefn:
print_slots(fdefn_slots, count, ptr);
break;
#ifdef type_ScavengerHook
case type_ScavengerHook:
print_slots(scavenger_hook_slots, count, ptr);
break;
#endif
default:
NEWLINE;
printf("Unknown header object?");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment