group Modules

Description

This set of functions are useful for module writers. The module system provides a uniform mechanism for loading native libraries and registering the functions within the system.

group contents
Functions
function ferite_add_library_search_path(char) - Add a path to the list of paths that ferite searches for scripts
function ferite_load_module(FeriteScript,FeriteNamespace,char) - Load a module (script or native)
function ferite_module_add_preload(char) - Add a module to the list of libraries that are loaded when a script is compiled
function ferite_module_do_preload(FeriteScript) - Preload the modules into the script
function ferite_module_find(char) - Locate a module within the ferite runtime
function ferite_module_find_function(char) - Locate a function pointer to the specified native function
function ferite_module_register_fake_module(char,void,void,void,void) - Register a fake native module.
function ferite_pop_library_search_path() - Remove the last added search path from the list of paths
function ferite_set_library_native_path(char) - Set the path where ferite looks for the native libraries to load

Functions

function ferite_add_library_search_path Click to go up to the list
Add a path to the list of paths that ferite searches for scripts
Declaration:
    void ferite_add_library_search_path( char *path )
Description:
Everytime a module is asked to be loaded, ferite will go through each of the search paths within the system. By default there are no paths used apart from the current directory.
Parameters:
    Parameter #1: char *path - The path to add

function ferite_load_module Click to go up to the list
Load a module (script or native)
Declaration:
    int ferite_load_module( FeriteScript *script, FeriteNamespace *ns, char *name )
Parameters:
    Parameter #1: FeriteScript *script - The script to load the module into
    Parameter #2: FeriteNamespace *ns - The namespace in which the module will be loaded. If you are not sure which namespace to use, just pass in script->mainns
    Parameter #3: char *name - The name of the module
Returns:
    0 on fail, otherwise greater than 0 for sucess

function ferite_module_add_preload Click to go up to the list
Add a module to the list of libraries that are loaded when a script is compiled
Declaration:
    void ferite_module_add_preload( char *name )
Description:
When a script is compiled, the compiler will, before any script is loaded, go through the pre-load list and load each noted module. This is equivalent to pre-pending the script to be loaded with a uses statement for each module.

This function is often used to pre-load modules that you know a script needs that the script may not load - such as a script running within an application.
Parameters:
    Parameter #1: char *name - The name of the module

function ferite_module_do_preload Click to go up to the list
Preload the modules into the script
Declaration:
    int ferite_module_do_preload( FeriteScript *script )
Description:
This function, usually called from the compiler, will go through the pre-load list created by calling ferite_module_add_preload, and compile them into the script.
Parameters:
    Parameter #1: FeriteScript *script - The script to load into

function ferite_module_find Click to go up to the list
Locate a module within the ferite runtime
Declaration:
    FeriteModule *ferite_module_find( char *name )
Description:
This function is useful to find out if a module has been loaded within the ferite system.
Parameters:
    Parameter #1: char *name - The name of the module
Returns:
    A FeriteModule pointer on success, NULL otherwise

function ferite_module_find_function Click to go up to the list
Locate a function pointer to the specified native function
Declaration:
    void *ferite_module_find_function( char *name
Description:
The name of the function should be a dot separated path to the function, followed by an underscore and then a list of the types the function accepts. For instance a function 'f' within the class 'F' that takes a string, a void and a number would be specified by:
F.f_svn
.
Parameters:
    Parameter #1: char *name - The name of the function to find
Returns:
    A non-NULL pointer on success, NULL otherwise

function ferite_module_register_fake_module Click to go up to the list
Register a fake native module.
Declaration:
    void ferite_module_register_fake_module( char *name, void *_register, void *_unregister, void *_init, void *_deinit )
Description:
This function is used to register fake modules from an application. This allows you to to setup a module to be loaded from an application. Combined with ferite_module_do_preload this will provide a method of exporting api to scripts using standard module methods.
Parameters:
    Parameter #1: char *name - The name of the module. Even though this is a fake module it must be post fixed with the ".lib" extension.
    Parameter #2: void *_register - A pointer to the register function - can be NULL
    Parameter #3: void *_unregister - A pointer to the unregister function - can be NULL
    Parameter #4: void *_init - A pointer to the init function - must not be NULL
    Parameter #5: void *_deinit - A pointer to the deinit function - must not be NULL

function ferite_pop_library_search_path Click to go up to the list
Remove the last added search path from the list of paths
Declaration:
    void ferite_pop_library_search_path()

function ferite_set_library_native_path Click to go up to the list
Set the path where ferite looks for the native libraries to load
Declaration:
    void ferite_set_library_native_path( char *path )
Description:
The system currently only uses one native search path, the aim is to reduce the potential for native code injection attacks.
Parameters:
    Parameter #1: char *path - The path where they libraries are located

Automatically generated at 12:07PM, Wednesday 25 May 2005 by feritedoc.