1with interfaces.c.strings;
2
3package body agar.gui.colors is
4  package cs renames interfaces.c.strings;
5
6  use type c.int;
7
8  package cbinds is
9    function load (path : cs.chars_ptr) return c.int;
10    pragma import (c, load, "AG_ColorsLoad");
11
12    function save (path : cs.chars_ptr) return c.int;
13    pragma import (c, save, "AG_ColorsSave");
14
15    function save_default return c.int;
16    pragma import (c, save_default, "AG_ColorsSaveDefault");
17  end cbinds;
18
19  function load (path : string) return boolean is
20    ca_path : aliased c.char_array := c.to_c (path);
21  begin
22    return cbinds.load (cs.to_chars_ptr (ca_path'unchecked_access)) = 0;
23  end load;
24
25  function save (path : string) return boolean is
26    ca_path : aliased c.char_array := c.to_c (path);
27  begin
28    return cbinds.save (cs.to_chars_ptr (ca_path'unchecked_access)) = 0;
29  end save;
30
31  function save_default return boolean is
32  begin
33    return cbinds.save_default = 0;
34  end save_default;
35
36end agar.gui.colors;
37