NCEPLIBS-bufr  11.7.0
 All Data Structures Files Functions Variables Pages
bufrlib.h
Go to the documentation of this file.
1 
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <string.h>
19 #include <ctype.h>
20 
21 #define NFILES 32
22 #define MAXCD 250
23 #define MAXNC 600
24 #define MXNAF 4
25 
26 /*
27 ** On certain operating systems, the FORTRAN compiler appends an underscore
28 ** to subprogram names in its object namespace. Therefore, on such systems,
29 ** a matching underscore must be appended to any C language references to
30 ** the same subprogram names so that the linker can correctly resolve such
31 ** references across the C <-> FORTRAN interface at link time. This needs
32 ** to be done for any subprogram that is either:
33 ** 1) a C function, or
34 ** 2) a FORTRAN subprogram called from C
35 */
36 #ifdef UNDERSCORE
37 #define arallocc arallocc_
38 #define ardllocc ardllocc_
39 #define bort bort_
40 #define bort_exit bort_exit_
41 #define bvers bvers_
42 #define cadn30 cadn30_
43 #define closbf closbf_
44 #define cmpia cmpia_
45 #define cmpmsg cmpmsg_
46 #define elemdx elemdx_
47 #define gets1loc gets1loc_
48 #define ibfms ibfms_
49 #define ichkstr ichkstr_
50 #define icvidx icvidx_
51 #define ifxy ifxy_
52 #define igetntbi igetntbi_
53 #define igetprm igetprm_
54 #define igettdi igettdi_
55 #define imrkopr imrkopr_
56 #define ipkm ipkm_
57 #define ireadns ireadns_
58 #define istdesc istdesc_
59 #define iupb iupb_
60 #define iupbs01 iupbs01_
61 #define iupm iupm_
62 #define maxout maxout_
63 #define nemtab nemtab_
64 #define nemtbb nemtbb_
65 #define nummtb nummtb_
66 #define numtbd numtbd_
67 #define openmb openmb_
68 #define pktdd pktdd_
69 #define restd restd_
70 #define stntbi stntbi_
71 #define strnum strnum_
72 #define stseq stseq_
73 #define ufbint ufbint_
74 #define ufbseq ufbseq_
75 #define uptdd uptdd_
76 #define wrdesc wrdesc_
77 #define wrdlen wrdlen_
78 #endif
79 
80 /*
81 ** In order to ensure that the C <-> FORTRAN interface works properly (and
82 ** portably!), the default size of an "INTEGER" declared in FORTRAN must be
83 ** identical to that of an "int" declared in C. If this is not the case (e.g.
84 ** some FORTRAN compilers, most notably AIX via the -qintsize= option, allow the
85 ** sizes of INTEGERs to be definitively prescribed outside of the source code
86 ** itself!), then the following conditional directive (or a variant of it) can
87 ** be used to ensure that the size of an "int" in C remains identical to that
88 ** of an "INTEGER" in FORTRAN.
89 */
90 #ifdef F77_INTSIZE_8
91  typedef long f77int;
92 #else
93  typedef int f77int;
94 #endif
95 typedef double f77r8; /* define the C object type that is equivalent to a REAL*8 in Fortran */
96 
97 /*
98 ** Declare prototypes for ANSI C compatibility. This should be done for any
99 ** subprogram that is either:
100 ** 1) a C function, or
101 ** 2) a FORTRAN subprogram called from C
102 */
103 void arallocc( void );
104 void ardllocc( void );
105 void bort( char *, size_t );
106 void bort_exit( void );
107 void bvers( char *, size_t );
108 void cadn30( f77int *, char *, size_t );
109 void closbf( f77int * );
110 int cmpia( const void *, const void * );
111 void cmpmsg( char *, size_t );
112 void elemdx( char *, f77int *, size_t );
113 void gets1loc( char *, f77int *, f77int *, f77int *, f77int *, size_t );
114 f77int ibfms( f77r8 * );
115 f77int ichkstr ( char *, char *, f77int *, size_t, size_t );
116 f77int icvidx ( f77int *, f77int *, f77int * );
117 f77int ifxy( char *, size_t );
118 f77int igetntbi( f77int *, char *, size_t );
119 f77int igetprm( char *, size_t );
120 f77int igettdi( f77int * );
121 f77int imrkopr( char *, size_t );
122 void ipkm( char *, f77int *, f77int *, size_t );
123 f77int ireadns( f77int *, char *, f77int *, size_t );
124 f77int istdesc( f77int * );
125 f77int iupb( f77int *, f77int *, f77int * );
126 f77int iupbs01 ( f77int *, char *, size_t );
127 f77int iupm ( char *, f77int *, size_t );
128 void maxout( f77int * );
129 void nemtab( f77int *, char *, f77int *, char *, f77int *, size_t, size_t );
130 void nemtbb( f77int *, f77int *, char *, f77int *, f77int *, f77int *, size_t );
131 void nummtb( f77int *, char *, f77int * );
132 void numtbd( f77int *, f77int *, char *, char *, f77int *, size_t, size_t );
133 void openmb( f77int *, char *, f77int *, size_t );
134 void pktdd( f77int *, f77int *, f77int *, f77int * );
135 void restd( f77int *, f77int *, f77int *, f77int * );
136 void stntbi( f77int *, f77int *, char *, char *, char *, size_t, size_t, size_t );
137 void strnum( char *, f77int *, size_t );
138 void stseq( f77int *, f77int *, f77int *, char *, char *, f77int *, f77int * );
139 void ufbint( f77int *, f77r8 *, f77int *, f77int *, f77int *, char *, size_t );
140 void ufbseq( f77int *, f77r8 *, f77int *, f77int *, f77int *, char *, size_t );
141 void uptdd( f77int *, f77int *, f77int *, f77int * );
142 void wrdesc( f77int, f77int *, f77int * );
143 void wrdlen( void );
void stseq(f77int *lun, f77int *irepct, f77int *idn, char nemo[8], char cseq[55], f77int cdesc[], f77int *ncdesc)
Given the bit-wise (integer) representation of a WMO-standard Table D descriptor, this subroutine use...
Definition: stseq.c:48
void arallocc(void)
This subroutine is called internally during the first call to subroutine openbf() from an application...
Definition: arallocc.c:36
function iupb(MBAY, NBYT, NBIT)
THIS FUNCTION UNPACKS AND RETURNS A BINARY INTEGER WORD CONTAINED WITHIN NBIT BITS OF A BUFR MESSAGE ...
Definition: iupb.f:36
function ireadns(LUNIT, SUBSET, IDATE)
This function calls BUFRLIB subroutine readns() and passes back its return code as the function value...
Definition: ireadns.f:38
void restd(f77int *lun, f77int *tddesc, f77int *nctddesc, f77int ctddesc[])
Given the bit-wise (integer) representation of a local (not WMO-standard) Table D descriptor...
Definition: restd.c:43
function istdesc(IDN)
Given the bit-wise (integer) representation of a descriptor, this function determines whether the des...
Definition: istdesc.f:25
subroutine openmb(LUNIT, SUBSET, JDATE)
This subroutine opens and initializes a new BUFR message within internal arrays, for eventual output ...
Definition: openmb.f:52
void nummtb(f77int *idn, char *tab, f77int *ipt)
C C SUBPROGRAM: NUMMTB C PRGMMR: ATOR ORG: NP12 DATE: 2009-03-23 C C ABSTRACT: THIS ROUTINE SEARCHES ...
Definition: nummtb.c:43
function iupm(CBAY, NBITS)
THIS FUNCTION UNPACKS AND RETURNS A BINARY INTEGER WORD CONTAINED WITHIN NBITS BITS OF A CHARACTER ST...
Definition: iupm.f:40
subroutine strnum(STR, NUM)
This subroutine decodes an integer from a character string.
Definition: strnum.f:23
function ichkstr(STR, CHR, N)
THIS FUNCTION COMPARES A SPECIFIED NUMBER OF CHARACTERS FROM AN INPUT CHARACTER ARRAY AGAINST THE SAM...
Definition: ichkstr.f:32
void ardllocc(void)
This subroutine frees any memory that was dynamically allocated during a previous call to subroutine ...
Definition: ardllocc.c:23
subroutine bvers(CVERSTR)
This subroutine returns a character string containing the version number of the BUFRLIB software...
Definition: bvers.f:33
INTEGER function igetprm(CPRMNM)
This function returns the current value of a parameter used for allocating one or more internal array...
Definition: igetprm.f:83
subroutine closbf(LUNIT)
This subroutine closes the connection between logical unit LUNIT and the BUFRLIB software.
Definition: closbf.f:34
subroutine gets1loc(S1MNEM, IBEN, ISBYT, IWID, IRET)
THIS SUBROUTINE RETURNS THE LOCATION (I.E.
Definition: gets1loc.f:80
function igettdi(IFLAG)
DEPENDING ON THE VALUE OF THE INPUT FLAG, THIS FUNCTION EITHER RETURNS THE NEXT USABLE SCRATCH TABLE ...
Definition: igettdi.f:30
subroutine cmpmsg(CF)
This subroutine is used to specify whether BUFR messages output by future calls to message-writing su...
Definition: cmpmsg.f:41
subroutine nemtbb(LUN, ITAB, UNIT, ISCL, IREF, IBIT)
This subroutine returns information about a Table B descriptor from the internal DX BUFR tables...
Definition: nemtbb.f:31
INTEGER function ibfms(R8VAL)
This function provides a handy way to check whether a real*8 data value returned from a previous call...
Definition: ibfms.f:38
subroutine numtbd(LUN, IDN, NEMO, TAB, IRET)
This subroutine searches for a descriptor within Table B and Table D of the internal DX BUFR tables...
Definition: numtbd.f:35
function ifxy(ADSC)
This function converts an FXY value from its 6 character representation to its bit-wise (integer) rep...
Definition: ifxy.f:42
subroutine wrdlen
This subroutine figures out some important information about the local machine on which the BUFRLIB s...
Definition: wrdlen.F:35
subroutine ipkm(CBAY, NBYT, N)
This subroutine encodes an integer value within a specified number of bytes of a character string...
Definition: ipkm.f:27
subroutine cadn30(IDN, ADN)
This subroutine converts an FXY value from its bit-wise (integer) representation to its 6 character r...
Definition: cadn30.f:23
function igetntbi(LUN, CTB)
This function returns the next available index for storing an entry within a specified internal DX BU...
Definition: igetntbi.f:27
subroutine pktdd(ID, LUN, IDN, IRET)
THIS SUBROUTINE STORES INFORMATION ABOUT A &quot;CHILD&quot; MNEMONIC WITHIN THE INTERNAL BUFR TABLE D ENTRY (I...
Definition: pktdd.f:54
void wrdesc(f77int desc, f77int descary[], f77int *ndescary)
C C SUBPROGRAM: WRDESC C PRGMMR: ATOR ORG: NP12 DATE: 2004-08-18 C C ABSTRACT: GIVEN THE BIT-WISE REP...
Definition: wrdesc.c:46
subroutine stntbi(N, LUN, NUMB, NEMO, CELSQ)
THIS SUBROUTINE STORES A NEW ENTRY WITHIN INTERNAL BUFR TABLE B OR D, DEPENDING ON THE VALUE OF NUMB...
Definition: stntbi.f:27
subroutine ufbint(LUNIN, USR, I1, I2, IRET, STR)
This subroutine reads or writes one or more data values from or to the BUFR data subset that is curre...
Definition: ufbint.f:152
void bort_exit(void)
This subroutine terminates the application program with a non-zero status code.
Definition: bort_exit.c:23
subroutine nemtab(LUN, NEMO, IDN, TAB, IRET)
This subroutine returns information about a descriptor from the internal DX BUFR tables, based on the mnemonic associated with that descriptor.
Definition: nemtab.f:44
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:22
subroutine elemdx(CARD, LUN)
THIS SUBROUTINE DECODES THE SCALE FACTOR, REFERENCE VALUE, BIT WIDTH AND UNITS (I.E., THE &quot;ELEMENTS&quot;) FROM A TABLE B MNEMONIC DEFINITION CARD THAT WAS PREVIOUSLY READ FROM A USER-SUPPLIED BUFR DICTIONARY TABLE FILE IN CHARACTER FORMAT BY BUFR ARCHIVE LIBRARY SUBROUTINE RDUSDX.
Definition: elemdx.f:47
subroutine ufbseq(LUNIN, USR, I1, I2, IRET, STR)
This subroutine reads or writes an entire sequence of data values from or to the BUFR data subset tha...
Definition: ufbseq.f:142
subroutine uptdd(ID, LUN, IENT, IRET)
THIS SUBROUTINE RETURNS THE BIT-WISE REPRESENTATION OF THE FXY VALUE CORRESPONDING TO...
Definition: uptdd.f:60
int cmpia(const void *pf1, const void *pf2)
C C SUBPROGRAM: CMPIA C PRGMMR: ATOR ORG: NP12 DATE: 2009-03-23 C C ABSTRACT: THIS ROUTINE DEFINES A ...
Definition: cmpia.c:41
subroutine maxout(MAXO)
This subroutine allows the user to define the maximum length of a BUFR message that can be written to...
Definition: maxout.f:38
INTEGER function imrkopr(NEMO)
This function determines whether a specified mnemonic is a Table C marker operator.
Definition: imrkopr.f:21
f77int icvidx(f77int *ii, f77int *jj, f77int *numjj)
C C SUBPROGRAM: ICVIDX C PRGMMR: ATOR ORG: NP12 DATE: 2009-03-23 C C ABSTRACT: THIS ROUTINE COMPUTES ...
Definition: icvidx.c:41
function iupbs01(MBAY, S01MNEM)
This function returns a specified value from within Section 0 or Section 1 of a BUFR message...
Definition: iupbs01.f:73