/************************************************************************ SUBROUTINE ALLOCATOR ALLOCATOR ALLOCATES THE PROPER AMOUNT OF STORAGE FOR AN ARRAY OF TWO INTEGER STRUCTURES. *************************************************************************/ /************************************************************** 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 2 INTEGERS AND ONE REAL ***************************************************************/ struct write2 *prep,*prep2; struct write2f *prepf; struct write3 *prep3; struct write4 *prep4; struct write4 *prep4; struct write5 *prep5; struct write2if *prep2if; float *prep0; int *prepi,*prepi2; short int *prepsi; struct write2fs *prepfs; struct write3fs *prepifs; allocator_( 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 = malloc( npros * sizeof (float) )) == NULL ) printf( " Not enough space in memory for %d profiles to be sorted\n", *numpros); } else if ( *indicator == 1 ) { if ( (prep = calloc( 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 = calloc( 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 = malloc( npros * sizeof( int ) )) == NULL ) printf( " Not enough space in memory for %d profiles to be sorted\n", *numpros); } else if ( *indicator == 4 ) { if ( (prep3 = calloc( 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 = calloc( 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 = calloc( 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 = calloc( 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 = calloc( 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 = calloc( 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 = calloc( 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 = calloc( npros, sizeof( struct write5 ) )) == NULL ) printf( " Not enough space in memory for %d profiles to be sorted\n", *numpros); } }