#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
return poly & AO_SCHEME_CONST;
}
-#define AO_SCHEME_IS_CONST(a) (ao_scheme_const <= ((uint8_t *) (a)) && ((uint8_t *) (a)) < ao_scheme_const + AO_SCHEME_POOL_CONST)
-#define AO_SCHEME_IS_POOL(a) (ao_scheme_pool <= ((uint8_t *) (a)) && ((uint8_t *) (a)) < ao_scheme_pool + AO_SCHEME_POOL)
-#define AO_SCHEME_IS_INT(p) (ao_scheme_poly_base_type(p) == AO_SCHEME_INT)
-#define AO_SCHEME_IS_CONS(p) (ao_scheme_poly_base_type(p) == AO_SCHEME_CONS)
+static inline int
+ao_scheme_is_const_addr(const void *addr) {
+ const uint8_t *a = addr;
+ return (ao_scheme_const <= a) && (a < ao_scheme_const + AO_SCHEME_POOL_CONST);
+}
+
+static inline int
+ao_scheme_is_pool_addr(const void *addr) {
+ const uint8_t *a = addr;
+ return (ao_scheme_pool <= a) && (a < ao_scheme_pool + AO_SCHEME_POOL);
+}
void *
ao_scheme_ref(ao_poly poly);
#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_stack_stash(int id, struct ao_scheme_stack *stack) {
- ao_scheme_poly_stash(id, ao_scheme_stack_poly(stack));
+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(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 */
ao_scheme_cons_cdr(struct ao_scheme_cons *cons);
ao_poly
-ao_scheme__cons(ao_poly car, ao_poly cdr);
+ao_scheme_cons(ao_poly car, ao_poly cdr);
extern struct ao_scheme_cons *ao_scheme_cons_free_list;
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);
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;