*BSD News Article 77977


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!metro!metro!asstdc.scgt.oz.au!nsw.news.telstra.net!act.news.telstra.net!psgrain!usenet.eel.ufl.edu!news.mathworks.com!newsfeed.internetmci.com!in2.uu.net!netnews.worldnet.att.net!news.u.washington.edu!root
From: "Steven G. Kargl" <kargl@troutmask.apl.washington.edu>
Newsgroups: comp.unix.bsd.freebsd.misc,gnu.misc.discuss
Subject: Re: [HOPE] Macro expansion to the FreeBSD f77.
Date: Tue, 10 Sep 1996 10:48:09 -0700
Organization: Applied Physics Lab
Lines: 52
Message-ID: <3235A9D9.41C67EA6@troutmask.apl.washington.edu>
References: <5134a6$bg0@newsgate.so-net.or.jp>
NNTP-Posting-Host: troutmask.apl.washington.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0b6 (X11; I; FreeBSD 2.1.5-RELEASE i386)
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:27022 gnu.misc.discuss:28686

Hiroshi Murakami wrote:
> 
> The fortran compiler f77 in VAX BSD4.x system
> have the capability of the cpp-type macro expansions
> for the .F suffixed source file as the following
> 
>       subroutine sub(a,b,c)
> #include "a.inc"
> #define KKK_CONST (MMM+4)
> #ifdef HUGE_N
>       n=NMX_NMX
> #else
>       n=100
> #endif
>       ....
> 
> I hope the MACRO functionality were available on
> FreeBSD also, since the conditional MACRO mechanism
> is quite convenient to take the system restriction
> or feature into one united source code.
> The include path should be explicitly directed as
> % f77 -I../incdir/ a.F a.f
> and also the default MACRO symbol definitions to the
> Fortran code should be different from that of C.
> 
> Yes. MACRO feature is the violation of the ANSI fortran standard.
> But this helps to coding maintain/test/debug/porting a lot.

I've written a wrapper utility around the f2c+gcc combination
that will work in the manner you describe.  The wrapper supports
all f2c options that I deemed to make sense in a standalone f77
utility.  Several gcc options have direct support in the wrapper,
and all other gcc options are supported in an indirect manner.

I was cleaning up my code to send to the FreeBSD project when I 
ran across a small problem.  In compiling lapack, the following
f77 command was issued:

f77 ../../blas.a some_object.o -o name

which caused the wrapper to die.  The wrapper assumes that options
will be placed before the target files except for libraries and
library locations (i.e, -L/usr/lib and -lm).

If you want to try my current version of the code, then drop
me an email and I'll put if up for ftp.

-- 
Steve

finger kargl@troutmask.apl.washington.edu
http://troutmask.apl.washington.edu/~kargl/sgk.html