#8: Buggy, but a lot of it works.
This commit is contained in:
parent
b6958bbf65
commit
0687b0baeb
6 changed files with 98 additions and 9 deletions
|
|
@ -21,6 +21,8 @@
|
|||
#include "conspage.h"
|
||||
#include "consspaceobject.h"
|
||||
#include "debug.h"
|
||||
#include "intern.h"
|
||||
#include "map.h"
|
||||
#include "print.h"
|
||||
#include "stack.h"
|
||||
#include "vectorspace.h"
|
||||
|
|
@ -146,6 +148,9 @@ void dump_object( URL_FILE * output, struct cons_pointer pointer ) {
|
|||
case STACKFRAMETV:
|
||||
dump_frame( output, pointer );
|
||||
break;
|
||||
case MAPTV:
|
||||
dump_map( output, pointer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ uint32_t get_hash_32(struct cons_pointer f, struct cons_pointer key) {
|
|||
uint32_t result = 0;
|
||||
int l = c_length(key);
|
||||
|
||||
if (keywordp(key) || stringp(key)) {
|
||||
if (keywordp(key) || stringp(key) || symbolp( key)) {
|
||||
if ( l > 0) {
|
||||
uint32_t buffer[l];
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ uint32_t get_hash_32(struct cons_pointer f, struct cons_pointer key) {
|
|||
result = hashword( buffer, l, 0);
|
||||
}
|
||||
} else {
|
||||
fputws(L"Hashing is thud far implemented only for keys and strings.\n", stderr);
|
||||
fputws(L"Hashing is thus far implemented only for keys, strings and symbols.\n", stderr);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
@ -220,6 +220,24 @@ struct cons_pointer assoc_in_map( struct cons_pointer map,
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function: create a map initialised with key/value pairs from my
|
||||
* first argument.
|
||||
*
|
||||
* * (make-map)
|
||||
* * (make-map store)
|
||||
*
|
||||
* @param frame the stack frame in which the expression is to be interpreted;
|
||||
* @param frame_pointer a pointer to my stack_frame.
|
||||
* @param env the environment in which it is to be intepreted.
|
||||
* @return a new containing all the key/value pairs from store.
|
||||
*/
|
||||
struct cons_pointer
|
||||
lisp_make_map( struct stack_frame *frame, struct cons_pointer frame_pointer,
|
||||
struct cons_pointer env ) {
|
||||
return merge_into_map( make_empty_map( NIL), frame->arg[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dump a map to this stream for debugging
|
||||
* @param output the stream
|
||||
|
|
|
|||
|
|
@ -83,7 +83,11 @@ struct cons_pointer merge_into_map( struct cons_pointer parent,
|
|||
struct cons_pointer to_merge);
|
||||
|
||||
struct cons_pointer assoc_in_map( struct cons_pointer map,
|
||||
struct cons_pointer key);
|
||||
struct cons_pointer key);
|
||||
|
||||
struct cons_pointer lisp_make_map( struct stack_frame *frame,
|
||||
struct cons_pointer frame_pointer,
|
||||
struct cons_pointer env );
|
||||
|
||||
void dump_map( URL_FILE * output, struct cons_pointer map_pointer );
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue