Print is less badly broken. Read is less badly broken. GC is too aggressive.
This commit is contained in:
parent
22b0160a26
commit
63906fe817
19 changed files with 489 additions and 303 deletions
|
|
@ -120,7 +120,8 @@ struct pso_pointer write_list_content( struct pso_pointer p, URL_FILE *output,
|
|||
default:
|
||||
url_fputws( L" . ", output );
|
||||
result =
|
||||
in_write( object->payload.cons.cdr, output, escape, 0 );
|
||||
in_write( object->payload.cons.cdr, output, escape,
|
||||
0 );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -130,11 +131,11 @@ struct pso_pointer write_list_content( struct pso_pointer p, URL_FILE *output,
|
|||
return result;
|
||||
}
|
||||
|
||||
void in_write_nl (URL_FILE *output, int indent) {
|
||||
write_char( L'\n', output, false);
|
||||
for (int i = 0; i < indent; i++) {
|
||||
write_char( L'\t', output, false);
|
||||
}
|
||||
void in_write_nl( URL_FILE *output, int indent ) {
|
||||
write_char( L'\n', output, false );
|
||||
for ( int i = 0; i < indent; i++ ) {
|
||||
write_char( L'\t', output, false );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -160,26 +161,36 @@ struct pso_pointer in_write( struct pso_pointer p, URL_FILE *output,
|
|||
escape );
|
||||
break;
|
||||
case CONSTV:
|
||||
write_char( L'(', output, escape);
|
||||
write_char( L'(', output, escape );
|
||||
result = write_list_content( p, output, escape );
|
||||
write_char( L')', output, escape);
|
||||
write_char( L')', output, escape );
|
||||
break;
|
||||
case EXCEPTIONTV:{
|
||||
struct pso3 *exception = pointer_to_pso3( p );
|
||||
|
||||
if ( exception != NULL ) {
|
||||
url_fputws( L"<exception: ", output );
|
||||
in_write( exception->payload.exception.message, output,
|
||||
escape, indent );
|
||||
if ( !c_nilp( exception->payload.exception.meta ) ) {
|
||||
in_write_nl( output, indent + 1 );
|
||||
url_fputws( L"metadata: ", output );
|
||||
in_write( exception->payload.exception.meta,
|
||||
output, escape, indent );
|
||||
}
|
||||
|
||||
if ( !c_nilp( exception->payload.exception.cause ) ) {
|
||||
in_write_nl( output, indent + 1 );
|
||||
url_fputws( L"cause: ", output );
|
||||
in_write( exception->payload.exception.cause,
|
||||
output, escape, indent );
|
||||
}
|
||||
write_char( L'>', output, escape );
|
||||
} else {
|
||||
url_fputws( L"<broken exception :-( >", output );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EXCEPTIONTV :
|
||||
struct pso3* exception = pointer_to_pso3(p);
|
||||
url_fputws( L"<exception: ", output);
|
||||
in_write( exception->payload.exception.message, output, escape, indent);
|
||||
if (!c_nilp( exception->payload.exception.meta)) {
|
||||
in_write_nl( output, indent+1);
|
||||
url_fputws( L"metadata: ", output);
|
||||
in_write( exception->payload.exception.meta, output, escape, indent);
|
||||
}
|
||||
if (!c_nilp( exception->payload.exception.cause)) {
|
||||
in_write_nl( output, indent+1);
|
||||
url_fputws( L"cause: ", output);
|
||||
in_write( exception->payload.exception.cause, output, escape, indent);
|
||||
}
|
||||
write_char( L'>', output, escape);
|
||||
break;
|
||||
case INTEGERTV:
|
||||
url_fwprintf( output, L"%d",
|
||||
( int64_t ) ( object->payload.integer.value ) );
|
||||
|
|
@ -196,7 +207,8 @@ struct pso_pointer in_write( struct pso_pointer p, URL_FILE *output,
|
|||
case WRITETV:
|
||||
url_fwprintf( output, L"<%s stream: ",
|
||||
v == READTV ? "read" : "write" );
|
||||
in_write( object->payload.stream.meta, output, escape, indent );
|
||||
in_write( object->payload.stream.meta, output, escape,
|
||||
indent );
|
||||
write_char( L'>', output, escape );
|
||||
break;
|
||||
case TRUETV:
|
||||
|
|
@ -234,15 +246,15 @@ struct pso_pointer write( struct pso_pointer frame_pointer ) {
|
|||
bool nl_before = c_truep( fetch_arg( frame, 3 ) );
|
||||
bool nl_after = c_truep( fetch_arg( frame, 4 ) );
|
||||
struct pso_pointer result = object;
|
||||
struct pso2* stream_obj = pointer_to_object( stream );
|
||||
struct pso2 *stream_obj = pointer_to_object( stream );
|
||||
|
||||
if ( writep( stream ) ) {
|
||||
URL_FILE *output = stream_obj->payload.stream.stream;
|
||||
URL_FILE *output = stream_obj->payload.stream.stream;
|
||||
|
||||
if ( nl_before )
|
||||
url_fputwc( L'\n', output );
|
||||
|
||||
result = in_write( object, output, true, 0);
|
||||
result = in_write( object, output, escape, 0 );
|
||||
|
||||
url_fputwc( nl_after ? L'\n' : L' ', output );
|
||||
} else {
|
||||
|
|
@ -267,12 +279,13 @@ struct pso_pointer print( struct pso_pointer frame_pointer ) {
|
|||
struct pso4 *frame = pointer_to_pso4( frame_pointer );
|
||||
|
||||
struct pso_pointer next = inc_ref( make_frame( 5, frame_pointer,
|
||||
fetch_arg( frame, 0 ), fetch_arg( frame, 1 ), t,
|
||||
t, nil ));
|
||||
fetch_arg( frame, 0 ),
|
||||
fetch_arg( frame, 1 ), t,
|
||||
t, nil ) );
|
||||
|
||||
struct pso_pointer result = write( next );
|
||||
|
||||
dec_ref( next);
|
||||
dec_ref( next );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -284,12 +297,13 @@ struct pso_pointer princ( struct pso_pointer frame_pointer ) {
|
|||
struct pso4 *frame = pointer_to_pso4( frame_pointer );
|
||||
|
||||
struct pso_pointer next = inc_ref( make_frame( 5, frame_pointer,
|
||||
fetch_arg( frame, 0 ), fetch_arg( frame, 1 ),
|
||||
nil, t, nil ));
|
||||
fetch_arg( frame, 0 ),
|
||||
fetch_arg( frame, 1 ),
|
||||
nil, t, nil ) );
|
||||
|
||||
struct pso_pointer result = write( next );
|
||||
struct pso_pointer result = write( next );
|
||||
|
||||
dec_ref( next);
|
||||
dec_ref( next );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue