86 switch ( cell->
tag.value ) {
90 result = cell->
payload.integer.value & 0xffffffff;
95 result = cell->
payload.string.hash;
120 for (
int i = 0; i < vso->
payload.hashmap.n_buckets; i++ ) {
123 L
"Decrementing bucket [%d] of hashmap at 0x%lx\n",
124 i, cell->
payload.vectorp.address );
143 ( n_buckets + 2 ) ) +
144 (
sizeof( uint32_t ) * 2 ) );
153 for (
int i = 0; i < n_buckets; i++ ) {
168 for (
int i = 0; i < map->
payload.hashmap.n_buckets; i++ ) {
190 if (
consp( assoc ) ) {
192 pair =
c_car( assoc ) ) {
195 if (
consp( pair ) ) {
202 assoc =
c_cdr( assoc );
229 return_key ?
"key" :
"value" );
261 if ( from != NULL ) {
270 for (
int i = 0; i < to_pl.
n_buckets; i++ ) {
279 ( L
"Arg to `clone_hashmap` must "
280 L
"be a readable hashmap.`" ),
NIL );
316 return_key ?
"key" :
"value" );
339 return_key ?
c_car( entry_ptr )
340 :
c_cdr( entry_ptr );
354 ( L
"search-store (entry)" ),
357 ( L
"Unexpected store type: " ),
366 ( L
"\n\tHashmap as top-level value in list",
374 ( L
"search-store (cursor)" ),
377 ( L
"Unexpected store type: " ),
390 ( L
"search-store (store)" ),
392 ( L
"Unexpected store type: " ),
400 ( L
"search-store (exception)" ),
402 ( L
"Unexpected key type: " ),
409 ( L
"search-store (key)" ),
411 ( L
"Unexpected key type: " ),
440 if (
consp( store ) ) {
443 if (
consp( pair ) ) {
454 store =
c_cdr( store );
459 for (
int i = 0; i < map->
payload.hashmap.n_buckets; i++ ) {
503 map->
payload.hashmap.buckets[bucket_no] =
505 map->
payload.hashmap.buckets[bucket_no] );
566 if (
nilp( canonical ) ) {
570 result =
set( key,
TRUE, 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 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.
uint32_t get_tag_value(struct cons_pointer pointer)
given a cons_pointer as argument, return the tag.
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 EXCEPTIONTV
The string EXEP, considered as an unsigned int.
#define TRUE
a cons pointer which points to the special T cell
struct cons_pointer c_string_to_lisp_symbol(wchar_t *symbol)
Return a lisp symbol representation of this wide character string.
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.
#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_print_binding(struct cons_pointer key, struct cons_pointer val, bool deep, int level)
Standardise printing of binding trace messages.
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,...
bool eq(struct cons_pointer a, struct cons_pointer b)
Shallow, and thus cheap, equality: true if these two objects are the same object, else false.
struct cons_pointer search_store(struct cons_pointer key, struct cons_pointer store, bool return_key)
(search-store key store return-key?) Search this store for this a key lexically identical to this key...
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.
struct cons_pointer hashmap_get(struct cons_pointer mapp, struct cons_pointer key, bool return_key)
Get a value from a hashmap.
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 interned(struct cons_pointer key, struct cons_pointer store)
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, and returns the key.
struct cons_pointer set(struct cons_pointer key, struct cons_pointer value, struct cons_pointer store)
If this store is modifiable, add this key value pair to it.
struct cons_pointer throw_exception(struct cons_pointer location, struct cons_pointer payload, struct cons_pointer frame_pointer)
Throw an exception.
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...