calog/libs/calogCsv.h

20 lines
899 B
C

// calogCsv.h -- calog CSV library: parse and format RFC 4180 comma-separated values.
//
// csvParse(text: string [, delimiter: string]) -> list(list(string))
// Parse CSV into rows of string cells. Quoted cells ("...") may contain the delimiter,
// newlines, and doubled quotes (""). The optional delimiter is one byte (default ",").
// csvFormat(rows: list(list) [, delimiter: string]) -> string
// Format rows of cells into CSV (records joined by CRLF). A cell is a string, int, real,
// bool, or nil; any cell containing the delimiter, a quote, or a newline is quoted.
//
// Pure and dependency-free; the natives are inline (they run on the calling context's thread).
#ifndef CALOG_CSV_H
#define CALOG_CSV_H
#include "calog.h"
// Register the CSV natives on a runtime. Idempotent across runtimes (no shared state).
int32_t calogCsvRegister(CalogT *calog);
#endif