3 void clear_environment(void)
6 for(i = 0; i < USER_ENV; i++)
10 void init_environment(void)
12 /* + CELLS * 2 to skip header and length cell */
13 env.ds_bot = tag_object(array(STACK_SIZE,empty));
15 env.cs_bot = tag_object(array(STACK_SIZE,empty));
20 #define EXECUTE(w) ((XT)(UNTAG(w->xt)))()
42 env.cf = (CELL)untag_cons(env.cf);
44 env.cf = get(env.cf + CELLS);
46 if(TAG(next) == WORD_TYPE)
48 env.w = (WORD*)UNTAG(next);
59 /* XT of deferred words */
62 general_error(ERROR_UNDEFINED_WORD,tag_word(env.w));
65 /* XT of compound definitions */
68 /* tail call optimization */
71 /* the parameter is the colon def */
72 env.cf = env.w->parameter;
76 void primitive_execute(void)
78 WORD* word = untag_word(env.dt);
84 void primitive_call(void)
86 CELL calling = env.dt;
93 void primitive_ifte(void)
98 CELL calling = (untag_boolean(cond) ? t : f);
105 void primitive_getenv(void)
107 FIXNUM e = untag_fixnum(env.dt);
108 if(e < 0 || e >= USER_ENV)
109 range_error(F,e,USER_ENV);
110 env.dt = env.user[e];
113 void primitive_setenv(void)
115 FIXNUM e = untag_fixnum(env.dt);
117 if(e < 0 || e >= USER_ENV)
118 range_error(F,e,USER_ENV);
119 check_non_empty(value);
124 void primitive_exit(void)
126 exit(untag_fixnum(env.dt));