diff --git a/src/c/memory/pso2.h b/src/c/memory/pso2.h index 4cbad4a..0c36b29 100644 --- a/src/c/memory/pso2.h +++ b/src/c/memory/pso2.h @@ -12,8 +12,8 @@ #include -#include "../payloads/psse-string.h" #include "memory/header.h" +#include "payloads/character.h" #include "payloads/cons.h" #include "payloads/free.h" #include "payloads/function.h" @@ -22,9 +22,9 @@ #include "payloads/lambda.h" #include "payloads/nlambda.h" #include "payloads/read_stream.h" -#include "payloads/special.h" +#include "payloads/psse-string.h" #include "payloads/symbol.h" -// #include "payloads/time.h" +#include "payloads/time.h" #include "payloads/vector_pointer.h" #include "payloads/write_stream.h" @@ -38,13 +38,16 @@ struct pso2 { union { char bytes[16]; uint64_t words[2]; + struct character_payload character; struct cons_payload cons; struct free_payload free; struct function_payload function; struct integer_payload integer; struct lambda_payload lambda; -// struct special_payload special; + struct function_payload special; struct stream_payload stream; + struct string_payload string; +// TODO: this isn't working and I don't know why (error: field ‘time’ has incomplete type) // struct time_payload time; struct vectorp_payload vectorp; } payload; diff --git a/src/c/payloads/character.h b/src/c/payloads/character.h new file mode 100644 index 0000000..81a6dfa --- /dev/null +++ b/src/c/payloads/character.h @@ -0,0 +1,39 @@ +/** + * payloads/character.h + * + * A character object. + * + * Note that, instead of instantiating actual character objects, it would be + * possible to reserve one special page index, outside the normal page range, + * possibly even page 0, such that a character would be represented by a + * pso_pointer {node, special_page, character_code}. The special page wouldn't + * actually have to exist. This wouldn't prevent `nil` being 'the object at + * {n, 0, 0}, since the UTF character with the index 0 is NULL, which feels + * entirely compatible. UTF 1 is 'Start of heading', which is not used by + * anything I'm aware of these days, and is canonically not NULL, so I don't + * see why we should not continue to treat {n, 0, 1} as `t`. + * + * (c) 2026 Simon Brooke + * Licensed under GPL version 2.0, or, at your option, any later version. + */ + +#ifndef __psse_payloads_character_h +#define __psse_payloads_character_h +/* + * wide characters + */ +#include +#include + + +#define CHARTAG "CHR" +#define CHARTV 5392451 + +/** + * @brief a single character, as returned by the reader. + */ +struct character_payload { + wchar_t character; +}; + +#endif \ No newline at end of file diff --git a/src/c/payloads/special.h b/src/c/payloads/special.h index 4dcf7c2..b0ff91b 100644 --- a/src/c/payloads/special.h +++ b/src/c/payloads/special.h @@ -3,6 +3,9 @@ * * A special form. * + * No payload here; it would be identical to function_payload, q.v., so + * use that instead. + * * (c) 2026 Simon Brooke * Licensed under GPL version 2.0, or, at your option, any later version. */ @@ -21,25 +24,4 @@ #define SPECIALTAG "SFM" #define SPECIALTV 5064275 -// /** -// * @brief Payload of a special form cell. -// * -// * Currently identical to the payload of a function cell. -// * \see function_payload -// */ -// struct special_payload { -// /** -// * pointer to the source from which the special form was compiled, or NIL -// * if it is a primitive. -// */ -// struct pso_pointer meta; -// /** pointer to a function which takes a cons pointer (representing -// * its argument list) and a cons pointer (representing its environment) and a -// * stack frame (representing the previous stack frame) as arguments and returns -// * a cons pointer (representing its result). */ -// struct pso_pointer ( *executable ) ( struct pso4*, -// struct pso_pointer, -// struct pso_pointer ); -// }; - #endif diff --git a/src/c/payloads/time.h b/src/c/payloads/time.h index cc1ef0a..d808c0e 100644 --- a/src/c/payloads/time.h +++ b/src/c/payloads/time.h @@ -10,7 +10,9 @@ #ifndef __psse_payloads_cons_h #define __psse_payloads_cons_h +#include #include +#include #include "memory/pointer.h" @@ -26,7 +28,7 @@ * convenience, 14Bn years before 1st Jan 1970 (the UNIX epoch)) */ struct time_payload { - unsigned __int128_t value; + unsigned __int128 value; }; #endif diff --git a/utils_src/tagvalcalc/tvc b/utils_src/tagvalcalc/tvc index acd850a..374be1a 100755 Binary files a/utils_src/tagvalcalc/tvc and b/utils_src/tagvalcalc/tvc differ