NCEPLIBS-bufr
12.1.0
|
C language interface for processing master Code/Flag table entries. More...
#include "bufrlib.h"
Go to the source code of this file.
Macros | |
#define | MAX_MEANING_LEN 150 |
Maximum length of a meaning string for a Code/Flag table entry. More... | |
Functions | |
int | cmpstia1 (const void *pe1, const void *pe2) |
Define a comparison between two master Code/Flag table entries. More... | |
int | cmpstia2 (const void *pe1, const void *pe2) |
Define a comparison between two master Code/Flag table entries. More... | |
void | dlloctbf (void) |
Free all dynamically-allocated memory for internal storage of master Code/Flag table entries. More... | |
void | inittbf (void) |
Initialize memory for internal storage of master Code/Flag table entries, including dynamically allocating memory space if needed. More... | |
void | sorttbf (void) |
Sort entries within the master Code/Flag table, in preparation for future searches using function srchtbf(). More... | |
void | srchtbf (int ifxyi, int ivali, int *ifxyd, int mxfxyd, int ivald, char *meaning, int mxmng, int *lnmng, int *iret) |
Search for a specified master Code/Flag table entry. More... | |
void | strtbfe (int ifxyn, int ival, char *meaning, int lmeaning, int idfxy, int idval) |
Store a new master Code/Flag table entry. More... | |
Variables | |
struct code_flag_entry * | cfe |
Master Code/Flag table entries. More... | |
int | mxmtbf |
Maximum number of master Code/Flag table entries, counting across all individual Code/Flag tables, and counting each defined code figure (within each individual Code table) or defined bit number (within each individual Flag table) as a separate entry. More... | |
int | nmtf |
Number of stored master Code/Flag table entries in cfe, up to a maximum of MXMTBF. More... | |
C language interface for processing master Code/Flag table entries.
Definition in file cfe.c.
#define MAX_MEANING_LEN 150 |
int cmpstia1 | ( | const void * | pe1, |
const void * | pe2 | ||
) |
Define a comparison between two master Code/Flag table entries.
The comparison is used by the intrinsic C functions qsort and bsearch, and it differs from the the comparison in function cmpstia2() because it compares all of the iffxyn, ifval, iffxynd and ifvald components of the structure, whereas cmpstia2() only compares the iffxyn and ifval components.
pe1 | - First master Code/Flag table entry. |
pe2 | - Second master Code/Flag table entry. |
int cmpstia2 | ( | const void * | pe1, |
const void * | pe2 | ||
) |
Define a comparison between two master Code/Flag table entries.
The comparison is used by the intrinsic C function bsearch, and it differs from the the comparison in function cmpstia1() because it only compares the iffxyn and ifval components of the structure, whereas cmpstia1() compares all of the iffxyn, ifval, iffxynd and ifvald components of the structure.
pe1 | - First master Code/Flag table entry. |
pe2 | - Second master Code/Flag table entry. |
Definition at line 150 of file cfe.c.
Referenced by srchtbf().
void dlloctbf | ( | void | ) |
void inittbf | ( | void | ) |
void sorttbf | ( | void | ) |
void srchtbf | ( | int | ifxyi, |
int | ivali, | ||
int * | ifxyd, | ||
int | mxfxyd, | ||
int | ivald, | ||
char * | meaning, | ||
int | mxmng, | ||
int * | lnmng, | ||
int * | iret | ||
) |
Search for a specified master Code/Flag table entry.
The search is based on a specified FXY number and associated value (code figure or bit number) within the internal memory structure for storage of master Code/Flag table entries. If found, the associated meaning is returned as a character string.
The search may optionally include a specified second FXY number and associated value upon which the first FXY number and its associated value depend, for example when the meaning of an originating sub-center value depends on the identity of the originating center for which the sub-center in question is a member.
ifxyi | - WMO bit-wise representation of FXY number to search for. |
ivali | - Value (code figure or bit number) associated with ifxyi. |
ifxyd | - Dependence indicator:
|
ivald | - Value (code figure or bit number) associated with the FXY number in ifxyd[0]; set to (-1) whenever ifxyd[0] is also set to (-1). |
mxfxyd | - Number of elements in ifxyd array; used by the function to ensure that it doesn't overflow the array. |
mxmng | - Number of elements in meaning array; used by the function to ensure that it doesn't overflow the string. |
meaning | - Meaning corresponding to ifxyi and ivali (and to ifxyd[0] and ivald, if specified on input). |
lnmng | - Length (in bytes) of string returned in CMEANG. |
iret | - Return code:
|
Definition at line 264 of file cfe.c.
References cfe, cmpstia1(), cmpstia2(), and nmtf.
void strtbfe | ( | int | ifxyn, |
int | ival, | ||
char * | meaning, | ||
int | lmeaning, | ||
int | idfxy, | ||
int | idval | ||
) |
Store a new master Code/Flag table entry.
ifxyn | - WMO bit-wise representation of FXY number for which ival is a defined code or flag table entry. |
ival | - Code figure or bit number. |
meaning | - Meaning associated with ifxyn and ival. |
lmeaning | - Length (in bytes) of meaning. |
idfxy | - WMO bit-wise representation of FXY number upon which ifxyn and ival depend (if any), or else set to a value of (-1). |
idval | - Code figure or bit number associated with idfxy and upon which ifxyn and ival depend (if any), or else set to (-1) whenever idfxy is also set to (-1). |
Definition at line 180 of file cfe.c.
References bort_f(), cfe, moda_ival::ival, MAX_MEANING_LEN, mxmtbf, and nmtf.
struct code_flag_entry* cfe |
int mxmtbf |