Closes #18. Change to char32_t everywhere; builds fine, behaviour as before.

This commit is contained in:
Simon Brooke 2026-04-20 12:10:38 +01:00
parent 812a1be7d9
commit c59825d7fe
33 changed files with 116 additions and 76 deletions

View file

@ -41,5 +41,6 @@ struct pso_pointer lisp_bind(
struct pso_pointer c_bind( struct pso_pointer key,
struct pso_pointer value,
struct pso_pointer store ) {
// todo: issue #21: must have stack frame passed in.
return c_cons( c_cons( key, value ), store );
}

View file

@ -48,6 +48,7 @@ void int_handler( int dummy ) {
* Very simple read/eval/print loop for bootstrapping.
*/
void c_repl( bool show_prompt ) {
// todo: issue #21: must have stack frame passed in.
signal( SIGINT, int_handler );
debug_print( L"Entered repl\n", DEBUG_REPL, 0 );

View file

@ -13,7 +13,7 @@
#define SRC_C_OPS_REPL_H_
// todo: issue #21: must have stack frame passed in.
void c_repl( );

View file

@ -36,6 +36,7 @@
* the argument was not a sequence.
*/
struct pso_pointer c_reverse( struct pso_pointer sequence ) {
// todo: issue #21: must have stack frame passed in.
struct pso_pointer result = nil;
for ( struct pso_pointer cursor = sequence; !nilp( sequence );

View file

@ -66,7 +66,7 @@ uint32_t calculate_hash( wint_t c, struct pso_pointer ptr ) {
* pointer to next is nil.
*
* NOTE THAT: in 0.1.X, we may allocate symbols and keywords as arrays of
* wchar_t in larger pso classes, so this function may be only for strings
* 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,
@ -138,7 +138,7 @@ struct pso_pointer make_symbol( wint_t c, struct pso_pointer tail ) {
/**
* Return a lisp string representation of this wide character string.
*/
struct pso_pointer c_string_to_lisp_string( wchar_t *string ) {
struct pso_pointer c_string_to_lisp_string( char32_t *string ) {
struct pso_pointer result = nil;
for ( int i = wcslen( string ) - 1; i >= 0; i-- ) {
@ -157,11 +157,11 @@ struct pso_pointer c_string_to_lisp_string( wchar_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( wchar_t *symbol ) {
struct pso_pointer c_string_to_lisp_symbol( char32_t *symbol ) {
struct pso_pointer result = nil;
for ( int i = wcslen( symbol ) - 1; i >= 0; i-- ) {
wchar_t c = towlower( symbol[i] );
char32_t c = towlower( symbol[i] );
if ( iswalpha( c ) || c == L'-' || c == L'*' ) {
result = make_symbol( c, result );
@ -175,11 +175,11 @@ struct pso_pointer c_string_to_lisp_symbol( wchar_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( wchar_t *symbol ) {
struct pso_pointer c_string_to_lisp_keyword( char32_t *symbol ) {
struct pso_pointer result = nil;
for ( int i = wcslen( symbol ) - 1; i >= 0; i-- ) {
wchar_t c = towlower( symbol[i] );
char32_t c = towlower( symbol[i] );
if ( iswalnum( c ) || c == L'-' ) {
result = make_keyword( c, result );

View file

@ -13,6 +13,7 @@
/*
* wide characters
*/
#include <uchar.h>
#include <wchar.h>
#include <wctype.h>
@ -25,10 +26,10 @@ struct pso_pointer make_keyword( wint_t c, struct pso_pointer tail );
struct pso_pointer make_symbol( wint_t c, struct pso_pointer tail );
struct pso_pointer c_string_to_lisp_string( wchar_t *string );
struct pso_pointer c_string_to_lisp_string( char32_t *string );
struct pso_pointer c_string_to_lisp_keyword( wchar_t *symbol );
struct pso_pointer c_string_to_lisp_keyword( char32_t *symbol );
struct pso_pointer c_string_to_lisp_symbol( wchar_t *symbol );
struct pso_pointer c_string_to_lisp_symbol( char32_t *symbol );
#endif