48EST_Chunk::EST_Chunk ()
55EST_Chunk::~EST_Chunk ()
59 cerr <<
"deleting chunk with non-zero count\n";
73#if !defined(__CHUNK_INLINE_AGGRESSIVELY__)
75void EST_Chunk:: operator ++ ()
78 if (++count > MAX_CHUNK_COUNT)
80 cerr<<
"max count exceeded\n";
85 if (count < MAX_CHUNK_COUNT)
91void EST_Chunk::operator -- ()
95 cerr<<
"negative count\n";
106void *EST_Chunk::operator
new (
size_t size,
int bytes)
109 if (
bytes > MAX_CHUNK_SIZE)
111 cerr<<
"trying to make chunk of size "<<
bytes<<
"\n";
114#if defined(__CHUNK_USE_WALLOC__)
115 void *
it = walloc(
char, size+
bytes);
118 void *
it =
new char[size +
bytes];
128void EST_Chunk::operator
delete (
void *
it)
131#if defined(__CHUNK_USE_WALLOC__)
145#if !defined(__CHUNK_INLINE_AGGRESSIVELY__)
161EST_ChunkPtr::~EST_ChunkPtr (
void)
191EST_ChunkPtr::operator
const char*()
const
194 return &(ptr->memory[0]);
199EST_ChunkPtr::operator
char const*()
201 return ptr?&(ptr->memory[0]):(
const char *)NULL;
204EST_ChunkPtr::operator
char*()
210 CHUNK_WARN(
"getting writable version of shared chunk");
211 cp_make_updatable(*
this);
214 return &(ptr->memory[0]);
220char &EST_ChunkPtr::operator () (
int i) {
223 CHUNK_WARN(
"getting writable version of shared chunk");
224 cp_make_updatable(*
this);
226 return ptr->memory[i];
248 cerr<<
"initialiser too long\n";
265 cerr<<
"initialiser too long\n";
288 if (
cp.ptr &&
cp.ptr->count > 1)
301 if (
cp.ptr &&
cp.ptr->count > 1)
323 cp_make_updatable(
cp);
353 memcpy(
buff,
ch.memory, 20);
357 return (s<<
"[" <<
ch.size <<
"!" <<
ch.count <<
"!" <<
buff <<
"]");