X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fscheme%2Fao_scheme.h;h=68803462841bcefb989fbb6a301e28bff380204a;hb=036a5311cbc86dbc5a8f859778d52d588915e4e2;hp=5cae0bda0558dc17f630be0e8dda60c9d58480ee;hpb=71fb79492cb955af4bd52e79f1fa69d17e084dbc;p=fw%2Faltos diff --git a/src/scheme/ao_scheme.h b/src/scheme/ao_scheme.h index 5cae0bda..68803462 100644 --- a/src/scheme/ao_scheme.h +++ b/src/scheme/ao_scheme.h @@ -71,7 +71,7 @@ ao_scheme_os_restore(void); #endif #ifdef AO_SCHEME_MAKE_CONST -#define AO_SCHEME_POOL_CONST 16384 +#define AO_SCHEME_POOL_CONST 32764 extern uint8_t ao_scheme_const[AO_SCHEME_POOL_CONST] __attribute__((aligned(4))); #define ao_scheme_pool ao_scheme_const #define AO_SCHEME_POOL AO_SCHEME_POOL_CONST @@ -595,38 +595,72 @@ ao_scheme_cons_check(struct ao_scheme_cons *cons); #endif void -ao_scheme_cons_stash(int id, struct ao_scheme_cons *cons); +ao_scheme_poly_stash(ao_poly poly); -struct ao_scheme_cons * -ao_scheme_cons_fetch(int id); +ao_poly +ao_scheme_poly_fetch(void); -void -ao_scheme_poly_stash(int id, ao_poly poly); +static inline void +ao_scheme_cons_stash(struct ao_scheme_cons *cons) { + ao_scheme_poly_stash(ao_scheme_cons_poly(cons)); +} -ao_poly -ao_scheme_poly_fetch(int id); +static inline struct ao_scheme_cons * +ao_scheme_cons_fetch(void) { + return ao_scheme_poly_cons(ao_scheme_poly_fetch()); +} -void -ao_scheme_string_stash(int id, struct ao_scheme_string *string); +static inline void +ao_scheme_atom_stash(struct ao_scheme_atom *atom) { + ao_scheme_poly_stash(ao_scheme_atom_poly(atom)); +} -struct ao_scheme_string * -ao_scheme_string_fetch(int id); +static inline struct ao_scheme_atom * +ao_scheme_atom_fetch(void) { + return ao_scheme_poly_atom(ao_scheme_poly_fetch()); +} + +static inline void +ao_scheme_string_stash(struct ao_scheme_string *string) { + ao_scheme_poly_stash(ao_scheme_string_poly(string)); +} + +static inline struct ao_scheme_string * +ao_scheme_string_fetch(void) { + return ao_scheme_poly_string(ao_scheme_poly_fetch()); +} + +#ifdef AO_SCHEME_FEATURE_VECTOR +static inline void +ao_scheme_vector_stash(struct ao_scheme_vector *vector) { + ao_scheme_poly_stash(ao_scheme_vector_poly(vector)); +} + +static inline struct ao_scheme_vector * +ao_scheme_vector_fetch(void) { + return ao_scheme_poly_vector(ao_scheme_poly_fetch()); +} +#endif static inline void -ao_scheme_stack_stash(int id, struct ao_scheme_stack *stack) { - ao_scheme_poly_stash(id, ao_scheme_stack_poly(stack)); +ao_scheme_stack_stash(struct ao_scheme_stack *stack) { + ao_scheme_poly_stash(ao_scheme_stack_poly(stack)); } static inline struct ao_scheme_stack * -ao_scheme_stack_fetch(int id) { - return ao_scheme_poly_stack(ao_scheme_poly_fetch(id)); +ao_scheme_stack_fetch(void) { + return ao_scheme_poly_stack(ao_scheme_poly_fetch()); } -void -ao_scheme_frame_stash(int id, struct ao_scheme_frame *frame); +static inline void +ao_scheme_frame_stash(struct ao_scheme_frame *frame) { + ao_scheme_poly_stash(ao_scheme_frame_poly(frame)); +} -struct ao_scheme_frame * -ao_scheme_frame_fetch(int id); +static inline struct ao_scheme_frame * +ao_scheme_frame_fetch(void) { + return ao_scheme_poly_frame(ao_scheme_poly_fetch()); +} /* bool */ @@ -676,7 +710,10 @@ struct ao_scheme_string * ao_scheme_string_copy(struct ao_scheme_string *a); struct ao_scheme_string * -ao_scheme_string_make(char *a); +ao_scheme_string_new(char *a); + +struct ao_scheme_string * +ao_scheme_make_string(int32_t len, char fill); struct ao_scheme_string * ao_scheme_atom_to_string(struct ao_scheme_atom *a); @@ -774,7 +811,7 @@ struct ao_scheme_vector * ao_scheme_list_to_vector(struct ao_scheme_cons *cons); struct ao_scheme_cons * -ao_scheme_vector_to_list(struct ao_scheme_vector *vector); +ao_scheme_vector_to_list(struct ao_scheme_vector *vector, int start, int end); extern const struct ao_scheme_type ao_scheme_vector_type;