Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ISSUE: Macro substitution fail
Message
De
11/08/2004 05:17:02
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Titre:
ISSUE: Macro substitution fail
Divers
Thread ID:
00932265
Message ID:
00932265
Vues:
58
Macro substitution is a recursive process ( this remembers the LISP )

On next program, VFP fire a recursive error:
CLEAR
ON ERROR ?? MESSAGE() AT 30
DIMENSION x[1]
? "expected '&"+"x'"
?? '&x'		at 30
? "expected '&"+"x[1]'"
?? '&x[1]'	at 30
? "expected '&"+"x.['"
?? '&x.['	at 30
? "expected '&"+"x['"
?? '&x['	at 30
Because is the expected value '&x[':

Explain the Macro subs process:
Steps
0. '&x['
1. a)  : &x is equal to &x[1], x[1] is a logical then no subs have to do
   b)  : on VFP, on a pattern like '&x[nnn]', 
                  if (x is a array) and (x[1] is a string) and (nnn<>1)
                     then &x is not substituited with the x[1] value
Of course, to found a workaround is simple:
??	'&x'+'['	at 30
BUT IT fixed only the first level of the recursive process.

This issue ( a bug for me ) have another effect:

What it can be made with variables with indexes names ( name1,name2... )
it cannot to be made with a Array.

Example:
* with indexes names
x1='&x'
CLEAR
ON ERROR ?? MESSAGE() AT 30
? 'Expected &x3'
?? '&x1.1.1.1.1.1.1.3'

y1='&y'
y2='1'
? 'Expected &y3'
?? '&y1.1.1.1.1.1.1.3' AT 30

? 'Expected &y3'
?? '&y1.1.&y2..1.1.1.3' AT 30
? 'Expected &y3'
?? '&y1.&y2..1.1.1.1.3' AT 30

* try to replicate with a array
DIMENSION Z[2]
z[1]='&z'
z[2]='[1]'
? 'Expected &z3'
?? '&z[1].[1].[1].[1].3' AT 30

? 'Expected &z3'
?? '&z[1].[1].&z[2]..[1].[1].3' AT 30
Thanks,
Fabio
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform