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,fd63afa4dc364b7e
X-Google-Attributes: gid103376,public
X-Google-ArrivalTime: 2001-03-26 10:46:06 PST
Path:
supernews.google.com!sn-xit-03!supernews.com!freenix!wanadoo.fr!not-for-mail
From: Pascal Obry
Newsgroups: comp.lang.ada
Subject: Re: Implementing C/C++ style #include...
Date: 26 Mar 2001 20:44:00 +0200
Organization: Home - http://perso.wanadoo.fr/pascal.obry
Message-ID:
References: <98m938$2iod0$1@ID-25716.news.dfncis.de>
<99alrr$itf$1@nh.pace.co.uk>
<99d5dj$fi4$1@nh.pace.co.uk>
<99nkte$157$1@nh.pace.co.uk>
NNTP-Posting-Host: mix-velizy-106-2-189.abo.wanadoo.fr
X-Trace: wanadoo.fr 985631745 9588 193.249.121.189 (26 Mar 2001 18:35:46 GMT)
X-Complaints-To: abuse@wanadoo.fr
NNTP-Posting-Date: 26 Mar 2001 18:35:46 GMT
X-Newsreader: Gnus v5.7/Emacs 20.7
Xref: supernews.google.com comp.lang.ada:6066
Date: 2001-03-26T18:35:46+00:00
List-Id:
Stephen Leake writes:
> Not this one:
>
> function Ada_Size_Of_Input is new
> Interfaces_C_More.Storage_Unit_Size_Of (Input_Type);
> #if GNAT_Compiler
> pragma Export (C, Ada_Size_Of_Input,
> "ball_ct633_ada_size_of_input",
> "ball_ct633_ada_size_of_input");
> #elsif ObjectAda_Compiler
> pragma Export (DLL_STDCALL, Ada_Size_Of_Input,
> "ball_ct633_ada_size_of_input",
> "ball_ct633_ada_size_of_input");
> #end if;
I agree with you that in such a case a preprocessor could be usefull. Anothe
way to handle this is by writing a template and have the right spec generated
by a script.
function Ada_Size_Of_Input is new
Interfaces_C_More.Storage_Unit_Size_Of (Input_Type);
pragma Export (, Ada_Size_Of_Input,
"ball_ct633_ada_size_of_input",
"ball_ct633_ada_size_of_input");
This is even easier to maintain. Only one Export pragma. And if you have to
change/add new convention for new compiler you just need to add one token into
your script.
You can even configure prefix if you need so:
function Ada_Size_Of_Input is new
Interfaces_C_More.Storage_Unit_Size_Of (Input_Type);
pragma Export (, Ada_Size_Of_Input,
"_ada_size_of_input",
"_ada_size_of_input");
>
> The difference is in the name of the Convention. Preprocessing is, in
> this case, the best way to handle it. I believe the only alternative
> is to reproduce the entire package spec, and change this one value.
> Surely you do not claim that is better from a maintenance point of
> view?
Agree, but see above.
> I can only assume you have not personally encountered a situation like
> this. Until you have, you need to be a little more open :).
I have but in that case I use script.
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://perso.wanadoo.fr/pascal.obry
--|
--| "The best way to travel is by means of imagination"