x-engine-c v0.2.31
The C engine for x-lang
Loading...
Searching...
No Matches
x-eval.h
Go to the documentation of this file.
1#ifndef X_EVAL_H
2#define X_EVAL_H
3
53/*
54 * ., .,
55 * {O,O}
56 * ( )
57 * " "
58 */
59
60#include "x-base.h"
61#include "x-eval-slots.h" /* the slots the evaluator's routines are called through */
62
66
76#define X_OBJ_FLAG_COV X_OBJ_FLAG_2
77
85#define X_OBJ_FLAG_TRACE 0x400
86
107#define X_OBJ_EVALS_SHIFT 11
108#define X_OBJ_EVALS_BITS 20
109#define X_OBJ_EVALS_ONE ((x_int_t)1 << X_OBJ_EVALS_SHIFT)
110#define X_OBJ_EVALS_MAX (((x_int_t)1 << X_OBJ_EVALS_BITS) - 1)
111#define x_obj_evals(X) ((x_obj_flags(X) >> X_OBJ_EVALS_SHIFT) & X_OBJ_EVALS_MAX)
112
113/* TRACE sits above x-expr's highest flag, the count above TRACE, and the
114 * count ends below bit 31. An x-expr bump that grows the flags, or an edit
115 * that moves or widens either, fails to compile here instead of sharing
116 * bits without a word. */
122 X_OBJ_EVALS_SHIFT + X_OBJ_EVALS_BITS <= 31 ? 1 : -1];
123
137#define x_error_handler_jmp(H) x_ptrval(x_firstobj(H))
138#define x_error_handler_saved_env(H) x_001(H)
139#define x_error_handler_error(H) x_011(H)
154#include "x-eval-layout.h" /* generated: x_eval_env/ctrl/io_state/state anchors + x_eval_field_* */
155
156
185#define X_READ_BUF_SIZE 65536
186
/* end base_field */
188
191
194
197
199x_obj_t *x_eval_buffer_push(x_obj_t *p_base, x_obj_t *p_buffer);
200
202
204void x_eval_error(x_obj_t *p_base, x_char_t *message, x_obj_t *p_obj);
205
208#define x_eval_arg_exp(X) x_0((X))
213
219
221void x_eval_spine_guard(x_obj_t *p_base, x_obj_t *p_obj);
222
224x_obj_t *x_eval_spine_first(x_obj_t *p_base, x_obj_t *p_pos);
225
228
231
234
239
242#endif /* X_EVAL_H */
static void x_obj_t * p_args
Definition x-prim.h:56
Definition x-obj.h:214
Base environment object – the root context for evaluation.
The base's slot vector – the engine's routines, each at a fixed position, called through the position...
x_satom_t x_eval_obj
Definition obj.c:20
x_obj_t * x_eval_type_alist_extend(x_obj_t *p_base, x_obj_t *p_args)
Definition x-eval.c:1065
void x_eval_spine_guard(x_obj_t *p_base, x_obj_t *p_obj)
Definition x-eval.c:375
#define X_OBJ_EVALS_BITS
Definition x-eval.h:108
x_obj_t * x_eval_body_tco(x_obj_t *p_base, x_obj_t *p_args)
Definition x-eval.c:572
x_obj_t * x_eval_op_body(x_obj_t *p_base, x_obj_t *p_args)
Definition x-eval.c:85
x_obj_t * x_eval(x_obj_t *p_base, x_obj_t *p_args)
Definition x-eval.c:223
x_obj_t * x_eval_type_alist_assoc(x_obj_t *p_base, x_obj_t *p_args)
Definition x-eval.c:1095
#define X_OBJ_EVALS_SHIFT
Definition x-eval.h:107
char x_assert_evals_above_trace[(x_int_t) X_OBJ_FLAG_TRACE< X_OBJ_EVALS_ONE ? 1 :-1]
Definition x-eval.h:120
char x_assert_trace_above_flags[X_OBJ_FLAG_MASK< X_OBJ_FLAG_TRACE ? 1 :-1]
Definition x-eval.h:118
#define X_OBJ_EVALS_ONE
Definition x-eval.h:109
x_obj_t * x_eval_body(x_obj_t *p_base, x_obj_t *p_args)
Definition x-eval.c:498
x_obj_t * x_eval_load(x_obj_t *p_base, x_obj_t *p_args)
Definition x-eval.c:1157
x_obj_t * x_eval_spine_first(x_obj_t *p_base, x_obj_t *p_pos)
Definition x-eval.c:414
#define X_OBJ_FLAG_TRACE
Definition x-eval.h:85
x_obj_t * x_eval_make(x_obj_t *p_base, x_obj_t *p_args)
Definition x-eval.c:808
void x_eval_error(x_obj_t *p_base, x_char_t *message, x_obj_t *p_obj)
Definition x-eval.c:951
x_obj_t * x_eval_buffer_push(x_obj_t *p_base, x_obj_t *p_buffer)
Definition x-eval.c:1122
x_obj_t * x_eval_tco_trampoline(x_obj_t *p_base, x_obj_t *p_args)
Definition x-eval.c:654
char x_assert_evals_below_sign[X_OBJ_EVALS_SHIFT+X_OBJ_EVALS_BITS<=31 ? 1 :-1]
Definition x-eval.h:122
x_obj_t * x_eval_list(x_obj_t *p_base, x_obj_t *p_args)
Definition x-eval.c:453
@ X_OBJ_FLAG_MASK
Definition x-obj.h:177
x_obj_t x_satom_t[X_OBJ_META_LEN+X_OBJ_UNITS_ATOM]
Definition x-obj.h:285
long x_int_t
Definition x.h:129
char x_char_t
Definition x.h:138