forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Conditional compilation with C-style preprocessing

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
louis



Joined: 19 Oct 2005
Posts: 9

PostPosted: Mon Mar 06, 2006 11:28 am    Post subject: Conditional compilation with C-style preprocessing Reply with quote

The FTN95 manual says that C-style preprocessing is available through the /CFPP compiler directive.

However, using FTN95 in the following manner : FTN95 myprog.f /CFPP
raises errors concerning the #ifdef and #include statements which are present in the code of myprog.f

How does one use the C-style preprocessor for Fortran source files ?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Mon Mar 06, 2006 1:35 pm    Post subject: Conditional compilation with C-style preprocessing Reply with quote

Louis

I seem to recall that the documentation appeared in one version of FTN95 before the feature was enabled. I think you should be OK with either version 4.8 or 4.9. This is from memory. I do not have the version log to hand. I have tried with version 4.9 and it is OK.

The range of features is limited and is described in the help file under "C-Style Conditional Compilation".

Regards

Paul
Back to top
View user's profile Send private message AIM Address
Anonymous
Guest





PostPosted: Mon Mar 06, 2006 3:14 pm    Post subject: Conditional compilation with C-style preprocessing Reply with quote

Dear Paul

I am using FTN95 v 4.9.1 (without .NET) and it does not work in the fashion I described. Am I using the correct command line syntax ?
The program code (in fixed format) starts as

program SPDF
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
#include "params.inc"
#include "const.inc"
#ifdef USEMPI
include "mpif.h"
#endif
c
character atom1*8, atom2*8

The compiler objects to all the # statements as invalid.

Regards Louis
Back to top
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Tue Mar 07, 2006 12:41 am    Post subject: Conditional compilation with C-style preprocessing Reply with quote

Louis

If you are using /CFPP on the command line then FTN95 should not complain about all of the # statements. Try them one at a time starting with just one #include and an include file that contains no # statements.

As I recall, #define in FTN95 does not work in the same way as C. You must use /VPARAM or /DEFINE on the command line at the same time. I am guessing here but one or two simple trials will verify this.

Regards

Paul
Back to top
View user's profile Send private message AIM Address
Anonymous
Guest





PostPosted: Tue Mar 07, 2006 1:42 am    Post subject: Conditional compilation with C-style preprocessing Reply with quote

Paul

On testing I find that FTN95 works with /CFPP if the source code is in free format, but not in the old Fortan fixed format. I guess there is
no way round this? I am trying to use FTN95 compile a large pre-written program in fixed format, which would be too troublesome to modify.

Louis
Back to top
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Tue Mar 07, 2006 2:39 am    Post subject: Conditional compilation with C-style preprocessing Reply with quote

Louis

A simple example works OK for me but I had to start the # in column 7.

Regards

Paul
Back to top
View user's profile Send private message AIM Address
Andrew



Joined: 09 Sep 2004
Posts: 232
Location: Frankfurt, Germany

PostPosted: Sat Mar 18, 2006 5:57 am    Post subject: Conditional compilation with C-style preprocessing Reply with quote

It is possible to use #define within source code and also on the command line as a replacement for /VPARAM.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group