factor/native/run.h

92 lines
1.7 KiB
C
Raw Normal View History

2005-09-24 17:26:04 -04:00
#define USER_ENV 32
2004-07-16 02:26:21 -04:00
2005-12-11 15:14:41 -05:00
#define CARD_OFF_ENV 1 /* for compiling set-slot */
/* 2 is unused */
#define NAMESTACK_ENV 3 /* used by library only */
#define GLOBAL_ENV 4
#define BREAK_ENV 5
#define CATCHSTACK_ENV 6 /* used by library only */
#define CPU_ENV 7
#define BOOT_ENV 8
#define CALLCC_1_ENV 9 /* used by library only */
#define ARGS_ENV 10
#define OS_ENV 11
#define ERROR_ENV 12 /* a marker consed onto kernel errors */
#define IN_ENV 13
#define OUT_ENV 14
#define GEN_ENV 15 /* set to gen_count */
#define IMAGE_ENV 16 /* image name */
#define CELL_SIZE_ENV 17 /* sizeof(CELL) */
#define COMPILED_BASE_ENV 18 /* base of code heap */
2004-07-16 02:26:21 -04:00
2005-05-13 00:09:49 -04:00
/* TAGGED user environment data; see getenv/setenv prims */
DLLEXPORT CELL userenv[USER_ENV];
2005-05-13 00:09:49 -04:00
2004-07-16 02:26:21 -04:00
/* Error handlers restore this */
2005-10-11 21:46:14 -04:00
JMP_BUF toplevel;
2004-08-16 21:05:38 -04:00
2004-07-16 02:26:21 -04:00
INLINE CELL dpop(void)
{
CELL value = get(ds);
2004-08-20 18:48:08 -04:00
ds -= CELLS;
return value;
2004-07-16 02:26:21 -04:00
}
INLINE void drepl(CELL top)
{
put(ds,top);
}
2004-07-16 02:26:21 -04:00
INLINE void dpush(CELL top)
{
2004-08-20 18:48:08 -04:00
ds += CELLS;
put(ds,top);
2004-07-16 02:26:21 -04:00
}
INLINE CELL dpeek(void)
{
return get(ds);
2004-07-16 02:26:21 -04:00
}
INLINE CELL dpeek2(void)
{
return get(ds - CELLS);
}
2004-07-16 02:26:21 -04:00
INLINE CELL cpop(void)
{
CELL value = get(cs);
2004-08-20 18:48:08 -04:00
cs -= CELLS;
return value;
2004-07-16 02:26:21 -04:00
}
INLINE void cpush(CELL top)
{
2004-08-20 18:48:08 -04:00
cs += CELLS;
put(cs,top);
2004-07-16 02:26:21 -04:00
}
2004-08-23 01:13:09 -04:00
INLINE void call(CELL quot)
{
/* tail call optimization */
2005-12-20 21:36:52 -05:00
if(callframe != F)
2004-08-23 01:13:09 -04:00
{
2004-12-31 02:38:58 -05:00
cpush(executing);
2004-08-23 01:13:09 -04:00
cpush(callframe);
}
2005-01-01 19:30:57 -05:00
2004-08-23 01:13:09 -04:00
callframe = quot;
}
2004-07-16 02:26:21 -04:00
void run(void);
void platform_run(void);
2005-09-14 00:37:50 -04:00
void undefined(F_WORD *word);
void docol(F_WORD *word);
void dosym(F_WORD *word);
2004-07-16 02:26:21 -04:00
void primitive_execute(void);
void primitive_call(void);
void primitive_ifte(void);
void primitive_dispatch(void);
2004-07-16 02:26:21 -04:00
void primitive_getenv(void);
void primitive_setenv(void);