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

I don't think it's a bug but rather a limitation. Keep in mind that #DEFINE is processed in the pre-compile time when VFP does a vary limited parsing.

>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']
>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform