Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can you get a count of the lines of code
Message
From
24/08/1999 17:33:05
 
 
To
24/08/1999 17:06:55
Bruno Di Lalla
Bdl Computer Consulting
Greely, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00257293
Message ID:
00257340
Views:
17
>>>A client has requested the number of lines of code in one of our systems [I don't know why -- the request was forwarded to me]. Is there an easy way to get this info -- is this number [or something similar] stored somewhere in the project?
>>>
>>>Thanks
>>>Doug
>>
>>Including lines of code in VCXs, PRGs, SCXs, MNXs, and QPRs? I would suggest writing a small prg to sum all the memlines() in the method fields of all the VCX and SCX files. Then you have Procedure and Command fields in the MNX to sum the memlines() for. I think you can use the Debugger profiler to get line numbers for PRGs. You might be better off appending the PRGs into a dummy dbf and counting the non-blank and non-commented lines. Of course, the line continuations [semi-colons] would slightly inflate this count. So, you could count how many non-commented lines end in a semi-colon to subtract this number off.
>>
>>You can do a SELECT TYPE, NAME,, HOMEDIR from the PJX file for TYPES of M, K, and V [menus, forms and classes] to get the list of items to count memlines for.
>>
>>Good luck.
>
>Another method, if you want all VCXs, PRGs, etc., is to run the document wizard. It will create a file named after your project name with an extension .lst
>
>This file contains the entire listing of the application, including Referential integrity code. You may then open this file as a program file in VFP and check the status bar for the number of lines.
>
>Note: For the number of lines to show in the status bar, right click the program window, click on properties, and check the option Show line/column position. Also, when using the document wizard, don't select to generate the file listing as this takes forever.
>

Again, you can just look in Files.Lst to get essentially the same number without added lines for procedsure file names, etc. The project name.LST adds some even more nonsensical lines to the count.

Single command lines split into multiple lines get counted this way. So if you're being paid by the KLOC, make sure to write:

SELECT * from MyFile INTO Cursor TEMP

as

SELECT ;
* ;
FROM ;
MyFile ;
INTO ;
Cursor ;
Temp

and offset each line with plenty of whitespace above and below. You can bust up your literal strings, too, so that:

"GREED"

becomes

"G" + ;
"R" + ;
"E" + ;
"E" + ;
"D"

Line counts made with documenting wizard are completely non-indicative of the code involved.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform