#include<stdio.h>
extern alloc_memory(),open_files(),init_screen(),init_printer(),
init_vars(),init_commport();
char * memblock;
#define BLOCK_SIZE 4096
#define MEM_ALLOCATION_ERROR 2001
int (*init_funcs[])() = {
alloc_memory, /* Each of these initialization functions */
open_files, /* returns a value of 0 if it executed OK. */
init_screen, /* If an error occurred ,it returns an error*/
init_printer, /* code that is unique to itself, such as */
init_vars, /* MEM_ALLOCATION_ERROR. The error is*/
init_commport, /* handled by the routine that called */
NULL /* initialize() */
};
initialize()
{
int i,errstat;
for(i = 0 ; init_funcs[i] != NULL ; ++i){
if(errstat = (*init_funcs[i])()){
return(errstat);
}
}
return(0);
}
alloc_memory()
{
char * malloc();
if(!(memblock = (char *)malloc(BLOCK_SIZE))){
return(MEM_ALLOCATION_ERROR);
}
return(0);
}
/* The rest of the initialization functions are setup like
alloc_memory() */