Added first cut of reader and writer, but nothing working at this stage.

This commit is contained in:
Simon Brooke 2017-01-06 22:49:04 +00:00
parent 0e693d4360
commit 5920b0d04f
12 changed files with 413 additions and 36 deletions

View file

@ -9,14 +9,14 @@
* the size which, by version 1, it will default to) is the maximum value of an unsigned 32
* bit integer, which is to say 4294967296. However, we'll start small.
*/
#define CONSPAGESIZE 256
#define CONSPAGESIZE 64
/**
* the number of cons pages we will initially allow for. For convenience we'll set up an array
* of cons pages this big; however, later we will want a mechanism for this to be able to grow
* dynamically to the maximum we can currently allow, which is 4294967296.
*/
#define NCONSPAGES 256
#define NCONSPAGES 64
/**
* a cons page is essentially just an array of cons space objects. It might later have a local
@ -28,9 +28,45 @@ struct cons_page {
};
/**
* The (global) pointer to the (global) freelist. Not sure whether this ultimately
* belongs in this file.
*/
extern struct cons_pointer freelist;
/**
* An array of pointers to cons pages.
*/
extern struct cons_page* conspages[NCONSPAGES];
/**
* Frees the cell at the specified pointer. Dangerous, primitive, low
* level.
*
* @pointer the cell to free
*/
void free_cell(struct cons_pointer pointer);
/**
* Allocates a cell with the specified tag. Dangerous, primitive, low
* level.
*
* @param tag the tag of the cell to allocate - must be a valid cons space tag.
* @return the cons pointer which refers to the cell allocated.
*/
struct cons_pointer allocatecell( char* tag);
/**
* initialise the cons page system; to be called exactly once during startup.
*/
void conspagesinit();
/**
* dump the allocated pages to this output stream.
*/
void dumppages( FILE* output);
#endif