I asked this in DevC++ mailing list(don't know why!) but can't get responses yet probably for that digest thing. Here it is:
> I like to see how many lines of code I wrote, but
> the project properties shows them per file. Is
> there a way to count the total number of lines in
> the whole project?
Currently I count them in "Project Properties" and write all numbers to windows calculator. With file numbers increasing that became harder.
You could write a little C/C++ program that simply reads the lines of every cpp file in the current directory and calculates the total for you.
Download Unix tools for Windows:
Or if you are too lazy to do that, then:
Or use wc?
No need to use cat. wc * will print the total counts for all files at the bottom.
You could write a little C/C++ program that simply reads the lines of every cpp file in the current directory and calculates the total for you.
This might be useful and easy. I need that info only for my main project, so a totally hardcoded prog can do what I want.
Or if you are too lazy to do that, then:
type *.c > bigfile.c
Open up bigfile.c and count the lines.
Very nice! Combining this with the previous idea can decrease the coding time of that utility from 5 mins to 2 mins:)
EDIT:
I found the cat and wc tools but failed to use them. They start a console where I can write some commands apparently but I don't know what to write there.
EDIT2:
Nah, nevermind! I liked the "do-it-yourself" idea. It may turn into something better one day.
What is that?(I really don't know!)
It gives you the number of lines, words, and characters. Just read my post, point 1. Follow the link to download.
I found the cat and wc tools but failed to use them. They start a console where I can write some commands apparently but I don't know what to write there.
Copy them to your Windows folder. Go to your programming folder (within a shell) and type:
wc *.c
Or add the folder they're in to your system path (might be a better idea).
Marcello
Use grep to remove blank lines and comments, then wc to count. Maybe... cat *.c | grep -v "^\s*/*.*" | grep -v "^\s*//" | grep -v "^\s*$" | wc -l will work.
That's cheating! You're supposed to include comments and blank lines.
Marcello
Try sloccount.
Use grep to remove blank lines and comments, then wc to count. Maybe... cat *.c | grep -v "^\s*/*.*" | grep -v "^\s*//" | grep -v "^\s*$" | wc -l will work.
What is that, ASCII art?:) I think it would be better to post a feature-request to the bloodshed guys.
That's cheating! You're supposed to include comments and blank lines.
That's why I like DevCpp's built-in counter. It reports them seperately. I keep three numbers in my "comment.h" file; total lines, without empty lines and code lines only. The third doesn't really help your self-confidence;)
Try sloccount
Seems like not so Windows-friendly!
I will try something tomorrow, it's 11PM. And sorry I'm out of cookies, Matthew gave me only one plate to serve:)(I know, wrong forum category!)
Some quite useless statistics about allegro. Statistics generated by sloccount.
Latest SVN version of 4.2:
Totals grouped by language (dominant language first):
ansic: 126573 (83.88%)
asm: 17018 (11.28%)
cpp: 3846 (2.55%)
sh: 2108 (1.40%)
objc: 925 (0.61%)
python: 216 (0.14%)
pascal: 179 (0.12%)
perl: 29 (0.02%)
Total Physical Source Lines of Code (SLOC) = 150,894
Development Effort Estimate, Person-Years (Person-Months) = 38.78 (465.39)
(Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
Schedule Estimate, Years (Months) = 2.15 (25.81)
(Basic COCOMO model, Months = 2.5 * (person-months**0.38))
Estimated Average Number of Developers (Effort/Schedule) = 18.03
Total Estimated Cost to Develop = $ 5,238,985
(average salary = $56,286/year, overhead = 2.40).
4.3:
Totals grouped by language (dominant language first):
ansic: 128564 (84.12%)
asm: 17011 (11.13%)
cpp: 3800 (2.49%)
sh: 2108 (1.38%)
objc: 925 (0.61%)
python: 216 (0.14%)
pascal: 179 (0.12%)
perl: 29 (0.02%)
Total Physical Source Lines of Code (SLOC) = 152,832
Development Effort Estimate, Person-Years (Person-Months) = 39.31 (471.67)
(Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
Schedule Estimate, Years (Months) = 2.16 (25.94)
(Basic COCOMO model, Months = 2.5 * (person-months**0.38))
Estimated Average Number of Developers (Effort/Schedule) = 18.19
Total Estimated Cost to Develop = $ 5,309,659
(average salary = $56,286/year, overhead = 2.40).
So, Allegro costs around $5,300,000. Not too bad for a ten year old thingie
Total Estimated Cost to Develop = $ 5,309,659
See what you loose ! ;-X
Total Estimated Cost to Develop = $ 5,309,659
(average salary = $56,286/year, overhead = 2.40).
Well done, Hoho! Now noone will work on Allegro anymore without being paid:P
I think the effort estimate is a little off. I doubt combining all developers together would make four full-time developers over ten years.
of course there is always the chance that allegro developers are simply so good they can do the work of a ten devs in 1/10'th of the time
pascal: 179 (0.12%)
Eh?
hoho@box ~/katsepolygon/allegro-svn $ sloccount --details ./4.3/ | grep pascal 74 pascal src_amd64 /home/hoho/katsepolygon/allegro-svn/4.3/src/amd64/asmdefs.inc 105 pascal src_ppc /home/hoho/katsepolygon/allegro-svn/4.3/src/ppc/ppcdef.inc
I think it doesn't use anything else but file extensions to see what language is used.
I think the effort estimate is a little off. I doubt combining all developers together would make four full-time developers over ten years.
It looks like it thinks it was made in 2.16 years, which makes sense since allegro is developed rather slowly compared to commercial products.
It looks like it thinks it was made in 2.16 years
... by 18.19 developers
1 | #include <allegro.h> |
2 | |
3 | int main(int argc, char* argv[]) { |
4 | allegro_init(); |
5 | int lines = 0; |
6 | |
7 | if (argc < 2) |
8 | return -1; |
9 | |
10 | PACKFILE* f = pack_fopen(argv[1], "rb"); |
11 | |
12 | if (!f) |
13 | return -2; |
14 | |
15 | while (!pack_eof(f)) { |
16 | char c = pack_getc(f); |
17 | if (c == '\n') |
18 | ++lines; |
19 | } |
20 | printf("%s: %i lines.\n", argv[1], lines); |
21 | |
22 | return 0; |
23 | } |
24 | END_OF_MAIN() |