2005-05-08 07:39:51 +00:00
|
|
|
/*
|
2005-05-22 15:38:31 +00:00
|
|
|
* $Id: stx.c,v 1.27 2005-05-22 15:38:31 bacon Exp $
|
2005-05-08 07:39:51 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <xp/stx/stx.h>
|
|
|
|
#include <xp/stx/memory.h>
|
2005-05-19 16:41:10 +00:00
|
|
|
#include <xp/stx/misc.h>
|
2005-05-08 07:39:51 +00:00
|
|
|
|
|
|
|
xp_stx_t* xp_stx_open (xp_stx_t* stx, xp_stx_word_t capacity)
|
|
|
|
{
|
|
|
|
if (stx == XP_NULL) {
|
2005-05-19 16:41:10 +00:00
|
|
|
stx = (xp_stx_t*)xp_stx_malloc (xp_sizeof(stx));
|
2005-05-08 07:39:51 +00:00
|
|
|
if (stx == XP_NULL) return XP_NULL;
|
|
|
|
stx->__malloced = xp_true;
|
|
|
|
}
|
|
|
|
else stx->__malloced = xp_false;
|
|
|
|
|
|
|
|
if (xp_stx_memory_open (&stx->memory, capacity) == XP_NULL) {
|
2005-05-19 16:41:10 +00:00
|
|
|
if (stx->__malloced) xp_stx_free (stx);
|
2005-05-08 07:39:51 +00:00
|
|
|
return XP_NULL;
|
|
|
|
}
|
|
|
|
|
2005-05-08 10:31:25 +00:00
|
|
|
stx->nil = XP_STX_NIL;
|
|
|
|
stx->true = XP_STX_TRUE;
|
|
|
|
stx->false = XP_STX_FALSE;
|
|
|
|
|
2005-05-10 06:08:57 +00:00
|
|
|
stx->symbol_table = XP_STX_NIL;
|
2005-05-17 16:18:56 +00:00
|
|
|
stx->smalltalk = XP_STX_NIL;
|
|
|
|
|
2005-05-18 04:01:51 +00:00
|
|
|
stx->class_symlink = XP_STX_NIL;
|
2005-05-10 15:15:58 +00:00
|
|
|
stx->class_symbol = XP_STX_NIL;
|
2005-05-10 12:00:43 +00:00
|
|
|
stx->class_metaclass = XP_STX_NIL;
|
2005-05-18 04:01:51 +00:00
|
|
|
stx->class_pairlink = XP_STX_NIL;
|
2005-05-17 16:18:56 +00:00
|
|
|
|
2005-05-15 18:37:00 +00:00
|
|
|
stx->class_method = XP_STX_NIL;
|
|
|
|
stx->class_context = XP_STX_NIL;
|
2005-05-10 06:08:57 +00:00
|
|
|
|
2005-05-15 18:37:00 +00:00
|
|
|
stx->__wantabort = xp_false;
|
2005-05-08 07:39:51 +00:00
|
|
|
return stx;
|
|
|
|
}
|
|
|
|
|
|
|
|
void xp_stx_close (xp_stx_t* stx)
|
|
|
|
{
|
|
|
|
xp_stx_memory_close (&stx->memory);
|
2005-05-19 16:41:10 +00:00
|
|
|
if (stx->__malloced) xp_stx_free (stx);
|
2005-05-08 07:39:51 +00:00
|
|
|
}
|
|
|
|
|