2005-05-08 07:39:51 +00:00
|
|
|
/*
|
2005-06-08 16:05:41 +00:00
|
|
|
* $Id: stx.c,v 1.30 2005-06-08 16:00:51 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
|
|
|
|
2005-06-08 16:05:41 +00:00
|
|
|
xp_stx_t* xp_stx_open (xp_stx_t* stx, xp_word_t capacity)
|
2005-05-08 07:39:51 +00:00
|
|
|
{
|
|
|
|
if (stx == XP_NULL) {
|
2005-06-08 16:05:41 +00:00
|
|
|
stx = (xp_stx_t*)xp_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-06-08 16:05:41 +00:00
|
|
|
if (stx->__malloced) xp_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-25 16:44:05 +00:00
|
|
|
stx->class_object = XP_STX_NIL;
|
|
|
|
stx->class_class = XP_STX_NIL;
|
2005-05-23 14:43:03 +00:00
|
|
|
stx->class_array = 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-06-08 16:05:41 +00:00
|
|
|
if (stx->__malloced) xp_free (stx);
|
2005-05-08 07:39:51 +00:00
|
|
|
}
|
|
|
|
|