Hi,
Can anyone help me find a software that can convert a code in 'C'
to 'Fortran77/90' automatically?
Thanks in advance.
Sam. 26 13501
sam wrote: Hi, Can anyone help me find a software that can convert a code in 'C' to 'Fortran77/90' automatically?
Thanks in advance.
Sam.
Wow, - good luck :)
sam wrote: Hi, Can anyone help me find a software that can convert a code in 'C' to 'Fortran77/90' automatically?
This is not really on-topic.
However, there is a slightly more topical version: Why fix something
that is not broken?
C modules can communicate with fortran modules.
Now the problem is just how to fit the two together.
Google for "mix fortran and C". It basically comes down to
providing interfaces, creating the right headers and intelligent
makefiles.
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
> Can anyone help me find a software that can convert a code in 'C' to 'Fortran77/90' automatically?
Good luck. You'll need it. C concepts like pointers don't
translate very well into FORTRAN.
Gordon L. Burditt
sam wrote: Hi, Can anyone help me find a software that can convert a code in 'C' to 'Fortran77/90' automatically?
This is off-topic for this newsgroup. However, I suggest using a search
engine for f2c.
Brian
On Wed, 10 Nov 2004, Default User wrote: sam wrote:
Can anyone help me find a software that can convert a code in 'C' to 'Fortran77/90' automatically?
This is off-topic for this newsgroup. However, I suggest using a search engine for f2c.
That is in the wrong direction...
Tak-Shing
"Tak-Shing Chan" <es***@city.ac.uk> wrote in message
news:Pine.GSO.4.33.0411102059310.12278-100000@swindon... On Wed, 10 Nov 2004, Default User wrote:
sam wrote:
Can anyone help me find a software that can convert a code in 'C' to 'Fortran77/90' automatically?
This is off-topic for this newsgroup. However, I suggest using a search engine for f2c.
That is in the wrong direction...
So you can use it to check your result, in the unexpected case that the
original C code fell within the subset of C used by f2c, and your OS gets
along with the f2c conventions.
On Wed, 10 Nov 2004 21:00:12 +0000, Tak-Shing Chan <es***@city.ac.uk>
wrote: On Wed, 10 Nov 2004, Default User wrote:
sam wrote:
Can anyone help me find a software that can convert a code in 'C' to 'Fortran77/90' automatically?
This is off-topic for this newsgroup. However, I suggest using a search engine for f2c.
That is in the wrong direction...
Tak-Shing
Try searching for c2f then.
Jim
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Michael Mair wrote:
| sam wrote:
|
|> Hi,
|> Can anyone help me find a software that can convert a code in 'C'
|> to 'Fortran77/90' automatically?
|
|
| This is not really on-topic.
| However, there is a slightly more topical version: Why fix something
| that is not broken?
Maybe because the Fortran compiler's optimization is better than the
platform's C compiler. Or to make calling the code from Fortran easier.
Or a small number of other possible reasons.
Obviously, going the other way is a lot more common. The Fortran FAQ
I'll link to later says that there aren't any tools to automate the c2f
conversion.
| C modules can communicate with fortran modules.
True, but it isn't always easy. There are more issues involved in this
than I'll go into here, but there is a (long) discussion of it at
section 3.1.3 of the Fortran FAQ at this address:
~ http://www.faqs.org/faqs/fortran-faq/
| Now the problem is just how to fit the two together.
And it is, indeed, a problem. ;)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFBkxGaKxatjOtX+j0RArp4AJ9kXvMBB1BHuetZobFJS5 bB9iwkCwCeOCdR
GpWhVHxh1RLZn/JHtRI+rkk=
=Z1NT
-----END PGP SIGNATURE-----
Chris Barts wrote: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Michael Mair wrote: | sam wrote: | |> Hi, |> Can anyone help me find a software that can convert a code in 'C' |> to 'Fortran77/90' automatically? | | | This is not really on-topic. | However, there is a slightly more topical version: Why fix something | that is not broken?
Maybe because the Fortran compiler's optimization is better than the platform's C compiler. Or to make calling the code from Fortran easier. Or a small number of other possible reasons.
Well, as the OP did not give a _good_ reasons, I assumed (s)he was not
aware of this way.
Obviously, going the other way is a lot more common. The Fortran FAQ I'll link to later says that there aren't any tools to automate the c2f conversion.
Yep, this I know. I would rather go for the f2c but the OP seemed
to want to have Fortran.
| C modules can communicate with fortran modules.
True, but it isn't always easy. There are more issues involved in this than I'll go into here, but there is a (long) discussion of it at section 3.1.3 of the Fortran FAQ at this address:
~ http://www.faqs.org/faqs/fortran-faq/
| Now the problem is just how to fit the two together.
And it is, indeed, a problem. ;)
*g* Maybe.
Up to now, I only had the dubious pleasure of getting F77 code
to work together with C code, always the C code calling -- and
this went always straight by recipe.
Thanks for the additional information :-)
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Chris Barts <ch************@gmail.com> wrote in message news:<S9********************@onewest.net>... -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Michael Mair wrote: | sam wrote: | |> Hi, |> Can anyone help me find a software that can convert a code in 'C' |> to 'Fortran77/90' automatically? | | | This is not really on-topic. | However, there is a slightly more topical version: Why fix something | that is not broken?
Maybe because the Fortran compiler's optimization is better than the platform's C compiler. Or to make calling the code from Fortran easier. Or a small number of other possible reasons.
Obviously, going the other way is a lot more common. The Fortran FAQ I'll link to later says that there aren't any tools to automate the c2f conversion.
That FAQ at http://www.faqs.org/faqs/fortran-faq/
is almost 8 years old and is thus out of date. The OP posted the same
message to comp.lang.fortran (a breach of etiquette), where I
mentioned a Fortran 90 program C2F at http://home.cfl.rr.com/davegemini/c2f.f90 as a PARTIAL translator from
C to Fortran. I earlier wrote about it at http://groups.google.com/groups?q=be...gle.com&rnum=1
..
The c.l.f crowd agrees with the c.l.c crowd that translation (as
opposed to linking) is probably not the way to go.
Chris Barts <ch************@gmail.com> writes: Michael Mair wrote: |> Can anyone help me find a software that can convert a code in 'C' |> to 'Fortran77/90' automatically? | | This is not really on-topic. | However, there is a slightly more topical version: Why fix something | that is not broken?
Maybe because the Fortran compiler's optimization is better than the platform's C compiler. Or to make calling the code from Fortran easier. Or a small number of other possible reasons.
I'm skeptical that optimization is a good reason to convert C to
Fortran. Leaving pointer issues aside (and I think recent versions of
Fortran have something similar to pointers), automatically generated
Fortran is likely to be ugly and difficult to optimize.
If you want to be able to maintain the Fortran code, the best tool for
the job is probably a programmer who knows both C and Fortran and is
willing to do it for what you can afford to pay.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
In <e3**************************@posting.google.com > at*****@gmail.com (sam) writes: Can anyone help me find a software that can convert a code in 'C' to 'Fortran77/90' automatically?
Converting from a lower level language to a higher level language is
seldom possible. Only a subset of C could be converted to Fortran
automatically.
The comp.lang.fortran FAQ might have some pointers.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Currently looking for a job in the European Union
In <ln************@nuthaus.mib.org> Keith Thompson <ks***@mib.org> writes: Chris Barts <ch************@gmail.com> writes: Michael Mair wrote: |> Can anyone help me find a software that can convert a code in 'C' |> to 'Fortran77/90' automatically? | | This is not really on-topic. | However, there is a slightly more topical version: Why fix something | that is not broken?
Maybe because the Fortran compiler's optimization is better than the platform's C compiler. Or to make calling the code from Fortran easier. Or a small number of other possible reasons. I'm skeptical that optimization is a good reason to convert C to Fortran. Leaving pointer issues aside (and I think recent versions of Fortran have something similar to pointers),
Not quite. It's similar to Pascal pointers: you can't perform pointer
arithmetic on them.
automatically generated Fortran is likely to be ugly and difficult to optimize.
Ugly to the human eye doesn't necessarily imply difficult to optimize for
the Fortran compiler. It is basically the strict aliasing rules of
Fortran that allow Fortran optimisers to be (significantly) more
aggressive than C optimisers.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Currently looking for a job in the European Union at*****@gmail.com (sam) wrote in message news:<e3**************************@posting.google. com>... Hi, Can anyone help me find a software that can convert a code in 'C' to 'Fortran77/90' automatically?
Thanks in advance.
Sam.
This is why God created interns.
In <2v*************@uni-berlin.de> Michael Mair <Mi**********@invalid.invalid> writes: sam wrote:
Hi, Can anyone help me find a software that can convert a code in 'C' to 'Fortran77/90' automatically?
This is not really on-topic. However, there is a slightly more topical version: Why fix something that is not broken? C modules can communicate with fortran modules. Now the problem is just how to fit the two together. Google for "mix fortran and C". It basically comes down to providing interfaces, creating the right headers and intelligent makefiles.
The real problem is that the solution is not portable. The details of
interfacing C and Fortran are highly system specific. Everything could
just work by "magic", as was the case under VAX/VMS, but many other
platforms require the C code to have inside knowledge about the workings
of the Fortran compiler and/or vice versa.
The best attempt at hiding these details was made by the cfortran.h
project: http://www-zeus.desy.de/~burow/cfortran/
IIRC, it is only the last Fortran standard that addresses the issue.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Currently looking for a job in the European Union
Keith Thompson wrote: Chris Barts <ch************@gmail.com> writes: Michael Mair wrote: |> Can anyone help me find a software that can convert a code in 'C' |> to 'Fortran77/90' automatically? | | This is not really on-topic. | However, there is a slightly more topical version: Why fix something | that is not broken?
Maybe because the Fortran compiler's optimization is better than the platform's C compiler. Or to make calling the code from Fortran easier. Or a small number of other possible reasons.
I'm skeptical that optimization is a good reason to convert C to Fortran. Leaving pointer issues aside (and I think recent versions of Fortran have something similar to pointers), automatically generated Fortran is likely to be ugly and difficult to optimize.
If you want to be able to maintain the Fortran code, the best tool for the job is probably a programmer who knows both C and Fortran and is willing to do it for what you can afford to pay.
If he does it himself, it will be a good way to learn Fortran ?
On Thu, 11 Nov 2004 00:15:38 -0700, Chris Barts wrote: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Michael Mair wrote: | sam wrote: | |> Hi, |> Can anyone help me find a software that can convert a code in 'C' |> to 'Fortran77/90' automatically? | | | This is not really on-topic. | However, there is a slightly more topical version: Why fix something | that is not broken?
Maybe because the Fortran compiler's optimization is better than the platform's C compiler.
However the comparison isn't between the Fortran compiler's optimiser and
rhe C compiler's optimiser, it is between the C compiler's optimiser and
the combined effects of the 2 compilers' translations. C compilers can
be pretty good at optimising C code. That can still result in slower code
than a Fortran compiler compiling Fortran code because the C language
semantics can be harder to optimise. A C to F compiler will have to
preserve the C language semantics of the code it translates and probably
generate pretty nasty Fortran code as a result. It is a reasonable bet
that a Fortran compiler will be less good at optimising C language
semantics than a C compiler, especially from an intermediate language that
doesn't express those semantics naturally.
Lawrence Da*****@cern.ch (Dan Pop) writes:
[...] The real problem is that the solution is not portable. The details of interfacing C and Fortran are highly system specific. Everything could just work by "magic", as was the case under VAX/VMS, but many other platforms require the C code to have inside knowledge about the workings of the Fortran compiler and/or vice versa.
C doesn't define an interface to Fortran, but Ada defines interfaces
to both C and Fortran, so one solution might be to write the main
program in Ada. (Assuming an Ada compiler is available on the system,
and that it defines interfaces to the particular C and Fortran
implementations.)
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
In <ln************@nuthaus.mib.org> Keith Thompson <ks***@mib.org> writes: Da*****@cern.ch (Dan Pop) writes: [...] The real problem is that the solution is not portable. The details of interfacing C and Fortran are highly system specific. Everything could just work by "magic", as was the case under VAX/VMS, but many other platforms require the C code to have inside knowledge about the workings of the Fortran compiler and/or vice versa.
C doesn't define an interface to Fortran, but Ada defines interfaces to both C and Fortran, so one solution might be to write the main program in Ada. (Assuming an Ada compiler is available on the system, and that it defines interfaces to the particular C and Fortran implementations.)
It's not the main program you want to write in Ada, but the interface
between the C and the Fortran code. I.e. if the Fortran code needs to
call a C function, provide an Ada wrapper that is Fortran callable and
that knows how to call the C function. Then again, it is not clear how
portable the solution would be in the real world (see your own
parenthetical remark).
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Currently looking for a job in the European Union
In article <e3**************************@posting.google.com >, at*****@gmail.com (sam) writes: Hi, Can anyone help me find a software that can convert a code in 'C' to 'Fortran77/90' automatically?
I didn't even know there was a fractional Fortran standard. I've only
used the integral ones (well, sometimes their derivatives).
--
Michael Wojcik mi************@microfocus.com
In <cn********@news1.newsguy.com> mw*****@newsguy.com (Michael Wojcik) writes: In article <e3**************************@posting.google.com >, at*****@gmail.com (sam) writes: Hi, Can anyone help me find a software that can convert a code in 'C' to 'Fortran77/90' automatically?
I didn't even know there was a fractional Fortran standard. I've only used the integral ones (well, sometimes their derivatives).
F77S was a fraction of the F77 standard (a "subset" in the F77 jargon).
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Currently looking for a job in the European Union Da*****@cern.ch (Dan Pop) writes: In <ln************@nuthaus.mib.org> Keith Thompson <ks***@mib.org> writes:
[...] C doesn't define an interface to Fortran, but Ada defines interfaces to both C and Fortran, so one solution might be to write the main program in Ada. (Assuming an Ada compiler is available on the system, and that it defines interfaces to the particular C and Fortran implementations.)
It's not the main program you want to write in Ada, but the interface between the C and the Fortran code. I.e. if the Fortran code needs to call a C function, provide an Ada wrapper that is Fortran callable and that knows how to call the C function. Then again, it is not clear how portable the solution would be in the real world (see your own parenthetical remark).
If the main program is written in a language other than Ada, it will
have to call a special routine "adainit" to initialize (elaborate) the
Ada runtime. (This was added in Ada 95; Ada 83 didn't have it (which
is probably why I incorrectly assumed the main program would need to
be in Ada).)
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
On 11 Nov 2004 15:09:10 GMT, Da*****@cern.ch (Dan Pop) wrote: In <ln************@nuthaus.mib.org> Keith Thompson <ks***@mib.org> writes:
<snip> I'm skeptical that optimization is a good reason to convert C to Fortran. Leaving pointer issues aside (and I think recent versions of Fortran have something similar to pointers),
Not quite. It's similar to Pascal pointers: you can't perform pointer arithmetic on them.
Not just Pascal; outside the C family, I don't know of any HLL that
has pointer arithmetic, except that I hear it has been added (I think
implementation-dependently) to PL/I more recently than the last time I
used it seriously. Ada's primary form of pointers, access types, are
opaque but it has standard syntax for conversion to and from 'address'
types that support some arithmetic.
F90 POINTERs are unusual -- AFAIK unique -- in that for arrays they
are full dope vectors that can designate noncontiguous slices.
- David.Thompson1 at worldnet.att.net
In article <mo********************************@4ax.com>, Dave Thompson <da*************@worldnet.att.net> writes: Not just Pascal; outside the C family, I don't know of any HLL that has pointer arithmetic, except that I hear it has been added (I think implementation-dependently) to PL/I more recently than the last time I used it seriously.
COBOL added pointer arithmetic (SET [pointer] UP [or DOWN] BY [amount])
in the 2002 standard, and some flavors (eg Micro Focus) have had it for
longer. (The oldest example I have for MF COBOL at hand is from 1997,
but I think pointer arithmetic was added significantly earlier than
that.)
--
Michael Wojcik mi************@microfocus.com mw*****@newsguy.com (Michael Wojcik) wrote: In article <mo********************************@4ax.com>, Dave Thompson <da*************@worldnet.att.net> writes: Not just Pascal; outside the C family, I don't know of any HLL that has pointer arithmetic, except that I hear it has been added (I think implementation-dependently) to PL/I more recently than the last time I used it seriously.
COBOL added pointer arithmetic (SET [pointer] UP [or DOWN] BY [amount])
Ow! My eyes... will you please not do that? It hurts...
Richard
In article <41**************@news.individual.net>, rl*@hoekstra-uitgeverij.nl (Richard Bos) writes: mw*****@newsguy.com (Michael Wojcik) wrote:
COBOL added pointer arithmetic (SET [pointer] UP [or DOWN] BY [amount])
Ow! My eyes... will you please not do that? It hurts...
Not do which? Use block capitals (customary for posting COBOL,
though I use lowercase for actual COBOL source), use square brackets
(standard for editorial insertions in English), or post COBOL (I have
no excuse for that)?
I must admit reading COBOL often pains me too. On the other hand,
the comp.lang.cobol regulars will make the same complaint about C...
--
Michael Wojcik mi************@microfocus.com
HTML is as readable as C. You can take this either way. -- Charlie Gibbs This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Graham Feeley |
last post by:
Hi I have data resembling like this
Clearing, The
Italian Job, The
Final Cut, The
Manson Family, The
I would like some code to convert the data to
The Clearing
The Italian Job
The Final Cut
|
by: Diego |
last post by:
Hi,
Anyone can help to convert this code to C#?
Public Class MonImageConverter
Inherits System.Windows.Forms.AxHost
Public Sub New()
MyBase.New("59EE46BA-677D-4d20-BF10-8D8067CB8B33")
'note...
|
by: Mike |
last post by:
is there a tool that will convert cold fusion code to C#?
Or anything out there to help in this process?
thx
|
by: Tanzim Saqib |
last post by:
I've been trying to learn VB.NET. I know VB6. I can not convert the following VB6 code segment to VB.NET
In VB 6:
' In a module starts here:
Public Declare Function SetTimer Lib "user32"...
|
by: Dushyant |
last post by:
Hello everyone,
I am working on converting one code from VB to VB.NET.
I am stuck at some point, please help me how to convert following code from
VB to VB.NET :
Dim xImage As...
|
by: shapper |
last post by:
Hello,
Could someone, please, convert the following code line to VB.NET?
bool containsValue = myList.Any(item =item.NameParameter ==
nameParameterValue);
(This is .NET 3.5. I couldn't find...
|
by: shapper |
last post by:
Hello,
I am having problems in converting the following code line to VB.NET:
Control list = MyFun(myControl, delegate(Control ctl) { ctl.ID ==
"MyControl"; });
Could someone please help me...
|
by: Sam |
last post by:
I am new in software development, and need some help.
Please help me convert a class written in c# to vb.net.
Thanks, Sam
|
by: mshmyob |
last post by:
I am new to vb.net and would like to be able to convert the following code to it's own function - either inside the current module or better yet in a seperate class.
This code currently runs in...
|
by: royhoja |
last post by:
How do i convert the following code into a function? What parameters would be in the function?
printingform(???,???)
#include <stdio.h>
#include <string.h>
int main()
{
int i;
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |