Program Real Line Counter. Anyone want to jump in?
#7
OK I put my counts at bottom in comment:
Code: (Select All)
Print "Line count analysis...": Print ' 1

Print "Press [1] to parse all colons or [2] the exclude colons after an IF statement.": Print '2

Do
    _Limit 30
    b$ = InKey$
    If Len(b$) Then
        Select Case b$
            Case Chr$(27): System ' 3
            Case "1": myopt = 3: Print "Parsing all significant colons...": Print ' 6
            Case "2": myopt = 4: Print "Parsing all significant colons not used in IF/THEN one line statements.": Print ' 9
        End Select
        If myopt Then Exit Do
    End If
Loop

x$ = _Clipboard$ + Chr$(13)

Do
    ' parse clipboard
    statement$ = UCase$(Mid$(x$, 1, InStr(x$, Chr$(13)) - 1))
    If statement$ = Chr$(10) Then statement$ = ""
    x$ = Mid$(x$, InStr(x$, Chr$(13)) + 1)

    If Len(_Trim$(statement$)) Then
        program_ide_lines = program_ide_lines + 1
        For i = 1 To myopt
            Select Case i
                Case 1: mychr$ = Chr$(34) '10
                Case 2: mychr$ = "'" '11
                Case 3: mychr$ = "REM " '12
                Case 4: mychr$ = " THEN " '13
            End Select

            Select Case i
                Case 1 '  Double polling for enclosed quotes.
                    Do Until InStr(statement$, mychr$) = 0
                        If InStr(statement$, mychr$) Then
                            statement$ = Mid$(statement$, 1, InStr(statement$, mychr$) - 1) + Mid$(statement$, InStr(InStr(statement$, mychr$) + 1, statement$, mychr$) + 1)
                        End If
                    Loop
                Case Else
                    Do Until InStr(statement$, mychr$) = 0
                        If InStr(statement$, mychr$) Then
                            statement$ = Mid$(statement$, 1, InStr(statement$, mychr$) - 1)
                        End If
                    Loop
            End Select
        Next
        If Right$(RTrim$(statement$), 1) = ":" Then statement$ = Mid$(RTrim$(statement$), 1, Len(RTrim$(statement$)) - 1) ' ??

        Rem PRINT statement$,

        ' count colons

        seed% = 0: linecnt = linecnt + 1: real_line_cnt = real_line_cnt + 1 '  15
        Do Until InStr(seed%, statement$, ":") = 0 ' ??
            seed% = InStr(seed%, statement$, ":") + 1 ' ??
            real_line_cnt = real_line_cnt + 1
        Loop
    Else
        program_ide_lines = program_ide_lines + 1
    End If
Loop Until x$ = ""
Print "Program IDE lines ="; program_ide_lines; "  Line count ="; linecnt; "  Real line count ="; real_line_cnt


' 66 lines  9 blank lines  = 57 + 15 colons = 72
They match what your code comes up with but should we count a line that is only a comment?
b = b + ...
Reply


Messages In This Thread
RE: Program real Line counter. Anyone want to jump in. - by bplus - 10-22-2022, 10:18 PM



Users browsing this thread: 22 Guest(s)