#ifndef TRE_STACK_H
#define TRE_STACK_H 1
#include "tre.h"
typedef struct tre_stack_rec tre_stack_t;
__private_extern__ tre_stack_t *
tre_stack_new(int size, int max_size, int increment);
__private_extern__ void
tre_stack_destroy(tre_stack_t *s);
__private_extern__ int
tre_stack_num_objects(tre_stack_t *s);
#define declare_pushf(typetag, type) \
__private_extern__ reg_errcode_t tre_stack_push_ ## typetag(tre_stack_t *s, \
type value)
declare_pushf(voidptr, void *);
declare_pushf(int, int);
#define declare_popf(typetag, type) \
__private_extern__ type tre_stack_pop_ ## typetag(tre_stack_t *s)
declare_popf(voidptr, void *);
declare_popf(int, int);
#define STACK_PUSH(s, typetag, value) \
do \
{ \
status = tre_stack_push_ ## typetag(s, value); \
} \
while (0)
#define STACK_PUSHX(s, typetag, value) \
{ \
status = tre_stack_push_ ## typetag(s, value); \
if (status != REG_OK) \
break; \
}
#define STACK_PUSHR(s, typetag, value) \
{ \
reg_errcode_t _status; \
_status = tre_stack_push_ ## typetag(s, value); \
if (_status != REG_OK) \
return _status; \
}
#endif