*** empty log message ***

This commit is contained in:
hyung-hwan 2005-07-24 16:50:53 +00:00
parent 0b9899fd53
commit fbb5baf096
2 changed files with 26 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: stx.c,v 1.34 2005-07-19 12:08:04 bacon Exp $
* $Id: stx.c,v 1.35 2005-07-24 16:50:53 bacon Exp $
*/
#include <xp/stx/stx.h>
@ -8,6 +8,8 @@
xp_stx_t* xp_stx_open (xp_stx_t* stx, xp_word_t capacity)
{
xp_word_t i;
if (stx == XP_NULL) {
stx = (xp_stx_t*)xp_malloc (xp_sizeof(stx));
if (stx == XP_NULL) return XP_NULL;
@ -20,6 +22,16 @@ xp_stx_t* xp_stx_open (xp_stx_t* stx, xp_word_t capacity)
return XP_NULL;
}
stx->symtab.size = 0;
stx->symtab.capacity = 256;
stx->symtab.data = (xp_word_t*)xp_malloc (
xp_sizeof(xp_word_t) * stx->symtab.capacity);
if (stx->symtab.data == XP_NULL) {
xp_stx_memory_close (&stx->memory);
if (stx->__malloced) xp_free (stx);
return XP_NULL;
}
stx->nil = XP_STX_NIL;
stx->true = XP_STX_TRUE;
stx->false = XP_STX_FALSE;
@ -41,12 +53,17 @@ xp_stx_t* xp_stx_open (xp_stx_t* stx, xp_word_t capacity)
stx->class_method = XP_STX_NIL;
stx->class_smallinteger = XP_STX_NIL;
for (i = 0; i < stx->symtab.capacity; i++) {
stx->symtab.data[i] = stx->nil;
}
stx->__wantabort = xp_false;
return stx;
}
void xp_stx_close (xp_stx_t* stx)
{
xp_free (stx->symtab.data);
xp_stx_memory_close (&stx->memory);
if (stx->__malloced) xp_free (stx);
}

View File

@ -1,5 +1,5 @@
/*
* $Id: stx.h,v 1.38 2005-07-19 12:08:04 bacon Exp $
* $Id: stx.h,v 1.39 2005-07-24 16:50:53 bacon Exp $
*/
#ifndef _XP_STX_STX_H_
@ -60,6 +60,13 @@ struct xp_stx_memory_t
struct xp_stx_t
{
xp_stx_memory_t memory;
struct
{
xp_word_t* data;
xp_word_t size;
xp_word_t capacity;
} symtab;
xp_word_t nil;
xp_word_t true;