Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: Parser not compile #define on particular strings
Message
From
11/08/2003 06:52:06
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
BUG: Parser not compile #define on particular strings
Miscellaneous
Thread ID:
00818823
Message ID:
00818823
Views:
53
Hi,

VFP compile #define within square brackets strings;
but compiler count internal string separator ( ? ), and stop #define replacement within the string while the count id odd.
_screen.Cls
@ 1,1 say ''

#define MYDEFINITION1 "Fabio"
#define MYDEFINITION2 is Live

* NO REPLACEMENT
? "MYDEFINITION1 MYDEFINITION2 "
? 'MYDEFINITION1 MYDEFINITION2 '

* REPLACEMENT
? [MYDEFINITION1 MYDEFINITION2 ]

? [MYDEFINITION1" MYDEFINITION2 " MYDEFINITION1]
? [MYDEFINITION1' MYDEFINITION2 ' MYDEFINITION1]

? [MYDEFINITION1' MYDEFINITION2 '" MYDEFINITION1 " MYDEFINITION2 ]
Workaround: split string on substrings.

But: "The devil makes the pots, but not the covers!"
#define MYDEFINITION3 Dell'

? [MYDEFINITION3 MYDEFINITION3 MYDEFINITION3]
? [MYDEFINITION3 MYDEFINITION3' MYDEFINITION3]
Then, you need to remember if the constant it contains ' or " characters,
or you split the string every time for every constant!

Note: Why parser for #define replacement, analyzes also the replaced values?

This is much annoying one in SPT commandos for MSQL ( within have ' ), where need a spilt for insert VFP string values:
Example:
* on include file
#DEFINE CHR_ANY %
#DEFINE CHR_ONE _
*
sqlCmd=[SELECT * FROM myTable WHERE f1 LIKE 'CHR_ANY]+m.sMask+["CHR_ONE"CHR_ANY']
Next
Reply
Map
View

Click here to load this message in the networking platform