Index: classes/multiarray.pmc =================================================================== RCS file: /cvs/public/parrot/classes/multiarray.pmc,v retrieving revision 1.5 diff -p -u -r1.5 multiarray.pmc --- classes/multiarray.pmc 7 Sep 2002 02:29:09 -0000 1.5 +++ classes/multiarray.pmc 22 Oct 2002 07:00:30 -0000 @@ -56,7 +56,7 @@ typedef struct _cell_buffer CELL_B; * cell buffer representation */ struct _cell_buffer { - Buffer *cell_buffer; + Buffer buffer; INTVAL size; INTVAL free_cell; PMC *dimension; @@ -102,7 +102,7 @@ static INTVAL calc_offset_multi(struct P dim_key = cell_data->dimension; my_key = k; - if(cell_data->cell_buffer != NULL && dim_key != NULL && my_key != NULL ) { + if(cell_data->buffer.bufstart != NULL && dim_key != NULL && my_key != NULL ) { /* first part of alg. * (i + (j-1)*Ni @@ -155,7 +155,7 @@ static void expand_cell_buffer( struct P { CELL_B *b = data; if(new_size > b->size) { - Parrot_reallocate(interpreter, b->cell_buffer, new_size * sizeof(CELL)); + Parrot_reallocate(interpreter, &b->buffer, new_size * sizeof(CELL)); b->free_cell += (new_size - b->size); b->size = new_size; } @@ -171,7 +171,7 @@ static CELL *new_cell( struct Parrot_Int CELL *ret_cell; INTVAL new_size = 0; CELL_B *cell_b = data; - ret_cell = (CELL *)cell_b->cell_buffer->bufstart; + ret_cell = (CELL *)cell_b->buffer.bufstart; if((cell_b->free_cell-1) > 0) { cell_b->free_cell -= 1; @@ -179,7 +179,7 @@ static CELL *new_cell( struct Parrot_Int new_size = cell_b->size*2; expand_cell_buffer( interpreter, cell_b, new_size); cell_b->free_cell -= 1; - ret_cell = (CELL *)cell_b->cell_buffer->bufstart; + ret_cell = (CELL *)cell_b->buffer.bufstart; } return &ret_cell[cell_b->size - cell_b->free_cell-1]; /* notice -1 we start at 0 */ } @@ -188,13 +188,11 @@ static CELL *new_cell( struct Parrot_Int static CELL_B *new_marray( Interp *interpreter ) { CELL_B *b = (CELL_B *)new_bufferlike_header(interpreter, sizeof(*b)); - /* CELL_B *b = (CELL_B *)new_tracked_header(interpreter, sizeof(*b)); */ b->size = CELL_POOL_SIZE; b->free_cell = CELL_POOL_SIZE; - b->cell_buffer = new_buffer_header(interpreter); b->dimension = NULL; - Parrot_allocate(interpreter, b->cell_buffer , CELL_POOL_SIZE*sizeof(CELL)); - memset( b->cell_buffer->bufstart, 0, CELL_POOL_SIZE*sizeof(CELL)); + Parrot_allocate(interpreter, &b->buffer, CELL_POOL_SIZE*sizeof(CELL)); + memset( b->cell_buffer.bufstart, 0, CELL_POOL_SIZE*sizeof(CELL)); return b; } @@ -208,8 +206,8 @@ static void init_marray( Interp *interpr PMC *oldkey; marray = new_marray(interpreter); - marray->cell_buffer->flags |= PMC_is_buffer_ptr_FLAG; - marray->cell_buffer->flags |= PMC_is_PMC_ptr_FLAG; + marray->buffer.flags |= PMC_is_buffer_ptr_FLAG; + marray->buffer.flags |= PMC_is_PMC_ptr_FLAG; self->data = (CELL_B *)marray; self->cache.int_val = 0; @@ -225,8 +223,8 @@ static void init_marray( Interp *interpr marray->size = size; marray->free_cell = size; - Parrot_reallocate(interpreter, marray->cell_buffer, marray->size * sizeof(CELL)); - memset(marray->cell_buffer->bufstart, 0, marray->size * sizeof(CELL)); + Parrot_reallocate(interpreter, &marray->buffer, marray->size * sizeof(CELL)); + memset(marray->buffer.bufstart, 0, marray->size * sizeof(CELL)); marray->dimension = oldkey; } @@ -249,7 +247,7 @@ static INTVAL get_marray_keyed( Interp * offs = calc_offset_multi(interpreter, mg_marray, key); - base = (CELL *)mg_marray->cell_buffer->bufstart; + base = (CELL *)mg_marray->buffer.bufstart; buffer_ptr = &base[offs]; buffer_ptr_virt = buffer_ptr; @@ -319,7 +317,7 @@ static void set_marray_keyed( Interp *in CELL *base; INTVAL offs = 0; offs = calc_offset_multi(interpreter, sik_marray, key); - base = (CELL *)sik_marray->cell_buffer->bufstart; + base = (CELL *)sik_marray->buffer.bufstart; my_cell = &base[offs]; my_cell->virtual_addr = offs; my_cell->data.int_val = src_value; @@ -827,7 +825,7 @@ pmclass MultiArray { INTVAL stalker; marray = SELF->data; - base = (CELL *)marray->cell_buffer->bufstart; + base = (CELL *)marray->buffer.bufstart; size = stalker = marray->size; while(stalker >= 0) { ptr = &base[size-stalker]; @@ -865,7 +863,7 @@ pmclass MultiArray { INTVAL stalker; marray = SELF->data; - base = (CELL *)marray->cell_buffer->bufstart; + base = (CELL *)marray->buffer.bufstart; size = stalker = marray->size; while(stalker >= 0) { ptr = &base[size-stalker]; @@ -902,7 +900,7 @@ pmclass MultiArray { INTVAL stalker; marray = SELF->data; - base = (CELL *)marray->cell_buffer->bufstart; + base = (CELL *)marray->buffer.bufstart; size = stalker = marray->size; while(stalker >= 0) { ptr = &base[size-stalker]; @@ -939,7 +937,7 @@ pmclass MultiArray { INTVAL stalker; marray = SELF->data; - base = (CELL *)marray->cell_buffer->bufstart; + base = (CELL *)marray->buffer.bufstart; size = stalker = marray->size; while(stalker >= 0) { ptr = &base[size-stalker]; @@ -976,7 +974,7 @@ pmclass MultiArray { INTVAL stalker; marray = SELF->data; - base = (CELL *)marray->cell_buffer->bufstart; + base = (CELL *)marray->buffer.bufstart; size = stalker = marray->size; while(stalker >= 0) { ptr = &base[size-stalker];