feat/api #46
2 changed files with 28 additions and 28 deletions
|
@ -216,7 +216,7 @@
|
|||
|
||||
uchar *access; // Pointer used to parse packed stream.
|
||||
uchar *memory; // Memory handle for packed stream chunck.
|
||||
} bitstream;
|
||||
} span;
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! STRUCT NAME: eas3_header !
|
||||
|
@ -368,7 +368,7 @@
|
|||
float *f;
|
||||
} field;
|
||||
|
||||
bitstream *aux;
|
||||
span *aux;
|
||||
} eas3_data;
|
||||
|
||||
/************************************************************************************************************\
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
|| ||
|
||||
\************************************************************************************************************/
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! FUNCTION NAME: uint32 bytes_used(bitstream *const stream) !
|
||||
! FUNCTION NAME: uint32 eas3_bytes_used(bitstream *const stream) !
|
||||
! -------------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
|
@ -115,7 +115,7 @@
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uint64
|
||||
bytes_used(bitstream const *const stream)
|
||||
eas3_bytes_used(span const *const stream)
|
||||
{
|
||||
if(stream->T == 0xFF)
|
||||
{
|
||||
|
@ -128,7 +128,7 @@ bytes_used(bitstream const *const stream)
|
|||
}
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! FUNCTION NAME: bitstream* bwc_init_stream(uchar* memory, uint32 size, char instr) !
|
||||
! FUNCTION NAME: span* bwc_init_stream(uchar* memory, uint32 size, char instr) !
|
||||
! -------------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
|
@ -165,13 +165,13 @@ bytes_used(bitstream const *const stream)
|
|||
! 19.06.2019 Patrick Vogler B87D120 V 0.1.0 function created !
|
||||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
bitstream*
|
||||
init_stream(uchar* memory, uint32 size, char instr)
|
||||
span*
|
||||
eas3_init_stream(uchar* memory, uint32 size, char instr)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE STRUCTS: !
|
||||
\*-----------------------*/
|
||||
bitstream *stream;
|
||||
span *stream;
|
||||
|
||||
/*-----------------------*\
|
||||
! DEFINE ASSERTIONS: !
|
||||
|
@ -181,7 +181,7 @@ init_stream(uchar* memory, uint32 size, char instr)
|
|||
/*--------------------------------------------------------*\
|
||||
! Allocate the bwc stream structure. !
|
||||
\*--------------------------------------------------------*/
|
||||
stream = calloc(1, sizeof(bitstream));
|
||||
stream = calloc(1, sizeof(span));
|
||||
if(!stream)
|
||||
{
|
||||
// memory allocation error
|
||||
|
@ -231,7 +231,7 @@ init_stream(uchar* memory, uint32 size, char instr)
|
|||
}
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
! FUNCTION NAME: void bwc_emit_chunck(bitstream *const stream, const uchar* string, const uint64 length) !
|
||||
! FUNCTION NAME: void eas3_emit_chunck(bitstream *const stream, const uchar* string, const uint64 length) !
|
||||
! -------------- !
|
||||
! !
|
||||
! DESCRIPTION: !
|
||||
|
@ -266,7 +266,7 @@ init_stream(uchar* memory, uint32 size, char instr)
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
void
|
||||
emit_chunck(bitstream *const stream, const uchar* chunck, const uint64 size)
|
||||
eas3_emit_chunck(span *const stream, const uchar* chunck, const uint64 size)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE INT VARIABLES: !
|
||||
|
@ -283,7 +283,7 @@ emit_chunck(bitstream *const stream, const uchar* chunck, const uint64 size)
|
|||
! Evaluate the memory block size if the current chunck of !
|
||||
! data is written to the stream. !
|
||||
\*--------------------------------------------------------*/
|
||||
Lreq = (bytes_used(stream) + size);
|
||||
Lreq = (eas3_bytes_used(stream) + size);
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
! Check if the enough memory has been allocated for the !
|
||||
|
@ -373,7 +373,7 @@ emit_chunck(bitstream *const stream, const uchar* chunck, const uint64 size)
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar*
|
||||
get_chunck(bitstream *const stream, const uint64 size)
|
||||
eas3_get_chunck(span *const stream, const uint64 size)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE CHAR VARIABLES: !
|
||||
|
@ -390,7 +390,7 @@ get_chunck(bitstream *const stream, const uint64 size)
|
|||
! does not exceed the number of bytes still present in its !
|
||||
! memory block. !
|
||||
\*--------------------------------------------------------*/
|
||||
if(bytes_used(stream) + size <= stream->Lmax)
|
||||
if(eas3_bytes_used(stream) + size <= stream->Lmax)
|
||||
{
|
||||
/*--------------------------------------------------------*\
|
||||
! Allocate a temporary array used to store the bytes that !
|
||||
|
@ -461,7 +461,7 @@ get_chunck(bitstream *const stream, const uint64 size)
|
|||
! !
|
||||
\*----------------------------------------------------------------------------------------------------------*/
|
||||
uchar
|
||||
terminate_stream(bitstream *stream, bitstream *const packed_stream)
|
||||
eas3_terminate_stream(span *stream, span *const packed_stream)
|
||||
{
|
||||
/*-----------------------*\
|
||||
! DEFINE ASSERTIONS: !
|
||||
|
@ -722,7 +722,7 @@ read_eas3_header(FILE *const fp, eas3_data *const data)
|
|||
! DEFINE STRUCTS: !
|
||||
\*-----------------------*/
|
||||
bwc_gl_inf *info;
|
||||
bitstream *aux;
|
||||
span *aux;
|
||||
eas3_std_params *params;
|
||||
|
||||
/*-----------------------*\
|
||||
|
@ -778,7 +778,7 @@ read_eas3_header(FILE *const fp, eas3_data *const data)
|
|||
/*--------------------------------------------------------*\
|
||||
! Allocate the auxiliary information packed stream. !
|
||||
\*--------------------------------------------------------*/
|
||||
data->aux = calloc(1, sizeof(bitstream));
|
||||
data->aux = calloc(1, sizeof(span));
|
||||
if(!data->aux)
|
||||
{
|
||||
// memory allocation error
|
||||
|
@ -793,7 +793,7 @@ read_eas3_header(FILE *const fp, eas3_data *const data)
|
|||
! block has been chosen arbitrarily and should be large !
|
||||
! enough to prevent excessive reallocation. !
|
||||
\*--------------------------------------------------------*/
|
||||
aux = init_stream(NULL, AUX_SIZE, 'c');
|
||||
aux = eas3_init_stream(NULL, AUX_SIZE, 'c');
|
||||
if(!aux)
|
||||
{
|
||||
// memory allocation error
|
||||
|
@ -896,7 +896,7 @@ read_eas3_header(FILE *const fp, eas3_data *const data)
|
|||
! Emit the time step array to the auxiliary information !
|
||||
! memory block. !
|
||||
\*--------------------------------------------------------*/
|
||||
emit_chunck(aux, buffer_char, params->nts * sizeof(uint64));
|
||||
eas3_emit_chunck(aux, buffer_char, params->nts * sizeof(uint64));
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
! Check if any attributes have been specified in the eas3 !
|
||||
|
@ -929,7 +929,7 @@ read_eas3_header(FILE *const fp, eas3_data *const data)
|
|||
! Emit the timestep attribute array to the auxiliary infor-!
|
||||
! mation memory block. !
|
||||
\*--------------------------------------------------------*/
|
||||
emit_chunck(aux, buffer_char, params->nts * ATTRLEN * sizeof(char));
|
||||
eas3_emit_chunck(aux, buffer_char, params->nts * ATTRLEN * sizeof(char));
|
||||
|
||||
for(i = 0; i < params->npar; ++i)
|
||||
{
|
||||
|
@ -1000,7 +1000,7 @@ read_eas3_header(FILE *const fp, eas3_data *const data)
|
|||
! Emit the remaining header information the the auxiliary !
|
||||
! information stream. !
|
||||
\*--------------------------------------------------------*/
|
||||
emit_chunck(aux, buffer_char, Lread);
|
||||
eas3_emit_chunck(aux, buffer_char, Lread);
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
! Free the buffer character array. !
|
||||
|
@ -1012,7 +1012,7 @@ read_eas3_header(FILE *const fp, eas3_data *const data)
|
|||
! ful, the address to the aux memory block stored is !
|
||||
! stored in the file structure alongside its size. !
|
||||
\*--------------------------------------------------------*/
|
||||
if(terminate_stream(aux, data->aux))
|
||||
if(eas3_terminate_stream(aux, data->aux))
|
||||
{
|
||||
// memory allocation error
|
||||
fprintf(stderr, MEMERROR);
|
||||
|
@ -1073,7 +1073,7 @@ write_eas3_header(FILE *const fp, eas3_data *const data)
|
|||
! DEFINE STRUCTS: !
|
||||
\*-----------------------*/
|
||||
bwc_gl_inf *info;
|
||||
bitstream *aux;
|
||||
span *aux;
|
||||
eas3_std_params *params;
|
||||
eas3_param_names *param_names;
|
||||
|
||||
|
@ -1095,13 +1095,13 @@ write_eas3_header(FILE *const fp, eas3_data *const data)
|
|||
/*--------------------------------------------------------*\
|
||||
! Initialize the auxiliary information stream. !
|
||||
\*--------------------------------------------------------*/
|
||||
aux = init_stream(data->aux->memory, data->aux->size, 'd');
|
||||
aux = eas3_init_stream(data->aux->memory, data->aux->size, 'd');
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
! Get the standard parameters from the auxiliary informa- !
|
||||
! memory block and write them to the file stream. !
|
||||
\*--------------------------------------------------------*/
|
||||
params = (eas3_std_params*)get_chunck(aux, 176);
|
||||
params = (eas3_std_params*)eas3_get_chunck(aux, 176);
|
||||
|
||||
if(fwrite(params, sizeof(uint64), 22, fp) != 22)
|
||||
{
|
||||
|
@ -1129,7 +1129,7 @@ write_eas3_header(FILE *const fp, eas3_data *const data)
|
|||
! the timestep array from the auxiliary information block !
|
||||
! and write it to the file stream. !
|
||||
\*--------------------------------------------------------*/
|
||||
buffer_char = get_chunck(aux, data->params.nts * sizeof(uint64));
|
||||
buffer_char = eas3_get_chunck(aux, data->params.nts * sizeof(uint64));
|
||||
if(!buffer_char)
|
||||
{
|
||||
// memory allocation error
|
||||
|
@ -1158,7 +1158,7 @@ write_eas3_header(FILE *const fp, eas3_data *const data)
|
|||
! the timestep attribute array from the auxiliary informa- !
|
||||
! tion block and write it to the file stream. !
|
||||
\*--------------------------------------------------------*/
|
||||
buffer_char = get_chunck(aux, data->params.nts * ATTRLEN);
|
||||
buffer_char = eas3_get_chunck(aux, data->params.nts * ATTRLEN);
|
||||
if(!buffer_char)
|
||||
{
|
||||
// memory allocation error
|
||||
|
@ -1222,7 +1222,7 @@ write_eas3_header(FILE *const fp, eas3_data *const data)
|
|||
! the remaining eas header bytes from the auxiliary infor- !
|
||||
! mation block and write it to the file stream. !
|
||||
\*--------------------------------------------------------*/
|
||||
buffer_char = get_chunck(aux, Lwrite);
|
||||
buffer_char = eas3_get_chunck(aux, Lwrite);
|
||||
if(!buffer_char)
|
||||
{
|
||||
// memory allocation error
|
||||
|
|
Loading…
Reference in a new issue