Re: Re-Marketing Ada (was "With and use")
From: Lutz Donnerhacke (lutz_at_iks-jena.de)
Date: 11/20/03
- Next message: Stephane Richard: "Re: Low Level Ada"
- Previous message: Georg Bauhaus: "Re: OT: Nuclear Waste (Was Re-Marketing Ada)"
- In reply to: Warren Gay: "Re: Re-Marketing Ada (was "With and use")"
- Next in thread: Warren W. Gay VE3WWG: "Re: Re-Marketing Ada (was "With and use")"
- Reply: Warren W. Gay VE3WWG: "Re: Re-Marketing Ada (was "With and use")"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 20 Nov 2003 12:19:02 +0000 (UTC)
* Warren Gay wrote:
> What thinbind would be required to do, is to preprocess the header
> file somewhat differently than the C's preprocessor. Instead of
This destroys most of the original C API in a unusable way.
> Obviously any macros that provide C programmer conveniences, would
> be a challenge (like putchar()). It should be possible
> to infer inline Ada functions from them. I suppose one could apply the
> following C test :
>
> Case 1 : with or without macro arguments
> Does the code fragment represent a complete compilable
> C statement/block? If so, is there an implied return value?
> Define an inline procedure/function with
> or without arguments matching the name.
Hard work. Especially when considering marco expansion down to the plain
syscall (Linux).
> Case 2 : the defined macro components appear to not represent
> a complete statement, nor block of code. Just drop the
> code fragment, because it has already been used
> earlier for macro expansion and is no longer required.
Almost all API constants are marcos. A major part of structures are of compiler
option dependant design. Several structures are different in the man page
and in the implementation. Several macros are used to transform the API
conforming code into the real structure. This can't be ignored.
> #1 is also complicated by "do you expand macro functions?", or
> do you "translate them into Ada inline functions?" I think you would
> need to need to do both (a hints file could control this (see next)).
Thin binding to C is expected as a function/procedure and some
types/constants which can be combined like described in the C API man pages.
So you have to start from the man page and fill in the blanks by designing
the Ada types(!) and calls like expected. Then you have to find out how
these API-types are really defined and used. In a good number of cases you
need quite a different type than described in the man page. C does not know
about variant records and therefore collects a lot of things via unions and
some paragraphs of English text. This has to transformed to an approbriate
Ada type.
> But I think C code can be handled in a well defined way.
I tend to disagree. BTDT.
- Next message: Stephane Richard: "Re: Low Level Ada"
- Previous message: Georg Bauhaus: "Re: OT: Nuclear Waste (Was Re-Marketing Ada)"
- In reply to: Warren Gay: "Re: Re-Marketing Ada (was "With and use")"
- Next in thread: Warren W. Gay VE3WWG: "Re: Re-Marketing Ada (was "With and use")"
- Reply: Warren W. Gay VE3WWG: "Re: Re-Marketing Ada (was "With and use")"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|