Post Scarcity
A prototype for a post scarcity programming environment
Loading...
Searching...
No Matches
hashmap.c File Reference
#include "arith/integer.h"
#include "arith/peano.h"
#include "authorise.h"
#include "debug.h"
#include "ops/intern.h"
#include "io/print.h"
#include "memory/conspage.h"
#include "memory/consspaceobject.h"
#include "memory/hashmap.h"
#include "memory/vectorspace.h"
Include dependency graph for hashmap.c:

Go to the source code of this file.

Functions

void dump_map (URL_FILE *output, struct cons_pointer pointer)
 
struct cons_pointer lisp_get_hash (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
 A lisp function signature conforming wrapper around get_hash, q.v.
 
struct cons_pointer lisp_hashmap_keys (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
 
struct cons_pointer lisp_hashmap_put (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
 Expects frame->arg[1] to be a hashmap or namespace; frame->arg[2] to be a string-like-thing (perhaps necessarily a keyword); frame->arg[3] to be any value.
 
struct cons_pointer lisp_hashmap_put_all (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
 Lisp function expecting two arguments, a hashmap and an assoc list.
 
struct cons_pointer lisp_make_hashmap (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
 Lisp funtion of up to four args (all optional), where.
 

Function Documentation

◆ dump_map()

void dump_map ( URL_FILE output,
struct cons_pointer  pointer 
)

◆ lisp_get_hash()

struct cons_pointer lisp_get_hash ( struct stack_frame frame,
struct cons_pointer  frame_pointer,
struct cons_pointer  env 
)

A lisp function signature conforming wrapper around get_hash, q.v.

Definition at line 25 of file hashmap.c.

References get_hash(), make_integer(), and NIL.

Referenced by main().

◆ lisp_hashmap_keys()

struct cons_pointer lisp_hashmap_keys ( struct stack_frame frame,
struct cons_pointer  frame_pointer,
struct cons_pointer  env 
)

Definition at line 132 of file hashmap.c.

References hashmap_keys().

◆ lisp_hashmap_put()

struct cons_pointer lisp_hashmap_put ( struct stack_frame frame,
struct cons_pointer  frame_pointer,
struct cons_pointer  env 
)

Expects frame->arg[1] to be a hashmap or namespace; frame->arg[2] to be a string-like-thing (perhaps necessarily a keyword); frame->arg[3] to be any value.

If current user is authorised to write to this hashmap, modifies the hashmap and returns it; if not, clones the hashmap, modifies the clone, and returns that.

Definition at line 106 of file hashmap.c.

References hashmap_put(), and pointer2cell.

Referenced by main().

◆ lisp_hashmap_put_all()

struct cons_pointer lisp_hashmap_put_all ( struct stack_frame frame,
struct cons_pointer  frame_pointer,
struct cons_pointer  env 
)

Lisp function expecting two arguments, a hashmap and an assoc list.

Copies all key/value pairs from the assoc list into the map.

Definition at line 126 of file hashmap.c.

References hashmap_put_all().

Referenced by main().

◆ lisp_make_hashmap()

struct cons_pointer lisp_make_hashmap ( struct stack_frame frame,
struct cons_pointer  frame_pointer,
struct cons_pointer  env 
)

Lisp funtion of up to four args (all optional), where.

first is expected to be an integer, the number of buckets, or nil; second is expected to be a hashing function, or nil; third is expected to be an assocable, or nil; fourth is a list of user tokens, to be used as a write ACL, or nil.

Definition at line 39 of file hashmap.c.

References authorised(), c_car(), c_cdr(), c_string_to_lisp_string(), DFLT_HASHMAP_BUCKETS, functionp, get_hash(), integerp, make_cons(), make_exception(), make_hashmap(), NIL, nilp, vector_space_object::payload, pointer_to_vso, to_long_int(), and truep.

Referenced by main().