diff --git a/xyntax.c b/xyntax.c index f82010a..4aca4a3 100644 --- a/xyntax.c +++ b/xyntax.c @@ -11,65 +11,6 @@ #include -#ifdef XYNTAX_PREDEFINED_C_HIGHLIGHT - -int syntax_count = SYNTAX_C_COUNT; - -int syntax_mode [SYNTAX_C_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -int syntax_enrange [SYNTAX_C_COUNT] = { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1 }; -int syntax_derange [SYNTAX_C_COUNT] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; - -char * syntax_begin [SYNTAX_C_COUNT] = { - "#", "//", "/*", "'", "\"", "()[]{}.,:;<=>+-*/%!&~^?|", - "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", - "0123456789", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz" -}; - -char * syntax_end [SYNTAX_C_COUNT] = { - "\n", "\n", "*/", "'", "\"", "", - ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", - ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", - ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", - ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", - ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", - ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", - ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", - ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", - ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n", ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n" -}; - -char syntax_escape [SYNTAX_C_COUNT] = { - '\\', '\0', '\0', '\\', '\\', '\0', - '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', - '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', - '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', - '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', - '\0', '\0', '\0' -}; - -int syntax_colour [SYNTAX_C_COUNT] = { - COLOUR_RED, COLOUR_GREY, COLOUR_GREY, COLOUR_RED, COLOUR_RED, COLOUR_BLUE, - COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, - COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, - COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, - COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, COLOUR_BLUE, - COLOUR_PINK, COLOUR_PINK, COLOUR_WHITE -}; - -int syntax_effect [SYNTAX_C_COUNT] = { - EFFECT_NORMAL, EFFECT_BOLD, EFFECT_BOLD, EFFECT_BOLD, EFFECT_NORMAL, EFFECT_BOLD, - EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, - EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, - EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, - EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, EFFECT_NORMAL, - EFFECT_BOLD, EFFECT_NORMAL, EFFECT_ITALIC -}; - -#else - int syntax_count = 0; int * syntax_mode = NULL; int * syntax_enrange = NULL; @@ -80,8 +21,6 @@ char * syntax_escape = NULL; int * syntax_colour = NULL; int * syntax_effect = NULL; -#endif - static int compare_character_array (char character, char * character_array, int count) { int i = 0; @@ -94,7 +33,6 @@ static int compare_character_array (char character, char * character_array, int return (0); } -#ifndef XYNTAX_PREDEFINED_C_HIGHLIGHT void syntax_define (int * index, int enrange, int derange, char * begin, char * end, char escape, int colour, int effect) { syntax_mode = reallocate (syntax_mode, (unsigned long int) (syntax_count + 1) * sizeof (* syntax_mode)); syntax_enrange = reallocate (syntax_enrange, (unsigned long int) (syntax_count + 1) * sizeof (* syntax_enrange)); @@ -122,7 +60,6 @@ void syntax_define (int * index, int enrange, int derange, char * begin, char * ++syntax_count; } -#endif void syntax_select (char * string, int * index, int * length) { int offset = 0; @@ -190,7 +127,6 @@ void syntax_select (char * string, int * index, int * length) { } while (string [offset - 1] != '\0'); } -#ifndef XYNTAX_PREDEFINED_C_HIGHLIGHT void syntax_delete (void) { --syntax_count; @@ -208,6 +144,5 @@ void syntax_delete (void) { syntax_colour = deallocate (syntax_colour); syntax_effect = deallocate (syntax_effect); } -#endif #endif diff --git a/xyntax.h b/xyntax.h index eef664a..784b1c7 100644 --- a/xyntax.h +++ b/xyntax.h @@ -12,18 +12,6 @@ #include #include -#ifdef XYNTAX_PREDEFINED_C_HIGHLIGHT -#define SYNTAX_C_COUNT (41) -extern int syntax_count; -extern int syntax_mode [SYNTAX_C_COUNT]; -extern int syntax_enrange [SYNTAX_C_COUNT]; -extern int syntax_derange [SYNTAX_C_COUNT]; -extern char * syntax_begin [SYNTAX_C_COUNT]; -extern char * syntax_end [SYNTAX_C_COUNT]; -extern char syntax_escape [SYNTAX_C_COUNT]; -extern int syntax_colour [SYNTAX_C_COUNT]; -extern int syntax_effect [SYNTAX_C_COUNT]; -#else extern int syntax_count; extern int * syntax_mode; extern int * syntax_enrange; @@ -33,16 +21,11 @@ extern char * * syntax_end; extern char * syntax_escape; extern int * syntax_colour; extern int * syntax_effect; -#endif -#ifndef XYNTAX_PREDEFINED_C_HIGHLIGHT extern void syntax_define (int *, int, int, char *, char *, char, int, int); -#endif extern void syntax_select (char *, int *, int *); -#ifndef XYNTAX_PREDEFINED_C_HIGHLIGHT extern void syntax_delete (void); -#endif #endif