Removed predefined highlighting options...
This commit is contained in:
parent
7982bab9a4
commit
26f39b9af8
65
xyntax.c
65
xyntax.c
@ -11,65 +11,6 @@
|
|||||||
|
|
||||||
#include <xolatile/xyntax.h>
|
#include <xolatile/xyntax.h>
|
||||||
|
|
||||||
#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_count = 0;
|
||||||
int * syntax_mode = NULL;
|
int * syntax_mode = NULL;
|
||||||
int * syntax_enrange = NULL;
|
int * syntax_enrange = NULL;
|
||||||
@ -80,8 +21,6 @@ char * syntax_escape = NULL;
|
|||||||
int * syntax_colour = NULL;
|
int * syntax_colour = NULL;
|
||||||
int * syntax_effect = NULL;
|
int * syntax_effect = NULL;
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int compare_character_array (char character, char * character_array, int count) {
|
static int compare_character_array (char character, char * character_array, int count) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@ -94,7 +33,6 @@ static int compare_character_array (char character, char * character_array, int
|
|||||||
return (0);
|
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) {
|
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_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));
|
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;
|
++syntax_count;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void syntax_select (char * string, int * index, int * length) {
|
void syntax_select (char * string, int * index, int * length) {
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
@ -190,7 +127,6 @@ void syntax_select (char * string, int * index, int * length) {
|
|||||||
} while (string [offset - 1] != '\0');
|
} while (string [offset - 1] != '\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef XYNTAX_PREDEFINED_C_HIGHLIGHT
|
|
||||||
void syntax_delete (void) {
|
void syntax_delete (void) {
|
||||||
--syntax_count;
|
--syntax_count;
|
||||||
|
|
||||||
@ -208,6 +144,5 @@ void syntax_delete (void) {
|
|||||||
syntax_colour = deallocate (syntax_colour);
|
syntax_colour = deallocate (syntax_colour);
|
||||||
syntax_effect = deallocate (syntax_effect);
|
syntax_effect = deallocate (syntax_effect);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
17
xyntax.h
17
xyntax.h
@ -12,18 +12,6 @@
|
|||||||
#include <xolatile/xtandard.h>
|
#include <xolatile/xtandard.h>
|
||||||
#include <xolatile/xtandard.c>
|
#include <xolatile/xtandard.c>
|
||||||
|
|
||||||
#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_count;
|
||||||
extern int * syntax_mode;
|
extern int * syntax_mode;
|
||||||
extern int * syntax_enrange;
|
extern int * syntax_enrange;
|
||||||
@ -33,16 +21,11 @@ extern char * * syntax_end;
|
|||||||
extern char * syntax_escape;
|
extern char * syntax_escape;
|
||||||
extern int * syntax_colour;
|
extern int * syntax_colour;
|
||||||
extern int * syntax_effect;
|
extern int * syntax_effect;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef XYNTAX_PREDEFINED_C_HIGHLIGHT
|
|
||||||
extern void syntax_define (int *, int, int, char *, char *, char, int, int);
|
extern void syntax_define (int *, int, int, char *, char *, char, int, int);
|
||||||
#endif
|
|
||||||
|
|
||||||
extern void syntax_select (char *, int *, int *);
|
extern void syntax_select (char *, int *, int *);
|
||||||
|
|
||||||
#ifndef XYNTAX_PREDEFINED_C_HIGHLIGHT
|
|
||||||
extern void syntax_delete (void);
|
extern void syntax_delete (void);
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user