2004-07-16 02:26:21 -04:00
|
|
|
#define USER_ENV 16
|
|
|
|
|
2005-05-13 20:37:28 -04:00
|
|
|
#define CARD_OFF_ENV 1 /* for compiling set-slot */
|
|
|
|
#define UNUSED_ENV 2
|
2004-08-20 21:26:25 -04:00
|
|
|
#define NAMESTACK_ENV 3 /* used by library only */
|
2004-07-29 17:18:41 -04:00
|
|
|
#define GLOBAL_ENV 4
|
|
|
|
#define BREAK_ENV 5
|
2004-08-20 21:26:25 -04:00
|
|
|
#define CATCHSTACK_ENV 6 /* used by library only */
|
2004-10-12 23:52:03 -04:00
|
|
|
#define CPU_ENV 7
|
2004-08-20 18:48:08 -04:00
|
|
|
#define BOOT_ENV 8
|
2004-08-20 21:26:25 -04:00
|
|
|
#define RUNQUEUE_ENV 9 /* used by library only */
|
2004-08-22 01:46:26 -04:00
|
|
|
#define ARGS_ENV 10
|
2004-12-13 15:37:50 -05:00
|
|
|
#define OS_ENV 11
|
2004-12-26 01:42:09 -05:00
|
|
|
#define ERROR_ENV 12 /* a marker consed onto kernel errors */
|
2005-04-22 20:09:46 -04:00
|
|
|
#define IN_ENV 13
|
|
|
|
#define OUT_ENV 14
|
2005-05-12 01:02:39 -04:00
|
|
|
#define GEN_ENV 15 /* set to GC_GENERATIONS constant */
|
2004-07-16 02:26:21 -04:00
|
|
|
|
2005-05-13 00:09:49 -04:00
|
|
|
/* TAGGED user environment data; see getenv/setenv prims */
|
2005-05-13 20:37:28 -04:00
|
|
|
DLLEXPORT CELL userenv[USER_ENV];
|
2005-05-13 00:09:49 -04:00
|
|
|
|
2004-08-23 01:13:09 -04:00
|
|
|
/* Profiling timer */
|
2004-12-11 15:02:34 -05:00
|
|
|
#ifndef WIN32
|
2004-08-23 01:13:09 -04:00
|
|
|
struct itimerval prof_timer;
|
2004-12-11 15:02:34 -05:00
|
|
|
#endif
|
2004-08-23 01:13:09 -04:00
|
|
|
|
2004-07-16 02:26:21 -04:00
|
|
|
/* Error handlers restore this */
|
2004-12-11 15:02:34 -05:00
|
|
|
#ifdef WIN32
|
|
|
|
jmp_buf toplevel;
|
|
|
|
#else
|
2004-08-16 21:25:01 -04:00
|
|
|
sigjmp_buf toplevel;
|
2004-12-11 15:02:34 -05:00
|
|
|
#endif
|
2004-07-16 02:26:21 -04:00
|
|
|
|
2004-08-23 01:13:09 -04:00
|
|
|
/* Call stack depth to start profile counter from */
|
|
|
|
/* This ensures that words in the user's interpreter do not count */
|
|
|
|
CELL profile_depth;
|
2004-08-16 21:05:38 -04:00
|
|
|
|
2004-07-16 02:26:21 -04:00
|
|
|
INLINE CELL dpop(void)
|
|
|
|
{
|
2004-11-06 21:03:35 -05:00
|
|
|
CELL value = get(ds);
|
2004-08-20 18:48:08 -04:00
|
|
|
ds -= CELLS;
|
2004-11-06 21:03:35 -05:00
|
|
|
return value;
|
2004-07-16 02:26:21 -04:00
|
|
|
}
|
|
|
|
|
2004-08-12 17:36:36 -04:00
|
|
|
INLINE void drepl(CELL top)
|
|
|
|
{
|
2004-11-06 21:03:35 -05:00
|
|
|
put(ds,top);
|
2004-08-12 17:36:36 -04:00
|
|
|
}
|
|
|
|
|
2004-07-16 02:26:21 -04:00
|
|
|
INLINE void dpush(CELL top)
|
|
|
|
{
|
2004-08-20 18:48:08 -04:00
|
|
|
ds += CELLS;
|
2004-11-06 21:03:35 -05:00
|
|
|
put(ds,top);
|
2004-07-16 02:26:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
INLINE CELL dpeek(void)
|
|
|
|
{
|
2004-11-06 21:03:35 -05:00
|
|
|
return get(ds);
|
2004-07-16 02:26:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
INLINE CELL cpop(void)
|
|
|
|
{
|
2004-11-06 21:03:35 -05:00
|
|
|
CELL value = get(cs);
|
2004-08-20 18:48:08 -04:00
|
|
|
cs -= CELLS;
|
2004-11-06 21:03:35 -05:00
|
|
|
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;
|
2004-11-06 21:03:35 -05:00
|
|
|
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-01-01 19:30:57 -05:00
|
|
|
if(callframe == F)
|
|
|
|
/* put(cs - CELLS,executing) */;
|
|
|
|
else
|
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);
|
2005-02-08 17:05:08 -05:00
|
|
|
void platform_run(void);
|
2005-01-01 19:30:57 -05: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);
|
2005-06-12 03:38:57 -04:00
|
|
|
void primitive_dispatch(void);
|
2004-07-16 02:26:21 -04:00
|
|
|
void primitive_getenv(void);
|
|
|
|
void primitive_setenv(void);
|