* Ada to C Question
@ 2003-04-12 14:43 MPowell
2003-04-12 14:53 ` Jeffrey Creem
2003-04-12 19:43 ` tmoran
0 siblings, 2 replies; 9+ messages in thread
From: MPowell @ 2003-04-12 14:43 UTC (permalink / raw)
Perhaps I'm in the wrong forum but I doing some translation from Ada
to C.
I've noticed in Ada you can do things like.
type MYTYPE_YOURTYPE is (MyType, -- 0
YourType); -- 1
type YOURTYPE_MYTYPE is (YourType, -- 0
MyType); -- 1
typedef enum { MyType,
YourType } MYTYPE_YOURTYPE ;
Obviously if I typedef on YOURTYPE_MYTYPE the compiler complains so
I'm not sure how to handle this?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Ada to C Question
2003-04-12 14:43 Ada to C Question MPowell
@ 2003-04-12 14:53 ` Jeffrey Creem
2003-04-12 17:18 ` MPowell
2003-04-12 19:43 ` tmoran
1 sibling, 1 reply; 9+ messages in thread
From: Jeffrey Creem @ 2003-04-12 14:53 UTC (permalink / raw)
I suspect you are going to have to add ugly prefixes to all of the members
of the enums.
(e.g
typedef enum { mtYt_MyType, mtYt_YourType} myTypeYourType;
)
or something similar.
You will run into similar problems all over the place with overloaded
procedures and even
procedures of the same name in different packages since the C namespace is
global and .h files
are nothing like Ada specs.
There are (commercial/proprietary) tools that can translate from Ada to C.
While they may not do
a perfect job it might be a good starting point.
Even doing a hand translation, you are likely to have some issues since the
code will end up
being structures with an Ada bias which C programmers who work on your code
in the future
will not like.
For instance, it is likely that you may end up with descriptive variable
names and
well structured code.. C programmers hate that :) (Flames to personal
e-mail only..)
"MPowell" <mpowell_jr@hotmail.com> wrote in message
news:2a159604.0304120643.39f77838@posting.google.com...
> Perhaps I'm in the wrong forum but I doing some translation from Ada
> to C.
> I've noticed in Ada you can do things like.
>
> type MYTYPE_YOURTYPE is (MyType, -- 0
> YourType); -- 1
>
> type YOURTYPE_MYTYPE is (YourType, -- 0
> MyType); -- 1
>
>
>
>
> typedef enum { MyType,
> YourType } MYTYPE_YOURTYPE ;
>
>
> Obviously if I typedef on YOURTYPE_MYTYPE the compiler complains so
> I'm not sure how to handle this?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Ada to C Question
2003-04-12 14:53 ` Jeffrey Creem
@ 2003-04-12 17:18 ` MPowell
2003-04-12 19:16 ` Larry Kilgallen
0 siblings, 1 reply; 9+ messages in thread
From: MPowell @ 2003-04-12 17:18 UTC (permalink / raw)
>
> There are (commercial/proprietary) tools that can translate from Ada to C.
> While they may not do
> a perfect job it might be a good starting point.
>
Jeff any examples per above. I've seen an Ada2CC utility but not
Ada2C. I've downloaded a demo copy of the Ada2CC utility but haven't
delved much into it yet.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Ada to C Question
2003-04-12 17:18 ` MPowell
@ 2003-04-12 19:16 ` Larry Kilgallen
0 siblings, 0 replies; 9+ messages in thread
From: Larry Kilgallen @ 2003-04-12 19:16 UTC (permalink / raw)
In article <2a159604.0304120918.20fac0d6@posting.google.com>, mpowell_jr@hotmail.com (MPowell) writes:
>>
>> There are (commercial/proprietary) tools that can translate from Ada to C.
>> While they may not do
>> a perfect job it might be a good starting point.
>>
>
> Jeff any examples per above. I've seen an Ada2CC utility but not
> Ada2C. I've downloaded a demo copy of the Ada2CC utility but haven't
> delved much into it yet.
http://www.sofcheck.com/
mentions an AdaMagic front end that generates ANSI C. For maintainable
ANSI C (as distinguished from repeated conversions), I believe the same
company offers a service.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Ada to C Question
2003-04-12 14:43 Ada to C Question MPowell
2003-04-12 14:53 ` Jeffrey Creem
@ 2003-04-12 19:43 ` tmoran
[not found] ` <2a159604.0304121850.2820b67f@posting.google.com>
1 sibling, 1 reply; 9+ messages in thread
From: tmoran @ 2003-04-12 19:43 UTC (permalink / raw)
> I've noticed in Ada you can do things like.
>
> type MYTYPE_YOURTYPE is (MyType, -- 0
> YourType); -- 1
>
> type YOURTYPE_MYTYPE is (YourType, -- 0
> MyType); -- 1
If the code you are tranlsating has nastiness like that, you better
prepare to redo, rather than just transliterate. Does the original
program actually work? Have you found other similar obfuscations yet?
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2003-04-13 13:38 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-12 14:43 Ada to C Question MPowell
2003-04-12 14:53 ` Jeffrey Creem
2003-04-12 17:18 ` MPowell
2003-04-12 19:16 ` Larry Kilgallen
2003-04-12 19:43 ` tmoran
[not found] ` <2a159604.0304121850.2820b67f@posting.google.com>
2003-04-13 5:37 ` Hyman Rosen
2003-04-13 6:05 ` tmoran
2003-04-13 11:34 ` Larry Kilgallen
2003-04-13 13:38 ` MPowell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox