Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get preprocessed code.
Message
From
14/11/2004 11:22:57
 
 
To
14/11/2004 10:52:53
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro Beta
Miscellaneous
Thread ID:
00960730
Message ID:
00961258
Views:
8
>>>I have a problem.
>>>
>>>I need to have the preprocessed sourcecode ( #DIRECTIVES applied ).
>>>Exist a way for this ?
>>>This is for debug control.
>>>
>>>But the same problem has a greater impact in the following case:
>>>- Properties expression are not preprocessed ( a bug for me )
>>>- i want use WriteExpression for put into a property the preprocessed expression
>>>
>>>Exampe:
>>>
>>>#DEFINE PRECONSTANT1 1
>>>* table.expression is 'm.this.byby>PRECONSTANT1'
>>>objselected[1].WriteExpression('someprop',??????)
>>>* now objselected[1].someprop have to be = m.this.byby>1
>>>
>>>
>>>Someone knows one mode ( ????? operation ) in order making to make it to the VFP preprocessor ?
>>>
>>>The only way that i found for use preprocessor at runtime is with COMPILE/EXECSCRIPT,
>>>but i have not found a way for get the preprocessed code.
>>>
>>>I have to rewrite the VFP preprocessor ?
>>>A lot frustrating, I have the vfp preprocessor available, but I cannot use it.
>>>
>>>Thanks,
>>>Fabio
>>
>>hi Fabio,
>>
>>It looks like you'll have to write your own preprocessor.
>>
>>The only way I've found to see some preprocessed code is when there's an error on a line, eg
>>
>>
>>#define	MAX_INTEGER	(0x7fffffff)
>>
>>set MAX_INTEGER ON
>>
>>
>>The prog.err file looks like
>>
>>set (0x7fffffff) ON
>>Error in line 30: Command contains unrecognized phrase/keyword.
>>
>>
>>There may be a way with a sys() that is not documented, but then someone from Microsoft would have to answer that
>
>
>Hi Gregory,
>
>this I knew it,
>but your message has made to see one me solution (slow),
>at least for the expressions.
>
>
>CLEAR
>FOR K=1 TO ALINES(aExp,PreprocessExpr('PRECONSTANT1>3,PRECONSTANT1*m.x+INT(m.y)','#DEFINE PRECONSTANT1 1'),',')
>	? aExp[m.k]
>NEXT
>
>FUNCTION PreprocessExpr(sExp,sDefines)
>	PRIVATE sTempFile,sCode
>	STORE SYS(2023)+'\_#####COMPILE####_.tmp' TO sTempFile
>	
>	=STRTOFILE(m.sDefines+CHR(13)+[=]+m.sExp+[,=],m.sTempFile)
>	COMPILE (m.sTempFile)
>	
>	STORE STREXTRACT(FILETOSTR(FORCEEXT(m.sTempFile,'err')),'=',',='+CHR(13)) TO sCode
>	ERASE FORCEEXT(m.sTempFile,'*')
>	RETURN m.sCode
>ENDFUNC
>
>
>Fabio

hi Fabio,

Well I guess it will be a lot faster than writing your own preprocessor which would be a RegEx search with a huge pattern consisting of all the defines, skipping the defines that are in a string, except the [] string of course. (leaving aside the defines based on other defines)

Oh, btw, I'm writing a RegEx class in vfp for fun in my spare time ;-)
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform