comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com
Subject: Re: Nontrivial examples of C interface with Ada
Date: 2000/05/25
Date: 2000-05-25T00:00:00+00:00	[thread overview]
Message-ID: <oGfX4.320$yf2.148802@news.pacbell.net> (raw)
In-Reply-To: 8gjqpo$kjv$1@nnrp1.deja.com

>any further abstracting of the binding to make it simpler is going to
>inevitably loose some of the power of the original.  Sure, it will be
>easier to use, but you won't be able to do as interface.
  The escape hatch is to have routines that let you get at the lowest
level entities and then make whatever system calls you want.
  function Get_Handle (Socket : in Root_Socket_Type'Class)
                return Socket_Handles;
        -- Returns the Windows handle of the socket.
  procedure Get_Socket_From_Handle (Socket : in out Socket_Type;
                                    Handle : in     Socket_Handles);
        -- Handle should be the Windows handle of an open, connected,
        -- blocking, or non-blocking but with no interrupts allowed,
        -- stream socket.
        -- Socket should be a closed CLAW Socket_Type'Class.
        -- On return, Socket will be open and have Handle as its
        -- Windows handle.
Of course it's also then up to the power user not to trip himself up
by his mixing of high and low level calls.

>But then how do I set my sockets to non-blocking?
  That's just a question of how thorough is the coverage of the thick
binding.  A lot can be done with a Text_IO style interface to blocking
sockets, with asynchrony being provided by suitable Ada tasking.  In
fact, Windows CE does not offer non-blocking sockets, so they expect
you to live happily with task switching instead of non-blocking sockets.
For Windows versions that do offer non-blocking sockets, Claw includes:
  type Async_Socket_Type is abstract new Socket_Type with private;
  -- A concrete non-blocking socket type must be derived from this
  -- and overriding When_xxx routines supplied.
which supplies the blocking socket routines plus primitives
  procedure When_Connect(Socket : in out Async_Socket_Type);
        -- Called when the socket becomes connected on an Open call.
  procedure When_Readable(Socket : in out Async_Socket_Type) is abstract;
        -- Called when "data is available to read" goes from False to True
and so forth.




  reply	other threads:[~2000-05-25  0:00 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-23  0:00 Nontrivial examples of C interface with Ada gressett
2000-05-24  0:00 ` Terry Westley
2000-05-24  0:00 ` Ted Dennison
2000-05-24  0:00   ` Marin D. Condic
2000-05-25  0:00     ` tmoran
2000-05-25  0:00       ` Geoff Bull
2000-05-25  0:00         ` tmoran
2000-05-25  0:00       ` Ted Dennison
2000-05-25  0:00         ` tmoran [this message]
2000-05-25  0:00           ` Ted Dennison
2000-05-25  0:00             ` tmoran
2000-05-26  0:00         ` Julian Day
2000-05-26  0:00           ` Julian Day
2000-05-26  0:00       ` Marin D. Condic
2000-05-27  0:00         ` tmoran
2000-05-27  0:00           ` Marin D. Condic
2000-05-28  0:00             ` tmoran
2000-05-28  0:00               ` Robert Dewar
2000-05-28  0:00               ` Marin D. Condic
2000-05-28  0:00                 ` tmoran
2000-05-25  0:00     ` Ted Dennison
2000-05-25  0:00       ` tmoran
2000-05-29  0:00       ` Geoff Bull
2000-05-24  0:00 ` tmoran
2000-05-24  0:00 ` Marin D. Condic
2000-05-24  0:00   ` Scott Ingram
2000-05-24  0:00     ` Marin D. Condic
2000-05-24  0:00 ` David Emery
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox