comp.lang.ada
 help / color / mirror / Atom feed
From: Ole-Hjalmar Kristensen <ohk@clustra.com>
Subject: Re: adasockets and adatypes
Date: 06 Sep 2001 09:04:28 +0200
Date: 2001-09-06T09:04:28+02:00	[thread overview]
Message-ID: <umqg0a0ol4z.fsf@maestro.clustra.com> (raw)
In-Reply-To: x7vpu96ehbx.fsf@smaug.pushface.org

Simon Wright <simon@pushface.org> writes:

> "Marin David Condic" <dont.bother.mcondic.auntie.spam@[acm.org> writes:
> 
> > Note that while I may complain about this from time to time, you're
> > still better off than you are with C in the same situation. In C you
> > have very little control over representation and in general just
> > have to rely on the fact that most C compilers choose to do things
> > basically the same way. The one advantage C has in this area is that
> > it is at least simpler to take just about any data structure and
> > treat it as raw bytes. You can get there in Ada, but it does require
> > more work.
> 
> I would have thought the ideal non-automated C way of doing this would
> be to define a wire format that is convenient for manipulating
> endianness (eg, no packing) and manually stuff this on the way
> out/unstuff on the way in. Far less dangerous than trying to
> manipulate packed data.
> 
> Sometimes the transport mechanism forces you to use the same length
> for every component -- eg, X properties, where you can choose 1/2/4
> byte length and the server byteswaps for you.

And don't forget that there are automated tools for doing this in C,
the most widespread is probably SUN's XDR/rpcgen, which always has
been freely available.  From an XDR interface specification, rpcgen
will happily generate both server and client side subs, and indeed a
skeleton server, if you wish. As the XDR format is a wire format,
there are no problems with different compilers and endianness.  rpcgen
essentially eliminated the extra manual work in writing bread and
butter client/server applications years ago.

Of course, there is nothing stopping you from calling the generated C
stubs from Ada.

-- 
Kabelsalat ist gesund.

Ole-Hj. Kristensen



  reply	other threads:[~2001-09-06  7:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-04 10:53 adasockets and adatypes Tony Gair
2001-09-04 11:37 ` David C. Hoos, Sr.
2001-09-04 12:17   ` Florian Weimer
2001-09-04 14:55     ` David C. Hoos
2001-09-04 15:33       ` Ted Dennison
2001-09-04 15:53         ` David C. Hoos
2001-09-04 18:53           ` Ted Dennison
2001-09-04 20:44             ` David C. Hoos
2001-09-04 21:35               ` Ted Dennison
2001-09-04 15:58         ` Marin David Condic
2001-09-05  9:13   ` Tony Gair
2001-09-04 12:02 ` Marc A. Criley
2001-09-04 13:43 ` Marin David Condic
2001-09-04 22:12   ` Simon Wright
2001-09-06  7:04     ` Ole-Hjalmar Kristensen [this message]
2001-09-07 13:16       ` Peter Dulimov
2001-09-07 14:46         ` Ted Dennison
2001-09-08  5:51         ` Simon Wright
2001-09-06 14:16     ` Marin David Condic
replies disabled

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