Hi,
[...]
> Right now it's only used by lists and nodes, but I want to make it more flexible
> For example, add type parametr for example: pool_free, pool_list, pool_node and so on
[...]
> For example kNewNode now look like:
> heap_ptr nodebase = POOL_ALLOCATE (8); /* instead of heap_allocate */
OK, but plus type parameters, I suppose (POOL_ALLOCATE(POOL_NODE, 8)
or something like that)?
> if (!nodebase) {
> KERNEL_OOPS
> return 0;
> }
> PUT_POOL (nodebase, LIST_PREVIOUS_NODE, 0); /* instead of PUT_HEAP (nodebase +
>LIST_PREVIOUS_NODE, 0); */
If we're doing this already, we might as well describe the structures in
plain C and do
struct node_struct
{
pool_ptr prev, next;
int key, value;
}
...
struct node_struct *node = POOL_ALLOCATE(POOL_NODE);
/* explicit typecast in macro */
POOL_MEM_ASSERT(node, "memory node"); /* Error check */
node->next = pool->prev = 0;
pool->key = PARAM(0);
pool->value = PARAM(1);
...
...where POOL_ALLOCATE could look something like:
#define POOL_ALLOCATE(type) (type *) pool_alloc(sizeof(type), #type)
> So I changed all list refernces in klists, kstrings and kgraphics
> I finish with additional check today evening and can send you a patch
Great! I'm not certain yet whether it should go into a separate tree yet
(as it would require additional debug functionality and depart from Sierra
SCI heap compatibility) or into the main one (since the changes don't
affect the scripts yet), but I'm leaning towards the former, since this
isn't going to help with the games we intend to support for 0.4
(SCI0) anyway.
llap,
Christoph