BlitzMax Doxygen

BlitzMax Forums/BlitzMax Programming/BlitzMax Doxygen

SystemError51(Posted 2012) [#1]
It's been a while since I've been posting into this category, I also couldn't find anything on the subject.

Some of you may be familiar with a little something called Doxygen. It is a very clever source code parsing tool that creates nicely designed documentation for you, in HTML and LaTeX. I'm sure some of you are using it as it is easy as pie to maintain documentation in large-scale projects.

Doxygen is a documentation system for C++, C, Java, Objective-C, Python, IDL (Corba and Microsoft flavors), Fortran, VHDL, PHP, C#, and to some extent D.


Now the question is, if anyone has ever created something similar to that for BlitzMax, or if someone came across a tool like that? It would be very advantageous for a lot of people, I would say.

I'm wondering about this since I'm back on B/Max, so any insight is as always appreciated and taken on board.


matibee(Posted 2012) [#2]
There's a document generator built in to Blitzmax. Can't recall the ins and outs at the minute though.


Russell(Posted 2012) [#3]
Yep. If you click on 'source' at the top of most of the Bmax help pages, you'll see the source for that particular module. Look for 'bbdoc:' inside rem/end comment blocks.

Russell


Derron(Posted 2012) [#4]
I wrote a simple php script which parses my bmx sources, handles globals, child variables/methods/functions, comments ...

Using your own parser is a nice way to allow custom documentations (I needed a documentation about lua-readable/writeable objects - so I also parse {metatags}). Also nice is the possibility to vary the documentation style (@param, ...). "Ignore patterns" are also nifty - if you don't like to document some external libs (bruceys mods, some other helper libs).

Parser and template filling took only some hours to code - and it fits 100% of your needs at the end - may be that is a possibility for you.


bye
Ron


SystemError51(Posted 2012) [#5]
Would it be possible for you to share that little PHP gem with me?


Derron(Posted 2012) [#6]
Some things could be improved but it does what it should for me.

It works for things like:
'Summary: all kind of characters walking through the building (players, terrorists and so on)
Type TFigures {_exposeToLua="selected"}
	Field Name:String		= "unknown"
	Field pos:TPosition		= TPosition.Create(0.0,0.0) {_exposeToLua}		'pos.y is difference to y of building
	Field dx:Float			= 0.0 'pixels per second
	Field initialdx:Float	= 0.0
	field target:TPosition	= TPosition.Create(-1,-1) {_exposeToLua}
...



index.php



includes/parser.class.php


includes/dataobject.class.php


template.html



bye
Ron


SystemError51(Posted 2012) [#7]
Wow - awesome Ron!

I shall try this out and report back :)


Derron(Posted 2012) [#8]
Remember not to host it accessible from outside without adding further checks to the filename (I host it only in a internal-only-directory of my apache) else someone will be able to do bad things :D.

Best case here: prepend your Main-Working-directory (eg. "C:\ProgrammingMyWork") to the filename given in index.php and do some further checks...

replace
$path	= isset($_GET["mainfile"]) ? $_GET["mainfile"] : "";


with

$path	= isset($_GET["mainfile"]) ? $_GET["mainfile"] : "";
$path	= str_replace('\','/', $path); // win, unix... slash backslash
$path	= str_replace("../", "", $path); //some try to get out of directory bounds
$path	= "C:\Programming\MyWork".$path;

//finish if not a blitzmax file (disable the check if custom extensions are possible)
if( strtolower(pathinfo($path, PATHINFO_EXTENSION)) <> "bmx" )
	return;



There are other improvements possible (template files for methods, types, ... to make it easier for them to get collapseable ( [+] and [-] signs at the header ) and so on.


bye
Ron