#ifndef __PF_STACK__ #define __PF_STACK__ /** @file stack.h @brief Basic stack operations All the pf_stack_ functions perform reference count management. As opposed to pf_list_ and pf_tree_ operations, which work on the list/tree structure only. A stack is treated as a tree (all embedded lists are branches), and all data is owned by the stack. Note that if you create objects that are not referenced on the stacks (return/data/dictionary stacks), you explicitly need to manage them yourself. */ void pf_stack_free(pf_stack_t *s); void pf_stack_clear(pf_stack_t *s); /* forth words. not all the words in forth.c are declared here. if you need more (i.e. for extension modules), this is the place to add declarations. */ pf_error_t pf_stack_drop(pf_stack_t *s); pf_error_t pf_stack_swap(pf_stack_t *s); /* some util stuff */ pf_stack_t *pf_stack_new(void); void pf_stack_free(pf_stack_t *s); void pf_stack_clear(pf_stack_t *s); /* move between two stacks*/ static inline void pf_stack_move(pf_stack_t *from, pf_stack_t *to) { pf_list_push_atom(to, pf_list_pop_atom(from)); } static inline pf_error_t pf_check_atom(pf_atom_t *s, int n){ while (n--) if (!(s = pf_atom_next(s))) return e_underflow; return e_ok; } #endif