*** 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> #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_lsp_obj_t* obj, * prev, * next;
ase_size_t i; ase_size_t i;
// scan all the allocated objects and get rid of unused objects /* scan all the allocated objects and get rid of unused objects */
for (i = 0; i < ASE_LSP_TYPE_COUNT; i++) { for (i = 0; i < ASE_LSP_TYPE_COUNT; i++)
{
//for (i = ASE_LSP_TYPE_COUNT; i > 0; /*i--*/) { //for (i = ASE_LSP_TYPE_COUNT; i > 0; /*i--*/) {
prev = ASE_NULL; prev = ASE_NULL;
obj = mem->used[i]; obj = mem->used[i];
@ -358,16 +359,18 @@ static void ase_lsp_sweepunmarkedobjs (ase_lsp_mem_t* mem)
#if 0 #if 0
ase_dprint1 (ASE_T("sweeping objects of type: %u\n"), i); ase_dprint1 (ASE_T("sweeping objects of type: %u\n"), i);
#endif #endif
while (obj != ASE_NULL)
while (obj != ASE_NULL) { {
next = ASE_LSP_LINK(obj); next = ASE_LSP_LINK(obj);
if (ASE_LSP_LOCK(obj) == 0 && ASE_LSP_MARK(obj) == 0) { if (ASE_LSP_LOCK(obj) == 0 && ASE_LSP_MARK(obj) == 0)
// dispose of unused objects {
/* dispose of unused objects */
ase_lsp_dispose (mem, prev, obj); ase_lsp_dispose (mem, prev, obj);
} }
else { else
// unmark the object in use {
/* unmark the object in use */
ASE_LSP_MARK(obj) = 0; ASE_LSP_MARK(obj) = 0;
prev = obj; 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_ #ifndef _ASE_LSP_MEM_H_
@ -15,41 +15,29 @@ struct ase_lsp_mem_t
{ {
ase_lsp_t* lsp; ase_lsp_t* lsp;
/* /* object allocation list */
* 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 ubound; // upper bounds of the maximum number of objects ase_size_t count; /* the number of objects currently allocated */
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* used[ASE_LSP_TYPE_COUNT];
ase_lsp_obj_t* free[ASE_LSP_TYPE_COUNT]; ase_lsp_obj_t* free[ASE_LSP_TYPE_COUNT];
ase_lsp_obj_t* locked; ase_lsp_obj_t* locked;
/* /* commonly accessed objects */
* 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* nil; // ase_lsp_obj_nil_t ase_lsp_obj_t* quote; /* ase_lsp_obj_symbol_t */
ase_lsp_obj_t* t; // ase_lsp_obj_true_t ase_lsp_obj_t* lambda; /* ase_lsp_obj_symbol_t */
ase_lsp_obj_t* quote; // ase_lsp_obj_symbol_t ase_lsp_obj_t* macro; /* 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; ase_lsp_frame_t* frame;
// pointer to a global-level frame /* pointer to a global-level frame */
ase_lsp_frame_t* root_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; ase_lsp_frame_t* brooding_frame;
/*
* temporary objects
*/
/*ase_lsp_arr_t* temp_arr;*/
}; };
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #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_ #ifndef _ASE_LSP_OBJ_H_
@ -77,8 +77,7 @@ struct ase_lsp_obj_real_t
struct ase_lsp_obj_sym_t struct ase_lsp_obj_sym_t
{ {
ase_lsp_objhdr_t hdr; ase_lsp_objhdr_t hdr;
#if defined(__BORLANDC__) || defined(_MSC_VER) #if !defined(__BORLANDC__) && !defined(_MSC_VER)
#else
ase_char_t buffer[0]; ase_char_t buffer[0];
#endif #endif
}; };
@ -86,8 +85,7 @@ struct ase_lsp_obj_sym_t
struct ase_lsp_obj_str_t struct ase_lsp_obj_str_t
{ {
ase_lsp_objhdr_t hdr; ase_lsp_objhdr_t hdr;
#if defined(__BORLANDC__) || defined(_MSC_VER) #if !defined(__BORLANDC__) && !defined(_MSC_VER)
#else
ase_char_t buffer[0]; ase_char_t buffer[0];
#endif #endif
}; };

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_ #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_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); 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 #ifdef __cplusplus
} }
#endif #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> #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) 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; return ASE_NULL;
} }
if (TOKEN_TYPE(lsp) == TOKEN_DOT) if (TOKEN_TYPE(lsp) == TOKEN_DOT)
{ {
if (prev == ASE_NULL) { if (prev == ASE_NULL)
lsp->errnum = ASE_LSP_ERR_SYNTAX; // unexpected . {
lsp->errnum = ASE_LSP_ERR_SYNTAX; /* unexpected dot */
return ASE_NULL; 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) if (lsp->errnum == ASE_LSP_ERR_END)
{ {
//unexpected end of input /* unexpected end of input */
lsp->errnum = ASE_LSP_ERR_SYNTAX; lsp->errnum = ASE_LSP_ERR_SYNTAX;
} }
return ASE_NULL; return ASE_NULL;
@ -165,7 +166,7 @@ static ase_lsp_obj_t* read_list (ase_lsp_t* lsp)
NEXT_TOKEN (lsp); NEXT_TOKEN (lsp);
if (TOKEN_TYPE(lsp) != TOKEN_RPAREN) if (TOKEN_TYPE(lsp) != TOKEN_RPAREN)
{ {
lsp->errnum = ASE_LSP_ERR_SYNTAX; // ) expected lsp->errnum = ASE_LSP_ERR_SYNTAX; /* ) expected */
return ASE_NULL; return ASE_NULL;
} }