#include <v_lib.h>

/*
 *	Adjusting storage of stacks
 */

void dump(u8_stack_t *s)
{
	printf("next_elem %u, n_elem %00000008X, buf %00000008X\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);
    u8sAdjust(&s);
    dump(&s);
    u8sPush(&s,4);
    dump(&s);
    u8sResize(&s,0);
    dump(&s);
    u8sAdjust(&s);
    dump(&s);
	return 0;    
}
    