Introduction

In this document, we will go over what needs to be implemented in a code generation plugin. You have to implement the following functions no matter what language you are writing for:
gcg_module_get_name
gcg_module_get_info
gcg_module_get_source_ext
gcg_module_get_has_header
gcg_module_get_source_code
In addition, if the language that you're writing for requires a header file, then you need to implement the following as well:
gcg_module_get_header_ext
gcg_module_get_header_code

get_name

The get_name function should be defined in this way:
G_MODULE_EXPORT gchar *gcg_module_get_name(void)
The purpose of this function is to provide the name that is displayed in the plugin combo box

get_info

The get_info function should be defined in this way:
G_MODULE_EXPORT GcgModuleInfo gcg_module_get_info(void)
The purpose of this function is to provide information about the plugin for the "About Plugins" help item. The GcgModuleInfo struct is defined in gcgmodule.h and has the following members:
gchar *authors - A newline separated string containing the authors of the plugin
gchar *language - The language that the plugin is for (C, Python etc.)
gchar *other - Any other misc info about the plugin
gboolean supports_properties - Does the plugin support properties
gboolean supports_signals - Does the plugin support signals
gboolean supports_interfaces - Does the plugin support interfaces

get_source_ext

The get_source_ext function should be defined in this way:
G_MODULE_EXPORT gchar *gcg_module_get_source_ext(void)
The purpose of this function is just what the name implies - it is to get the extension of the source files it saves. For example, for C you would return "c" and for python you would return "py"

get_has_header

The get_has_header function should be defined in this way:
G_MODULE_EXPORT gboolean gcg_module_get_has_header(void)
This function returns TRUE if the language you're writing for requires a header file, and FALSE if it doesn't

get_source_code

The get_source_code function should be defined in this way:
G_MODULE_EXPORT gchar *gcg_module_get_source_code(GcgClassData*)
This is the function that actually generates the outputed code. It is passed a pointer to a GcgClassData struct, which holds information about the to-be-generated class. See here for information on this struct.

get_header_ext

The get_header_ext function should be defined in this way:
G_MODULE_EXPORT gchar *gcg_module_get_header_ext(void)
This function is just like get_source_ext, except that it is for the header file instead of the source file.

get_header_code

The get_header_code function should be defined in this way:
G_MODULE_EXPORT gchar *gcg_module_get_header_code(GcgClassData*)
This function is just like get_source_code, except that it is for the header file instead of the source file.

Conclusion

You should now have all you need to know to write a code generation plugin for GClassGen. Remember that the official plugins' source code are available here.