From 00a92fa838520364cb02e71f6d9372f617aed57a Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Sun, 13 Nov 2016 18:59:54 +1100 Subject: Fixed bug in word count --- c_fl_text_buffer.cpp | 9 +++++++-- c_fl_text_buffer.h | 1 + fltk-text_buffers.adb | 19 +++++++++++++++++++ fltk-text_buffers.ads | 6 ++++++ 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/c_fl_text_buffer.cpp b/c_fl_text_buffer.cpp index a28286f..20699e8 100644 --- a/c_fl_text_buffer.cpp +++ b/c_fl_text_buffer.cpp @@ -71,11 +71,16 @@ void fl_text_buffer_select(TEXTBUFFER tb, int s, int e) { int fl_text_buffer_skip_lines(TEXTBUFFER tb, int s, int l) { - reinterpret_cast(tb)->skip_lines(s, l); + return reinterpret_cast(tb)->skip_lines(s, l); } int fl_text_buffer_rewind_lines(TEXTBUFFER tb, int s, int l) { - reinterpret_cast(tb)->rewind_lines(s, l); + return reinterpret_cast(tb)->rewind_lines(s, l); +} + + +unsigned int fl_text_buffer_char_at(TEXTBUFFER tb, int p) { + return reinterpret_cast(tb)->char_at(p); } diff --git a/c_fl_text_buffer.h b/c_fl_text_buffer.h index ed95a6d..0ee2e5a 100644 --- a/c_fl_text_buffer.h +++ b/c_fl_text_buffer.h @@ -24,6 +24,7 @@ extern "C" int fl_text_buffer_search_forward(TEXTBUFFER tb, int start, const cha extern "C" void fl_text_buffer_select(TEXTBUFFER tb, int s, int e); extern "C" int fl_text_buffer_skip_lines(TEXTBUFFER tb, int s, int l); extern "C" int fl_text_buffer_rewind_lines(TEXTBUFFER tb, int s, int l); +extern "C" unsigned int fl_text_buffer_char_at(TEXTBUFFER tb, int p); #endif diff --git a/fltk-text_buffers.adb b/fltk-text_buffers.adb index ab752ff..5db105d 100644 --- a/fltk-text_buffers.adb +++ b/fltk-text_buffers.adb @@ -96,6 +96,12 @@ package body FLTK.Text_Buffers is return Interfaces.C.int; pragma Import (C, fl_text_buffer_rewind_lines, "fl_text_buffer_rewind_lines"); + function fl_text_buffer_char_at + (TB : in System.Address; + P : in Interfaces.C.int) + return Interfaces.C.unsigned; + pragma Import (C, fl_text_buffer_char_at, "fl_text_buffer_char_at"); + @@ -376,5 +382,18 @@ package body FLTK.Text_Buffers is end Rewind_Lines; + + + function Character_At + (This : in Text_Buffer; + Pos : in Natural) + return Character is + begin + return Character'Val (fl_text_buffer_char_at + (This.Void_Ptr, + Interfaces.C.int (Pos))); + end Character_At; + + end FLTK.Text_Buffers; diff --git a/fltk-text_buffers.ads b/fltk-text_buffers.ads index 5b260d6..171fd84 100644 --- a/fltk-text_buffers.ads +++ b/fltk-text_buffers.ads @@ -105,6 +105,12 @@ package FLTK.Text_Buffers is return Natural; + function Character_At + (This : in Text_Buffer; + Pos : in Natural) + return Character; + + private -- cgit