summaryrefslogtreecommitdiff
path: root/modules/spreadsheet/src/c/csvRead.h
blob: 0d3b70372568771ab607ce5ab7f0d0adc3f162f8 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2010-2011 - DIGITEO - Allan CORNET
 *
 * This file must be used under the terms of the CeCILL.
 * This source file is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at
 * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
 *
 */
#ifndef __CSV_READ_H__
#define __CSV_READ_H__

typedef enum
{
    CSV_READ_NO_ERROR = 0,
    CSV_READ_MOPEN_ERROR = 1,
    CSV_READ_FILE_NOT_EXIST = 2,
    CSV_READ_MEMORY_ALLOCATION = 3,
    CSV_READ_READLINES_ERROR = 4,
    CSV_READ_COLUMNS_ERROR = 5,
    CSV_READ_ERROR = 6,
    CSV_READ_SEPARATOR_DECIMAL_EQUAL = 7,
    CSV_READ_REGEXP_ERROR = 8
} csvReadError;

typedef struct
{
    char **pstrValues;
    int m;
    int n;
    char **pstrComments;
    int nbComments;
    csvReadError err;
} csvResult;

#ifdef __cplusplus
extern "C" {
#endif

    csvResult* csvRead(const char *filename, const char *separator, const char *decimal,
                       const char **toreplace, int sizetoreplace, const char *regexpcomments, int header);

    csvResult* csvTextScan(const char **lines, int numberOfLines, const char *separator, const char *decimal);

    void freeCsvResult(csvResult *result);

#ifdef __cplusplus
}
#endif


#endif /* __CSV_READ_H__ */