March 02, 2021, 02:33:03 PM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Forum
Help
Search
Gallery
Login
Register
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
Miscellaneous
»
[bb] BB Source Code Counter by King Dave [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bb] BB Source Code Counter by King Dave [ 1+ years ago ] (Read 405 times)
BlitzBot
Jr. Member
Posts: 1
[bb] BB Source Code Counter by King Dave [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:40 AM »
Title :
BB Source Code Counter
Author :
King Dave
Posted :
1+ years ago
Description :
Counts the number of lines in all .bb files under the apps directory (including sub directorys).
Displays the total lines of code and the total size in bytes of them.
It does NOT count backup bb files.
Code :
Code: BlitzBasic
Graphics
520
,
340
,
16
,
2
dir.Dir=
New
Dir
dirloc$=
CurrentDir
$
(
)
Print
"Counting lines..."
While
dir<>
Null
lis=
ReadDir
(
dirloc$
)
If
Not
lis
Then
RuntimeError
"Failed to read the '"
+dirloc$+
"' directory"
filen$=
NextFile
(
lis
)
While
filen$<>
""
If
KeyHit
(
1
)
Then
End
Select
FileType
(
dirloc$+filen$
)
Case
1
If
Right
$
(
filen$,
3
)
=
".bb"
Size=Size+
FileSize
(
dirloc$+filen$
)
file=
ReadFile
(
dirloc$+filen$
)
While
Not
Eof
(
file
)
txt$=
ReadLine
(
file
)
If
txt$<>
""
And
Left
$
(
txt$,
1
)
<>
";"
Then
Lines=Lines+
1
Else
Blanks=Blanks+
1
Wend
CloseFile
file
EndIf
Case
2
If
filen$<>
"."
And
filen$<>
".."
ndir.Dir=
New
Dir
ndirloc$=dirloc$+filen$+
""
EndIf
End Select
filen$=
NextFile
(
lis
)
Wend
CloseDir
lis
Delete
dir
dir.Dir=
First
Dir
Wend
Cls
Locate
0
,
0
Print
"Lines of code: "
+Lines
Print
"Blank or comment lines: "
+Blanks
Print
"---"
Print
"Total lines: "
+
(
Lines+Blanks
)
Print
:
Print
kb#=
Float
#
(
Size
)
/
1024
mb#=
Float
#
(
Size
)
/
1048576
Print
"Total file size: "
+Size+
" bytes ("
+
Left
$
(
kb#,
Len
(
kb#
)
-
4
)
+
" kb / "
+
Left
$
(
mb#,
Len
(
mb#
)
-
4
)
+
" mb)"
Print
:
Print
Print
"Press any key to close."
FlushKeys
WaitKey
End
Type
Dir
Field
loc$
End Type
Comments :
none...
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
Miscellaneous
»
[bb] BB Source Code Counter by King Dave [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal