gerbv  2.10.1-dev~93f1b5
csv.h
Go to the documentation of this file.
1 /* csv - read write comma separated value format
2  * Copyright (c) 2003 Michael B. Allen <mba2000 ioplex.com>
3  *
4  * The MIT License
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22  * OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 /* We (Juergen Haas and Tomasz Motylewski) execute our rights given above
26  * to distribute and sublicence this file (csv.h) and csv.c, csv_defines.h
27  * under General Pulic Licence version 2 or any later version.
28  *
29  * This file is derived from libmba : A library of generic C modules
30  * http://www.ioplex.com/~miallen/libmba/dl/libmba-0.8.9.tar.gz
31  */
32 
38 #ifndef CSV_H
39 #define CSV_H
40 
41 /* csv - read write comma separated value format
42  */
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 #define LIBMBA_API extern
49 
50 #include <stdio.h>
51 /*#include "text.h"*/
52 
53 #if defined(USE_WCHAR)
54 #define csv_row_parse csv_row_parse_wcs
55 #else
56 #define csv_row_parse csv_row_parse_str
57 #endif
58 
59 #define CSV_TRIM 0x01
60 #define CSV_QUOTES 0x02
61 
62 LIBMBA_API int
63 csv_row_parse_str(const char* src, size_t sn, char* buf, size_t bn, char* row[], int rn, int sep, int flags);
64 LIBMBA_API int
65 csv_row_parse_wcs(const wchar_t* src, size_t sn, wchar_t* buf, size_t bn, wchar_t* row[], int rn, int sep, int flags);
66 LIBMBA_API int csv_row_fread(FILE* in, char* buf, size_t bn, char* row[], int numcols, int sep, int flags);
67 
68 #ifdef __cplusplus
69 }
70 #endif
71 
72 #endif /* CSV_H */