*** empty log message ***
This commit is contained in:
parent
273adcb58d
commit
108d071ef0
@ -1,10 +1,11 @@
|
||||
/*
|
||||
* $Id: stx.c,v 1.2 2005-05-08 10:31:24 bacon Exp $
|
||||
* $Id: stx.c,v 1.3 2005-05-08 10:44:58 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <xp/stx/stx.h>
|
||||
#include <xp/stx/memory.h>
|
||||
#include <xp/bas/memory.h>
|
||||
#include <xp/bas/assert.h>
|
||||
|
||||
xp_stx_t* xp_stx_open (xp_stx_t* stx, xp_stx_word_t capacity)
|
||||
{
|
||||
@ -33,4 +34,16 @@ void xp_stx_close (xp_stx_t* stx)
|
||||
if (stx->__malloced) xp_free (stx);
|
||||
}
|
||||
|
||||
int xp_stx_bootstrap (xp_stx_t* stx)
|
||||
{
|
||||
stx->nil = 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);
|
||||
|
||||
xp_assert (stx->nil == XP_STX_NIL);
|
||||
xp_assert (stx->true == XP_STX_TRUE);
|
||||
xp_assert (stx->false == XP_STX_FALSE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stx.h,v 1.2 2005-05-08 10:31:24 bacon Exp $
|
||||
* $Id: stx.h,v 1.3 2005-05-08 10:44:58 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _XP_STX_STX_H_
|
||||
@ -115,8 +115,6 @@ struct xp_stx_t
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -124,6 +122,8 @@ extern "C" {
|
||||
xp_stx_t* xp_stx_open (xp_stx_t* stx, xp_stx_word_t capacity);
|
||||
void xp_stx_close (xp_stx_t* stx);
|
||||
|
||||
int xp_stx_bootstrap (xp_stx_t* stx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -3,7 +3,7 @@ OUTS = $(SRCS:.c=.x)
|
||||
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@ -I@abs_top_builddir@
|
||||
LDFLAGS = @LDFLAGS@ -L@abs_top_builddir@/xp/bas -L@abs_top_builddir@/xp/lisp
|
||||
LDFLAGS = @LDFLAGS@ -L@abs_top_builddir@/xp/bas -L@abs_top_builddir@/xp/stx
|
||||
LIBS = @LIBS@ -lxpstx -lxpbas
|
||||
|
||||
all: $(OUTS)
|
||||
|
@ -7,13 +7,15 @@ int xp_main ()
|
||||
xp_stx_word_t i;
|
||||
|
||||
if (xp_stx_open (&stx, 10) == XP_NULL) {
|
||||
xp_printf (XP_TEXT("cannot open memory\n"));
|
||||
xp_printf (XP_TEXT("cannot open stx\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
stx.nil = 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);
|
||||
if (xp_stx_bootstrap(&stx) == -1) {
|
||||
xp_stx_close (&stx);
|
||||
xp_printf (XP_TEXT("cannot bootstrap\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
xp_printf (XP_TEXT("stx.nil %d\n"), stx.nil);
|
||||
xp_printf (XP_TEXT("stx.true %d\n"), stx.true);
|
||||
|
Loading…
Reference in New Issue
Block a user