Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Odd behavior with #ENDIF in #DEFINE
Message
From
11/09/2006 16:47:56
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
11/09/2006 16:01:12
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01152849
Message ID:
01152879
Views:
26
>>Greg,
>>
>>After VFP encounters #IF .F. it will ignore all lines until it finds #ELIF or closing #ENDIF.
>>
>
>This I do understand. Actually I am attempting to take advandage of it. What I want is when the developer views the code, they will see the TEST_SUITE / ENDTEST_SUITE statement block. But when compiled, the code between these two statement is removed from the compiled version. To help clarify why I want to do this; I am developing a class that when passed a object reference it will recurs the object model and scan the source code for TEST_SUITE statements. When found, the code between the TEST_CASE are extracted, and executed as automated test cases. So far, I have most of it complete, but this inability to convert the ENDTEST_SUITE into proper #ENDIF statement is hanging me up.

I think the VFP preprocessor is single-pass. Which means it'll transform whatever it can into their proper replacements, but then if you have to have a second layer of replacements, you may be out of luck. I'm not sure at all whether the second replacement ever takes place.

You may try to use something like
*-- start test code
#ifdef c_testing
{your testing code here}
#endif
*-- end test code
...and have a #define testing somewhere in your .h files, which you'd then remove when not testing. And you could use the comments around this block to find the chunks of code you want to (str)extract.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform