/** * Copyright (c) 2022 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #pragma once #include "dawnsharedlibs.hpp" #include "string.h" #define CSV_ROW_COUNT_MAX 128 #define CSV_COLUMN_COUNT_MAX 16 typedef enum { CSV_PARSE_STATE_FIND_CELL,//0 CSV_PARSE_STATE_PARSE_CELL_WITH_QUOTES, CSV_PARSE_STATE_PARSE_CELL,//2 CSV_PARSE_STATE_LINE_END } csvparsestate_t; typedef struct { char *buffer; char **rows; int32_t rowCount; int32_t *cellCounts; } csv_t; char * csvGetCell(csv_t *csv, int32_t row, int32_t cell); void csvParse(char *string, csv_t *csv); void csvDispose(csv_t *csv);