/*
 * The Spar Library - modular math parser
 * Copyright (C) 2000,2001 Davide Angelocola <davide178@inwind.it>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA  02111-1307, USA.
 *
 */

/**
 *  Module manager extern interface.
 *
 *  This is a low-level interface to a binary search tree that stores
 *  the modules by struct @see struct module. There are two main key:
 *  the module ID (a counter assigned by the module loader) and the
 *  module name (that is unique). All function in this module has the
 *  prefix "sl_module_manager_".
 *
 */

#ifndef _sl_module_manager_h
#define _sl_module_manager_h

#include <spar/sl_module.h>
#include <spar/sl_conf.h>

__BEGIN_DECLS
/*
 *  Add a module to the module binary tree
 * 
 *  This function inserts the module m into the module binary in order to 
 *  simplify the module search. Also is added a module ID (that is a integer 
 *  variable) needed by some tree function.    
 */
int sl_module_manager_add (const sl_module * m, int module_ID, void *handle);

/*
 *  Remove a module to the module binary tree
 *
 *  This function removes the module m into the module binary. After do this
 *  the module is not usable  
 */
int sl_module_manager_remove (const char *name);

/*
 *  Show module documentation
 *
 *  This function prints out all module data members and specify if the module 
 *  requested is loaded into memory. 
 */
int sl_module_manager_print (const char *name);

/*
 *  Removes all modules 
 *
 *  This function clean up memory from the module binary tree.
 */
void sl_module_manager_remove_all (void);

/*
 *  Prints all modules currently loaded
 */
void sl_module_manager_print_all (void);

/*
 *  Inits the module manager
 */
void sl_module_manager_init (void);

/*
 *  Run a module 
 *
 *  This function runs a module by calling the module_main function. Then
 *  the control is returned in this function that cheks the return code.
 *  If the module named "name" is not loaded returns SYMBOL_NOT_FOUND
 */
int sl_module_manager_run (const char *name);

__END_DECLS
#endif /* _sl_module_manager_h_ */


syntax highlighted by Code2HTML, v. 0.9.1