The patch below my sig adds a new_stack() function to take care of the allocation and setup of "generic" stacks. It's called like:
new_stack(interpreter, &base, &top); This in preparation for my third regex patch, which I should have ready in a few days. --Brent Dax [EMAIL PROTECTED] Configure pumpking for Perl 6 "Nothing important happened today." --George III of England's diary entry for 4-Jul-1776 --- ..\..\parrot-cvs\parrot\include\parrot\stacks.h Thu Jan 3 14:18:52 2002 +++ include\parrot\stacks.h Thu Jan 3 14:13:04 2002 @@ -38,6 +38,8 @@ struct Stack_Entry entry[STACK_CHUNK_DEPTH]; }; +void new_stack(struct Parrot_Interp *, struct StackChunk **, struct Stack_Entry **); + INTVAL stack_depth(struct Parrot_Interp *,struct StackChunk *chunk); struct Stack_Entry *stack_entry(struct Parrot_Interp *, struct StackChunk *chunk,INTVAL); void rotate_entries(struct Parrot_Interp *, struct StackChunk *, struct Stack_Entry *, INTVAL); --- ..\..\parrot-cvs\parrot\stacks.c Thu Jan 3 14:18:08 2002 +++ stacks.c Thu Jan 3 14:25:40 2002 @@ -12,6 +12,17 @@ #include "parrot/parrot.h" +void +new_stack(struct Parrot_Interp *interpreter, struct StackChunk **base, struct Stack_Entry **top) { + (*base)=mem_allocate_aligned(sizeof(struct StackChunk)); + (*top)=&((*base)->entry[0]); + + (*base)->used=0; + (*base)->free=STACK_CHUNK_DEPTH; + (*base)->next=NULL; + (*base)->prev=NULL; +} + INTVAL stack_depth(struct Parrot_Interp *interpreter, struct StackChunk *chunk) { INTVAL depth; --- ..\..\parrot-cvs\parrot\interpreter.c Thu Jan 3 14:18:06 2002 +++ interpreter.c Thu Jan 3 14:15:48 2002 @@ -471,31 +471,15 @@ Parrot_clear_p(interpreter); /* Need a user stack */ - interpreter->user_stack_base = - mem_allocate_aligned(sizeof(struct StackChunk)); - interpreter->user_stack_top = &interpreter->user_stack_base->entry[0]; - /* Unlike the registers, we start with zero used */ - interpreter->user_stack_base->used = 0; - interpreter->user_stack_base->free = STACK_CHUNK_DEPTH; - interpreter->user_stack_base->next = NULL; - interpreter->user_stack_base->prev = NULL; + new_stack(interpreter, &interpreter->user_stack_base, &interpreter->user_stack_top); /* And a control stack */ - interpreter->control_stack_base = - mem_allocate_aligned(sizeof(struct StackChunk)); - interpreter->control_stack_top = - &interpreter->control_stack_base->entry[0]; - /* Unlike the registers, we start with zero used */ - interpreter->control_stack_base->used = 0; - interpreter->control_stack_base->free = STACK_CHUNK_DEPTH; - interpreter->control_stack_base->next = NULL; - interpreter->control_stack_base->prev = NULL; + new_stack(interpreter, &interpreter->control_stack_base, &interpreter->control_stack_top); /* Need an empty stash */ interpreter->perl_stash = mem_allocate_new_stash(); /* Load the core op func and info tables */ - interpreter->op_lib = PARROT_CORE_OPLIB_INIT(); interpreter->op_count = interpreter->op_lib->op_count; interpreter->op_func_table = interpreter->op_lib->op_func_table;