NCEPLIBS-bufr  11.6.0
 All Data Structures Files Functions Variables Pages
bufrlib.h File Reference

Define signatures to enable a number of BUFRLIB subprograms to be called directly from C application programs. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

Go to the source code of this file.

Macros

#define MAXCD   250
 
#define MAXNC   600
 
#define MXNAF   4
 
#define NFILES   32
 

Typedefs

typedef int f77int
 
typedef double f77r8
 

Functions

void arallocc (void)
 This subroutine is called internally during the first call to subroutine openbf() from an application program, in order to dynamically allocate internal C language arrays based on parameter values set during one or more previous calls to function isetprm(). More...
 
void ardllocc (void)
 This subroutine frees any memory that was dynamically allocated during a previous call to subroutine arallocc(). More...
 
void bort (char *, size_t)
 
void bort_exit (void)
 This subroutine terminates the application program with a non-zero status code. More...
 
void bvers (char *, size_t)
 
void cadn30 (f77int *, char *, size_t)
 
void closbf (f77int *)
 
int cmpia (const void *, const void *)
 C C SUBPROGRAM: CMPIA C PRGMMR: ATOR ORG: NP12 DATE: 2009-03-23 C C ABSTRACT: THIS ROUTINE DEFINES A COMPARISON BETWEEN TWO INTEGERS C FOR USE BY THE BINARY SEARCH FUNCTION BSEARCH. More...
 
void cmpmsg (char *, size_t)
 
void elemdx (char *, f77int *, size_t)
 
void gets1loc (char *, f77int *, f77int *, f77int *, f77int *, size_t)
 
f77int ibfms (f77r8 *)
 
f77int ichkstr (char *, char *, f77int *, size_t, size_t)
 
f77int icvidx (f77int *, f77int *, f77int *)
 C C SUBPROGRAM: ICVIDX C PRGMMR: ATOR ORG: NP12 DATE: 2009-03-23 C C ABSTRACT: THIS ROUTINE COMPUTES A UNIQUE 1-DIMENSIONAL ARRAY C INDEX FROM 2-DIMENSIONAL INDICES. More...
 
f77int ifxy (char *, size_t)
 
f77int igetntbi (f77int *, char *, size_t)
 
f77int igetprm (char *, size_t)
 
f77int igettdi (f77int *)
 
f77int imrkopr (char *, size_t)
 
void ipkm (char *, f77int *, f77int *, size_t)
 
f77int ireadns (f77int *, char *, f77int *, size_t)
 
f77int istdesc (f77int *)
 
f77int iupb (f77int *, f77int *, f77int *)
 
f77int iupbs01 (f77int *, char *, size_t)
 
f77int iupm (char *, f77int *, size_t)
 
void maxout (f77int *)
 
void nemtab (f77int *, char *, f77int *, char *, f77int *, size_t, size_t)
 
void nemtbb (f77int *, f77int *, char *, f77int *, f77int *, f77int *, size_t)
 
void nummtb (f77int *, char *, f77int *)
 C C SUBPROGRAM: NUMMTB C PRGMMR: ATOR ORG: NP12 DATE: 2009-03-23 C C ABSTRACT: THIS ROUTINE SEARCHES FOR AN ENTRY CORRESPONDING TO IDN C IN THE BUFR MASTER TABLE (EITHER 'B' OR 'D', DEPENDING ON THE VALUE C OF IDN). More...
 
void numtbd (f77int *, f77int *, char *, char *, f77int *, size_t, size_t)
 
void openmb (f77int *, char *, f77int *, size_t)
 
void pktdd (f77int *, f77int *, f77int *, f77int *)
 
void restd (f77int *, f77int *, f77int *, f77int *)
 
void stntbi (f77int *, f77int *, char *, char *, char *, size_t, size_t, size_t)
 
void strnum (char *, f77int *, size_t)
 
void stseq (f77int *, f77int *, f77int *, char *, char *, f77int *, f77int *)
 
void ufbint (f77int *, f77r8 *, f77int *, f77int *, f77int *, char *, size_t)
 
void ufbseq (f77int *, f77r8 *, f77int *, f77int *, f77int *, char *, size_t)
 
void uptdd (f77int *, f77int *, f77int *, f77int *)
 
void wrdesc (f77int, f77int *, f77int *)
 
void wrdlen (void)
 This subroutine figures out some important information about the local machine on which the BUFRLIB software is being run, including the native endianness, the number of bytes in an integer, and whether the machine uses the ASCII or EBCDIC character set. More...
 

Detailed Description

Define signatures to enable a number of BUFRLIB subprograms to be called directly from C application programs.

This header file defines the signatures for all BUFRLIB subprograms which are native C functions, or which are native Fortran subroutines but can be called directly from C application programs without the use of wrapper functions. This header file also contains macros used throughout the C portion of the BUFRLIB.

Author
J.Ator
Date
2003-11-04

Definition in file bufrlib.h.

Function Documentation

void arallocc ( void  )

This subroutine is called internally during the first call to subroutine openbf() from an application program, in order to dynamically allocate internal C language arrays based on parameter values set during one or more previous calls to function isetprm().

This subroutine isn't normally called directly from an application program, since it's automatically called internally during the first call to subroutine openbf() from an application program.

Author
J. Ator
Date
2014-12-04
Remarks
  • All memory allocated within this subroutine can be freed via a subsequent call to subroutine exitbufr() from within the application program, or else it will be freed automatically by the operating system once the application program terminates.

Program history log:

Date Programmer Comments
2014-12-04 J. Ator Original author
2021-05-17 J. Ator Allow up to 24 characters in cbunit

Definition at line 36 of file arallocc.c.

References bort(), igetprm(), lstpos, and pb.

Referenced by openbf().

void ardllocc ( void  )

This subroutine frees any memory that was dynamically allocated during a previous call to subroutine arallocc().

Author
J. Ator
Date
2014-12-04

Program history log:

Date Programmer Comments
2014-12-04 J. Ator Original author

Definition at line 23 of file ardllocc.c.

References lstpos, and pb.

Referenced by ardllocf().

void bort_exit ( void  )

This subroutine terminates the application program with a non-zero status code.

Author
J. Ator
Date
2003-11-04

Program history log:

Date Programmer Comments
2003-11-04 J. Ator Original author
2003-11-04 D. Keyser Unified/portable for WRF
2004-08-18 J. Ator Use bufrlib.h include file
2007-01-19 J. Ator Fix declaration for ANSI-C

Definition at line 23 of file bort_exit.c.

Referenced by bort(), and bort2().

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 COMPARISON BETWEEN TWO INTEGERS C FOR USE BY THE BINARY SEARCH FUNCTION BSEARCH.

C C PROGRAM HISTORY LOG: C 2009-03-23 J. ATOR – ORIGINAL AUTHOR C C USAGE: CALL CMPIA( PF1, PF2 ) C INPUT ARGUMENT LIST: C PF1 - INTEGER: FIRST INTEGER TO BE COMPARED C PF2 - INTEGER: SECOND INTEGER TO BE COMPARED C C OUTPUT ARGUMENT LIST: C CMPIA - INTEGER: RESULT OF COMPARISON: C -1 = PF1 is less than PF2 C 0 = PF1 is equal to PF2 C 1 = PF1 is greater than PF2 C C REMARKS: C THIS ROUTINE CALLS: None C THIS ROUTINE IS CALLED BY: NUMMTB C Normally not called by any application C programs. C C ATTRIBUTES: C LANGUAGE: C C MACHINE: PORTABLE TO ALL PLATFORMS C C$$$

Definition at line 41 of file cmpia.c.

Referenced by nummtb().

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 A UNIQUE 1-DIMENSIONAL ARRAY C INDEX FROM 2-DIMENSIONAL INDICES.

THIS ALLOWS A 2-DIMENSIONAL C (ROW-BY-COLUMN) ARRAY TO BE STORED AND ACCESSED AS A C 1-DIMENSIONAL ARRAY. C C PROGRAM HISTORY LOG: C 2009-03-23 J. ATOR – ORIGINAL AUTHOR C C USAGE: CALL ICVIDX( II, JJ, NUMJJ ) C INPUT ARGUMENT LIST: C II - INTEGER: FIRST (ROW) INDEX C JJ - INTEGER: SECOND (COLUMN) INDEX C NUMJJ - INTEGER: MAXIMUM NUMBER OF COLUMN INDICES C C OUTPUT ARGUMENT LIST: C ICVIDX - INTEGER: 1-DIMENSIONAL INDEX C C REMARKS: C THIS ROUTINE CALLS: None C THIS ROUTINE IS CALLED BY: CPMSTABS IREADMT STSEQ C Normally not called by any application C programs. C C ATTRIBUTES: C LANGUAGE: C C MACHINE: PORTABLE TO ALL PLATFORMS C C$$$

Definition at line 41 of file icvidx.c.

Referenced by cpmstabs(), ireadmt(), and stseq().

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 FOR AN ENTRY CORRESPONDING TO IDN C IN THE BUFR MASTER TABLE (EITHER 'B' OR 'D', DEPENDING ON THE VALUE C OF IDN).

THE SEARCH USES BINARY SEARCH LOGIC, SO ALL OF THE ENTRIES C IN THE TABLE MUST BE SORTED IN ASCENDING ORDER (BY FXY NUMBER) IN C ORDER FOR THIS ROUTINE TO WORK PROPERLY. C C PROGRAM HISTORY LOG: C 2009-03-23 J. ATOR – ORIGINAL AUTHOR C C USAGE: CALL NUMMTB( IDN, TAB, IPT ) C INPUT ARGUMENT LIST: C IDN - INTEGER: BIT-WISE REPRESENTATION OF FXY VALUE TO BE C SEARCHED FOR C C OUTPUT ARGUMENT LIST: C TAB - CHARACTER: TABLE IN WHICH IDN WAS FOUND ('B' OR 'D') C IPT - INTEGER: INDEX OF ENTRY FOR IDN IN MASTER TABLE TAB C C REMARKS: C THIS ROUTINE CALLS: BORT CADN30 CMPIA C THIS ROUTINE IS CALLED BY: STSEQ C Normally not called by any application C programs. C C ATTRIBUTES: C LANGUAGE: C C MACHINE: PORTABLE TO ALL PLATFORMS C C$$$

Definition at line 43 of file nummtb.c.

References bort(), cadn30(), cmpia(), and ifxy().

Referenced by stseq().

void wrdlen ( void  )

This subroutine figures out some important information about the local machine on which the BUFRLIB software is being run, including the native endianness, the number of bytes in an integer, and whether the machine uses the ASCII or EBCDIC character set.

This subroutine isn't normally called directly by any application program, because it's automatically called internally from within subroutine openbf() during the first time that subroutine is called by any application program. It's also called as needed from within several other subroutines, but it always keeps track of its results as well as whether it has already been called during the life of an application program, and that way if it does end up being called more than once, it will just quietly return without having to recompute all of its results from the first call.

Authors
J. Woollen
J. Ator
Date
1994-01-06

Program history log:

Date Programmer Comments
1994-01-06 J. Woollen Original author
1998-07-08 J. Woollen Replaced call to Cray library routine ABORT with call to new internal routine bort()
2003-11-04 J. Ator Added documentation
2003-11-04 S. Bender Added remarks and routine interdependencies
2003-11-04 D. Keyser Unified/portable for WRF; added documentation; outputs more complete diagnostic info when routine terminates abnormally, initialized NBYTW to zero during the first call
2004-08-18 J. Ator Added SAVE For IFIRST flag and immediate return if IFIRST=1
2007-01-19 J. Ator Big-endian vs. little-endian is now determined at compile time and configured within BUFRLIB via conditional compilation directives
2009-03-23 J. Ator Call bvers() to get version number

Definition at line 35 of file wrdlen.F.

References bort(), errwrt(), and iupm().

Referenced by cobfl(), copybf(), datelen(), dumpbf(), iupbs01(), iupbs3(), main(), openbf(), rdmtbb(), rdmtbd(), rdmtbf(), and upds3().