From f0448b3e43734fe2a8259b8db6a2d48a4867515c Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sat, 17 Sep 2005 17:42:21 +0000 Subject: [PATCH] *** empty log message *** --- ase/lsp/{lisp.c => lsp.c} | 16 ++++++++------- ase/lsp/{lisp.h => lsp.h} | 11 ++++++---- ase/types.h | 43 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 58 insertions(+), 12 deletions(-) rename ase/lsp/{lisp.c => lsp.c} (77%) rename ase/lsp/{lisp.h => lsp.h} (87%) diff --git a/ase/lsp/lisp.c b/ase/lsp/lsp.c similarity index 77% rename from ase/lsp/lisp.c rename to ase/lsp/lsp.c index 7719b825..743d453c 100644 --- a/ase/lsp/lisp.c +++ b/ase/lsp/lsp.c @@ -1,17 +1,19 @@ /* - * $Id: lisp.c,v 1.10 2005-05-30 07:15:35 bacon Exp $ + * $Id: lsp.c,v 1.1 2005-09-17 17:42:21 bacon Exp $ */ #include #include #include -xp_lisp_t* xp_lisp_new (xp_size_t mem_ubound, xp_size_t mem_ubound_inc) +xp_lisp_t* xp_lisp_open (xp_lisp_t* lsp, xp_size_t mem_ubound, xp_size_t mem_ubound_inc) { - xp_lisp_t* lsp; - - lsp = (xp_lisp_t*)xp_malloc(sizeof(xp_lisp_t)); - if (lsp == XP_NULL) return lsp; + if (lsp == XP_NULL) { + lsp = (xp_lisp_t*)xp_malloc(sizeof(xp_lisp_t)); + if (lsp == XP_NULL) return lsp; + lsp->__malloced = xp_true; + } + else lsp->__malloced = xp_false; lsp->token = xp_lisp_token_new (256); if (lsp->token == XP_NULL) { @@ -52,7 +54,7 @@ void xp_lisp_free (xp_lisp_t* lsp) xp_lisp_mem_free (lsp->mem); xp_lisp_token_free (lsp->token); - free (lsp); + if (lsp->__malloced) xp_free (lsp); } int xp_lisp_error (xp_lisp_t* lsp, xp_char_t* buf, xp_size_t size) diff --git a/ase/lsp/lisp.h b/ase/lsp/lsp.h similarity index 87% rename from ase/lsp/lisp.h rename to ase/lsp/lsp.h index 95a6f95e..25a56fdc 100644 --- a/ase/lsp/lisp.h +++ b/ase/lsp/lsp.h @@ -1,5 +1,5 @@ /* - * $Id: lisp.h,v 1.5 2005-05-28 13:34:26 bacon Exp $ + * $Id: lsp.h,v 1.1 2005-09-17 17:42:21 bacon Exp $ */ #ifndef _XP_LSP_LISP_H_ @@ -58,6 +58,7 @@ struct xp_lisp_t /* memory manager */ xp_lisp_mem_t* mem; + xp_bool_t __malloced; }; typedef struct xp_lisp_t xp_lisp_t; @@ -67,9 +68,11 @@ extern "C" { #endif /* lsp.c */ -xp_lisp_t* xp_lisp_new (xp_size_t mem_ubound, xp_size_t mem_ubound_inc); -void xp_lisp_free (xp_lisp_t* lsp); -int xp_lisp_error (xp_lisp_t* lsp, xp_char_t* buf, xp_size_t size); +xp_lisp_t* xp_lisp_open (xp_lisp_t* lisp, + xp_size_t mem_ubound, xp_size_t mem_ubound_inc); +void xp_lisp_close (xp_lisp_t* lsp); + +int xp_lisp_error (xp_lisp_t* lsp, xp_char_t* buf, xp_size_t size); /* read.c */ // TODO: move xp_lisp_set_creader to lsp.c diff --git a/ase/types.h b/ase/types.h index 75319dad..626ad08c 100644 --- a/ase/types.h +++ b/ase/types.h @@ -1,5 +1,5 @@ /* - * $Id: types.h,v 1.31 2005-08-15 04:14:54 bacon Exp $ + * $Id: types.h,v 1.32 2005-09-17 17:42:21 bacon Exp $ */ #ifndef _XP_TYPES_H_ @@ -13,6 +13,47 @@ #include #endif +/* + * HEADER: types.h + * The toolkit predefines some of commonly used data types. + * + * GROUP: State Types + * + * TYPE: xp_bool_t + * Boolean type + * + * TYPE: xp_tri_t + * Tri-State type + * + * GROUP: Integral Types + * + * TYPE: xp_byte_t + * + * TYPE: xp_int_t + * + * TYPE: xp_uint_t + * + * TYPE: xp_long_t + * + * TYPE: xp_ulong_t + * + * TYPE: xp_int8_t + * + * TYPE: xp_uint8_t + * + * TYPE: xp_int16_t + * + * TYPE: xp_uint16_t + * + * TYPE: xp_int32_t + * + * TYPE: xp_uint32_t + * + * TYPE: xp_int64_t + * + * TYPE: xp_uint64_t + */ + /* boolean type */ /* #ifdef __cplusplus