Axel Simon <axel.si...@ens.fr> writes: > On Sep 30, 2009, at 16:27, Andy Stewart wrote: > >> Today, i see function `gtk_text_buffer_get_bounds` document: >> >> ------------------------------> document start >> <------------------------------ >> /** >> * gtk_text_buffer_get_bounds: >> * @buffer: a #GtkTextBuffer >> * @start: iterator to initialize with first position in the buffer >> * @end: iterator to initialize with the end iterator >> * >> * Retrieves the first and last iterators in the buffer, i.e. the >> * entire buffer lies within the range [...@start,@end). >> * >> **/ >> void >> gtk_text_buffer_get_bounds (GtkTextBuffer *buffer, >> GtkTextIter *start, >> GtkTextIter *end) >> ... >> ------------------------------> document end >> <------------------------------ >> >> So textBufferGetBounds should be >> >> "TextBufferClass self => self -> IO (TextIter, TextIter)", >> >> and not current type signature >> >> "TextBufferClass self => self -> TextIter -> TextIter -> IO ()" >> >> return type `IO ()` doesn't make any sense. > > True. > >> >> Below is my new implementation of `textBufferGetBounds`: >> >> ------------------------------> implement start >> <------------------------------ >> textBufferGetBounds :: TextBufferClass self => self -> IO >> (TextIter, TextIter) >> textBufferGetBounds self = do >> start <- makeEmptyTextIter >> end <- makeEmptyTextIter >> {# call unsafe text_buffer_get_bounds #} >> (toTextBuffer self) >> start >> end >> return (start, end) >> ------------------------------> implement end >> <------------------------------ >> >> What do you think? >> >> -- Andy >> > > That's not better. Try: > > textBufferGetBounds :: TextBufferClass self => self -> IO (TextIter, > TextIter) > textBufferGetBounds self = alloca \startPtr -> alloca \endIter -> do > {# call unsafe text_buffer_get_bounds #} > (toTextBuffer self) > startIter > endIter > start <- peek startIter > end <- peek endIter > return (start, end) Hmm, looks TextBuffer.chs.pp need change manay Because many funcitons use `makeEmptyTextIter`.
I will send you new patch soon. -- Andy ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Gtk2hs-devel mailing list Gtk2hs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel