🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Count Your Code

Started by
23 comments, last by vallis 24 years, 3 months ago
I just create a directory called "Source" and just throw all my source files into there.

Add a character counter as well that ignores whitespace.

more accurate code count


Edited by - Kavos on 3/10/00 5:34:08 AM
Advertisement
quote: Original post by Kavos

I just create a directory called "Source" and just throw all my source files into there.

Add a character counter as well that ignores whitespace.

more accurate code count


Edited by - Kavos on 3/10/00 5:34:08 AM

Consider it done. I''ll put all of you on the credits for this thing too
Hey. All done (nearly)

Just added character counting support, and a few other niceties. Also added preliminary VB support. Havn''t been bothered to parse the FRM files yet so at the moment it includes all of your window details in the count. Ill fix this soon...can anyone suggest a quick way of detecting the start of the code?

I thought about counting the "Begin"''s and "End"''s and when you have matching Begins and Ends you are in the code section. Thats my best one so far...

Also - for VB I currently look at the extensions .BAS .CLS .FRM - are there any others??

Code Counter Version 1.1
http://members.xoom.com/blvallis/CodeCounter/CodeCounter-1_1.zip

Enjoy!
In answer to the question about detecting the start of code in VB form files look for lines beginning with ''Attribute''. These follow the form definition and preceed the code (VB5+ only). I dont think you should disregard the form definition though - it provides an indication of the complexity of the form. Perhaps you want to start maintaining different counters for different aspects of the code (how much time where you going to put into this app?)

The cleanest way to analyse VB projects is via the project file (.vbp in VB5,6 and .mak in VB3). This includes the OCX references and project properties as well as a list of all the files which make up the project. Working from this means that you pick up all files regardless of where they are *and* you don''t count files which happen to be in the project directory but aren''t part of the project any longer.

Because I work with large VB projects that share code and use split folders I wrote a utility to copy projects, check for bad file references, compare source intelligently, etc. The code''s pretty crude, but I could cut out the section which parses the project file if that would be useful. Of course it might be faster for you just to pick up a complicated project file and work out it''s structure yourself - there''s really not much to it. Reply here if you want me to email you any of this (I can also provide some sample project files - both VB 3 and 5).

Among all the other things the VB team did right storing the whole project in text files was an often overlooked blessing.
Hey, your code counter sounds really cool.

It''s a nifty, fun way to demonstrate the project''s
completion.
But a lot of people say code lines are no indication
of the greatness of the project.
So why not count procedures?
And/Or Classes, structs etc...
Just a little idea for you...

Take it easy,

-Mezz
One thing that would be cool to see is the ability to check all of the sub-directories as well. Large projects generally don't have all of the source in a single directory.

BTW, how are you determining a line? Are you counting semicolons? Carriage returns? Do you include comments in the line count?


Mark Fassett
Laughing Dragon Entertainment
http://www.laughing-dragon.com

Edited by - LaughingD on 3/11/00 4:12:27 AM

Edited by - LaughingD on 3/11/00 4:15:04 AM

Mark Fassett

Laughing Dragon Games

http://www.laughing-dragon.com

quote: Original post by LaughingD
BTW, how are you determining a line? Are you counting semicolons? Carriage returns? Do you include comments in the line count?


Currently carriage returns...comments are included.

quote: Original post by Mezz

Hey, your code counter sounds really cool.

It''s a nifty, fun way to demonstrate the project''s
completion.
But a lot of people say code lines are no indication
of the greatness of the project.
So why not count procedures?
And/Or Classes, structs etc...
Just a little idea for you...

Take it easy,

-Mezz



Noted for a future version
quote: Original post by LaughingD

One thing that would be cool to see is the ability to check all of the sub-directories as well. Large projects generally don''t have all of the source in a single directory.


Yeah - this is what I was asking about earlier...I''ll try and add support for this ASAP.

You might wanna add these files too, they''re available in Visual Basic 6 (UserControls and PropertyPages), they work like a .frm file, with the Begin and End.

.ctl
.pag

============================
Daniel Netz, Sentinel Design
"I'm not stupid, I'm from Sweden" - Unknown
============================Daniel Netz, Sentinel Design"I'm not stupid, I'm from Sweden" - Unknown

This topic is closed to new replies.

Advertisement