/***********************************************************************/ /* Open Visualization Data Explorer */ /* (C) Copyright IBM Corp. 1989,1999 */ /* ALL RIGHTS RESERVED */ /* This code licensed under the */ /* "IBM PUBLIC LICENSE - Open Visualization Data Explorer" */ /***********************************************************************/ /* \section{Array class} Dynamic arrays are implemented by re-allocating the storage block pointed to by {\tt data} as necessary, thus increasing the size of the block in proportion to the current size. If only one dynamic array is being created at a time, the overhead is minimal. If two or more are being created simultaneously, the overhead is a small fixed number of copy operations of the entire data. To demonstrate this: Let $\alpha>1$ be the factor by which the block is enlarged. Suppose $N$ is the final size of the block, where $\alpha^narray.data) { \ DXsyncmem(); \ return a->array.data; \ } \ DXlock(&a->array.inprogress, DXProcessorId()); \ if (a->array.data) { \ DXunlock(&a->array.inprogress, DXProcessorId());\ DXsyncmem(); \ return a->array.data; \ } \ } #define EXPAND_RETURN(a, result) { \ a->array.data = (Pointer)(result); \ DXunlock(&a->array.inprogress, DXProcessorId()); \ return (Pointer)(result); \ } #define EXPAND_ERROR(a) { \ DXunlock(&a->array.inprogress, DXProcessorId()); \ return NULL; \ }