@@ -13,18 +13,66 @@ It is distributed in the hope that it will be useful or harmful, it really depen | |||
/* | |||
void program_view_c_file (char * text_file, int width, int height, int x, int y) { | |||
char * text_data; | |||
curses_active = 1; | |||
text_data = file_record (text_file); | |||
while (curses_active != 0) { | |||
curses_render_background (' ', COLOUR_WHITE, EFFECT_NORMAL); | |||
curses_render_string (text_data, COLOUR_WHITE, EFFECT_NORMAL, x, x); | |||
curses_synchronize (); | |||
} | |||
text_data = deallocate (text_data); | |||
} | |||
*/ | |||
void program_view_c_file (char * text_file, int width, int height, int x, int y) { | |||
char * text_data; | |||
int reset_x = x; | |||
int reset_y = y; | |||
curses_active = 1; | |||
text_data = file_record (text_file); | |||
while (curses_active != 0) { | |||
int offset, colour, effect, string; | |||
curses_render_background (' ', COLOUR_WHITE, EFFECT_NORMAL); | |||
curses_render_string (text_data, COLOUR_WHITE, EFFECT_NORMAL, x, x); | |||
x = reset_x; | |||
y = reset_y; | |||
string = 0; | |||
colour = COLOUR_WHITE; | |||
effect = EFFECT_NORMAL; | |||
for (offset = 0; offset != string_length (text_data); ++offset) { | |||
switch (text_data [offset]) { | |||
case '"': | |||
string = ! string; | |||
colour = (string != 0) ? COLOUR_RED : COLOUR_WHITE; | |||
effect = (string != 0) ? EFFECT_BOLD : EFFECT_NORMAL; | |||
break; | |||
default: | |||
break; | |||
} | |||
curses_render_character (text_data [offset], colour, effect, x, y); | |||
switch (text_data [offset]) { | |||
case '\t': x += 8; break; | |||
case '\n': y += 1; x = reset_x; break; | |||
default: x += 1; break; | |||
} | |||
} | |||
curses_synchronize (); | |||
} | |||
@@ -14,17 +14,17 @@ gcc -g -Wall -Wextra -Wpedantic -O0 -c -o xhartae.o xhartae.c | |||
gcc -o xhartae xhartae.o chapter/chapter_0.o chapter/chapter_1.o chapter/chapter_2.o chapter/chapter_3.o chapter/chapter_4.o | |||
splint -weak -warnposix -retvalother -syntax -type chapter/chapter_0.h | |||
splint -weak -warnposix -retvalother -syntax -type chapter/chapter_0.c | |||
splint -weak -warnposix -retvalother -syntax -type chapter/chapter_1.h | |||
splint -weak -warnposix -retvalother -syntax -type chapter/chapter_1.c | |||
splint -weak -warnposix -retvalother -syntax -type chapter/chapter_2.h | |||
splint -weak -warnposix -retvalother -syntax -type chapter/chapter_2.c | |||
splint -weak -warnposix -retvalother -syntax -type chapter/chapter_3.h | |||
splint -weak -warnposix -retvalother -syntax -type chapter/chapter_3.c | |||
splint -weak -warnposix -retvalother -syntax -type chapter/chapter_4.h | |||
splint -weak -warnposix -retvalother -syntax -type chapter/chapter_4.c | |||
splint -weak -warnposix -retvalother -syntax -type xhartae.c | |||
#~splint -weak -warnposix -retvalother -syntax -type chapter/chapter_0.h | |||
#~splint -weak -warnposix -retvalother -syntax -type chapter/chapter_0.c | |||
#~splint -weak -warnposix -retvalother -syntax -type chapter/chapter_1.h | |||
#~splint -weak -warnposix -retvalother -syntax -type chapter/chapter_1.c | |||
#~splint -weak -warnposix -retvalother -syntax -type chapter/chapter_2.h | |||
#~splint -weak -warnposix -retvalother -syntax -type chapter/chapter_2.c | |||
#~splint -weak -warnposix -retvalother -syntax -type chapter/chapter_3.h | |||
#~splint -weak -warnposix -retvalother -syntax -type chapter/chapter_3.c | |||
#~splint -weak -warnposix -retvalother -syntax -type chapter/chapter_4.h | |||
#~splint -weak -warnposix -retvalother -syntax -type chapter/chapter_4.c | |||
#~splint -weak -warnposix -retvalother -syntax -type xhartae.c | |||
valgrind --show-leak-kinds=all --leak-check=full ./xhartae | |||