bufr2synop 0.24.0
Functions
bufrdeco_print.c File Reference

file with the code to print data or any output from library decobufr More...

#include "bufrdeco.h"
Include dependency graph for bufrdeco_print.c:

Go to the source code of this file.

Functions

int sprint_sec0_info (char *target, size_t lmax, struct bufrdeco *b)
 Prints info from sec0. More...
 
int print_sec0_info (struct bufrdeco *b)
 Prints info from sec0. More...
 
int sprint_sec1_info (char *target, size_t lmax, struct bufrdeco *b)
 Prints info from sec1. More...
 
int print_sec1_info (struct bufrdeco *b)
 Prints info from sec1. More...
 
int sprint_sec3_info (char *target, size_t lmax, struct bufrdeco *b)
 Prints info from sec3. More...
 
int print_sec3_info (struct bufrdeco *b)
 Prints info from sec3. More...
 
int sprint_sec4_info (char *target, size_t lmax, struct bufrdeco *b)
 Prints info from sec4. More...
 
int print_sec4_info (struct bufrdeco *b)
 Prints info from sec3. More...
 
int bufrdeco_fprint_tree_recursive (FILE *f, struct bufrdeco *b, struct bufr_sequence *seq)
 Print a tree of descriptors to a file in a recursive way. More...
 
int bufrdeco_fprint_tree (FILE *f, struct bufrdeco *b)
 Print a tree of descriptors. More...
 
int bufrdeco_print_tree (struct bufrdeco *b)
 Print a tree of descriptors. More...
 
int bufrdeco_print_atom_data_file (FILE *f, struct bufr_atom_data *a)
 print the data in a struct bufr_atom_data to a file already open by caller More...
 
int bufrdeco_print_atom_data_stdout (struct bufr_atom_data *a)
 print the data in a struct bufr_atom_data to stdout More...
 
char * bufrdeco_print_atom_data (char *target, size_t lmax, struct bufr_atom_data *a)
 print the data in a struct bufr_atom_data to a string More...
 
int bufrdeco_fprint_subset_sequence_data (FILE *f, struct bufrdeco_subset_sequence_data *s)
 
int bufrdeco_print_subset_sequence_data (struct bufrdeco_subset_sequence_data *s)
 Prints a struct bufrdeco_subset_sequence_data. More...
 
int fprint_bufrdeco_compressed_ref (FILE *f, struct bufrdeco_compressed_ref *r)
 prints a struct bufrdeco_compressed_ref More...
 
int print_bufrdeco_compressed_ref (struct bufrdeco_compressed_ref *r)
 prints a struct bufrdeco_compressed_ref More...
 
int print_bufrdeco_compressed_data_references (struct bufrdeco_compressed_data_references *r)
 prints a struct bufrdeco_compressed_references More...
 
int fprint_bufrdeco_compressed_data_references (FILE *f, struct bufrdeco_compressed_data_references *r)
 

Detailed Description

file with the code to print data or any output from library decobufr

Definition in file bufrdeco_print.c.

Function Documentation

◆ bufrdeco_fprint_subset_sequence_data()

int bufrdeco_fprint_subset_sequence_data ( FILE *  f,
struct bufrdeco_subset_sequence_data s 
)

Definition at line 520 of file bufrdeco_print.c.

521{
522 size_t i;
523 char aux[1024];
524
525 bufrdeco_assert ( f != NULL && s != NULL);
526
527 for ( i = 0; i < s->nd ; i++ )
528 {
529 if ( i && s->sequence[i].seq != s->sequence[i - 1].seq )
530 fprintf ( f, "\n" );
531
532 fprintf ( f, "%5lu: %s\n", i, bufrdeco_print_atom_data ( aux, sizeof ( aux ), &s->sequence[i] ) );
533 }
534 return 0;
535
536}
#define bufrdeco_assert(__my_expr__)
Check a expression and exit if it fails.
Definition: bufrdeco.h:374
char * bufrdeco_print_atom_data(char *target, size_t lmax, struct bufr_atom_data *a)
print the data in a struct bufr_atom_data to a string
struct bufr_sequence * seq
Definition: bufrdeco.h:445
struct bufr_atom_data * sequence
Definition: bufrdeco.h:462

References bufrdeco_assert, bufrdeco_print_atom_data(), bufrdeco_subset_sequence_data::nd, bufr_atom_data::seq, and bufrdeco_subset_sequence_data::sequence.

Referenced by bufrdeco_print_subset_sequence_data().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufrdeco_fprint_tree()

int bufrdeco_fprint_tree ( FILE *  f,
struct bufrdeco b 
)

Print a tree of descriptors.

Parameters
fPointer to file opened by caller
bpointer to a basic container struct bufrdeco
Returns
If succeeded return 0

Definition at line 360 of file bufrdeco_print.c.

361{
362 bufrdeco_assert ( f != NULL && b != NULL );
363
364 if ( b->mask & BUFRDECO_OUTPUT_HTML )
365 fprintf ( f, "<pre>\n" );
366 bufrdeco_fprint_tree_recursive ( f, b, NULL );
367 if ( b->mask & BUFRDECO_OUTPUT_HTML )
368 fprintf ( f, "</pre>\n" );
369 else
370 fprintf ( f, "\n" );
371 return 0;
372};
#define BUFRDECO_OUTPUT_HTML
Bit mask to the member mask for struct bufrdeco to format output as html for SECs 0 to 3.
Definition: bufrdeco.h:256
int bufrdeco_fprint_tree_recursive(FILE *f, struct bufrdeco *b, struct bufr_sequence *seq)
Print a tree of descriptors to a file in a recursive way.
uint32_t mask
Definition: bufrdeco.h:966

References bufrdeco_assert, bufrdeco_fprint_tree_recursive(), BUFRDECO_OUTPUT_HTML, and bufrdeco::mask.

Here is the call graph for this function:

◆ bufrdeco_fprint_tree_recursive()

int bufrdeco_fprint_tree_recursive ( FILE *  f,
struct bufrdeco b,
struct bufr_sequence seq 
)

Print a tree of descriptors to a file in a recursive way.

Parameters
fPointer to file opened by caller
bpointer to the basic container struct bufrdeco
seqpointer to the struct bufr_sequence to print
Returns
If succeded return 0, else return 1

Definition at line 259 of file bufrdeco_print.c.

260{
261 buf_t i, j, k;
262 struct bufr_sequence *l;
263 char explanation[256];
264
265 bufrdeco_assert ( f != NULL && b != NULL );
266
267 if ( seq == NULL )
268 {
269 l = & ( b->tree->seq[0] );
270 }
271 else
272 {
273 l = seq;
274 }
275
276 for ( i = 0; i < l->ndesc; i++ )
277 {
278 // we search for descriptors with f == 3
279
280 for ( j = 0; j < l->level; j++ )
281 {
282 fprintf ( f, " |" );
283 }
284 fprintf ( f, "%u %02u %03u", l->lseq[i].f, l->lseq[i].x,l->lseq[i].y );
285
286 if ( l->lseq[i].f != 3 )
287 {
288 if ( l->lseq[i].f == 0 )
289 {
290 if ( bufr_find_tableB_index ( &k, & ( b->tables->b ), l->lseq[i].c ) )
291 fprintf ( f, "\n" );
292 else
293 {
294 fprintf ( f, ":" );
295 if ( l->replicated[i] )
296 {
297 //fprintf ( f, " " );
298 for ( j = 0; j < l->replicated[i] ; j++ )
299 fprintf ( f, "*" );
300 }
301 if ( is_a_delayed_descriptor ( & l->lseq[i] ) ||
303 fprintf ( f, "* %s\n", b->tables->b.item[k].name );
304 else
305 fprintf ( f, " %s\n", b->tables->b.item[k].name );
306 }
307 }
308 else if ( l->lseq[i].f == 2 )
309 {
310 fprintf ( f, ": %s\n", bufrdeco_get_f2_descriptor_explanation ( explanation, sizeof ( explanation ), & ( l->lseq[i] ) ) );
311 }
312 else if ( l->lseq[i].f == 1 )
313 {
314 if ( l->lseq[i].y == 0 )
315 {
316 if ( l->lseq[i].x == 1 )
317 fprintf ( f, ":* Replicator for %d descriptor after next delayed descriptor which set the number of replications.\n", l->lseq[i].x );
318 else
319 fprintf ( f, ":* Replicator for %d descriptors after next delayed descriptor which set the number of replications.\n", l->lseq[i].x );
320 }
321 else
322 {
323 if ( l->lseq[i].x == 1 )
324 fprintf ( f, ":* Replicator for next descriptor %d times\n", l->lseq[i].y );
325 else
326 fprintf ( f, ":* Replicator for next %d descriptors %d times\n", l->lseq[i].x, l->lseq[i].y );
327 }
328 }
329 else
330 fprintf ( f, "\n" );
331 continue;
332 }
333
334 // we then recursively parse the son
335 if ( l->replicated[i] )
336 {
337 fprintf ( f, ":" );
338 for ( j = 0; j < l->replicated[i] ; j++ )
339 fprintf ( f, "*" );
340 }
341
342 fprintf ( f, "-> %s\n", l->sons[i]->name );
343 if ( bufrdeco_fprint_tree_recursive ( f, b, l->sons[i] ) )
344 {
345 return 1;
346 }
347
348 }
349
350 return 0;
351}
uint32_t buf_t
Type to set offsets and dimension of arrays or counters used in bufrdeco.
Definition: bufrdeco.h:346
int bufr_find_tableB_index(buf_t *index, struct bufr_tableB *tb, const char *key)
found a descriptor index in a struct bufr_tableB
int is_a_delayed_descriptor(struct bufr_descriptor *d)
check if a descriptor is a delayed descriptor
int is_a_short_delayed_descriptor(struct bufr_descriptor *d)
check if a descriptor is a short delayed descriptor
char * bufrdeco_get_f2_descriptor_explanation(char *e, size_t dim, struct bufr_descriptor *d)
Definition: bufrdeco_f2.c:773
char c[12]
Definition: bufrdeco.h:414
Stores an unexpanded sequence of descriptors.
Definition: bufrdeco.h:572
struct bufr_descriptor lseq[NMAXSEQ_DESCRIPTORS]
Definition: bufrdeco.h:583
buf_t ndesc
Definition: bufrdeco.h:575
uint8_t replicated[NMAXSEQ_DESCRIPTORS]
Definition: bufrdeco.h:582
buf_t level
Definition: bufrdeco.h:574
struct bufr_sequence * sons[NMAXSEQ_DESCRIPTORS]
Definition: bufrdeco.h:584
char name[BUFR_EXPLAINED_LENGTH]
Definition: bufrdeco.h:588
char name[BUFR_TABLEB_NAME_LENGTH]
Definition: bufrdeco.h:842
struct bufr_tableB_decoded_item item[BUFR_MAXLINES_TABLEB]
Definition: bufrdeco.h:867
struct bufr_tableB b
Definition: bufrdeco.h:939
struct bufr_sequence seq[BUFR_MAX_EXPANDED_SEQUENCES]
Definition: bufrdeco.h:598
struct bufr_tables * tables
Definition: bufrdeco.h:973
struct bufrdeco_expanded_tree * tree
Definition: bufrdeco.h:975

References bufr_tables::b, bufr_find_tableB_index(), bufrdeco_assert, bufrdeco_fprint_tree_recursive(), bufrdeco_get_f2_descriptor_explanation(), bufr_descriptor::c, bufr_descriptor::f, is_a_delayed_descriptor(), is_a_short_delayed_descriptor(), bufr_tableB::item, bufr_sequence::level, bufr_sequence::lseq, bufr_sequence::name, bufr_tableB_decoded_item::name, bufr_sequence::ndesc, bufr_sequence::replicated, bufrdeco_expanded_tree::seq, bufr_sequence::sons, bufrdeco::tables, bufrdeco::tree, bufr_descriptor::x, and bufr_descriptor::y.

Referenced by bufrdeco_fprint_tree(), bufrdeco_fprint_tree_recursive(), and bufrdeco_print_tree().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufrdeco_print_atom_data()

char * bufrdeco_print_atom_data ( char *  target,
size_t  lmax,
struct bufr_atom_data a 
)

print the data in a struct bufr_atom_data to a string

Parameters
targetstring where to print the result
lmaxsize of allocated string target
apointer to struct ref bufr_atom_data with data to print
Returns
a pointer to result string

Definition at line 433 of file bufrdeco_print.c.

434{
435 char aux[256];
436 size_t used = 0;
437 size_t nlimit, climit;
438
439 bufrdeco_assert ( a != NULL && target != NULL );
440
441 used += snprintf ( target + used, lmax - used, "%u %02u %03u ", a->desc.f, a->desc.x, a->desc.y );
442 strcpy_safe ( aux, a->name );
443 aux[64] = '\0';
444 used += snprintf ( target + used, lmax - used, "%-64s ", aux );
445 strcpy_safe ( aux, a->unit );
446 aux[20] = '\0';
447 used += snprintf ( target + used, lmax - used, "%-20s", aux );
449 {
450 used += snprintf ( target + used, lmax - used, "%17s", "MISSING" );
451 }
452 else
453 {
455 {
456 strcpy_safe ( aux, a->cval );
457 aux[64] = '\0';
458 used += snprintf ( target + used, lmax - used, " " );
459 used += snprintf ( target + used, lmax - used, "%s", aux );
460 }
462 || strstr ( a->unit, "CODE TABLE" ) == a->unit
463 || strstr ( a->unit, "Code table" ) == a->unit )
464 {
465 strcpy_safe ( aux, a->ctable );
466 aux[64] = '\0';
467 used += snprintf ( target + used, lmax - used, "%17u ", ( uint32_t ) a->val );
468 used += snprintf ( target + used, lmax - used, "%s", aux );
469 }
471 {
472 strcpy_safe ( aux, a->ctable );
473 aux[64] = '\0';
474 used += snprintf ( target + used, lmax - used, " 0x%08X ", ( uint32_t ) a->val );
475 used += snprintf ( target + used, lmax - used, "%s", aux );
476 }
477 else
478 {
479 used += snprintf ( target + used, lmax - used, "%s ", get_formatted_value_from_escale ( aux, sizeof ( aux ), a->escale, a->val ) );
480 }
481
482 }
483
484 // Now print remaining chars in a->name or a->ctable
485 nlimit = 64;
486 climit = 64;
487 while ( ( strlen ( a->name ) > nlimit && nlimit < BUFR_TABLEB_NAME_LENGTH ) ||
488 ( strlen ( a->ctable ) > climit && climit < BUFR_EXPLAINED_LENGTH ) )
489 {
490 aux[0] = 0;
491 if ( strlen ( a->name ) > nlimit && nlimit < BUFR_TABLEB_NAME_LENGTH )
492 strncpy ( aux, a->name + nlimit, 64 );
493 used += snprintf ( target + used, lmax - used, "\n %-64s", aux );
494 aux[0] = 0;
495 if ( strlen ( a->ctable ) > climit && climit < BUFR_EXPLAINED_LENGTH )
496 strncpy ( aux, a->ctable + climit, 64 );
497 used += snprintf ( target + used, lmax - used, " %s", aux );
498 nlimit += 64;
499 climit += 64;
500 }
501
502 if ( a->is_bitmaped_by != 0 )
503 used += snprintf ( target + used, lmax - used, " *IS BITMAPED BY #%u*", a->is_bitmaped_by );
504
505 if ( a->bitmap_to != 0 )
506 used += snprintf ( target + used, lmax - used, " *BITMAP TO #%u*", a->bitmap_to );
507
508 if ( a->related_to != 0 )
509 used += snprintf ( target + used, lmax - used, " *RELATED TO #%u*", a->related_to );
510
511 return target;
512}
#define BUFR_EXPLAINED_LENGTH
Maximum length for a explained descriptor string.
Definition: bufrdeco.h:122
#define strcpy_safe(_target_, _src_)
Macro to make safely a strcpy when we know in calling function the size of string target with sizeof(...
Definition: bufrdeco.h:358
#define DESCRIPTOR_HAVE_FLAG_TABLE_STRING
Bit mask for a flag table string in a struct bufr_atom_data.
Definition: bufrdeco.h:170
#define DESCRIPTOR_HAVE_STRING_VALUE
Bit mask for a string in a struct bufr_atom_data.
Definition: bufrdeco.h:152
char * get_formatted_value_from_escale(char *fmt, size_t dim, int32_t escale, double val)
gets a string with formatted value depending of scale
#define DESCRIPTOR_VALUE_MISSING
Bit mask for a missing value in a struct bufr_atom_data.
Definition: bufrdeco.h:140
#define BUFR_TABLEB_NAME_LENGTH
Max length (in chars) reserved for a name of variable in table B.
#define DESCRIPTOR_HAVE_CODE_TABLE_STRING
Bit mask for a code table string in a struct bufr_atom_data.
Definition: bufrdeco.h:164
int32_t escale
Definition: bufrdeco.h:441
uint32_t mask
Definition: bufrdeco.h:437
char name[BUFR_TABLEB_NAME_LENGTH]
Definition: bufrdeco.h:438
char ctable[BUFR_EXPLAINED_LENGTH]
Definition: bufrdeco.h:444
struct bufr_descriptor desc
Definition: bufrdeco.h:436
buf_t related_to
Definition: bufrdeco.h:449
double val
Definition: bufrdeco.h:440
buf_t is_bitmaped_by
Definition: bufrdeco.h:447
char unit[BUFR_TABLEB_UNIT_LENGTH]
Definition: bufrdeco.h:439
char cval[BUFR_CVAL_LENGTH]
Definition: bufrdeco.h:443
buf_t bitmap_to
Definition: bufrdeco.h:448

References bufr_atom_data::bitmap_to, BUFR_EXPLAINED_LENGTH, BUFR_TABLEB_NAME_LENGTH, bufrdeco_assert, bufr_atom_data::ctable, bufr_atom_data::cval, bufr_atom_data::desc, DESCRIPTOR_HAVE_CODE_TABLE_STRING, DESCRIPTOR_HAVE_FLAG_TABLE_STRING, DESCRIPTOR_HAVE_STRING_VALUE, DESCRIPTOR_VALUE_MISSING, bufr_atom_data::escale, bufr_descriptor::f, get_formatted_value_from_escale(), bufr_atom_data::is_bitmaped_by, bufr_atom_data::mask, bufr_atom_data::name, bufr_atom_data::related_to, strcpy_safe, bufr_atom_data::unit, bufr_atom_data::val, bufr_descriptor::x, and bufr_descriptor::y.

Referenced by bufrdeco_fprint_subset_sequence_data(), and bufrdeco_print_atom_data_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufrdeco_print_atom_data_file()

int bufrdeco_print_atom_data_file ( FILE *  f,
struct bufr_atom_data a 
)

print the data in a struct bufr_atom_data to a file already open by caller

Parameters
fPointer to file opened by caller
apointer to struct ref bufr_atom_data with data to print
Returns
If succeeded return 0

Definition at line 403 of file bufrdeco_print.c.

404{
405 char aux[1024];
406 bufrdeco_assert ( f != NULL && a != NULL );
407
408 bufrdeco_print_atom_data ( aux, sizeof ( aux ), a );
409 fprintf ( f, "%s\n",aux );
410 return 0;
411}

References bufrdeco_assert, and bufrdeco_print_atom_data().

Referenced by bufrdeco_print_atom_data_stdout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufrdeco_print_atom_data_stdout()

int bufrdeco_print_atom_data_stdout ( struct bufr_atom_data a)

print the data in a struct bufr_atom_data to stdout

Parameters
apointer to struct ref bufr_atom_data with data to print
Returns
If succeeded return 0

Definition at line 419 of file bufrdeco_print.c.

420{
421 return bufrdeco_print_atom_data_file ( stdout, a );
422}
int bufrdeco_print_atom_data_file(FILE *f, struct bufr_atom_data *a)
print the data in a struct bufr_atom_data to a file already open by caller

References bufrdeco_print_atom_data_file().

Here is the call graph for this function:

◆ bufrdeco_print_subset_sequence_data()

int bufrdeco_print_subset_sequence_data ( struct bufrdeco_subset_sequence_data s)

Prints a struct bufrdeco_subset_sequence_data.

Parameters
spointer to the struct to print
Returns
If succeeded return 0

Definition at line 545 of file bufrdeco_print.c.

546{
547 bufrdeco_assert ( s != NULL );
548 return bufrdeco_fprint_subset_sequence_data ( stdout, s );
549}
int bufrdeco_fprint_subset_sequence_data(FILE *f, struct bufrdeco_subset_sequence_data *s)

References bufrdeco_assert, and bufrdeco_fprint_subset_sequence_data().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufrdeco_print_tree()

int bufrdeco_print_tree ( struct bufrdeco b)

Print a tree of descriptors.

Parameters
bpointer to a basic container struct bufrdeco
Returns
The amount of bytes sent to out
Parameters
bpointer to a basic container struct bufrdeco
Returns
If succeeded return 0

Definition at line 381 of file bufrdeco_print.c.

382{
383 bufrdeco_assert ( b != NULL );
384
385 if ( b->mask & BUFRDECO_OUTPUT_HTML )
386 printf ( "<pre>\n" );
387 bufrdeco_fprint_tree_recursive ( stdout, b, NULL );
388 if ( b->mask & BUFRDECO_OUTPUT_HTML )
389 printf ( "</pre>\n" );
390 else
391 printf ( "\n" );
392 return 0;
393};

References bufrdeco_assert, bufrdeco_fprint_tree_recursive(), BUFRDECO_OUTPUT_HTML, and bufrdeco::mask.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fprint_bufrdeco_compressed_data_references()

int fprint_bufrdeco_compressed_data_references ( FILE *  f,
struct bufrdeco_compressed_data_references r 
)

Definition at line 619 of file bufrdeco_print.c.

620{
621 size_t i;
622
623 bufrdeco_assert ( f != NULL && r != NULL);
624
625 for ( i = 0; i < r->nd; i++ )
627
628 return 0;
629}
int fprint_bufrdeco_compressed_ref(FILE *f, struct bufrdeco_compressed_ref *r)
prints a struct bufrdeco_compressed_ref
struct bufrdeco_compressed_ref * refs
Definition: bufrdeco.h:671

References bufrdeco_assert, fprint_bufrdeco_compressed_ref(), bufrdeco_compressed_data_references::nd, and bufrdeco_compressed_data_references::refs.

Here is the call graph for this function:

◆ fprint_bufrdeco_compressed_ref()

int fprint_bufrdeco_compressed_ref ( FILE *  f,
struct bufrdeco_compressed_ref r 
)

prints a struct bufrdeco_compressed_ref

Parameters
fpointer to a file opened by caller
rpointer to the struct to print
Returns
If succeeded return 0

Definition at line 558 of file bufrdeco_print.c.

559{
560 bufrdeco_assert ( f != NULL && r != NULL );
561
563 return 0;
564
565 fprintf ( f, "%s -> A=%u, D=%u, ",r->desc->c,r->is_associated,r->has_data );
566 if ( r->cref0[0] == '\0' )
567 {
568 fprintf ( f, "bits=%2u, ref=%10d, escale=%3d,", r->bits, r->ref, r->escale );
569 fprintf ( f, " bit0=%10u, ref0=%10u, inc_bits=%2u ", r->bit0, r->ref0, r->inc_bits );
570 fprintf ( f, "%s %s\n",r->name, r->unit );
571 }
572 else
573 {
574 fprintf ( f, "'%s', chars=%3u\n", r->cref0, r->inc_bits );
575 }
576 return 0;
577}
#define BUFRDECO_COMPRESSED_REF_DATA_DESCRIPTOR_BITMASK
Bitmask for struct bufrdeco_compressed_ref which marks a data descriptor.
Definition: bufrdeco.h:611
char unit[BUFR_TABLEB_UNIT_LENGTH]
Definition: bufrdeco.h:651
char name[BUFR_TABLEB_NAME_LENGTH]
Definition: bufrdeco.h:650
struct bufr_descriptor * desc
Definition: bufrdeco.h:652

References bufrdeco_compressed_ref::bit0, bufrdeco_compressed_ref::bits, bufrdeco_assert, BUFRDECO_COMPRESSED_REF_DATA_DESCRIPTOR_BITMASK, bufr_descriptor::c, bufrdeco_compressed_ref::cref0, bufrdeco_compressed_ref::desc, bufrdeco_compressed_ref::escale, bufrdeco_compressed_ref::has_data, bufrdeco_compressed_ref::inc_bits, bufrdeco_compressed_ref::is_associated, bufrdeco_compressed_ref::mask, bufrdeco_compressed_ref::name, bufrdeco_compressed_ref::ref, bufrdeco_compressed_ref::ref0, and bufrdeco_compressed_ref::unit.

Referenced by fprint_bufrdeco_compressed_data_references(), and print_bufrdeco_compressed_ref().

Here is the caller graph for this function:

◆ print_bufrdeco_compressed_data_references()

int print_bufrdeco_compressed_data_references ( struct bufrdeco_compressed_data_references r)

prints a struct bufrdeco_compressed_references

Parameters
rpointer to the struct to print
Returns
If succeeded return 0, 1 otherwise

It is used mainly in debug stage

Definition at line 600 of file bufrdeco_print.c.

601{
602 size_t i;
603 bufrdeco_assert ( r != NULL );
604
605 for ( i = 0; i < r->nd; i++ )
607
608 return 0;
609}
int print_bufrdeco_compressed_ref(struct bufrdeco_compressed_ref *r)
prints a struct bufrdeco_compressed_ref

References bufrdeco_assert, bufrdeco_compressed_data_references::nd, print_bufrdeco_compressed_ref(), and bufrdeco_compressed_data_references::refs.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_bufrdeco_compressed_ref()

int print_bufrdeco_compressed_ref ( struct bufrdeco_compressed_ref r)

prints a struct bufrdeco_compressed_ref

Parameters
rpointer to the struct to print
Returns
If succeeded return 0

Definition at line 585 of file bufrdeco_print.c.

586{
587 bufrdeco_assert ( r != NULL );
588
589 return fprint_bufrdeco_compressed_ref ( stdout, r );
590}

References bufrdeco_assert, and fprint_bufrdeco_compressed_ref().

Referenced by print_bufrdeco_compressed_data_references().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_sec0_info()

int print_sec0_info ( struct bufrdeco b)

Prints info from sec0.

Parameters
bpointer to the source struct bufrdeco
Returns
If succeeded return 0

Definition at line 62 of file bufrdeco_print.c.

63{
64 char caux[512];
65
66 bufrdeco_assert ( b != NULL );
67
68 caux[0] = 0;
69 sprint_sec0_info ( caux, 512, b );
70 printf ( "%s", caux );
71 return 0;
72}
int sprint_sec0_info(char *target, size_t lmax, struct bufrdeco *b)
Prints info from sec0.

References bufrdeco_assert, and sprint_sec0_info().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_sec1_info()

int print_sec1_info ( struct bufrdeco b)

Prints info from sec1.

Parameters
bpointer to the source struct bufrdeco
Returns
If succeeded return 0, 1 otherwise

Definition at line 135 of file bufrdeco_print.c.

136{
137 char caux[2048];
138
139 bufrdeco_assert ( b != NULL );
140
141 caux[0] = 0;
142 sprint_sec1_info ( caux, 2048, b );
143 printf ( "%s", caux );
144 return 0;
145}
int sprint_sec1_info(char *target, size_t lmax, struct bufrdeco *b)
Prints info from sec1.

References bufrdeco_assert, and sprint_sec1_info().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_sec3_info()

int print_sec3_info ( struct bufrdeco b)

Prints info from sec3.

Parameters
bpointer to the source struct bufrdeco
Returns
If succeeded return 0

Definition at line 192 of file bufrdeco_print.c.

193{
194 char caux[8192];
195
196 bufrdeco_assert ( b != NULL );
197
198 caux[0] = 0;
199 sprint_sec3_info ( caux, 8192, b );
200 printf ( "%s", caux );
201 return 0;
202}
int sprint_sec3_info(char *target, size_t lmax, struct bufrdeco *b)
Prints info from sec3.

References bufrdeco_assert, and sprint_sec3_info().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_sec4_info()

int print_sec4_info ( struct bufrdeco b)

Prints info from sec3.

Parameters
bpointer to the source struct bufrdeco
Returns
If succeeded return 0

Definition at line 239 of file bufrdeco_print.c.

240{
241 char caux[8192];
242
243 bufrdeco_assert ( b != NULL );
244
245 caux[0] = 0;
246 sprint_sec4_info ( caux, 8192, b );
247 printf ( "%s", caux );
248 return 0;
249}
int sprint_sec4_info(char *target, size_t lmax, struct bufrdeco *b)
Prints info from sec4.

References bufrdeco_assert, and sprint_sec4_info().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sprint_sec0_info()

int sprint_sec0_info ( char *  target,
size_t  lmax,
struct bufrdeco b 
)

Prints info from sec0.

Parameters
targetstring target
lmaxavailable size in target
bpointer to the source struct bufrdeco
Returns
If succeeded return 0, otherwise 1

Definition at line 35 of file bufrdeco_print.c.

36{
37 size_t used = 0;
38
39 bufrdeco_assert ( b != NULL );
40
41 if ( lmax == 0 || target == NULL )
42 {
43 snprintf ( b->error, sizeof ( b->error ), "%s(): Unspected NULL argument(s)\n", __func__ );
44 return 1;
45 }
46
47 if ( b->mask & BUFRDECO_OUTPUT_HTML )
48 return sprint_sec0_info_html ( target, lmax, b );
49
50 used += snprintf ( target + used, lmax - used, "#### SEC 0 INFO ###\n" );
51 used += snprintf ( target + used, lmax - used, "Bufr length: %5u\n", b->sec0.bufr_length );
52 used += snprintf ( target + used, lmax - used, "Bufr edition: %5u\n", b->sec0.edition );
53 return 0;
54}
int sprint_sec0_info_html(char *target, size_t lmax, struct bufrdeco *b)
Prints info from sec0 in html format.
uint8_t edition
Definition: bufrdeco.h:698
uint32_t bufr_length
Definition: bufrdeco.h:697
struct bufr_sec0 sec0
Definition: bufrdeco.h:968
char error[1024]
Definition: bufrdeco.h:983

References bufr_sec0::bufr_length, bufrdeco_assert, BUFRDECO_OUTPUT_HTML, bufr_sec0::edition, bufrdeco::error, bufrdeco::mask, bufrdeco::sec0, and sprint_sec0_info_html().

Referenced by print_sec0_info().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sprint_sec1_info()

int sprint_sec1_info ( char *  target,
size_t  lmax,
struct bufrdeco b 
)

Prints info from sec1.

Parameters
targetstring target
lmaxavailable size in target
bpointer to the source struct bufrdeco
Returns
If succeeded return 0, 1 otherwise

Definition at line 83 of file bufrdeco_print.c.

84{
85 size_t used = 0;
86
87 bufrdeco_assert ( b != NULL );
88
89 if ( lmax == 0 || target == NULL )
90 {
91 snprintf ( b->error, sizeof ( b->error ), "%s(): Unspected NULL argument(s)\n", __func__ );
92 return 1;
93 }
94
95 if ( b->mask & BUFRDECO_OUTPUT_HTML )
96 return sprint_sec1_info_html ( target, lmax, b );
97
98 used += snprintf ( target + used, lmax - used, "\n#### SEC 1 INFO ###\n" );
99 used += snprintf ( target + used, lmax - used, "Sec1 length: %5u\n", b->sec1.length );
100 used += snprintf ( target + used, lmax - used, "Bufr master table: %5u\n", b->sec1.master );
101 used += snprintf ( target + used, lmax - used, "Centre: %5u\n", b->sec1.centre );
102 used += snprintf ( target + used, lmax - used, "Sub-Centre: %5u\n", b->sec1.subcentre );
103 used += snprintf ( target + used, lmax - used, "Update sequence: %5u\n", b->sec1.update );
104 used += snprintf ( target + used, lmax - used, "Options: %5x\n", b->sec1.options );
105 used += snprintf ( target + used, lmax - used, "Category: %5u\n", b->sec1.category );
106 used += snprintf ( target + used, lmax - used, "Subcategory: %5u\n", b->sec1.subcategory );
107 used += snprintf ( target + used, lmax - used, "Sub-category local: %5u\n", b->sec1.subcategory_local );
108 used += snprintf ( target + used, lmax - used, "Master table version: %5u\n", b->sec1.master_version );
109 used += snprintf ( target + used, lmax - used, "Master table local: %5u\n", b->sec1.master_local );
110 used += snprintf ( target + used, lmax - used, "Year: %5u\n", b->sec1.year );
111 used += snprintf ( target + used, lmax - used, "Month: %5u\n", b->sec1.month );
112 used += snprintf ( target + used, lmax - used, "Day: %5u\n", b->sec1.day );
113 used += snprintf ( target + used, lmax - used, "Hour: %5u\n", b->sec1.hour );
114 used += snprintf ( target + used, lmax - used, "Minute: %5u\n", b->sec1.minute );
115 used += snprintf ( target + used, lmax - used, "Second: %5u\n", b->sec1.second );
116 if ( b->sec0.edition == 3 )
117 used += snprintf ( target + used, lmax - used, "Aditional space: %5u\n", b->sec1.length - 17 );
118 else
119 used += snprintf ( target + used, lmax - used, "Aditional space: %5u\n", b->sec1.length - 22 );
120 if ( b->tables->b.path[0] )
121 {
122 used += snprintf ( target + used, lmax - used, "Tables used: '%s'\n", b->tables->b.path );
123 used += snprintf ( target + used, lmax - used, " '%s'\n", b->tables->c.path );
124 used += snprintf ( target + used, lmax - used, " '%s'\n", b->tables->d.path );
125 }
126 return 0;
127}
int sprint_sec1_info_html(char *target, size_t lmax, struct bufrdeco *b)
Prints info from sec1.
uint8_t month
Definition: bufrdeco.h:785
uint32_t year
Definition: bufrdeco.h:784
uint8_t master_local
Definition: bufrdeco.h:783
uint32_t subcentre
Definition: bufrdeco.h:776
uint32_t centre
Definition: bufrdeco.h:775
uint8_t category
Definition: bufrdeco.h:779
uint8_t options
Definition: bufrdeco.h:778
uint8_t minute
Definition: bufrdeco.h:788
uint8_t subcategory
Definition: bufrdeco.h:780
uint8_t master_version
Definition: bufrdeco.h:782
uint8_t second
Definition: bufrdeco.h:789
uint8_t day
Definition: bufrdeco.h:786
uint32_t length
Definition: bufrdeco.h:773
uint8_t subcategory_local
Definition: bufrdeco.h:781
uint8_t hour
Definition: bufrdeco.h:787
uint8_t update
Definition: bufrdeco.h:777
uint8_t master
Definition: bufrdeco.h:774
char path[BUFRDECO_PATH_LENGTH]
Definition: bufrdeco.h:861
char path[BUFRDECO_PATH_LENGTH]
Definition: bufrdeco.h:893
char path[BUFRDECO_PATH_LENGTH]
Definition: bufrdeco.h:922
struct bufr_tableD d
Definition: bufrdeco.h:941
struct bufr_tableC c
Definition: bufrdeco.h:940
struct bufr_sec1 sec1
Definition: bufrdeco.h:969

References bufr_tables::b, bufrdeco_assert, BUFRDECO_OUTPUT_HTML, bufr_tables::c, bufr_sec1::category, bufr_sec1::centre, bufr_tables::d, bufr_sec1::day, bufr_sec0::edition, bufrdeco::error, bufr_sec1::hour, bufr_sec1::length, bufrdeco::mask, bufr_sec1::master, bufr_sec1::master_local, bufr_sec1::master_version, bufr_sec1::minute, bufr_sec1::month, bufr_sec1::options, bufr_tableB::path, bufr_tableC::path, bufr_tableD::path, bufrdeco::sec0, bufrdeco::sec1, bufr_sec1::second, sprint_sec1_info_html(), bufr_sec1::subcategory, bufr_sec1::subcategory_local, bufr_sec1::subcentre, bufrdeco::tables, bufr_sec1::update, and bufr_sec1::year.

Referenced by print_sec1_info().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sprint_sec3_info()

int sprint_sec3_info ( char *  target,
size_t  lmax,
struct bufrdeco b 
)

Prints info from sec3.

Parameters
targetstring target
lmaxavailable size in target
bpointer to the source struct bufrdeco
Returns
If succeeded return 0, 1 otherwise

Definition at line 155 of file bufrdeco_print.c.

156{
157 size_t i;
158 size_t used = 0;
159
160 bufrdeco_assert ( b != NULL );
161
162 if ( lmax == 0 || target == NULL)
163 {
164 snprintf ( b->error, sizeof ( b->error ), "%s(): Unspected NULL argument(s)\n", __func__ );
165 return 1;
166 }
167
168 if ( b->mask & BUFRDECO_OUTPUT_HTML )
169 return sprint_sec3_info_html ( target, lmax, b );
170
171 used += snprintf ( target + used, lmax - used, "\n#### SEC 3 INFO ###\n" );
172 used += snprintf ( target + used, lmax - used, "Sec3 length: %5u\n", b->sec3.length );
173 used += snprintf ( target + used, lmax - used, "Subsets: %5u\n", b->sec3.subsets );
174 used += snprintf ( target + used, lmax - used, "Observed: %5u\n", b->sec3.observed );
175 used += snprintf ( target + used, lmax - used, "Compressed: %5u\n", b->sec3.compressed );
176 used += snprintf ( target + used, lmax - used, "Unexpanded descriptors %5u\n", b->sec3.ndesc );
177
178 for ( i = 0; i < b->sec3.ndesc; i++ )
179 {
180 used += snprintf ( target + used, lmax - used, " %3lu: %u %02u %03u\n", i, b->sec3.unexpanded[i].f,
181 b->sec3.unexpanded[i].x, b->sec3.unexpanded[i].y );
182 }
183 return 0;
184}
int sprint_sec3_info_html(char *target, size_t lmax, struct bufrdeco *b)
Prints info from sec3 formatted as html.
uint8_t observed
Definition: bufrdeco.h:811
uint8_t compressed
Definition: bufrdeco.h:812
struct bufr_descriptor unexpanded[BUFR_LEN_UNEXPANDED_DESCRIPTOR]
Definition: bufrdeco.h:814
uint32_t ndesc
Definition: bufrdeco.h:813
uint32_t length
Definition: bufrdeco.h:809
uint32_t subsets
Definition: bufrdeco.h:810
struct bufr_sec3 sec3
Definition: bufrdeco.h:971

References bufrdeco_assert, BUFRDECO_OUTPUT_HTML, bufr_sec3::compressed, bufrdeco::error, bufr_descriptor::f, bufr_sec3::length, bufrdeco::mask, bufr_sec3::ndesc, bufr_sec3::observed, bufrdeco::sec3, sprint_sec3_info_html(), bufr_sec3::subsets, bufr_sec3::unexpanded, bufr_descriptor::x, and bufr_descriptor::y.

Referenced by print_sec3_info().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sprint_sec4_info()

int sprint_sec4_info ( char *  target,
size_t  lmax,
struct bufrdeco b 
)

Prints info from sec4.

Parameters
targetstring target
lmaxavailable size in target
bpointer to the source struct bufrdeco
Returns
If succeeded return 0, 1 otherwise

Definition at line 213 of file bufrdeco_print.c.

214{
215 size_t used = 0;
216
217 bufrdeco_assert ( b != NULL );
218
219 if ( lmax == 0 || target == NULL )
220 {
221 snprintf ( b->error, sizeof ( b->error ), "%s(): Unspected NULL argument(s)\n", __func__ );
222 return 1;
223 }
224
225 if ( b->mask & BUFRDECO_OUTPUT_HTML )
226 return sprint_sec4_info_html ( target, lmax, b );
227
228 used += snprintf ( target + used, lmax - used, "\n#### SEC 4 INFO ###\n" );
229 used += snprintf ( target + used, lmax - used, "Sec4 length: %5u\n\n", b->sec4.length );
230 return 0;
231}
int sprint_sec4_info_html(char *target, size_t lmax, struct bufrdeco *b)
Prints info from sec4.
uint32_t length
Definition: bufrdeco.h:826
struct bufr_sec4 sec4
Definition: bufrdeco.h:972

References bufrdeco_assert, BUFRDECO_OUTPUT_HTML, bufrdeco::error, bufr_sec4::length, bufrdeco::mask, bufrdeco::sec4, and sprint_sec4_info_html().

Referenced by print_sec4_info().

Here is the call graph for this function:
Here is the caller graph for this function: