*** empty log message ***

This commit is contained in:
hyung-hwan 2006-11-02 06:46:31 +00:00
parent d82cada059
commit af9751f5b7
5 changed files with 51 additions and 56 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: mem.c,v 1.21 2006-10-30 14:31:37 bacon Exp $
* $Id: mem.c,v 1.22 2006-11-02 06:46:31 bacon Exp $
*/
#include <ase/lsp/lsp_i.h>
@ -348,8 +348,9 @@ static void ase_lsp_sweepunmarkedobjs (ase_lsp_mem_t* mem)
ase_lsp_obj_t* obj, * prev, * next;
ase_size_t i;
// scan all the allocated objects and get rid of unused objects
for (i = 0; i < ASE_LSP_TYPE_COUNT; i++) {
/* scan all the allocated objects and get rid of unused objects */
for (i = 0; i < ASE_LSP_TYPE_COUNT; i++)
{
//for (i = ASE_LSP_TYPE_COUNT; i > 0; /*i--*/) {
prev = ASE_NULL;
obj = mem->used[i];
@ -358,16 +359,18 @@ static void ase_lsp_sweepunmarkedobjs (ase_lsp_mem_t* mem)
#if 0
ase_dprint1 (ASE_T("sweeping objects of type: %u\n"), i);
#endif
while (obj != ASE_NULL) {
while (obj != ASE_NULL)
{
next = ASE_LSP_LINK(obj);
if (ASE_LSP_LOCK(obj) == 0 && ASE_LSP_MARK(obj) == 0) {
// dispose of unused objects
if (ASE_LSP_LOCK(obj) == 0 && ASE_LSP_MARK(obj) == 0)
{
/* dispose of unused objects */
ase_lsp_dispose (mem, prev, obj);
}
else {
// unmark the object in use
else
{
/* unmark the object in use */
ASE_LSP_MARK(obj) = 0;
prev = obj;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: mem.h,v 1.14 2006-10-29 13:40:33 bacon Exp $
* $Id: mem.h,v 1.15 2006-11-02 06:46:31 bacon Exp $
*/
#ifndef _ASE_LSP_MEM_H_
@ -15,41 +15,29 @@ struct ase_lsp_mem_t
{
ase_lsp_t* lsp;
/*
* object allocation list
*/
ase_size_t ubound; // upper bounds of the maximum number of objects
ase_size_t ubound_inc; // increment of the upper bounds
ase_size_t count; // the number of objects currently allocated
/* object allocation list */
ase_size_t ubound; /* upper bounds of the maximum number of objects */
ase_size_t ubound_inc; /* increment of the upper bounds */
ase_size_t count; /* the number of objects currently allocated */
ase_lsp_obj_t* used[ASE_LSP_TYPE_COUNT];
ase_lsp_obj_t* free[ASE_LSP_TYPE_COUNT];
ase_lsp_obj_t* locked;
/*
* commonly accessed objects
*/
ase_lsp_obj_t* nil; // ase_lsp_obj_nil_t
ase_lsp_obj_t* t; // ase_lsp_obj_true_t
ase_lsp_obj_t* quote; // ase_lsp_obj_symbol_t
ase_lsp_obj_t* lambda; // ase_lsp_obj_symbol_t
ase_lsp_obj_t* macro; // ase_lsp_obj_symbol_t
/* commonly accessed objects */
ase_lsp_obj_t* nil; /* ase_lsp_obj_nil_t */
ase_lsp_obj_t* t; /* ase_lsp_obj_true_t */
ase_lsp_obj_t* quote; /* ase_lsp_obj_symbol_t */
ase_lsp_obj_t* lambda; /* ase_lsp_obj_symbol_t */
ase_lsp_obj_t* macro; /* ase_lsp_obj_symbol_t */
/*
* run-time environment frame
*/
/* run-time environment frame */
ase_lsp_frame_t* frame;
// pointer to a global-level frame
/* pointer to a global-level frame */
ase_lsp_frame_t* root_frame;
// pointer to an interim frame not yet added to "frame"
/* pointer to an interim frame not yet added to "frame" */
ase_lsp_frame_t* brooding_frame;
/*
* temporary objects
*/
/*ase_lsp_arr_t* temp_arr;*/
};
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -1,5 +1,5 @@
/*
* $Id: obj.h,v 1.13 2006-10-30 14:31:37 bacon Exp $
* $Id: obj.h,v 1.14 2006-11-02 06:46:31 bacon Exp $
*/
#ifndef _ASE_LSP_OBJ_H_
@ -77,8 +77,7 @@ struct ase_lsp_obj_real_t
struct ase_lsp_obj_sym_t
{
ase_lsp_objhdr_t hdr;
#if defined(__BORLANDC__) || defined(_MSC_VER)
#else
#if !defined(__BORLANDC__) && !defined(_MSC_VER)
ase_char_t buffer[0];
#endif
};
@ -86,8 +85,7 @@ struct ase_lsp_obj_sym_t
struct ase_lsp_obj_str_t
{
ase_lsp_objhdr_t hdr;
#if defined(__BORLANDC__) || defined(_MSC_VER)
#else
#if !defined(__BORLANDC__) && !defined(_MSC_VER)
ase_char_t buffer[0];
#endif
};
@ -122,29 +120,29 @@ struct ase_lsp_obj_prim_t
};
/* header access */
#define ASE_LSP_TYPE(x) (((ase_lsp_obj_t*)x)->hdr.type)
#define ASE_LSP_SIZE(x) (((ase_lsp_obj_t*)x)->hdr.size)
#define ASE_LSP_MARK(x) (((ase_lsp_obj_t*)x)->hdr.mark)
#define ASE_LSP_LOCK(x) (((ase_lsp_obj_t*)x)->hdr.lock)
#define ASE_LSP_LINK(x) (((ase_lsp_obj_t*)x)->hdr.link)
#define ASE_LSP_TYPE(x) (((ase_lsp_obj_t*)x)->hdr.type)
#define ASE_LSP_SIZE(x) (((ase_lsp_obj_t*)x)->hdr.size)
#define ASE_LSP_MARK(x) (((ase_lsp_obj_t*)x)->hdr.mark)
#define ASE_LSP_LOCK(x) (((ase_lsp_obj_t*)x)->hdr.lock)
#define ASE_LSP_LINK(x) (((ase_lsp_obj_t*)x)->hdr.link)
/* value access */
#define ASE_LSP_IVAL(x) (((ase_lsp_obj_int_t*)x)->value)
#define ASE_LSP_RVAL(x) (((ase_lsp_obj_real_t*)x)->value)
#define ASE_LSP_IVAL(x) (((ase_lsp_obj_int_t*)x)->value)
#define ASE_LSP_RVAL(x) (((ase_lsp_obj_real_t*)x)->value)
#if defined(__BORLANDC__) || defined(_MSC_VER)
#define ASE_LSP_SYMPTR(x) ((ase_char_t*)(((ase_lsp_obj_sym_t*)x) + 1))
#else
#define ASE_LSP_SYMPTR(x) (((ase_lsp_obj_sym_t*)x)->buffer)
#endif
#define ASE_LSP_SYMLEN(x) ((((ase_lsp_obj_sym_t*)x)->hdr.size - sizeof(ase_lsp_obj_t)) / sizeof(ase_char_t) - 1)
#define ASE_LSP_SYMLEN(x) ((((ase_lsp_obj_sym_t*)x)->hdr.size - sizeof(ase_lsp_obj_t)) / sizeof(ase_char_t) - 1)
#if defined(__BORLANDC__) || defined(_MSC_VER)
#define ASE_LSP_STRPTR(x) ((ase_char_t*)(((ase_lsp_obj_str_t*)x) + 1))
#else
#define ASE_LSP_STRPTR(x) (((ase_lsp_obj_str_t*)x)->buffer)
#endif
#define ASE_LSP_STRLEN(x) ((((ase_lsp_obj_str_t*)x)->hdr.size - sizeof(ase_lsp_obj_t)) / sizeof(ase_char_t) - 1)
#define ASE_LSP_STRLEN(x) ((((ase_lsp_obj_str_t*)x)->hdr.size - sizeof(ase_lsp_obj_t)) / sizeof(ase_char_t) - 1)
#define ASE_LSP_CAR(x) (((ase_lsp_obj_cons_t*)x)->car)
#define ASE_LSP_CDR(x) (((ase_lsp_obj_cons_t*)x)->cdr)

View File

@ -1,5 +1,5 @@
/*
* $Id: prim.h,v 1.11 2006-10-29 13:40:33 bacon Exp $
* $Id: prim.h,v 1.12 2006-11-02 06:46:31 bacon Exp $
*/
#ifndef _ASE_LSP_PRIM_H_
@ -52,6 +52,11 @@ ase_lsp_obj_t* ase_lsp_prim_mul (ase_lsp_t* lsp, ase_lsp_obj_t* args);
ase_lsp_obj_t* ase_lsp_prim_div (ase_lsp_t* lsp, ase_lsp_obj_t* args);
ase_lsp_obj_t* ase_lsp_prim_mod (ase_lsp_t* lsp, ase_lsp_obj_t* args);
/*---------------------
prim_fact.c
---------------------*/
ase_lsp_obj_t* ase_lsp_prim_fact (ase_lsp_t* lsp, ase_lsp_obj_t* args);
#ifdef __cplusplus
}
#endif

View File

@ -1,5 +1,5 @@
/*
* $Id: read.c,v 1.27 2006-10-29 13:00:39 bacon Exp $
* $Id: read.c,v 1.28 2006-11-02 06:46:31 bacon Exp $
*/
#include <ase/lsp/lsp_i.h>
@ -138,14 +138,15 @@ static ase_lsp_obj_t* read_list (ase_lsp_t* lsp)
{
if (TOKEN_TYPE(lsp) == TOKEN_END)
{
lsp->errnum = ASE_LSP_ERR_SYNTAX; // unexpected end of input
lsp->errnum = ASE_LSP_ERR_SYNTAX; /* unexpected end of input */
return ASE_NULL;
}
if (TOKEN_TYPE(lsp) == TOKEN_DOT)
{
if (prev == ASE_NULL) {
lsp->errnum = ASE_LSP_ERR_SYNTAX; // unexpected .
if (prev == ASE_NULL)
{
lsp->errnum = ASE_LSP_ERR_SYNTAX; /* unexpected dot */
return ASE_NULL;
}
@ -155,7 +156,7 @@ static ase_lsp_obj_t* read_list (ase_lsp_t* lsp)
{
if (lsp->errnum == ASE_LSP_ERR_END)
{
//unexpected end of input
/* unexpected end of input */
lsp->errnum = ASE_LSP_ERR_SYNTAX;
}
return ASE_NULL;
@ -165,7 +166,7 @@ static ase_lsp_obj_t* read_list (ase_lsp_t* lsp)
NEXT_TOKEN (lsp);
if (TOKEN_TYPE(lsp) != TOKEN_RPAREN)
{
lsp->errnum = ASE_LSP_ERR_SYNTAX; // ) expected
lsp->errnum = ASE_LSP_ERR_SYNTAX; /* ) expected */
return ASE_NULL;
}