NCEPLIBS-bufr 11.7.1
cread.h File Reference

Define signatures and declare variables for reading or writing BUFR messages via a C language interface. More...

Go to the source code of this file.

Functions

void backbufr (f77int *)
 This subroutine backspaces a BUFR file by one BUFR message. More...
 
void cewind (f77int *)
 This subroutine rewinds a BUFR file back to its beginning. More...
 
void closfb (f77int *)
 This subroutine closes a previously opened BUFR file. More...
 
f77int crdbufr (f77int *, char *, f77int *)
 This function reads the next message from a BUFR file that was previously opened for reading. More...
 
void cwrbufr (f77int *, f77int *, f77int *)
 This subroutine writes a BUFR message into a file that was previously opened for writing. More...
 
void openab (f77int *, char *)
 This subroutine opens a new system file for appending BUFR messages. More...
 
void openrb (f77int *, char *)
 This subroutine opens a new system file for reading BUFR messages. More...
 
void openwb (f77int *, char *)
 This subroutine opens a new system file for writing BUFR messages. More...
 

Variables

fpos_t * lstpos
 Byte positions of last successful reads from files corresponding to pb, for files that were opened for reading. More...
 
FILE ** pb
 File pointers. More...
 

Detailed Description

Define signatures and declare variables for reading or writing BUFR messages via a C language interface.

These signatures and variables are used by the C language interface which encompasses subroutines openrb(), openwb(), openab(), backbufr(), cewind(), closfb(), crdbufr() and cwrbufr().

The variables are dimensioned as one larger than NFILES because of the difference in array indexing between Fortran and C. In each subroutine, the value passed in for nfile will be an internal Fortran I/O stream index ranging in value from 1 to NFILES, so we need to allow for this same range of values in C, which would otherwise expect the array indices to range from 0 to NFILES-1.

Author
J. Woollen
Date
2012-09-15

Definition in file cread.h.

Function Documentation

◆ backbufr()

void backbufr ( f77int *  nfile)

This subroutine backspaces a BUFR file by one BUFR message.

Author
J. Woollen
Date
2012-09-15
Parameters
[in]nfile– f77int*: Internal Fortran I/O stream index associated with BUFR file

Program history log:

Date Programmer Comments
2012-09-15 J. Woollen Original author
2014-11-07 J. Ator Allow dynamic allocation of pb and lstpos arrays

Definition at line 84 of file cread.c.

References lstpos, and pb.

Referenced by cpdxmm(), posapx(), rdbfdx(), readmg(), and ufbmem().

◆ cewind()

void cewind ( f77int *  nfile)

This subroutine rewinds a BUFR file back to its beginning.

Author
J. Woollen
Date
2012-09-15
Parameters
[in]nfile– f77int*: Internal Fortran I/O stream index associated with BUFR file

Program history log:

Date Programmer Comments
2012-09-15 J. Woollen Original author
2014-11-07 J. Ator Allow dynamic allocation of pb array

Definition at line 100 of file cread.c.

References pb.

Referenced by rewnbf(), ufbmem(), and ufbpos().

◆ closfb()

void closfb ( f77int *  nfile)

This subroutine closes a previously opened BUFR file.

Author
J. Woollen
Date
2012-09-15
Parameters
[in]nfile– f77int*: Internal Fortran I/O stream index associated with BUFR file

Program history log:

Date Programmer Comments
2012-09-15 J. Woollen Original author
2014-11-07 J. Ator Allow dynamic allocation of pb array

Definition at line 116 of file cread.c.

References pb.

Referenced by closbf().

◆ crdbufr()

f77int crdbufr ( f77int *  nfile,
char *  bufr,
f77int *  mxbyt 
)

This function reads the next message from a BUFR file that was previously opened for reading.

Author
J. Woollen
Date
2012-09-15
Parameters
[in]nfile– f77int*: Internal Fortran I/O stream index associated with BUFR file
[out]bufr– char*: BUFR message
[in]mxbyt– f77int*: Dimensioned size (in bytes) of bufr; used by the function to ensure that it doesn't overflow the BUFR array
Returns
crdbufr – f77int: return code
  • 0 = normal return
  • -1 = end-of-file encountered while reading
  • -2 = I/O error encountered while reading
  • -3 = overflow of bufr array

Program history log:

Date Programmer Comments
2012-09-15 J. Woollen Original author
2014-11-07 J. Ator Allow dynamic allocation of pb and lstpos arrays

Definition at line 140 of file cread.c.

References iupbs01(), lstpos, and pb.

◆ cwrbufr()

void cwrbufr ( f77int *  nfile,
f77int *  bufr,
f77int *  nwrd 
)

This subroutine writes a BUFR message into a file that was previously opened for writing.

Author
J. Woollen
Date
2012-09-15
Parameters
[in]nfile– f77int*: Internal Fortran I/O stream index associated with BUFR file
[in]bufr– f77int*: BUFR message
[in]nwrd– f77int*: Size (in f77ints) of bufr

Program history log:

Date Programmer Comments
2012-09-15 J. Woollen Original author
2014-11-07 J. Ator Allow dynamic allocation of pb array

Definition at line 173 of file cread.c.

References pb.

Referenced by msgwrt().

◆ openab()

void openab ( f77int *  nfile,
char *  ufile 
)

This subroutine opens a new system file for appending BUFR messages.

Author
J. Woollen
Date
2012-09-15
Parameters
[in]nfile– f77int*: Internal Fortran I/O stream index associated with ufile
[in]ufile– char*: [path/]name of system file to be opened

Program history log:

Date Programmer Comments
2012-09-15 J. Woollen Original author
2014-11-07 J. Ator Allow dynamic allocation of pb array

Definition at line 68 of file cread.c.

References pb.

Referenced by openbf().

◆ openrb()

void openrb ( f77int *  nfile,
char *  ufile 
)

This subroutine opens a new system file for reading BUFR messages.

Author
J. Woollen
Date
2012-09-15
Parameters
[in]nfile– f77int*: Internal Fortran I/O stream index associated with ufile
[in]ufile– char*: [path/]name of system file to be opened

Program history log:

Date Programmer Comments
2012-09-15 J. Woollen Original author
2014-11-07 J. Ator Allow dynamic allocation of pb array

Definition at line 34 of file cread.c.

References pb.

Referenced by openbf().

◆ openwb()

void openwb ( f77int *  nfile,
char *  ufile 
)

This subroutine opens a new system file for writing BUFR messages.

Author
J. Woollen
Date
2012-09-15
Parameters
[in]nfile– f77int*: Internal Fortran I/O stream index associated with ufile
[in]ufile– char*: [path/]name of system file to be opened

Program history log:

Date Programmer Comments
2012-09-15 J. Woollen Original author
2014-11-07 J. Ator Allow dynamic allocation of pb array

Definition at line 51 of file cread.c.

References pb.

Referenced by openbf().

Variable Documentation

◆ lstpos

lstpos
extern

Byte positions of last successful reads from files corresponding to pb, for files that were opened for reading.

Referenced by arallocc(), ardllocc(), backbufr(), and crdbufr().

◆ pb

pb
extern