From 7b8b4d4495164250c71582347dd0338d387c4e98 Mon Sep 17 00:00:00 2001 From: pommicket Date: Thu, 7 Sep 2023 12:29:24 -0400 Subject: updat development.md, todo list --- development.md | 23 +++++++++++++++++++++++ main.c | 3 +++ 2 files changed, 26 insertions(+) diff --git a/development.md b/development.md index 205c843..fc23ee5 100644 --- a/development.md +++ b/development.md @@ -11,6 +11,29 @@ The big `Ted` struct has basically all of the data for ted. In general, fixed-size types such as `u32` should be preferred to `unsigned int` & co. +ted makes heavy use of “dynamic arrays” (basically, `std::vector` for C, +inspired by [stb_ds.h](https://github.com/nothings/stb/blob/master/stb_ds.h)) — +check out the `arr_*` functions in `ds.h`. Basic usage is like: + +```c +int *array = NULL; +for (int i = 0; i < 5; i++) { + arr_add(array, i); +} +arr_foreach_ptr(array, int, p) { + *p *= 2; +} +// prints 5 6 +printf("%d %d\n", arr_len(array), array[3]); +// prints the numbers 0, 2, 4, 6, 8 +arr_foreach_ptr(array, int, p) { + printf("%d\n", *p); +} +arr_free(array); +``` + +(the secret is that the length/capacity of the array is stored at `array[-8..-1]` so that +indexing works as expected.) ## Files diff --git a/main.c b/main.c index 86d3b86..e6bd506 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,7 @@ /* +TODO: +- LSP diagnostics +- gdscript syntax highlighting FUTURE FEATURES: - autodetect indentation (tabs vs spaces) - custom file/build command associations -- cgit v1.2.3