From 2b22780ccfd98970396c403f96f473cc65e86c84 Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Mon, 30 Mar 2026 21:49:08 +0100 Subject: [PATCH] This once again does NOT compile. I've done work on macros; they don't work yet.. --- src/c/io/fopen.h | 2 +- src/c/io/print.c | 122 +++++++++++++++++ src/c/io/print.h | 19 +++ src/c/io/read.h | 0 src/c/memory/page.c | 4 + src/c/memory/pso.c | 19 +-- src/c/memory/pso.h | 2 +- src/c/memory/pso2.h | 2 + src/c/memory/tags.h | 125 ++++++++++++++++++ src/c/ops/eval.c | 2 + src/c/payloads/cons.c | 12 +- src/c/payloads/cons.h | 5 - src/c/payloads/exception.c | 7 - src/c/payloads/exception.h | 5 - src/c/payloads/free.h | 6 - src/c/payloads/function.h | 8 -- src/c/payloads/hashtable.h | 7 - src/c/payloads/integer.h | 3 - src/c/payloads/keyword.h | 6 - src/c/payloads/mutex.h | 8 -- src/c/payloads/namespace.h | 7 - src/c/payloads/nlambda.h | 6 - src/c/payloads/psse-string.h | 7 - src/c/payloads/read_stream.h | 6 - src/c/payloads/special.h | 2 - src/c/payloads/stack.h | 4 - src/c/payloads/symbol.h | 7 - src/c/payloads/vector_pointer.c | 18 --- src/c/payloads/vector_pointer.h | 2 - src/c/payloads/write_stream.h | 9 -- {archive/unit-tests => unit-tests}/add.sh | 0 .../allocation-tests/allocation-tester.sh | 0 .../allocation-tests/allocation-tests.csv | 0 .../allocation-tests/allocation-tests.ods | Bin .../allocation-tests/feature-2.test.tmp | 0 .../allocation-tests/grep.bb | 0 .../allocation-tests/test-forms | 0 {archive/unit-tests => unit-tests}/append.sh | 0 {archive/unit-tests => unit-tests}/apply.sh | 0 {archive/unit-tests => unit-tests}/assoc.sh | 0 .../unit-tests => unit-tests}/bignum-add.sh | 0 .../unit-tests => unit-tests}/bignum-expt.sh | 0 .../unit-tests => unit-tests}/bignum-print.sh | 0 .../bignum-subtract.sh | 0 {archive/unit-tests => unit-tests}/bignum.sh | 0 .../unit-tests => unit-tests}/complex-list.sh | 0 {archive/unit-tests => unit-tests}/cond.sh | 0 .../unit-tests => unit-tests}/empty-list.sh | 0 .../unit-tests => unit-tests}/empty-string.sh | 0 {archive/unit-tests => unit-tests}/equal.sh | 0 .../unit-tests => unit-tests}/eval-integer.sh | 0 .../eval-quote-sexpr.sh | 0 .../eval-quote-symbol.sh | 0 .../unit-tests => unit-tests}/eval-real.sh | 0 .../unit-tests => unit-tests}/eval-string.sh | 0 {archive/unit-tests => unit-tests}/fred.sh | 0 .../integer-allocation.sh | 0 {archive/unit-tests => unit-tests}/integer.sh | 0 .../unit-tests => unit-tests}/interpreter.sh | 0 {archive/unit-tests => unit-tests}/lambda.sh | 0 {archive/unit-tests => unit-tests}/let.sh | 0 .../unit-tests => unit-tests}/list-test.sh | 0 .../unit-tests => unit-tests}/many-args.sh | 0 {archive/unit-tests => unit-tests}/map.sh | 0 {archive/unit-tests => unit-tests}/mapcar.sh | 0 {archive/unit-tests => unit-tests}/memberp.sh | 0 {archive/unit-tests => unit-tests}/memory.sh | 0 .../unit-tests => unit-tests}/multiply.sh | 0 {archive/unit-tests => unit-tests}/nil.sh | 0 {archive/unit-tests => unit-tests}/nlambda.sh | 0 .../path-notation.sh | 0 {archive/unit-tests => unit-tests}/progn.sh | 0 {archive/unit-tests => unit-tests}/quote.sh | 0 .../unit-tests => unit-tests}/quoted-list.sh | 0 .../ratio-addition.sh | 0 .../unit-tests => unit-tests}/recursion.sh | 0 {archive/unit-tests => unit-tests}/reverse.sh | 0 .../unit-tests => unit-tests}/simple-list.sh | 0 {archive/unit-tests => unit-tests}/slurp.sh | 0 .../string-allocation.sh | 0 .../unit-tests => unit-tests}/string-cons.sh | 0 .../string-with-spaces.sh | 0 .../unit-tests => unit-tests}/subtract.sh | 0 {archive/unit-tests => unit-tests}/try.sh | 0 {archive/unit-tests => unit-tests}/varargs.sh | 0 .../wide-character.sh | 0 86 files changed, 279 insertions(+), 153 deletions(-) create mode 100644 src/c/io/print.c create mode 100644 src/c/io/print.h create mode 100644 src/c/io/read.h create mode 100644 src/c/memory/tags.h delete mode 100644 src/c/payloads/vector_pointer.c rename {archive/unit-tests => unit-tests}/add.sh (100%) rename {archive/unit-tests => unit-tests}/allocation-tests/allocation-tester.sh (100%) rename {archive/unit-tests => unit-tests}/allocation-tests/allocation-tests.csv (100%) rename {archive/unit-tests => unit-tests}/allocation-tests/allocation-tests.ods (100%) rename {archive/unit-tests => unit-tests}/allocation-tests/feature-2.test.tmp (100%) rename {archive/unit-tests => unit-tests}/allocation-tests/grep.bb (100%) rename {archive/unit-tests => unit-tests}/allocation-tests/test-forms (100%) rename {archive/unit-tests => unit-tests}/append.sh (100%) rename {archive/unit-tests => unit-tests}/apply.sh (100%) rename {archive/unit-tests => unit-tests}/assoc.sh (100%) rename {archive/unit-tests => unit-tests}/bignum-add.sh (100%) rename {archive/unit-tests => unit-tests}/bignum-expt.sh (100%) rename {archive/unit-tests => unit-tests}/bignum-print.sh (100%) rename {archive/unit-tests => unit-tests}/bignum-subtract.sh (100%) rename {archive/unit-tests => unit-tests}/bignum.sh (100%) rename {archive/unit-tests => unit-tests}/complex-list.sh (100%) rename {archive/unit-tests => unit-tests}/cond.sh (100%) rename {archive/unit-tests => unit-tests}/empty-list.sh (100%) rename {archive/unit-tests => unit-tests}/empty-string.sh (100%) rename {archive/unit-tests => unit-tests}/equal.sh (100%) rename {archive/unit-tests => unit-tests}/eval-integer.sh (100%) rename {archive/unit-tests => unit-tests}/eval-quote-sexpr.sh (100%) rename {archive/unit-tests => unit-tests}/eval-quote-symbol.sh (100%) rename {archive/unit-tests => unit-tests}/eval-real.sh (100%) rename {archive/unit-tests => unit-tests}/eval-string.sh (100%) rename {archive/unit-tests => unit-tests}/fred.sh (100%) rename {archive/unit-tests => unit-tests}/integer-allocation.sh (100%) rename {archive/unit-tests => unit-tests}/integer.sh (100%) rename {archive/unit-tests => unit-tests}/interpreter.sh (100%) rename {archive/unit-tests => unit-tests}/lambda.sh (100%) rename {archive/unit-tests => unit-tests}/let.sh (100%) rename {archive/unit-tests => unit-tests}/list-test.sh (100%) rename {archive/unit-tests => unit-tests}/many-args.sh (100%) rename {archive/unit-tests => unit-tests}/map.sh (100%) rename {archive/unit-tests => unit-tests}/mapcar.sh (100%) rename {archive/unit-tests => unit-tests}/memberp.sh (100%) rename {archive/unit-tests => unit-tests}/memory.sh (100%) rename {archive/unit-tests => unit-tests}/multiply.sh (100%) rename {archive/unit-tests => unit-tests}/nil.sh (100%) rename {archive/unit-tests => unit-tests}/nlambda.sh (100%) rename {archive/unit-tests => unit-tests}/path-notation.sh (100%) rename {archive/unit-tests => unit-tests}/progn.sh (100%) rename {archive/unit-tests => unit-tests}/quote.sh (100%) rename {archive/unit-tests => unit-tests}/quoted-list.sh (100%) rename {archive/unit-tests => unit-tests}/ratio-addition.sh (100%) rename {archive/unit-tests => unit-tests}/recursion.sh (100%) rename {archive/unit-tests => unit-tests}/reverse.sh (100%) rename {archive/unit-tests => unit-tests}/simple-list.sh (100%) rename {archive/unit-tests => unit-tests}/slurp.sh (100%) rename {archive/unit-tests => unit-tests}/string-allocation.sh (100%) rename {archive/unit-tests => unit-tests}/string-cons.sh (100%) rename {archive/unit-tests => unit-tests}/string-with-spaces.sh (100%) rename {archive/unit-tests => unit-tests}/subtract.sh (100%) rename {archive/unit-tests => unit-tests}/try.sh (100%) rename {archive/unit-tests => unit-tests}/varargs.sh (100%) rename {archive/unit-tests => unit-tests}/wide-character.sh (100%) diff --git a/src/c/io/fopen.h b/src/c/io/fopen.h index 5f87bd2..5bffe92 100644 --- a/src/c/io/fopen.h +++ b/src/c/io/fopen.h @@ -1,5 +1,5 @@ /* - * fopen.h + * io/fopen.h * * adapted from https://curl.haxx.se/libcurl/c/fopen.html. * diff --git a/src/c/io/print.c b/src/c/io/print.c new file mode 100644 index 0000000..227c958 --- /dev/null +++ b/src/c/io/print.c @@ -0,0 +1,122 @@ +/** + * io/print.c + * + * Post Scarcity Software Environment: print. + * + * Print basic Lisp objects..This is :bootstrap layer print; it needs to be + * able to print characters, symbols, integers, lists and dotted pairs. I + * don't think it needs to be able to print anything else. + * + * (c) 2026 Simon Brooke + * Licensed under GPL version 2.0, or, at your option, any later version. + */ + +#include +#include +#include +#include +/* + * wide characters + */ +#include +#include + +#include "io/fopen.h" + +#include "memory/pointer.h" +#include "memory/pso.h" +#include "memory/pso2.h" +#include "memory/tags.h" + +#include "payloads/character.h" +#include "payloads/cons.h" +#include "payloads/integer.h" + +struct pso_pointer in_print( pso_pointer p, URL_FILE * stream); + +struct pso_pointer print_list_content( pso_pointer p, URL_FILE * stream) { + struct pso_pointer result = nil; + + if (consp(p)) { + for (; consp( p); p = cdr(p)) { + stuct pso2* object = pointer_to_object(cursor); + + result = in_print( object->payload.cons.car, stream); + + if (exceptionp(result)) break; + + switch (get_tag_value(object->payload.cons.cdr)) { + case NILTV : + break; + case CONSTV : + url_fputwc( L'\ ', output ); + break; + default : + url_fputws( L" . ", output); + result = in_print( object->payload.cons.cdr, stream); + } + + } + + struct pso_pointer cdr = object->payload.cons.cdr; + + switchb( get) + } else { + // TODO: return exception + } + + return result; +} + +struct pso_pointer in_print( pso_pointer p, URL_FILE * stream) { + stuct pso2* object = pointer_to_object(p); + struct pso_pointer result = nil; + + if )object != NULL) { + switch (get_tag_value( p)) { + case CHARACTERTV : + url_fputwc( object->payload.character.character, output); + break; + case CONSTV : + url_fputwc( L'\(', output ); + result = print_list_content( object, stream); + url_fputwc( L'\)', output ); + break; + case INTEGERTV : + fwprintf( output, "%d", (int64_t)(object->payload.integer.value)); + break; + case TRUETV : + url_fputwc( L'\t', output ); + break; + case NILTV : + url_fputws( L"nil", output ); + default : + // TODO: return exception + } + } else { + // TODO: return exception + } + + return result; +} + +/** + * @brief Simple print for bootstrap layer. + * + * @param p pointer to the object to print. + * @param stream if a pointer to an open write stream, print to there. + * @return struct pso_pointer `nil`, or an exception if some erroe occurred. + */ +struct pso_pointer print( pso_pointer p, pso_pointer stream) { + URL_FILE *output = writep( stream) ? + pointer_to_object( stream )->payload.stream.stream: + stdout; + + if ( writep( stream)) { inc_ref( stream); } + + struct pso_pointer result = in_print(p, output); + + if ( writep( stream)) { dec_ref( stream); } + + return result; +} diff --git a/src/c/io/print.h b/src/c/io/print.h new file mode 100644 index 0000000..9aa793f --- /dev/null +++ b/src/c/io/print.h @@ -0,0 +1,19 @@ +/** + * io/print.c + * + * Post Scarcity Software Environment: print. + * + * Print basic Lisp objects..This is :bootstrap layer print; it needs to be + * able to print characters, symbols, integers, lists and dotted pairs. I + * don't think it needs to be able to print anything else. + * + * (c) 2026 Simon Brooke + * Licensed under GPL version 2.0, or, at your option, any later version. + */ + +#ifndef __psse_io_print_h +#define __psse_io_print_h + +struct pso_pointer print( pso_pointer p, pso_pointer stream); + +#endif \ No newline at end of file diff --git a/src/c/io/read.h b/src/c/io/read.h new file mode 100644 index 0000000..e69de29 diff --git a/src/c/memory/page.c b/src/c/memory/page.c index b0afe4f..2d3319d 100644 --- a/src/c/memory/page.c +++ b/src/c/memory/page.c @@ -11,7 +11,9 @@ #include #include #include + #include "debug.h" + #include "memory/memory.h" #include "memory/node.h" #include "memory/page.h" @@ -29,6 +31,8 @@ #include "memory/psod.h" #include "memory/psoe.h" #include "memory/psof.h" +#include "memory/tags.h" + #include "payloads/free.h" /** diff --git a/src/c/memory/pso.c b/src/c/memory/pso.c index 6982ca8..a3a48e7 100644 --- a/src/c/memory/pso.c +++ b/src/c/memory/pso.c @@ -24,6 +24,8 @@ #include "memory/page.h" #include "memory/pointer.h" #include "memory/pso.h" +#include "memory/tags.h" + #include "ops/truth.h" /** @@ -171,20 +173,3 @@ void lock_object( struct pso_pointer pointer ) { } -/** - * @brief Get the numeric value of the tag bytes of the object indicated - * by this pointer - * - * @param pointer a pointer to an object. - * @return the tag value of the object indicated. - */ -uint32_t get_tag_value( struct pso_pointer pointer ) { - struct pso2 *object = pointer_to_object( pointer ); - uint32_t result = ( object->header.tag.value & 0xffffff ); - - if ( vectorpointp( pointer ) ) { - result = ( object->payload.vectorp.tag.value & 0xffffff ); - } - - return result; -} diff --git a/src/c/memory/pso.h b/src/c/memory/pso.h index 1ce7bf2..3d74fe7 100644 --- a/src/c/memory/pso.h +++ b/src/c/memory/pso.h @@ -251,6 +251,6 @@ struct pso_pointer inc_ref( struct pso_pointer pointer ); void lock_object( struct pso_pointer pointer); -uint32_t get_tag_value( struct pso_pointer pointer); +// uint32_t get_tag_value( struct pso_pointer pointer); #endif diff --git a/src/c/memory/pso2.h b/src/c/memory/pso2.h index 0c36b29..e0080cb 100644 --- a/src/c/memory/pso2.h +++ b/src/c/memory/pso2.h @@ -13,6 +13,8 @@ #include #include "memory/header.h" +#include "memory/tags.h" + #include "payloads/character.h" #include "payloads/cons.h" #include "payloads/free.h" diff --git a/src/c/memory/tags.h b/src/c/memory/tags.h new file mode 100644 index 0000000..f513699 --- /dev/null +++ b/src/c/memory/tags.h @@ -0,0 +1,125 @@ +/** + * memory/tags.h + * + * Tags for all page space and vector objects known to the bootstrap layer. + * + * All macros! + * + * (c) 2026 Simon Brooke + * Licensed under GPL version 2.0, or, at your option, any later version. + */ + +#ifndef __psse_memory_tags_h +#define __psse_memory_tags_h + +#define TAGLENGTH 3 + +#define CONSTAG "CNS" +#define EXCEPTIONTAG "EXP" +#define FREETAG "FRE" +#define FUNCTIONTAG "FUN" +#define HASHTAG "HTB" +#define INTEGERTAG "INT" +#define KEYTAG "KEY" +#define LAMBDATAG "LMD" +#define LOOPTAG "LOP" +#define LAZYCONSTAG "LZY" +#define LAZYSTRTAG "LZS" +#define LAZYWRKRTAG "WRK" +#define MUTEXTAG "MTX" +#define NAMESPACETAG "NSP" +#define NILTAG "NIL" +#define NLAMBDATAG "NLM" +#define RATIOTAG "RAT" +#define READTAG "RED" +#define REALTAG "REA" +#define SPECIALTAG "SFM" +#define STACKTAG "STK" +#define STRINGTAG "STR" +#define SYMBOLTAG "SYM" +#define TIMETAG "TIM" +#define TRUETAG "TRU" +#define VECTORTAG "VEC" +#define VECTORPOINTTAG "VSP" +#define WRITETAG "WRT" + +// TODO: all these tag values are WRONG, recalculate! + +#define CONSTV 5459523 +#define EXCEPTIONTV 5265477 +#define FREETV 4543046 +#define FUNCTIONTV 5133638 +#define HASHTV 4346952 +#define INTEGERTV 5525065 +#define KEYTV 5850443 +#define LAMBDATV 4345164 +#define LOOPTV 5263180 +#define MUTEXTV 5788749 +#define NAMESPACETV 5264206 +#define NILTV 4999502 +#define NLAMBDATV 5065806 +#define RATIOTV 5521746 +#define READTV 4474194 +#define REALTV 4277586 +#define SPECIALTV 5064275 +#define STACKTV 4936787 +#define STRINGTV 5395539 +#define SYMBOLTV 5069139 +#define TIMETV 5065044 +#define TRUETV 5591636 +#define VECTORTV 4408662 +#define VECTORPOINTTV 5264214 +#define WRITETV 5264214 + +#define consp(p) (check_tag(p,CONSTV)) +#define exceptionp(p) (check_tag(p,EXCEPTIONTV)) +#define freep(p) (check_tag(p,FREETV)) +#define functionp(p) (check_tag(p,FUNCTIONTV)) +#define integerp(p) (check_tag(p,INTEGERTV)) +#define keywordp(p) (check_tag(p,KEYTV)) +#define lambdap(p) (check_tag(p,LAMBDATV)) +#define loopp(p) (check_tag(p,LOOPTV)) +#define namespacep(p)(check_tag(p,NAMESPACETV)) +// the version of nilp in ops/truth.c is better than this, because it does not +// require a fetch, and will see nils curated by other nodes as nil. +// #define nilp(p) (check_tag(p,NILTV)) +#define numberp(p) (check_tag(p,INTEGERTV)||check_tag(p,RATIOTV)||check_tag(p,REALTV)) +#define ratiop(p) (check_tag(p,RATIOTV)) +#define readp(p) (check_tag(p,READTV)) +#define realp(p) (check_tag(p,REALTV)) +#define sequencep(p) (check_tag(p,CONSTV)||check_tag(p,STRINGTV)||check_tag(p,SYMBOLTV)) +#define specialp(p) (check_tag(p,SPECIALTV)) +#define streamp(p) (check_tag(p,READTV)||check_tag(p,WRITETV)) +#define stringp(p) (check_tag(p,STRINGTV)) +#define symbolp(p) (check_tag(p,SYMBOLTV)) +#define timep(p) (check_tag(p,TIMETV)) +// the version of truep in ops/truth.c is better than this, because it does not +// require a fetch, and will see ntsils curated by other nodes as t. +// #define tp(p) (check_tag(p,TRUETV)) +// #define truep(p) ( !check_tag(p,NILTV)) +#define vectorpointp(p) (check_tag(p,VECTORPOINTTV)) +#define vectorp(p) (check_tag(p,VECTORTV)) +#define writep(p) (check_tag(p,WRITETV)) + +/** + * @brief return the numerical value of the tag of the object indicated by + * pointer `p`. + * + * @param p must be a struct pso_pointer, indicating the appropriate object. + * + * @return the numerical value of the tag, as a uint32_t. + */ +#define get_tag_value(p)((pointer_to_object(p)->header.tag.value) & 0xffffff) + +/** + * @brief check that the tag of the object indicated by this poiner has this + * value. + * + * @param p must be a struct pso_pointer, indicating the appropriate object. + * @param v should be an integer, ideally uint32_t, the expected value of a tag. + * + * @return true if the tag at p matches v, else false. + */ +#define check_tag(p,v) (get_tag_value(p) == v) + +#endif \ No newline at end of file diff --git a/src/c/ops/eval.c b/src/c/ops/eval.c index 5e20b71..17e4c15 100644 --- a/src/c/ops/eval.c +++ b/src/c/ops/eval.c @@ -11,6 +11,8 @@ #include "memory/pointer.h" #include "memory/pso4.h" +#include "memory/tags.h" + #include "payloads/cons.h" #include "payloads/exception.h" #include "payloads/function.h" diff --git a/src/c/payloads/cons.c b/src/c/payloads/cons.c index 00219e7..2417385 100644 --- a/src/c/payloads/cons.c +++ b/src/c/payloads/cons.c @@ -13,6 +13,7 @@ #include "memory/pointer.h" #include "memory/pso.h" #include "memory/pso2.h" +#include "memory/tags.h" #include "payloads/cons.h" /** @@ -36,17 +37,6 @@ struct pso_pointer cons( struct pso_pointer car, struct pso_pointer cdr ) { return result; } -/** - * @brief return true if `ptr` indicates a cons cell, else false. - * - * @param ptr a pointer. - * @return true if `ptr` indicates a cons cell. - * @return false otherwise - */ -bool consp( struct pso_pointer ptr ) { - // TODO: make it actually work! - return false; -} /** * @brief return the car of this cons cell. diff --git a/src/c/payloads/cons.h b/src/c/payloads/cons.h index 91d1f1b..48e6782 100644 --- a/src/c/payloads/cons.h +++ b/src/c/payloads/cons.h @@ -13,11 +13,6 @@ #include "memory/pointer.h" -/** - * An ordinary cons cell: - */ -#define CONSTAG "CNS" -#define CONSTV 5459523 /** * @brief A cons cell. diff --git a/src/c/payloads/exception.c b/src/c/payloads/exception.c index 507b804..b61f401 100644 --- a/src/c/payloads/exception.c +++ b/src/c/payloads/exception.c @@ -12,10 +12,3 @@ #include "memory/pso.h" #include "payloads/exception.h" -/** - * @param p a pointer to an object. - * @return true if that object is an exception, else false. - */ -bool exceptionp( struct pso_pointer p ) { - return ( get_tag_value( p ) == EXCEPTIONTV ); -} diff --git a/src/c/payloads/exception.h b/src/c/payloads/exception.h index 38314ee..c522f96 100644 --- a/src/c/payloads/exception.h +++ b/src/c/payloads/exception.h @@ -13,9 +13,6 @@ #include "memory/pointer.h" -#define EXCEPTIONTAG "EXP" -#define EXCEPTIONTV 5265477 - /** * @brief An exception; required three pointers, so use object of size class 3. */ @@ -28,6 +25,4 @@ struct exception_payload { struct pso_pointer cause; }; -bool exceptionp( struct pso_pointer p ); - #endif diff --git a/src/c/payloads/free.h b/src/c/payloads/free.h index 947a3e4..cf4706f 100644 --- a/src/c/payloads/free.h +++ b/src/c/payloads/free.h @@ -12,12 +12,6 @@ #include "memory/pointer.h" -/** - * @brief Tag for an unassigned object; may be of any size class. - */ -#define FREETAG "FRE" -#define FREETV 4543046 - /** * @brief An unassigned object, on a freelist; may be of any size class. * diff --git a/src/c/payloads/function.h b/src/c/payloads/function.h index bd02836..ea54051 100644 --- a/src/c/payloads/function.h +++ b/src/c/payloads/function.h @@ -13,14 +13,6 @@ #include "memory/pointer.h" #include "memory/pso4.h" -/** - * @brief Tag for an ordinary Lisp function - one whose arguments are pre-evaluated. - * \see LAMBDATAG for interpretable functions. - * \see SPECIALTAG for functions whose arguments are not pre-evaluated. - */ -#define FUNCTIONTAG "FUN" -#define FUNCTIONTV 5133638 - /** * @brief Payload of a function cell. * `source` points to the source from which the function was compiled, or NIL diff --git a/src/c/payloads/hashtable.h b/src/c/payloads/hashtable.h index b235b0b..6cf8144 100644 --- a/src/c/payloads/hashtable.h +++ b/src/c/payloads/hashtable.h @@ -32,13 +32,6 @@ #include "memory/pointer.h" -/** - * @brief Tag for an ordinary Lisp hashtable - one whose contents are immutable. - * \see NAMESPACETAG for mutable hashtables. - */ -#define HASHTABLETAG "HTB" -#define HASHTABLETV 4346952 - /** * The payload of a hashtable. The number of buckets is assigned at run-time, * and is stored in n_buckets. Each bucket is something ASSOC can consume: diff --git a/src/c/payloads/integer.h b/src/c/payloads/integer.h index 00ee92d..025882c 100644 --- a/src/c/payloads/integer.h +++ b/src/c/payloads/integer.h @@ -12,9 +12,6 @@ #include -#define INTEGERTAG "INT" -#define INTEGERTV 5525065 - /** * @brief An integer . * diff --git a/src/c/payloads/keyword.h b/src/c/payloads/keyword.h index de89749..4728066 100644 --- a/src/c/payloads/keyword.h +++ b/src/c/payloads/keyword.h @@ -12,12 +12,6 @@ #include "memory/pointer.h" -/** - * Tag for a keyword - an interned, self-evaluating string. - */ -#define KEYTAG "KEY" -#define KEYTV 5850443 - /* TODO: for now, Keyword shares a payload with String, but this may change. * Strings are of indefinite length, but keywords are really not, and might * fit into any size class. */ diff --git a/src/c/payloads/mutex.h b/src/c/payloads/mutex.h index f158b0d..5b6346f 100644 --- a/src/c/payloads/mutex.h +++ b/src/c/payloads/mutex.h @@ -14,14 +14,6 @@ #include "memory/pointer.h" -/** - * @brief Tag for mutex cell. mutexes are thread-safe locks, required by - * mutable objects. - * \see FUNCTIONTAG. - */ -#define MUTEXTAG "MTX" -#define MUTEXTV 5788749 - /** * @brief payload for mutex objects. * diff --git a/src/c/payloads/namespace.h b/src/c/payloads/namespace.h index 229c8e4..cba0112 100644 --- a/src/c/payloads/namespace.h +++ b/src/c/payloads/namespace.h @@ -35,13 +35,6 @@ #include "memory/pointer.h" -/** - * @brief Tag for a Lisp namespace - a hashtable whose contents are mutable. - * \see HASHTABLETAG for mutable hashtables. - */ -#define NAMESPACETAG "NSP" -#define NAMESPACETV 5264206 - /** * The payload of a namespace. The number of buckets is assigned at run-time, * and is stored in n_buckets. Each bucket is something ASSOC can consume: diff --git a/src/c/payloads/nlambda.h b/src/c/payloads/nlambda.h index 1f0771f..d82d2e3 100644 --- a/src/c/payloads/nlambda.h +++ b/src/c/payloads/nlambda.h @@ -12,12 +12,6 @@ #include "memory/pointer.h" -/** - * An ordinary nlambda cell: - */ -#define NLAMBDATAG "NLM" -#define NLAMBDATV 5065806 - /* nlambda shares a payload with lambda */ #endif diff --git a/src/c/payloads/psse-string.h b/src/c/payloads/psse-string.h index c08690d..90d87da 100644 --- a/src/c/payloads/psse-string.h +++ b/src/c/payloads/psse-string.h @@ -17,13 +17,6 @@ #include "memory/pointer.h" - -/** - * @brief Tag for string of characters, organised as a linked list. - */ -#define STRINGTAG "STR" -#define STRINGTV 5395539 - /** * @brief payload of a string cell. * diff --git a/src/c/payloads/read_stream.h b/src/c/payloads/read_stream.h index ef2f5cc..bb0e000 100644 --- a/src/c/payloads/read_stream.h +++ b/src/c/payloads/read_stream.h @@ -17,12 +17,6 @@ #include "io/fopen.h" #include "memory/pointer.h" -/** - * An open read stream. - */ -#define READTAG "REA" -#define READTV 4277586 - /** * payload of a read or write stream cell. */ diff --git a/src/c/payloads/special.h b/src/c/payloads/special.h index b0ff91b..5ccdb1f 100644 --- a/src/c/payloads/special.h +++ b/src/c/payloads/special.h @@ -21,7 +21,5 @@ * provided. * \see NLAMBDATAG. */ -#define SPECIALTAG "SFM" -#define SPECIALTV 5064275 #endif diff --git a/src/c/payloads/stack.h b/src/c/payloads/stack.h index b02e8f0..b33d7a3 100644 --- a/src/c/payloads/stack.h +++ b/src/c/payloads/stack.h @@ -13,10 +13,6 @@ #define __psse_payloads_stack_h #include "memory/pointer.h" -// #include "memory/pso4.h" - -#define STACKTAG "STK" -#define STACKTV 4936787 /* * number of arguments stored in a stack frame diff --git a/src/c/payloads/symbol.h b/src/c/payloads/symbol.h index fdc01c1..cddd293 100644 --- a/src/c/payloads/symbol.h +++ b/src/c/payloads/symbol.h @@ -12,13 +12,6 @@ #include "memory/pointer.h" - -/** - * Tag for a symbol: just like a keyword except not self-evaluating. - */ -#define SYMBOLTAG "SYM" -#define SYMBOLTV 5069139 - /* TODO: for now, Symbol shares a payload with String, but this may change. * Strings are of indefinite length, but symbols are really not, and might * fit into any size class. */ diff --git a/src/c/payloads/vector_pointer.c b/src/c/payloads/vector_pointer.c deleted file mode 100644 index e575874..0000000 --- a/src/c/payloads/vector_pointer.c +++ /dev/null @@ -1,18 +0,0 @@ -/** - * payloads/vector_pointer.c - * - * A pointer to an object in vector space. - * - * (c) 2026 Simon Brooke - * Licensed under GPL version 2.0, or, at your option, any later version. - */ - -#include - -#include "memory/pointer.h" -#include "memory/pso.h" -#include "payloads/vector_pointer.h" - -bool vectorpointp( struct pso_pointer p ) { - return ( get_tag_value( p ) == VECTORPOINTTV ); -} diff --git a/src/c/payloads/vector_pointer.h b/src/c/payloads/vector_pointer.h index e527bb1..4be88b6 100644 --- a/src/c/payloads/vector_pointer.h +++ b/src/c/payloads/vector_pointer.h @@ -39,6 +39,4 @@ struct vectorp_payload { void *address; }; -bool vectorpointp( struct pso_pointer p ); - #endif diff --git a/src/c/payloads/write_stream.h b/src/c/payloads/write_stream.h index 1197d73..d647575 100644 --- a/src/c/payloads/write_stream.h +++ b/src/c/payloads/write_stream.h @@ -10,14 +10,5 @@ #ifndef __psse_payloads_write_stream_h #define __psse_payloads_write_stream_h -#include "io/fopen.h" -#include "memory/pointer.h" - -/** - * @brief Tag for an open write stream. - */ -#define WRITETAG "WRT" -#define WRITETV 5264214 - /* write stream shares a payload with /see read_streem.h */ #endif diff --git a/archive/unit-tests/add.sh b/unit-tests/add.sh similarity index 100% rename from archive/unit-tests/add.sh rename to unit-tests/add.sh diff --git a/archive/unit-tests/allocation-tests/allocation-tester.sh b/unit-tests/allocation-tests/allocation-tester.sh similarity index 100% rename from archive/unit-tests/allocation-tests/allocation-tester.sh rename to unit-tests/allocation-tests/allocation-tester.sh diff --git a/archive/unit-tests/allocation-tests/allocation-tests.csv b/unit-tests/allocation-tests/allocation-tests.csv similarity index 100% rename from archive/unit-tests/allocation-tests/allocation-tests.csv rename to unit-tests/allocation-tests/allocation-tests.csv diff --git a/archive/unit-tests/allocation-tests/allocation-tests.ods b/unit-tests/allocation-tests/allocation-tests.ods similarity index 100% rename from archive/unit-tests/allocation-tests/allocation-tests.ods rename to unit-tests/allocation-tests/allocation-tests.ods diff --git a/archive/unit-tests/allocation-tests/feature-2.test.tmp b/unit-tests/allocation-tests/feature-2.test.tmp similarity index 100% rename from archive/unit-tests/allocation-tests/feature-2.test.tmp rename to unit-tests/allocation-tests/feature-2.test.tmp diff --git a/archive/unit-tests/allocation-tests/grep.bb b/unit-tests/allocation-tests/grep.bb similarity index 100% rename from archive/unit-tests/allocation-tests/grep.bb rename to unit-tests/allocation-tests/grep.bb diff --git a/archive/unit-tests/allocation-tests/test-forms b/unit-tests/allocation-tests/test-forms similarity index 100% rename from archive/unit-tests/allocation-tests/test-forms rename to unit-tests/allocation-tests/test-forms diff --git a/archive/unit-tests/append.sh b/unit-tests/append.sh similarity index 100% rename from archive/unit-tests/append.sh rename to unit-tests/append.sh diff --git a/archive/unit-tests/apply.sh b/unit-tests/apply.sh similarity index 100% rename from archive/unit-tests/apply.sh rename to unit-tests/apply.sh diff --git a/archive/unit-tests/assoc.sh b/unit-tests/assoc.sh similarity index 100% rename from archive/unit-tests/assoc.sh rename to unit-tests/assoc.sh diff --git a/archive/unit-tests/bignum-add.sh b/unit-tests/bignum-add.sh similarity index 100% rename from archive/unit-tests/bignum-add.sh rename to unit-tests/bignum-add.sh diff --git a/archive/unit-tests/bignum-expt.sh b/unit-tests/bignum-expt.sh similarity index 100% rename from archive/unit-tests/bignum-expt.sh rename to unit-tests/bignum-expt.sh diff --git a/archive/unit-tests/bignum-print.sh b/unit-tests/bignum-print.sh similarity index 100% rename from archive/unit-tests/bignum-print.sh rename to unit-tests/bignum-print.sh diff --git a/archive/unit-tests/bignum-subtract.sh b/unit-tests/bignum-subtract.sh similarity index 100% rename from archive/unit-tests/bignum-subtract.sh rename to unit-tests/bignum-subtract.sh diff --git a/archive/unit-tests/bignum.sh b/unit-tests/bignum.sh similarity index 100% rename from archive/unit-tests/bignum.sh rename to unit-tests/bignum.sh diff --git a/archive/unit-tests/complex-list.sh b/unit-tests/complex-list.sh similarity index 100% rename from archive/unit-tests/complex-list.sh rename to unit-tests/complex-list.sh diff --git a/archive/unit-tests/cond.sh b/unit-tests/cond.sh similarity index 100% rename from archive/unit-tests/cond.sh rename to unit-tests/cond.sh diff --git a/archive/unit-tests/empty-list.sh b/unit-tests/empty-list.sh similarity index 100% rename from archive/unit-tests/empty-list.sh rename to unit-tests/empty-list.sh diff --git a/archive/unit-tests/empty-string.sh b/unit-tests/empty-string.sh similarity index 100% rename from archive/unit-tests/empty-string.sh rename to unit-tests/empty-string.sh diff --git a/archive/unit-tests/equal.sh b/unit-tests/equal.sh similarity index 100% rename from archive/unit-tests/equal.sh rename to unit-tests/equal.sh diff --git a/archive/unit-tests/eval-integer.sh b/unit-tests/eval-integer.sh similarity index 100% rename from archive/unit-tests/eval-integer.sh rename to unit-tests/eval-integer.sh diff --git a/archive/unit-tests/eval-quote-sexpr.sh b/unit-tests/eval-quote-sexpr.sh similarity index 100% rename from archive/unit-tests/eval-quote-sexpr.sh rename to unit-tests/eval-quote-sexpr.sh diff --git a/archive/unit-tests/eval-quote-symbol.sh b/unit-tests/eval-quote-symbol.sh similarity index 100% rename from archive/unit-tests/eval-quote-symbol.sh rename to unit-tests/eval-quote-symbol.sh diff --git a/archive/unit-tests/eval-real.sh b/unit-tests/eval-real.sh similarity index 100% rename from archive/unit-tests/eval-real.sh rename to unit-tests/eval-real.sh diff --git a/archive/unit-tests/eval-string.sh b/unit-tests/eval-string.sh similarity index 100% rename from archive/unit-tests/eval-string.sh rename to unit-tests/eval-string.sh diff --git a/archive/unit-tests/fred.sh b/unit-tests/fred.sh similarity index 100% rename from archive/unit-tests/fred.sh rename to unit-tests/fred.sh diff --git a/archive/unit-tests/integer-allocation.sh b/unit-tests/integer-allocation.sh similarity index 100% rename from archive/unit-tests/integer-allocation.sh rename to unit-tests/integer-allocation.sh diff --git a/archive/unit-tests/integer.sh b/unit-tests/integer.sh similarity index 100% rename from archive/unit-tests/integer.sh rename to unit-tests/integer.sh diff --git a/archive/unit-tests/interpreter.sh b/unit-tests/interpreter.sh similarity index 100% rename from archive/unit-tests/interpreter.sh rename to unit-tests/interpreter.sh diff --git a/archive/unit-tests/lambda.sh b/unit-tests/lambda.sh similarity index 100% rename from archive/unit-tests/lambda.sh rename to unit-tests/lambda.sh diff --git a/archive/unit-tests/let.sh b/unit-tests/let.sh similarity index 100% rename from archive/unit-tests/let.sh rename to unit-tests/let.sh diff --git a/archive/unit-tests/list-test.sh b/unit-tests/list-test.sh similarity index 100% rename from archive/unit-tests/list-test.sh rename to unit-tests/list-test.sh diff --git a/archive/unit-tests/many-args.sh b/unit-tests/many-args.sh similarity index 100% rename from archive/unit-tests/many-args.sh rename to unit-tests/many-args.sh diff --git a/archive/unit-tests/map.sh b/unit-tests/map.sh similarity index 100% rename from archive/unit-tests/map.sh rename to unit-tests/map.sh diff --git a/archive/unit-tests/mapcar.sh b/unit-tests/mapcar.sh similarity index 100% rename from archive/unit-tests/mapcar.sh rename to unit-tests/mapcar.sh diff --git a/archive/unit-tests/memberp.sh b/unit-tests/memberp.sh similarity index 100% rename from archive/unit-tests/memberp.sh rename to unit-tests/memberp.sh diff --git a/archive/unit-tests/memory.sh b/unit-tests/memory.sh similarity index 100% rename from archive/unit-tests/memory.sh rename to unit-tests/memory.sh diff --git a/archive/unit-tests/multiply.sh b/unit-tests/multiply.sh similarity index 100% rename from archive/unit-tests/multiply.sh rename to unit-tests/multiply.sh diff --git a/archive/unit-tests/nil.sh b/unit-tests/nil.sh similarity index 100% rename from archive/unit-tests/nil.sh rename to unit-tests/nil.sh diff --git a/archive/unit-tests/nlambda.sh b/unit-tests/nlambda.sh similarity index 100% rename from archive/unit-tests/nlambda.sh rename to unit-tests/nlambda.sh diff --git a/archive/unit-tests/path-notation.sh b/unit-tests/path-notation.sh similarity index 100% rename from archive/unit-tests/path-notation.sh rename to unit-tests/path-notation.sh diff --git a/archive/unit-tests/progn.sh b/unit-tests/progn.sh similarity index 100% rename from archive/unit-tests/progn.sh rename to unit-tests/progn.sh diff --git a/archive/unit-tests/quote.sh b/unit-tests/quote.sh similarity index 100% rename from archive/unit-tests/quote.sh rename to unit-tests/quote.sh diff --git a/archive/unit-tests/quoted-list.sh b/unit-tests/quoted-list.sh similarity index 100% rename from archive/unit-tests/quoted-list.sh rename to unit-tests/quoted-list.sh diff --git a/archive/unit-tests/ratio-addition.sh b/unit-tests/ratio-addition.sh similarity index 100% rename from archive/unit-tests/ratio-addition.sh rename to unit-tests/ratio-addition.sh diff --git a/archive/unit-tests/recursion.sh b/unit-tests/recursion.sh similarity index 100% rename from archive/unit-tests/recursion.sh rename to unit-tests/recursion.sh diff --git a/archive/unit-tests/reverse.sh b/unit-tests/reverse.sh similarity index 100% rename from archive/unit-tests/reverse.sh rename to unit-tests/reverse.sh diff --git a/archive/unit-tests/simple-list.sh b/unit-tests/simple-list.sh similarity index 100% rename from archive/unit-tests/simple-list.sh rename to unit-tests/simple-list.sh diff --git a/archive/unit-tests/slurp.sh b/unit-tests/slurp.sh similarity index 100% rename from archive/unit-tests/slurp.sh rename to unit-tests/slurp.sh diff --git a/archive/unit-tests/string-allocation.sh b/unit-tests/string-allocation.sh similarity index 100% rename from archive/unit-tests/string-allocation.sh rename to unit-tests/string-allocation.sh diff --git a/archive/unit-tests/string-cons.sh b/unit-tests/string-cons.sh similarity index 100% rename from archive/unit-tests/string-cons.sh rename to unit-tests/string-cons.sh diff --git a/archive/unit-tests/string-with-spaces.sh b/unit-tests/string-with-spaces.sh similarity index 100% rename from archive/unit-tests/string-with-spaces.sh rename to unit-tests/string-with-spaces.sh diff --git a/archive/unit-tests/subtract.sh b/unit-tests/subtract.sh similarity index 100% rename from archive/unit-tests/subtract.sh rename to unit-tests/subtract.sh diff --git a/archive/unit-tests/try.sh b/unit-tests/try.sh similarity index 100% rename from archive/unit-tests/try.sh rename to unit-tests/try.sh diff --git a/archive/unit-tests/varargs.sh b/unit-tests/varargs.sh similarity index 100% rename from archive/unit-tests/varargs.sh rename to unit-tests/varargs.sh diff --git a/archive/unit-tests/wide-character.sh b/unit-tests/wide-character.sh similarity index 100% rename from archive/unit-tests/wide-character.sh rename to unit-tests/wide-character.sh