Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Tool to count lines of code?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00125475
Message ID:
00125552
Vues:
21
>Is there any way to know how many lines of code we've written in a VFP app?

For program files, you could count CHR(13)+CHR(10) pairs (let´s call them CRLF) in the text, though there are some problems:

1. Tabs are a bother; replace all CHR(9) with " "

2. Spaces at the beginning of a line can hinder some of the ideas below, so you could replace CRLF+" " with CRLF until there are no more CRLF+" " left. (See (7) below.)

3. Spaces at the end of a line are also a bother; replace " "+CRLF with CRLF until there are no more left. (See (6) below.)

4. empty lines shouldn´t be counted. Replacing CRLF+CRLF with CRLF until there are no more CRLF+CRLF left works.

5. Put the entire code in uppercase using UPPER(). (See (7) below.)

OK! Now count CRLF pairs, but...

6. continuation lines shouldn´t be counted. Count ";"+CRLF and deduct that number from the CRLF count. (This works because of step (3) above.)

7. all comment lines shouldn´t be counted either. Count CRLF+"*", CRLF+"&&", and CRLF+"NOTE", and subtract that number too. (This works because of steps (2) and (5) above.)

This should be a good approximation!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform