#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
#include "assert.h"
#include "main.h"
#include "modsup.h"
#include "error.h"
#include "chromo.h"
#include "gettext.h"
Functions | |
moduleoption * | option_new (moduleoption *opt, char *name, char *content) |
Inserts a new module option to the beginning of the moduleoption linked list. | |
moduleoption * | option_find (moduleoption *opt, char *name) |
Finds an option by name. | |
int | option_int (moduleoption *opt, char *name) |
Finds an integer option by name. | |
char * | option_str (moduleoption *opt, char *name) |
Finds a string option by name. | |
void | option_free (moduleoption *opt) |
Free a linked list of options. | |
precalcfunc * | precalc_new (init_f func) |
Register a new precalc function. | |
int | precalc_call () |
Call all registered precalc functions. | |
fitnessfunc * | fitness_new (char *name, int weight, int man, fitness_f func) |
Registers a new fitness function. | |
int | fitness_request_chromo (fitnessfunc *fitness, char *restype) |
Request a chromosome to be passed to a fitness function. | |
int | fitness_request_ext (fitnessfunc *fitness, char *contype, char *vartype) |
Request an extension to be passed to a fitness function. | |
int | fitness_request_slist (fitnessfunc *fitness, char *vartype) |
Request a slist to be passed to a fitness function. | |
void | table_fitness (table *tab) |
Assign a fitness to a table by calling all fitness functions. | |
modulehandler * | handler_tup_new (char *restriction, handler_tup_f handler) |
Registers a new tuple restriction handler. | |
modulehandler * | handler_res_new (char *restype, char *restriction, handler_res_f handler) |
Registers a new resource restriction handler. | |
modulehandler * | handler_find (modulehandler *cur, resourcetype *restype, char *restriction) |
Find a module restriction handler. | |
int | handler_res_call (resource *res, char *restriction, char *content) |
Call a resource restriction handler. | |
int | handler_tup_call (tupleinfo *tuple, char *restriction, char *content) |
Call a tuple restriction handler. | |
modulelist * | modulelist_new () |
Allocates a new modulelist structure. | |
module * | module_load (char *name, moduleoption *opt) |
Loads a module. After the module is loaded, module_init() function is called. | |
Variables | |
static modulelist * | mod_list = NULL |
Linked list of all registered modules. | |
static modulehandler * | mod_handler = NULL |
Linked list of all registered restriction handlers. | |
int | mod_fitnessnum = 0 |
Number of all registered fitness functions. | |
fitnessfunc * | mod_fitnessfunc = NULL |
Linked list of all registered fitness functions. | |
static precalcfunc * | mod_precalc = NULL |
Linked list of all registered precalc functions. | |
static resourcetype | mod_eventtype = {type: EVENT_TYPE } |
Special resource type for events. It is used only by restriction handlers. | |
static resourcetype | mod_anytype = {type: ANY_TYPE } |
Special resource type that matches any type and is used only by restriction handlers. |
|
Registers a new fitness function.
|
|
Request a chromosome to be passed to a fitness function.
|
|
Request an extension to be passed to a fitness function.
|
|
Request a slist to be passed to a fitness function.
|
|
Find a module restriction handler.
|
|
Call a resource restriction handler.
|
|
Registers a new resource restriction handler.
|
|
Call a tuple restriction handler.
|
|
Registers a new tuple restriction handler.
|
|
Loads a module. After the module is loaded, module_init() function is called.
|
|
Allocates a new modulelist structure.
|
|
Finds an option by name. If there many options with the same name in the linked list, you can find them all with the following loop:
moduleoption *result; // "list" is the pointer to the linked list to search result=option_find(list, "name"); while(result!=NULL) { // do something with "result" result=option_find(result->next, "name"); }
|
|
Free a linked list of options.
|
|
Finds an integer option by name. Note that if more than one option with the same name is defined then this function returns the value of the option that was added last to the linked list by option_new()
|
|
Inserts a new module option to the beginning of the moduleoption linked list.
|
|
Finds a string option by name. Note that if more than one option with the same name is defined then this function returns the value of the option that was added last to the linked list by option_new()
|
|
Call all registered precalc functions.
|
|
Register a new precalc function.
|
|
Assign a fitness to a table by calling all fitness functions.
|