>>>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.