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 

Struggling with conditional compilation

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



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Thu Jul 21, 2016 9:57 pm    Post subject: Struggling with conditional compilation Reply with quote

I have a parameter set that IO want to include with every INCLUDE'd file. Borrowing from "C", I have coded the parameter file (parameters.ins) to look like this:

Code:

#ifndef parameters_already_included
#define parameters_already_included
.
.
      integer,parameter::abcd=0
.
.
#endif


At the start of every other included file is:
Code:

        include 'parameters.ins'


Within the main modules are INCLUDE sequences like this:

Code:

        include 'abcd.ins'
        include 'defg.ins'


Both abcd.ins and defg.ins have the parameter.ins file included. Logically, the parameter.ins file is included when abcd.ins is itself included (the variable parameters_already_included does not exist), then when defg.ins is included, the body of the parameters.ins file will not be compiled because the variable parameters_already_included does now exist.

What appears to be happening is that the condtionals are failing to properly execute, causing each parameter statement to be flagged as an error (duplicate definition).

Anyone else having this as an issue?
Back to top
View user's profile Send private message Visit poster's website
mecej4



Joined: 31 Oct 2006
Posts: 1886

PostPosted: Fri Jul 22, 2016 1:22 am    Post subject: Reply with quote

You need to use the /CFPp option in order to preprocess C style directives.
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Fri Jul 22, 2016 1:32 am    Post subject: Reply with quote

Yes, and that is on the command line.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Fri Jul 22, 2016 8:00 pm    Post subject: Reply with quote

I tried a simple test and it worked OK so it probably depends on how this is put together. One thing to bear in mind is that FTN95 will not open a second copy of a particular INCLUDE file. It will use the existing copy that has been kept open.
Back to top
View user's profile Send private message AIM Address
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Sat Jul 23, 2016 7:35 pm    Post subject: Reply with quote

If I understand, then the conditionals that would be processed inside of an INCLUDE'ed file would already be "resolved", there being only a single copy opened and processed. With that assumption, then the #ifndef would always be resolved as TRUE, and the remainder of the INCLUDE'ed file would always be processed.

I may have the terminology wrong, but I think this is referred to a single pass include processor. This may be to trying to use SCC to build the freetype library several months ago.

Ah, well. I'll deal with it a different way!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support 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