2023-10-03 10:36:14 -04:00
|
|
|
#include <xolatile/xtandard.c>
|
|
|
|
#include <xolatile/xyntax.c>
|
2023-10-01 15:09:40 -04:00
|
|
|
#include <xolatile/xlesses.c>
|
|
|
|
|
|
|
|
int main (void) {
|
2023-10-03 10:36:14 -04:00
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int offset;
|
|
|
|
int length;
|
|
|
|
int select;
|
|
|
|
char * buffer;
|
|
|
|
|
|
|
|
char separator [29] = ".,:;<=>+-*/%!&~^()[]{}'\" \t\r\n";
|
|
|
|
|
|
|
|
char * c_keywords [32] = {
|
|
|
|
"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"
|
|
|
|
};
|
|
|
|
|
|
|
|
(void) syntax_insert (0, 0, "#", " ", '\\', 0XCC33CC, 0);
|
|
|
|
(void) syntax_insert (0, 0, "/*", "*/", '\0', 0X333333, 0);
|
|
|
|
(void) syntax_insert (0, 0, "'", "'", '\\', 0XCC1133, 0);
|
|
|
|
(void) syntax_insert (0, 0, "\"", "\"", '\\', 0XCC1133, 0);
|
|
|
|
(void) syntax_insert (1, 0, ".,:;<=>+-*/%!&~^?|()[]{}", "", '\0', 0X1133CC, 0);
|
|
|
|
|
|
|
|
for (offset = 0; offset != 32; ++offset) {
|
|
|
|
(void) syntax_insert (0, 1, c_keywords [offset], separator, '\0', 0XCCCC33, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
(void) syntax_insert (1, 1, "0123456789", separator, '\0', 0X33CCCC, 0);
|
|
|
|
|
|
|
|
(void) syntax_insert (1, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_", separator, '\0', 0XCCCCCC, 0);
|
|
|
|
|
|
|
|
buffer = file_import ("./example/base.c");
|
|
|
|
|
2023-10-01 15:09:40 -04:00
|
|
|
blesses_initialize ();
|
|
|
|
|
|
|
|
while (blesses_active != 0) {
|
2023-10-03 10:36:14 -04:00
|
|
|
x = 0;
|
|
|
|
y = 0;
|
|
|
|
|
|
|
|
blesses_render_background_colour (0X111111);
|
|
|
|
|
|
|
|
for (offset = 0; buffer [offset] != '\0'; offset += length) {
|
|
|
|
select = syntax_select (& buffer [offset], & length);
|
|
|
|
|
|
|
|
if (y >= 50 * BLESSES_FONT_WIDTH) break;
|
|
|
|
|
|
|
|
blesses_render_string_limit (& buffer [offset], length, & x, & y, syntax_colour [select], 0X111111);
|
|
|
|
}
|
2023-10-01 15:09:40 -04:00
|
|
|
|
|
|
|
blesses_synchronize ();
|
|
|
|
}
|
|
|
|
|
|
|
|
blesses_deinitialize ();
|
|
|
|
|
2023-10-03 10:36:14 -04:00
|
|
|
buffer = deallocate (buffer);
|
|
|
|
|
|
|
|
syntax_delete ();
|
|
|
|
|
2023-10-01 15:09:40 -04:00
|
|
|
return (EXIT_SUCCESS);
|
|
|
|
}
|