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-08 10:44:58 +00:00
|
|
|
xp_printf (XP_TEXT("cannot open stx\n"));
|
2005-05-06 17:18:29 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2005-05-08 10:44:58 +00:00
|
|
|
if (xp_stx_bootstrap(&stx) == -1) {
|
|
|
|
xp_stx_close (&stx);
|
|
|
|
xp_printf (XP_TEXT("cannot bootstrap\n"));
|
|
|
|
return -1;
|
|
|
|
}
|
2005-05-08 10:31:25 +00:00
|
|
|
|
2005-05-08 10:39:40 +00:00
|
|
|
xp_printf (XP_TEXT("stx.nil %d\n"), stx.nil);
|
|
|
|
xp_printf (XP_TEXT("stx.true %d\n"), stx.true);
|
|
|
|
xp_printf (XP_TEXT("stx.false %d\n"), stx.false);
|
|
|
|
|
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:58:26 +00:00
|
|
|
for (i = 5; i < 10; 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;
|
|
|
|
}
|
|
|
|
|