Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Control the definitions of variables
Message
From
01/01/2007 07:43:10
 
 
To
01/01/2007 07:30:41
Hans-Otto Lochmann
Dr. Lochmann Consulting Gmbh
Frankfurt, Germany
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
01181174
Message ID:
01181180
Views:
10
Hans,

Well, I knew it existed and have to confess I've never used it

___________________
>Hi Gregory,
>
>thank you for your fast answer. It sounded good, I downloaded ParseLocals, installed it and used it to test some working code, well known to me, and it returned some questionable results. I assume that one reason for these analysis results might come from the coding style, which I use: I prefer one-line-declarations, use of the >>m.<< prefix and so on (see below).
>
>So again many thanks for this hint, Gregory, but ParseLocals does not seem to do what I am looking for.
>
>By the way: A tool, which does the complementary job, can be found in "MegaFox: 1002 Things You Wanted to Know About Extending Visual FoxPro", p. 20, "How do I set up a hot key to declare local variables?" Example:
>DeclareLocals.prg. After tweaking this a little bit, it also generates one-line-declarations. Use: Have the pointer on a variable somewhere in the code, hit ALT+6 (or whatever you assign for this) and this routine checks, whether the variable is declared. If not, then is does this for you, using the VFP naming conventions (lnX = local numeric etc).
>
>Using it when coding is a tremendous help, just excellent! But using this tool to check existing code is very time consuming. So I am still looking for a tool doing that reverse kind of job.
>
>I will now add two examples to show what I observed using ParseLocals. Sorry for the lengthy examples, but I think otherwise the examples might be difficult to follow. Here is Example 1:
>
>Procedure AddASinglePath
>
>  Local loFolder As Object
>  Local loFSO As Object
>  Local lcInputValue As String
>  Local lcNewDir As String
>  Local lcNewPath As String
>  Local lcOldDir As String
>  Local lcPrompt As String
>
>  m.lcPrompt = 'Pick your directory'
>
>  m.lcOldDir = Sys(5)+Curdir()
>  m.lcNewDir = ''
>  *--  GETDIR([cDirectory [, cText] [, cCaption [, nFlags [, lRootOnly]]]])
>  m.lcInputValue = Getdir(m.lcNewDir, m.lcPrompt, HLSTART_APPLICATION_HEADER, 64)
>
>  If Empty(m.lcInputValue)
>    Wait Window Chr(13) + ' Nothing selected ! ' + Chr(13)
>  Else
>    *-- Get the original capitalization of the path name elements.
>    m.loFSO = Createobject('Scripting.FileSystemObject')
>    m.loFolder = m.loFSO.GetFolder( m.lcInputValue )
>    m.lcInputValue = Addbs(m.loFolder.Path)
>    Store .Null. To m.loFolder, m.loFSO
>  Endif Empty(m.lcInputValue)
>.....
>Endproc && AddASinglePath
>
>which resulted in the message:
>
>***********************
>Function AddASinglePath
>***********************
>Add ;
>	Local m.loFolder, m.loFSO
>
>And here is the example2:
>
>Function AddPath
>
>  Lparameters tcExisting As String, tcAdditional As String
>
>  Local lcElement As String
>  Local lnI As Integer
>  Local lnLinesInArray As Integer
>  Local lcNewPath As String
>  Local Array laPathArray[1]
>
>  If Type( "m.tcAdditional") <> "C" Or Empty( m.tcAdditional )
>    Return m.tcExisting
>  Endif Empty( m.tcAdditional )
>
>  *--  Add new elements, avoid double entries.
>  If Empty( m.tcExisting )
>    m.lcNewPath = m.tcAdditional
>  Else
>    m.lcNewPath = m.tcExisting + ";" + m.tcAdditional
>  Endif Empty( m.lcNewPath )
>  m.lnLinesInArray = Alines(laPathArray,Strtran(Strtran(Strtran(m.lcNewPath,",",";"),";;",";"),";",Chr(13)),4)
>  m.lcNewPath = ";"
>  For m.lnI = 1 To m.lnLinesInArray
>    m.lcElement = Strtran(laPathArray(m.lnI), '"', '')
>    If At( ';' + Addbs(Lower(m.lcElement)) + ';', Lower( m.lcNewPath )) = 0
>      m.lcNewPath = m.lcNewPath + Addbs( m.lcElement ) + ';'
>    Endif At( Addbs( Lower( Alltrim(laP ...
>  Next m.lnI
>...
>Endfunc && AddPath
>
>which which resulted in the message:
>
>****************
>Function AddPath
>****************
>Add ;
>	Local m
>
>Remove Local ;
>	lnI, ;
>
>
>
>
>>>Hi All,
>>>
>>>Happy New Year 2007 to everybody!
>>>
>>>I faintly remember there has been a tool which allows comparing the definitions of the variables at the beginning of program/Subroutine/Function with what is used in the code later on. Can please somebody help me to update my memory?
>>>
>>>Presently I am working on some old code, some of which I got from somewhere else, and such a tool would be very helpful.
>>>
>>>Hans
>>
>>Hans,
>>
>>Is this what you are looking for ? http://fox.wikis.com/wc.dll?Wiki~ParseLocals
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform