BlitzMax "FrameWork" assistant

Miscellaneous Forums/Blitz Showcase/BlitzMax "FrameWork" assistant

We all know how tasking it is to 'framework' your code in order to streamline your final executable size.
So, I've knocked up an assistant to help reduce some of the pain.



Click link in signature.


History
v2.02  Checks for multiple quoted text - eg. MyLoader "pic1.bmp",pic2.png"
v2.01  Capitalized module names
       Check for http::
v2.00  Re-written to produce html output
       Imported code now gets its own report
       faScanMods integrated into faScanBMX (using /scanmods switch)
v1.34  Drag & Drop support added
v1.33  Improved Graphics mode checks:
         * Max2D GL
         * Max2D DX
         * Max2D GL/DX (mixed driver options)
         * Pure OpenGL (with guidance for mixing PureGL/Max2D)
         * faScanMods - now accounts for imported "*.bmx" files
       GUI - Returns to same folder afer scanning a *.bmx file
v1.32  Improved / Fixed 'Include' folder scan
v1.31  Fixed spaces in folders/filenames (GUI interface and faScanMods)
v1.30  New GUI layout and features
       faScanMods now accepts an argument to tell it where Max is installed
       faScanBMX re-written again
       Some small bugs trapped
       BRL.FreeTypeFont module added if LoadImageFont() present
v1.20  Improved graphics mode detection for raw GL, max2d, and maxdx
       Lists optional includes for cases such as 'LoadImage(myfile$)
       (where media type is unknown)
v1.10  Include (Folder) bug fixes
       Changed parameter for faScanBMX to single argument
v1.00  First release


Very useful tool, thank you.

Blimey jb that is very very useful.
Many thanks
<edit> Hope you don't mind but I posted the link at CodersWorkshop

handy :)

I don't yet have BlitzMax, but I look forward to using this with it when I do - thanks, Jim.

When first learning C years ago, it bugged the hell out of me that I was expected to know what modules the functions I was using were in and tell the compiler with headers. That's the computer's job! <grrr>

So, it's nice to see a way to get BMX to do this as it should. :)


When first learning C years ago, it bugged the hell out of me that I was expected to know what modules the functions I was using were in and tell the compiler with headers. That's the computer's job! <grrr>

So, it's nice to see a way to get BMX to do this as it should. :)

Actually, BMax is the opposite, it will not tell you what you don't need (which, although it produces larger exe's by default, is much more preferable to not being able to compile).

that is really handy indeed.

Pitty the IDE dont do this by default.

Extremely useful - thank you jb !

:)

Sergio.

Pitty the IDE dont do this by default.

well, if someone from BRL sees this, or if we get access to the IDE source at some point, it can have.

How does this code handle things like the image loaders? All on by default if an image module is used?

Nice, but it doesn't seem to work very well when I test it... (BMax on Windows XP)

I ran it against one of my old programs, and it returned the following:

------------------------------
Framework brl.pngloader
Import brl.wavloader
------------------------------

While my program needs all of the following to actually run:

Framework BRL.GLMax2D
Import BRL.RamStream
Import BRL.FreeAudioAudio
Import BRL.PNGLoader
Import BRL.WAVLoader
Import BRL.JPGLoader

Hope you don't mind but I posted the link at CodersWorkshop
No problem, and thankyou Tony.

How does this code handle things like the image loaders? All on by default if an image module is used?
All that happens is, if the scan picks up 'png' for example, the brl.pngloader is added.


xlsior,
Are you doing lots includes?
My code does not look at these yet.

Are you doing lots includes?
My code does not look at these yet.


Nope... No includes at all.

Just a single ~750 line source file, containing maybe a dozen different function.

Interesting enough:
After I cleaned up my code a bit by removing all REM statements and remarked out lines, your program didn't bring up ANY functions which it thought should be included. Nothing at all.

Very strange. Something must be tripping it up.
My code ignores Rem .. End Rem blocks as well as commented lines.

Are your commands/functions 'Cased' correctly?
Example:

LoadImage rather than loadimage ??

All that happens is, if the scan picks up 'png' for example, the brl.pngloader is added.

So a program that relyed on user input, like a file requestor, would not have any image modules loaded? Just something to watch out for.

True. I could print a reminder to that effect if there is a RequestFlie present.

JB, it would need to be more than just RequestFile. What if the image names are stored in an external configuration file? Maybe your program should just ask the user if image loaders are required?

Updated to warn about other modules which may be required.
Also checks imports and includes.

Duh, nevermind -- looks like I skipped the 'place in your blitzmax root folder' part, and after running it from there it DOES return a lot more information.

One thing I found though:

In my current program, your module checker returned the following:

Framework brl.pngloader
Import brl.wavloader
Import brl.jpgloader
Import brl.glmax2d
Import brl.standardio
Import brl.system
Import brl.blitzgl
Import brl.retro
Import brl.freeaudioaudio

While the program in question runs fine using just:

Framework BRL.GLMax2D
Import brl.RamStream
Import BRL.FreeAudioAudio
Import BRL.PNGLoader
Import BRL.WAVLoader
Import BRL.JPGLoader
Import BRL.StandardIO

...Not sure why it thought that brl.system, brl.blitzgl and brl.retro were also required? (My original version compiled about 11K smaller than when using the suggested imports)

Looks like further optimisations are required.

For instance, the BRL.GLMax2D module imports BRL.BlitzGL.
Some of this I can capture. I ought to map what each of the modules are importing themselves.

Nice one! I hope you can improve it over time.

Just shrinked my exe from 1,5 MB to 600 kb...! :D

Will it search files linked to the blitzmax file you picK?

Yes. It will look through associated files (Includes).

Example of Digesteroids:
Scanning D:/blitzmax/samples/digesteroids/digesteroids.bmx ...
Scanning D:/blitzmax/samples/digesteroids/simplephysics.bmx ...
Scanning D:/blitzmax/samples/digesteroids/dynamicgame.bmx ...
Scanning D:/blitzmax/samples/digesteroids/minitimer.bmx ...
Scanning D:/blitzmax/samples/digesteroids/MathUtil.bmx ...


HERE ARE THE MODULES REQUIRED BY YOUR PROGRAM:

' -----------------------
Framework brl.glmax2d
Import brl.retro
Import brl.linkedlist
Import brl.freeaudioaudio
Import brl.oggloader
Import brl.pngloader
Import brl.random
Import brl.wavloader
Import brl.standardio
' -----------------------


Updated again to further reduce module list.

I get an unhandled exception error when I run the 1.4a version against the Framework Assistant itself.

The error message is generated from the statement:
RuntimeError "File not found: "+bmxfile$


The error description says:
File not found: C:/BMAX_109/,
Note the comma at the end of the string.

It works fine on other .bmx files.

Sergio.

Thanks. Fixed.
Now ignores commands inside text strings and only checks for filetype references.

NEW UPDATE!

Caters for the new changes in BlitzMax v1.10
If you are using graphics in Max you'll now see 2 lists of frameworks. One for OpenGL and another for DirectX7.

jb,

This is phenomenally good. Kudos to you. I knocked almost 800 kb off my app...not to mention the compile was almost instantaneous. :)

I am a happy viking.

very cool

I have just used it now !

thanks !

I don't think it takes into account that the default renderer is DX on windows (i.e. it doesn't tell you about D3D7Max2DDriver)

well, if someone from BRL sees this, or if we get access to the IDE source at some point, it can have.

Oh I hope we do, I have lots of things I would like to do to it. :-#

This framework assistant is *very* useful by the way. :-}

Hi jb!

Is there a mac version of the framework assistant?

It looks amazing.

PLS

Is there a mac version of the framework assistant?
Currently, the GUI front end is coded in Pure Basic. When MaxGUI is out I'll code everything in MAX then seek out a willing Mac/Linux user to compile respective versions.

I can help with compiling both the linux and mac versions... How does the program comunicate with the GUI frontend? Is it a set of blitzmax command line utilities?

Right now I really do not have the time to help out coding the GUI but if it is really simple I can probably create a native mac frontend app. What I need in order to do it is to know what commands should the frontend execute, at what points or in response to what user action, and what are the drop files (a sample of those please). Hopefully I can hack something that works in an hour or so and give it back to you for distribution... :-)

I really have no clue at this point about when BRL will finish maxGUI, and guessing what to import is a pain. I thought about making a Framework assistant from scratch but I would be following your footsteps, and parsing bmx files and matchmaking keywords is not all that fun, rather help you out if I can...

PLS

its a great tool, thanks. im just updating to your latest version, i think somthing like this should be shipped along side blitzmax.

kev

Didn't this tool come our of an initial thread where people were saying it wasn't possible.

Paulo,
Check your email.

Thanks everyone for your kind comments so far.

Didn't this tool come our of an initial thread where people were saying it wasn't possible.
I remember Mark(?) saying it would be difficult/not possible to know what modules are required for situations such as:
file$=Input$("enter image file name:")
i:TImage=LoadImage(file$)
As you can see, in the above example it is not possible to know what image format is going to be loaded (png, jpg, etc).

In that sort of situation my 'assistant' produces this result:
' modules which may be required:
' Import BRL.PNGLoader
' Import BRL.BMPLoader
' Import BRL.TGALoader
' Import BRL.JPGLoader
Same thing for audio formats.

jb: check your mail... :-)

You should find your app compiled for Mac OS X as well as a native frontend. I have not tested the app itself, so I can't tell if its giving the correct results.

The Mac OS X frontend calls the app and displays the html results using the default html renderer on the Mac (Safari). The Mac OS X version should work on pretty much every version of the OS X, but it was tested in Tiger (10.4) only.

I also have the Linux frontend ready, but I need to install BlitzMax under linux in order to compile your stuff. The linux version of the frontend is GTK2 based and needs the mozzila stuff installed for the html rendering.

PLS

Wonderful tool.

In that sort of situation my 'assistant' produces this result:

It would be nice if Framework Assitant were capable of distinguishing which modules were loader modules and then display a list of those instead of the hard coded list it currently shows.