Counting Lines of Code
Kay C Lan
lan.kc.macmail at gmail.com
Mon Sep 14 02:18:35 EDT 2009
On Mon, Sep 14, 2009 at 12:11 PM, Edward D Lavieri Jr <edljr at mac.com> wrote:
> Does anyone know an way that I can count the total lines of code in a stack
> that has numerous substacks and handlers assigned to objects, cards, and
> stacks? I have tried using the Revolution Script Reporter, but it chokes on
> stacks of significant size.
>
Chipp Walter's AltStats does that. It's a very old pluggin, been around
since 1.1 I think, but it still works with 3.5. Not only does it count
lines, but words, chars, buttons, images, fields and groups, and gives the
data broken down as individual objects, per card, per sub-stack, per stack
and as a Grand Total. I'd like to give you a link but I went to Chipp's site
but I couldn't find it. So here's his site:
http://www.altuit.com/webs/altuit2/RunRev/default.htm
up in the top left corner is a contact link so you can email him and ask for
directions.
On the other hand, you could just roll your own. Not functional, but here's
a stepping stone (or two):
--probably need to declare a script local variable to keep track of your
tallies
local lOutput
put the openstacks into tOpenStacks
--don't need any of the rev stacks listed
filter tOpenStacks without "rev*"
filter tOpenStacks without "message*"
sort tOpenStacks
--assuming you're using an Option Button
set the text of button "SelectStack" to tOpenStacks
--inside your Option Button "SelectStack" you could have
ON menuPick pChosenStack
put the substacks of stack pChosenStack into tSubStacks
IF (tSubStacks <> empty) THEN
put pChosenStack & cr & tSubStacks after tStackNames
ELSE
put pChosenStack into tStackNames
END IF
REPEAT FOR each line tStack in tStackNames
REPEAT WITH tCard = 1 to the number of cards of stack tStack
REPEAT WITH tControl = 1 to the number of controls of card tCard of stack
tStack
IF (the script of control tControl of card tCard of stack tStack <>
empty) THEN
--once here you can do anything you like, count lines, words, chars etc
etc
--myCustomHandler the script of control tControl
END IF
END repeat --end control repeat
--after doing all the scripts of each control on a card we need to do the
script of the card
IF (the script of card tCard of stack tStack <> empty) THEN
--basically do exactly the same as above
--myCustomHandler the script of card tCard
END IF
END repeat -- end card repeat
--after doing all the scripts of each card we need to do the script of the
stack
IF (the script of stack tStack <> empty) THEN
--basically do exactly the same as above
--myCustomHandler the script of stack tStack
END IF
END repeat --end stack repeat
END menuPick
ON myCustomHandler pTheScript
--do whatever you need to
--use the local variable lOutput so data is not
--lost as you pop in and out of this handler
put myNewData & cr AFTER lOutput
END myCustomHandler
HTH
More information about the use-livecode
mailing list