Right, I'm committing this session because I'm too cold and tired to go on.

It does not at present build (and it's going to take a good bit more work
before it does).
This commit is contained in:
Simon Brooke 2026-04-20 18:29:28 +01:00
parent f05d1af9d6
commit 6148d3699f
32 changed files with 364 additions and 309 deletions

View file

@ -69,12 +69,13 @@ uint32_t calculate_hash( wint_t c, struct pso_pointer ptr ) {
* char32_t in larger pso classes, so this function may be only for strings
* (and thus simpler).
*/
struct pso_pointer make_string_like_thing( wint_t c, struct pso_pointer tail,
struct pso_pointer make_string_like_thing( struct pso4 *frame_pointer,
wint_t c, struct pso_pointer tail,
char *tag ) {
struct pso_pointer pointer = tail;
if ( check_type( tail, tag ) || nilp( tail ) ) {
pointer = allocate( tag, CONS_SIZE_CLASS );
pointer = allocate( frame_pointer, tag, CONS_SIZE_CLASS );
struct pso2 *cell = pointer_to_object( pointer );
cell->payload.string.character = c;
@ -106,8 +107,9 @@ struct pso_pointer make_string_like_thing( wint_t c, struct pso_pointer tail,
* @param c the character to add (prepend);
* @param tail the string which is being built.
*/
struct pso_pointer make_string( wint_t c, struct pso_pointer tail ) {
return make_string_like_thing( c, tail, STRINGTAG );
struct pso_pointer make_string( struct pso4 *frame_pointer, wint_t c,
struct pso_pointer tail ) {
return make_string_like_thing( frame_pointer, c, tail, STRINGTAG );
}
/**
@ -118,8 +120,9 @@ struct pso_pointer make_string( wint_t c, struct pso_pointer tail ) {
* @param c the character to add (prepend);
* @param tail the keyword which is being built.
*/
struct pso_pointer make_keyword( wint_t c, struct pso_pointer tail ) {
return make_string_like_thing( c, tail, KEYTAG );
struct pso_pointer make_keyword( struct pso4 *frame_pointer, wint_t c,
struct pso_pointer tail ) {
return make_string_like_thing( frame_pointer, c, tail, KEYTAG );
}
/**
@ -130,22 +133,26 @@ struct pso_pointer make_keyword( wint_t c, struct pso_pointer tail ) {
* @param c the character to add (prepend);
* @param tail the symbol which is being built.
*/
struct pso_pointer make_symbol( wint_t c, struct pso_pointer tail ) {
return make_string_like_thing( c, tail, SYMBOLTAG );
struct pso_pointer make_symbol( struct pso4 *frame_pointer, wint_t c,
struct pso_pointer tail ) {
return make_string_like_thing( frame_pointer, c, tail, SYMBOLTAG );
}
/**
* Return a lisp string representation of this wide character string.
*/
struct pso_pointer c_string_to_lisp_string( char32_t *string ) {
struct pso_pointer c_string_to_lisp_string( struct pso4 *frame_pointer,
char32_t *string ) {
struct pso_pointer result = nil;
for ( int i = wcslen( string ) - 1; i >= 0; i-- ) {
if ( string[i] != '"' ) {
result = make_string( string[i], result );
result = make_string( frame_pointer, string[i], result );
} else {
result = make_string( L'\\', make_string( string[i], result ) );
result = make_string( frame_pointer, L'\\',
make_string( frame_pointer, string[i],
result ) );
}
}
@ -157,14 +164,15 @@ struct pso_pointer c_string_to_lisp_string( char32_t *string ) {
* 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( char32_t *symbol ) {
struct pso_pointer c_string_to_lisp_symbol( struct pso4 *frame_pointer,
char32_t *symbol ) {
struct pso_pointer result = nil;
for ( int i = wcslen( symbol ) - 1; i >= 0; i-- ) {
char32_t c = towlower( symbol[i] );
if ( iswalpha( c ) || c == L'-' || c == L'*' ) {
result = make_symbol( c, result );
result = make_symbol( frame_pointer, c, result );
}
}
@ -175,14 +183,15 @@ struct pso_pointer c_string_to_lisp_symbol( char32_t *symbol ) {
* Return a lisp keyword representation of this wide character string. In
* keywords, I am accepting only lower case characters and numbers.
*/
struct pso_pointer c_string_to_lisp_keyword( char32_t *symbol ) {
struct pso_pointer c_string_to_lisp_keyword( struct pso4 *frame_pointer,
char32_t *symbol ) {
struct pso_pointer result = nil;
for ( int i = wcslen( symbol ) - 1; i >= 0; i-- ) {
char32_t c = towlower( symbol[i] );
if ( iswalnum( c ) || c == L'-' ) {
result = make_keyword( c, result );
result = make_keyword( frame_pointer, c, result );
}
}