Code: Select all
;gdipmaker.pb
crlf.s = Chr(13) + Chr(10)
group.s = ""
doc.s = GetClipboardText()
outfile$ = "gdiplus.pbl"
hfile = OpenFile(#PB_Any, outfile$)
If hfile = 0 : End : EndIf
FileSeek(Lof())
WriteStringN(";" + group)
NewList ErrorList.l()
line$ = ""
start = 1
lineCount = 1
funcCount = 0
found.b = 0
Repeat
p = FindString(doc, crlf, start)
If p=0 : break : EndIf
line$ = Mid(doc, start, p-start)
If Left(line$, Len("GpStatus WINGDIPAPI"))="GpStatus WINGDIPAPI"
line$ = Trim(Right(line$, Len(line$)-Len("GpStatus WINGDIPAPI"))) ;remove GpStatus WINGDIPAPI
found =1
ElseIf Left(line$, Len("Status __stdcall"))="Status __stdcall"
line$ = Trim(Right(line$, Len(line$)-Len("Status __stdcall"))) ;remove Status __stdcall
found = 1
ElseIf Left(line$, Len("UINT WINGDIPAPI"))="UINT WINGDIPAPI"
line$ = Trim(Right(line$, Len(line$)-Len("UINT WINGDIPAPI"))) ;remove UINT WINGDIPAPI
found = 1
ElseIf Left(line$, Len("HPALETTE WINGDIPAPI"))="HPALETTE WINGDIPAPI"
line$ = Trim(Right(line$, Len(line$)-Len("HPALETTE WINGDIPAPI"))) ;remove HPALETTE WINGDIPAPI
found = 1
ElseIf Left(line$, Len("VOID WINGDIPAPI"))="VOID WINGDIPAPI"
line$ = Trim(Right(line$, Len(line$)-Len("VOID WINGDIPAPI"))) ;remove VOID WINGDIPAPI
found = 1
EndIf
If found
;Debug line$
p1 = FindString(line$, "(", 1)
If p1<>0
p2 = FindString(line$, ")", p1 + 1)
If p2<>0 ;OK
funcName$ = Left(line$, p1-1)
line$ = Mid(line$, p1+1, p2-p1-1) ;inside ()
nParams = countstring(line$, ",") + 1
WriteStringN(funcName$ + " " + Str(nParams))
funcCount + 1
Else ;error
AddElement(ErrorList()) : ErrorList() = lineCount
EndIf
Else ;error
AddElement(ErrorList()) : ErrorList() = lineCount
EndIf
EndIf
start = p + Len(crlf)
lineCount + 1
found = 0
Until p=0
Debug "Functions " + Str(funcCount)
Debug "Errors " + Str(CountList(ErrorList()))
CloseFile(hfile)

