From: <as...@us...> - 2003-07-09 22:42:51
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/windows In directory sc8-pr-cvs1:/tmp/cvs-serv25460/gtk/windows Modified Files: Dialog.chs FileSel.chs Window.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: Dialog.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/windows/Dialog.chs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Dialog.chs 10 Jan 2003 07:51:35 -0000 1.4 +++ Dialog.chs 9 Jul 2003 22:42:46 -0000 1.5 @@ -49,8 +49,8 @@ ) where import Monad (liftM) -import Foreign -import UTFCForeign +import FFI + import Object (makeNewObject) {#import Hierarchy#} {#import Signal#} @@ -96,7 +96,7 @@ -- * The function returns the Button that resulted from the call. -- dialogAddButton :: DialogClass dc => dc -> String -> ResponseId -> IO Button -dialogAddButton dc button resId = withCString button $ \strPtr -> +dialogAddButton dc button resId = withUTFString button $ \strPtr -> makeNewObject mkButton $ liftM castPtr $ {#call dialog_add_button#} (toDialog dc) strPtr (fromResponse resId) Index: FileSel.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/windows/FileSel.chs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- FileSel.chs 5 Aug 2002 16:41:35 -0000 1.4 +++ FileSel.chs 9 Jul 2003 22:42:46 -0000 1.5 @@ -45,8 +45,8 @@ ) where import Monad (liftM) -import Foreign -import UTFCForeign +import FFI + {#import Hierarchy#} import Object (makeNewObject) import Structs (fileSelectionGetButtons) @@ -62,7 +62,7 @@ -- fileSelectionNew :: String -> IO FileSelection fileSelectionNew title = do - withCString title $ \strPtr -> + withUTFString title $ \strPtr -> makeNewObject mkFileSelection $ liftM castPtr $ {#call unsafe file_selection_new#} strPtr @@ -71,7 +71,7 @@ -- fileSelectionSetFilename :: FileSelectionClass fsel => fsel -> String -> IO () fileSelectionSetFilename fsel str = - withCString str $ \strPtr -> + withUTFString str $ \strPtr -> {#call unsafe file_selection_set_filename#} (toFileSelection fsel) strPtr -- @method fileSelectionGetFilename@ Get the filename currently selected by @@ -82,7 +82,7 @@ do strPtr <- {#call unsafe file_selection_get_filename#} (toFileSelection fsel) - peekCString strPtr + peekUTFString strPtr -- @method fileSelectionShowFileopButtons@ Show the file operation buttons -- of the given file selection dialog. @@ -118,5 +118,5 @@ -- fileSelectionComplete :: FileSelectionClass fsel => fsel -> String -> IO () fileSelectionComplete fsel pattern = - withCString pattern $ \patternPtr -> + withUTFString pattern $ \patternPtr -> {#call file_selection_complete#} (toFileSelection fsel) patternPtr Index: Window.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/windows/Window.chs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Window.chs 5 Aug 2002 16:41:35 -0000 1.5 +++ Window.chs 9 Jul 2003 22:42:46 -0000 1.6 @@ -71,8 +71,8 @@ ) where import Monad (liftM) -import Foreign -import UTFCForeign +import FFI + import Enums (WindowType(WindowToplevel), WindowPosition(..)) import Object (makeNewObject) {#import Hierarchy#} @@ -93,7 +93,7 @@ -- windowSetTitle :: WindowClass w => w -> String -> IO () windowSetTitle w str = - withCString str ({#call window_set_title#} (toWindow w)) + withUTFString str ({#call window_set_title#} (toWindow w)) -- @method windowSetResizable@ Sets whether the user can resize a window. -- @@ -225,7 +225,7 @@ -- windowSetRole :: WindowClass w => w -> String -> IO () windowSetRole w str = - withCString str ({#call window_set_role#} (toWindow w)) + withUTFString str ({#call window_set_role#} (toWindow w)) -- @method windowStick@ show the window on every workspace -- |