Using !MethodGen
================


1. Introduction
---------------

MethodGen is an application for generating code for methods used by the
Toolbox modules.  It does not handle the generation of specific SWI veneers.


2. Creating a new object
------------------------

To create a new object you will need to click on the icon on the iconbar. 
This will open a window that you will need to enter certain parameters into.
These are as follows :-

	Class Title 	-	The title of the class (e.g. gadgets)
	Object Name	-	The name of the object for the parameter
				passed in R1 (e.g. window)
	Needs		-       The header files that will be needed for
				the prototype generation
	Source Path	-	The path to write the sources to when
				generating the code (e.g.
				ToolboxLib:sources.gadgets)

Clickling on create will create the new object class and open a window
for the entry of methods.  The main window is a list window which contains a
list of the methods that belong to the class.


3. Adding new methods
---------------------

To add a new method you will need to click on the 'Add New Method' button on
the list window.  This will open the entry window for the method.  The
following information will need to be added :-

	Method Name	-	the name of the method
				(e.g. ActionButton_SetText)
	Source File     -       the name of the source file to save as
				(e.g. settext)
	Descript        -       a description of the call for the prototype
				comments and the source file
				
Once this data has been entered you will need to enter the input and output
registers.  Input or output register entry is selected by the radio icons
'Input' or 'Output'.

When 'Input' is selected, registers R0-R2 are faded out as these are filled
in automatically by the application.  To enter data for the registers you
will first need to turn on the option button for each register that is
required.  Once the option button for the register has been selected the
following data will need to be entered :-

	Var Type	-	the type of variable (i.e. char or ObjectId)
	Var Name   	-	the name of the variable for the prototype
				and source file (e.g. buffer)
	Ptr 		-	whether the variable is a pointer or not
	
The entry of output variables is the same except that register R0-R2 are not
faded.  When entering the output variables you will need to set them all to
be pointers (this is not done automatically for you).

Once you have entered all the data for the method clicking on 'Add' will add
the object to the list.  The list window will have a line similar to the
following added to it :-

	ActionButton_GetText (Source file = 'gettext')
	
	
4. Editing methods
------------------

A method can be edited by double clicking on it in the list window.  This
will open the method entry window and any data can be changed.  Clicking on
the 'Add' icon will then updated the method that was edited.


5. Deleting or Copying methods
------------------------------

Methods can be selected by clicking on them in the window (similar to a filer
viewer).  The selection menu can then be used to either copy, delete or clear
the current selection.


6. Saving the data
------------------

Once you have completed the editing of the methods it can be saved using the
save file option from the save menu.  This saves a data description file for
the object.

The file can be re-loaded by double clicking on and items can be edited and
then re-saved.


7. Generating prototypes
------------------------

The prototypes for the method functions is done by the saving of a text file. 
This is done by using the save protypes option from the save menu.  When
saving prototypes, there are the following options :-

	Partial Comments -	When set comments will be added at the start
				of each prototype
	C Header Wrappings -	When set the prototypes will be saved with
				with the wrappings of a C header file.
				
If none of the options are set then the saved text file will contain
prototypes only.


8. Generating source files
--------------------------

The source files are generated by clicking on the 'Generate Source Files'
button on the list window.  This will cause the creation of the appropriate
directories on the class's path ('c' and 'o' directories) and will write the
source files into C.

NOTE: if the source paths for the object does not contain a specific pointer
to a directory (a full path or path variable) then you will need to set the
current directory before source generation.

If you edit some of the methods and then re-generate the source, all the
source files will be re-generated and not just the ones that have changed.

