|
Strict
Framework Brl.StandardIO
Import Brl.FileSystem
Function ProcDir(Dir$, PrintSub = True, Rec = True)
Local lines
For Local a$ = EachIn LoadDir(Dir)
Local file$ = Dir + "/" + a
If FileType(file) = FILETYPE_FILE
Local Ext$ = ExtractExt(a)
If a <> "PrgLinec.bmx" And (Ext = "cs" Or Ext = "bird" Or Ext = "s" Or Ext = "asm" Or Ext = "c" Or Ext = "cpp" Or Ext = "h" Or Ext = "bmx")
Local n = FileLinen(LoadString(file), a)
lines :+ n
If PrintSub Then PrintData a, n, FileSize(file)
EndIf
Else If Rec
If a[0] <> Asc(".") And a <> "Txt" And a <> "Libraries" And a <> "Samples" And a <> "bin" And a <> "obj" And a <> "Test"
lines :+ ProcDir(Dir + "/" + a, PrintSub)
EndIf
EndIf
Next
Return lines
EndFunction
Local Source = ProcDir("Source")
Local Modules = 0
Local Samples = 0
Print Source
Print
For Local a$ = EachIn LoadDir("Libraries")
Local Dir$ = "Libraries\" + a
If FileType(Dir) <> 2 Then Continue
Print Dir
Print "--------------------------------------------------------"
Local C = ProcDir(Dir)
Print C
Modules :+ C
Print
Next
Print "Samples"
Print "--------------------------------------------------------"
For Local a$ = EachIn LoadDir("Samples")
Local Dir$ = "Samples\" + a
If FileType(Dir) <> 2 Then Continue
Local C = ProcDir(Dir, False)
Print Dir + ": " + C
Samples :+ C
Next
Local C = ProcDir("Samples", False, False)
Print "Sample common: " + C
Samples :+ C
Print
Print "--------------------------------------------------------"
Print "Source: " + Source
Print "Modules: " + Modules
Print "Samples: " + Samples
Print "All: " + (Source + Modules + Samples)
Input ""
Function FileLinen(s$,f$)
Local linen=0
Local bytes:Byte Ptr=s.ToCString()
For Local a=0 To s.Length-2
If bytes[a]=13 And bytes[a+1]=10 linen:+1
If bytes[a]=13 And bytes[a+2]=10 linen:+1
If bytes[a]=13 And bytes[a+2]=0 linen:+1
If bytes[a]=10 And bytes[a+2]=0 linen:+1
Next
MemFree bytes
Return linen+1
EndFunction
Function PrintData(f$,linen,b)
Print f+": "+StrMul(" ",28-Len(f)-Len(String(linen)))+linen+"line "+StrMul(" ",6-Len(String(b)))+b+"b"
EndFunction
Function StrMul$(f$,n)
Local out$=""
For Local a=1 To n
out:+f
Next
Return out
EndFunction
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.