bufr2synop 0.24.0
|
This file has the code of useful routines for read or write csv formatted lines. More...
#include "bufrdeco.h"
Go to the source code of this file.
Macros | |
#define | CSV_WAIT_ITEM 1 |
#define | CSV_FINISHED_ITEM 2 |
#define | CSV_IS_ITEM 4 |
#define | CSV_IS_SEPARATOR 8 |
#define | CSV_IS_CITED 16 |
#define | CSV_WAIT_SEPARATOR 32 |
#define | CSV_IS_DOUBLE_QUOTED 64 |
Functions | |
char * | csv_quoted_string (char *out, char *in) |
Transform a string to a quoted string to be inserted in a csv file. More... | |
int | parse_csv_line2 (int *nt, char *tk[], char *lin) |
Parse a csv line. More... | |
int | parse_csv_line (int *nt, char *tk[], char *lin) |
Parse a csv line. More... | |
Variables | |
const char | CSV_SPACE [] = " \t\r" |
const char | CSV_SEPARATOR = ',' |
const char | CSV_CITE = '\"' |
const char | CSV_FINAL = '\n' |
This file has the code of useful routines for read or write csv formatted lines.
Definition in file bufrdeco_csv.c.
#define CSV_FINISHED_ITEM 2 |
Definition at line 27 of file bufrdeco_csv.c.
#define CSV_IS_CITED 16 |
Definition at line 30 of file bufrdeco_csv.c.
#define CSV_IS_DOUBLE_QUOTED 64 |
Definition at line 32 of file bufrdeco_csv.c.
#define CSV_IS_ITEM 4 |
Definition at line 28 of file bufrdeco_csv.c.
#define CSV_IS_SEPARATOR 8 |
Definition at line 29 of file bufrdeco_csv.c.
#define CSV_WAIT_ITEM 1 |
Definition at line 26 of file bufrdeco_csv.c.
#define CSV_WAIT_SEPARATOR 32 |
Definition at line 31 of file bufrdeco_csv.c.
char * csv_quoted_string | ( | char * | out, |
char * | in | ||
) |
Transform a string to a quoted string to be inserted in a csv file.
out | resulting string |
in | input string |
Definition at line 48 of file bufrdeco_csv.c.
References CSV_MAXL.
Referenced by main().
int parse_csv_line | ( | int * | nt, |
char * | tk[], | ||
char * | lin | ||
) |
Parse a csv line.
nt | pointer to a integer. On success is the number of items found |
tk | array of pointers. Every pointer is a item on success |
lin | input line which is modified in this routine to be splitted into items |
This is an optimization of routine parse_csv_line2(). Here we suppose: -All no void items are closed between "" and separed by comas ',' -No " in items. -No blank spaces at the end nor begin of items
NOTE that input line is modified
Definition at line 258 of file bufrdeco_csv.c.
References CSV_CITE, CSV_FINAL, CSV_MAXL, and CSV_SEPARATOR.
Referenced by bufr_read_tableB(), bufr_read_tableC(), bufr_read_tableD(), and main().
int parse_csv_line2 | ( | int * | nt, |
char * | tk[], | ||
char * | lin | ||
) |
Parse a csv line.
nt | pointer to a integer. On success is the number of items found |
tk | array of pointers. Every pointer is a item on success |
lin | input line which is modified in this routine to be splitted into items |
NOTE that input line is modified
Definition at line 86 of file bufrdeco_csv.c.
References bufrdeco_assert, CSV_CITE, CSV_FINAL, CSV_FINISHED_ITEM, CSV_IS_CITED, CSV_IS_DOUBLE_QUOTED, CSV_IS_ITEM, CSV_MAXL, CSV_SEPARATOR, CSV_SPACE, CSV_WAIT_ITEM, and CSV_WAIT_SEPARATOR.
const char CSV_CITE = '\"' |
Definition at line 36 of file bufrdeco_csv.c.
Referenced by parse_csv_line(), and parse_csv_line2().
const char CSV_FINAL = '\n' |
Definition at line 37 of file bufrdeco_csv.c.
Referenced by parse_csv_line(), and parse_csv_line2().
const char CSV_SEPARATOR = ',' |
Definition at line 35 of file bufrdeco_csv.c.
Referenced by parse_csv_line(), and parse_csv_line2().
const char CSV_SPACE[] = " \t\r" |
Definition at line 34 of file bufrdeco_csv.c.
Referenced by parse_csv_line2().