Initialisation almost succeeds. nil and t are successfully instantiated.
We then go into a mess of exceptions which trigger exceptions until we run out of allocatable memory, but all those exceptions and stack frames are correctly allocated and torn down again afterwards, so.... sort of good?
This commit is contained in:
commit
ba985474f6
31 changed files with 869 additions and 199 deletions
|
|
@ -73,7 +73,7 @@ struct pso_pointer make_string_like_thing( wint_t c, struct pso_pointer tail,
|
|||
char *tag ) {
|
||||
struct pso_pointer pointer = nil;
|
||||
|
||||
if ( check_type( tail, tag ) || check_tag( tail, NILTV ) ) {
|
||||
if ( check_type( tail, tag ) || nilp(tail) ) {
|
||||
pointer = allocate( tag, CONS_SIZE_CLASS );
|
||||
struct pso2 *cell = pointer_to_object( pointer );
|
||||
|
||||
|
|
@ -85,9 +85,10 @@ struct pso_pointer make_string_like_thing( wint_t c, struct pso_pointer tail,
|
|||
debug_println( DEBUG_ALLOC );
|
||||
} else {
|
||||
// \todo should throw an exception!
|
||||
struct pso2* tobj = pointer_to_object( tail);
|
||||
debug_printf( DEBUG_ALLOC, 0,
|
||||
L"Warning: only %4.4s can be prepended to %4.4s\n",
|
||||
tag, tag );
|
||||
L"Warning: %3.3s cannot be prepended to %3.3s\n",
|
||||
tag, tobj->header.tag.bytes.mnemonic );
|
||||
}
|
||||
|
||||
return pointer;
|
||||
|
|
@ -145,6 +146,25 @@ struct pso_pointer c_string_to_lisp_string( wchar_t *string ) {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a lisp symbol representation of this wide character string. In
|
||||
* symbols, I am accepting only lower case characters.
|
||||
*/
|
||||
struct pso_pointer c_string_to_lisp_symbol( wchar_t *symbol ) {
|
||||
struct pso_pointer result = nil;
|
||||
|
||||
for ( int i = wcslen( symbol ) - 1; i >= 0; i-- ) {
|
||||
wchar_t c = towlower( symbol[i] );
|
||||
|
||||
if ( iswalpha( c ) || c == L'-' ) {
|
||||
result = make_symbol( c, result );
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a lisp keyword representation of this wide character string. In
|
||||
* keywords, I am accepting only lower case characters and numbers.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue