Buchempfehlung
Windows System Programming
Windows System Programming
Das Kompendium liefert viele interessante Informationen zur Windows-Programmierung auf Englisch. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

Line-of-Code-CounterA

Uploader:MitgliedThe_Muh
Datum/Zeit:19.07.2008 12:59:45

screen 1
dim shared as string tZeile()
declare sub counter()
declare function file() as string

sub counter()
    dim code as integer
    dim blank as integer
    dim comment as integer
    dim U as integer
    dim i as integer
    U = 0
    for i = 1 to ubound(tzeile)-1
        if left(ltrim(tzeile(i)),2) = "'/" then
            u = 0
            comment += 1
        end if
        if u = 1 then
            comment += 1
        else
        if left(ltrim(tzeile(i)),1) = "'" then comment += 1
        if len(ltrim(tzeile(i))) = 0 or len(ltrim(tzeile(i),chr(9))) = 0 then blank += 1
        if left(ltrim(tzeile(i)),1) <> "'" and left(ltrim(tzeile(i)),1) <> "'/" and len(ltrim(tzeile(i),chr(9))) <> 0 and len(ltrim(tzeile(i))) <> 0 then code += 1
        if left(ltrim(tzeile(i)),2) = "[komm]LyciIHRoZW4gCiAgICAgICAgICAgIFUgPSAxCiAgICAgICAgICAgIGNvbW1lbnQgKz0gMQogICAgICAgIGVuZCBpZgogICAgICAgIGVuZCBpZgogICAgICAgIGlmIHJpZ2h0KHJ0cmltKHR6ZWlsZShpKSksMikgPSAiJy8ß[/komm]" then u = 0
    next i

    cls
    print "Codezeilen:      "& code' - blank
    print "Leerzeilen:      "& blank
    print "Kommentarzeilen: "& comment
    print ""
    print "Gesamt:          "& code + comment + blank
end sub

function file() as string
    dim files as string
    dim filename() as string
    dim as integer i = 1
    dim as integer c
    redim filename(1)
    filename(i) = DIR("*.bas",0) ' das erste verzeichnis
    do                          ' alle anderen =)
        if filename(i) <> "." and len(filename(i)) <> 0 then
            print i & ") \" & filename(i)
        end if
        i +=1
        if i = 46 then exit do
        redim preserve filename(i)
        filename(i) = DIR("")
    LOOP WHILE LEN(filename(i)) ' solange noch ein nicht gelistetes Verzeichnis existiert

    if len(filename(1)) >= 1 then
        do
        input "Number: ",c
        if len(filename(c)) >=1 then
            files = filename(c)
            exit do
        end if
        loop
    else
    Print "No files";
    end if
    return files
end function

declare sub laden()
sub laden()
    dim files as string
    dim as integer i = 2

    files = file()

    redim tzeile(0) as string
    OPEN files FOR INPUT AS #1
    while not EOF(1)
        i += 1
        REDIM Preserve tzeile(i) AS STRING
        line INPUT #1, tzeile(i)
    wend
    CLOSE #1
    cls
end sub
do
cls
laden()
counter()
print
print "Zum beenden Esc druecken"
sleep
loop until inkey = chr(27)Á