Compiles again, now with bootstrap-layer print implemented, but not yet tested.

To get print implemented, I also had to implement a lot of other things.
This commit is contained in:
Simon Brooke 2026-03-31 15:05:44 +01:00
parent 2b22780ccf
commit 364d7d2c7b
23 changed files with 1616 additions and 57 deletions

View file

@ -13,6 +13,7 @@
#include "memory/pointer.h"
#define CONS_SIZE_CLASS 2
/**
* @brief A cons cell.

View file

@ -8,7 +8,13 @@
*/
#include "memory/node.h"
#include "memory/pointer.h"
#include "memory/pso.h"
#include "payloads/exception.h"
struct pso_pointer make_exception( struct pso_pointer message, struct pso_pointer frame_pointer, struct pso_pointer cause) {
// TODO: not yet implemented
return nil;
}

View file

@ -9,7 +9,6 @@
#ifndef __psse_payloads_exception_h
#define __psse_payloads_exception_h
#include <stdbool.h>
#include "memory/pointer.h"
@ -25,4 +24,6 @@ struct exception_payload {
struct pso_pointer cause;
};
struct pso_pointer make_exception( struct pso_pointer message, struct pso_pointer frame_pointer, struct pso_pointer cause);
#endif

39
src/c/payloads/integer.c Normal file
View file

@ -0,0 +1,39 @@
/**
* payloads/integer.c
*
* An integer. Doctrine here is that we are not implementing bignum arithmetic in
* the bootstrap layer; an integer is, for now, just a 64 bit integer.
*
* (c) 2026 Simon Brooke <simon@journeyman.cc>
* Licensed under GPL version 2.0, or, at your option, any later version.
*/
#include <stdint.h>
#include "memory/node.h"
#include "memory/pointer.h"
#include "memory/pso.h"
#include "memory/pso2.h"
#include "memory/tags.h"
#include "debug.h"
/**
* Allocate an integer cell representing this `value` and return a pso_pointer to it.
* @param value an integer value;
* @param more `nil`, or a pointer to the more significant cell(s) of this number.
* *NOTE* that if `more` is not `nil`, `value` *must not* exceed `MAX_INTEGER`.
*/
struct pso_pointer make_integer( int64_t value ) {
struct pso_pointer result = nil;
debug_print( L"Entering make_integer\n", DEBUG_ALLOC , 0);
result = allocate( INTEGERTAG, 2);
struct pso2 *cell = pointer_to_object( result );
cell->payload.integer.value = value;
debug_print( L"make_integer: returning\n", DEBUG_ALLOC , 0);
debug_dump_object( result, DEBUG_ALLOC, 0 );
return result;
}

View file

@ -23,5 +23,6 @@ struct integer_payload {
__int128_t value;
};
struct pso_pointer make_integer( int64_t value );
#endif

View file

@ -33,4 +33,6 @@ struct string_payload {
struct pso_pointer cdr;
};
struct pso_pointer make_string( wint_t c, struct pso_pointer tail );
#endif

View file

@ -0,0 +1,25 @@
/**
* payloads/string.c
*
* A string cell.
*
* (c) 2026 Simon Brooke <simon@journeyman.cc>
* Licensed under GPL version 2.0, or, at your option, any later version.
*/
#include <stdint.h>
/*
* wide characters
*/
#include <wchar.h>
#include <wctype.h>
#include "memory/node.h"
#include "memory/pointer.h"
#include "memory/pso2.h"
#include "memory/tags.h"
#include "ops/string_ops.h"
#include "ops/truth.h"