Hot damn! When you see an obvious, stupid bug you created, you can't unsee it!

This commit is contained in:
Simon Brooke 2026-04-18 11:02:35 +01:00
parent ca5671f613
commit 02a4bc3e28
8 changed files with 563 additions and 495 deletions

View file

@ -24,9 +24,6 @@
#include "memory/pointer.h"
#include "memory/pso.h"
#include "memory/pso2.h"
#include "memory/pso2.h"
#include "memory/pso2.h"
#include "memory/pso2.h"
#include "memory/pso4.h"
#include "memory/tags.h"
@ -57,18 +54,20 @@ void c_repl( ) {
struct pso_pointer env = consp( oblist ) ? oblist : c_cons( oblist, nil );
struct pso_pointer input_stream = c_assoc( lisp_io_in, env );
struct pso_pointer output_stream = c_assoc( lisp_io_out, env );
if (!readp(input_stream)) {
debug_print(L"Invalid read stream: ", DEBUG_IO, 0);
debug_print_object(input_stream, DEBUG_IO, 0);
}
if (!writep(output_stream)) {
debug_print(L"Invalid write stream: ", DEBUG_IO, 0);
debug_print_object(output_stream, DEBUG_IO, 0);
}
while ( readp( input_stream )
&& !url_feof( stream_get_url_file( input_stream ) ) ) {
if ( !readp( input_stream ) ) {
debug_print( L"Invalid read stream: ", DEBUG_IO, 0 );
debug_print_object( input_stream, DEBUG_IO, 0 );
input_stream = lisp_stdin;
}
if ( !writep( output_stream ) ) {
debug_print( L"Invalid write stream: ", DEBUG_IO, 0 );
debug_print_object( output_stream, DEBUG_IO, 0 );
output_stream = lisp_stdout;
}
while ( readp( input_stream ) &&
!url_feof( stream_get_url_file( input_stream ) ) ) {
/* bottom of stack */
struct pso_pointer frame_pointer = make_frame( 1, nil, input_stream );

View file

@ -81,11 +81,11 @@ struct pso_pointer make_string_like_thing( wint_t c, struct pso_pointer tail,
cell->payload.string.cdr = tail;
cell->payload.string.hash = calculate_hash( c, tail );
debug_printf( DEBUG_ALLOC, 0,
L"Building string-like-thing of type %3.3s: ",
cell->header.tag.bytes.mnemonic);
debug_print_object(pointer, DEBUG_ALLOC, 0);
debug_println(DEBUG_ALLOC);
debug_printf( DEBUG_ALLOC, 0,
L"Building string-like-thing of type %3.3s: ",
cell->header.tag.bytes.mnemonic );
debug_print_object( pointer, DEBUG_ALLOC, 0 );
debug_println( DEBUG_ALLOC );
} else {
// \todo should throw an exception!
struct pso2 *tobj = pointer_to_object( tail );
@ -94,7 +94,7 @@ struct pso_pointer make_string_like_thing( wint_t c, struct pso_pointer tail,
tag, tobj->header.tag.bytes.mnemonic );
}
return pointer;
}
@ -145,8 +145,8 @@ struct pso_pointer c_string_to_lisp_string( wchar_t *string ) {
if ( string[i] != '"' ) {
result = make_string( string[i], result );
} else {
result = make_string( L'\\', make_string( string[i], result));
}
result = make_string( L'\\', make_string( string[i], result ) );
}
}
return result;
@ -163,7 +163,7 @@ struct pso_pointer c_string_to_lisp_symbol( wchar_t *symbol ) {
for ( int i = wcslen( symbol ) - 1; i >= 0; i-- ) {
wchar_t c = towlower( symbol[i] );
if ( iswalpha( c ) || c == L'-' || c == L'*') {
if ( iswalpha( c ) || c == L'-' || c == L'*' ) {
result = make_symbol( c, result );
}
}