Standardised format (with make format)

This commit is contained in:
Simon Brooke 2021-09-12 15:06:05 +01:00
parent 2b8f31d2ce
commit 40e3502247
No known key found for this signature in database
GPG key ID: A7A4F18D1D4DF987
8 changed files with 97 additions and 87 deletions

View file

@ -502,8 +502,8 @@ lisp_read_char( struct stack_frame *frame, struct cons_pointer frame_pointer,
if ( readp( frame->arg[0] ) ) {
result =
make_string( url_fgetwc
( pointer2cell( frame->arg[0] ).payload.
stream.stream ), NIL );
( pointer2cell( frame->arg[0] ).payload.stream.
stream ), NIL );
}
return result;

View file

@ -266,5 +266,7 @@ void initialise_cons_pages( ) {
}
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 );
}

View file

@ -114,10 +114,10 @@ void dump_object( URL_FILE * output, struct cons_pointer pointer ) {
case RATIOTV:
url_fwprintf( output,
L"\t\tRational cell: value %ld/%ld, count %u\n",
pointer2cell( cell.payload.ratio.dividend ).
payload.integer.value,
pointer2cell( cell.payload.ratio.divisor ).
payload.integer.value, cell.count );
pointer2cell( cell.payload.ratio.dividend ).payload.
integer.value,
pointer2cell( cell.payload.ratio.divisor ).payload.
integer.value, cell.count );
break;
case READTV:
url_fputws( L"\t\tInput stream; metadata: ", output );

View file

@ -180,8 +180,8 @@ struct cons_pointer lisp_make_hashmap( struct stack_frame *frame,
map->payload.hashmap.buckets[bucket_no] =
inc_ref( make_cons( make_cons( key, val ),
map->payload.
hashmap.buckets[bucket_no] ) );
map->payload.hashmap.
buckets[bucket_no] ) );
}
}
}

View file

@ -416,8 +416,9 @@ c_apply( struct stack_frame *frame, struct cons_pointer frame_pointer,
result = next_pointer;
} else {
result =
( *fn_cell.payload.special.
executable ) ( get_stack_frame( next_pointer ),
( *fn_cell.payload.
special.executable ) ( get_stack_frame
( next_pointer ),
next_pointer, env );
debug_print( L"Special form returning: ", 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 message = frame->arg[0];
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 ( nilp( c_cdr( l1 ) ) ) {
return
make_string_like_thing( ( pointer2cell( l1 ).payload.
string.character ), l2,
make_string_like_thing( ( pointer2cell( l1 ).
payload.string.character ),
l2,
pointer2cell( l1 ).tag.value );
} else {
return
make_string_like_thing( ( pointer2cell( l1 ).payload.
string.character ),
make_string_like_thing( ( pointer2cell( l1 ).
payload.string.character ),
c_append( c_cdr( l1 ), l2 ),
pointer2cell( l1 ).tag.value );
}
@ -1426,7 +1429,8 @@ struct cons_pointer lisp_mapcar( struct stack_frame *frame,
int i = 0;
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 );
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;
for ( struct cons_pointer cursor = frame->arg[0];
truep(cursor);
cursor = c_cdr(cursor)) {
truep( cursor ); cursor = c_cdr( cursor ) ) {
struct cons_pointer pair = c_car( cursor );
struct cons_pointer symbol = c_car( pair );
if ( symbolp( symbol ) ) {
bindings = make_cons(
make_cons(symbol, eval_form(frame, frame_pointer, c_cdr(pair), bindings)),
bindings);
bindings =
make_cons( make_cons
( symbol,
eval_form( frame, frame_pointer, c_cdr( pair ),
bindings ) ), bindings );
} else {
result = throw_exception(
c_string_to_lisp_string(L"Let: cannot bind, not a symbol"),
result =
throw_exception( c_string_to_lisp_string
( L"Let: cannot bind, not a symbol" ),
frame_pointer );
break;
}
@ -1503,7 +1509,9 @@ struct cons_pointer lisp_let( struct stack_frame *frame,
/* i.e., no exception yet */
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;