.TH "g2ccsv.c" 3 "Version 2.1.0" "NCEPLIBS-g2c" \" -*- nroff -*-
.ad l
.nh
.SH NAME
g2ccsv.c \- This file reads the GRIB2 CSV files\&.  

.SH SYNOPSIS
.br
.PP
\fC#include 'grib2_int\&.h'\fP
.br
\fC#include <stdio\&.h>\fP
.br
\fC#include <stdlib\&.h>\fP
.br
\fC#include <string\&.h>\fP
.br

.SS "Functions"

.in +1c
.ti -1c
.RI "int \fBg2c_csv_init\fP ()"
.br
.RI "Initialize tables from 'CodeFlag\&.txt'\&. "
.ti -1c
.RI "static char * \fBg2c_csv_strsep\fP (char **stringp, const char *delim)"
.br
.RI "Implementation of strsep for code portability\&. "
.ti -1c
.RI "int \fBg2c_find_desc\fP (char *title, int code, char *desc)"
.br
.RI "Given a table title and an integer code, find a description\&. "
.ti -1c
.RI "int \fBg2c_find_desc_str\fP (char *title, char *code, char *desc)"
.br
.RI "Given a table title and a code, find a description\&. "
.ti -1c
.RI "\fBG2C_CODE_ENTRY_T\fP * \fBg2c_find_entry\fP (char *desc, \fBG2C_CODE_TABLE_T\fP *table)"
.br
.RI "Find an entry in a table given a description\&. "
.ti -1c
.RI "\fBG2C_CODE_TABLE_T\fP * \fBg2c_find_table\fP (char *key)"
.br
.RI "Find a table given a key\&. "
.ti -1c
.RI "void \fBg2c_free_tables\fP ()"
.br
.RI "Free table memory\&. "
.ti -1c
.RI "void \fBg2c_print_tables\fP ()"
.br
.RI "Print the table data\&. "
.in -1c
.SS "Variables"

.in +1c
.ti -1c
.RI "FILE * \fBdoc\fP"
.br
.RI "Contains the parsed CSV document\&. "
.ti -1c
.RI "\fBG2C_CODE_TABLE_T\fP * \fBg2c_table\fP = NULL"
.br
.RI "Pointer to the list of code tables\&. "
.in -1c
.SH "Detailed Description"
.PP 
This file reads the GRIB2 CSV files\&. 


.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 
.RE
.PP
\fBDate\fP
.RS 4
8/25/22 
.RE
.PP

.PP
Definition in file \fBg2ccsv\&.c\fP\&.
.SH "Function Documentation"
.PP 
.SS "int g2c_csv_init ()"

.PP
Initialize tables from 'CodeFlag\&.txt'\&. 
.PP
\fBReturns\fP
.RS 4

.IP "\(bu" 2
\fBG2C_NOERROR\fP No error\&.
.PP
.RE
.PP
\fBAuthor\fP
.RS 4
Alyson Stahl 
.RE
.PP
\fBDate\fP
.RS 4
8/2/24 
.RE
.PP

.PP
Definition at line \fB215\fP of file \fBg2ccsv\&.c\fP\&.
.PP
References \fBdoc\fP, \fBg2c_csv_strsep()\fP, \fBG2C_ECSV\fP, \fBG2C_ENAMETOOLONG\fP, \fBG2C_ENOMEM\fP, \fBg2c_find_table()\fP, \fBG2C_MAX_GRIB_CODE_LEN\fP, \fBG2C_MAX_GRIB_DESC_LEN\fP, \fBG2C_MAX_GRIB_LEVEL_DESC_LEN\fP, \fBG2C_MAX_GRIB_STATUS_LEN\fP, \fBG2C_MAX_GRIB_TITLE_LEN\fP, \fBG2C_NOERROR\fP, and \fBg2c_table\fP\&.
.PP
Referenced by \fBg2c_log_file()\fP, and \fBg2c_log_section1()\fP\&.
.SS "static char * g2c_csv_strsep (char ** stringp, const char * delim)\fC [static]\fP"

.PP
Implementation of strsep for code portability\&. Extracts first token in string given a delimiter\&.
.PP
\fBParameters\fP
.RS 4
\fIstringp\fP The address of a pointer to string to be separated\&. This value is overwritten with the value past the delimiter\&. 
.br
\fIdelim\fP Characters that delimit the tokens\&.
.RE
.PP
\fBAuthor\fP
.RS 4
Alyson Stahl 
.RE
.PP
\fBDate\fP
.RS 4
11/6/24
.RE
.PP
\fBReturns\fP
.RS 4
a pointer to the original value of stringp 
.RE
.PP

.PP
Definition at line \fB192\fP of file \fBg2ccsv\&.c\fP\&.
.PP
Referenced by \fBg2c_csv_init()\fP\&.
.SS "int g2c_find_desc (char * title, int code, char * desc)"

.PP
Given a table title and an integer code, find a description\&. 
.PP
\fBParameters\fP
.RS 4
\fItitle\fP Title of table\&. 
.br
\fIcode\fP Code to search for as an int\&. 
.br
\fIdesc\fP Pointer that gets a copy of the description\&. Must be allocated to \fBG2C_MAX_GRIB_DESC_LEN\fP + 1\&.
.RE
.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 
.RE
.PP
\fBDate\fP
.RS 4
8/28/22
.RE
.PP
\fBReturns\fP
.RS 4
0 for success, error code otherwise\&. 
.RE
.PP

.PP
Definition at line \fB131\fP of file \fBg2ccsv\&.c\fP\&.
.PP
References \fBg2c_find_desc_str()\fP, and \fBG2C_MAX_GRIB_CODE_LEN\fP\&.
.PP
Referenced by \fBg2c_log_section1()\fP\&.
.SS "int g2c_find_desc_str (char * title, char * code, char * desc)"

.PP
Given a table title and a code, find a description\&. 
.PP
\fBParameters\fP
.RS 4
\fItitle\fP Title of table\&. 
.br
\fIcode\fP Code to search for\&. 
.br
\fIdesc\fP Pointer that gets a copy of the description\&. Must be allocated to \fBG2C_MAX_GRIB_DESC_LEN\fP + 1\&.
.RE
.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 
.RE
.PP
\fBDate\fP
.RS 4
8/28/22
.RE
.PP
\fBReturns\fP
.RS 4
0 for success, error code otherwise\&. 
.RE
.PP

.PP
Definition at line \fB84\fP of file \fBg2ccsv\&.c\fP\&.
.PP
References \fBG2C_EINVAL\fP, \fBG2C_ENOTFOUND\fP, \fBG2C_MAX_GRIB_CODE_LEN\fP, \fBG2C_MAX_GRIB_TITLE_LEN\fP, \fBG2C_NOERROR\fP, and \fBg2c_table\fP\&.
.PP
Referenced by \fBg2c_find_desc()\fP\&.
.SS "\fBG2C_CODE_ENTRY_T\fP * g2c_find_entry (char * desc, \fBG2C_CODE_TABLE_T\fP * table)"

.PP
Find an entry in a table given a description\&. 
.PP
\fBParameters\fP
.RS 4
\fIdesc\fP The description of the entry to find\&. 
.br
\fItable\fP A pointer to the table to search\&.
.RE
.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 
.RE
.PP
\fBDate\fP
.RS 4
8/29/22
.RE
.PP
\fBReturns\fP
.RS 4
a pointer to the matching entry, or NULL if not found\&. 
.RE
.PP

.PP
Definition at line \fB169\fP of file \fBg2ccsv\&.c\fP\&.
.PP
References \fBG2C_MAX_GRIB_DESC_LEN\fP\&.
.SS "\fBG2C_CODE_TABLE_T\fP * g2c_find_table (char * key)"

.PP
Find a table given a key\&. 
.PP
\fBParameters\fP
.RS 4
\fIkey\fP The table title to find\&.
.RE
.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 
.RE
.PP
\fBDate\fP
.RS 4
8/28/22
.RE
.PP
\fBReturns\fP
.RS 4
a pointer to the matching code table, or NULL if not found\&. 
.RE
.PP

.PP
Definition at line \fB148\fP of file \fBg2ccsv\&.c\fP\&.
.PP
References \fBG2C_MAX_GRIB_TITLE_LEN\fP, and \fBg2c_table\fP\&.
.PP
Referenced by \fBg2c_csv_init()\fP\&.
.SS "void g2c_free_tables ()"

.PP
Free table memory\&. 
.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 
.RE
.PP
\fBDate\fP
.RS 4
8/28/22 
.RE
.PP

.PP
Definition at line \fB42\fP of file \fBg2ccsv\&.c\fP\&.
.PP
References \fBg2c_table\fP\&.
.PP
Referenced by \fBg2c_log_file()\fP\&.
.SS "void g2c_print_tables ()"

.PP
Print the table data\&. 
.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 
.RE
.PP
\fBDate\fP
.RS 4
8/28/22 
.RE
.PP

.PP
Definition at line \fB23\fP of file \fBg2ccsv\&.c\fP\&.
.PP
References \fBg2c_table\fP\&.
.SH "Variable Documentation"
.PP 
.SS "FILE* doc"

.PP
Contains the parsed CSV document\&. 
.PP
Definition at line \fB13\fP of file \fBg2ccsv\&.c\fP\&.
.PP
Referenced by \fBg2c_csv_init()\fP\&.
.SS "\fBG2C_CODE_TABLE_T\fP* g2c_table = NULL"

.PP
Pointer to the list of code tables\&. 
.PP
Definition at line \fB16\fP of file \fBg2ccsv\&.c\fP\&.
.PP
Referenced by \fBg2c_csv_init()\fP, \fBg2c_find_desc_str()\fP, \fBg2c_find_table()\fP, \fBg2c_free_tables()\fP, \fBg2c_log_file()\fP, and \fBg2c_print_tables()\fP\&.
.SH "Author"
.PP 
Generated automatically by Doxygen for NCEPLIBS-g2c from the source code\&.