BlitzMax "FrameWork" assistant

Community Forums/Showcase/BlitzMax "FrameWork" assistant

EOF(Posted 2005) [#1]
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
format_codebox('
v2.12 Update: Word comparision speed tweaks. Previous routine was taking too long
v2.11 Update: Minor bug fixes, interface tweaks
v2.10 Updated: Keyword scanning routine
Changed: Hard-coded "MaxGUI.Drivers"
Changed: Minor cosmetic layout changes
Updated: Setting of modules folder method
v2.09 More Mac fixes (for HTML links) and ScanMods bug fix too
Show 'Scanning' message during scan process
v2.08 Fixed 'Set ROOT folder' issue on Macs ?
Fixed file links in html output
v2.07 Added support for dragging file to Framework Assistants icon
Check for '*.xml' added. Suggests Pub.MaXML as module required
v2.06 Added support for unicode files
v2.05 Added line counting for Source-only and total lines
Mac tweaks added by Pierre Durant - IDE launching, Mac-specific icon
v2.04 Major re-write for BlitzMax v1.12
Fully coded into a single application using BlitzMax
v2.03 Minor tweaks and fixes.
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')

Last edited show_time('2011-01-14 06:35:29')


TartanTangerine (was Indiepath)(Posted 2005) [#2]
Very useful tool, thank you.


tonyg(Posted 2005) [#3]
Blimey jb that is very very useful.
Many thanks
<edit> Hope you don't mind but I posted the link at CodersWorkshop


Perturbatio(Posted 2005) [#4]
handy :)


WendellM(Posted 2005) [#5]
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. :)


Perturbatio(Posted 2005) [#6]

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).


Paul "Taiphoz"(Posted 2005) [#7]
that is really handy indeed.

Pitty the IDE dont do this by default.


semar(Posted 2005) [#8]
Extremely useful - thank you jb !

:)

Sergio.


Perturbatio(Posted 2005) [#9]
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.


Hotcakes(Posted 2005) [#10]
How does this code handle things like the image loaders? All on by default if an image module is used?


xlsior(Posted 2005) [#11]
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


EOF(Posted 2005) [#12]
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.


xlsior(Posted 2005) [#13]
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.


EOF(Posted 2005) [#14]
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 ??


Hotcakes(Posted 2005) [#15]
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.


EOF(Posted 2005) [#16]
True. I could print a reminder to that effect if there is a RequestFlie present.


TeaVirus(Posted 2005) [#17]
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?


EOF(Posted 2005) [#18]
Updated to warn about other modules which may be required.
Also checks imports and includes.


xlsior(Posted 2005) [#19]
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)


EOF(Posted 2005) [#20]
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.


Grisu(Posted 2005) [#21]
Nice one! I hope you can improve it over time.

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


Will(Posted 2005) [#22]
Will it search files linked to the blitzmax file you picK?


EOF(Posted 2005) [#23]
Yes. It will look through associated files (Includes).

Example of Digesteroids:
format_code('
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.


semar(Posted 2005) [#24]
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:
format_code('
RuntimeError "File not found: "+bmxfile$
')

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

It works fine on other .bmx files.

Sergio.


EOF(Posted 2005) [#25]
Thanks. Fixed.
Now ignores commands inside text strings and only checks for filetype references.


EOF(Posted 2005) [#26]
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.


LeisureSuitLurie(Posted 2005) [#27]
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.


SillyPutty(Posted 2005) [#28]
very cool

I have just used it now !

thanks !


Perturbatio(Posted 2005) [#29]
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)


Stuart Morgan(Posted 2005) [#30]
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. :-}


pls(Posted 2005) [#31]
Hi jb!

Is there a mac version of the framework assistant?

It looks amazing.

PLS


EOF(Posted 2005) [#32]
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.


pls(Posted 2005) [#33]
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


Kev(Posted 2005) [#34]
its a great tool, thanks. im just updating to your latest version, i think somthing like this should be shipped along side blitzmax.

kev


tonyg(Posted 2005) [#35]
Didn't this tool come our of an initial thread where people were saying it wasn't possible.


EOF(Posted 2005) [#36]
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:
format_code('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:
format_code('' modules which may be required:
' Import BRL.PNGLoader
' Import BRL.BMPLoader
' Import BRL.TGALoader
' Import BRL.JPGLoader')Same thing for audio formats.


pls(Posted 2005) [#37]
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


Hotcakes(Posted 2005) [#38]
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.


Tricky(Posted 2011) [#39]
What I was wondering... (Sorry for thread necromancing)...

FrameWork Assistant hasn't been updated for quite awhile...
Is it gonna stay that way?

For now I only have a few minor issues that may need fixing

For example I got this advice on a quick DataBase program I coded for my latest project

format_code('Framework BRL.System
Import BRL.Retro
Import MaxGUI.MaxGUI
Import BRL.MaxLua
Import BRL.EventQueue
')

Well we may all know that MaxGUI.MaxGUI ain't gonna work, as we need MaxGUI.Drivers to import MaxGUI properly ;)

Another issue, which (as far as I know) only exists on Mac... We all know Ctrl-C and Ctrl-V to copy and paste, which is on Mac actually Apple-C and Apple-V. The result is just the same in most applications. In FrameWork Assistant these hotkeys do not work, at least not on Mac. Seems to me MaxGUI was used to code FA and for Apple-C to work in the mac version of MaxGUI the key binding must be set (most likely in the menu) in order to work. And that one has always annoyed me as a Mac User.
(Fortulatly the way to get around it is by rightclicking the text in the output and choose "copy" in the popup menu that appears, but I hate that way. I'm the guy for quick keys to get things on the move) :P


EOF(Posted 2011) [#40]
Download the latest Win32 version here. There are no other versions though. If you want I can send you the source code to compile your end

http://sites.google.com/site/jimbrown007/home/fa212.zip


"MaxGUI.Drivers" was done in v2.10
The keyboard Copy/Paste does not work in Windows version either. I think I used "COMMAND" versions of keys for universal system key operations. I will have a check at the weekend


Tricky(Posted 2011) [#41]
That would be great ;)

You can mail it to tric1975 <at> hotmail <dot> com
When you put [Tric-FAQ] in the subject you can make sure you avoid my spamfilter so that I see the mail

Thank you ;)

P.S. Do you want me to mail my build back to you so you can make it available for download? (I can only make an x86 build though, my PPC mac has gone to heaven, ya see)

And yeah, the newest version I could find was 2.09 so that explains ;)

Last edited show_time('2011-01-14 07:39:23')


Tricky(Posted 2011) [#42]
Okay, source received compiled and sent back.
I even found a solution for the ctrl-c issue ;)


Xaron(Posted 2011) [#43]
I think I found a bug. If I use some math stuff (like Cos and Sin) your (undoubtly great) tool won't import BRL.Math