#ident "@(#) create_struct.c 1.1 05/08/19 SwRI" #include #include "old_vidf_str.h" #include "vidf_codes.h" #include "SDDAS_types.h" /***************************************************************************** * * * IR_INIT_EXPERIMENT_INFO SUBROUTINE * * * * DESCRIPTION * * This routine is called to initialize a newly allocated experiment_info * * structure, which indicates that a new data set has been encountered and * * is being processed. * * * * INPUT VARIABLES * * void **vidf_data_ptr ptr to the memory location that holds the * * address of the structure that holds * * the contents of a VIDF file * * * * USAGE * * x = create_vidf_structure (&vidf_data_ptr) * * * * NECESSARY SUBPROGRAMS * * sizeof () the size of the specified object in bytes * * malloc () allocates memory * * * * EXTERNAL VARIABLES * * None * * * * INTERNAL VARIABLES * * size_t bytes the number of bytes to allocate * * SDDAS_SHORT i looping variable * * void *tmp_ptr pointer which holds address passed back * * by the call to the MALLOC routine * * * * SUBSYSTEM * * Display Level * * * *****************************************************************************/ SDDAS_SHORT create_vidf_structure (void **vidf_data_ptr) { vidf_info *VIDF_INFO; size_t bytes; SDDAS_SHORT i; void *tmp_ptr; /************************************************************************/ /* Allocate the structure that holds the information read from the */ /* VIDF file. */ /************************************************************************/ bytes = sizeof (vidf_info); if ((tmp_ptr = malloc (bytes)) == NULL) return (VIDF_CREATE_MALLOC); /************************************************************************/ /* Initialize the information pertinent to the reading of VIDF data. */ /************************************************************************/ VIDF_INFO = (vidf_info *) tmp_ptr; VIDF_INFO->version[0] = '\0'; VIDF_INFO->vidf_data = NULL; VIDF_INFO->tbl_offs = NULL; VIDF_INFO->const_offs = NULL; VIDF_INFO->info_off = 0; VIDF_INFO->TABLES = 0; VIDF_INFO->CONSTS = 0; for (i = 0; i < 72; ++i) VIDF_INFO->offsets[i] = 0; *vidf_data_ptr = tmp_ptr; return (ALL_OKAY); }