NCEPLIBS-bufr  12.2.0
borts.c
Go to the documentation of this file.
1 
9 #include "bufrlib.h"
10 #include <setjmp.h>
11 
13 jmp_buf context;
14 
20 void
22 {
23  longjmp(context, 1);
24 }
25 
36 void
37 catch_bort_openbf(int lunit, char *cio, int lundx, int cio_str_len)
38 {
39  /* Set the target location to which to return if a bort error is caught. */
40  if ( setjmp(context) == 1 ) return;
41 
42  /* Add a trailing null to cio, for use with get_c_string_length inside of openbf_f. */
43  cio[cio_str_len] = '\0';
44 
45  /* Recursively call the subroutine. */
46  openbf_f(lunit, cio, lundx);
47 }
48 
56 void
58 {
59  /* Set the target location to which to return if a bort error is caught. */
60  if ( setjmp(context) == 1 ) return;
61 
62  /* Recursively call the subroutine. */
63  closbf_f(lunit);
64 }
65 
79 void
80 catch_bort_readmg(int lunxx, char *subset, int *jdate, int subset_str_len, int *iret)
81 {
82  /* Set the target location to which to return if a bort error is caught. */
83  if ( setjmp(context) == 1 ) return;
84 
85  /* Recursively call the subroutine. */
86  readmg_f(lunxx, subset, jdate, subset_str_len, iret);
87 }
88 
102 void
103 catch_bort_readns(int lunit, char *subset, int *jdate, int subset_str_len, int *iret)
104 {
105  /* Set the target location to which to return if a bort error is caught. */
106  if ( setjmp(context) == 1 ) return;
107 
108  /* Recursively call the subroutine. */
109  readns_f(lunit, subset, jdate, subset_str_len, iret);
110 }
111 
122 void
123 catch_bort_readsb(int lunit, int *iret)
124 {
125  /* Set the target location to which to return if a bort error is caught. */
126  if ( setjmp(context) == 1 ) return;
127 
128  /* Recursively call the subroutine. */
129  readsb_f(lunit, iret);
130 }
131 
145 void
146 catch_bort_ufbint(int lunin, double *usr, int i1, int i2, int *iret, char *cstr, int cstr_len)
147 {
148  /* Set the target location to which to return if a bort error is caught. */
149  if ( setjmp(context) == 1 ) return;
150 
151  /* Add a trailing null to cstr, for use with get_c_string_length inside of ufbint_f. */
152  cstr[cstr_len] = '\0';
153 
154  /* Recursively call the subroutine. */
155  ufbint_f(lunin, (void**) &usr, i1, i2, iret, cstr);
156 }
void catch_bort_ufbint(int lunin, double *usr, int i1, int i2, int *iret, char *cstr, int cstr_len)
Catch any bort error inside of subroutine ufbint().
Definition: borts.c:146
void catch_bort_openbf(int lunit, char *cio, int lundx, int cio_str_len)
Catch any bort error inside of subroutine openbf().
Definition: borts.c:37
void catch_bort_closbf(int lunit)
Catch any bort error inside of subroutine closbf().
Definition: borts.c:57
void catch_bort_readsb(int lunit, int *iret)
Catch any bort error inside of subroutine readsb().
Definition: borts.c:123
void catch_bort_readns(int lunit, char *subset, int *jdate, int subset_str_len, int *iret)
Catch any bort error inside of subroutine readns().
Definition: borts.c:103
void catch_bort_readmg(int lunxx, char *subset, int *jdate, int subset_str_len, int *iret)
Catch any bort error inside of subroutine readmg().
Definition: borts.c:80
void bort_goto_target(void)
Return to the previously-set target location after a bort error.
Definition: borts.c:21
jmp_buf context
Context information for returning to an application program.
Definition: borts.c:13
void closbf_f(int bufr_unit)
Close a previously opened file and disconnect it from the library.
void openbf_f(int bufr_unit, const char *cio, int table_file_id)
Connect a new file to the library, or initialize the library, or change verbosity associated with alr...
void readsb_f(int bufr_unit, int *ires)
Read the next data subset from a BUFR message.
void readmg_f(int bufr_unit, char *subset, int *iddate, int subset_len, int *ires)
Read the next message from a BUFR file.
void ufbint_f(int bufr_unit, void **c_data, int dim_1, int dim_2, int *iret, const char *table_b_mnemonic)
Read/write one or more data values from/to a data subset.
void readns_f(int bufr_unit, char *subset, int *iddate, int subset_len, int *ires)
Read the next data subset from a BUFR file.
Enable a number of NCEPLIBS-bufr subprograms to be called from within the C part of the library.
character *(:), dimension(:), allocatable cstr
Character data value, if corresponding ityp value is set to 3.