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,38159b1b5557a2e7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-29 04:52:36 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!elnk-pas-nf1!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread1.news.atl.earthlink.net.POSTED!d9c68f36!not-for-mail Message-ID: <40190210.2060307@noplace.com> From: Marin David Condic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 (OEM-HPQ-PRS1C03) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Standard Ada Preprocessor (Was: why ada is so unpopular ?) References: <400A9B48.3060100@noplace.com> <400BD4B5.6000307@noplace.com> <400BDB7C.40100@noplace.com> <400D2150.6000705@noplace.com> <400E72F9.8060501@noplace.com> <100upo7ln5e3k59@corp.supernews.com> <400FC8E8.2040100@noplace.com> <_JSdna166JuxFo3dRVn-hg@comcast.com> <401115B7.5020205@noplace.com> <401264ED.306@noplace.com> <4012927F.60401@noplace.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 29 Jan 2004 12:52:35 GMT NNTP-Posting-Host: 209.165.24.161 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.atl.earthlink.net 1075380755 209.165.24.161 (Thu, 29 Jan 2004 04:52:35 PST) NNTP-Posting-Date: Thu, 29 Jan 2004 04:52:35 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:5040 Date: 2004-01-29T12:52:35+00:00 List-Id: That might be an answer. It at least goes a long way towards alleviating most of the problems. I'd have some concerns about mentioning actual filenames in the pragma because that can be incredibly system dependent and all you have to do is move some directory tree and the whole thing collapses. I've seen that problem show up in C and would prefer not to have it show up in any Ada code. If, OTOH, it let me use some kind of symbolic name in much the same way as I already do with a package name, then you can at least figure that each compiler or platform has some mechanism for finding a body already and now it just does so with a different name. (On Gnat, it looks for an appropriately named file. On Aonix, it looks in its compilation database for the right unit to associate. On ??? - it uses whatever means it has natively.) Maybe its something like this: with Some_Package ; if (some_condition) then for Some_Package'Body use GNAT_Some_Package ; else for Some_Package'Body use AONIX_Some_Package ; end if ; I'm not saying it would have to be this syntax or that a pragma wouldn't be better. Just saying that I want the compiler to apply its normal interpretation rules to find "GNAT_Some_Package" and pretend that its name is "Some_Package". Something like that might work. MDC Jacob Sparre Andersen wrote: > > Would a pragma in the package specification declaring which file the > package body should be read from depending on some compilation > parameters (compiler, operating system, etc.) do the job? > > Something like this, where the body is grabbed from the file named by > the first "Body_Source_File" pragma with a matching condition. If no > "Body_Source_File" pragma has a matching condition, the compiler just > uses its default routine for finding the source code for the package > body. > > with System; > with System.Compiler_Flags; > > package Hiding_Compiler_Specific_Details is > pragma Body_Source_File > (Condition => System.Compiler_Name = "GNAT", > File => "GNAT/HCSD.ada_body"); > pragma Body_Source_File > (Condition => System.Compiler_Flags.Set ("--with-gnu-gettext"), > File => "GNU-Gettext/HCSD.ada_body"); > pragma Body_Source_File > (Condition => True, > File => "default_implementations/HCSD.ada_body"); > > ... > end Hiding_Compiler_Specific_Details; > > This would limit the language handling of conditional compilation to > selecting package/unit bodies, but I think it would solve most of the > problems mentioned in this discussion, without risking the whole > preprocessing hell seen in too many C programs. > > Greetings, > > Jacob -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jsf.mil/NSFrames.htm Send Replies To: m o d c @ a m o g c n i c . r "Face it ladies, its not the dress that makes you look fat. Its the FAT that makes you look fat." -- Al Bundy ======================================================================