factor/native/image.h

43 lines
1.0 KiB
C
Raw Normal View History

2004-07-16 02:26:21 -04:00
#define IMAGE_MAGIC 0x0f0e0d0c
2004-12-25 02:55:03 -05:00
#define IMAGE_VERSION_0 0
#define IMAGE_VERSION 1
2004-07-16 02:26:21 -04:00
typedef struct {
CELL magic;
CELL version;
/* all pointers in the image file are relocated from
relocation_base to here when the image is loaded */
CELL relocation_base;
/* tagged pointer to bootstrap quotation */
CELL boot;
/* tagged pointer to global namespace */
CELL global;
2005-05-10 22:30:58 -04:00
/* tagged pointer to t singleton */
CELL t;
/* tagged pointer to bignum 0 */
CELL bignum_zero;
/* tagged pointer to bignum 1 */
CELL bignum_pos_one;
/* tagged pointer to bignum -1 */
CELL bignum_neg_one;
2004-07-16 02:26:21 -04:00
/* size of heap */
CELL size;
} HEADER;
2004-12-25 02:55:03 -05:00
/* If version is IMAGE_VERSION_1 */
typedef struct EXT_HEADER {
/* size of code heap */
CELL size;
/* code relocation base */
CELL relocation_base;
/* end of literal table */
CELL literal_top;
/* maximum value of literal_top */
CELL literal_max;
} HEADER_2;
2005-05-10 22:30:58 -04:00
void init_objects(HEADER *h);
2005-05-09 22:34:47 -04:00
void load_image(char* file, int literal_size);
2004-07-16 02:26:21 -04:00
bool save_image(char* file);
void primitive_save_image(void);