From 71ced998122c357bc62e54d9bb4e124c88acf94b Mon Sep 17 00:00:00 2001 From: nasr Date: Sun, 8 Mar 2026 21:01:43 +0000 Subject: refactor(main): worked on string handling in C and other stuff --- source/csv_parser.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 source/csv_parser.h (limited to 'source/csv_parser.h') diff --git a/source/csv_parser.h b/source/csv_parser.h new file mode 100644 index 0000000..1aa96b9 --- /dev/null +++ b/source/csv_parser.h @@ -0,0 +1,40 @@ +#ifndef CSV_PARSER_H +#define CSV_PARSER_H + +typedef struct csv_row csv_row; +struct csv_row +{ + // array of size col_count, points into mmap buffer + string8 *fields; + s32 count; +}; + +typedef struct csv_table csv_table; +struct csv_table +{ + // first row, col names + // all data rows + string8 *headers; + csv_row *rows; + s32 col_count; + s32 row_count; +}; + +read_only global_variable +csv_row nil_csv_row = +{ + .fields = &nil_string, + .count = 0, +}; + +read_only global_variable +csv_table nil_csv_table = +{ + .headers = &nil_string, + .rows = &nil_csv_row, + .col_count = 0, + .row_count = 0, +}; + + +#endif /* CSV_PARSER_H */ -- cgit v1.3