*** empty log message ***
This commit is contained in:
parent
bfeb8dac69
commit
84badb1a49
@ -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/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) {
|
||||
lsp = xp_lsp_t*)xp_malloc(sizeofxp_lsp_t));
|
||||
lsp = (xp_lsp_t*)xp_malloc(sizeofxp_lsp_t));
|
||||
if (lsp == XP_NULL) return lsp;
|
||||
lsp->__malloced = xp_true;
|
||||
}
|
||||
else lsp->__malloced = xp_false;
|
||||
|
||||
lsp->token =xp_lsp_token_new (256);
|
||||
lsp->token = xp_lsp_token_new (256);
|
||||
if (lsp->token == XP_NULL) {
|
||||
xp_free (lsp);
|
||||
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->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) {
|
||||
xp_lsp_token_free (lsp->token);
|
||||
free (lsp);
|
||||
xp_lsp_token_free (lsp->token);
|
||||
if (lsp->__malloced) xp_free (lsp);
|
||||
return XP_NULL;
|
||||
}
|
||||
|
||||
if xp_lsp_add_prims (lsp->mem) == -1) {
|
||||
xp_lsp_mem_free (lsp->mem);
|
||||
xp_lsp_token_free (lsp->token);
|
||||
free (lsp);
|
||||
if (xp_lsp_add_prims (lsp->mem) == -1) {
|
||||
xp_lsp_mem_free (lsp->mem);
|
||||
xp_lsp_token_free (lsp->token);
|
||||
if (lsp->__malloced) xp_free (lsp);
|
||||
return XP_NULL;
|
||||
}
|
||||
|
||||
return lsp;
|
||||
}
|
||||
|
||||
voidxp_lsp_free xp_lsp_t* lsp)
|
||||
void xp_lsp_close (xp_lsp_t* lsp)
|
||||
{
|
||||
xp_assert (lsp != XP_NULL);
|
||||
|
||||
xp_lsp_mem_free (lsp->mem);
|
||||
xp_lsp_token_free (lsp->token);
|
||||
xp_lsp_mem_free (lsp->mem);
|
||||
xp_lsp_token_free (lsp->token);
|
||||
if (lsp->__malloced) xp_free (lsp);
|
||||
}
|
||||
|
||||
|
@ -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_
|
||||
@ -58,7 +58,7 @@ struct xp_lsp_t
|
||||
xp_lsp_creader_t creader;
|
||||
void* creader_extra;
|
||||
int creader_just_set;
|
||||
xp_lsp_token_t* token;
|
||||
xp_lsp_token_t* token;
|
||||
|
||||
/* for eval */
|
||||
xp_size_t max_eval_depth; // TODO:....
|
||||
|
Loading…
Reference in New Issue
Block a user