00001 /* csv - read write comma separated value format 00002 * Copyright (c) 2003 Michael B. Allen <mba2000 ioplex.com> 00003 * 00004 * The MIT License 00005 * 00006 * Permission is hereby granted, free of charge, to any person obtaining a 00007 * copy of this software and associated documentation files (the "Software"), 00008 * to deal in the Software without restriction, including without limitation 00009 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00010 * and/or sell copies of the Software, and to permit persons to whom the 00011 * Software is furnished to do so, subject to the following conditions: 00012 * 00013 * The above copyright notice and this permission notice shall be included 00014 * in all copies or substantial portions of the Software. 00015 * 00016 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00017 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00018 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00019 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00020 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00021 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00022 * OTHER DEALINGS IN THE SOFTWARE. 00023 */ 00024 00025 /* We (Juergen Haas and Tomasz Motylewski) execute our rights given above 00026 * to distribute and sublicence this file (csv.h) and csv.c, csv_defines.h 00027 * under General Pulic Licence version 2 or any later version. 00028 * 00029 * This file is derived from libmba : A library of generic C modules 00030 * http://www.ioplex.com/~miallen/libmba/dl/libmba-0.8.9.tar.gz 00031 */ 00032 00038 #ifndef CSV_H 00039 #define CSV_H 00040 00041 /* csv - read write comma separated value format 00042 */ 00043 00044 #ifdef __cplusplus 00045 extern "C" { 00046 #endif 00047 00048 # define LIBMBA_API extern 00049 00050 #include <stdio.h> 00051 /*#include "text.h"*/ 00052 00053 #if defined(USE_WCHAR) 00054 #define csv_row_parse csv_row_parse_wcs 00055 #else 00056 #define csv_row_parse csv_row_parse_str 00057 #endif 00058 00059 #define CSV_TRIM 0x01 00060 #define CSV_QUOTES 0x02 00061 00062 LIBMBA_API int csv_row_parse_str(const char *src, size_t sn, char *buf, size_t bn, char *row[], int rn, int sep, int flags); 00063 LIBMBA_API int 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); 00064 LIBMBA_API int csv_row_fread(FILE *in, char *buf, size_t bn, char *row[], int numcols, int sep, int flags); 00065 00066 #ifdef __cplusplus 00067 } 00068 #endif 00069 00070 #endif /* CSV_H */