*** empty log message ***
This commit is contained in:
parent
63286b4af5
commit
a4ab9b9de8
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: eval.c,v 1.2 2005-02-04 16:00:37 bacon Exp $
|
||||
* $Id: eval.c,v 1.3 2005-02-04 16:23:34 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <xp/lisp/lisp.h>
|
||||
@ -147,9 +147,9 @@ static xp_lisp_obj_t* eval_cons (xp_lisp_t* lsp, xp_lisp_obj_t* cons)
|
||||
}
|
||||
}
|
||||
|
||||
xp_printf (XP_LISP_TEXT("bad function: "));
|
||||
xp_printf (XP_TEXT("bad function: "));
|
||||
xp_lisp_print (lsp, car);
|
||||
xp_printf (XP_LISP_TEXT("\n"));
|
||||
xp_printf (XP_TEXT("\n"));
|
||||
lsp->error = XP_LISP_ERR_BAD_FUNC;
|
||||
return XP_NULL;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: lisp.c,v 1.2 2005-02-04 16:00:37 bacon Exp $
|
||||
* $Id: lisp.c,v 1.3 2005-02-04 16:23:34 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <xp/lisp/lisp.h>
|
||||
@ -22,7 +22,7 @@ xp_lisp_t* xp_lisp_new (xp_size_t mem_ubound, xp_size_t mem_ubound_inc)
|
||||
//lsp->opt_undef_symbol = 1;
|
||||
lsp->opt_undef_symbol = 0;
|
||||
|
||||
lsp->curc = XP_LISP_CHAR_END;
|
||||
lsp->curc = XP_EOF;
|
||||
lsp->creader = XP_NULL;
|
||||
lsp->creader_extra = XP_NULL;
|
||||
lsp->creader_just_set = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: memory.c,v 1.2 2005-02-04 16:00:37 bacon Exp $
|
||||
* $Id: memory.c,v 1.3 2005-02-04 16:23:34 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <xp/lisp/memory.h>
|
||||
@ -53,9 +53,9 @@ xp_lisp_mem_t* xp_lisp_mem_new (xp_size_t ubound, xp_size_t ubound_inc)
|
||||
// initialize common object pointers
|
||||
mem->nil = xp_lisp_make_nil (mem);
|
||||
mem->t = xp_lisp_make_true (mem);
|
||||
mem->quote = xp_lisp_make_symbol (mem, XP_LISP_TEXT("quote"), 5);
|
||||
mem->lambda = xp_lisp_make_symbol (mem, XP_LISP_TEXT("lambda"), 6);
|
||||
mem->macro = xp_lisp_make_symbol (mem, XP_LISP_TEXT("macro"), 5);
|
||||
mem->quote = xp_lisp_make_symbol (mem,XP_TEXT("quote"), 5);
|
||||
mem->lambda = xp_lisp_make_symbol (mem,XP_TEXT("lambda"), 6);
|
||||
mem->macro = xp_lisp_make_symbol (mem,XP_TEXT("macro"), 5);
|
||||
|
||||
if (mem->nil == XP_NULL ||
|
||||
mem->t == XP_NULL ||
|
||||
@ -574,7 +574,7 @@ int xp_lisp_comp_symbol (xp_lisp_obj_t* obj, const xp_lisp_char* str)
|
||||
index++; p++; str++;
|
||||
}
|
||||
|
||||
return (*str == XP_LISP_CHAR('\0'))? 0: -1;
|
||||
return (*str == XP_CHAR('\0'))? 0: -1;
|
||||
}
|
||||
|
||||
int xp_lisp_comp_symbol2 (xp_lisp_obj_t* obj, const xp_lisp_char* str, xp_size_t len)
|
||||
@ -615,7 +615,7 @@ int xp_lisp_comp_string (xp_lisp_obj_t* obj, const xp_lisp_char* str)
|
||||
index++; p++; str++;
|
||||
}
|
||||
|
||||
return (*str == XP_LISP_CHAR('\0'))? 0: -1;
|
||||
return (*str == XP_CHAR('\0'))? 0: -1;
|
||||
}
|
||||
|
||||
int xp_lisp_comp_string2 (xp_lisp_obj_t* obj, const xp_lisp_char* str, xp_size_t len)
|
||||
@ -642,8 +642,8 @@ int xp_lisp_comp_string2 (xp_lisp_obj_t* obj, const xp_lisp_char* str, xp_size_t
|
||||
void xp_lisp_copy_string (xp_lisp_char* dst, const xp_lisp_char* str)
|
||||
{
|
||||
// the buffer pointed by dst should be big enough to hold str
|
||||
while (*str != XP_LISP_CHAR('\0')) *dst++ = *str++;
|
||||
*dst = XP_LISP_CHAR('\0');
|
||||
while (*str != XP_CHAR('\0')) *dst++ = *str++;
|
||||
*dst = XP_CHAR('\0');
|
||||
}
|
||||
|
||||
void xp_lisp_copy_string2 (xp_lisp_char* dst, const xp_lisp_char* str, xp_size_t len)
|
||||
@ -653,6 +653,6 @@ void xp_lisp_copy_string2 (xp_lisp_char* dst, const xp_lisp_char* str, xp_size_t
|
||||
*dst++ = *str++;
|
||||
len--;
|
||||
}
|
||||
*dst = XP_LISP_CHAR('\0');
|
||||
*dst = XP_CHAR('\0');
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: print.c,v 1.2 2005-02-04 16:00:37 bacon Exp $
|
||||
* $Id: print.c,v 1.3 2005-02-04 16:23:34 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <xp/lisp/lisp.h>
|
||||
@ -8,52 +8,52 @@ void xp_lisp_print_debug (xp_lisp_obj_t* obj)
|
||||
{
|
||||
switch (XP_LISP_TYPE(obj)) {
|
||||
case XP_LISP_OBJ_NIL:
|
||||
xp_printf ( XP_LISP_TEXT("nil"));
|
||||
xp_printf (XP_TEXT("nil"));
|
||||
break;
|
||||
case XP_LISP_OBJ_TRUE:
|
||||
xp_printf ( XP_LISP_TEXT("t"));
|
||||
xp_printf (XP_TEXT("t"));
|
||||
break;
|
||||
case XP_LISP_OBJ_INT:
|
||||
xp_printf ( XP_LISP_TEXT("%d"), XP_LISP_IVALUE(obj));
|
||||
xp_printf (XP_TEXT("%d"), XP_LISP_IVALUE(obj));
|
||||
break;
|
||||
case XP_LISP_OBJ_FLOAT:
|
||||
xp_printf ( XP_LISP_TEXT("%f"), XP_LISP_FVALUE(obj));
|
||||
xp_printf (XP_TEXT("%f"), XP_LISP_FVALUE(obj));
|
||||
break;
|
||||
case XP_LISP_OBJ_SYMBOL:
|
||||
xp_printf ( XP_LISP_TEXT("%s"), XP_LISP_SYMVALUE(obj));
|
||||
xp_printf (XP_TEXT("%s"), XP_LISP_SYMVALUE(obj));
|
||||
break;
|
||||
case XP_LISP_OBJ_STRING:
|
||||
xp_printf ( XP_LISP_TEXT("%s"), XP_LISP_STRVALUE(obj));
|
||||
xp_printf (XP_TEXT("%s"), XP_LISP_STRVALUE(obj));
|
||||
break;
|
||||
case XP_LISP_OBJ_CONS:
|
||||
{
|
||||
xp_lisp_obj_t* p = obj;
|
||||
xp_printf ( XP_LISP_TEXT("("));
|
||||
xp_printf (XP_TEXT("("));
|
||||
do {
|
||||
xp_lisp_print_debug (XP_LISP_CAR(p));
|
||||
p = XP_LISP_CDR(p);
|
||||
if (XP_LISP_TYPE(p) != XP_LISP_OBJ_NIL) {
|
||||
xp_printf ( XP_LISP_TEXT(" "));
|
||||
xp_printf (XP_TEXT(" "));
|
||||
if (XP_LISP_TYPE(p) != XP_LISP_OBJ_CONS) {
|
||||
xp_printf ( XP_LISP_TEXT(". "));
|
||||
xp_printf (XP_TEXT(". "));
|
||||
xp_lisp_print_debug (p);
|
||||
}
|
||||
}
|
||||
} while (XP_LISP_TYPE(p) != XP_LISP_OBJ_NIL && XP_LISP_TYPE(p) == XP_LISP_OBJ_CONS);
|
||||
xp_printf ( XP_LISP_TEXT(")"));
|
||||
xp_printf (XP_TEXT(")"));
|
||||
}
|
||||
break;
|
||||
case XP_LISP_OBJ_FUNC:
|
||||
xp_printf ( XP_LISP_TEXT("func"));
|
||||
xp_printf (XP_TEXT("func"));
|
||||
break;
|
||||
case XP_LISP_OBJ_MACRO:
|
||||
xp_printf (XP_LISP_TEXT("macro"));
|
||||
xp_printf (XP_TEXT("macro"));
|
||||
break;
|
||||
case XP_LISP_OBJ_PRIM:
|
||||
xp_printf (XP_LISP_TEXT("prim"));
|
||||
xp_printf (XP_TEXT("prim"));
|
||||
break;
|
||||
default:
|
||||
xp_printf (XP_LISP_TEXT("unknown object type: %d"), XP_LISP_TYPE(obj));
|
||||
xp_printf (XP_TEXT("unknown object type: %d"), XP_LISP_TYPE(obj));
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,53 +61,53 @@ void xp_lisp_print (xp_lisp_t* lsp, xp_lisp_obj_t* obj)
|
||||
{
|
||||
switch (XP_LISP_TYPE(obj)) {
|
||||
case XP_LISP_OBJ_NIL:
|
||||
xp_fprintf (lsp->outstream, XP_LISP_TEXT("nil"));
|
||||
xp_fprintf (lsp->outstream,XP_TEXT("nil"));
|
||||
break;
|
||||
case XP_LISP_OBJ_TRUE:
|
||||
xp_fprintf (lsp->outstream, XP_LISP_TEXT("t"));
|
||||
xp_fprintf (lsp->outstream,XP_TEXT("t"));
|
||||
break;
|
||||
case XP_LISP_OBJ_INT:
|
||||
xp_fprintf (lsp->outstream, XP_LISP_TEXT("%d"), XP_LISP_IVALUE(obj));
|
||||
xp_fprintf (lsp->outstream,XP_TEXT("%d"), XP_LISP_IVALUE(obj));
|
||||
break;
|
||||
case XP_LISP_OBJ_FLOAT:
|
||||
xp_fprintf (lsp->outstream, XP_LISP_TEXT("%f"), XP_LISP_FVALUE(obj));
|
||||
xp_fprintf (lsp->outstream,XP_TEXT("%f"), XP_LISP_FVALUE(obj));
|
||||
break;
|
||||
case XP_LISP_OBJ_SYMBOL:
|
||||
xp_fprintf (lsp->outstream, XP_LISP_TEXT("%s"), XP_LISP_SYMVALUE(obj));
|
||||
xp_fprintf (lsp->outstream,XP_TEXT("%s"), XP_LISP_SYMVALUE(obj));
|
||||
break;
|
||||
case XP_LISP_OBJ_STRING:
|
||||
xp_fprintf (lsp->outstream, XP_LISP_TEXT("\"%s\""), XP_LISP_STRVALUE(obj));
|
||||
xp_fprintf (lsp->outstream,XP_TEXT("\"%s\""), XP_LISP_STRVALUE(obj));
|
||||
break;
|
||||
case XP_LISP_OBJ_CONS:
|
||||
{
|
||||
xp_lisp_obj_t* p = obj;
|
||||
xp_fprintf (lsp->outstream, XP_LISP_TEXT("("));
|
||||
xp_fprintf (lsp->outstream,XP_TEXT("("));
|
||||
do {
|
||||
xp_lisp_print (lsp, XP_LISP_CAR(p));
|
||||
p = XP_LISP_CDR(p);
|
||||
if (p != lsp->mem->nil) {
|
||||
xp_fprintf (lsp->outstream, XP_LISP_TEXT(" "));
|
||||
xp_fprintf (lsp->outstream,XP_TEXT(" "));
|
||||
if (XP_LISP_TYPE(p) != XP_LISP_OBJ_CONS) {
|
||||
xp_fprintf (lsp->outstream, XP_LISP_TEXT(". "));
|
||||
xp_fprintf (lsp->outstream,XP_TEXT(". "));
|
||||
xp_lisp_print (lsp, p);
|
||||
}
|
||||
}
|
||||
} while (p != lsp->mem->nil && XP_LISP_TYPE(p) == XP_LISP_OBJ_CONS);
|
||||
xp_fprintf (lsp->outstream, XP_LISP_TEXT(")"));
|
||||
xp_fprintf (lsp->outstream,XP_TEXT(")"));
|
||||
}
|
||||
break;
|
||||
case XP_LISP_OBJ_FUNC:
|
||||
xp_fprintf (lsp->outstream, XP_LISP_TEXT("func"));
|
||||
xp_fprintf (lsp->outstream,XP_TEXT("func"));
|
||||
break;
|
||||
case XP_LISP_OBJ_MACRO:
|
||||
xp_fprintf (lsp->outstream, XP_LISP_TEXT("macro"));
|
||||
xp_fprintf (lsp->outstream,XP_TEXT("macro"));
|
||||
break;
|
||||
case XP_LISP_OBJ_PRIM:
|
||||
xp_fprintf (lsp->outstream, XP_LISP_TEXT("prim"));
|
||||
xp_fprintf (lsp->outstream,XP_TEXT("prim"));
|
||||
break;
|
||||
default:
|
||||
xp_fprintf (lsp->outstream,
|
||||
XP_LISP_TEXT("unknown object type: %d"), XP_LISP_TYPE(obj));
|
||||
XP_TEXT("unknown object type: %d"), XP_LISP_TYPE(obj));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: read.c,v 1.2 2005-02-04 16:00:37 bacon Exp $
|
||||
* $Id: read.c,v 1.3 2005-02-04 16:23:34 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <xp/lisp/lisp.h>
|
||||
@ -11,12 +11,12 @@
|
||||
#define IS_ALNUM(x) xp_isalnum(x)
|
||||
|
||||
#define IS_IDENT(c) \
|
||||
((c) == XP_LISP_CHAR('+') || (c) == XP_LISP_CHAR('-') || \
|
||||
(c) == XP_LISP_CHAR('*') || (c) == XP_LISP_CHAR('/') || \
|
||||
(c) == XP_LISP_CHAR('%') || (c) == XP_LISP_CHAR('&') || \
|
||||
(c) == XP_LISP_CHAR('<') || (c) == XP_LISP_CHAR('>') || \
|
||||
(c) == XP_LISP_CHAR('=') || (c) == XP_LISP_CHAR('_') || \
|
||||
(c) == XP_LISP_CHAR('?'))
|
||||
((c) == XP_CHAR('+') || (c) == XP_CHAR('-') || \
|
||||
(c) == XP_CHAR('*') || (c) == XP_CHAR('/') || \
|
||||
(c) == XP_CHAR('%') || (c) == XP_CHAR('&') || \
|
||||
(c) == XP_CHAR('<') || (c) == XP_CHAR('>') || \
|
||||
(c) == XP_CHAR('=') || (c) == XP_CHAR('_') || \
|
||||
(c) == XP_CHAR('?'))
|
||||
|
||||
#define TOKEN_CLEAR(lsp) xp_lisp_token_clear (lsp->token)
|
||||
#define TOKEN_TYPE(lsp) lsp->token->type
|
||||
@ -142,8 +142,8 @@ static xp_lisp_obj_t* read_obj (xp_lisp_t* lsp)
|
||||
return obj;
|
||||
case TOKEN_IDENT:
|
||||
xp_lisp_assert (lsp->mem->nil != XP_NULL && lsp->mem->t != XP_NULL);
|
||||
if (TOKEN_COMPARE(lsp, XP_LISP_TEXT("nil")) == 0) obj = lsp->mem->nil;
|
||||
else if (TOKEN_COMPARE(lsp, XP_LISP_TEXT("t")) == 0) obj = lsp->mem->t;
|
||||
if (TOKEN_COMPARE(lsp,XP_TEXT("nil")) == 0) obj = lsp->mem->nil;
|
||||
else if (TOKEN_COMPARE(lsp,XP_TEXT("t")) == 0) obj = lsp->mem->t;
|
||||
else {
|
||||
obj = xp_lisp_make_symbol (
|
||||
lsp->mem, TOKEN_SVALUE(lsp), TOKEN_SLENGTH(lsp));
|
||||
@ -264,43 +264,43 @@ static int read_token (xp_lisp_t* lsp)
|
||||
while (IS_SPACE(lsp->curc)) NEXT_CHAR (lsp);
|
||||
|
||||
// skip the comments here
|
||||
if (lsp->curc == XP_LISP_CHAR(';')) {
|
||||
if (lsp->curc == XP_CHAR(';')) {
|
||||
do {
|
||||
NEXT_CHAR (lsp);
|
||||
} while (lsp->curc != XP_LISP_CHAR('\n') && lsp->curc != XP_LISP_CHAR_END);
|
||||
} while (lsp->curc != XP_CHAR('\n') && lsp->curc != XP_EOF);
|
||||
}
|
||||
else break;
|
||||
}
|
||||
|
||||
if (lsp->curc == XP_LISP_CHAR_END) {
|
||||
if (lsp->curc == XP_EOF) {
|
||||
TOKEN_TYPE(lsp) = TOKEN_END;
|
||||
return 0;
|
||||
}
|
||||
else if (lsp->curc == XP_LISP_CHAR('(')) {
|
||||
else if (lsp->curc == XP_CHAR('(')) {
|
||||
TOKEN_ADD_CHAR (lsp, lsp->curc);
|
||||
TOKEN_TYPE(lsp) = TOKEN_LPAREN;
|
||||
NEXT_CHAR (lsp);
|
||||
return 0;
|
||||
}
|
||||
else if (lsp->curc == XP_LISP_CHAR(')')) {
|
||||
else if (lsp->curc == XP_CHAR(')')) {
|
||||
TOKEN_ADD_CHAR (lsp, lsp->curc);
|
||||
TOKEN_TYPE(lsp) = TOKEN_RPAREN;
|
||||
NEXT_CHAR (lsp);
|
||||
return 0;
|
||||
}
|
||||
else if (lsp->curc == XP_LISP_CHAR('\'')) {
|
||||
else if (lsp->curc == XP_CHAR('\'')) {
|
||||
TOKEN_ADD_CHAR (lsp, lsp->curc);
|
||||
TOKEN_TYPE(lsp) = TOKEN_QUOTE;
|
||||
NEXT_CHAR (lsp);
|
||||
return 0;
|
||||
}
|
||||
else if (lsp->curc == XP_LISP_CHAR('.')) {
|
||||
else if (lsp->curc == XP_CHAR('.')) {
|
||||
TOKEN_ADD_CHAR (lsp, lsp->curc);
|
||||
TOKEN_TYPE(lsp) = TOKEN_DOT;
|
||||
NEXT_CHAR (lsp);
|
||||
return 0;
|
||||
}
|
||||
else if (lsp->curc == XP_LISP_CHAR('-')) {
|
||||
else if (lsp->curc == XP_CHAR('-')) {
|
||||
TOKEN_ADD_CHAR (lsp, lsp->curc);
|
||||
NEXT_CHAR (lsp);
|
||||
return (IS_DIGIT(lsp->curc))?
|
||||
@ -312,7 +312,7 @@ static int read_token (xp_lisp_t* lsp)
|
||||
else if (IS_ALPHA(lsp->curc) || IS_IDENT(lsp->curc)) {
|
||||
return read_ident (lsp);
|
||||
}
|
||||
else if (lsp->curc == XP_LISP_CHAR('\"')) {
|
||||
else if (lsp->curc == XP_CHAR('\"')) {
|
||||
NEXT_CHAR (lsp);
|
||||
return read_string (lsp);
|
||||
}
|
||||
@ -326,7 +326,7 @@ static int read_number (xp_lisp_t* lsp, int negative)
|
||||
{
|
||||
do {
|
||||
TOKEN_IVALUE(lsp) =
|
||||
TOKEN_IVALUE(lsp) * 10 + lsp->curc - XP_LISP_CHAR('0');
|
||||
TOKEN_IVALUE(lsp) * 10 + lsp->curc - XP_CHAR('0');
|
||||
TOKEN_ADD_CHAR (lsp, lsp->curc);
|
||||
NEXT_CHAR (lsp);
|
||||
} while (IS_DIGIT(lsp->curc));
|
||||
@ -355,7 +355,7 @@ static int read_string (xp_lisp_t* lsp)
|
||||
xp_lisp_cint code = 0;
|
||||
|
||||
do {
|
||||
if (lsp->curc == XP_LISP_CHAR_END) {
|
||||
if (lsp->curc == XP_EOF) {
|
||||
TOKEN_TYPE(lsp) = TOKEN_UNTERM_STRING;
|
||||
return 0;
|
||||
}
|
||||
@ -369,34 +369,34 @@ static int read_string (xp_lisp_t* lsp)
|
||||
}
|
||||
else if (escaped == 1) {
|
||||
/* backslash + character */
|
||||
if (lsp->curc == XP_LISP_CHAR('a'))
|
||||
lsp->curc = XP_LISP_CHAR('\a');
|
||||
else if (lsp->curc == XP_LISP_CHAR('b'))
|
||||
lsp->curc = XP_LISP_CHAR('\b');
|
||||
else if (lsp->curc == XP_LISP_CHAR('f'))
|
||||
lsp->curc = XP_LISP_CHAR('\f');
|
||||
else if (lsp->curc == XP_LISP_CHAR('n'))
|
||||
lsp->curc = XP_LISP_CHAR('\n');
|
||||
else if (lsp->curc == XP_LISP_CHAR('r'))
|
||||
lsp->curc = XP_LISP_CHAR('\r');
|
||||
else if (lsp->curc == XP_LISP_CHAR('t'))
|
||||
lsp->curc = XP_LISP_CHAR('\t');
|
||||
else if (lsp->curc == XP_LISP_CHAR('v'))
|
||||
lsp->curc = XP_LISP_CHAR('\v');
|
||||
else if (lsp->curc == XP_LISP_CHAR('0')) {
|
||||
if (lsp->curc == XP_CHAR('a'))
|
||||
lsp->curc = XP_CHAR('\a');
|
||||
else if (lsp->curc == XP_CHAR('b'))
|
||||
lsp->curc = XP_CHAR('\b');
|
||||
else if (lsp->curc == XP_CHAR('f'))
|
||||
lsp->curc = XP_CHAR('\f');
|
||||
else if (lsp->curc == XP_CHAR('n'))
|
||||
lsp->curc = XP_CHAR('\n');
|
||||
else if (lsp->curc == XP_CHAR('r'))
|
||||
lsp->curc = XP_CHAR('\r');
|
||||
else if (lsp->curc == XP_CHAR('t'))
|
||||
lsp->curc = XP_CHAR('\t');
|
||||
else if (lsp->curc == XP_CHAR('v'))
|
||||
lsp->curc = XP_CHAR('\v');
|
||||
else if (lsp->curc == XP_CHAR('0')) {
|
||||
escaped = 2;
|
||||
code = 0;
|
||||
NEXT_CHAR (lsp);
|
||||
continue;
|
||||
}
|
||||
else if (lsp->curc == XP_LISP_CHAR('x')) {
|
||||
else if (lsp->curc == XP_CHAR('x')) {
|
||||
escaped = 3;
|
||||
code = 0;
|
||||
NEXT_CHAR (lsp);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (lsp->curc == XP_LISP_CHAR('\\')) {
|
||||
else if (lsp->curc == XP_CHAR('\\')) {
|
||||
escaped = 1;
|
||||
NEXT_CHAR (lsp);
|
||||
continue;
|
||||
@ -404,7 +404,7 @@ static int read_string (xp_lisp_t* lsp)
|
||||
|
||||
TOKEN_ADD_CHAR (lsp, lsp->curc);
|
||||
NEXT_CHAR (lsp);
|
||||
} while (lsp->curc != XP_LISP_CHAR('\"'));
|
||||
} while (lsp->curc != XP_CHAR('\"'));
|
||||
|
||||
TOKEN_TYPE(lsp) = TOKEN_STRING;
|
||||
NEXT_CHAR (lsp);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: token.c,v 1.2 2005-02-04 16:00:37 bacon Exp $
|
||||
* $Id: token.c,v 1.3 2005-02-04 16:23:34 bacon Exp $
|
||||
*/
|
||||
|
||||
#include "token.h"
|
||||
@ -25,7 +25,7 @@ xp_lisp_token_t* xp_lisp_token_new (xp_size_t capacity)
|
||||
|
||||
token->size = 0;
|
||||
token->capacity = capacity;
|
||||
token->buffer[0] = XP_LISP_CHAR('\0');
|
||||
token->buffer[0] = XP_CHAR('\0');
|
||||
|
||||
return token;
|
||||
}
|
||||
@ -48,7 +48,7 @@ int xp_lisp_token_addc (xp_lisp_token_t* token, xp_lisp_cint c)
|
||||
}
|
||||
|
||||
token->buffer[token->size++] = c;
|
||||
token->buffer[token->size] = XP_LISP_CHAR('\0');
|
||||
token->buffer[token->size] = XP_CHAR('\0');
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ void xp_lisp_token_clear (xp_lisp_token_t* token)
|
||||
token->fvalue = .0;
|
||||
|
||||
token->size = 0;
|
||||
token->buffer[0] = XP_LISP_CHAR('\0');
|
||||
token->buffer[0] = XP_CHAR('\0');
|
||||
}
|
||||
|
||||
xp_lisp_char* xp_lisp_token_transfer (xp_lisp_token_t* token, xp_size_t capacity)
|
||||
@ -72,7 +72,7 @@ xp_lisp_char* xp_lisp_token_transfer (xp_lisp_token_t* token, xp_size_t capacity
|
||||
token->buffer = new_buffer;
|
||||
token->size = 0;
|
||||
token->capacity = capacity;
|
||||
token->buffer[0] = XP_LISP_CHAR('\0');
|
||||
token->buffer[0] = XP_CHAR('\0');
|
||||
|
||||
return old_buffer;
|
||||
}
|
||||
@ -88,5 +88,5 @@ int xp_lisp_token_compare (xp_lisp_token_t* token, const xp_lisp_char* str)
|
||||
index++; p++; str++;
|
||||
}
|
||||
|
||||
return (*str == XP_LISP_CHAR('\0'))? 0: -1;
|
||||
return (*str == XP_CHAR('\0'))? 0: -1;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: types.h,v 1.2 2005-02-04 16:00:37 bacon Exp $
|
||||
* $Id: types.h,v 1.3 2005-02-04 16:23:34 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _XP_LISP_TYPES_H_
|
||||
@ -10,14 +10,7 @@
|
||||
|
||||
typedef xp_char_t xp_lisp_char;
|
||||
typedef xp_cint_t xp_lisp_cint;
|
||||
typedef int xp_lisp_int;
|
||||
typedef float xp_lisp_float;
|
||||
|
||||
#define XP_LISP_CHAR(x) XP_CHAR(x)
|
||||
#define XP_LISP_TEXT(x) XP_TEXT(x)
|
||||
#define XP_LISP_CHAR_END XP_EOF
|
||||
|
||||
#define xp_lisp_ensure(x) XP_ENSURE(x)
|
||||
#define xp_lisp_assert(x) XP_ASSERT(x)
|
||||
typedef xp_long_t xp_lisp_int;
|
||||
typedef xp_real_t xp_lisp_float;
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user