]> git.xolatile.top Git - public-libhl.git/commitdiff
more logical syntax header ordering
authoranon <anon@anon.anon>
Thu, 24 Aug 2023 02:45:07 +0000 (04:45 +0200)
committeranon <anon@anon.anon>
Thu, 24 Aug 2023 02:45:07 +0000 (04:45 +0200)
config.mk
source/hl_c.inc [deleted file]
source/main.c
syntax/c.h [new file with mode: 0644]

index 9397d4ae802766dd8ac10b3bed0f659f11ca838d..517dfe6d7a5750102dc0d9d9f0acc01f4217f103 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -6,7 +6,7 @@
 PREFIX:=/usr/bin
 
 CFLAGS:=-std=c99
-CPPFLAGS:=-D_GNU_SOURCE -D_FORTIFY_SOURCE=2
+CPPFLAGS:=-Isyntax/ -D_GNU_SOURCE -D_FORTIFY_SOURCE=2
 
 DEBUG=1
 
diff --git a/source/hl_c.inc b/source/hl_c.inc
deleted file mode 100644 (file)
index 8ce987f..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-const char * c_keywords[] = {
-  "register",     "volatile",     "auto",         "const",        "static",       "extern",       "if",           "else",
-  "do",           "while",        "for",          "continue",     "switch",       "case",         "default",      "break",
-  "enum",         "union",        "struct",       "typedef",      "goto",         "void",         "return",       "sizeof",
-  "char",         "short",        "int",          "long",         "signed",       "unsigned",     "float",        "double",
-  NULL
-};
-
-const char * preprocessor_keywords[] = {
-  "#include",     "#pragma",      "#define",      "#undef",       "#ifdef",       "#ifndef",      "#elifdef",     "#elifndef",
-  "#if",          "#elif",        "#else",        "#endif",       "#embed",       "#line",        "#error",       "#warning",
-  NULL
-};
-
-new_char_tokens("&|()[]{}*,", symbol_hl);
-new_keyword_tokens(c_keywords, keyword_hl);
-new_keyword_tokens(preprocessor_keywords, preprocessor_hl);
index 7a7390e3b74f3ddf32e7612fe1c3ddcd9a01f3d2..4946dc54cffa4a84a35c945fc4114d1f5a954740 100644 (file)
@@ -36,7 +36,7 @@ int main(int      argc,
        // Highlight init
        terminal_hl_init();
        //
-       #include "hl_c.inc"
+       #include "c.h"
        //
        render_string(buffer, "cterm");
        putchar('\n');
diff --git a/syntax/c.h b/syntax/c.h
new file mode 100644 (file)
index 0000000..8ce987f
--- /dev/null
@@ -0,0 +1,17 @@
+const char * c_keywords[] = {
+  "register",     "volatile",     "auto",         "const",        "static",       "extern",       "if",           "else",
+  "do",           "while",        "for",          "continue",     "switch",       "case",         "default",      "break",
+  "enum",         "union",        "struct",       "typedef",      "goto",         "void",         "return",       "sizeof",
+  "char",         "short",        "int",          "long",         "signed",       "unsigned",     "float",        "double",
+  NULL
+};
+
+const char * preprocessor_keywords[] = {
+  "#include",     "#pragma",      "#define",      "#undef",       "#ifdef",       "#ifndef",      "#elifdef",     "#elifndef",
+  "#if",          "#elif",        "#else",        "#endif",       "#embed",       "#line",        "#error",       "#warning",
+  NULL
+};
+
+new_char_tokens("&|()[]{}*,", symbol_hl);
+new_keyword_tokens(c_keywords, keyword_hl);
+new_keyword_tokens(preprocessor_keywords, preprocessor_hl);