From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,60e2922351e0e780 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-20 04:19:03 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.vmunix.org!news-FFM2.ecrc.net!news.iks-jena.de!not-for-mail From: Lutz Donnerhacke Newsgroups: comp.lang.ada Subject: Re: Re-Marketing Ada (was "With and use") Date: Thu, 20 Nov 2003 12:19:02 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: References: <3FB0B57D.6070906@noplace.com> <3FB22125.1040807@noplace.com> <3FB3751D.5090809@noplace.com> <3FB8B9BC.5040505@noplace.com> <3FBA1118.4060105@noplace.com> <0fxub.48425$bQ3.12107@nwrdny03.gnilink.net> <3FBC2EEC.212A1B5@cogeco.ca> NNTP-Posting-Host: taranis.iks-jena.de X-Trace: branwen.iks-jena.de 1069330742 15740 217.17.192.37 (20 Nov 2003 12:19:02 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Thu, 20 Nov 2003 12:19:02 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:2724 Date: 2003-11-20T12:19:02+00:00 List-Id: * 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.