--- parser3/src/main/Attic/pa_array.C 2001/01/27 15:00:04 1.1 +++ parser3/src/main/Attic/pa_array.C 2003/02/17 13:49:15 1.54.2.3 @@ -1,68 +1,15 @@ -/* - $Id: pa_array.C,v 1.1 2001/01/27 15:00:04 paf Exp $ -*/ - -#include - -#include "pa_pool.h" - -void *Array::operator new(size_t size, Pool *apool) { - return apool->malloc(size); -} - -void Array::construct(Pool *apool, int initial_rows) { - pool=apool; - curr_chunk_rows=initial_rows; - head=static_cast( - pool->malloc(sizeof(int)+sizeof(Chunk::Row)*curr_chunk_rows+sizeof(Chunk *))); - append_here=head->rows; - link_row=&head->rows[curr_chunk_rows]; - link_row->link=0; - fused_rows=0; -} - -void Array::expand() { - curr_chunk_rows+=curr_chunk_rows*CR_GROW_PERCENT/100; - Chunk *chunk=static_cast( - pool->malloc(sizeof(int)+sizeof(Chunk::Row)*curr_chunk_rows+sizeof(Chunk *))); - chunk->count=curr_chunk_rows; - link_row->link=chunk; - append_here=chunk->rows; - link_row=&chunk->rows[curr_chunk_rows]; - link_row->link=0; -} +/** @file + Parser: Array classe impl. + Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexandr Petrosian (http://paf.design.ru) +*/ -Array& Array::operator += (Item src) { - if(chunk_is_full()) - expand(); - - append_here->item=src; - append_here++; fused_rows++; - - return *this; -} - -/* -char *Array::c_str() { - char *result=static_cast(pool->malloc(size()+1)); - - char *copy_here=result; - Chunk *chunk=&head; - do { - Chunk::Row *row=chunk->rows; - for(int i=0; icount; i++) { - if(row==append_here) - goto break2; - - memcpy(copy_here, row->item.ptr, row->item.size); - copy_here+=row->item.size; - row++; - } - chunk=row->link; - } while(chunk); -break2: - *copy_here=0; - return result; -} -*/ \ No newline at end of file +#include "pa_array.h" +#include "pa_types.h" +#include "pa_common.h" + +char* Pool::format_integer(int value) { + char local[MAX_NUMBER]; + return copy(local, snprintf(local, MAX_NUMBER, "%d", value)); +};