diff options
| author | nasr <nsrddyn@gmail.com> | 2026-03-11 20:54:06 +0000 |
|---|---|---|
| committer | nasr <nsrddyn@gmail.com> | 2026-03-11 20:54:06 +0000 |
| commit | ea3cab79d193f3421caddd5b3ef4aff6dc6f5361 (patch) | |
| tree | 86ee85585f3fbdf527920df0ce132e9ddafb594d | |
| parent | bcf4c2ebce03699110d13608999510c43fa959df (diff) | |
feature(main): project description + project owner
| -rw-r--r-- | source/csv_reader.h | 30 | ||||
| -rw-r--r-- | source/engine.c | 14 |
2 files changed, 21 insertions, 23 deletions
diff --git a/source/csv_reader.h b/source/csv_reader.h index 6c8e625..2b6f49c 100644 --- a/source/csv_reader.h +++ b/source/csv_reader.h | |||
| @@ -63,6 +63,9 @@ csv_table nil_csv_table = | |||
| 63 | }; | 63 | }; |
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | |||
| 67 | #endif /* ENGINE_LEXER_H */ | ||
| 68 | |||
| 66 | // the lexer acts as a table builder from a csv file | 69 | // the lexer acts as a table builder from a csv file |
| 67 | // and parsing indivudal rows and columns | 70 | // and parsing indivudal rows and columns |
| 68 | // the next step would be building a the b-tree | 71 | // the next step would be building a the b-tree |
| @@ -115,31 +118,24 @@ tokenize_csv(string8 buffer, mem_arena *arena) | |||
| 115 | } | 118 | } |
| 116 | 119 | ||
| 117 | internal void | 120 | internal void |
| 118 | strip_new_line(string8 buffer) | ||
| 119 | { | ||
| 120 | |||
| 121 | for (u64 index = 0; index < buffer.size; index++) | ||
| 122 | { | ||
| 123 | |||
| 124 | } | ||
| 125 | |||
| 126 | return; | ||
| 127 | |||
| 128 | } | ||
| 129 | |||
| 130 | internal void | ||
| 131 | read_csv(string8 buffer) | 121 | read_csv(string8 buffer) |
| 132 | { | 122 | { |
| 133 | // printf("\nsize:%lu\ndata %s\n", buffer.size, buffer.data); | 123 | // printf("\nsize:%lu\ndata %s\n", buffer.size, buffer.data); |
| 134 | 124 | ||
| 135 | } | 125 | } |
| 136 | 126 | ||
| 137 | internal csv_table * | 127 | internal b_tree * |
| 138 | parse_csv(token *tokens, csv_table *table) | 128 | parse_csv(csv_token *tok, csv_table *table) |
| 139 | { | 129 | { |
| 140 | 130 | ||
| 131 | |||
| 132 | for (;tok->next; tok = tok->next) | ||
| 133 | { | ||
| 134 | b_tree_node *current_btree_node = btree_node_alloc; | ||
| 135 | |||
| 136 | |||
| 137 | } | ||
| 138 | |||
| 141 | return NULL; | 139 | return NULL; |
| 142 | } | 140 | } |
| 143 | 141 | ||
| 144 | |||
| 145 | #endif /* ENGINE_LEXER_H */ | ||
diff --git a/source/engine.c b/source/engine.c index 67b5491..1cfbab0 100644 --- a/source/engine.c +++ b/source/engine.c | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | #define B_TREE_IMPLEMENTATION | ||
| 1 | #define BASE_UNITY | 2 | #define BASE_UNITY |
| 2 | #include "base/base_include.h" | 3 | #include "base/base_include.h" |
| 3 | 4 | ||
| @@ -29,10 +30,12 @@ internal b32 | |||
| 29 | is_delimiter(u8 point) | 30 | is_delimiter(u8 point) |
| 30 | { | 31 | { |
| 31 | return (point == ','); | 32 | return (point == ','); |
| 33 | |||
| 32 | } | 34 | } |
| 33 | 35 | ||
| 36 | |||
| 37 | #include "b_tree.h" | ||
| 34 | #include "csv_reader.h" | 38 | #include "csv_reader.h" |
| 35 | // #include "btree.h" | ||
| 36 | 39 | ||
| 37 | typedef struct query_token query_token; | 40 | typedef struct query_token query_token; |
| 38 | struct query_token | 41 | struct query_token |
| @@ -74,8 +77,6 @@ query_tokenizer(mem_arena *arena, string8 *buffer) | |||
| 74 | 77 | ||
| 75 | tok->next = tok; | 78 | tok->next = tok; |
| 76 | start = index + 1; | 79 | start = index + 1; |
| 77 | |||
| 78 | |||
| 79 | } | 80 | } |
| 80 | } | 81 | } |
| 81 | 82 | ||
| @@ -84,6 +85,7 @@ query_tokenizer(mem_arena *arena, string8 *buffer) | |||
| 84 | 85 | ||
| 85 | int main(int c, char **v) | 86 | int main(int c, char **v) |
| 86 | { | 87 | { |
| 88 | |||
| 87 | if(c < 2) | 89 | if(c < 2) |
| 88 | { | 90 | { |
| 89 | print("bad file, setting default file\n"); | 91 | print("bad file, setting default file\n"); |
| @@ -104,14 +106,14 @@ int main(int c, char **v) | |||
| 104 | if (running) | 106 | if (running) |
| 105 | { | 107 | { |
| 106 | { | 108 | { |
| 107 | u8 line_buffer[256] = {}; | 109 | u8 lbuf[256] = {}; |
| 108 | s32 err = os_read(STDIN_FD, line_buffer, 256); | 110 | s32 err = os_read(STDIN_FD, lbuf, 256); |
| 109 | if(err < 0) | 111 | if(err < 0) |
| 110 | { | 112 | { |
| 111 | print("error reading from stdin"); | 113 | print("error reading from stdin"); |
| 112 | } | 114 | } |
| 113 | 115 | ||
| 114 | query_tokenizer(global_arena, &StringLit(line_buffer)); | 116 | query_tokenizer(global_arena, &StringLit(lbuf)); |
| 115 | 117 | ||
| 116 | } | 118 | } |
| 117 | 119 | ||
