#include <v_lib.h>

/*
 * Adjusting storage of stacks
 */

void dump(u8_stack_t *s)
{
	printf("next_elem %u, n_elem %u, buf %08X\n",
		s->next_elem,s->n_elem,s->buf);
}

#define	BLOCKSIZE	(1024 * 137)
u8_t buf[BLOCKSIZE];

int main()
{
	u8_stack_t s=TYPED_STACK_EMPTY_INITIALIZER;
	logStartConsoleLog();
	logUpperLevel(LOG_TRACE);
	dump(&s);
	u8sPush(&s,1);
	u8sPush(&s,2);
	u8sPush(&s,3);
	dump(&s);
	u8sPushBuffer(&s,buf,BLOCKSIZE);
	dump(&s);
	u8sTrim(&s);
	dump(&s);
	u8sPush(&s,4);
	dump(&s);
	u8sResize(&s,0);
	dump(&s);
	u8sTrim(&s);
	dump(&s);
	return 0;	
}

