From 2b2520afafa1c9a88835d90c2a199470aad7ea0f Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 18 Sep 2005 12:20:43 +0000 Subject: [PATCH] *** empty log message *** --- ase/lsp/init.c | 10 +++++----- ase/lsp/lsp.h | 16 ++++++++-------- ase/lsp/print.c | 4 ++-- ase/lsp/read.c | 34 +++++++++++++--------------------- ase/test/lsp/lisp.c | 4 ++-- 5 files changed, 30 insertions(+), 38 deletions(-) diff --git a/ase/lsp/init.c b/ase/lsp/init.c index d50d6314..7c9451aa 100644 --- a/ase/lsp/init.c +++ b/ase/lsp/init.c @@ -1,5 +1,5 @@ /* - * $Id: init.c,v 1.1 2005-09-18 10:18:35 bacon Exp $ + * $Id: init.c,v 1.2 2005-09-18 12:20:43 bacon Exp $ */ #include @@ -76,7 +76,7 @@ int xp_lsp_attach_input (xp_lsp_t* lsp, xp_lsp_io_t input) xp_assert (lsp->input_func == XP_NULL); - if (input(XP_LSP_IO_OPEN, lsp, XP_NULL) == -1) { + if (input(lsp, XP_LSP_IO_OPEN, XP_NULL) == -1) { /* TODO: set error number */ return -1; } @@ -87,7 +87,7 @@ int xp_lsp_attach_input (xp_lsp_t* lsp, xp_lsp_io_t input) int xp_lsp_detach_input (xp_lsp_t* lsp) { if (lsp->input_func != XP_NULL) { - if (lsp->input_func(XP_LSP_IO_CLOSE, lsp, XP_NULL) == -1) { + if (lsp->input_func(lsp, XP_LSP_IO_CLOSE, XP_NULL) == -1) { /* TODO: set error number */ return -1; } @@ -103,7 +103,7 @@ int xp_lsp_attach_output (xp_lsp_t* lsp, xp_lsp_io_t output) xp_assert (lsp->output_func == XP_NULL); - if (output(XP_LSP_IO_OPEN, lsp, XP_NULL) == -1) { + if (output(lsp, XP_LSP_IO_OPEN, XP_NULL) == -1) { /* TODO: set error number */ return -1; } @@ -114,7 +114,7 @@ int xp_lsp_attach_output (xp_lsp_t* lsp, xp_lsp_io_t output) int xp_lsp_detach_output (xp_lsp_t* lsp) { if (lsp->output_func != XP_NULL) { - if (lsp->output_func(XP_LSP_IO_CLOSE, lsp, XP_NULL) == -1) { + if (lsp->output_func(lsp, XP_LSP_IO_CLOSE, XP_NULL) == -1) { /* TODO: set error number */ return -1; } diff --git a/ase/lsp/lsp.h b/ase/lsp/lsp.h index 0083ed99..cb859091 100644 --- a/ase/lsp/lsp.h +++ b/ase/lsp/lsp.h @@ -1,5 +1,5 @@ /* - * $Id: lsp.h,v 1.8 2005-09-18 11:54:23 bacon Exp $ + * $Id: lsp.h,v 1.9 2005-09-18 12:20:43 bacon Exp $ */ #ifndef _XP_LSP_LSP_H_ @@ -42,7 +42,13 @@ enum XP_LSP_ERR_BAD_VALUE }; -typedef int (*xp_lsp_io_t) (int cmd, void* owner, void* arg); +/* + * TYPEDEF: xp_lsp_t + * Defines a lisp processor + */ +typedef struct xp_lsp_t xp_lsp_t; + +typedef int (*xp_lsp_io_t) (xp_lsp_t* lsp, int cmd, void* arg); enum { XP_LSP_IO_OPEN, @@ -74,12 +80,6 @@ struct xp_lsp_t xp_bool_t __malloced; }; -/* - * TYPEDEF: xp_lsp_t - * Defines a lisp processor - */ -typedef struct xp_lsp_t xp_lsp_t; - #ifdef __cplusplus extern "C" { #endif diff --git a/ase/lsp/print.c b/ase/lsp/print.c index d1390108..efb10be8 100644 --- a/ase/lsp/print.c +++ b/ase/lsp/print.c @@ -1,5 +1,5 @@ /* - * $Id: print.c,v 1.6 2005-09-18 10:18:35 bacon Exp $ + * $Id: print.c,v 1.7 2005-09-18 12:20:43 bacon Exp $ */ #include @@ -60,7 +60,7 @@ void xp_lsp_print_debug (xp_lsp_obj_t* obj) #define OUTPUT_STR(lsp,str) \ do { \ - if (lsp->output_func(XP_LSP_IO_STR, (void*)lsp, (void*)str) == -1) { \ + if (lsp->output_func(lsp, XP_LSP_IO_STR, (void*)str) == -1) { \ lsp->errnum = XP_LSP_ERR_OUTPUT; \ return -1; \ } \ diff --git a/ase/lsp/read.c b/ase/lsp/read.c index e11ead74..d638e8dc 100644 --- a/ase/lsp/read.c +++ b/ase/lsp/read.c @@ -1,5 +1,5 @@ /* - * $Id: read.c,v 1.11 2005-09-18 10:18:35 bacon Exp $ + * $Id: read.c,v 1.12 2005-09-18 12:20:43 bacon Exp $ */ #include @@ -28,7 +28,7 @@ #define TOKEN_SLENGTH(lsp) (lsp)->token.name.size #define TOKEN_ADD_CHAR(lsp,ch) \ do { \ - if (xp_lsp_token_addc (&(lsp)->token, ch) == -1) { \ + if (xp_lsp_token_addc(&(lsp)->token, ch) == -1) { \ lsp->errnum = XP_LSP_ERR_MEM; \ return -1; \ } \ @@ -47,30 +47,13 @@ #define TOKEN_INVALID 50 #define TOKEN_UNTERM_STRING 51 -#ifdef __cplusplus -extern "C" { -#endif - -static xp_lsp_obj_t* read_obj (xp_lsp_t* lsp); -static xp_lsp_obj_t* read_list (xp_lsp_t* lsp); -static xp_lsp_obj_t* read_quote (xp_lsp_t* lsp); - -static int read_token (xp_lsp_t* lsp); -static int read_number (xp_lsp_t* lsp, int negative); -static int read_ident (xp_lsp_t* lsp); -static int read_string (xp_lsp_t* lsp); - -#ifdef __cplusplus -} -#endif - #define NEXT_CHAR(lsp) \ do { \ if (lsp->input_func == XP_NULL) { \ lsp->errnum = XP_LSP_ERR_INPUT_NOT_ATTACHED; \ return -1; \ } \ - else if (lsp->input_func(XP_LSP_IO_CHAR, lsp, XP_NULL) == -1) { \ + else if (lsp->input_func(lsp, XP_LSP_IO_CHAR, XP_NULL) == -1) { \ lsp->errnum = XP_LSP_ERR_INPUT; \ return -1; \ } \ @@ -81,6 +64,15 @@ static int read_string (xp_lsp_t* lsp); if (read_token(lsp) == -1) return XP_NULL; \ } while (0) +static xp_lsp_obj_t* read_obj (xp_lsp_t* lsp); +static xp_lsp_obj_t* read_list (xp_lsp_t* lsp); +static xp_lsp_obj_t* read_quote (xp_lsp_t* lsp); + +static int read_token (xp_lsp_t* lsp); +static int read_number (xp_lsp_t* lsp, int negative); +static int read_ident (xp_lsp_t* lsp); +static int read_string (xp_lsp_t* lsp); + xp_lsp_obj_t* xp_lsp_read (xp_lsp_t* lsp) { /*NEXT_CHAR (lsp);*/ @@ -88,7 +80,7 @@ xp_lsp_obj_t* xp_lsp_read (xp_lsp_t* lsp) lsp->errnum = XP_LSP_ERR_INPUT_NOT_ATTACHED; return XP_NULL; } - else if (lsp->input_func(XP_LSP_IO_CHAR, lsp, XP_NULL) == -1) { + else if (lsp->input_func(lsp, XP_LSP_IO_CHAR, XP_NULL) == -1) { lsp->errnum = XP_LSP_ERR_INPUT; return XP_NULL; } diff --git a/ase/test/lsp/lisp.c b/ase/test/lsp/lisp.c index 52c7faea..25cb9c65 100644 --- a/ase/test/lsp/lisp.c +++ b/ase/test/lsp/lisp.c @@ -8,7 +8,7 @@ #include #endif -static int get_char (int cmd, void* owner, void* arg) +static int get_char (xp_lsp_t* lsp, int cmd, void* arg) { xp_cint_t c; @@ -32,7 +32,7 @@ static int get_char (int cmd, void* owner, void* arg) return 0; } -static int put_char (int cmd, void* owner, void* arg) +static int put_char (xp_lsp_t* lsp, int cmd, void* arg) { switch (cmd) {