85 switch ( cell->
tag.value ) {
89 result = cell->
payload.integer.value & 0xffffffff;
94 result = cell->
payload.string.hash;
119 for (
int i = 0; i < vso->
payload.hashmap.n_buckets; i++ ) {
122 L
"Decrementing bucket [%d] of hashmap at 0x%lx\n",
123 i, cell->
payload.vectorp.address );
142 ( n_buckets + 2 ) ) +
143 (
sizeof( uint32_t ) * 2 ) );
152 for (
int i = 0; i < n_buckets; i++ ) {
167 for (
int i = 0; i < map->
payload.hashmap.n_buckets; i++ ) {
189 if (
consp( assoc ) ) {
191 pair =
c_car( assoc ) ) {
194 if (
consp( pair ) ) {
201 assoc =
c_cdr( assoc );
244 if ( from != NULL ) {
253 for (
int i = 0; i < to_pl.
n_buckets; i++ ) {
262 ( L
"Arg to `clone_hashmap` must "
263 L
"be a readable hashmap.`" ),
NIL );
335 if (
consp( store ) ) {
339 if (
consp( next ) ) {
343 switch ( entry.
tag.value ) {
346 result = entry.
payload.cons.cdr;
355 ( L
"Store entry is of unknown type: " ),
362 }
else if ( !
nilp( store ) ) {
369 ( L
"Store is of unknown type: " ),
400 map->
payload.hashmap.buckets[bucket_no] =
402 map->
payload.hashmap.buckets[bucket_no] ) );
426 if (
nilp( value ) ) {
428 }
else if (
nilp( store ) ||
consp( store ) ) {
481 if (
nilp( canonical ) ) {
485 result =
set( key,
NIL, environment );
struct cons_pointer authorised(struct cons_pointer target, struct cons_pointer acl)
TODO: does nothing, yet.
struct cons_pointer dec_ref(struct cons_pointer pointer)
Decrement the reference count of the object at this cons pointer.
#define KEYTV
The string KEYW, considered as an unsigned int.
#define VECTORPOINTTV
The string VECP, considered as an unsigned int.
#define truep(conspoint)
true if conspoint points to something that is truthy, i.e.
#define SYMBOLTV
The string SYMB, considered as an unsigned int.
union cons_space_object::@2 tag
union cons_space_object::@3 payload
#define NIL
a cons pointer which points to the special NIL cell
struct cons_pointer make_exception(struct cons_pointer message, struct cons_pointer frame_pointer)
Construct an exception cell.
struct cons_pointer c_cdr(struct cons_pointer arg)
Implementation of cdr in C.
#define STRINGTV
The string STRG, considered as an unsigned int.
#define INTEGERTV
The string INTR, considered as an unsigned int.
#define consp(conspoint)
true if conspoint points to a cons cell, else false
#define CONSTV
The string CONS, considered as an unsigned int.
#define nilp(conspoint)
true if conspoint points to the special cell NIL, else false (there should only be one of these so it...
#define TRUETV
The string TRUE, considered as an unsigned int.
#define symbolp(conspoint)
true if conspoint points to a symbol cell, else false
struct cons_pointer c_string_to_lisp_string(wchar_t *string)
Return a lisp string representation of this wide character string.
struct cons_pointer inc_ref(struct cons_pointer pointer)
increment the reference count of the object at this cons pointer.
#define TRUE
a cons pointer which points to the special T cell
#define keywordp(conspoint)
true if conspoint points to a keyword, else false
struct cons_pointer c_car(struct cons_pointer arg)
Implementation of car in C.
struct cons_pointer c_type(struct cons_pointer pointer)
Get the Lisp type of the single argument.
struct cons_pointer dec_ref(struct cons_pointer pointer)
Decrement the reference count of the object at this cons pointer.
#define pointer2cell(pointer)
given a cons_pointer as argument, return the cell.
struct cons_pointer make_cons(struct cons_pointer car, struct cons_pointer cdr)
Construct a cons cell from this pair of pointers.
An indirect pointer to a cons cell.
void debug_println(int level)
print a line feed to stderr, if verbosity matches level.
void debug_dump_object(struct cons_pointer pointer, int level)
Like dump_object, q.v., but protected by the verbosity mechanism.
void debug_printf(int level, wchar_t *format,...)
wprintf adapted for the debug logging system.
void debug_print(wchar_t *message, int level)
print this debug message to stderr, if verbosity matches level.
void debug_print_object(struct cons_pointer pointer, int level)
print the object indicated by this pointer to stderr, if verbosity matches level.
#define DEBUG_BIND
Print messages debugging symbol binding.
#define DEBUG_ALLOC
Print messages debugging memory allocation.
bool equal(struct cons_pointer a, struct cons_pointer b)
Deep, and thus expensive, equality: true if these two objects have identical structure,...
struct cons_pointer hashmap_get(struct cons_pointer mapp, struct cons_pointer key)
Get a value from a hashmap.
struct cons_pointer hashmap_put(struct cons_pointer mapp, struct cons_pointer key, struct cons_pointer val)
Store this val as the value of this key in this hashmap mapp.
struct cons_pointer privileged_symbol_nil
the symbol NIL, which is special!
void free_hashmap(struct cons_pointer pointer)
Free the hashmap indicated by this pointer.
struct cons_pointer hashmap_put_all(struct cons_pointer mapp, struct cons_pointer assoc)
Copy all key/value pairs in this association list assoc into this hashmap mapp.
struct cons_pointer make_hashmap(uint32_t n_buckets, struct cons_pointer hash_fn, struct cons_pointer write_acl)
Make a hashmap with this number of buckets, using this hash_fn.
struct cons_pointer hashmap_keys(struct cons_pointer mapp)
return a flat list of all the keys in the hashmap indicated by map.
uint32_t get_hash(struct cons_pointer ptr)
Get the hash value for the cell indicated by this ptr; currently only implemented for string like thi...
struct cons_pointer internedp(struct cons_pointer key, struct cons_pointer store)
Implementation of interned? in C.
uint32_t sxhash(struct cons_pointer ptr)
Return a hash value for the structure indicated by ptr such that if x,y are two separate structures w...
struct cons_pointer c_assoc(struct cons_pointer key, struct cons_pointer store)
Implementation of assoc in C.
struct cons_pointer intern(struct cons_pointer key, struct cons_pointer environment)
Ensure that a canonical copy of this key is bound in this environment, and return that canonical copy...
struct cons_pointer oblist
The global object list/or, to put it differently, the root namespace.
struct cons_pointer clone_hashmap(struct cons_pointer ptr)
If this ptr is a pointer to a hashmap, return a new identical hashmap; else return an exception.
struct cons_pointer deep_bind(struct cons_pointer key, struct cons_pointer value)
Binds this key to this value in the global oblist.
struct cons_pointer set(struct cons_pointer key, struct cons_pointer value, struct cons_pointer store)
Return a new key/value store containing all the key/value pairs in this store with this key/value pai...
char * lisp_string_to_c_string(struct cons_pointer s)
Convert this lisp string-like-thing (also works for symbols, and, later keywords) into a UTF-8 string...
struct cons_pointer throw_exception(struct cons_pointer message, struct cons_pointer frame_pointer)
Throw an exception.
struct cons_pointer c_append(struct cons_pointer l1, struct cons_pointer l2)
A version of append which can conveniently be called from C.
struct cons_pointer make_vso(uint32_t tag, uint64_t payload_size)
Allocate a vector space object with this payload_size and tag, and return a cons_pointer which points...
struct cons_pointer hash_fn
struct cons_pointer write_acl
union vector_space_object::@5 payload
we'll malloc size bytes for payload, payload is just the first of these.
#define pointer_to_vso(pointer)
given a pointer to a vector space object, return the object.
#define hashmapp(conspoint)
struct cons_pointer buckets[]
The payload of a hashmap.
a vector_space_object is just a vector_space_header followed by a lump of bytes; what we deem to be i...