Update lmao...

This commit is contained in:
Ognjen Milan Robovic 2023-08-27 16:49:54 -04:00
parent 0ba334093c
commit d4b25781dc

View File

@ -24,8 +24,8 @@ static unsigned int select = FOREGROUND;
static int width = 0; static int width = 0;
static int height = 0; static int height = 0;
static int x = 4 * FONT_WIDTH + 2; static int x = 0;
static int y = 3 * FONT_HEIGHT + 2; static int y = 0;
static void export_render_as_png (char * file_path) { static void export_render_as_png (char * file_path) {
png_image image = { 0 }; png_image image = { 0 };
@ -132,32 +132,7 @@ static void render_character (char character) {
render [u * width + v] = glyph [i]; render [u * width + v] = glyph [i];
} }
x += FONT_WIDTH; x += FONT_WIDTH + 1;
}
static void render_line_number (void) {
static int line = 0;
int j = 0;
unsigned int z = select;
char c [] = " ";
select = FOREGROUND;
c [0] = (char) ((line / 1000) % 10) + '0';
c [1] = (char) ((line / 100) % 10) + '0';
c [2] = (char) ((line / 10) % 10) + '0';
c [3] = (char) ((line / 1) % 10) + '0';
for (j = 0; j != sizeof (c) - 1; ++j) {
render_character (c [j] - ' ');
}
select = z;
++x;
++line;
} }
static void render_string (char * string, int length) { static void render_string (char * string, int length) {
@ -167,9 +142,8 @@ static void render_string (char * string, int length) {
if (string [i] == '\t') { if (string [i] == '\t') {
x += FONT_WIDTH * TAB_WIDTH; x += FONT_WIDTH * TAB_WIDTH;
} else if (string [i] == '\n') { } else if (string [i] == '\n') {
y += FONT_HEIGHT; y += FONT_HEIGHT + 1;
x = 1; x = 1;
render_line_number ();
} else { } else {
render_character (string [i] - ' '); render_character (string [i] - ' ');
} }
@ -182,18 +156,6 @@ static void render_base (void) {
for (i = 0; i != width * height; ++i) { for (i = 0; i != width * height; ++i) {
render [i] = BACKGROUND; render [i] = BACKGROUND;
} }
for (i = 0; i != width; ++i) {
render [i ] = FOREGROUND;
render [i + (3 * FONT_HEIGHT + 1) * width] = FOREGROUND;
render [i + (height - 1) * width] = FOREGROUND;
}
for (i = 0; i != height; ++i) {
render [i * width ] = FOREGROUND;
render [i * width + 4 * FONT_WIDTH + 1] = FOREGROUND;
render [i * width + width - 1] = FOREGROUND;
}
} }
int main (void) { int main (void) {
@ -211,54 +173,32 @@ int main (void) {
"char", "short", "int", "long", "signed", "unsigned", "float", "double" "char", "short", "int", "long", "signed", "unsigned", "float", "double"
}; };
char * c_preprocessor [8] = { syntax_define (0, 0, 0, "#", "\n", '\\', TERMINAL_COLOUR_RED, TERMINAL_EFFECT_BOLD);
"#include", "#define", "#ifdef", "#ifndef", "#undef", "#elif", "#if", "#endif" syntax_define (0, 0, 0, "//", "\n", '\0', TERMINAL_COLOUR_GREY, TERMINAL_EFFECT_BOLD);
}; syntax_define (0, 0, 0, "/*", "*/", '\0', TERMINAL_COLOUR_GREY, TERMINAL_EFFECT_BOLD);
syntax_define (0, 0, 0, "'", "'", '\\', TERMINAL_COLOUR_PINK, TERMINAL_EFFECT_BOLD);
syntax_define (0, 0, 0, "#", "\n", '\\', TERMINAL_COLOUR_RED, TERMINAL_EFFECT_BOLD); syntax_define (0, 0, 0, "\"", "\"", '\\', TERMINAL_COLOUR_RED, TERMINAL_EFFECT_BOLD);
syntax_define (0, 0, 0, "//", "\n", '\0', TERMINAL_COLOUR_GREY, TERMINAL_EFFECT_BOLD); syntax_define (0, 1, 0, "()[]{}", "", '\0', TERMINAL_COLOUR_BLUE, TERMINAL_EFFECT_BOLD);
syntax_define (0, 0, 0, "/*", "*/", '\0', TERMINAL_COLOUR_GREY, TERMINAL_EFFECT_BOLD); syntax_define (0, 1, 0, ".,:;<=>+-*/%!&~^", "", '\0', TERMINAL_COLOUR_BLUE, TERMINAL_EFFECT_BOLD);
syntax_define (0, 0, 0, "'", "'", '\\', TERMINAL_COLOUR_PINK, TERMINAL_EFFECT_BOLD);
syntax_define (0, 0, 0, "\"", "\"", '\\', TERMINAL_COLOUR_RED, TERMINAL_EFFECT_BOLD);
syntax_define (0, 1, 0, "()[]{}", "", '\0', TERMINAL_COLOUR_GREEN, TERMINAL_EFFECT_BOLD);
syntax_define (0, 1, 0, ".,:;<=>+-*/%!&~^", "", '\0', TERMINAL_COLOUR_BLUE, TERMINAL_EFFECT_BOLD);
do { do {
syntax_define (0, 0, 1, c_keywords [word], separator, '\0', TERMINAL_COLOUR_YELLOW, TERMINAL_EFFECT_BOLD); syntax_define (0, 0, 1, c_keywords [word], separator, '\0', TERMINAL_COLOUR_YELLOW, TERMINAL_EFFECT_BOLD);
} while (++word != 32); } while (++word != 32);
word = 0;
do {
syntax_define (0, 0, 1, c_preprocessor [word], separator, '\0', TERMINAL_COLOUR_YELLOW, TERMINAL_EFFECT_NORMAL);
} while (++word != 8);
word = 0;
syntax_define (0, 1, 1, "0123456789", separator, '\0', TERMINAL_COLOUR_CYAN, TERMINAL_EFFECT_BOLD); syntax_define (0, 1, 1, "0123456789", separator, '\0', TERMINAL_COLOUR_CYAN, TERMINAL_EFFECT_BOLD);
/*syntax_define (0, 1, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", separator, '\0', TERMINAL_COLOUR_PINK, TERMINAL_EFFECT_ITALIC); /*syntax_define (0, 1, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", separator, '\0', TERMINAL_COLOUR_PINK, TERMINAL_EFFECT_ITALIC);
syntax_define (0, 1, 1, "abcdefghijklmnopqrstuvwxyz", separator, '\0', TERMINAL_COLOUR_WHITE, TERMINAL_EFFECT_ITALIC); syntax_define (0, 1, 1, "abcdefghijklmnopqrstuvwxyz", separator, '\0', TERMINAL_COLOUR_WHITE, TERMINAL_EFFECT_ITALIC);
syntax_define (0, 0, 1, "_", separator, '\0', TERMINAL_COLOUR_YELLOW, TERMINAL_EFFECT_ITALIC);*/ syntax_define (0, 0, 1, "_", separator, '\0', TERMINAL_COLOUR_YELLOW, TERMINAL_EFFECT_ITALIC);*/
buffer = record (); buffer = record ();
/**/
width = (fetch_width (buffer) + 4) * FONT_WIDTH + 3; width = fetch_width (buffer) * (FONT_WIDTH + 1) + 1;
height = (fetch_height (buffer) + 3) * FONT_HEIGHT + 3; height = fetch_height (buffer) * (FONT_HEIGHT + 1) + 1;
render = allocate (4 * width * height); render = allocate (4 * width * height);
render_base (); render_base ();
x = 2 + 5 * FONT_WIDTH;
y = 1 + FONT_HEIGHT;
render_string ("Xuxuxu - Ognjen 'xolatile' Milan Robovic", 40);
x = 1;
y = 2 + 3 * FONT_HEIGHT;
render_line_number ();
/**/
do { do {
int colour = 0; int colour = 0;
int effect = 0; int effect = 0;