7 #include <libxml/tree.h>
8 #include <libxml/parser.h>
30 printf(
"%s\n", t->title);
31 for (e = t->entry; e; e = e->next)
32 printf(
"code %s desc %s status %s\n", e->code, e->desc, e->status);
59 for (e = t->entry; e; e = e_next)
95 for (t =
g2c_table; !found && t; t = t->next)
97 if (!strncmp(title, t->title, strlen(title)))
102 for (e = t->entry; e; e = e->next)
104 if (!strncmp(code, e->code, strlen(code)))
106 strcpy(desc, e->desc);
136 sprintf(str_code,
"%d", code);
174 for (e = table->entry; e; e = e->next)
203 if (!(
doc = xmlReadFile(
"CodeFlag.xml", NULL, 0)))
207 cur = xmlDocGetRootElement(
doc)->xmlChildrenNode;
210 xmlNode *child = cur->xmlChildrenNode;
217 if ((!xmlStrcmp(child->name, (
const xmlChar *)
"Title_en")))
219 key = xmlNodeListGetString(
doc, child->xmlChildrenNode, 1);
228 my_table = new_table;
235 if ((!xmlStrcmp(child->name, (
const xmlChar *)
"CodeFlag")))
241 if (child->xmlChildrenNode)
243 key = xmlNodeListGetString(
doc, child->xmlChildrenNode, 1);
254 for (e = my_table->entry; e->next; e = e->next)
259 my_table->entry = new_entry;
261 if ((!xmlStrcmp(child->name, (
const xmlChar *)
"MeaningParameterDescription_en")))
263 key = xmlNodeListGetString(
doc, child->xmlChildrenNode, 1);
272 if ((!xmlStrcmp(child->name, (
const xmlChar *)
"Status")))
274 key = xmlNodeListGetString(
doc, child->xmlChildrenNode, 1);
300 for (; g->next; g = g->next)
int g2c_find_desc_str(char *title, char *code, char *desc)
Given a table title and a code, find a description.
int g2c_find_desc(char *title, int code, char *desc)
Given a table title and an integer code, find a description.
G2C_CODE_ENTRY_T * g2c_find_entry(char *desc, G2C_CODE_TABLE_T *table)
Find an entry in a table given a description.
void g2c_free_tables()
Free table memory.
G2C_CODE_TABLE_T * g2c_find_table(char *key)
Find a table given a key.
xmlDocPtr doc
Contains the parsed XML document.
G2C_CODE_TABLE_T * g2c_table
Pointer to the list of code tables.
void g2c_print_tables()
Print the table data.
#define G2C_MAX_GRIB_TITLE_LEN
Maximum length of code table title.
#define G2C_MAX_GRIB_DESC_LEN
Maximum length of code description.
#define G2C_ENAMETOOLONG
Name too long.
#define G2C_ENOMEM
Out of memory.
#define G2C_ENOTFOUND
Table or entry not found.
#define G2C_MAX_GRIB_STATUS_LEN
Maximum length of code status.
#define G2C_EINVAL
Invalid input.
#define G2C_MAX_GRIB_CODE_LEN
Maximum length of code.
#define G2C_EXML
XML error.
#define G2C_NOERROR
No error.
Header file with internal function prototypes NCEPLIBS-g2c library.
An entry in a GRIB2 code table.