factor/native/run.h

92 lines
1.5 KiB
C
Raw Normal View History

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-07-29 17:18:41 -04:00
#define GC_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 */
#define ARGS_ENV 10
2004-07-16 02:26:21 -04:00
/* Error handlers restore this */
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 */
CELL ds;
/* 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-16 21:05:38 -04:00
void init_signals(void);
2004-07-16 02:26:21 -04:00
void clear_environment(void);
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
}
INLINE void drepl(CELL top)
{
2004-08-20 18:48:08 -04:00
put(ds - CELLS,top);
}
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
}
void run(void);
void undefined(void);
void call(void);
void primitive_execute(void);
void primitive_call(void);
void primitive_ifte(void);
void primitive_getenv(void);
void primitive_setenv(void);
void primitive_exit(void);
2004-07-30 16:22:20 -04:00
void primitive_os_env(void);