raw
ffa_ch4_ffacalc.kv      1 ------------------------------------------------------------------------------
ffa_ch4_ffacalc.kv 2 ------------------------------------------------------------------------------
ffa_ch4_ffacalc.kv 3 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
ffa_ch4_ffacalc.kv 4 -- --
ffa_ch4_ffacalc.kv 5 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
ffa_ch4_ffacalc.kv 6 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
ffa_ch4_ffacalc.kv 7 -- --
ffa_ch4_ffacalc.kv 8 -- You do not have, nor can you ever acquire the right to use, copy or --
ffa_ch4_ffacalc.kv 9 -- distribute this software ; Should you use this software for any purpose, --
ffa_ch4_ffacalc.kv 10 -- or copy and distribute it to anyone or in any manner, you are breaking --
ffa_ch4_ffacalc.kv 11 -- the laws of whatever soi-disant jurisdiction, and you promise to --
ffa_ch4_ffacalc.kv 12 -- continue doing so for the indefinite future. In any case, please --
ffa_ch4_ffacalc.kv 13 -- always : read and understand any software ; verify any PGP signatures --
ffa_ch4_ffacalc.kv 14 -- that you use - for any purpose. --
ffa_ch4_ffacalc.kv 15 -- --
ffa_ch4_ffacalc.kv 16 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
ffa_ch4_ffacalc.kv 17 ------------------------------------------------------------------------------
ffa_ch4_ffacalc.kv 18 ------------------------------------------------------------------------------
ffa_ch4_ffacalc.kv 19
ffa_ch4_ffacalc.kv 20 package body OS is
ffa_ch4_ffacalc.kv 21
ffa_ch4_ffacalc.kv 22 -- Receive a character from the TTY, and True if success (False if EOF)
ffa_ch4_ffacalc.kv 23 function Read_Char(C : out Character) return Boolean is
ffa_ch4_ffacalc.kv 24 i : int;
ffa_ch4_ffacalc.kv 25 Result : Boolean := False;
ffa_ch4_ffacalc.kv 26 begin
ffa_ch4_ffacalc.kv 27 i := GetChar;
ffa_ch4_ffacalc.kv 28 if i /= EOF then
ffa_ch4_ffacalc.kv 29 C := Character'Val(i);
ffa_ch4_ffacalc.kv 30 Result := True;
ffa_ch4_ffacalc.kv 31 end if;
ffa_ch4_ffacalc.kv 32 return Result;
ffa_ch4_ffacalc.kv 33 end Read_Char;
ffa_ch4_ffacalc.kv 34
ffa_ch4_ffacalc.kv 35
ffa_ch4_ffacalc.kv 36 -- Send a character to the TTY.
ffa_ch4_ffacalc.kv 37 procedure Write_Char(C : in Character) is
ffa_ch4_ffacalc.kv 38 R : int;
ffa_ch4_ffacalc.kv 39 pragma Unreferenced(R);
ffa_ch4_ffacalc.kv 40 begin
ffa_ch4_ffacalc.kv 41 R := PutChar(int(Character'Pos(C)));
ffa_ch4_ffacalc.kv 42 end Write_Char;
ffa_ch4_ffacalc.kv 43
ffa_ch4_ffacalc.kv 44
ffa_ch4_ffacalc.kv 45 -- Send a Newline to the TTY.
ffa_ch4_ffacalc.kv 46 procedure Write_Newline is
ffa_ch4_ffacalc.kv 47 begin
ffa_ch4_ffacalc.kv 48 Write_Char(Character'Val(16#A#));
ffa_ch4_ffacalc.kv 49 end Write_Newline;
ffa_ch4_ffacalc.kv 50
ffa_ch4_ffacalc.kv 51
ffa_ch11_tuning_a... 52 -- Send a String to the TTY.
ffa_ch11_tuning_a... 53 procedure Write_String(S : in String) is
ffa_ch11_tuning_a... 54 begin
ffa_ch11_tuning_a... 55 for i in S'Range loop
ffa_ch11_tuning_a... 56 Write_Char(S(i));
ffa_ch11_tuning_a... 57 end loop;
ffa_ch11_tuning_a... 58 end Write_String;
ffa_ch11_tuning_a... 59
ffa_ch11_tuning_a... 60
ffa_ch4_ffacalc.kv 61 -- Exit with an error condition report.
ffa_ch4_ffacalc.kv 62 procedure Eggog(M : String) is
ffa_ch4_ffacalc.kv 63 begin
ffa_ch4_ffacalc.kv 64 for i in 1 .. M'Length loop
ffa_ch4_ffacalc.kv 65 To_Stderr(M(I));
ffa_ch4_ffacalc.kv 66 end loop;
ffa_ch4_ffacalc.kv 67
ffa_ch4_ffacalc.kv 68 -- Emit LF
ffa_ch4_ffacalc.kv 69 To_Stderr(Character'Val(16#A#));
ffa_ch4_ffacalc.kv 70
ffa_ch4_ffacalc.kv 71 -- Exit
ffa_ch4_ffacalc.kv 72 Quit(Sadness_Code);
ffa_ch4_ffacalc.kv 73 end;
ffa_ch4_ffacalc.kv 74
ffa_ch4_ffacalc.kv 75 end OS;