Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with your faq
Message
De
28/09/2005 02:45:19
Lutz Scheffler (En ligne)
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Problem with your faq
Divers
Thread ID:
01053752
Message ID:
01053752
Vues:
38
Hi Greg,

I have tested your FAQ #27946 and found it a nice idea.

It also teaches me the differnce between PARAMETERS and LPARAMETERS, something I never understand till now.

But I found some little problems with the code. I altert it to what I think better code and post it below. Feel free to add it to your FAQ.

Replace the main section off your code with the following and run the whole stuff.
CLEAR
lox = 'x   x'
xtest(1,2,3,4,5,6,7,8,9,10,11,12,13,14)

PROCEDURE xtest

 LPARAMETERS;
 pxFirst,;
 pxSecond,;
 pxThird,;
 pll4,;
 pll_5,;
 pll__6,;
 pll___7,;
 pll____8,;
 pll_____9,;
 pll_____10,;
 pll______11,;
 pll_______12,;
 pll________13,;
 pll________14
 LOCAL pcnt,pll
 pll=2
 pcnt = PCOUNT()
 FOR i=1 TO pcnt
  lcName = aPara( i, pcnt)
  ? lcName, EVALUATE(lcName)
 NEXT

 RETURN
ENDPROC
The first problem is that it will fail after the third para.

This is because you check in aPara
CASE lnPar > lnPCount
Better (in the first) would be:
CASE lnPar > pcnt
In the second this is wrong too, because you start lnPara with 0 so it must be
CASE lnPar > pcnt-1
or the like

If you have that fixed run the stuff again
On my comp I see wrong paras after paran No. 10
I get the following
m.PXFIRST       1
m.PXSECOND       2
m.PXTHIRD       3
m.PLL4       4
m.PLL_5       5
m.PLL__6       6
m.PLL___7       7
m.PLL____8       8
m.PLL_____9       9
m.PLL_____10       10
m.PCNT       14
m.PLL       2
m.I       13
m.LCNAME  m.LCNAME
This is because LIST MEMORY breaks the line if the varname is longer then 10 chars.
In that case you need the check the next line

If you replace like
*old
*  lcMemory	= STRTRAN(laMemory[lnLine],' ',CHR(13)+CHR(10))
*new
  lcMemory	= laMemory(lnLine)
  IF !EMPTY(lcMemory) AND OCCURS(' ',lcMemory)<2 AND lnLine<lnLines THEN
   lnLine = lnLine+1
  lcMemory	= lcMemory+' '+laMemory(lnLine)
  ENDIF &&!EMPTY(lcMemory) AND OCCURS(' ',lcMemory)<2 AND lnLine<lnLines
  lcMemory	= STRTRAN(lcMemory,' ',CHR(13)+CHR(10))
  lnCnt = ALINES(laVar, lcMemory, .T.)
it will work better


Agnes
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform