@@ -7,7 +7,7 @@ TotalDirectories := 0
7
7
SourceFiles := 0
8
8
SourceFilesCounted := 0
9
9
NonSourceExts = dll
10
- ExtensionsToParse = cs,c,cpp,h,ahk,hpp,cc
10
+ ExtensionsToParse = cs,c,cpp,h,ahk,hpp,cc,py,sh
11
11
; ExcludeFolders = SDL,My-Doom
12
12
SourceOnlyLines := 0
13
13
CommentOnlyLines := 0
@@ -17,15 +17,50 @@ BracesOnlyLines := 0
17
17
SkippedLines := 0
18
18
TODOs := 0
19
19
HACKs := 0
20
+
20
21
Directories :=
21
22
SourceFileList :=
22
23
Comments :=
23
24
24
25
SetWorkingDir , %A_ScriptDir %\..
25
26
27
+ ; Let the user know that we're doing something
28
+ Progress , M2, (1 / 3 ), Counting Directories, Counting...
29
+
30
+ ; Just determine how many directories there are, for really big source trees (like ReactOS and Linux)
31
+ JustDirectories := 0
32
+ Loop , Files, * , DR
33
+ {
34
+ ; Even though this code isn't really meant for MyOS, I'll skip these directories for consistency:
35
+ IfInString , A_LoopFileFullPath ,SDL\
36
+ continue
37
+ IfInString A_LoopFileFullPath ,My- Doom\
38
+ continue
39
+ IfInString A_LoopFileFullPath ,.git
40
+ continue
41
+ IfInString A_LoopFileFullPath ,.vs
42
+ continue
43
+ IfInString A_LoopFileFullPath ,font
44
+ continue
45
+ IfInString A_LoopFileFullPath ,spf
46
+ continue
47
+ IfInString A_LoopFileFullPath ,Debug
48
+ continue
49
+ IfInString A_LoopFileFullPath ,Release
50
+ continue
51
+ IfInString A_LoopFileFullPath ,x64
52
+ continue
53
+
54
+ JustDirectories + = 1
55
+ }
56
+
57
+ Progress , R0- %JustDirectories% M2, (2 / 3 ), Counting Numer of Files, Counting...
58
+
26
59
; Determine how many files and directories we need to scan
27
60
Loop , Files, * , DFR
28
61
{
62
+ Progress , %TotalDirectories%, (2 / 3 ), Counting Numer of Files, Counting...
63
+
29
64
; Don't include files or folders which mostly contain source I didn't write
30
65
IfInString , A_LoopFileFullPath ,SDL\
31
66
continue
@@ -78,7 +113,7 @@ Loop, Files, *, DFR
78
113
79
114
; Display a window with a progress bar
80
115
; totalEverything := TotalFiles + TotalDirectories
81
- Progress , R0- %SourceFiles%, %a_index %, %a_loopfilename %, Counting..., Counting Lines
116
+ Progress , R0- %SourceFiles% M2 , %a_index %, %a_loopfilename %, Counting..., Counting Lines
82
117
Loop , Files, * , DFR
83
118
{
84
119
Progress , %SourceFilesCounted%, %a_loopfilename %, Counting..., Counting Lines
@@ -133,27 +168,30 @@ StringTrimRight, StringLines, StringLines, 3
133
168
134
169
; MsgBox %Directories%
135
170
CountSummary :=
136
- CountSummary .= NumericalFormat(SourceOnlyLines + SourceLinesWithComments + CommentOnlyLines) . " Total Unique and meaningful lines`r`r"
171
+ CountSummary .= NumericalFormat(SourceOnlyLines + SourceLinesWithComments + CommentOnlyLines) . " Total unique and meaningful lines`r`r"
137
172
CountSummary .= NumericalFormat(SourceOnlyLines + SourceLinesWithComments) . " Total lines with code`r"
138
173
CountSummary .= NumericalFormat(CommentOnlyLines + SourceLinesWithComments) . " Total lines with comments`r`r"
139
174
CountSummary .= NumericalFormat(SourceOnlyLines) . " lines with only code`r"
140
175
CountSummary .= NumericalFormat(SourceLinesWithComments) . " lines with comments and code`r"
141
176
CountSummary .= NumericalFormat(CommentOnlyLines) . " lines with only comments`r"
142
177
CountSummary .= NumericalFormat(BracesOnlyLines) . " lines with only braces`r"
143
- CountSummary .= NumericalFormat(BlankLines) . " blank lines"
144
-
145
- CommentOnlyLines := 0
146
- SourceLinesWithComments := 0
147
- BlankLines := 0
148
- BracesOnlyLines := 0
178
+ CountSummary .= NumericalFormat(BlankLines) . " blank lines`r "
179
+ CountSummary .= NumericalFormat(TODOs) . " TODOs`r "
180
+ CountSummary .= NumericalFormat(HACKs) . " HACKs`r "
181
+ CountSummary .= " `rCounted in`r "
182
+ CountSummary .= NumericalFormat(SourceFiles) . " source files in`r "
183
+ CountSummary .= NumericalFormat(TotalDirectories) . " directories "
149
184
150
185
; This can be used for debugging. Here I've set it out to show me lines with comments and code:
151
186
; Gui, Add, Edit, R50 w900 Multi vListingBox
152
187
; GuiControl,, ListingBox, %Comments%
153
188
; GuiControl,, ListingBox, %Directories%
154
189
; Gui, Show
155
190
156
- MsgBox Results of scanning %A_WorkingDir %:`r`r%CountSummary%`r%TODOs% TODOs`r%HACKs% HACKs`r`rCounted in `r%TotalDirectories% directories`r%SourceFiles% source files
191
+ ; Isolate the OS name from the working dir
192
+ StringGetPos , NameStart, A_WorkingDir ,\,R
193
+ OSName := SubStr (A_WorkingDir , NameStart + 2 )
194
+ MsgBox Results of scanning %OSName%:`r`r%CountSummary%
157
195
; `rNon-Source files with extensions of %NonSourceExts%
158
196
ExitApp ; Replace this with return during development
159
197
0 commit comments