From: <as...@us...> - 2003-07-09 22:42:51
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/ornaments In directory sc8-pr-cvs1:/tmp/cvs-serv25460/gtk/ornaments Modified Files: Frame.chs HSeparator.chs VSeparator.chs Log Message: Make compile with GHC 6.00. There are two major changes in the FFI which made me separate everything that has to do with Foreign and Foreign.C into a new file called general/FFI.hs. The file UTFCForeign.hs is now obsolete as its string conversion functions are now in FFI.hs. The nullForeignPtr function is also located here. All files now import FFI instead of Foreign and UTFCForeign. The major changes are: newForeignPtr now takes a pointer to a C function as finalizer. Every destructor function is now defined differently depending on whether the new GHC is used or not. In particular there is now a function called free :: Ptr a -> IO () imported from the Foreign library. In addition to that I defined a function foreignFree which can be used as finalizer to a C data structure. It is equivalent to free if GHC version <=5.04 is used. The second change is that ForeignPtr are no longer accepted as arguments to foreign calls. This change is mainly reflected in c2hs, but also in some files which directly called functions. Index: Frame.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/ornaments/Frame.chs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Frame.chs 24 May 2002 09:43:25 -0000 1.2 +++ Frame.chs 9 Jul 2003 22:42:45 -0000 1.3 @@ -43,8 +43,8 @@ ) where import Monad (liftM) -import Foreign -import UTFCForeign +import FFI + import Object (makeNewObject) {#import Hierarchy#} {#import Signal#} @@ -65,7 +65,7 @@ -- @method frameSetLabel@ Replace the label of the frame. -- frameSetLabel :: FrameClass f => f -> String -> IO () -frameSetLabel f label = withCString label $ \strPtr -> +frameSetLabel f label = withUTFString label $ \strPtr -> {#call frame_set_label#} (toFrame f) strPtr -- @method frameSetLabelWidget@ Replace the label with a (label) widget. @@ -98,7 +98,7 @@ strPtr <- throwIfNull "frameGetLabel: the title of the frame was not a Label widget." $ {#call unsafe frame_get_label#} (toFrame f) - res <- peekCString strPtr + res <- peekUTFString strPtr {#call unsafe g_free#} (castPtr strPtr) return res Index: HSeparator.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/ornaments/HSeparator.chs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- HSeparator.chs 24 May 2002 09:43:25 -0000 1.2 +++ HSeparator.chs 9 Jul 2003 22:42:45 -0000 1.3 @@ -40,8 +40,8 @@ ) where import Monad (liftM) -import Foreign -import UTFCForeign +import FFI + import Object (makeNewObject) {#import Hierarchy#} {#import Signal#} Index: VSeparator.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/ornaments/VSeparator.chs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- VSeparator.chs 24 May 2002 09:43:25 -0000 1.2 +++ VSeparator.chs 9 Jul 2003 22:42:45 -0000 1.3 @@ -40,8 +40,8 @@ ) where import Monad (liftM) -import Foreign -import UTFCForeign +import FFI + import Object (makeNewObject) {#import Hierarchy#} {#import Signal#} |