*** empty log message ***

This commit is contained in:
hyung-hwan 2005-09-18 03:57:26 +00:00
parent bfeb8dac69
commit 84badb1a49
2 changed files with 18 additions and 18 deletions

View File

@ -1,21 +1,22 @@
/* /*
* $Id: lsp.c,v 1.2 2005-09-17 17:50:45 bacon Exp $ * $Id: lsp.c,v 1.3 2005-09-18 03:57:26 bacon Exp $
*/ */
#include <xp/lsp/lisp.h> #include <xp/lsp/lsp.h>
#include <xp/bas/memory.h> #include <xp/bas/memory.h>
#include <xp/bas/assert.h> #include <xp/bas/assert.h>
xp_lisp_t*xp_lsp_open xp_lsp_t* lsp, xp_size_t mem_ubound, xp_size_t mem_ubound_inc) xp_lsp_t* xp_lsp_open (xp_lsp_t* lsp,
xp_size_t mem_ubound, xp_size_t mem_ubound_inc)
{ {
if (lsp == XP_NULL) { if (lsp == XP_NULL) {
lsp = xp_lsp_t*)xp_malloc(sizeofxp_lsp_t)); lsp = (xp_lsp_t*)xp_malloc(sizeofxp_lsp_t));
if (lsp == XP_NULL) return lsp; if (lsp == XP_NULL) return lsp;
lsp->__malloced = xp_true; lsp->__malloced = xp_true;
} }
else lsp->__malloced = xp_false; else lsp->__malloced = xp_false;
lsp->token =xp_lsp_token_new (256); lsp->token = xp_lsp_token_new (256);
if (lsp->token == XP_NULL) { if (lsp->token == XP_NULL) {
xp_free (lsp); xp_free (lsp);
return XP_NULL; return XP_NULL;
@ -31,29 +32,28 @@ xp_lisp_t*xp_lsp_open xp_lsp_t* lsp, xp_size_t mem_ubound, xp_size_t mem_ubound_
lsp->creader_just_set = 0; lsp->creader_just_set = 0;
lsp->outstream = xp_stdout; lsp->outstream = xp_stdout;
lsp->mem =xp_lsp_mem_new (mem_ubound, mem_ubound_inc); lsp->mem = xp_lsp_mem_new (mem_ubound, mem_ubound_inc);
if (lsp->mem == XP_NULL) { if (lsp->mem == XP_NULL) {
xp_lsp_token_free (lsp->token); xp_lsp_token_free (lsp->token);
free (lsp); if (lsp->__malloced) xp_free (lsp);
return XP_NULL; return XP_NULL;
} }
if xp_lsp_add_prims (lsp->mem) == -1) { if (xp_lsp_add_prims (lsp->mem) == -1) {
xp_lsp_mem_free (lsp->mem); xp_lsp_mem_free (lsp->mem);
xp_lsp_token_free (lsp->token); xp_lsp_token_free (lsp->token);
free (lsp); if (lsp->__malloced) xp_free (lsp);
return XP_NULL; return XP_NULL;
} }
return lsp; return lsp;
} }
voidxp_lsp_free xp_lsp_t* lsp) void xp_lsp_close (xp_lsp_t* lsp)
{ {
xp_assert (lsp != XP_NULL); xp_assert (lsp != XP_NULL);
xp_lsp_mem_free (lsp->mem);
xp_lsp_mem_free (lsp->mem); xp_lsp_token_free (lsp->token);
xp_lsp_token_free (lsp->token);
if (lsp->__malloced) xp_free (lsp); if (lsp->__malloced) xp_free (lsp);
} }

View File

@ -1,5 +1,5 @@
/* /*
* $Id: lsp.h,v 1.2 2005-09-17 17:50:45 bacon Exp $ * $Id: lsp.h,v 1.3 2005-09-18 03:57:26 bacon Exp $
*/ */
#ifndef _XP_LSP_LSP_H_ #ifndef _XP_LSP_LSP_H_