diff -uNr a/ffa/fzclear/bin/README b/ffa/fzclear/bin/README --- a/ffa/fzclear/bin/README false +++ b/ffa/fzclear/bin/README 86525f2c7086039d79e5bf92869d02934a44716812433ca3a90e18a8d03745785c5ca54fe8c39e681b3b13c00c33a5128884a28c8cbaccbc65d0b401d901ec2e @@ -0,0 +1 @@ +Placeholder. diff -uNr a/ffa/fzclear/clear.adb b/ffa/fzclear/clear.adb --- a/ffa/fzclear/clear.adb false +++ b/ffa/fzclear/clear.adb 9fe53e9d30d1f506d6e102cd7774fbdec14b59086cc4600343378b1a41a561fdb506cb543f2437b05ec0cf346977ac7f57e44aab56d0c01a96ca509db772341e @@ -0,0 +1,7 @@ +with Clear_Mod; use Clear_Mod; + +procedure Clear is +begin + Clear_Procedure; + Print_Procedure; +end Clear; diff -uNr a/ffa/fzclear/clear_mod.adb b/ffa/fzclear/clear_mod.adb --- a/ffa/fzclear/clear_mod.adb false +++ b/ffa/fzclear/clear_mod.adb 52cd6079064570698b10e0342d05dde9bbe8d7366df056c57a00593858e7e5e324e03253282c91b68cb7989da1d8f7b28856af859025286c70bb1b6e393421d0 @@ -0,0 +1,44 @@ +with Ada.Text_IO; use Ada.Text_IO; + +-- From FFA: +with Words; use Words; +with FZ_Type; use FZ_Type; +with FZ_Arith; use FZ_Arith; + +-- FFA Ch. 2 +with FZ_Basic; use FZ_Basic; +with FFA_IO; use FFA_IO; + +package body Clear_Mod is + + procedure Clear_Procedure is + Z : FZ (0 .. 128); + begin + FZ_Set_Head (Z, 20); + FZ_Clear (Z); + Put_Line ("--- cleared: ---"); + Dump (Z); + New_Line; + FZ_Set_Head (Z, 22); + Z (2) := 16#DEAD#; + Z (3) := 16#FAAF#; + Z (4) := 16#1001#; + Z (100) := 16#0110#; + Z (128) := 16#F1F1#; + Dump (Z); + New_Line; + FZ_Clear (Z); + end Clear_Procedure; + + procedure Print_Procedure is + Z : FZ (0 .. 256); + Y : FZ (0 .. 132); + begin + --Dump(Z); + New_Line; + Dump (Y); + Put_Line ("--- <<<< ---"); + New_Line; + end Print_Procedure; + +end Clear_Mod; diff -uNr a/ffa/fzclear/clear_mod.ads b/ffa/fzclear/clear_mod.ads --- a/ffa/fzclear/clear_mod.ads false +++ b/ffa/fzclear/clear_mod.ads e81b26f62fc452a57409070a946e77b7a8735a382de526e4af841544530bfe18b1a437ded49e3ad7768f235534c5f8599ac3f6bc8820d530fe4342bff727a055 @@ -0,0 +1,4 @@ +package Clear_Mod is + procedure Clear_Procedure; + procedure Print_Procedure; +end Clear_Mod; Binary files a/ffa/fzclear/.demo_ch2.adb.swo and b/ffa/fzclear/.demo_ch2.adb.swo differ diff -uNr a/ffa/fzclear/ffa_io.adb b/ffa/fzclear/ffa_io.adb --- a/ffa/fzclear/ffa_io.adb false +++ b/ffa/fzclear/ffa_io.adb 6f98e204104ad3b8db78f082b7c125a96e8018bd0f52b5f002dfefc0e387811d0cfb29bc22bd1ebb4b442378e0bb9addd614318ca79e2dc7d2f513a7d5ad62e7 @@ -0,0 +1,58 @@ +------------------------------------------------------------------------------ +------------------------------------------------------------------------------ +-- This file is part of 'Finite Field Arithmetic', aka 'FFA'. -- +-- -- +-- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) -- +-- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html -- +-- -- +-- You do not have, nor can you ever acquire the right to use, copy or -- +-- distribute this software ; Should you use this software for any purpose, -- +-- or copy and distribute it to anyone or in any manner, you are breaking -- +-- the laws of whatever soi-disant jurisdiction, and you promise to -- +-- continue doing so for the indefinite future. In any case, please -- +-- always : read and understand any software ; verify any PGP signatures -- +-- that you use - for any purpose. -- +-- -- +-- See also http://trilema.com/2015/a-new-software-licensing-paradigm . -- +------------------------------------------------------------------------------ +------------------------------------------------------------------------------ + +with Ada.Text_IO; use Ada.Text_IO; + +with Words; use Words; +with W_Shifts; use W_Shifts; +with FZ_Type; use FZ_Type; + +package body FFA_IO is + + -- Obtain the WChars corresponding to the given Word + function W_To_WChars (N : Word) return WChars is + H : constant array (0 .. 15) of Character := "0123456789ABCDEF"; + W : Word := N; + Result : WChars; + begin + for b in WChars'Range loop -- From bottom to top: + Result (b) := H (Natural (W and 16#F#)); -- Get current nibble. + W := Shift_Right (W, 4); -- Get the next nibble. + end loop; + return Result; + end W_To_WChars; + + -- Display a hex representation of W to stdout + procedure Dump (W : in Word) is + T : WChars := W_To_WChars (W); + begin + for i in reverse T'Range loop + Put (T (i)); + end loop; + end Dump; + + -- Display a hex representation of N to stdout + procedure Dump (N : in FZ) is + begin + for i in reverse N'Range loop + Dump (N (i)); + end loop; + end Dump; + +end FFA_IO; diff -uNr a/ffa/fzclear/ffa_io.ads b/ffa/fzclear/ffa_io.ads --- a/ffa/fzclear/ffa_io.ads false +++ b/ffa/fzclear/ffa_io.ads db1b30ad8dbcee168cafb341389587c207730e898053093b051f02677ef918d26c67ba724e75599fbe5ad45ba0223551ffa3f6a1d1526fb5ae8a9bcc9eb2f044 @@ -0,0 +1,37 @@ +------------------------------------------------------------------------------ +------------------------------------------------------------------------------ +-- This file is part of 'Finite Field Arithmetic', aka 'FFA'. -- +-- -- +-- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) -- +-- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html -- +-- -- +-- You do not have, nor can you ever acquire the right to use, copy or -- +-- distribute this software ; Should you use this software for any purpose, -- +-- or copy and distribute it to anyone or in any manner, you are breaking -- +-- the laws of whatever soi-disant jurisdiction, and you promise to -- +-- continue doing so for the indefinite future. In any case, please -- +-- always : read and understand any software ; verify any PGP signatures -- +-- that you use - for any purpose. -- +-- -- +-- See also http://trilema.com/2015/a-new-software-licensing-paradigm . -- +------------------------------------------------------------------------------ +------------------------------------------------------------------------------ + +with Words; use Words; +with FZ_Type; use FZ_Type; + +package FFA_IO is + + -- Character representation of a Word + type WChars is array (1 .. 2 * Byteness) of Character; + + -- Obtain the WChars corresponding to the given Word + function W_To_WChars (N : Word) return WChars; + + -- Display a hex representation of W to stdout + procedure Dump (W : in Word); + + -- Display a hex representation of N to stdout + procedure Dump (N : in FZ); + +end FFA_IO; diff -uNr a/ffa/fzclear/fzclear.gpr b/ffa/fzclear/fzclear.gpr --- a/ffa/fzclear/fzclear.gpr false +++ b/ffa/fzclear/fzclear.gpr 98e6a6a5c5738d464d0f3b76f44b51bffedfa1153a259e59646d2a10cb87dc88a115e2bb59b289c0bcfd1e11c5adcbbec6a359a5433fca5755aff49036896095 @@ -0,0 +1,66 @@ +------------------------------------------------------------------------------ +------------------------------------------------------------------------------ +-- This file is part of 'Finite Field Arithmetic', aka 'FFA'. -- +-- -- +-- You do not have, nor can you ever acquire the right to use, copy or -- +-- distribute this software ; Should you use this software for any purpose, -- +-- or copy and distribute it to anyone or in any manner, you are breaking -- +-- the laws of whatever soi-disant jurisdiction, and you promise to -- +-- continue doing so for the indefinite future. In any case, please -- +-- always : read and understand any software ; verify any PGP signatures -- +-- that you use - for any purpose. -- +-- -- +-- See also http://trilema.com/2015/a-new-software-licensing-paradigm . -- +------------------------------------------------------------------------------ +------------------------------------------------------------------------------ + +with "../libffa/ffa.gpr"; + +project FZClear is + + for Object_Dir use "obj"; + + type Mode_Type is ("debug", "release"); + Mode : Mode_Type := external ("mode", "release"); + + for Languages use ("Ada"); + for Source_Dirs use ("."); + for Exec_Dir use "bin"; + for Main use ("clear.adb"); + + package Compiler is + case Mode is + when "debug" => + for Switches ("Ada") + use ("-g"); + when "release" => + for Switches ("Ada") + use ("-O3", "-gnatN", "-gnatwa", "-fstack-check", + "-fdata-sections", "-ffunction-sections"); + end case; + end Compiler; + + package Binder is + case Mode is + when "debug" => + for Switches ("Ada") + use (); + when "release" => + for Switches ("Ada") + use ("-static"); + end case; + end Binder; + + package Linker is + case Mode is + when "debug" => + for Switches ("Ada") + use (); + when "release" => + for Switches ("Ada") + use ("-Wl,--gc-sections", + "-static"); + end case; + end Linker; + +end FZClear; diff -uNr a/ffa/fzclear/obj/auto.cgpr b/ffa/fzclear/obj/auto.cgpr --- a/ffa/fzclear/obj/auto.cgpr false +++ b/ffa/fzclear/obj/auto.cgpr 79eafb828b5fa356c12d28599eceb9d74bc2b881834b7dba7e577fc3b36c3cd69655b9dd368484a3a654e8d9bba9b3861002cbec1fb1afb9fe6dcb0bcbc72578 @@ -0,0 +1,11 @@ +-- This gpr configuration file was generated by gprconfig +-- using this command line: +-- /usr/bin/gprconfig --batch -o /home/vanelteren/ADA/ffa-ch1/ch2/ffa/ffademo/obj/auto.cgpr --target=x86_64-linux -q --config=ada,, + +configuration project Default is + for Target use "x86_64-linux"; + for Archive_Builder use ("ar", "cr"); + for Archive_Builder_Append_Option use ("q"); + for Archive_Indexer use ("ranlib"); + for Archive_Suffix use ".a"; +end Default; diff -uNr a/ffa/fzclear/obj/README b/ffa/fzclear/obj/README --- a/ffa/fzclear/obj/README false +++ b/ffa/fzclear/obj/README 86525f2c7086039d79e5bf92869d02934a44716812433ca3a90e18a8d03745785c5ca54fe8c39e681b3b13c00c33a5128884a28c8cbaccbc65d0b401d901ec2e @@ -0,0 +1 @@ +Placeholder. diff -uNr a/ffa/fzclear/README b/ffa/fzclear/README --- a/ffa/fzclear/README false +++ b/ffa/fzclear/README 2008f2511e6fc98527ecb7969f9826a8db530f4a2bf0009c5cc71d98b2de25a31c7c03fa1e3da4525ee13b346baeed757bdf402c2155bdbd991f084231a8698d @@ -0,0 +1,37 @@ +------------------------------------------------------------------------------ +------------------------------------------------------------------------------ +-- You do not have, nor can you ever acquire the right to use, copy or -- +-- distribute this software ; Should you use this software for any purpose, -- +-- or copy and distribute it to anyone or in any manner, you are breaking -- +-- the laws of whatever soi-disant jurisdiction, and you promise to -- +-- continue doing so for the indefinite future. In any case, please -- +-- always : read and understand any software ; verify any PGP signatures -- +-- that you use - for any purpose. -- +-- -- +-- See also http://trilema.com/2015/a-new-software-licensing-paradigm . -- +------------------------------------------------------------------------------ +------------------------------------------------------------------------------ + +to clean: +gprclean + +to build: +gprbuild + +to build debug, or on crapple: +gprbuild -Xmode=debug + + +'libffa' will build recursively. + +to run: +./bin/clear + + +Output should look like this: +--- cleared: --- +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000F1F10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001001000000000000FAAF000000000000DEAD00000000000000000000000000000016 + +00007FFD19944970000000000040026800007FFD199449700000000000407178000000000000F1F10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001001000000000000FAAF000000000000DEAD00000000000000000000000000000016--- <<<< --- + diff -uNr a/ffa/libffa/fz_basic.adb b/ffa/libffa/fz_basic.adb --- a/ffa/libffa/fz_basic.adb 8bfdbf52890d298e1a0498bd632bedd8eeb9ee8bee80e2a2edd2897eaed8f77c93d45470946adb8c4d1e6c442dca343b11640d7bcd61ff06b7c68f7f462fd794 +++ b/ffa/libffa/fz_basic.adb 5d3639d328d53de49958a6f447bc7f3ad701d53ff9286f4ad76e9869015ec6e4423e8227b94c2363bc8c8b24194330340642307563910bbc4ac232e6954831ed @@ -12,7 +12,6 @@ begin N := (others => 0); end FZ_Clear; - pragma Inline_Always(FZ_Clear); -- First word of N := Source diff -uNr a/ffa/libffa/fz_basic.ads b/ffa/libffa/fz_basic.ads --- a/ffa/libffa/fz_basic.ads 34985b726106bd8cdfc6bfe8e85e96b884f4d7b5bb8dfbd0a9911f1913dfc67d246487104dcf8cdce5940ecf2ed94da0d6e26745b57818de558fbd4e2a609437 +++ b/ffa/libffa/fz_basic.ads bdbef59aa8c9b8cd31d9ae1a0044deb825511bbb748051253a32a0b74743e9d592b888cc1158f93f48d407ca1412c90233ead74109afe512c9c57d8564b0dfd0 @@ -8,6 +8,7 @@ -- N := 0 procedure FZ_Clear(N : out FZ); + pragma Inline_Always(FZ_Clear); -- First word of N := Source procedure FZ_Set_Head(N : out FZ; Source : in Word); Binary files a/ffa/libffa/.fz_basic.ads.swp and b/ffa/libffa/.fz_basic.ads.swp differ diff -uNr a/ffa/README b/ffa/README --- a/ffa/README 9af33f9bacae3ae188a80e4ff671838832a4c198d6cef9e3ec6b81acc547e8573d225e7fef75ced68e5cfe80e60da11d996343b6580107d849bc66ab00bc9dd8 +++ b/ffa/README c80f1ac39b5e9b03d5b14940d7c862a76b85debf66ae111b667d2ab466519e6087cf87995c5768151c5fd936a13ce0c365c02d2d1db67d66c961eb18898ed171 @@ -26,3 +26,5 @@ http://webchat.freenode.net/?channels=#trilema&nick=from_ffa Privmsg one of the people speaking and ask politely for 'voice'. + +See contents of 'clear' for the fz_clear experiment.