Skip to content
osenmukdav edited this page Mar 24, 2020 · 2 revisions

Even though pony is a highly flexible platform and (at least currently) is undergoing changes even in core elements, it still has some basic conceptual parts which are always included. These parts are the bus and the plugin execution list. Each of them has an infrastructure that allows for simpler interaction with the user.

Bus

Bus of pony consitsts of several different parts, some of which are just pointers to the corresponding structures instead of the structures themselves. This is done to avoid extra memory being allocated for parts that are not used in the program. As a user, you can decide for which bus parts memory is allocated through pony.init(). Depending on the configuration string passed, pony.init() allocates the memory for them and initialises certain values. Later, those parts can be used in the plugins. Each bus part also contains part of configuration string specific to this bus part, which allows to pass user-defined information to plugins (for instance, input file names). The user does not need to free any memory on the bus other than allocated by themselves, but such variables are very rare and are always marked. In the rest of the cases, memory is freed automatically.

Plugin execution list

Pony contains a plugin execution list, which is effectively a dynamic array of pony_plugin structires. Main part of pony_plugin is func, a pointer to a plugin, user-defined function of type void name(void). Functions in the array are all called one time when pony.step() is called, and have different behaviour depending on the mode (initialisation, normal work, termination). You can add your plugins to the execution list simply by using pony.add_plugin(), the functions will be called in the order you added them. There are advanced functions for manipulating plugins, but they are covered in a different place.

Clone this wiki locally