From c91c49ab846603e332be8e6eacebcbbb0c45017d Mon Sep 17 00:00:00 2001 From: pommicket Date: Mon, 2 Jan 2023 14:37:21 -0500 Subject: clean some stuff up --- .gitignore | 1 + Makefile | 10 ++++------ base.h | 4 ++++ buffer.c | 1 + build.c | 2 +- ide-hover.c | 2 +- main.c | 1 - sdl-inc.h | 3 --- ted.h | 3 +-- 9 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 3cf8d93..bd51247 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ ted !windows_installer/ted/ted Debug Release +obj *~ *.swp tags diff --git a/Makefile b/Makefile index 3216aa0..836ea74 100644 --- a/Makefile +++ b/Makefile @@ -19,12 +19,10 @@ OBJECTS=obj/buffer.o obj/build.o obj/colors.o obj/command.o\ obj/syntax.o obj/tags.o obj/ted.o obj/text.o obj/ui.o obj/util.o ted: *.[ch] libpcre2-32.a $(OBJECTS) $(CC) $(OBJECTS) -o ted $(DEBUG_CFLAGS) $(LIBS) -obj/stb_%.o: stb_%.c obj - $(CC) -O3 -Wall $< -c -o $@ -obj/%.o: %.c *.h obj - $(CC) -Wall $< -c -o $@ $(DEBUG_CFLAGS) -obj: - mkdir obj +obj/stb_%.o: stb_%.c + mkdir -p obj && $(CC) -O3 -Wall $< -c -o $@ +obj/%.o: %.c *.h + mkdir -p obj && $(CC) -Wall $< -c -o $@ $(DEBUG_CFLAGS) release: *.[ch] libpcre2-32.a $(CC) main.c -o ted $(RELEASE_CFLAGS) $(LIBS) profile: *.[ch] libpcre2-32.a diff --git a/base.h b/base.h index 30d9b2c..92afc3e 100644 --- a/base.h +++ b/base.h @@ -9,6 +9,10 @@ #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 050676b..581a447 100644 --- a/buffer.c +++ b/buffer.c @@ -1,5 +1,6 @@ #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 diff --git a/build.c b/build.c index 6046b86..110a3c0 100644 --- a/build.c +++ b/build.c @@ -159,7 +159,7 @@ static int parse_nonnegative_integer(char32_t **str, char32_t *end) { // could this character (reasonably) appear in a source file path? static bool is_source_path(char32_t c) { const char *allowed_ascii_symbols_in_path = "./\\-_:"; - return c > CHAR_MAX || isalnum((char)c) + return c > CHAR_MAX || is32_alnum((wint_t)c) || strchr(allowed_ascii_symbols_in_path, (char)c); } diff --git a/ide-hover.c b/ide-hover.c index 254f56d..aed5dbd 100644 --- a/ide-hover.c +++ b/ide-hover.c @@ -67,7 +67,7 @@ void hover_process_lsp_response(Ted *ted, LSPResponse *response) { char *p = hover->text + strlen(hover->text) - 1; // remove trailing whitespace // (rust-analyzer gives us trailing newlines for local variables) - for (; p > hover->text && isspace(*p); --p) + for (; p > hover->text && strchr("\n \t", *p); --p) *p = '\0'; } } diff --git a/main.c b/main.c index 59db07b..8d3f28f 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,5 @@ /* @TODO: -- don't include SDL when possible - rename v[234] to vec[234] - make ctrl+up/ctrl+down move to next/prev blank line - broken session fix: close buffers not in any used node diff --git a/sdl-inc.h b/sdl-inc.h index 7bb613b..a8a1624 100644 --- a/sdl-inc.h +++ b/sdl-inc.h @@ -5,9 +5,6 @@ no_warn_start #if _WIN32 #include #else - #if DEBUG || __TINYC__ // speed up compile time on debug, also tcc doesn't have immintrin.h - #define SDL_DISABLE_IMMINTRIN_H - #endif #include #endif no_warn_end diff --git a/ted.h b/ted.h index 8445808..2481ee4 100644 --- a/ted.h +++ b/ted.h @@ -2,7 +2,6 @@ #define TED_H_ #include "base.h" -#include "sdl-inc.h" #include "util.h" #include "os.h" #include "unicode.h" @@ -12,6 +11,7 @@ #include "colors.h" #include "command.h" #include "lib/glcorearb.h" +#include "sdl-inc.h" #define TED_VERSION "2.0" #define TED_VERSION_FULL "ted v. " TED_VERSION @@ -95,7 +95,6 @@ ENUM_U8 { #define SYNTAX_CODE SYNTAX_PREPROCESSOR // for markdown #define SYNTAX_LINK SYNTAX_CONSTANT // for markdown - #define SCANCODE_MOUSE_X1 (SDL_NUM_SCANCODES) #define SCANCODE_MOUSE_X2 (SDL_NUM_SCANCODES+1) #define SCANCODE_COUNT (SDL_NUM_SCANCODES+2) -- cgit v1.2.3