Re: Identifying Un-used functions and commands
On 11/28/19 9:52 AM, J. Landman Gay via use-livecode wrote: We should verify whether we're looking for orphaned handlers or orphaned calls. If it's handlers I'd do something like: Scan all scripts for "end" & space to get a list of handlers Remove duplicates Scan all scripts for each handler name and keep a count If there's only two instances of the handler name, it's an orphan. Um. No. It's a bit more complicated. Removing duplicates without keeping track of the object script wouldn't catch handlers of the same name in different scripts. And you'd want to eliminate system messages from the list so that a closeStack handler, for instance, wouldn't show up as an orphan. -- Mark Wieder ahsoftw...@gmail.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Identifying Un-used functions and commands
We should verify whether we're looking for orphaned handlers or orphaned calls. If it's handlers I'd do something like: Scan all scripts for "end" & space to get a list of handlers Remove duplicates Scan all scripts for each handler name and keep a count If there's only two instances of the handler name, it's an orphan. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com On November 28, 2019 11:05:56 AM Mark Wieder via use-livecode wrote: On 11/28/19 8:25 AM, Richard Gaskin via use-livecode wrote: Quentin Long wrote: > Finding explicit function/command calls seems like it should be a > fairly straightforward task. However, the "do" keyword can also be > a source of function/command calls, which complicates matters a > wee bit. You'll also need to evaluate all the non-cleartext components > that can go into "do" statements— > do (VariableName) > do (the WhateverProp of ThisObject) > do (line 4 of fld "ThisField") > —etc etc etc. There are many reasons to resort to "do" only after all other more with-the-grain approaches cannot be made to work. That it eludes static code analysis is just one more. If I get around to tidying up my old orphan-finder and adding it to other code base management tools in devolution, I wouldn't bother attempting to handle "do" cases. Low ROI, and not handling them helps draw attention to the technical debt many uses of "do" accrue. Somewhat similar problem with "send" and "dispatch" commands as well. You can alleviate this a bit during parsing by seeing if what follows the "do" or "send" or "dispatch [function]" command is a quoted string. -- Mark Wieder ahsoftw...@gmail.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Identifying Un-used functions and commands
On 11/28/19 8:25 AM, Richard Gaskin via use-livecode wrote: Quentin Long wrote: > Finding explicit function/command calls seems like it should be a > fairly straightforward task. However, the "do" keyword can also be > a source of function/command calls, which complicates matters a > wee bit. You'll also need to evaluate all the non-cleartext components > that can go into "do" statements— > do (VariableName) > do (the WhateverProp of ThisObject) > do (line 4 of fld "ThisField") > —etc etc etc. There are many reasons to resort to "do" only after all other more with-the-grain approaches cannot be made to work. That it eludes static code analysis is just one more. If I get around to tidying up my old orphan-finder and adding it to other code base management tools in devolution, I wouldn't bother attempting to handle "do" cases. Low ROI, and not handling them helps draw attention to the technical debt many uses of "do" accrue. Somewhat similar problem with "send" and "dispatch" commands as well. You can alleviate this a bit during parsing by seeing if what follows the "do" or "send" or "dispatch [function]" command is a quoted string. -- Mark Wieder ahsoftw...@gmail.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Identifying Un-used functions and commands
Quentin Long wrote: > Finding explicit function/command calls seems like it should be a > fairly straightforward task. However, the "do" keyword can also be > a source of function/command calls, which complicates matters a > wee bit. You'll also need to evaluate all the non-cleartext components > that can go into "do" statements— > do (VariableName) > do (the WhateverProp of ThisObject) > do (line 4 of fld "ThisField") > —etc etc etc. There are many reasons to resort to "do" only after all other more with-the-grain approaches cannot be made to work. That it eludes static code analysis is just one more. If I get around to tidying up my old orphan-finder and adding it to other code base management tools in devolution, I wouldn't bother attempting to handle "do" cases. Low ROI, and not handling them helps draw attention to the technical debt many uses of "do" accrue. -- Richard Gaskin Fourth World Systems Software Design and Development for the Desktop, Mobile, and the Web ambassa...@fourthworld.comhttp://www.FourthWorld.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Identifying Un-used functions and commands
> Date: Tue, 12 Nov 2019 12:12:47 -0500 > From: Stephen MacLean > To: How to use LiveCode > Subject: Identifying Un-used functions and commands > Message-ID: > Content-Type: text/plain; charset=utf-8 > > Hi All, > > I?m wondering if anyone has a way or code to identify any un-used functions >and commands in a set of stacks? Finding explicit function/command calls seems like it should be a fairly straightforward task. However, the "do" keyword can also be a source of function/command calls, which complicates matters a wee bit. You'll also need to evaluate all the non-cleartext components that can go into "do" statements— do (VariableName) do (the WhateverProp of ThisObject) do (line 4 of fld "ThisField") —etc etc etc. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Identifying Un-used functions and commands
Jacque, Ah. You may be right. So, Steve, which way, or do you need both? The methodology is basically the same. Craig -Original Message- From: J. Landman Gay via use-livecode To: How to use LiveCode Cc: J. Landman Gay Sent: Mon, Nov 25, 2019 1:09 pm Subject: Re: Identifying Un-used functions and commands I think he wants it the other way around, identifying handlers and functions that aren't called by any other handler. I've done this, but only one at a time, by searching for the handler name across all open stacks. If the only occurrence is the handler itself ("on/function whatever", ) then it's unused. The method here would probably be to get a list of all handlers and functions and then do a global search for instances of each. If there's one or more that isn't the handler declaration, it's used. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com On November 25, 2019 11:51:14 AM dunbarx--- via use-livecode wrote: > Hi. > This was posted a couple of weeks ago, no? > I suggested then that you could write a short handler that loops through > all the scripts in all the controls on all the cards, and isolate words > that are not preceded by either "command", "on" or "function". In this way > you might see, for example, that "myGadget3" may be present in scripts here > and there, but there is no "on myGadget3" anywhere. Then you will have > found an unused handler call. > This may require tweaking. For example, LC will compile, say: > "on myGadget3" -- spaces galore > > Craig > > -Original Message- > From: Bob Sneidar via use-livecode > To: How to use LiveCode > Cc: Bob Sneidar > Sent: Mon, Nov 25, 2019 12:29 pm > Subject: Re: Identifying Un-used functions and commands > > Since there is code in the script editor that knows the location of any > command or function you right click on, if you found out how they do that, > you would be well on your way to developing a way to grok it. Also, GLX2 > has a "clairvoyance" (Auto-Complete) function that is handler aware. I > suspect Mark Wieder developed a method for getting a list of all handlers > in a stack that is opened. That would probably help too. > > Bob S > > >> On Nov 12, 2019, at 09:12 , Stephen MacLean via use-livecode >> wrote: >> >> >> Hi All, >> >> >> I’m wondering if anyone has a way or code to identify any un-used functions >> and commands in a set of stacks? >> >> >> Best, >> Steve MacLean >> >> >> ___ >> use-livecode mailing list >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your >> subscription preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Identifying Un-used functions and commands
revRefactor has a very nice "orphan Code..." feature https://github.com/mwieder/revRefactor/tree/master/Plugin On 11/25/2019 1:08 PM, J. Landman Gay via use-livecode wrote: I think he wants it the other way around, identifying handlers and functions that aren't called by any other handler. I've done this, but only one at a time, by searching for the handler name across all open stacks. If the only occurrence is the handler itself ("on/function whatever", ) then it's unused. The method here would probably be to get a list of all handlers and functions and then do a global search for instances of each. If there's one or more that isn't the handler declaration, it's used. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com On November 25, 2019 11:51:14 AM dunbarx--- via use-livecode wrote: Hi. This was posted a couple of weeks ago, no? I suggested then that you could write a short handler that loops through all the scripts in all the controls on all the cards, and isolate words that are not preceded by either "command", "on" or "function". In this way you might see, for example, that "myGadget3" may be present in scripts here and there, but there is no "on myGadget3" anywhere. Then you will have found an unused handler call. This may require tweaking. For example, LC will compile, say: "on myGadget3" -- spaces galore Craig -Original Message- From: Bob Sneidar via use-livecode To: How to use LiveCode Cc: Bob Sneidar Sent: Mon, Nov 25, 2019 12:29 pm Subject: Re: Identifying Un-used functions and commands Since there is code in the script editor that knows the location of any command or function you right click on, if you found out how they do that, you would be well on your way to developing a way to grok it. Also, GLX2 has a "clairvoyance" (Auto-Complete) function that is handler aware. I suspect Mark Wieder developed a method for getting a list of all handlers in a stack that is opened. That would probably help too. Bob S On Nov 12, 2019, at 09:12 , Stephen MacLean via use-livecode wrote: Hi All, I’m wondering if anyone has a way or code to identify any un-used functions and commands in a set of stacks? Best, Steve MacLean ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Identifying Un-used functions and commands
I think he wants it the other way around, identifying handlers and functions that aren't called by any other handler. I've done this, but only one at a time, by searching for the handler name across all open stacks. If the only occurrence is the handler itself ("on/function whatever", ) then it's unused. The method here would probably be to get a list of all handlers and functions and then do a global search for instances of each. If there's one or more that isn't the handler declaration, it's used. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com On November 25, 2019 11:51:14 AM dunbarx--- via use-livecode wrote: Hi. This was posted a couple of weeks ago, no? I suggested then that you could write a short handler that loops through all the scripts in all the controls on all the cards, and isolate words that are not preceded by either "command", "on" or "function". In this way you might see, for example, that "myGadget3" may be present in scripts here and there, but there is no "on myGadget3" anywhere. Then you will have found an unused handler call. This may require tweaking. For example, LC will compile, say: "on myGadget3" -- spaces galore Craig -Original Message- From: Bob Sneidar via use-livecode To: How to use LiveCode Cc: Bob Sneidar Sent: Mon, Nov 25, 2019 12:29 pm Subject: Re: Identifying Un-used functions and commands Since there is code in the script editor that knows the location of any command or function you right click on, if you found out how they do that, you would be well on your way to developing a way to grok it. Also, GLX2 has a "clairvoyance" (Auto-Complete) function that is handler aware. I suspect Mark Wieder developed a method for getting a list of all handlers in a stack that is opened. That would probably help too. Bob S On Nov 12, 2019, at 09:12 , Stephen MacLean via use-livecode wrote: Hi All, I’m wondering if anyone has a way or code to identify any un-used functions and commands in a set of stacks? Best, Steve MacLean ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Identifying Un-used functions and commands
Hi. This was posted a couple of weeks ago, no? I suggested then that you could write a short handler that loops through all the scripts in all the controls on all the cards, and isolate words that are not preceded by either "command", "on" or "function". In this way you might see, for example, that "myGadget3" may be present in scripts here and there, but there is no "on myGadget3" anywhere. Then you will have found an unused handler call. This may require tweaking. For example, LC will compile, say: "on myGadget3" -- spaces galore Craig -Original Message- From: Bob Sneidar via use-livecode To: How to use LiveCode Cc: Bob Sneidar Sent: Mon, Nov 25, 2019 12:29 pm Subject: Re: Identifying Un-used functions and commands Since there is code in the script editor that knows the location of any command or function you right click on, if you found out how they do that, you would be well on your way to developing a way to grok it. Also, GLX2 has a "clairvoyance" (Auto-Complete) function that is handler aware. I suspect Mark Wieder developed a method for getting a list of all handlers in a stack that is opened. That would probably help too. Bob S > On Nov 12, 2019, at 09:12 , Stephen MacLean via use-livecode > wrote: > > Hi All, > > I’m wondering if anyone has a way or code to identify any un-used functions > and commands in a set of stacks? > > Best, > Steve MacLean > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Identifying Un-used functions and commands
Since there is code in the script editor that knows the location of any command or function you right click on, if you found out how they do that, you would be well on your way to developing a way to grok it. Also, GLX2 has a "clairvoyance" (Auto-Complete) function that is handler aware. I suspect Mark Wieder developed a method for getting a list of all handlers in a stack that is opened. That would probably help too. Bob S > On Nov 12, 2019, at 09:12 , Stephen MacLean via use-livecode > wrote: > > Hi All, > > I’m wondering if anyone has a way or code to identify any un-used functions > and commands in a set of stacks? > > Best, > Steve MacLean > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
RE: Identifying Un-used functions and commands
"DO"s make this tricky. EX: Say you have some code that is mobile platform specific. do "myHandlerBaseName platform param1, param2". This example may not be good practice but "DO"s can trip you up looking for orphan handlers. Ralph DiMola IT Director Evergreen Information Services rdim...@evergreeninfo.net -Original Message- From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of dunbarx--- via use-livecode Sent: Tuesday, November 12, 2019 12:43 PM To: use-livecode@lists.runrev.com Cc: dunb...@aol.com Subject: Re: Identifying Un-used functions and commands Hi. "unused functions and commands"? Do you mean handlers that exist in a script somewhere but are never called from anywhere? I suppose you can search all scripts, and if a certain handler name does not appear without being prepended by either "on" & space(s) or "function" & space(s) then you can say that handler is never called. Craig -Original Message- From: Stephen MacLean via use-livecode To: How to use LiveCode Cc: Stephen MacLean Sent: Tue, Nov 12, 2019 12:14 pm Subject: Identifying Un-used functions and commands Hi All, I’m wondering if anyone has a way or code to identify any un-used functions and commands in a set of stacks? Best, Steve MacLean ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Identifying Un-used functions and commands
Hi. "unused functions and commands"? Do you mean handlers that exist in a script somewhere but are never called from anywhere? I suppose you can search all scripts, and if a certain handler name does not appear without being prepended by either "on" & space(s) or "function" & space(s) then you can say that handler is never called. Craig -Original Message- From: Stephen MacLean via use-livecode To: How to use LiveCode Cc: Stephen MacLean Sent: Tue, Nov 12, 2019 12:14 pm Subject: Identifying Un-used functions and commands Hi All, I’m wondering if anyone has a way or code to identify any un-used functions and commands in a set of stacks? Best, Steve MacLean ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Identifying Un-used functions and commands
Hi All, I’m wondering if anyone has a way or code to identify any un-used functions and commands in a set of stacks? Best, Steve MacLean ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode