forked from xolatile/xhartae
Prototype for xyntax inclusion...
This commit is contained in:
parent
c24cd6b99e
commit
3cbe7ad8aa
@ -13,8 +13,6 @@ 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;
|
||||
|
||||
@ -32,4 +30,54 @@ void program_view_c_file (char * text_file, int width, int height, int x, int y)
|
||||
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);
|
||||
|
||||
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 ();
|
||||
}
|
||||
|
||||
text_data = deallocate (text_data);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
22
compile.sh
22
compile.sh
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user