diff --git a/src/personal_finance_tool.adb b/src/personal_finance_tool.adb new file mode 100644 index 0000000..d7f7630 --- /dev/null +++ b/src/personal_finance_tool.adb @@ -0,0 +1,44 @@ +with Ada.Text_IO; use Ada.Text_IO; +with Interfaces.C; +with Interfaces.C.Strings; use Interfaces.C.Strings; +with Interfaces.C_Streams; use Interfaces.C_Streams; + +procedure Personal_Finance_Tool is + + type NCDirect_Struct is null record with Convention => C; + + type NCDirect is access NCDirect_Struct + with Convention => C; + + function Init return NCDirect is + + function NCDirect_Init( Term_Type : Chars_Ptr; FP : FILEs ) return NCDirect + with Import, Convention => C, External_Name => "ncdirect_init"; + + begin + + return NCDirect_Init( NULL_Ptr , stdout ); + + end Init; + + function NC_Stop( NC : NCDirect ) return Interfaces.C.Int + with Import, Convention => C, External_Name => "ncdirect_stop"; + + function FG_RGB( NC : NCDirect; RGB : Interfaces.C.Int ) return Interfaces.C.Int + with Import, Convention => C, External_Name => "ncdirect_set_fg_rgb"; + + Handle : NCDirect := Init; + +begin + + if Handle = null then + Put_Line("Cannot open notcurses connection"); + end if; + + Put_Line(FG_RGB(Handle, 16#e539dc#)'Image); + + Put_Line("Hello, World!"); + + Put_Line(NC_Stop(Handle)'Image); + +end Personal_Finance_Tool;