*** empty log message ***
This commit is contained in:
parent
cfb7367faf
commit
0af87a6d78
@ -1,11 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: memory.c,v 1.6 2005-02-05 05:43:55 bacon Exp $
|
* $Id: memory.c,v 1.7 2005-02-05 06:28:13 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/lisp/memory.h>
|
#include <xp/lisp/memory.h>
|
||||||
#include <xp/lisp/primitive.h>
|
#include <xp/lisp/primitive.h>
|
||||||
#include <xp/c/memory.h>
|
#include <xp/c/memory.h>
|
||||||
#include <xp/c/assert.h>
|
#include <xp/c/assert.h>
|
||||||
|
#include <xp/c/dprint.h>
|
||||||
|
|
||||||
xp_lisp_mem_t* xp_lisp_mem_new (xp_size_t ubound, xp_size_t ubound_inc)
|
xp_lisp_mem_t* xp_lisp_mem_new (xp_size_t ubound, xp_size_t ubound_inc)
|
||||||
{
|
{
|
||||||
@ -173,7 +174,7 @@ xp_lisp_obj_t* xp_lisp_allocate (xp_lisp_mem_t* mem, int type, xp_size_t size)
|
|||||||
XP_LISP_LINK(obj) = mem->used[type];
|
XP_LISP_LINK(obj) = mem->used[type];
|
||||||
mem->used[type] = obj;
|
mem->used[type] = obj;
|
||||||
mem->count++;
|
mem->count++;
|
||||||
XP_DEBUG1 (XP_TEXT("mem->count: %u\n"), mem->count);
|
xp_dprint1 (XP_TEXT("mem->count: %u\n"), mem->count);
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
@ -192,7 +193,7 @@ void xp_lisp_dispose (xp_lisp_mem_t* mem, xp_lisp_obj_t* prev, xp_lisp_obj_t* ob
|
|||||||
else XP_LISP_LINK(prev) = XP_LISP_LINK(obj);
|
else XP_LISP_LINK(prev) = XP_LISP_LINK(obj);
|
||||||
|
|
||||||
mem->count--;
|
mem->count--;
|
||||||
XP_DEBUG1 (XP_TEXT("mem->count: %u\n"), mem->count);
|
xp_dprint1 (XP_TEXT("mem->count: %u\n"), mem->count);
|
||||||
|
|
||||||
xp_free (obj);
|
xp_free (obj);
|
||||||
}
|
}
|
||||||
@ -280,7 +281,7 @@ static void xp_lisp_mark (xp_lisp_mem_t* mem)
|
|||||||
xp_lisp_array_t* array;
|
xp_lisp_array_t* array;
|
||||||
xp_size_t i;
|
xp_size_t i;
|
||||||
|
|
||||||
XP_DEBUG0 (XP_TEXT("marking environment frames\n"));
|
xp_dprint0 (XP_TEXT("marking environment frames\n"));
|
||||||
// mark objects in the environment frames
|
// mark objects in the environment frames
|
||||||
frame = mem->frame;
|
frame = mem->frame;
|
||||||
while (frame != XP_NULL) {
|
while (frame != XP_NULL) {
|
||||||
@ -294,7 +295,7 @@ static void xp_lisp_mark (xp_lisp_mem_t* mem)
|
|||||||
frame = frame->link;
|
frame = frame->link;
|
||||||
}
|
}
|
||||||
|
|
||||||
XP_DEBUG0 (XP_TEXT("marking interim frames\n"));
|
xp_dprint0 (XP_TEXT("marking interim frames\n"));
|
||||||
|
|
||||||
// mark objects in the interim frames
|
// mark objects in the interim frames
|
||||||
frame = mem->brooding_frame;
|
frame = mem->brooding_frame;
|
||||||
@ -311,17 +312,17 @@ static void xp_lisp_mark (xp_lisp_mem_t* mem)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
XP_DEBUG0 (XP_TEXT("marking the locked object\n"));
|
xp_dprint0 (XP_TEXT("marking the locked object\n"));
|
||||||
if (mem->locked != XP_NULL) xp_lisp_mark_obj (mem->locked);
|
if (mem->locked != XP_NULL) xp_lisp_mark_obj (mem->locked);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
XP_DEBUG0 (XP_TEXT("marking termporary objects\n"));
|
xp_dprint0 (XP_TEXT("marking termporary objects\n"));
|
||||||
array = mem->temp_array;
|
array = mem->temp_array;
|
||||||
for (i = 0; i < array->size; i++) {
|
for (i = 0; i < array->size; i++) {
|
||||||
xp_lisp_mark_obj (array->buffer[i]);
|
xp_lisp_mark_obj (array->buffer[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
XP_DEBUG0 (XP_TEXT("marking builtin objects\n"));
|
xp_dprint0 (XP_TEXT("marking builtin objects\n"));
|
||||||
// mark common objects
|
// mark common objects
|
||||||
if (mem->t != XP_NULL) xp_lisp_mark_obj (mem->t);
|
if (mem->t != XP_NULL) xp_lisp_mark_obj (mem->t);
|
||||||
if (mem->nil != XP_NULL) xp_lisp_mark_obj (mem->nil);
|
if (mem->nil != XP_NULL) xp_lisp_mark_obj (mem->nil);
|
||||||
@ -342,7 +343,7 @@ static void xp_lisp_sweep (xp_lisp_mem_t* mem)
|
|||||||
obj = mem->used[i];
|
obj = mem->used[i];
|
||||||
//obj = mem->used[--i];
|
//obj = mem->used[--i];
|
||||||
|
|
||||||
XP_DEBUG1 (XP_TEXT("sweeping objects of type: %u\n"), i);
|
xp_dprint1 (XP_TEXT("sweeping objects of type: %u\n"), i);
|
||||||
|
|
||||||
while (obj != XP_NULL) {
|
while (obj != XP_NULL) {
|
||||||
next = XP_LISP_LINK(obj);
|
next = XP_LISP_LINK(obj);
|
||||||
|
12
ase/macros.h
12
ase/macros.h
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: macros.h,v 1.8 2005-02-05 06:05:19 bacon Exp $
|
* $Id: macros.h,v 1.9 2005-02-05 06:28:13 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _XP_MACROS_H_
|
#ifndef _XP_MACROS_H_
|
||||||
@ -27,16 +27,18 @@
|
|||||||
#define XP_QUOTE(val) __XP_QUOTE(val)
|
#define XP_QUOTE(val) __XP_QUOTE(val)
|
||||||
#define __XP_QUOTE(val) #val
|
#define __XP_QUOTE(val) #val
|
||||||
|
|
||||||
#define XP_MCHAR(ch) ((xp_mchar_t)ch)
|
//#define XP_MCHAR(ch) ((xp_mchar_t)ch)
|
||||||
#define XP_MTEXT(txt) ((const xp_mchar_t*)txt)
|
//#define XP_MTEXT(txt) ((const xp_mchar_t*)txt)
|
||||||
|
#define XP_MCHAR(ch) ch
|
||||||
|
#define XP_MTEXT(txt) txt
|
||||||
|
|
||||||
/* TODO: if the compiler doesn't have the built-in wchar_t support
|
/* TODO: if the compiler doesn't have the built-in wchar_t support
|
||||||
* XP_WCHAR & XP_WTEXT must be defined differently.
|
* XP_WCHAR & XP_WTEXT must be defined differently.
|
||||||
#define XP_WCHAR(ch) ((xp_wchar_t)ch)
|
#define XP_WCHAR(ch) ((xp_wchar_t)ch)
|
||||||
#define XP_WTEXT(txt) don't know yet... may have to call a function?
|
#define XP_WTEXT(txt) don't know yet... may have to call a function?
|
||||||
*/
|
*/
|
||||||
#define XP_WCHAR(ch) ((xp_wchar_t)L##ch)
|
#define XP_WCHAR(ch) L##ch
|
||||||
#define XP_WTEXT(txt) ((const xp_wchar_t*)L##txt)
|
#define XP_WTEXT(txt) L##txt
|
||||||
|
|
||||||
#if defined(XP_CHAR_IS_MCHAR)
|
#if defined(XP_CHAR_IS_MCHAR)
|
||||||
#define XP_CHAR(ch) XP_MCHAR(ch)
|
#define XP_CHAR(ch) XP_MCHAR(ch)
|
||||||
|
Loading…
Reference in New Issue
Block a user