*** empty log message ***

This commit is contained in:
hyung-hwan 2005-05-08 11:16:07 +00:00
parent f547b276d5
commit bc284fd24f
5 changed files with 22 additions and 23 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: memory.c,v 1.6 2005-05-08 10:58:26 bacon Exp $ * $Id: memory.c,v 1.7 2005-05-08 11:16:07 bacon Exp $
*/ */
#include <xp/stx/memory.h> #include <xp/stx/memory.h>
@ -59,13 +59,6 @@ void xp_stx_memory_close (xp_stx_memory_t* mem)
if (mem->__malloced) xp_free (mem); if (mem->__malloced) xp_free (mem);
} }
/*
// resize the object table - mem
xp_stx_memory_t* xp_stx_memory_resize (xp_stx_memory_t* mem, xp_stx_word_t capacity)
{
}
*/
void xp_stx_memory_gc (xp_stx_memory_t* mem) void xp_stx_memory_gc (xp_stx_memory_t* mem)
{ {
/* TODO: implement this function */ /* TODO: implement this function */

View File

@ -1,12 +1,12 @@
/* /*
* $Id: object.c,v 1.3 2005-05-08 10:31:24 bacon Exp $ * $Id: object.c,v 1.4 2005-05-08 11:16:07 bacon Exp $
*/ */
#include <xp/stx/object.h> #include <xp/stx/object.h>
#include <xp/stx/memory.h> #include <xp/stx/memory.h>
/* n: number of instance variables */ /* n: number of instance variables */
xp_stx_word_t xp_stx_alloc_object (xp_stx_t* stx, xp_size_t n) xp_stx_word_t xp_stx_alloc_object (xp_stx_t* stx, xp_stx_word_t n)
{ {
xp_stx_word_t idx; xp_stx_word_t idx;
@ -25,7 +25,7 @@ xp_stx_word_t xp_stx_alloc_object (xp_stx_t* stx, xp_size_t n)
} }
/* n: number of bytes */ /* n: number of bytes */
xp_stx_word_t xp_stx_alloc_byte_object (xp_stx_t* stx, xp_size_t n) xp_stx_word_t xp_stx_alloc_byte_object (xp_stx_t* stx, xp_stx_word_t n)
{ {
xp_stx_word_t idx; xp_stx_word_t idx;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: object.h,v 1.2 2005-05-08 07:39:51 bacon Exp $ * $Id: object.h,v 1.3 2005-05-08 11:16:07 bacon Exp $
*/ */
#ifndef _XP_STX_OBJECT_H_ #ifndef _XP_STX_OBJECT_H_
@ -15,10 +15,10 @@
extern "C" { extern "C" {
#endif #endif
xp_stx_word_t xp_stx_alloc_object (xp_stx_t* stx, xp_size_t n); xp_stx_word_t xp_stx_alloc_object (xp_stx_t* stx, xp_stx_word_t n);
xp_stx_word_t xp_stx_alloc_byte_object (xp_stx_t* stx, xp_size_t n); xp_stx_word_t xp_stx_alloc_byte_object (xp_stx_t* stx, xp_stx_word_t n);
xp_stx_word_t xp_stx_alloc_string_object ( xp_stx_word_t xp_stx_alloc_string_object (
xp_stx_t* stx, xp_stx_char_t* str, xp_size_t n); xp_stx_t* stx, xp_stx_char_t* str, xp_stx_word_t n);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stx.c,v 1.3 2005-05-08 10:44:58 bacon Exp $ * $Id: stx.c,v 1.4 2005-05-08 11:16:07 bacon Exp $
*/ */
#include <xp/stx/stx.h> #include <xp/stx/stx.h>
@ -36,6 +36,8 @@ void xp_stx_close (xp_stx_t* stx)
int xp_stx_bootstrap (xp_stx_t* stx) int xp_stx_bootstrap (xp_stx_t* stx)
{ {
xp_stx_word_t symbols;
stx->nil = xp_stx_memory_alloc (&stx->memory, 0); stx->nil = xp_stx_memory_alloc (&stx->memory, 0);
stx->true = 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); stx->false = xp_stx_memory_alloc (&stx->memory, 0);
@ -44,6 +46,10 @@ int xp_stx_bootstrap (xp_stx_t* stx)
xp_assert (stx->true == XP_STX_TRUE); xp_assert (stx->true == XP_STX_TRUE);
xp_assert (stx->false == XP_STX_FALSE); xp_assert (stx->false == XP_STX_FALSE);
symbol_table = xp_stx_memory_alloc (&stx->memory, 1);
XP_STX_OBJECT_AT(&stx->memory, symbol_table, 0) = hash_table;
XP_STX_OBJECT_CLASS(&stx->memory, sbs) = symbol_class;
return 0; return 0;
} }

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stx.h,v 1.3 2005-05-08 10:44:58 bacon Exp $ * $Id: stx.h,v 1.4 2005-05-08 11:16:07 bacon Exp $
*/ */
#ifndef _XP_STX_STX_H_ #ifndef _XP_STX_STX_H_
@ -35,7 +35,7 @@ struct xp_stx_object_t
*/ */
xp_stx_word_t access; xp_stx_word_t access;
xp_stx_word_t class; xp_stx_word_t class;
/*xp_stx_word_t didxa[1];*/ /*xp_stx_word_t data[1];*/
}; };
/* /*
@ -43,14 +43,14 @@ struct xp_stx_byte_object_t
{ {
xp_stx_word_t access; xp_stx_word_t access;
xp_stx_word_t class; xp_stx_word_t class;
xp_stx_byte_t didxa[1]; xp_stx_byte_t data[1];
}; };
struct xp_stx_string_object_t struct xp_stx_string_object_t
{ {
xp_stx_word_t access; xp_stx_word_t access;
xp_stx_word_t class; xp_stx_word_t class;
xp_stx_char_t didxa[1]; xp_stx_char_t data[1];
}; };
*/ */
@ -92,10 +92,10 @@ struct xp_stx_t
/* /*
#define XP_STX_OBJECT_DATA(mem,idx) \ #define XP_STX_OBJECT_DATA(mem,idx) \
(((XP_STX_OBJECT_ACCESS(mem,idx) & 0x03) == 0x00)? \ (((XP_STX_OBJECT_ACCESS(mem,idx) & 0x03) == 0x00)? \
(XP_STX_OBJECT(mem,idx)).didxa): \ (XP_STX_OBJECT(mem,idx)).data): \
(((XP_STX_OBJECT_ACCESS(mem,idx) & 0x03) == 0x01)? \ (((XP_STX_OBJECT_ACCESS(mem,idx) & 0x03) == 0x01)? \
(XP_STX_BYTE_OBJECT(mem,idx)).didxa): \ (XP_STX_BYTE_OBJECT(mem,idx)).data): \
(XP_STX_STRING_OBJECT(mem,idx)).didxa)) (XP_STX_STRING_OBJECT(mem,idx)).data))
*/ */
#define XP_STX_OBJECT_AT(mem,idx,n) \ #define XP_STX_OBJECT_AT(mem,idx,n) \