This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef NC_STRETCHY_BUFFERS | |
| #define NC_STRETCHY_BUFFERS | |
| #include <stdlib.h> | |
| #include <cassert> | |
| // NOTE(Noah): Stretchy buffers adapated from the cryptic C code of https://nothings.org/stb/stretchy_buffer.txt | |
| // Stretchy buffers basically work like so: A block of memory is allocated to store the current count, total element size, | |
| // plus all the elements. The array pointer that was passed in originally is modified in place with the new element pointer, | |
| // which is offset by 2 in the allocated block (just after the count and total element size). | |
| // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef NC_TYPES_H | |
| #define NC_TYPES_H | |
| // TODO(Noah): Do we trust cstdint? | |
| #include <cstdint> | |
| typedef float float32_t; | |
| typedef double float64_t; | |
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // taken from https://www.gingerbill.org/article/2015/08/19/defer-in-cpp/ | |
| // How does code work? | |
| // call defer macro to evaluate our code as a defer statement. | |
| // code into defer macro can be an exp or a statement | |
| // defer statement is defining a var (of type privDefer) with some unique autogen name | |
| // code gets executed when var goes out of scope because code is slotted to execute | |
| // in destructor of privDefer type. | |
| template <typename F> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstdint> | |
| #include <functional> | |
| // TODO(Noah): Let's do some proper fast string functions, yeah? | |
| // TODO(Noah): Let's also unit test these functions, yeah? | |
| namespace nc { | |
| namespace str { | |
| enum get_line_result { | |
| NC_EOL, NC_EOF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| /* the following settings have been written manually, | |
| even if they were the VS Code default. */ | |
| // VERSION CONTROL SETTINGS. | |
| // only consider git repo when open the folder containing .git folder. | |
| "git.openRepositoryInParentFolders": "never", | |
| // do not ignore changes in leading or trailing whitespace. | |
| "diffEditor.ignoreTrimWhitespace": false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Place your key bindings in this file to override the defaults | |
| [ | |
| { | |
| "key": "ctrl+left", | |
| "command": "cursorWordLeft", | |
| "when": "textInputFocus" | |
| }, | |
| { | |
| "key": "ctrl+right", | |
| "command": "cursorWordRight", |