Back to index

lightning-sunbird  0.9+nobinonly
morkPool.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-  */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1999
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef _MDB_
00039 #include "mdb.h"
00040 #endif
00041 
00042 #ifndef _MORK_
00043 #include "mork.h"
00044 #endif
00045 
00046 #ifndef _MORKNODE_
00047 #include "morkNode.h"
00048 #endif
00049 
00050 #ifndef _MORKENV_
00051 #include "morkEnv.h"
00052 #endif
00053 
00054 #ifndef _MORKPOOL_
00055 #include "morkPool.h"
00056 #endif
00057 
00058 #ifndef _MORKATOM_
00059 #include "morkAtom.h"
00060 #endif
00061 
00062 #ifndef _MORKHANDLE_
00063 #include "morkHandle.h"
00064 #endif
00065 
00066 #ifndef _MORKCELL_
00067 #include "morkCell.h"
00068 #endif
00069 
00070 #ifndef _MORKROW_
00071 #include "morkRow.h"
00072 #endif
00073 
00074 #ifndef _MORKBLOB_
00075 #include "morkBlob.h"
00076 #endif
00077 
00078 #ifndef _MORKDEQUE_
00079 #include "morkDeque.h"
00080 #endif
00081 
00082 #ifndef _MORKZONE_
00083 #include "morkZone.h"
00084 #endif
00085 
00086 //3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
00087 
00088 // ````` ````` ````` ````` ````` 
00089 // { ===== begin morkNode interface =====
00090 
00091 /*public virtual*/ void
00092 morkPool::CloseMorkNode(morkEnv* ev) // ClosePool() only if open
00093 {
00094   if ( this->IsOpenNode() )
00095   {
00096     this->MarkClosing();
00097     this->ClosePool(ev);
00098     this->MarkShut();
00099   }
00100 }
00101 
00102 /*public virtual*/
00103 morkPool::~morkPool() // assert ClosePool() executed earlier
00104 {
00105   MORK_ASSERT(this->IsShutNode());
00106 }
00107 
00108 /*public non-poly*/
00109 morkPool::morkPool(const morkUsage& inUsage, nsIMdbHeap* ioHeap,
00110   nsIMdbHeap* ioSlotHeap)
00111 : morkNode(inUsage, ioHeap)
00112 , mPool_Heap( ioSlotHeap )
00113 , mPool_UsedFramesCount( 0 )
00114 , mPool_FreeFramesCount( 0 )
00115 {
00116   // mPool_Heap is NOT refcounted
00117   MORK_ASSERT(ioSlotHeap);
00118   if ( ioSlotHeap )
00119     mNode_Derived = morkDerived_kPool;
00120 }
00121 
00122 /*public non-poly*/
00123 morkPool::morkPool(morkEnv* ev,
00124   const morkUsage& inUsage, nsIMdbHeap* ioHeap, nsIMdbHeap* ioSlotHeap)
00125 : morkNode(ev, inUsage, ioHeap)
00126 , mPool_Heap( ioSlotHeap )
00127 , mPool_UsedFramesCount( 0 )
00128 , mPool_FreeFramesCount( 0 )
00129 {
00130   if ( ioSlotHeap )
00131   {
00132     // mPool_Heap is NOT refcounted:
00133     // nsIMdbHeap_SlotStrongHeap(ioSlotHeap, ev, &mPool_Heap);
00134     if ( ev->Good() )
00135       mNode_Derived = morkDerived_kPool;
00136   }
00137   else
00138     ev->NilPointerError();
00139 }
00140 
00141 /*public non-poly*/ void
00142 morkPool::ClosePool(morkEnv* ev) // called by CloseMorkNode();
00143 {
00144   if ( this )
00145   {
00146     if ( this->IsNode() )
00147     {
00148 #ifdef morkZone_CONFIG_ARENA
00149 #else /*morkZone_CONFIG_ARENA*/
00150     //MORK_USED_1(ioZone);
00151 #endif /*morkZone_CONFIG_ARENA*/
00152 
00153       nsIMdbHeap* heap = mPool_Heap;
00154       nsIMdbEnv* mev = ev->AsMdbEnv();
00155       morkLink* aLink;
00156       morkDeque* d = &mPool_FreeHandleFrames;
00157       while ( (aLink = d->RemoveFirst()) != 0 )
00158         heap->Free(mev, aLink);
00159   
00160       // if the pool's closed, get rid of the frames in use too.
00161       d = &mPool_UsedHandleFrames;
00162       while ( (aLink = d->RemoveFirst()) != 0 )
00163         heap->Free(mev, aLink);
00164   
00165       this->MarkShut();
00166     }
00167     else
00168       this->NonNodeError(ev);
00169   }
00170   else
00171     ev->NilPointerError();
00172 }
00173 
00174 // } ===== end morkNode methods =====
00175 // ````` ````` ````` ````` ````` 
00176 
00177 
00178 // alloc and free individual instances of handles (inside hand frames):
00179 morkHandleFace*
00180 morkPool::NewHandle(morkEnv* ev, mork_size inSize, morkZone* ioZone)
00181 {
00182   void* newBlock = 0;
00183   if ( inSize <= sizeof(morkHandleFrame) )
00184   {
00185     morkLink* firstLink = mPool_FreeHandleFrames.RemoveFirst();
00186     if ( firstLink )
00187     {
00188       newBlock = firstLink;
00189       if ( mPool_FreeFramesCount )
00190         --mPool_FreeFramesCount;
00191       else
00192         ev->NewWarning("mPool_FreeFramesCount underflow");
00193     }
00194     else
00195       mPool_Heap->Alloc(ev->AsMdbEnv(), sizeof(morkHandleFrame),
00196         (void**) &newBlock);
00197   }
00198   else
00199   {
00200     ev->NewWarning("inSize > sizeof(morkHandleFrame)");
00201     mPool_Heap->Alloc(ev->AsMdbEnv(), inSize, (void**) &newBlock);
00202   }
00203 #ifdef morkZone_CONFIG_ARENA
00204 #else /*morkZone_CONFIG_ARENA*/
00205   MORK_USED_1(ioZone);
00206 #endif /*morkZone_CONFIG_ARENA*/
00207 
00208   return (morkHandleFace*) newBlock;
00209 }
00210 
00211 void
00212 morkPool::ZapHandle(morkEnv* ev, morkHandleFace* ioHandle)
00213 {
00214   if ( ioHandle )
00215   {
00216     morkLink* handleLink = (morkLink*) ioHandle;
00217     mPool_FreeHandleFrames.AddLast(handleLink);
00218     ++mPool_FreeFramesCount;
00219     // lets free all handles to track down leaks 
00220     // - uncomment out next 3 lines, comment out above 2
00221 //      nsIMdbHeap* heap = mPool_Heap;
00222 //      nsIMdbEnv* mev = ev->AsMdbEnv();
00223 //      heap->Free(mev, handleLink);
00224  
00225   }
00226 }
00227 
00228 
00229 // alloc and free individual instances of rows:
00230 morkRow*
00231 morkPool::NewRow(morkEnv* ev, morkZone* ioZone) // allocate a new row instance
00232 {
00233   morkRow* newRow = 0;
00234   
00235 #ifdef morkZone_CONFIG_ARENA
00236   // a zone 'chip' remembers no size, and so cannot be deallocated:
00237   newRow = (morkRow*) ioZone->ZoneNewChip(ev, sizeof(morkRow));
00238 #else /*morkZone_CONFIG_ARENA*/
00239   MORK_USED_1(ioZone);
00240   mPool_Heap->Alloc(ev->AsMdbEnv(), sizeof(morkRow), (void**) &newRow);
00241 #endif /*morkZone_CONFIG_ARENA*/
00242 
00243   if ( newRow )
00244     MORK_MEMSET(newRow, 0, sizeof(morkRow));
00245   
00246   return newRow;
00247 }
00248 
00249 void
00250 morkPool::ZapRow(morkEnv* ev, morkRow* ioRow,
00251   morkZone* ioZone) // free old row instance
00252 {
00253 #ifdef morkZone_CONFIG_ARENA
00254   if ( !ioRow )
00255     ev->NilPointerWarning(); // a zone 'chip' cannot be freed
00256 #else /*morkZone_CONFIG_ARENA*/
00257   MORK_USED_1(ioZone);
00258   if ( ioRow )
00259     mPool_Heap->Free(ev->AsMdbEnv(), ioRow);
00260 #endif /*morkZone_CONFIG_ARENA*/
00261 }
00262 
00263 // alloc and free entire vectors of cells (not just one cell at a time)
00264 morkCell*
00265 morkPool::NewCells(morkEnv* ev, mork_size inSize,
00266   morkZone* ioZone)
00267 {
00268   morkCell* newCells = 0;
00269 
00270   mork_size size = inSize * sizeof(morkCell);
00271   if ( size )
00272   {
00273 #ifdef morkZone_CONFIG_ARENA
00274     // a zone 'run' knows its size, and can indeed be deallocated:
00275     newCells = (morkCell*) ioZone->ZoneNewRun(ev, size);
00276 #else /*morkZone_CONFIG_ARENA*/
00277     MORK_USED_1(ioZone);
00278     mPool_Heap->Alloc(ev->AsMdbEnv(), size, (void**) &newCells);
00279 #endif /*morkZone_CONFIG_ARENA*/
00280   }
00281     
00282   // note morkAtom depends on having nil stored in all new mCell_Atom slots:
00283   if ( newCells )
00284     MORK_MEMSET(newCells, 0, size);
00285   return newCells;
00286 }
00287 
00288 void
00289 morkPool::ZapCells(morkEnv* ev, morkCell* ioVector, mork_size inSize,
00290   morkZone* ioZone)
00291 {
00292   MORK_USED_1(inSize);
00293 
00294   if ( ioVector )
00295   {
00296 #ifdef morkZone_CONFIG_ARENA
00297     // a zone 'run' knows its size, and can indeed be deallocated:
00298     ioZone->ZoneZapRun(ev, ioVector);
00299 #else /*morkZone_CONFIG_ARENA*/
00300     MORK_USED_1(ioZone);
00301     mPool_Heap->Free(ev->AsMdbEnv(), ioVector);
00302 #endif /*morkZone_CONFIG_ARENA*/
00303   }
00304 }
00305 
00306 // resize (grow or trim) cell vectors inside a containing row instance
00307 mork_bool
00308 morkPool::AddRowCells(morkEnv* ev, morkRow* ioRow, mork_size inNewSize,
00309   morkZone* ioZone)
00310 {
00311   // note strong implementation similarity to morkArray::Grow()
00312 
00313   MORK_USED_1(ioZone);
00314 #ifdef morkZone_CONFIG_ARENA
00315 #else /*morkZone_CONFIG_ARENA*/
00316 #endif /*morkZone_CONFIG_ARENA*/
00317 
00318   mork_fill fill = ioRow->mRow_Length;
00319   if ( ev->Good() && fill < inNewSize ) // need more cells?
00320   {
00321     morkCell* newCells = this->NewCells(ev, inNewSize, ioZone);
00322     if ( newCells )
00323     {
00324       morkCell* c = newCells; // for iterating during copy
00325       morkCell* oldCells = ioRow->mRow_Cells;
00326       morkCell* end = oldCells + fill; // copy all the old cells
00327       while ( oldCells < end )
00328       {
00329         *c++ = *oldCells++; // bitwise copy each old cell struct
00330       }
00331       oldCells = ioRow->mRow_Cells;
00332       ioRow->mRow_Cells = newCells;
00333       ioRow->mRow_Length = (mork_u2) inNewSize;
00334       ++ioRow->mRow_Seed;
00335       
00336       if ( oldCells )
00337         this->ZapCells(ev, oldCells, fill, ioZone);
00338     }
00339   }
00340   return ( ev->Good() && ioRow->mRow_Length >= inNewSize );
00341 }
00342 
00343 mork_bool
00344 morkPool::CutRowCells(morkEnv* ev, morkRow* ioRow,
00345   mork_size inNewSize,
00346   morkZone* ioZone)
00347 {
00348   MORK_USED_1(ioZone);
00349 #ifdef morkZone_CONFIG_ARENA
00350 #else /*morkZone_CONFIG_ARENA*/
00351 #endif /*morkZone_CONFIG_ARENA*/
00352 
00353   mork_fill fill = ioRow->mRow_Length;
00354   if ( ev->Good() && fill > inNewSize ) // need fewer cells?
00355   {
00356     if ( inNewSize ) // want any row cells at all?
00357     {
00358       morkCell* newCells = this->NewCells(ev, inNewSize, ioZone);
00359       if ( newCells )
00360       {
00361         morkCell* saveNewCells = newCells; // Keep newcell pos
00362         morkCell* oldCells = ioRow->mRow_Cells;
00363         morkCell* oldEnd = oldCells + fill; // one past all old cells
00364         morkCell* newEnd = oldCells + inNewSize; // copy only kept old cells
00365         while ( oldCells < newEnd )
00366         {
00367           *newCells++ = *oldCells++; // bitwise copy each old cell struct
00368         }
00369         while ( oldCells < oldEnd )
00370         {
00371           if ( oldCells->mCell_Atom ) // need to unref old cell atom?
00372             oldCells->SetAtom(ev, (morkAtom*) 0, this); // unref cell atom
00373           ++oldCells;
00374         }
00375         oldCells = ioRow->mRow_Cells;
00376         ioRow->mRow_Cells = saveNewCells;
00377         ioRow->mRow_Length = (mork_u2) inNewSize;
00378         ++ioRow->mRow_Seed;
00379         
00380         if ( oldCells )
00381           this->ZapCells(ev, oldCells, fill, ioZone);
00382       }
00383     }
00384     else // get rid of all row cells
00385     {
00386       morkCell* oldCells = ioRow->mRow_Cells;
00387       ioRow->mRow_Cells = 0;
00388       ioRow->mRow_Length = 0;
00389       ++ioRow->mRow_Seed;
00390       
00391       if ( oldCells )
00392         this->ZapCells(ev, oldCells, fill, ioZone);
00393     }
00394   }
00395   return ( ev->Good() && ioRow->mRow_Length <= inNewSize );
00396 }
00397 
00398 // alloc & free individual instances of atoms (lots of atom subclasses):
00399 void
00400 morkPool::ZapAtom(morkEnv* ev, morkAtom* ioAtom,
00401   morkZone* ioZone) // any subclass (by kind)
00402 {
00403 #ifdef morkZone_CONFIG_ARENA
00404   if ( !ioAtom )
00405     ev->NilPointerWarning(); // a zone 'chip' cannot be freed
00406 #else /*morkZone_CONFIG_ARENA*/
00407   MORK_USED_1(ioZone);
00408   if ( ioAtom )
00409     mPool_Heap->Free(ev->AsMdbEnv(), ioAtom);
00410 #endif /*morkZone_CONFIG_ARENA*/
00411 }
00412 
00413 morkOidAtom*
00414 morkPool::NewRowOidAtom(morkEnv* ev, const mdbOid& inOid,
00415   morkZone* ioZone)
00416 {
00417   morkOidAtom* newAtom = 0;
00418   
00419 #ifdef morkZone_CONFIG_ARENA
00420   // a zone 'chip' remembers no size, and so cannot be deallocated:
00421   newAtom = (morkOidAtom*) ioZone->ZoneNewChip(ev, sizeof(morkOidAtom));
00422 #else /*morkZone_CONFIG_ARENA*/
00423   MORK_USED_1(ioZone);
00424   mPool_Heap->Alloc(ev->AsMdbEnv(), sizeof(morkOidAtom),(void**) &newAtom);
00425 #endif /*morkZone_CONFIG_ARENA*/
00426 
00427   if ( newAtom )
00428     newAtom->InitRowOidAtom(ev, inOid);
00429   return newAtom;
00430 }
00431 
00432 morkOidAtom*
00433 morkPool::NewTableOidAtom(morkEnv* ev, const mdbOid& inOid,
00434   morkZone* ioZone)
00435 {
00436   morkOidAtom* newAtom = 0;
00437 
00438 #ifdef morkZone_CONFIG_ARENA
00439   // a zone 'chip' remembers no size, and so cannot be deallocated:
00440   newAtom = (morkOidAtom*) ioZone->ZoneNewChip(ev, sizeof(morkOidAtom));
00441 #else /*morkZone_CONFIG_ARENA*/
00442   MORK_USED_1(ioZone);
00443   mPool_Heap->Alloc(ev->AsMdbEnv(), sizeof(morkOidAtom), (void**) &newAtom);
00444 #endif /*morkZone_CONFIG_ARENA*/
00445   if ( newAtom )
00446     newAtom->InitTableOidAtom(ev, inOid);
00447   return newAtom;
00448 }
00449 
00450 morkAtom*
00451 morkPool::NewAnonAtom(morkEnv* ev, const morkBuf& inBuf,
00452   mork_cscode inForm,
00453   morkZone* ioZone)
00454 // if inForm is zero, and inBuf.mBuf_Fill is less than 256, then a 'wee'
00455 // anon atom will be created, and otherwise a 'big' anon atom.
00456 {
00457   morkAtom* newAtom = 0;
00458 
00459   mork_bool needBig = ( inForm || inBuf.mBuf_Fill > 255 );
00460   mork_size size = ( needBig )?
00461     morkBigAnonAtom::SizeForFill(inBuf.mBuf_Fill) :
00462     morkWeeAnonAtom::SizeForFill(inBuf.mBuf_Fill);
00463 
00464 #ifdef morkZone_CONFIG_ARENA
00465   // a zone 'chip' remembers no size, and so cannot be deallocated:
00466   newAtom = (morkAtom*) ioZone->ZoneNewChip(ev, size);
00467 #else /*morkZone_CONFIG_ARENA*/
00468   MORK_USED_1(ioZone);
00469   mPool_Heap->Alloc(ev->AsMdbEnv(), size, (void**) &newAtom);
00470 #endif /*morkZone_CONFIG_ARENA*/
00471   if ( newAtom )
00472   {
00473     if ( needBig )
00474       ((morkBigAnonAtom*) newAtom)->InitBigAnonAtom(ev, inBuf, inForm);
00475     else
00476       ((morkWeeAnonAtom*) newAtom)->InitWeeAnonAtom(ev, inBuf);
00477   }
00478   return newAtom;
00479 }
00480 
00481 morkBookAtom*
00482 morkPool::NewBookAtom(morkEnv* ev, const morkBuf& inBuf,
00483   mork_cscode inForm, morkAtomSpace* ioSpace, mork_aid inAid,
00484   morkZone* ioZone)
00485 // if inForm is zero, and inBuf.mBuf_Fill is less than 256, then a 'wee'
00486 // book atom will be created, and otherwise a 'big' book atom.
00487 {
00488   morkBookAtom* newAtom = 0;
00489 
00490   mork_bool needBig = ( inForm || inBuf.mBuf_Fill > 255 );
00491   mork_size size = ( needBig )?
00492     morkBigBookAtom::SizeForFill(inBuf.mBuf_Fill) :
00493     morkWeeBookAtom::SizeForFill(inBuf.mBuf_Fill);
00494 
00495 #ifdef morkZone_CONFIG_ARENA
00496   // a zone 'chip' remembers no size, and so cannot be deallocated:
00497   newAtom = (morkBookAtom*) ioZone->ZoneNewChip(ev, size);
00498 #else /*morkZone_CONFIG_ARENA*/
00499   MORK_USED_1(ioZone);
00500   mPool_Heap->Alloc(ev->AsMdbEnv(), size, (void**) &newAtom);
00501 #endif /*morkZone_CONFIG_ARENA*/
00502   if ( newAtom )
00503   {
00504     if ( needBig )
00505       ((morkBigBookAtom*) newAtom)->InitBigBookAtom(ev,
00506         inBuf, inForm, ioSpace, inAid);
00507     else
00508       ((morkWeeBookAtom*) newAtom)->InitWeeBookAtom(ev,
00509         inBuf, ioSpace, inAid);
00510   }
00511   return newAtom;
00512 }
00513 
00514 morkBookAtom*
00515 morkPool::NewBookAtomCopy(morkEnv* ev, const morkBigBookAtom& inAtom,
00516   morkZone* ioZone)
00517   // make the smallest kind of book atom that can hold content in inAtom.
00518   // The inAtom parameter is often expected to be a staged book atom in
00519   // the store, which was used to search an atom space for existing atoms.
00520 {
00521   morkBookAtom* newAtom = 0;
00522 
00523   mork_cscode form = inAtom.mBigBookAtom_Form;
00524   mork_fill fill = inAtom.mBigBookAtom_Size;
00525   mork_bool needBig = ( form || fill > 255 );
00526   mork_size size = ( needBig )?
00527     morkBigBookAtom::SizeForFill(fill) :
00528     morkWeeBookAtom::SizeForFill(fill);
00529 
00530 #ifdef morkZone_CONFIG_ARENA
00531   // a zone 'chip' remembers no size, and so cannot be deallocated:
00532   newAtom = (morkBookAtom*) ioZone->ZoneNewChip(ev, size);
00533 #else /*morkZone_CONFIG_ARENA*/
00534   MORK_USED_1(ioZone);
00535   mPool_Heap->Alloc(ev->AsMdbEnv(), size, (void**) &newAtom);
00536 #endif /*morkZone_CONFIG_ARENA*/
00537   if ( newAtom )
00538   {
00539     morkBuf buf(inAtom.mBigBookAtom_Body, fill);
00540     if ( needBig )
00541       ((morkBigBookAtom*) newAtom)->InitBigBookAtom(ev,
00542         buf, form, inAtom.mBookAtom_Space, inAtom.mBookAtom_Id);
00543     else
00544       ((morkWeeBookAtom*) newAtom)->InitWeeBookAtom(ev,
00545         buf, inAtom.mBookAtom_Space, inAtom.mBookAtom_Id);
00546   }
00547   return newAtom;
00548 }
00549 
00550 morkBookAtom*
00551 morkPool::NewFarBookAtomCopy(morkEnv* ev, const morkFarBookAtom& inAtom,
00552   morkZone* ioZone)
00553   // make the smallest kind of book atom that can hold content in inAtom.
00554   // The inAtom parameter is often expected to be a staged book atom in
00555   // the store, which was used to search an atom space for existing atoms.
00556 {
00557   morkBookAtom* newAtom = 0;
00558 
00559   mork_cscode form = inAtom.mFarBookAtom_Form;
00560   mork_fill fill = inAtom.mFarBookAtom_Size;
00561   mork_bool needBig = ( form || fill > 255 );
00562   mork_size size = ( needBig )?
00563     morkBigBookAtom::SizeForFill(fill) :
00564     morkWeeBookAtom::SizeForFill(fill);
00565 
00566 #ifdef morkZone_CONFIG_ARENA
00567   // a zone 'chip' remembers no size, and so cannot be deallocated:
00568   newAtom = (morkBookAtom*) ioZone->ZoneNewChip(ev, size);
00569 #else /*morkZone_CONFIG_ARENA*/
00570   MORK_USED_1(ioZone);
00571   mPool_Heap->Alloc(ev->AsMdbEnv(), size, (void**) &newAtom);
00572 #endif /*morkZone_CONFIG_ARENA*/
00573   if ( newAtom )
00574   {
00575     morkBuf buf(inAtom.mFarBookAtom_Body, fill);
00576     if ( needBig )
00577       ((morkBigBookAtom*) newAtom)->InitBigBookAtom(ev,
00578         buf, form, inAtom.mBookAtom_Space, inAtom.mBookAtom_Id);
00579     else
00580       ((morkWeeBookAtom*) newAtom)->InitWeeBookAtom(ev,
00581         buf, inAtom.mBookAtom_Space, inAtom.mBookAtom_Id);
00582   }
00583   return newAtom;
00584 }
00585 
00586 
00587 
00588 //3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
00589