qse/ase/test/stx/stx.c

37 lines
736 B
C
Raw Normal View History

2005-05-06 17:18:29 +00:00
#include <xp/stx/memory.h>
#include <xp/bas/stdio.h>
int xp_main ()
{
2005-05-08 10:31:25 +00:00
xp_stx_t stx;
2005-05-06 17:18:29 +00:00
xp_stx_word_t i;
2005-05-08 10:31:25 +00:00
if (xp_stx_open (&stx, 10) == XP_NULL) {
2005-05-06 17:18:29 +00:00
xp_printf (XP_TEXT("cannot open memory\n"));
return -1;
}
2005-05-08 10:31:25 +00:00
stx.nil = xp_stx_memory_alloc(&stx.memory, 0);
stx.true = xp_stx_memory_alloc(&stx.memory, 0);
stx.false = xp_stx_memory_alloc(&stx.memory, 0);
2005-05-06 17:18:29 +00:00
for (i = 0; i < 20; i++) {
xp_printf (XP_TEXT("%d, %d\n"),
2005-05-08 10:31:25 +00:00
i, xp_stx_memory_alloc(&stx.memory, 100));
2005-05-06 17:18:29 +00:00
}
for (i = 0; i < 5; i++) {
2005-05-08 10:31:25 +00:00
xp_stx_memory_dealloc (&stx.memory, i);
2005-05-06 17:18:29 +00:00
}
for (i = 0; i < 20; i++) {
xp_printf (XP_TEXT("%d, %d\n"),
2005-05-08 10:31:25 +00:00
i, xp_stx_memory_alloc(&stx.memory, 100));
2005-05-06 17:18:29 +00:00
}
2005-05-08 10:31:25 +00:00
xp_stx_close (&stx);
2005-05-06 17:18:29 +00:00
xp_printf (XP_TEXT("End of program\n"));
return 0;
}