diff options
author | pommicket <pommicket@gmail.com> | 2023-01-10 10:40:10 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-01-10 10:40:10 -0500 |
commit | b0fe15647d196081d801db574fa074ff77e46f5f (patch) | |
tree | 786d4b15493ab469811fc7cd139f5d664f414644 /development.md | |
parent | edd5188dfba93b8ffe376d0c194804f35f43dcaa (diff) |
linux build , etc.
Diffstat (limited to 'development.md')
-rw-r--r-- | development.md | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/development.md b/development.md index 8990218..a071b0d 100644 --- a/development.md +++ b/development.md @@ -2,12 +2,13 @@ ## Building -To build the debug version of `ted`, you will need ninja-build (package `ninja` on Debian/Ubuntu). -On Windows you don't need to install it since it comes with MSVC. Then run just `make` (or `make.bat`). +To build the debug version of ted, run `make` (or `make.bat` on Windows). -## Header files +## Files -TODO +Most function declarations should go in `ted.h`. +The exceptions are only for self-contained files, like `text.c`, +which gets its own header file `text.h`. As much as possible, OS-dependent functions should be put in `os.h/os-*.c`. (But "pure" functions like `qsort_with_context`, which could @@ -25,6 +26,11 @@ everyone the trouble...) ## Drawing +All drawing is done through either the `gl_geometry_*` functions or +the functions declared in `text.h`. +After using those functions, you need to call `gl_geometry_draw` +or `text_render` for it to actually be displayed. + ## Build details Currently, ted uses cmake for debug builds and plain old make (batch on windows) for @@ -40,9 +46,9 @@ or something. I don't like complicated build systems, and I'm only using cmake because it can -(through ninja) output `compile_commands.json` which is used for clangd. +output `compile_commands.json` which is needed for clangd. -Both `make.bat` and `Makefile` will run all the right cmake and ninja commands +Both `make.bat` and `make` will run all the right cmake and/or make and/or ninja commands for you (including generating `compile_commands.json`), so you shouldn't have to worry about that. @@ -55,11 +61,23 @@ When you add a source file to ted, make sure you: ## Adding settings +Find the `Settings` struct in `ted.h` and add the new member. +Then go to `config.c` and edit the `settings_<type>` array. + ## Adding commands +Go to `command.h` and add the command to the enum. Then +go to `command.c` and add the name of the command to the +`command_names` array, +and implement the command in the `command_execute` function. + ## Adding languages -## Syntax highlighting +Add a new member to the `Language` enum in `base.h`. +After that you should get a bunch of compiler warnings and errors +which will tell you what you need to add. + +### Syntax highlighting Obviously we don't want to re-highlight the whole file every time a change is made. Ideally, we would just re-highlight the line that was edited, but that might @@ -68,7 +86,9 @@ So we keep track of a "syntax state" for the start of each line (whether we're i whether we're in a multi-line string or not, etc.). A line's syntax highlighting can only change if it is edited, or if its syntax state changes. -## Adding LSP features +At the top of `syntax.c` there are a bunch of `SYNTAX_STATE_*` constants. +Create a new enum for your language, and add any state that needs to be remembered across lines. +Then implement the `syntax_highlight_<language>` function similar to the other ones. ## Releasing @@ -78,6 +98,6 @@ When releasing a new version of `ted`: - Update `Version` in `control` for the `.deb` file. - Run `make ted.deb` on Debian/Ubuntu. - Run `make.bat release` on Windows. -- Open installer project, and increment version number. +- Open installer project, and increase version number. - Build `ted.msi`. - Create a new release on GitHub with `ted.deb` and `ted.msi`. |