*** empty log message ***

This commit is contained in:
2005-05-22 13:41:14 +00:00
parent 450c413990
commit 0bf97fb3bd
10 changed files with 65 additions and 47 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: array.c,v 1.4 2005-04-24 07:48:16 bacon Exp $
* $Id: array.c,v 1.5 2005-05-22 13:41:14 bacon Exp $
*/
#include <xp/lisp/array.h>
@ -86,7 +86,7 @@ void xp_lisp_array_clear (xp_lisp_array_t* array)
array->buffer[0] = XP_NULL;
}
void** xp_lisp_array_transfer (xp_lisp_array_t* array, xp_size_t capacity)
void** xp_lisp_array_yield (xp_lisp_array_t* array, xp_size_t capacity)
{
void** old_buffer, ** new_buffer;

View File

@ -1,5 +1,5 @@
/*
* $Id: array.h,v 1.2 2005-02-04 16:00:37 bacon Exp $
* $Id: array.h,v 1.3 2005-05-22 13:41:14 bacon Exp $
*/
#ifndef _XP_LISP_ARRAY_H_
@ -25,7 +25,7 @@ int xp_lisp_array_add_item (xp_lisp_array_t* array, void* item);
int xp_lisp_array_insert (xp_lisp_array_t* array, xp_size_t index, void* value);
void xp_lisp_array_delete (xp_lisp_array_t* array, xp_size_t index);
void xp_lisp_array_clear (xp_lisp_array_t* array);
void** xp_lisp_array_transfer (xp_lisp_array_t* array, xp_size_t capacity);
void** xp_lisp_array_yield (xp_lisp_array_t* array, xp_size_t capacity);
#ifdef __cplusplus
}

View File

@ -1,5 +1,5 @@
/*
* $Id: token.c,v 1.8 2005-04-24 07:48:16 bacon Exp $
* $Id: token.c,v 1.9 2005-05-22 13:41:14 bacon Exp $
*/
#include <xp/lisp/token.h>
@ -12,10 +12,10 @@ xp_lisp_token_t* xp_lisp_token_new (xp_size_t capacity)
xp_assert (capacity > 0);
token = (xp_lisp_token_t*)xp_malloc (sizeof(xp_lisp_token_t));
token = (xp_lisp_token_t*)xp_malloc (xp_sizeof(xp_lisp_token_t));
if (token == XP_NULL) return XP_NULL;
token->buffer = (xp_char_t*)xp_malloc ((capacity + 1) * sizeof(xp_char_t));
token->buffer = (xp_char_t*)xp_malloc ((capacity + 1) * xp_sizeof(xp_char_t));
if (token->buffer == XP_NULL) {
xp_free (token);
return XP_NULL;
@ -41,8 +41,8 @@ int xp_lisp_token_addc (xp_lisp_token_t* token, xp_cint_t c)
{
if (token->size >= token->capacity) {
// double the capacity.
xp_char_t* new_buffer = (xp_char_t*)realloc (
token->buffer, (token->capacity * 2 + 1) * sizeof(xp_char_t));
xp_char_t* new_buffer = (xp_char_t*)xp_realloc (
token->buffer, (token->capacity * 2 + 1) * xp_sizeof(xp_char_t));
if (new_buffer == XP_NULL) return -1;
token->buffer = new_buffer;
token->capacity = token->capacity * 2;
@ -62,11 +62,11 @@ void xp_lisp_token_clear (xp_lisp_token_t* token)
token->buffer[0] = XP_CHAR('\0');
}
xp_char_t* xp_lisp_token_transfer (xp_lisp_token_t* token, xp_size_t capacity)
xp_char_t* xp_lisp_token_yield (xp_lisp_token_t* token, xp_size_t capacity)
{
xp_char_t* old_buffer, * new_buffer;
new_buffer = (xp_char_t*)xp_malloc((capacity + 1) * sizeof(xp_char_t));
new_buffer = (xp_char_t*)xp_malloc((capacity + 1) * xp_sizeof(xp_char_t));
if (new_buffer == XP_NULL) return XP_NULL;
old_buffer = token->buffer;

View File

@ -1,5 +1,5 @@
/*
* $Id: token.h,v 1.5 2005-02-14 14:37:50 bacon Exp $
* $Id: token.h,v 1.6 2005-05-22 13:41:14 bacon Exp $
*/
#ifndef _XP_LISP_TOKEN_H_
@ -25,12 +25,12 @@ typedef struct xp_lisp_token_t xp_lisp_token_t;
extern "C" {
#endif
xp_lisp_token_t* xp_lisp_token_new (xp_size_t capacity);
void xp_lisp_token_free (xp_lisp_token_t* token);
int xp_lisp_token_addc (xp_lisp_token_t* token, xp_cint_t c);
void xp_lisp_token_clear (xp_lisp_token_t* token);
xp_char_t* xp_lisp_token_transfer (xp_lisp_token_t* token, xp_size_t capacity);
int xp_lisp_token_compare (xp_lisp_token_t* token, const xp_char_t* str);
xp_lisp_token_t* xp_lisp_token_new (xp_size_t capacity);
void xp_lisp_token_free (xp_lisp_token_t* token);
int xp_lisp_token_addc (xp_lisp_token_t* token, xp_cint_t c);
void xp_lisp_token_clear (xp_lisp_token_t* token);
xp_char_t* xp_lisp_token_yield (xp_lisp_token_t* token, xp_size_t capacity);
int xp_lisp_token_compare (xp_lisp_token_t* token, const xp_char_t* str);
#ifdef __cplusplus
}