From: <as...@us...> - 2003-07-09 22:42:50
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/signals In directory sc8-pr-cvs1:/tmp/cvs-serv25460/gtk/signals Modified Files: HookGenerator.hs Signal.chs-boot1 Signal.chs-boot2 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: HookGenerator.hs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/signals/HookGenerator.hs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- HookGenerator.hs 18 Jan 2003 17:41:14 -0000 1.3 +++ HookGenerator.hs 9 Jul 2003 22:42:45 -0000 1.4 @@ -1,3 +1,4 @@ +{-# OPTIONS -cpp #-} -- HookGenerator.hs -*-haskell-*- -- Takes a type list of possible hooks from the GTK+ distribution and produces -- Haskell functions to connect to these callbacks. @@ -99,8 +100,8 @@ parseArg l (TokType ty: TokComma:rem) = let (args,rem') = parseArg l rem in (ty:args, rem') -parseArg l rem = error ("parse error on line "++show l++": expected type\ - \ followed by comma or EOL, found\n"++ +parseArg l rem = error ("parse error on line "++show l++": expected type"++ + " followed by comma or EOL, found\n "++ concatMap show (take 5 rem)) scan :: String -> [Token] @@ -388,13 +389,13 @@ usage = do - putStr "Program to generate callback hook for Gtk signals. Usage:\n\ - \HookGenerator <signatureFile> <bootPath> <outFile> [--broken]\n\ - \where\n\ - \ <signatureFile> is gtkmarshal.list from the the source Gtk+ tree\n\ - \ <bootPath> the path where Signal.chs-boot? file can be found\n\ - \ <outFile> is the name and path of the output file.\n\ - \ --broken do not ask for callbacks with more than 4 words/n" + putStr $ "Program to generate callback hook for Gtk signals. Usage:\n"++ + "HookGenerator <signatureFile> <bootPath> <outFile> [--broken]\n"++ + "where\n"++ + " <signatureFile> is gtkmarshal.list from the the source Gtk+ tree\n"++ + " <bootPath> the path where Signal.chs-boot? file can be found\n"++ + " <outFile> is the name and path of the output file.\n"++ + " --broken do not ask for callbacks with more than 4 words\n" exitWith $ ExitFailure 1 main = do @@ -434,7 +435,11 @@ indent 1.mkRawtype sig. indent 0. (if fakeSignature bs sig then id else indent 0.ss "foreign". +#if __GLASGOW_HASKELL__>=504 + ss " import ccall \"wrapper\" ").ss "mkHandler_".ident.ss " ::". +#else ss " export dynamic ").ss "mkHandler_".ident.ss " ::". +#endif indent 1.ss "Tag_".ident.ss " -> ". indent 1.ss "IO (FunPtr ".ss "Tag_".ident.sc ')'. (if fakeSignature bs sig then Index: Signal.chs-boot1 =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/signals/Signal.chs-boot1,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Signal.chs-boot1 24 Mar 2002 21:56:20 -0000 1.1.1.1 +++ Signal.chs-boot1 9 Jul 2003 22:42:45 -0000 1.2 @@ -1,3 +1,4 @@ +{-# OPTIONS -cpp #-} -- -*-haskell-*- -- ******************** automatically generated file - do not edit ************ -- Callback installers for the GIMP Toolkit (GTK) Binding for Haskell Index: Signal.chs-boot2 =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/signals/Signal.chs-boot2,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Signal.chs-boot2 10 Mar 2003 11:56:28 -0000 1.3 +++ Signal.chs-boot2 9 Jul 2003 22:42:45 -0000 1.4 @@ -5,8 +5,7 @@ ) where import Monad (liftM) -import Foreign -import UTFCForeign +import FFI import LocalData import GObject (objectRef, objectUnref) {#import Hierarchy#} @@ -25,7 +24,15 @@ {#pointer GClosureNotify#} +#if __GLASGOW_HASKELL__>=600 + +foreign import ccall "wrapper" mkDestructor :: IO () -> IO GClosureNotify + +#else + foreign export dynamic mkDestructor :: IO () -> IO GClosureNotify + +#endif disconnect :: GObjectClass obj => ConnectId obj -> IO () disconnect (ConnectID handler obj) = |