Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get preprocessed code.
Message
De
14/11/2004 10:52:53
 
 
À
13/11/2004 04:12:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Divers
Thread ID:
00960730
Message ID:
00961249
Vues:
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform