Since I am new to Clarion, I want to ask community for a little help. I am having trouble understanding how INCLUDE works in Clarion. I assume that .INC file is something like .H file in C++, and .CLW file is something like .CPP file?
Clarion help does not say much. I have created test project just to test INCLUDE with my file, but I get compile error. I have tried to look code in LibSrc\win directory as an example, but I am not able to figure it out.
I create TestFile.INC and code in it:
OMIT('_EndOfInclude_',_TestFilePresent_)
_TestFilePresent_ EQUATE(1)
someString STRING(8)
MAP
MODULE('TestFile.clw')
someProcedure PROCEDURE()
END
END
_EndOfInclude_
And in a TestFile.CLW I have wrote:
MEMBER()
INCLUDE('TestFile.inc')
MODULE
END
someProcedure PROCEDURE()
CODE
MESSAGE('Test')
RETURN
In test application in Global Embeds, section Before Global INCLUDEs I put include:
INCLUDE('TestFile.inc')
I get compiler error for .INC file, and it is:
Expected: ( , * ;
In line where is the procedure:
someProcedure PROCEDURE()
I am not getting compile error when it is only variable in INC file. If I put QUEUE, I get error Illegal data type. I have not tried with class, since I am trying to get it to work with procedure first.
Can anyone explain hot does INCLUDE() work? I would be very grateful. I tried to google it, but I could not find anything.
One feature that offers is you can use the _Symbol_ in your own code. If the Include is commented out then the Symbol does not exist and any COMPILE(â**â,_Symbol_) does not Include the code. Thatâs unusual to Not always want a class. I have test / debug helpers like BingBangTheory and WndPreview that I want out of the build once the code is good.
INCLUDE('CBWndPreview.INC'),ONCE !Simply !comment this line to remove all code
COMPILE('!** WndPrv **',_IFDef_CBWndPreview_)
WndPrvCls CBWndPreviewClass
'!** WndPrv **
...
OPEN(Window)
COMPILE('!** WndPrv **',_IFDef_CBWndPreview_)
WndPrvCls.Init()
'!** WndPrv **
That is a bit tricky to rely on that âhiddenâ _Symbol_ so I only do it with my own classes. Typically I declare my own equate e.g. I wanted to optionally include Geoffâs ST code:
!2 steps to use StringTheory: 1. Change _Have_ to (1), 2. Uncomment INCLUDE(..._ST')
_Have_StringTheory_ EQUATE(1) !1. Set as (1) = Have StringTheory
INCLUDE('FindCleanCwIDE_ST.clw','GLOBAL') !2. Uncomment ! Include(StringTheory
COMPILE('!**END ST Clean**', _Have_StringTheory_)
CleanOk = ST_CleanClaPropXmlFile(CleanQ.PathBS & ClarionProperties_xml , pQuery, |
ClnStats, CleanQ.CleanMsg)
!end COMPILE('!**END ST Clean**'
It is impressive how little ST code it took GR to shrink the FindPatterns.