Skip to content

Commit 9960010

Browse files
committed
Adds handling of strings with indirect headers for URaid object printing
1 parent ce20b35 commit 9960010

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/kprint.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,12 @@ void prindatum(LispPTR x) {
9898
break;
9999
case TYPE_ONED_ARRAY:
100100
case TYPE_GENERAL_ARRAY:
101+
/* this should probably use array.h's arrayheader */
101102
newstring = (NEWSTRINGP *)NativeAligned4FromLAddr(x);
102103
if (newstring->stringp) {
103104
print_NEWstring(x);
104105
}
106+
/* it would be useful to print non-string arrays, too */
105107
break;
106108
default: dtd_base = (struct dtd *)GetDTD(typen); printf("{");
107109
#ifdef BIGVM
@@ -173,14 +175,20 @@ void print_string(LispPTR x) {
173175
void print_NEWstring(LispPTR x) {
174176
NEWSTRINGP *string_point;
175177
DLword st_length;
178+
DLword st_offset;
176179
DLbyte *string_base;
177180

178181
int i;
179182

180183
string_point = (NEWSTRINGP *)NativeAligned4FromLAddr(x);
181184
st_length = string_point->fillpointer;
185+
st_offset = string_point->offset;
186+
if (string_point->indirectp) {
187+
/* base points to another array header not the raw storage */
188+
string_point = (NEWSTRINGP *)NativeAligned4FromLAddr(string_point->base);
189+
}
182190
string_base = (DLbyte *)NativeAligned2FromLAddr(string_point->base);
183-
string_base += string_point->offset;
191+
string_base += st_offset;
184192

185193
printf("%c", DOUBLEQUOTE); /* print %" */
186194

0 commit comments

Comments
 (0)