qforeign-0.62

Fergus Henderson fjh at cs.mu.oz.au
Tue Nov 28 07:19:57 EST 2000


On 28-Nov-2000, Simon Marlow <simonmar at microsoft.com> wrote:
> > qrczak at knm.org.pl (Marcin 'Qrczak' Kowalczyk) wrote,
> > >     -- Wrappers that convert the result to a possible exception.
> > >     -- *_EINTR variants repeat the action if there was an error
> > >     -- and errno == EINTR.
> > >     throwIf       :: (a -> Bool) -> String -> IO a -> IO a
> > >     throwIf_EINTR :: (a -> Bool) -> String -> IO a -> IO a
> > > 
> > >     throwIfMinus1       :: Num a => String -> IO a -> IO a
> > >     throwIfMinus1_EINTR :: Num a => String -> IO a -> IO a
> > >     throwIfNull         :: String -> IO (Ptr a) -> IO (Ptr a)
> > >     throwIfNull_EINTR   :: String -> IO (Ptr a) -> IO (Ptr a)
> > 
> > Again, this belongs into the higher-level marshalling
> > library.  Did you have a look at the corresponding routines
> > in C2HS?
> 
> Your ifRaise family is fairly similar (except that it doesn't deal
> explicitly with C's errno and EINTR).  I don't particularly mind what
> these functions are called or where they live, as long as we have them!
> 
> Admittedly the functions above are C-specific and should probably go
> into a C-specific library on top of Foreign.  CForeign anyone?

These are not C-specific, they are POSIX-specific.

As evidence that they are not C-specific, I offer the fact that the
Mercury "extras" distribution includes a POSIX interface library which
defines `errno' and `eINTR'.  No doubt Perl's POSIX interface also
defines equivalents.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.




More information about the FFI mailing list