NCEPLIBS-g2c 1.9.0
Loading...
Searching...
No Matches
g2cxml.c File Reference

This file reads the GRIB2 XML files. More...

#include <libxml/tree.h>
#include <libxml/parser.h>
#include <grib2_int.h>

Go to the source code of this file.

Functions

int g2c_find_desc (char *title, int code, char *desc)
 Given a table title and an integer code, find a description.
 
int g2c_find_desc_str (char *title, char *code, char *desc)
 Given a table title and a code, find a description.
 
G2C_CODE_ENTRY_Tg2c_find_entry (char *desc, G2C_CODE_TABLE_T *table)
 Find an entry in a table given a description.
 
G2C_CODE_TABLE_Tg2c_find_table (char *key)
 Find a table given a key.
 
void g2c_free_tables ()
 Free table memory.
 
void g2c_print_tables ()
 Print the table data.
 
int g2c_xml_init ()
 Init.
 

Variables

xmlDocPtr doc
 Contains the parsed XML document.
 
G2C_CODE_TABLE_Tg2c_table = NULL
 Pointer to the list of code tables.
 

Detailed Description

This file reads the GRIB2 XML files.

Author
Ed Hartnett
Date
8/25/22

Definition in file g2cxml.c.

Function Documentation

◆ g2c_find_desc()

int g2c_find_desc ( char *  title,
int  code,
char *  desc 
)

Given a table title and an integer code, find a description.

Parameters
titleTitle of table.
codeCode to search for as an int.
descPointer that gets a copy of the description. Must be allocated to G2C_MAX_GRIB_DESC_LEN + 1.
Author
Ed Hartnett
Date
8/28/22
Returns
0 for success, error code otherwise.

Definition at line 132 of file g2cxml.c.

References g2c_find_desc_str(), and G2C_MAX_GRIB_CODE_LEN.

Referenced by g2c_log_section1().

◆ g2c_find_desc_str()

int g2c_find_desc_str ( char *  title,
char *  code,
char *  desc 
)

Given a table title and a code, find a description.

Parameters
titleTitle of table.
codeCode to search for.
descPointer that gets a copy of the description. Must be allocated to G2C_MAX_GRIB_DESC_LEN + 1.
Author
Ed Hartnett
Date
8/28/22
Returns
0 for success, error code otherwise.

Definition at line 84 of file g2cxml.c.

References G2C_EINVAL, G2C_ENOTFOUND, G2C_MAX_GRIB_CODE_LEN, G2C_MAX_GRIB_TITLE_LEN, G2C_NOERROR, and g2c_table.

Referenced by g2c_find_desc().

◆ g2c_find_entry()

G2C_CODE_ENTRY_T * g2c_find_entry ( char *  desc,
G2C_CODE_TABLE_T table 
)

Find an entry in a table given a description.

Parameters
descThe description of the entry to find.
tableA pointer to the table to search.
Author
Ed Hartnett
Date
8/29/22
Returns
a pointer to the matching entry, or NULL if not found.

Definition at line 170 of file g2cxml.c.

References G2C_MAX_GRIB_DESC_LEN.

◆ g2c_find_table()

G2C_CODE_TABLE_T * g2c_find_table ( char *  key)

Find a table given a key.

Parameters
keyThe table title to find.
Author
Ed Hartnett
Date
8/28/22
Returns
a pointer to the matching code table, or NULL if not found.

Definition at line 149 of file g2cxml.c.

References G2C_MAX_GRIB_TITLE_LEN, and g2c_table.

Referenced by g2c_xml_init().

◆ g2c_free_tables()

void g2c_free_tables ( )

Free table memory.

Author
Ed Hartnett
Date
8/28/22

Definition at line 42 of file g2cxml.c.

References g2c_table.

Referenced by g2c_log_file().

◆ g2c_print_tables()

void g2c_print_tables ( )

Print the table data.

Author
Ed Hartnett
Date
8/28/22

Definition at line 22 of file g2cxml.c.

References g2c_table.

◆ g2c_xml_init()

int g2c_xml_init ( )

Init.

Returns
Author
Ed Hartnett
Date
8/26/22

Definition at line 190 of file g2cxml.c.

References doc, G2C_ENAMETOOLONG, G2C_ENOMEM, G2C_EXML, g2c_find_table(), G2C_MAX_GRIB_CODE_LEN, G2C_MAX_GRIB_DESC_LEN, G2C_MAX_GRIB_STATUS_LEN, G2C_MAX_GRIB_TITLE_LEN, G2C_NOERROR, and g2c_table.

Referenced by g2c_log_file(), and g2c_log_section1().

Variable Documentation

◆ doc

xmlDocPtr doc

Contains the parsed XML document.

Definition at line 12 of file g2cxml.c.

Referenced by g2c_xml_init().

◆ g2c_table

G2C_CODE_TABLE_T* g2c_table = NULL

Pointer to the list of code tables.

Definition at line 15 of file g2cxml.c.

Referenced by g2c_find_desc_str(), g2c_find_table(), g2c_free_tables(), g2c_log_file(), g2c_print_tables(), and g2c_xml_init().