Introduction

Being a long-time Visual FoxPro turned .NET developer, I am now faced with
the task of porting several existing applications from VFP to .NET - and
providing customers with estimates of effort for each project as well.

Since I could not find a Source Lines of Code (SLOC) tool for VFP projects, I
decided to build one. This article is the result of my work and I hope someone
else will find this tool useful in their work.

Using the Application

The VFPLOCCounter application is very easy to use - simply
select the VFP *.pjx file you wish to analyze and then click the
Process button.

History

30th December, 2011: Updated project, corrected bug that did not
correctly account for lines containing a single character (such as a ? or a
single tab). Also corrected bug that prevented Include files (.h) from being
examined. Also correctly count comment lines that begin with "&&" as comment
lines and not code lines. Starting a comment line with "&&" is considered
bad form in VFP, but is allowed nonetheless.

After looking over the program it occured to me that the problem may be that some of the reports, programs, forms, etc that are part of the VFP application may not be included in the application project file. This tool will only analyze those files that are found in the PJX file. If it isn't in the PJX, it won't be analyzed.

As for the reports LOC count being low, I discovered on VFP 9 reports there are two fields that can contain code - 'expr' and 'supexpr' and the tool was not examining the 'supexpr' field. That has been added to the code.

I have submitted an update to the article with updated source code. If you need the source code prior to the CP editors updating the article, give me an email address and I'll send it to you.