pbAnalyzer v1.1

Developed or developing a new product in PureBasic? Tell the world about it.
dige
Addict
Addict
Posts: 1406
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

pbAnalyzer v1.1

Post by dige »

Maybe someone need it too:

This little tool ( 11KB ) create a new complete projectfile.
Including all includes. Unused Procedures() will be ripped
out. Also all comments.

I've made this tool, because the current PBCompiler v4.02
compiles unused procedures too.
Usage: pbAnalyzer.exe Main.pb [Outfile.pb]
Download pbanalyzer.zip

-EDIT-
Update: v1.1
Last edited by dige on Wed Jan 31, 2007 6:34 pm, edited 1 time in total.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Thanks !

Is this some kind of cutter plugin ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
dige
Addict
Addict
Posts: 1406
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Post by dige »

yes, something like that :)

The Cutterplugin do also a good job. But it does
not find all unused Procedures ().

For example ... after cutting a project main.pb
to CUT.main.pb and then starting the pbAnalyzer,
there a still 39 unused Procedures found ....
Last edited by dige on Wed Jan 31, 2007 6:33 pm, edited 1 time in total.
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: pbAnalyzer v1.0

Post by ricardo »

dige wrote: I've made this tool, because the current PBCompiler v4.02
compiles unused procedures too.
Are you sure?? Why is this?
Heathen
Enthusiast
Enthusiast
Posts: 498
Joined: Tue Sep 27, 2005 6:54 pm
Location: At my pc coding..

Post by Heathen »

Pb already doesn't compile unused procedures and comments (at least in 4.0) and if comments are kept, then fasm doesn't compile them. Although, if there are strings in the procedures, then those are added to the exe. Correct me if im wrong though.
I love Purebasic.
dige
Addict
Addict
Posts: 1406
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Post by dige »

Dont ask me why ... :roll:

I use a lot of includes ( dont like libs ) and since I found out,
that my current project have some stuff included that should'nt
be inside.

Try it out:

Code: Select all

Procedure NoUse1()
  txt.s = "Procedure NoUse1()"
  InitEngine3D()
EndProcedure
Procedure NoUse2()
  txt.s = "Procedure NoUse2()"
EndProcedure
Procedure NoUse3()
  txt.s = "Procedure NoUse3()"
EndProcedure
Procedure InUse()
  txt.s = "Procedure InUse()"
EndProcedure

InUse()
open the exe ( its 3073Bytes) in a hex editor ... and you will find the strings and the
Engine3D init stuff...
Procedure NoUse1() Procedure NoUse2() Procedure NoUse3() Procedure InUse() InitEngine3DFirst Engine3D.dll Parse3DScripts InitEngine3D Add3DArchive
Last edited by dige on Wed Jan 31, 2007 5:10 pm, edited 1 time in total.
Heathen
Enthusiast
Enthusiast
Posts: 498
Joined: Tue Sep 27, 2005 6:54 pm
Location: At my pc coding..

Post by Heathen »

dige wrote:Dont ask me why ... :roll:

I use a lot of includes ( dont like libs ) and since I found out,
that my current project have some stuff included that should'nt
be inside.

Try it out:

Code: Select all

Procedure NoUse1()
  txt.s = "Procedure NoUse1()"
  InitEngine3D()
EndProcedure
Procedure NoUse2()
  txt.s = "Procedure NoUse2()"
EndProcedure
Procedure NoUse3()
  txt.s = "Procedure NoUse3()"
EndProcedure
Procedure InUse()
  txt.s = "Procedure InUse()"
EndProcedure

InUse()
open the exe in a hex editor ... and you will find the strings and the
Engine3D init stuff...
try without strings.

ie

Code: Select all

Procedure blahblah()
  a = 100
  b = 100
  c = 100
EndProcedure
If you compile the exe with and without this procedure, the filesize will be the exact same
Last edited by Heathen on Wed Jan 31, 2007 5:10 pm, edited 1 time in total.
I love Purebasic.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

it has nothing to do with the strings... they are just there to make it easier to see in the hex-edi.
oh... and have a nice day.
Heathen
Enthusiast
Enthusiast
Posts: 498
Joined: Tue Sep 27, 2005 6:54 pm
Location: At my pc coding..

Post by Heathen »

Kaeru Gaman wrote:it has nothing to do with the strings... they are just there to make it easier to see in the hex-edi.
edit: nevermind, the filesize is the same with strings too.
Last edited by Heathen on Wed Jan 31, 2007 5:14 pm, edited 1 time in total.
I love Purebasic.
remi_meier
Enthusiast
Enthusiast
Posts: 468
Joined: Sat Dec 20, 2003 6:19 pm
Location: Switzerland

Post by remi_meier »

We had this discussion several times now. Use the search function!
In codes like

Code: Select all

declare b() 
Procedure a() 
  b() 
endprocedure 
procedure b() 
  a() 
endprocedure
both procedures will be included, even if they are not called. :roll:
Athlon64 3700+, 1024MB Ram, Radeon X1600
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

hm... seems it's unclear at the moment, I heard different opitions in both boards...

so I will shut up and listen until I have the need to find the time to test it on my own...
oh... and have a nice day.
Heathen
Enthusiast
Enthusiast
Posts: 498
Joined: Tue Sep 27, 2005 6:54 pm
Location: At my pc coding..

Post by Heathen »

remi_meier wrote:We had this discussion several times now. Use the search function!
In codes like

Code: Select all

declare b() 
Procedure a() 
  b() 
endprocedure 
procedure b() 
  a() 
endprocedure
both procedures will be included, even if they are not called. :roll:
I just tested that, the amount of bytes in the exe are identical with and without that code though.. at least in 4.0
I love Purebasic.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

If some bytes more or not, the exe is the same size. This is normal by
Design of Exe :wink:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: pbAnalyzer v1.0

Post by Kaeru Gaman »

Heathen wrote:.. at least in 4.0
dige wrote:I've made this tool, because the current PBCompiler v4.02
compiles unused procedures too.
so it seems you were offtopic.

I should have a look at edel's profile if he is still using 4.00, too
oh... and have a nice day.
Heathen
Enthusiast
Enthusiast
Posts: 498
Joined: Tue Sep 27, 2005 6:54 pm
Location: At my pc coding..

Post by Heathen »

true, my mistake, I should have tested in 4.02 instead.

sorry guys.
I love Purebasic.
Post Reply