in reply to Re: Parsing and converting Fortran expression
in thread Parsing and converting Fortran expression [solved]
"Use the source, Luke!"
If f2c can translate a bunch of Fortran expressions (a "Fortran program") to a bunch equivalent C expressions (a "C program"), f2c must contain code to convert a single Fortran expression into an equivalent C expression.
Either find and extract that, or construct a workaround: Wrap the Fortran expression in a dummy Fortran program that surrounds the expression in the C output with easy to find markers. Page 8 of the very verbose documentation suggests that Fortran labels may survive as C comments:
Unused labels are retained in comments for orienteering purposes.
So: Place an unused label "AAAAA" before the expression, a second unused label "ZZZZZ" after the expression, then search the generated C code for "/* AAAAA: */" and "/* ZZZZZ: */". Whatever you find in between should be the translated expression.
Alexander
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Parsing and converting Fortran expression
by kikuchiyo (Hermit) on Aug 25, 2015 at 21:29 UTC | |
by afoken (Chancellor) on Aug 26, 2015 at 05:25 UTC | |
by kikuchiyo (Hermit) on Aug 26, 2015 at 19:02 UTC |