*** empty log message ***

This commit is contained in:
hyung-hwan 2005-09-18 11:54:23 +00:00
parent 68fde07ef9
commit 4f9c21e00b
5 changed files with 50 additions and 23 deletions

View File

@ -1,11 +1,11 @@
/*
* $Id: env.h,v 1.5 2005-09-18 11:34:35 bacon Exp $
* $Id: env.h,v 1.6 2005-09-18 11:54:23 bacon Exp $
*/
#ifndef _XP_LSP_ENV_H_
#define _XP_LSP_ENV_H_
#include <xp/lsp/object.h>
#include <xp/lsp/obj.h>
struct xp_lsp_assoc_t
{

View File

@ -1,5 +1,5 @@
/*
* $Id: lsp.h,v 1.7 2005-09-18 11:34:35 bacon Exp $
* $Id: lsp.h,v 1.8 2005-09-18 11:54:23 bacon Exp $
*/
#ifndef _XP_LSP_LSP_H_
@ -14,7 +14,7 @@
#include <xp/lsp/types.h>
#include <xp/lsp/token.h>
#include <xp/lsp/object.h>
#include <xp/lsp/obj.h>
#include <xp/lsp/mem.h>
#define XP_LSP_ERR(lsp) ((lsp)->errnum)

View File

@ -1,11 +1,11 @@
/*
* $Id: mem.h,v 1.1 2005-09-18 11:34:35 bacon Exp $
* $Id: mem.h,v 1.2 2005-09-18 11:54:23 bacon Exp $
*/
#ifndef _XP_LSP_MEM_H_
#define _XP_LSP_MEM_H_
#include <xp/lsp/object.h>
#include <xp/lsp/obj.h>
#include <xp/lsp/env.h>
#include <xp/lsp/array.h>

View File

@ -1,9 +1,9 @@
/*
* $Id: object.h,v 1.6 2005-09-18 08:10:50 bacon Exp $
* $Id: obj.h,v 1.1 2005-09-18 11:54:23 bacon Exp $
*/
#ifndef _XP_LSP_OBJECT_H_
#define _XP_LSP_OBJECT_H_
#ifndef _XP_LSP_OBJ_H_
#define _XP_LSP_OBJ_H_
#include <xp/lsp/types.h>

View File

@ -8,20 +8,51 @@
#include <mcheck.h>
#endif
static int get_char (xp_cint_t* ch, void* arg)
static int get_char (int cmd, void* owner, void* arg)
{
xp_cint_t c;
c = xp_fgetc(xp_stdin);
switch (cmd) {
case XP_LSP_IO_OPEN:
case XP_LSP_IO_CLOSE:
return 0;
case XP_LSP_IO_CHAR:
c = xp_fgetc (xp_stdin);
if (c == XP_CHAR_EOF) {
if (xp_ferror(xp_stdin)) return -1;
c = XP_CHAR_EOF;
}
*ch = c;
break;
case XP_LSP_IO_STR:
return -1;
}
return 0;
}
static int put_char (int cmd, void* owner, void* arg)
{
switch (cmd) {
case XP_LSP_IO_OPEN:
case XP_LSP_IO_CLOSE:
return 0;
case XP_LSP_IO_CHAR:
xp_fputc (*(xp_char_t*)arg, xp_stdout);
break;
case XP_LSP_IO_STR:
xp_fputs ((xp_char_t*)arg, xp_stdout);
break;
}
return 0;
}
int to_int (const xp_char_t* str)
{
int r = 0;
@ -64,6 +95,7 @@ int handle_cli_error (
return -1;
}
xp_cli_t* parse_cli (int argc, xp_char_t* argv[])
{
static const xp_char_t* optsta[] =
@ -128,6 +160,7 @@ int xp_main (int argc, xp_char_t* argv[])
xp_printf (XP_TEXT("LSP 0.0001\n"));
xp_lsp_attach_input (lsp, get_char);
xp_lsp_attach_output (lsp, put_char);
for (;;) {
xp_printf (XP_TEXT("%s> "), argv[0]);
@ -151,14 +184,8 @@ int xp_main (int argc, xp_char_t* argv[])
else {
if (lsp->errnum == XP_LSP_ERR_ABORT) break;
xp_fprintf (xp_stderr,
XP_TEXT("error while reading: %d\n"), lsp->errnum);
XP_TEXT("error while evaluating: %d\n"), lsp->errnum);
}
/*
printf ("-----------\n");
xp_lsp_print (lsp, obj);
printf ("\n-----------\n");
*/
}
xp_lsp_close (lsp);