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) ! ! FUNCTION NAME: bwc_data* read_eas3(const char* const filename) !
! -------------- ! ! -------------- !

View file

@ -76,7 +76,25 @@
#include <string.h> #include <string.h>
#include "eas3.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 void
eas3_free_data(eas3_data* data) eas3_free_data(eas3_data* data)
{ {
if(data) if(data != NULL)
{ {
//if(data->aux) if (data->param_names != NULL)
//{ free(data->param_names);
//free(data->aux->memory);
//data->aux->access = NULL; if (data->field.d != NULL)
//data->aux->position = 0; free(data->field.d);
//data->aux->size = 0;
// TODO: remove if (data->field.f != NULL)
//data->aux->L = 0; free(data->field.f);
//}
//free(data->aux); if(data->aux.ptr != NULL)
free(data->aux.ptr);
free(data); free(data);
} }
} }