Any comments for improvements i could have done


Code: Select all
; ==============================================================
; ==============================================================
; COMPILER OPTIONS:
; [ ] Enable inline ASM support
; [ ] Create unicode executable
; [ ] Create threadsafe executable
; [ ] Enable OnError lines support
; [x] Enable XP skin support
; [ ] Request Administrator mode for Windows Vista
; [ ] Request User mode for Windows Vista (no virtualization)
; Library Subsystem:
; File Format: ASCII
; Executable Format: Windows
;
; Created on: 07/11/2012 12:30
; App/Lib-Name: convert to explicit
; Author: zebuddi
; Version: 1.00
; Compiler: PureBasic 5.00 (Windows - x86)
; ==============================================================
Pattern$ = "PureBasic (*.pb)|*.pb|*.pbi|All files (*.*)|*.*"
Global f$=OpenFileRequester("Select a .pb File to convert to explicit",pattern$,Pattern$,0)
Structure Procdata
List Procstring$()
posstart.l
posend.l
EndStructure
Global NewList result$()
;----------------------------------------------------------------------------------------------------------------
;-- Procedure ProcInfoFromFile(f$, dll.b, internal.b, procreturn.b, List result$())
;-- f$ - path & filename to scan
;-- dll.b if =1 only show ProcedureDll`s
;-- internal.b if =1 only show none ProcedureDll`s (for Lib files)
;-- dll.b=1 and interna;.b=1 for both types
;-- preocreturn.b
; 0 = proc only
; 1 = proc+line numbers
; 2 = proc +number of code lines
; 3 = proc +linenumbers+number of code lines
; 4 = path+proc +linenumbers+number of code lines
;
;-- List result$() for for returned data
;----------------------------------------------------------------------------------------------------------------
ProcedureDLL ProcInfoFromFile(f$, dll.b, internal.b, procreturn.b, List result$()); 0 = proc only, 1 = proc+line numbers, 2 = proc +number of code lines, 3 = proc +linenumbers+number of code lines , 4 = path+proc +linenumbers+number of code lines
Protected NewList string$()
Protected NewList Procdata.Procdata()
If ReadFile(0,f$)
While Eof(0)=0
AddElement(string$())
string$()=Trim(ReadString(0))
Wend
EndIf
ResetList(string$())
FirstElement(string$())
With Procdata()
ForEach string$()
If UCase(Left(string$(),9))=UCase("Procedure")
AddElement(Procdata())
\posstart=ListIndex(string$())
While UCase(Left(string$(),12))<>UCase("EndProcedure")
AddElement(\Procstring$())
\Procstring$()=string$()
NextElement(string$())
Wend
If UCase(Left(string$(),12))=UCase("EndProcedure")
AddElement(\Procstring$())
\Procstring$()=string$()
\posend=ListIndex(string$())
EndIf
EndIf
Next
EndWith
ResetList(Procdata())
FirstElement(Procdata())
ResetList(Procdata()\Procstring$())
FirstElement(Procdata()\Procstring$())
With Procdata()
If ListSize(Procdata())>0
Repeat
Select dll
Case 1
If UCase(Left(\Procstring$(),12))="PROCEDUREDLL"
c+1
Select procreturn
Case 0
AddElement(result$()) : result$()= Str(c)+". "+\Procstring$()
Case 1
AddElement(result$()) : result$()= Str(c)+". "+\Procstring$()+" ( Start Line:"+Str(\posstart)+" End Line:"+Str(\posend)+" )"
Case 2
AddElement(result$()) : result$()= Str(c)+". "+\Procstring$()+" --- #Code Lines:"+Str(\posend-\posstart)
Case 3
AddElement(result$()) : result$()= Str(c)+". "+\Procstring$()+" --- #Code Lines:"+Str(\posend-\posstart)+" ( Start Line:"+Str(\posstart)+" End Line:"+Str(\posend)+" )"
Case 4
AddElement(result$()) : result$()= f$+" --- "+Str(c)+". "+\Procstring$()+" --- #Code Lines:"+Str(\posend-\posstart)+" ( Start Line:"+Str(\posstart)+" End Line:"+Str(\posend)+" )"
EndSelect
EndIf
Case 2
c+1
Select procreturn
Case 0
AddElement(result$()) : result$()= Str(c)+". "+\Procstring$()
Case 1
AddElement(result$()) : result$()= Str(c)+". "+\Procstring$()+" ( Start Line:"+Str(\posstart)+" End Line:"+Str(\posend)+" )"
Case 2
AddElement(result$()) : result$()= Str(c)+". "+\Procstring$()+" --- #Code Lines:"+Str(\posend-\posstart)
Case 3
AddElement(result$()) : result$()= Str(c)+". "+\Procstring$()+" --- #Code Lines:"+Str(\posend-\posstart)+" ( Start Line:"+Str(\posstart)+" End Line:"+Str(\posend)+" )"
Case 4
AddElement(result$()) : result$()= f$+" --- "+Str(c)+". "+\Procstring$()+" --- #Code Lines:"+Str(\posend-\posstart)+" ( Start Line:"+Str(\posstart)+" End Line:"+Str(\posend)+" )"
Case 0
EndSelect
EndSelect
Select internal
Case 1
If UCase(Mid(\Procstring$(),10,3))<>"DLL"
c+1
Select procreturn
Case 0
AddElement(result$()) : result$()= Str(c)+". "+\Procstring$()
Case 1
AddElement(result$()) : result$()= Str(c)+". "+\Procstring$()+" ( Start Line:"+Str(\posstart)+" End Line:"+Str(\posend)+" )"
Case 2
AddElement(result$()) : result$()= Str(c)+". "+\Procstring$()+" --- #Code Lines:"+Str(\posend-\posstart)
Case 3
AddElement(result$()) : result$()= Str(c)+". "+\Procstring$()+" --- #Code Lines:"+Str(\posend-\posstart)+" ( Start Line:"+Str(\posstart)+" End Line:"+Str(\posend)+" )"
Case 4
AddElement(result$()) : result$()= f$+" --- "+Str(c)+". "+\Procstring$()+" --- #Code Lines:"+Str(\posend-\posstart)+" ( Start Line:"+Str(\posstart)+" End Line:"+Str(\posend)+" )"
Case 0
EndSelect
EndIf
EndSelect
result=NextElement(Procdata())
ResetList(\Procstring$())
FirstElement(\Procstring$())
Until result=0
EndIf
EndWith
FreeList(Procdata())
FreeList(string$())
EndProcedure
ProcInfoFromFile( f$,1,1,3, result$())
ResetList(result$())
FirstElement(result$())
ForEach result$()
Debug result$()
Next
CallDebugger
FreeList(result$())
Zebuddi.
