Added character as a first class object. Stepped through a run; it all works.
This commit is contained in:
parent
a8b4a6e69d
commit
e3f922a8bf
5 changed files with 52 additions and 26 deletions
39
src/c/payloads/character.h
Normal file
39
src/c/payloads/character.h
Normal file
|
|
@ -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 <simon@journeyman.cc>
|
||||
* 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 <wchar.h>
|
||||
#include <wctype.h>
|
||||
|
||||
|
||||
#define CHARTAG "CHR"
|
||||
#define CHARTV 5392451
|
||||
|
||||
/**
|
||||
* @brief a single character, as returned by the reader.
|
||||
*/
|
||||
struct character_payload {
|
||||
wchar_t character;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -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 <simon@journeyman.cc>
|
||||
* 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
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@
|
|||
#ifndef __psse_payloads_cons_h
|
||||
#define __psse_payloads_cons_h
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue