/************************************************************************ SUBROUTINE REALLOCATOR ALLOCATOR REALLOCATES THE PROPER AMOUNT OF STORAGE FOR AN ARRAY *************************************************************************/ /************************************************************** DEFINE *PREP AS A TWO INTEGER STRUCTURE. DEFINE *PREP2 AS A TWO INTEGER STRUCTURE. DEFINE *PREPF AS AN INTEGER, REAL STRUCTURE. DEFINE *PREP0 AS A REAL. DEFINE *PREPI AS AN INTEGER DEFINE *PREPSI AS A SHORT INTEGER DEFINE *PREP3 AS A THREE INTEGER STRUCTURE DEFINE *PREP4 AS A FOUR INTEGER STRUCTURE DEFINE *PREP5 AS A FIVE INTEGER STRUCTURE DEFINE *PREPFS AS A ONE REAL, ONE SHORT INTEGER STRUCTURE DEFINE *PREPIFS AS A ONE REAL, ONE INTEGER, ONE SHORT INTEGER STRUCTURE DEFINE *PREP2IF AS TWO INTEGERS, ONE REAL ***************************************************************/ struct write2 *prep,*prep2; struct write2f *prepf; struct write3 *prep3; struct write4 *prep4; struct write5 *prep5; struct write2if *prep2if; float *prep0; int *prepi; short int *prepsi; struct write2fs *prepfs; struct write3fs *prepifs; reallocator_( int *indicator, /* WHICH TYPE OF STRUCTURE TO ALLOCATE SPACE FOR: 0 - PREP0 (ONE REAL) 1 - WRITE2 (TWO INTEGERS) 2 - WRITE2F ( INTEGER,REAL) 3 - PREPI (ONE INTEGER) 4 - WRITE3 (THREE INTEGERS) 5 - PREP2 (TWO INTEGERS), SECOND WRITE2 STRUCTURE 6 - WRITE2FS - (ONE REAL, ONE SHORT INTEGER) 7 - WRITE3FS - (ONE REAL, ONE INTEGER, ONE SHORT INTEGER) 8 - PREPSI - (ONE SHORT INTEGER) 9 - PREP2IF - (TWO INTEGERS,ONE REAL) 10 - PREP4 (FOUR INTEGERS) 11 - PREP5 (FIVE INTEGERS) */ int *numpros /* NUMBER OF STRUCTURES FOR WHICH SPACE WILL BE ALLOCATED */ ) { int npros= *numpros+1; if ( *indicator == 0 ) { if ( (prep0 = realloc( prep0,npros * sizeof (float) )) == NULL ) printf( " Not enough space in memory for %d profiles to be sorted\n", *numpros); } else if ( *indicator == 1 ) { if ( (prep = realloc( prep,npros* 2 * sizeof( int ) )) == NULL ) printf( " Not enough space in memory for %d profiles to be sorted\n", *numpros); } else if ( *indicator == 2 ) { if ( (prepf = realloc( prepf,npros* sizeof( float )+ sizeof( int ) )) == NULL ) printf( " Not enough space in memory for %d profiles to be sorted\n", *numpros); } else if ( *indicator == 3 ) { if ( (prepi = realloc( prepi,npros * sizeof( int ) )) == NULL ) printf( " Not enough space in memory for %d profiles to be sorted\n", *numpros); } else if ( *indicator == 4 ) { if ( (prep3 = realloc( prep3,npros * 3*sizeof( int ) )) == NULL ) printf( " Not enough space in memory for %d profiles to be sorted\n", *numpros); } else if ( *indicator == 5 ) { if ( (prep2 = realloc( prep2,npros* 2 * sizeof( int ) )) == NULL ) printf( " Not enough space in memory for %d profiles to be sorted\n", *numpros); } else if ( *indicator == 6 ) { if ( (prepfs = realloc( prepfs,npros* sizeof( struct write2fs ) )) == NULL ) printf( " Not enough space in memory for %d profiles to be sorted\n", *numpros); } else if ( *indicator == 7 ) { if ( (prepifs = realloc(prepifs, npros* sizeof( struct write3fs ) )) == NULL ) printf( " Not enough space in memory for %d profiles to be sorted\n", *numpros); } else if ( *indicator == 8 ) { if ( (prepsi = realloc( prepsi,npros* sizeof( short int ) )) == NULL ) printf( " Not enough space in memory for %d profiles to be sorted\n", *numpros); } else if ( *indicator == 9 ) { if ( (prep2if = realloc( prep2if,npros* sizeof( struct write2if ) )) == NULL ) printf( " Not enough space in memory for %d profiles to be sorted\n", *numpros); } else if ( *indicator == 10 ) { if ( (prep4 = realloc( prep4,npros* sizeof( struct write4 ) )) == NULL ) printf( " Not enough space in memory for %d profiles to be sorted\n", *numpros); } else if ( *indicator == 11 ) { if ( (prep5 = realloc( prep5,npros* sizeof( struct write5 ) )) == NULL ) printf( " Not enough space in memory for %d profiles to be sorted\n", *numpros); } }