diff options
| author | Jed Barber <jjbarber@y7mail.com> | 2016-05-27 04:03:00 +1000 | 
|---|---|---|
| committer | Jed Barber <jjbarber@y7mail.com> | 2016-05-27 04:03:00 +1000 | 
| commit | 32062c660307d5b34f46b1f7b75d17a184930e71 (patch) | |
| tree | 6ab33672207fdef5b500e5a0bfded5190f05e79e /fltk-text_buffers.adb | |
| parent | 2aac034b614d6de39f4aee9f41dba8f2bcc63d8d (diff) | |
Text buffers, access types and line lengths
Diffstat (limited to 'fltk-text_buffers.adb')
| -rw-r--r-- | fltk-text_buffers.adb | 50 | 
1 files changed, 50 insertions, 0 deletions
| diff --git a/fltk-text_buffers.adb b/fltk-text_buffers.adb new file mode 100644 index 0000000..12a6a73 --- /dev/null +++ b/fltk-text_buffers.adb @@ -0,0 +1,50 @@ + + +with Interfaces.C; +with System; +use type System.Address; + + +package body FLTK.Text_Buffers is + + +    function new_fl_text_buffer +           (RS, PGS : in Interfaces.C.int) +        return System.Address; +    pragma Import (C, new_fl_text_buffer, "new_fl_text_buffer"); + +    procedure free_fl_text_buffer +           (TB : in System.Address); +    pragma Import (C, free_fl_text_buffer, "free_fl_text_buffer"); + + + + +    procedure Finalize +           (This : in out Text_Buffer) is +    begin +        if (This.Void_Ptr /= System.Null_Address) then +            free_fl_text_buffer (This.Void_Ptr); +        end if; +    end Finalize; + + + + +    function Create +           (Requested_Size     : in Natural := 0; +            Preferred_Gap_Size : in Natural := 1024) +        return Text_Buffer is + +        VP : System.Address; + +    begin +        VP := new_fl_text_buffer +                   (Interfaces.C.int (Requested_Size), +                    Interfaces.C.int (Preferred_Gap_Size)); +        return (Ada.Finalization.Limited_Controlled with Void_Ptr => VP); +    end Create; + + +end FLTK.Text_Buffers; + | 
