How Big Is Your Current Project?

Miscellaneous Forums/General Discussion/How Big Is Your Current Project?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Is there an easy way to count?

Look what I found lurking on my HD...
dropped$ = Lower$(Replace$(CommandLine$(), Chr$(34), ""))

If FileType(dropped$) <> 2 Then RuntimeError "'" + dropped$ + "' is Not a directory"

dir = ReadDir(dropped$)

total_c = 0
total_b = 0
total_r = 0
bb_file = 0

file$ = NextFile$(dir)

While file$ <> ""
	code = 0
	blank = 0
	comments = 0
	
	If Lower$(Right$(file$, 3)) = ".bb"
		bb_file = bb_file + 1
		
		in = OpenFile(dropped$ + "" + file$)
		If (Not in) Then RuntimeError "Couldn't open '" + file$ + "'"
		
		While (Not Eof(in))
			l$ = Left$(Trim$(ReadLine$(in)), 1)

			Select l$
				Case ""
					blank = blank + 1
				
				Case ";"
					comments = comments + 1
					
				Default
					code = code + 1
			
			End Select
		Wend		
		
		CloseFile in
		
		total_c = total_c + code
		total_b = total_b + blank
		total_r = total_r + comments
		
		Print file$ + " = " + code + " Lines : " + blank + " Blank : " + comments + " Comments"
	EndIf	
	
	file$ = NextFile$(dir)
Wend

Print
Print "Total Files : " + bb_file
Print "Total Lines : " + (total_c + total_b + total_r)
Print "Total Code  : " + total_c

WaitKey()

End