*** empty log message ***
This commit is contained in:
		| @ -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> | #include <xp/stx/stx.h> | ||||||
| @ -8,6 +8,8 @@ | |||||||
|  |  | ||||||
| xp_stx_t* xp_stx_open (xp_stx_t* stx, xp_word_t capacity) | xp_stx_t* xp_stx_open (xp_stx_t* stx, xp_word_t capacity) | ||||||
| { | { | ||||||
|  | 	xp_word_t i; | ||||||
|  |  | ||||||
| 	if (stx == XP_NULL) { | 	if (stx == XP_NULL) { | ||||||
| 		stx = (xp_stx_t*)xp_malloc (xp_sizeof(stx)); | 		stx = (xp_stx_t*)xp_malloc (xp_sizeof(stx)); | ||||||
| 		if (stx == XP_NULL) return XP_NULL; | 		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; | 		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->nil = XP_STX_NIL; | ||||||
| 	stx->true = XP_STX_TRUE; | 	stx->true = XP_STX_TRUE; | ||||||
| 	stx->false = XP_STX_FALSE; | 	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_method = XP_STX_NIL; | ||||||
| 	stx->class_smallinteger = 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; | 	stx->__wantabort = xp_false; | ||||||
| 	return stx; | 	return stx; | ||||||
| } | } | ||||||
|  |  | ||||||
| void xp_stx_close (xp_stx_t* stx) | void xp_stx_close (xp_stx_t* stx) | ||||||
| { | { | ||||||
|  | 	xp_free (stx->symtab.data); | ||||||
| 	xp_stx_memory_close (&stx->memory); | 	xp_stx_memory_close (&stx->memory); | ||||||
| 	if (stx->__malloced) xp_free (stx); | 	if (stx->__malloced) xp_free (stx); | ||||||
| } | } | ||||||
|  | |||||||
| @ -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_ | #ifndef _XP_STX_STX_H_ | ||||||
| @ -61,6 +61,13 @@ struct xp_stx_t | |||||||
| { | { | ||||||
| 	xp_stx_memory_t memory; | 	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 nil; | ||||||
| 	xp_word_t true; | 	xp_word_t true; | ||||||
| 	xp_word_t false; | 	xp_word_t false; | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user