Program that counts the (LOC) that were added, deleted, modified?

Do anyone have the source code or know how to code a program that counts the number of lines of code (LOC) that were added, deleted, or modified between program versions (i.e., between base code and final code)? Please Help?


Comments

  • The simplest solution would be to do a Char-by-Char comparison,

    Checking for new lines is easy - does the new version have more LOC then the base version?

    Deleted lines, same as above in reverse.

    Because StreamTokonizer gives you TT_EOL, you can check for modified lines because you'll be doing your char-by-char comparison on a line and then all of a sudden the new version will not be the same as the base version.... Then because you have TT_EOL you'll know when you've reached the end of that particular line on the base version and when you hit it on the new version - at which point you start again deciding if it's been modified or not.

    Obviously you could fine tune it a lot more then that but this is to illustrate that StreamTokonizer offers the facility to realise where the end of lines in each file is and thus keep track of which line is which on a base file and a new version file and thus compare each line for differences.

    Hope it's of some help,
    Cheers
    -Phill.
    Qudon Foundation: Computing, Mathematics & Creative Think Tank
    www.qudon.com




    : Do anyone have the source code or know how to code a program that counts the number of lines of code (LOC) that were added, deleted, or modified between program versions (i.e., between base code and final code)? Please Help?
    :
    :
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion