blob: e0bbca821ee785d2a39bb857adc57123636b4a7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/* parsecsv.c
Copyright (c) 2003-2016 HandBrake Team
This file is part of the HandBrake source code
Homepage: <http://handbrake.fr/>.
It may be used under the terms of the GNU General Public License v2.
For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html
*/
/*
A very simple CSV file parser.
*/
typedef struct hb_csv_file_s hb_csv_file_t;
typedef struct hb_csv_cell_s hb_csv_cell_t;
struct hb_csv_file_s
{
FILE * fileref;
int eof;
int parse_state;
int curr_row;
int curr_col;
};
struct hb_csv_cell_s
{
char cell_text[1024];
int cell_row;
int cell_col;
};
/* Open a CSV File */
hb_csv_file_t *hb_open_csv_file( const char *filepath );
void hb_close_csv_file( hb_csv_file_t *file );
/* Parse CSV Cells */
hb_csv_cell_t *hb_read_next_cell( hb_csv_file_t *file );
void hb_dispose_cell( hb_csv_cell_t *cell );
|