Standardised format (with make format
)
This commit is contained in:
parent
2b8f31d2ce
commit
40e3502247
|
@ -502,8 +502,8 @@ lisp_read_char( struct stack_frame *frame, struct cons_pointer frame_pointer,
|
||||||
if ( readp( frame->arg[0] ) ) {
|
if ( readp( frame->arg[0] ) ) {
|
||||||
result =
|
result =
|
||||||
make_string( url_fgetwc
|
make_string( url_fgetwc
|
||||||
( pointer2cell( frame->arg[0] ).payload.
|
( pointer2cell( frame->arg[0] ).payload.stream.
|
||||||
stream.stream ), NIL );
|
stream ), NIL );
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -266,5 +266,7 @@ void initialise_cons_pages( ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void summarise_allocation( ) {
|
void summarise_allocation( ) {
|
||||||
fwprintf(stderr, L"Allocation summary: allocated %lld; deallocated %lld.\n", total_cells_allocated, total_cells_freed );
|
fwprintf( stderr,
|
||||||
|
L"Allocation summary: allocated %lld; deallocated %lld.\n",
|
||||||
|
total_cells_allocated, total_cells_freed );
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,10 +114,10 @@ void dump_object( URL_FILE * output, struct cons_pointer pointer ) {
|
||||||
case RATIOTV:
|
case RATIOTV:
|
||||||
url_fwprintf( output,
|
url_fwprintf( output,
|
||||||
L"\t\tRational cell: value %ld/%ld, count %u\n",
|
L"\t\tRational cell: value %ld/%ld, count %u\n",
|
||||||
pointer2cell( cell.payload.ratio.dividend ).
|
pointer2cell( cell.payload.ratio.dividend ).payload.
|
||||||
payload.integer.value,
|
integer.value,
|
||||||
pointer2cell( cell.payload.ratio.divisor ).
|
pointer2cell( cell.payload.ratio.divisor ).payload.
|
||||||
payload.integer.value, cell.count );
|
integer.value, cell.count );
|
||||||
break;
|
break;
|
||||||
case READTV:
|
case READTV:
|
||||||
url_fputws( L"\t\tInput stream; metadata: ", output );
|
url_fputws( L"\t\tInput stream; metadata: ", output );
|
||||||
|
|
|
@ -180,8 +180,8 @@ struct cons_pointer lisp_make_hashmap( struct stack_frame *frame,
|
||||||
|
|
||||||
map->payload.hashmap.buckets[bucket_no] =
|
map->payload.hashmap.buckets[bucket_no] =
|
||||||
inc_ref( make_cons( make_cons( key, val ),
|
inc_ref( make_cons( make_cons( key, val ),
|
||||||
map->payload.
|
map->payload.hashmap.
|
||||||
hashmap.buckets[bucket_no] ) );
|
buckets[bucket_no] ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -416,8 +416,9 @@ c_apply( struct stack_frame *frame, struct cons_pointer frame_pointer,
|
||||||
result = next_pointer;
|
result = next_pointer;
|
||||||
} else {
|
} else {
|
||||||
result =
|
result =
|
||||||
( *fn_cell.payload.special.
|
( *fn_cell.payload.
|
||||||
executable ) ( get_stack_frame( next_pointer ),
|
special.executable ) ( get_stack_frame
|
||||||
|
( next_pointer ),
|
||||||
next_pointer, env );
|
next_pointer, env );
|
||||||
debug_print( L"Special form returning: ", DEBUG_EVAL );
|
debug_print( L"Special form returning: ", DEBUG_EVAL );
|
||||||
debug_print_object( result, DEBUG_EVAL );
|
debug_print_object( result, DEBUG_EVAL );
|
||||||
|
@ -1213,7 +1214,8 @@ lisp_exception( struct stack_frame *frame, struct cons_pointer frame_pointer,
|
||||||
struct cons_pointer env ) {
|
struct cons_pointer env ) {
|
||||||
struct cons_pointer message = frame->arg[0];
|
struct cons_pointer message = frame->arg[0];
|
||||||
return exceptionp( message ) ? message : throw_exception( message,
|
return exceptionp( message ) ? message : throw_exception( message,
|
||||||
frame->previous );
|
frame->
|
||||||
|
previous );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1380,13 +1382,14 @@ struct cons_pointer c_append( struct cons_pointer l1, struct cons_pointer l2 ) {
|
||||||
if ( pointer2cell( l1 ).tag.value == pointer2cell( l2 ).tag.value ) {
|
if ( pointer2cell( l1 ).tag.value == pointer2cell( l2 ).tag.value ) {
|
||||||
if ( nilp( c_cdr( l1 ) ) ) {
|
if ( nilp( c_cdr( l1 ) ) ) {
|
||||||
return
|
return
|
||||||
make_string_like_thing( ( pointer2cell( l1 ).payload.
|
make_string_like_thing( ( pointer2cell( l1 ).
|
||||||
string.character ), l2,
|
payload.string.character ),
|
||||||
|
l2,
|
||||||
pointer2cell( l1 ).tag.value );
|
pointer2cell( l1 ).tag.value );
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
make_string_like_thing( ( pointer2cell( l1 ).payload.
|
make_string_like_thing( ( pointer2cell( l1 ).
|
||||||
string.character ),
|
payload.string.character ),
|
||||||
c_append( c_cdr( l1 ), l2 ),
|
c_append( c_cdr( l1 ), l2 ),
|
||||||
pointer2cell( l1 ).tag.value );
|
pointer2cell( l1 ).tag.value );
|
||||||
}
|
}
|
||||||
|
@ -1426,7 +1429,8 @@ struct cons_pointer lisp_mapcar( struct stack_frame *frame,
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for ( struct cons_pointer c = frame->arg[1]; truep( c ); c = c_cdr( c ) ) {
|
for ( struct cons_pointer c = frame->arg[1]; truep( c ); c = c_cdr( c ) ) {
|
||||||
struct cons_pointer expr = make_cons(frame->arg[0], make_cons(c_car(c), NIL));
|
struct cons_pointer expr =
|
||||||
|
make_cons( frame->arg[0], make_cons( c_car( c ), NIL ) );
|
||||||
inc_ref( expr );
|
inc_ref( expr );
|
||||||
|
|
||||||
debug_printf( DEBUG_EVAL, L"Mapcar %d, evaluating ", i );
|
debug_printf( DEBUG_EVAL, L"Mapcar %d, evaluating ", i );
|
||||||
|
@ -1483,19 +1487,21 @@ struct cons_pointer lisp_let( struct stack_frame *frame,
|
||||||
struct cons_pointer result = NIL;
|
struct cons_pointer result = NIL;
|
||||||
|
|
||||||
for ( struct cons_pointer cursor = frame->arg[0];
|
for ( struct cons_pointer cursor = frame->arg[0];
|
||||||
truep(cursor);
|
truep( cursor ); cursor = c_cdr( cursor ) ) {
|
||||||
cursor = c_cdr(cursor)) {
|
|
||||||
struct cons_pointer pair = c_car( cursor );
|
struct cons_pointer pair = c_car( cursor );
|
||||||
struct cons_pointer symbol = c_car( pair );
|
struct cons_pointer symbol = c_car( pair );
|
||||||
|
|
||||||
if ( symbolp( symbol ) ) {
|
if ( symbolp( symbol ) ) {
|
||||||
bindings = make_cons(
|
bindings =
|
||||||
make_cons(symbol, eval_form(frame, frame_pointer, c_cdr(pair), bindings)),
|
make_cons( make_cons
|
||||||
bindings);
|
( symbol,
|
||||||
|
eval_form( frame, frame_pointer, c_cdr( pair ),
|
||||||
|
bindings ) ), bindings );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
result = throw_exception(
|
result =
|
||||||
c_string_to_lisp_string(L"Let: cannot bind, not a symbol"),
|
throw_exception( c_string_to_lisp_string
|
||||||
|
( L"Let: cannot bind, not a symbol" ),
|
||||||
frame_pointer );
|
frame_pointer );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1503,7 +1509,9 @@ struct cons_pointer lisp_let( struct stack_frame *frame,
|
||||||
|
|
||||||
/* i.e., no exception yet */
|
/* i.e., no exception yet */
|
||||||
for ( int form = 1; !exceptionp( result ) && form < frame->args; form++ ) {
|
for ( int form = 1; !exceptionp( result ) && form < frame->args; form++ ) {
|
||||||
result = eval_form(frame, frame_pointer, fetch_arg(frame, form), bindings);
|
result =
|
||||||
|
eval_form( frame, frame_pointer, fetch_arg( frame, form ),
|
||||||
|
bindings );
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue