Okay, it works, time to refactor it...

This commit is contained in:
Ognjen Milan Robovic 2024-05-13 06:54:57 -04:00
parent 521ce5dd0b
commit ec45e7c1e4
2 changed files with 13 additions and 8 deletions

View File

@ -202,7 +202,7 @@ begin
cursor_mode := 0; cursor_mode := 0;
xxx := import_text ("./source/attribute.ads"); xxx := import_text ("./source/skill.ads");
main_menu_loop: loop main_menu_loop: loop
synchronize; synchronize;

View File

@ -601,18 +601,23 @@ package body ui is
case buffer is case buffer is
when character'val (9) => offset.x := offset.x + 2 * width; when character'val (9) => offset.x := offset.x + 2 * width;
when character'val (10) => offset.y := offset.y + 1 * height; offset.x := x; when character'val (10) => offset.y := offset.y + 1 * height; offset.x := x;
when ':' | ';' | '+' | '*' | '/' | '.' | ',' | '(' | ')' | ''' | '=' | '<' | '>' => when ':' | ';' | '.' | ',' | '=' | '<' | '>' =>
ui.write (buffer & "", offset.x, offset.y, ( 0, 255, 255, 255), height, code => true); ui.write (buffer & "", offset.x, offset.y, (63, 127, 255, 255), height, code => true);
when '+' | '*' | '/' | '|' | '&' =>
ui.write (buffer & "", offset.x, offset.y, (63, 63, 255, 255), height, code => true);
when '(' | ')' | ''' =>
ui.write (buffer & "", offset.x, offset.y, (63, 255, 255, 255), height, code => true);
when '"' => when '"' =>
ui.write (buffer & "", offset.x, offset.y, (255, 127, 255, 255), height, code => true); ui.write (buffer & "", offset.x, offset.y, (127, 63, 127, 255), height, code => true);
offset.x := offset.x + width; offset.x := offset.x + width;
loop loop
core.increment (length); core.increment (length);
buffer := ada.strings.unbounded.element (text.text, length); buffer := ada.strings.unbounded.element (text.text, length);
ui.write (buffer & "", offset.x, offset.y, (255, 127, 255, 255), height, code => true); ui.write (buffer & "", offset.x, offset.y, (127, 63, 127, 255), height, code => true);
offset.x := offset.x + width; offset.x := offset.x + width;
exit when buffer = '"'; exit when buffer = '"';
end loop; end loop;
offset.x := offset.x - width;
when '-' => when '-' =>
if ada.strings.unbounded.element (text.text, length + 1) = '-' then if ada.strings.unbounded.element (text.text, length + 1) = '-' then
ui.write (buffer & "", offset.x, offset.y, (127, 127, 127, 255), height, code => true); ui.write (buffer & "", offset.x, offset.y, (127, 127, 127, 255), height, code => true);
@ -626,11 +631,11 @@ package body ui is
end loop; end loop;
core.decrement (length); core.decrement (length);
else else
ui.write (buffer & "", offset.x, offset.y, ( 0, 255, 255, 255), height, code => true); ui.write (buffer & "", offset.x, offset.y, (63, 63, 255, 255), height, code => true);
end if; end if;
when '0' .. '9' => when '0' .. '9' =>
loop loop
ui.write (buffer & "", offset.x, offset.y, (0, 0, 255, 255), height, code => true); ui.write (buffer & "", offset.x, offset.y, (127, 63, 255, 255), height, code => true);
core.increment (length); core.increment (length);
buffer := ada.strings.unbounded.element (text.text, length); buffer := ada.strings.unbounded.element (text.text, length);
exit when buffer = ' ' or buffer = ';' or buffer = ')' or buffer = ','; exit when buffer = ' ' or buffer = ';' or buffer = ')' or buffer = ',';
@ -650,7 +655,7 @@ package body ui is
if word = "type" or word = "begin" or word = "end" or word = "when" or word = "others" or word = "procedure" or word = "function" if word = "type" or word = "begin" or word = "end" or word = "when" or word = "others" or word = "procedure" or word = "function"
or word = "package" or word = "body" or word = "if" or word = "then" or word = "else" or word = "elsif" or word = "case" or word = "is" or word = "package" or word = "body" or word = "if" or word = "then" or word = "else" or word = "elsif" or word = "case" or word = "is"
or word = "and" or word = "or" or word = "xor" or word = "exit" or word = "constant" or word = "access" or word = "range" or word = "and" or word = "or" or word = "xor" or word = "exit" or word = "constant" or word = "access" or word = "range"
or word = "subtype" or word = "array" or word = "in" or word = "out" or word = "return" or word = "for" or word = "subtype" or word = "array" or word = "in" or word = "out" or word = "return" or word = "for" or word = "with"
or word = "loop" or word = "while" or word = "of" or word = "null" or word = "record" or word = "use" or word = "mod" or word = "new" or word = "loop" or word = "while" or word = "of" or word = "null" or word = "record" or word = "use" or word = "mod" or word = "new"
--~or word = "" --~or word = ""
--~or word = "" --~or word = ""