String-like-things are being created and printed correctly; bind is broken.
This commit is contained in:
parent
cf05e30540
commit
ca5671f613
8 changed files with 508 additions and 450 deletions
|
|
@ -71,7 +71,7 @@ uint32_t calculate_hash( wint_t c, struct pso_pointer ptr ) {
|
|||
*/
|
||||
struct pso_pointer make_string_like_thing( wint_t c, struct pso_pointer tail,
|
||||
char *tag ) {
|
||||
struct pso_pointer pointer = nil;
|
||||
struct pso_pointer pointer = tail;
|
||||
|
||||
if ( check_type( tail, tag ) || nilp( tail ) ) {
|
||||
pointer = allocate( tag, CONS_SIZE_CLASS );
|
||||
|
|
@ -81,8 +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_dump_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 );
|
||||
|
|
@ -91,6 +94,7 @@ struct pso_pointer make_string_like_thing( wint_t c, struct pso_pointer tail,
|
|||
tag, tobj->header.tag.bytes.mnemonic );
|
||||
}
|
||||
|
||||
|
||||
return pointer;
|
||||
}
|
||||
|
||||
|
|
@ -138,9 +142,11 @@ struct pso_pointer c_string_to_lisp_string( wchar_t *string ) {
|
|||
struct pso_pointer result = nil;
|
||||
|
||||
for ( int i = wcslen( string ) - 1; i >= 0; i-- ) {
|
||||
if ( iswprint( string[i] ) && string[i] != '"' ) {
|
||||
if ( string[i] != '"' ) {
|
||||
result = make_string( string[i], result );
|
||||
}
|
||||
} else {
|
||||
result = make_string( L'\\', make_string( string[i], result));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
@ -157,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'-' ) {
|
||||
if ( iswalpha( c ) || c == L'-' || c == L'*') {
|
||||
result = make_symbol( c, result );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue