Using Doxygen with BlitzMax

BlitzMax Forums/BlitzMax Programming/Using Doxygen with BlitzMax

If you're interested in using Doxygen with BlitzMax and you don't want to have to work with two different files for documentation and code, this is how you do it:
'/*
Rem
*/

/// @brief Prints "I"
/// @return Pi (3.1415962 and so on)
double Blah();

/// @brief Foo object class
class Foo
{
	public:
	/// @brief Some variable
	int bar;
	
	/// @brief Creates a Foo object
	/// @param i The Foo's bar information
	/// @return A new Foo object
	static Foo Create(int i);
};

/// @brief Bar object class
class Bar : public Foo
{
	public:
	/// @brief Craptasticalnessnessness
	int _foo;
	
	/// @brief Creates a Bar object
	/// @param f The Bar's _foo information
	/// @return A new Bar object
	static Bar Create(Object f);
};
'/*
End Rem

' Doxygen test

Function Blah!()
	Print "I"
	Return Pi
End Function

Type Foo
	Field bar:Int
	
	Function Create:Foo(i:Int)
		Local this:Foo = New Foo
		this.bar = i
		Return this
	End Function
End Type

Type Bar..
	Extends Foo
	
	Field _foo:Object
	
	Function Create:Bar(f:Object)
		Local this:Bar = New Bar
		this._foo = f
		Return this
	End Function
End Type

'*/


Ugly, messy, but if you like Doxygen then you probably don't mind that already. Until my documentation generator is released, this is probably the only way to document non-module code besides writing everything by hand.

Well, just thought I'd post that- weird experiment, but eh.

For those without a clue, Whats Doxygen?

http://www.stack.nl/~dimitri/doxygen/

Google would've taken less time -_-

Hey thanks Noel! This WILL have to hold us over till your Doc generator is done. Any ETA on its release?

I think it'll be soon (e.g., week or two), I'm just working on bits and pieces of the output now. I've been thinking about trying to use Dot with it, but I don't know yet. That can wait 'til I'm done with the rest of it.

Basically, this is what I've got it outputting at the moment when I run it over my GUI module (test output, in other words this wasn't made by DocGen itself but rather by looping through all of DocGen's acquired data and putting it in a single file so I can look for errors).

Basically, the way it works at the moment is a three-pass system. First pass gathers all the objects in the files, be it comments, types, methods, functions, variables, etc., then the second pass gathers all associations between the data, comments, etc. and links them accordingly. The third pass is generating the HTML based on template files that look something like this (you don't have to write you own as I'm including 'defaults' in it as well, but you'll likely want to write your own because the defaults are gonna be ugly [I don't want to spend a lot of time on them]):
@HTMLHEADER
	<html><head><link href="docgen.css" rel="stylesheet" type="text/css"/>
	<title>$PROJECTNAME$ Documentation</title></head><body>
@HTMLFOOTER
	<div class="smallText">Generated by <img src="docgenr3.png"/> v$DOCGENVERSION$</div>
	</body></html>
@BRIEFLIST
	<table border="1">
		$CONTENT$
	</table>
@FUNCTION
	<TABLE width="100%" align="center">
		<TR><TD>
			<TABLE width="100%">
				<TR><TD>
					$NAME-BRIEF$
				</TD></TR>
			</TABLE>
			<BR/>
			<TABLE width="100%">
				<TR>
					<TD>$ARGS-LONG$</TD>
					<TD>Description :<br>$DESC$<HR/>Returns :<br>$RETURNS$</TD>
				</TR>
			</TABLE>
		</TD></TR>
	</TABLE>
	<BR/>
@END


Edit: And for a basic example of how you document code in it:
''' @brief The class used to update and draw the GUI
Type CGUI Final
	''' @brief The gadget list- only here for windows, other gadgets really/
	''' should not be in this list
	Global GadList:TList
	''' @brief The active window
	Global ActiveWindow:CWindow
	''' @brief Whether or not the GUI class is initialized.  This variable is kindof useless.
	Global Initialized:Int
	''' @brief The active GUI object
	Global GUI:CGUI
	''' @brief The path to the skin the GUI is using
	Global SkinPath:String="./"
	''' @brief The path to the font the GUI is using
	Global FontPath:String=""
	''' @brief The font style of title bar text (like a header)
	Global TitleFontStyle:Int = SMOOTHFONT|BOLDFONT
	''' @brief The normal font style used for pretty much everything
	Global NormalFontStyle:Int = SMOOTHFONT
	''' @brief Normal gadget text color
	Global GadgetR
	''' @brief Normal gadget text color
	Global GadgetG
	''' @brief Normal gadget text color
	Global GadgetB
	''' @brief Disabled gadget text color
	Global DisabledR=92
	''' @brief Disabled gadget text color
	Global DisabledG=92
	''' @brief Disabled gadget text color
	Global DisabledB=92
	''' @brief Title text color
	Global TitleR
	''' @brief Title text color
	Global TitleG
	''' @brief Title text color
	Global TitleB
	''' @brief Selected text color
	Global SelectedR
	''' @brief Selected text color
	Global SelectedG
	''' @brief Selected text color
	Global SelectedB
	''' @brief Current GL context's width
	Global Width:Double
	''' @brief Current GL context's height
	Global Height:Double
	''' @brief
	Global PushData:Int = 1
	
	Method New()
		CGUI.Initialized = 1
		CGUI.GadList = CreateList()
		CGUI.GUI = Self
		SetMaskColor 255,0,255
		Form = LoadImage(CGUI.SkinPath+"form.png",0)
		Assert Form,"Form is Null; this is a required file"
		Font = LoadImageFont(CGUI.FontPath,12,NormalFontStyle)
		If Font = Null Then Font = GetImageFont()
		FontTitle = LoadImageFont(CGUI.FontPath,16,TitleFontStyle)
		If FontTitle = Null Then FontTitle = GetImageFont()
		If Font = Null Then Font = GetImageFont()
		If FontTitle = Null Then FontTitle = GetImageFont()
	End Method
	
	''' @brief Reloads the skin - use this to load a new skin
	Function ReloadSkin()
		SetMaskColor 255,0,255
		Form = LoadImage(CGUI.SkinPath+"form.png",0)
		Assert Form,"Form is Null; this is a required file"
		Font = LoadImageFont(CGUI.FontPath,12,NormalFontStyle)
		FontTitle = LoadImageFont(CGUI.FontPath,16,TitleFontStyle)
		If Font = Null Then Font = GetImageFont()
		If FontTitle = Null Then FontTitle = GetImageFont()
	End Function
	
	''' @brief Updates the GUI and all gadgets
	Function Update()
		If CGUI.Initialized = 0 Then Return
		
		Local cFont:TImageFont = GetImageFont()
		
		MH = 0
		MU = 0
		
		MD = MouseDown(1)
		If MD=1 And OMD=0 Then MH = 1
		If MD=0 And OMD=1 Then MU = 1
		MX = MouseX()
		MY = MouseY()
		
		For Local i:CGadget = EachIn CGUI.GadList
			i.Update()
		Next
		
		SetImageFont(cFont)
		
		OMD = MD
	End Function
	
	''' @brief Draws the GUI and all visible gadgets
	Function Draw()
		Local iPushData = PushData
		Local cFont:TImageFont
		
		If iPushData Then
			glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS)
			glPushAttrib(GL_ALL_ATTRIB_BITS)
			cg_Error_ "Pushing attribs"
			
			glMatrixMode(GL_PROJECTION)
			glPushMatrix()
			glLoadIdentity()
			cg_Error_ "Setting projection matrix"
			glOrtho(0:Double, CGUI.width:Double, CGUI.height:Double, 0:Double,..
				-10:Double, 10:Double)
			cg_Error_ "Setting orthographic projection "+CGUI.Width+" "+cgui.height
			glMatrixMode(GL_MODELVIEW)
			glPushMatrix()
			glLoadIdentity()
			cg_Error_ "Setting modelview matrix"
			
			cFont = GetImageFont()
			
			glEnable GL_TEXTURE_2D
			cg_Error_ "Setting blend modes"
			
			glDisable GL_DEPTH_TEST
		EndIf
		For Local i:CGadget = EachIn CGUI.GadList
			glScissor(0,0,GraphicsWidth(),GraphicsHeight())
			i.Draw()
		Next
		If iPushData Then
			SetImageFont(cFont)
			
			glPopMatrix()
			glMatrixMode GL_PROJECTION
			glPopMatrix()
			glMatrixMode GL_MODELVIEW
			
			glPopAttrib()
			glPopClientAttrib()
			cg_Error_ "Popping attributes and matrices"
		EndIf
	End Function
	
	''' @brief Registers a window - for internal use only
	Function RegisterGadget:TLink(gad:CWindow)
		ActiveWindow = gad
		Return ListAddLast(CGUI.GadList,gad)
	End Function
	
	'' Convenience functions added to make expanding the GUI easier
	
	''' @brief Gets the current skin's image class
	''' @return The current skin's image
	Method GetSkinImage:TImage()
		Return Form
	End Method
	
	''' @brief Gets the current skin's font class
	''' @return The current skin's font
	Method GetGadgetFont:TImageFont()
		Return Font
	End Method
	
	''' @brief Gets the current skin's header font class
	''' @return The current skin's titlebar/header font
	Method GetTitleFont:TImageFont()
		Return FontTitle
	End Method
	
	''' @brief Returns whether the left mouse button was released
	''' @return True if released, False if not
	Method MouseUp()
		Return MU
	End Method
	
	''' @brief Returns whether the left mouse button is being pressed
	''' @return True if pressed, False if not
	Method MouseDown()
		Return MD
	End Method
	
	''' @brief Returns whether the left mouse button was hit
	''' @return True if hit, False if not
	Method MouseHit()
		Return MH
	End Method
End Type


Random blurb over.

Damn Noel, thats the [poop]! Cant wait!