2004-07-16 02:26:21 -04:00
|
|
|
#define USER_ENV 16
|
|
|
|
|
2004-07-29 17:18:41 -04:00
|
|
|
#define STDIN_ENV 0
|
|
|
|
#define STDOUT_ENV 1
|
|
|
|
#define STDERR_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-07-16 02:26:21 -04:00
|
|
|
|
2004-08-23 01:13:09 -04:00
|
|
|
/* Profiling timer */
|
|
|
|
struct itimerval prof_timer;
|
|
|
|
|
2004-07-16 02:26:21 -04:00
|
|
|
/* Error handlers restore this */
|
2004-08-16 21:25:01 -04:00
|
|
|
sigjmp_buf toplevel;
|
2004-07-16 02:26:21 -04:00
|
|
|
|
2004-08-20 18:48:08 -04:00
|
|
|
/* TAGGED currently executing quotation */
|
|
|
|
CELL callframe;
|
|
|
|
|
|
|
|
/* raw pointer to datastack bottom */
|
|
|
|
CELL ds_bot;
|
|
|
|
|
|
|
|
/* raw pointer to datastack top */
|
2004-11-06 15:51:17 -05:00
|
|
|
#ifdef FACTOR_X86
|
2004-10-31 14:36:42 -05:00
|
|
|
register CELL ds asm("%esi");
|
|
|
|
#else
|
2004-08-20 18:48:08 -04:00
|
|
|
CELL ds;
|
2004-10-31 14:36:42 -05:00
|
|
|
#endif
|
2004-08-20 18:48:08 -04:00
|
|
|
|
|
|
|
/* raw pointer to callstack bottom */
|
|
|
|
CELL cs_bot;
|
|
|
|
|
|
|
|
/* raw pointer to callstack top */
|
|
|
|
CELL cs;
|
|
|
|
|
|
|
|
/* raw pointer to currently executing word */
|
|
|
|
WORD* executing;
|
|
|
|
|
|
|
|
/* TAGGED user environment data; see getenv/setenv prims */
|
|
|
|
CELL userenv[USER_ENV];
|
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-08-20 18:48:08 -04:00
|
|
|
ds -= CELLS;
|
|
|
|
return get(ds);
|
2004-07-16 02:26:21 -04:00
|
|
|
}
|
|
|
|
|
2004-08-12 17:36:36 -04:00
|
|
|
INLINE void drepl(CELL top)
|
|
|
|
{
|
2004-08-20 18:48:08 -04:00
|
|
|
put(ds - CELLS,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
|
|
|
put(ds,top);
|
|
|
|
ds += CELLS;
|
2004-07-16 02:26:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
INLINE CELL dpeek(void)
|
|
|
|
{
|
2004-08-20 18:48:08 -04:00
|
|
|
return get(ds - CELLS);
|
2004-07-16 02:26:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
INLINE CELL cpop(void)
|
|
|
|
{
|
2004-08-20 18:48:08 -04:00
|
|
|
cs -= CELLS;
|
|
|
|
return get(cs);
|
2004-07-16 02:26:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
INLINE void cpush(CELL top)
|
|
|
|
{
|
2004-08-20 18:48:08 -04:00
|
|
|
put(cs,top);
|
|
|
|
cs += CELLS;
|
2004-07-16 02:26:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
INLINE CELL cpeek(void)
|
|
|
|
{
|
2004-08-20 18:48:08 -04:00
|
|
|
return get(cs - CELLS);
|
2004-07-16 02:26:21 -04:00
|
|
|
}
|
|
|
|
|
2004-08-23 01:13:09 -04:00
|
|
|
INLINE void call(CELL quot)
|
|
|
|
{
|
|
|
|
/* tail call optimization */
|
|
|
|
if(callframe != F)
|
|
|
|
{
|
|
|
|
cpush(tag_word(executing));
|
|
|
|
cpush(callframe);
|
|
|
|
}
|
|
|
|
callframe = quot;
|
|
|
|
}
|
|
|
|
|
2004-08-23 02:15:10 -04:00
|
|
|
void clear_environment(void);
|
|
|
|
|
2004-07-16 02:26:21 -04:00
|
|
|
void run(void);
|
|
|
|
void undefined(void);
|
2004-08-23 01:13:09 -04:00
|
|
|
void docol(void);
|
2004-09-28 00:24:36 -04:00
|
|
|
void dosym(void);
|
2004-07-16 02:26:21 -04:00
|
|
|
void primitive_execute(void);
|
|
|
|
void primitive_call(void);
|
|
|
|
void primitive_ifte(void);
|
|
|
|
void primitive_getenv(void);
|
|
|
|
void primitive_setenv(void);
|