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);
48 /* printf("EXECUTE %d\n",env.w->primitive); */
53 /* printf("DPUSH %d\n",type_of(next)); */
60 /* XT of deferred words */
63 general_error(ERROR_UNDEFINED_WORD,tag_word(env.w));
66 /* XT of compound definitions */
69 /* tail call optimization */
72 /* the parameter is the colon def */
73 env.cf = env.w->parameter;
77 void primitive_execute(void)
79 WORD* word = untag_word(env.dt);
85 void primitive_call(void)
87 CELL calling = env.dt;
94 void primitive_ifte(void)
99 CELL calling = (untag_boolean(cond) ? t : f);
106 void primitive_getenv(void)
108 FIXNUM e = to_fixnum(env.dt);
109 if(e < 0 || e >= USER_ENV)
110 range_error(F,e,USER_ENV);
111 env.dt = env.user[e];
114 void primitive_setenv(void)
116 FIXNUM e = to_fixnum(env.dt);
118 if(e < 0 || e >= USER_ENV)
119 range_error(F,e,USER_ENV);
120 check_non_empty(value);
125 void primitive_exit(void)
127 exit(to_fixnum(env.dt));