'Fixed' issue #8; but done so by introducing a goto. Not entirely happy about this.

This commit is contained in:
Simon Brooke 2026-03-18 21:35:34 +00:00
parent dc5cac0bd8
commit a20c956288
11 changed files with 63 additions and 53 deletions

View file

@ -363,8 +363,8 @@ struct cons_pointer maybe_fixup_exception_location( struct cons_pointer r,
pointer2cell( result ).payload.exception.payload =
make_cons( make_cons( privileged_keyword_location,
c_assoc( privileged_keyword_name,
fn_cell->payload.function.
meta ) ),
fn_cell->payload.
function.meta ) ),
make_cons( make_cons
( privileged_keyword_payload,
payload ), NIL ) );
@ -416,7 +416,10 @@ c_apply( struct stack_frame *frame, struct cons_pointer frame_pointer,
get_stack_frame( next_pointer );
result = maybe_fixup_exception_location( ( *
( fn_cell->payload.function.executable ) )
( fn_cell->
payload.
function.
executable ) )
( next,
next_pointer,
env ),
@ -490,7 +493,10 @@ c_apply( struct stack_frame *frame, struct cons_pointer frame_pointer,
result = next_pointer;
} else {
result = maybe_fixup_exception_location( ( *
( fn_cell->payload.special.executable ) )
( fn_cell->
payload.
special.
executable ) )
( get_stack_frame( next_pointer ), next_pointer, env ), fn_pointer );
debug_print( L"Special form returning: ", DEBUG_EVAL );
debug_print_object( result, DEBUG_EVAL );
@ -921,13 +927,13 @@ struct cons_pointer c_keys( struct cons_pointer store ) {
if ( consp( store ) ) {
for ( struct cons_pointer pair = c_car( store ); !nilp( pair );
pair = c_car( store ) ) {
pair = c_car( store ) ) {
if ( consp( pair ) ) {
result = make_cons( c_car( pair), result);
result = make_cons( c_car( pair ), result );
} else if ( hashmapp( pair ) ) {
result=c_append( hashmap_keys( pair), result);
}
result = c_append( hashmap_keys( pair ), result );
}
store = c_cdr( store );
}
} else if ( hashmapp( store ) ) {
@ -1270,14 +1276,14 @@ struct cons_pointer eval_cond_clause( struct cons_pointer clause,
env ) );
#ifdef DEBUG
debug_print( L"\n\t\tCond clause ", DEBUG_EVAL);
debug_print_object( clause, DEBUG_EVAL);
debug_print( L"\n\t\tCond clause ", DEBUG_EVAL );
debug_print_object( clause, DEBUG_EVAL );
debug_print( L" succeeded; returning: ", DEBUG_EVAL );
debug_print_object( result, DEBUG_EVAL );
debug_println( DEBUG_EVAL );
} else {
debug_print( L"\n\t\tCond clause ", DEBUG_EVAL);
debug_print_object( clause, DEBUG_EVAL);
debug_print( L"\n\t\tCond clause ", DEBUG_EVAL );
debug_print_object( clause, DEBUG_EVAL );
debug_print( L" failed.\n", DEBUG_EVAL );
#endif
}
@ -1626,14 +1632,13 @@ 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 );
}