Modified eas3 interface to decouple it from the command line tool.

This commit is contained in:
Patrick Vogler 2024-10-28 11:04:18 +01:00
parent 26c00bd4e3
commit 6d5dc06446
Signed by: Patrick Vogler
GPG key ID: 5536B08CE82E8509
2 changed files with 44 additions and 12 deletions

View file

@ -347,6 +347,18 @@
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! This function deallocates the data structure used to store an numerical dataset !
! and can be called if an error occurs or once the data is no longer needed is to be closed. !
! The deallocation will be carried out down to the structure levels that have been allocated. !
! !
\*----------------------------------------------------------------------------------------------------------*/
void
eas3_free_data(eas3_data* data);
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: bwc_data* read_eas3(const char* const filename) !
! -------------- !

View file

@ -76,7 +76,25 @@
#include <string.h>
#include "eas3.h"
#include "bwccmdl.h"
/************************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************************/
#define MEMERROR "o##########################################################o\n"\
"| ERROR: Out of memory |\n"\
"o##########################################################o\n"
#define RDERROR "o##########################################################o\n"\
"| ERROR: Invalid Number of Bytes Read from File. |\n"\
"o##########################################################o\n"
#define WRTERROR "o##########################################################o\n"\
"| ERROR: Invalid Number of Bytes Written to File. |\n"\
"o##########################################################o\n"
/************************************************************************************************************\
|| ___ ____ _ _ _ ____ ___ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
@ -213,18 +231,20 @@ endian_conversion(void *value,
void
eas3_free_data(eas3_data* data)
{
if(data)
if(data != NULL)
{
//if(data->aux)
//{
//free(data->aux->memory);
//data->aux->access = NULL;
//data->aux->position = 0;
//data->aux->size = 0;
// TODO: remove
//data->aux->L = 0;
//}
//free(data->aux);
if (data->param_names != NULL)
free(data->param_names);
if (data->field.d != NULL)
free(data->field.d);
if (data->field.f != NULL)
free(data->field.f);
if(data->aux.ptr != NULL)
free(data->aux.ptr);
free(data);
}
}