NCEPLIBS-bufr 11.7.1
nummtb.c
Go to the documentation of this file.
1
6#include "bufrlib.h"
7#include "mstabs.h"
8
43void nummtb( f77int *idn, char *tab, f77int *ipt )
44{
45 f77int *pifxyn, *pbs, nmt;
46
47 char adn[7], errstr[129];
48
49 if ( *idn >= ifxy( "300000", 6 ) ) {
50 *tab = 'D';
51 pifxyn = &MSTABS_BASE(idfxyn)[0];
52 nmt = MSTABS_BASE(nmtd);
53 }
54 else {
55 *tab = 'B';
56 pifxyn = &MSTABS_BASE(ibfxyn)[0];
57 nmt = MSTABS_BASE(nmtb);
58 }
59
60 pbs = ( f77int * ) bsearch( idn, pifxyn, ( size_t ) nmt, sizeof( f77int ),
61 ( int (*) ( const void *, const void * ) ) cmpia );
62 if ( pbs == NULL ) {
63 cadn30( idn, adn, sizeof( adn ) );
64 adn[6] = '\0';
65 sprintf( errstr, "BUFRLIB: NUMMTB - COULD NOT FIND DESCRIPTOR "
66 "%s IN MASTER TABLE %c", adn, *tab );
67 bort( errstr, ( f77int ) strlen( errstr ) );
68 }
69 *ipt = pbs - pifxyn;
70
71 return;
72}
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23
Define signatures to enable a number of BUFRLIB subprograms to be called directly from C application ...
subroutine cadn30(IDN, ADN)
This subroutine converts an FXY value from its bit-wise (integer) representation to its 6 character r...
Definition: cadn30.f:24
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
function ifxy(ADSC)
This function converts an FXY value from its 6 character representation to its bit-wise (integer) rep...
Definition: ifxy.f:43
Define signatures and declare variables for internal storage of master Table B and Table D entries.
integer nmtd
Number of master Table D entries (up to a maximum of MXMTBD).
Definition: moda_mstabs.F:61
integer, dimension(:), allocatable idfxyn
Bit-wise representations of FXY numbers for master Table D.
Definition: moda_mstabs.F:69
integer nmtb
Number of master Table B entries (up to a maximum of MXMTBB).
Definition: moda_mstabs.F:60
integer, dimension(:), allocatable ibfxyn
Bit-wise representations of FXY numbers for master Table B.
Definition: moda_mstabs.F:62
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