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

@ -181,7 +181,7 @@ struct cons_pointer c_type( struct cons_pointer pointer ) {
* strings made with NIL termination. The question is which should be
* fixed, and actually that's probably strings read by `read`. However,
* for now, it was easier to add a null character here. */
struct cons_pointer result = make_string( ( wchar_t ) 0, NIL );
struct cons_pointer result = make_string( ( char32_t ) 0, NIL );
struct cons_space_object *cell = &pointer2cell( pointer );
if ( cell->tag.value == VECTORPOINTTV ) {
@ -189,11 +189,11 @@ struct cons_pointer c_type( struct cons_pointer pointer ) {
for ( int i = TAGLENGTH - 1; i >= 0; i-- ) {
result =
make_string( ( wchar_t ) vec->header.tag.bytes[i], result );
make_string( ( char32_t ) vec->header.tag.bytes[i], result );
}
} else {
for ( int i = TAGLENGTH - 1; i >= 0; i-- ) {
result = make_string( ( wchar_t ) cell->tag.bytes[i], result );
result = make_string( ( char32_t ) cell->tag.bytes[i], result );
}
}
@ -518,11 +518,11 @@ struct cons_pointer make_write_stream( URL_FILE *output,
* Return a lisp keyword representation of this wide character string. In
* keywords, I am accepting only lower case characters and numbers.
*/
struct cons_pointer c_string_to_lisp_keyword( wchar_t *symbol ) {
struct cons_pointer c_string_to_lisp_keyword( char32_t *symbol ) {
struct cons_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 );
@ -535,7 +535,7 @@ struct cons_pointer c_string_to_lisp_keyword( wchar_t *symbol ) {
/**
* Return a lisp string representation of this wide character string.
*/
struct cons_pointer c_string_to_lisp_string( wchar_t *string ) {
struct cons_pointer c_string_to_lisp_string( char32_t *string ) {
struct cons_pointer result = NIL;
for ( int i = wcslen( string ) - 1; i >= 0; i-- ) {
@ -550,7 +550,7 @@ struct cons_pointer c_string_to_lisp_string( wchar_t *string ) {
/**
* Return a lisp symbol representation of this wide character string.
*/
struct cons_pointer c_string_to_lisp_symbol( wchar_t *symbol ) {
struct cons_pointer c_string_to_lisp_symbol( char32_t *symbol ) {
struct cons_pointer result = NIL;
for ( int i = wcslen( symbol ); i > 0; i-- ) {

View file

@ -773,7 +773,7 @@ struct cons_pointer make_function( struct cons_pointer src,
struct cons_pointer,
struct cons_pointer ) );
struct cons_pointer c_string_to_lisp_keyword( wchar_t *symbol );
struct cons_pointer c_string_to_lisp_keyword( char32_t *symbol );
struct cons_pointer make_lambda( struct cons_pointer args,
struct cons_pointer body );
@ -805,8 +805,8 @@ struct cons_pointer make_read_stream( URL_FILE * input,
struct cons_pointer make_write_stream( URL_FILE * output,
struct cons_pointer metadata );
struct cons_pointer c_string_to_lisp_string( wchar_t *string );
struct cons_pointer c_string_to_lisp_string( char32_t *string );
struct cons_pointer c_string_to_lisp_symbol( wchar_t *symbol );
struct cons_pointer c_string_to_lisp_symbol( char32_t *symbol );
#endif

View file

@ -29,7 +29,7 @@
#include "memory/vectorspace.h"
void dump_string_cell( URL_FILE *output, wchar_t *prefix,
void dump_string_cell( URL_FILE *output, char32_t *prefix,
struct cons_pointer pointer ) {
struct cons_space_object cell = pointer2cell( pointer );
if ( cell.payload.string.character == 0 ) {

View file

@ -19,7 +19,7 @@
#ifndef __dump_h
#define __dump_h
void dump_string_cell( URL_FILE * output, wchar_t *prefix,
void dump_string_cell( URL_FILE * output, char32_t *prefix,
struct cons_pointer pointer );
void dump_object( URL_FILE * output, struct cons_pointer pointer );