From 4293f5284971473afaa43b83075d4d985b976622 Mon Sep 17 00:00:00 2001 From: pommicket Date: Wed, 4 Jan 2023 13:06:13 -0500 Subject: more documentation --- base.h | 4 ---- buffer.c | 7 ++++--- build.c | 3 +++ colors.c | 2 ++ colors.h | 2 ++ command.c | 3 +++ command.h | 10 +++++----- config.c | 3 +-- find.c | 2 ++ gl.c | 3 +++ ide-autocomplete.c | 2 ++ ide-definitions.c | 3 +++ ide-highlights.c | 2 ++ ide-signature-help.c | 1 + ide-usages.c | 2 ++ lsp.c | 2 ++ main.c | 4 ++-- sdl-inc.h | 8 ++++++++ ted.h | 3 +-- 19 files changed, 48 insertions(+), 18 deletions(-) diff --git a/base.h b/base.h index c5a7f80..3f2e61c 100644 --- a/base.h +++ b/base.h @@ -12,10 +12,6 @@ #define _GNU_SOURCE #endif -#if DEBUG || __TINYC__ // speed up compile time on debug, also tcc doesn't have immintrin.h -#define SDL_DISABLE_IMMINTRIN_H -#endif - #if __GNUC__ #define FALLTHROUGH __attribute__((fallthrough)); #else diff --git a/buffer.c b/buffer.c index d34b6da..56afffc 100644 --- a/buffer.c +++ b/buffer.c @@ -1,10 +1,11 @@ -#include "ted.h" - - // Text buffers - These store the contents of a file. // NOTE: All text editing should be done through the two functions // buffer_insert_text_at_pos and buffer_delete_chars_at_pos +#include "ted.h" + + + // this is a macro so we get -Wformat warnings #define buffer_seterr(buffer, ...) \ snprintf(buffer->error, sizeof buffer->error - 1, __VA_ARGS__) diff --git a/build.c b/build.c index 0a40df8..56bc316 100644 --- a/build.c +++ b/build.c @@ -1,3 +1,6 @@ +// :build command +// also handles :shell. + #include "ted.h" void build_stop(Ted *ted) { diff --git a/colors.c b/colors.c index edd7de4..fe5aaad 100644 --- a/colors.c +++ b/colors.c @@ -1,3 +1,5 @@ +// color names and functions for dealing with colors + #include "ted.h" typedef struct { diff --git a/colors.h b/colors.h index cc5faa3..3d2d90f 100644 --- a/colors.h +++ b/colors.h @@ -1,3 +1,5 @@ +// colors enum. + #ifndef COLORS_H_ #define COLORS_H_ diff --git a/command.c b/command.c index 9ba6766..464f240 100644 --- a/command.c +++ b/command.c @@ -1,3 +1,6 @@ +// the main highlight here is command_execute, which +// determines what to do when a command is executed. + #include "ted.h" typedef struct { diff --git a/command.h b/command.h index 2713df8..c29f01d 100644 --- a/command.h +++ b/command.h @@ -1,12 +1,12 @@ +// command enum + #ifndef COMMAND_H_ #define COMMAND_H_ -#include "base.h" - -// i | ARG_STRING = ted->strings[i] +// `i | ARG_STRING` when used as an argument refers to `ted->strings[i]` #define ARG_STRING 0x4000000000000000 -ENUM_U16 { +typedef enum { CMD_UNKNOWN, CMD_NOOP, // do nothing // movement and selection commands @@ -113,7 +113,7 @@ ENUM_U16 { CMD_ESCAPE, // by default this is the escape key. closes menus, etc. CMD_COUNT -} ENUM_U16_END(Command); +} Command; #endif diff --git a/config.c b/config.c index e94e164..2257722 100644 --- a/config.c +++ b/config.c @@ -1,4 +1,4 @@ -// Read a configuration file. +// Read a ted configuration file. // Config files are formatted as several sections, each containing key = value pairs. // e.g.: // [section1] @@ -773,7 +773,6 @@ static void config_parse_line(ConfigReader *cfg, Settings *settings, const Confi if (command != CMD_UNKNOWN) { action->command = command; action->argument = argument; - action->line_number = cfg->line_number; } else { config_err(cfg, "Unrecognized command %s", value); } diff --git a/find.c b/find.c index 61f581b..a292e5c 100644 --- a/find.c +++ b/find.c @@ -1,3 +1,5 @@ +// handles ted's find and replace menu. + #include "ted.h" #include "pcre-inc.h" diff --git a/gl.c b/gl.c index e2cfc21..07871d7 100644 --- a/gl.c +++ b/gl.c @@ -1,3 +1,6 @@ +// various functions for dealing with OpenGL. +// also houses all of the basic rendering functions ted uses. + #include "ted.h" #include "lib/glcorearb.h" diff --git a/ide-autocomplete.c b/ide-autocomplete.c index 05f7844..39ee076 100644 --- a/ide-autocomplete.c +++ b/ide-autocomplete.c @@ -1,3 +1,5 @@ +// auto-completion for ted + #include "ted.h" #define TAGS_MAX_COMPLETIONS 200 // max # of tag completions to scroll through diff --git a/ide-definitions.c b/ide-definitions.c index 1518515..a6809b6 100644 --- a/ide-definitions.c +++ b/ide-definitions.c @@ -1,3 +1,6 @@ +// this file deals with ctrl+click "go to definition", and +// the definitions menu (Ctrl+D) + #include "ted.h" void definition_cancel_lookup(Ted *ted) { diff --git a/ide-highlights.c b/ide-highlights.c index e568820..424d640 100644 --- a/ide-highlights.c +++ b/ide-highlights.c @@ -1,3 +1,5 @@ +// highlight uses of identifier (LSP request textDocument/highlight) + #include "ted.h" void highlights_close(Ted *ted) { diff --git a/ide-signature-help.c b/ide-signature-help.c index e573f3e..e7138a8 100644 --- a/ide-signature-help.c +++ b/ide-signature-help.c @@ -1,4 +1,5 @@ // deals with textDocument/signatureHelp LSP requests +// this is the little thing which shows you the signature of the function and the current argument #include "ted.h" diff --git a/ide-usages.c b/ide-usages.c index 0bfdb05..806c09a 100644 --- a/ide-usages.c +++ b/ide-usages.c @@ -1,3 +1,5 @@ +// find usages of symbol + #include "ted.h" void usages_cancel_lookup(Ted *ted) { diff --git a/lsp.c b/lsp.c index 0b3b44b..877e56f 100644 --- a/lsp.c +++ b/lsp.c @@ -1,3 +1,5 @@ +// main file for dealing with LSP servers + #define LSP_INTERNAL 1 #include "lsp.h" #include "util.h" diff --git a/main.c b/main.c index 75bc97d..e896483 100644 --- a/main.c +++ b/main.c @@ -14,8 +14,8 @@ - when searching files, put exact matches at the top - auto-set build command for cmake (both for windows and unix) --- LSP MERGE --- -- some way of opening + closing all C files in directory for clangd workspace/symbols to work? - is this still necessary? +- some way of opening + closing all C files in directory for clangd + textDocument/references to work? - maybe it can be done with the clangd config instead. - CSS highlighting - styles ([color] sections) diff --git a/sdl-inc.h b/sdl-inc.h index a8a1624..1864eda 100644 --- a/sdl-inc.h +++ b/sdl-inc.h @@ -1,6 +1,14 @@ +// this file includes SDL.h. +// you should include this rather than including SDL.h directly. + #ifndef SDL_INC_H_ #define SDL_INC_H_ + +#if DEBUG || __TINYC__ // speed up compile time on debug, also tcc doesn't have immintrin.h +#define SDL_DISABLE_IMMINTRIN_H +#endif + no_warn_start #if _WIN32 #include diff --git a/ted.h b/ted.h index c62dac7..c7eb35a 100644 --- a/ted.h +++ b/ted.h @@ -115,8 +115,7 @@ enum { typedef struct KeyAction { u32 key_combo; - u32 line_number; // config line number where this was set - Command command; // this will be 0 (COMMAND_UNKNOWN) if there's no action for the key + Command command; i64 argument; } KeyAction; -- cgit v1.2.3