Investigating why symbols created by read are not equal to those created in C.
This commit is contained in:
parent
1cfd333e26
commit
cf655e8020
6 changed files with 67 additions and 123 deletions
|
|
@ -33,10 +33,12 @@
|
|||
#include "memory/tags.h"
|
||||
|
||||
#include "payloads/character.h"
|
||||
#include "payloads/cons.h"
|
||||
#include "payloads/exception.h"
|
||||
#include "payloads/function.h"
|
||||
#include "payloads/integer.h"
|
||||
#include "payloads/read_stream.h"
|
||||
#include "payloads/symbol.h"
|
||||
|
||||
#include "ops/assoc.h"
|
||||
#include "ops/reverse.h"
|
||||
|
|
@ -150,6 +152,9 @@ struct pso_pointer read_number( struct pso_pointer frame_pointer ) {
|
|||
url_ungetwc( c, input );
|
||||
result = make_integer( frame_pointer, value );
|
||||
} // else exception?
|
||||
#ifdef DEBUG
|
||||
debug_printf( DEBUG_IO, 0, L"\nRead number %ld\n", value );
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -171,7 +176,7 @@ struct pso_pointer read_symbol( struct pso_pointer frame_pointer ) {
|
|||
? 0 : pointer_to_object( character )->payload.character.character;
|
||||
|
||||
URL_FILE *input = pointer_to_object( stream )->payload.stream.stream;
|
||||
for ( ; iswalnum( c ); c = url_fgetwc( input ) ) {
|
||||
for ( ; symbol_char_p( c ); c = url_fgetwc( input ) ) {
|
||||
result =
|
||||
make_string_like_thing( frame_pointer, c, result, SYMBOLTAG );
|
||||
}
|
||||
|
|
@ -180,6 +185,17 @@ struct pso_pointer read_symbol( struct pso_pointer frame_pointer ) {
|
|||
result = c_reverse( frame_pointer, result );
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
debug_print( L"\nRead symbol `", DEBUG_IO, 0 );
|
||||
debug_print_object( result, DEBUG_IO, 0);
|
||||
debug_print( L"`\n\t", DEBUG_IO, 0);
|
||||
for ( struct pso_pointer cursor = result; !c_nilp(cursor); cursor = c_cdr(cursor)) {
|
||||
wint_t c = pointer_to_object(cursor)->payload.string.character;
|
||||
debug_printf( DEBUG_IO, 0, L"[Character %lc (%d)]", c, c);
|
||||
}
|
||||
debug_println(DEBUG_IO);
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -244,7 +260,7 @@ struct pso_pointer read( struct pso_pointer frame_pointer ) {
|
|||
inc_ref( next );
|
||||
if ( iswdigit( c ) ) {
|
||||
result = push_local( frame_pointer, read_number( next ) );
|
||||
} else if ( iswalpha( c ) ) {
|
||||
} else if ( symbol_char_p( c ) ) {
|
||||
result = push_local( frame_pointer, read_symbol( next ) );
|
||||
} else {
|
||||
// result =
|
||||
|
|
@ -268,9 +284,9 @@ struct pso_pointer read( struct pso_pointer frame_pointer ) {
|
|||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
debug_print( L"Read object: ", DEBUG_IO, 0 );
|
||||
debug_print( L"Read expression: `", DEBUG_IO, 0 );
|
||||
debug_print_object( result, DEBUG_IO, 0 );
|
||||
debug_println( DEBUG_IO );
|
||||
debug_print( L"`\n", DEBUG_IO, 0 );
|
||||
#endif
|
||||
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue