3 void clear_environment(void)
6 for(i = 0; i < USER_ENV; i++)
10 void init_environment(void)
12 env.ds_bot = tag_object(array(STACK_SIZE,empty));
14 env.cs_bot = tag_object(array(STACK_SIZE,empty));
19 #define EXECUTE(w) ((XT)(w->xt))()
41 env.cf = (CELL)untag_cons(env.cf);
43 env.cf = get(env.cf + CELLS);
45 if(TAG(next) == WORD_TYPE)
47 env.w = (WORD*)UNTAG(next);
58 /* XT of deferred words */
61 general_error(ERROR_UNDEFINED_WORD,tag_word(env.w));
64 /* XT of compound definitions */
67 /* tail call optimization */
70 /* the parameter is the colon def */
71 env.cf = env.w->parameter;
75 void primitive_execute(void)
77 WORD* word = untag_word(env.dt);
83 void primitive_call(void)
85 CELL calling = env.dt;
92 void primitive_ifte(void)
97 CELL calling = (untag_boolean(cond) ? t : f);
104 void primitive_getenv(void)
106 FIXNUM e = untag_fixnum(env.dt);
107 if(e < 0 || e >= USER_ENV)
108 range_error(F,e,USER_ENV);
109 env.dt = env.user[e];
112 void primitive_setenv(void)
114 FIXNUM e = untag_fixnum(env.dt);
116 if(e < 0 || e >= USER_ENV)
117 range_error(F,e,USER_ENV);
118 check_non_empty(value);
123 void primitive_exit(void)
125 exit(untag_fixnum(env.dt));