--- parser3/src/main/Attic/pa_array.C 2002/01/21 12:10:07 1.44 +++ parser3/src/main/Attic/pa_array.C 2002/03/27 15:30:36 1.48 @@ -1,10 +1,10 @@ /** @file Parser: array class. - Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexander Petrosyan (http://paf.design.ru) + Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexandr Petrosian (http://paf.design.ru) - $Id: pa_array.C,v 1.44 2002/01/21 12:10:07 paf Exp $ + $Id: pa_array.C,v 1.48 2002/03/27 15:30:36 paf Exp $ */ #include "pa_pool.h" @@ -12,10 +12,7 @@ #include "pa_exception.h" #include "pa_common.h" -Array::Array(Pool& apool, int initial_rows) : - Pooled(apool) { - initial_rows=max(initial_rows, CR_INITIAL_ROWS_DEFAULT); - +void Array::construct_new(int initial_rows) { head=tail=static_cast( malloc(sizeof(int)+sizeof(Chunk::Row)*initial_rows+sizeof(Chunk *), 19)); head->count=initial_rows; @@ -25,6 +22,15 @@ Array::Array(Pool& apool, int initial_ro fused_rows=0; } +Array::Array(Pool& apool, int initial_rows) : Pooled(apool) { + construct_new(max(initial_rows, CR_INITIAL_ROWS_DEFAULT)); +} + +Array::Array(const Array& source, int offset) : Pooled(source.pool()) { + construct_new(source.size()); + append_array(source, offset); +} + void Array::expand(int chunk_rows) { Chunk *chunk=tail=static_cast( malloc(sizeof(int)+sizeof(Chunk::Row)*chunk_rows+sizeof(Chunk *), 2)); @@ -48,7 +54,7 @@ Array& Array::operator += (Item *src) { Array::Item *Array::get(int index) const { if(!(index>=0 && index=0 && index