#ifndef _RESREG_H_
#define _RESREG_H_

#include "bool.h"
#include "darray.h"
#include "ruleset.h"

typedef struct st_AlRSreg	*AlRSreg;

#ifdef __STDC__
extern Bool		AlRSreg_init();
extern Bool		AlRSreg_register(AlRuleSet);
extern AlRuleSet	AlRSreg_read_from_file(const char *);
extern Bool	        AlRSreg_write_to_file(AlRuleSet, const char *);
extern Bool		AlRSreg_save(char *);
extern Bool		AlRSreg_load(char *);
extern AlRuleSet	AlRSreg_find(char *);
extern Bool		AlRSreg_remove(char *);
extern unsigned int	AlRSreg_entry_count();
extern NORET		AlRSreg_fetch_rs_objs(Darray);
extern NORET		AlRSreg_saveall();
#else
extern Bool		AlRSreg_init();
extern Bool		AlRSreg_register();
extern AlRuleSet	AlRSreg_read_from_file();
extern Bool	        AlRSreg_write_to_file();
extern Bool		AlRSreg_save();
extern Bool		AlRSreg_load();
extern AlRuleSet	AlRSreg_find();
extern Bool		AlRSreg_remove();
extern unsigned int	AlRSreg_entry_count();
extern NORET		AlRSreg_fetch_rs_objs();
extern NORET		AlRSreg_saveall();
#endif

#endif

/* ----- Very brief comments ----
 * AlRSreg_init()
 * Needs to be called before any other RSreg command.  If re-called the
 * registry will be wiped-out.
 *
 * AlRSreg_register(ruleset)
 * Takes: an AlRuleSet and registers it (under it's name, which is it's file
 * name).
 * Returns: Bool_TRUE on success, _FALSE otherwise, for example if the rs
 * was already registered.
 *
 * AlRSreg_save(rs_name)
 * Takes: a string which is the name of the ruleset and also the name to
 * save it under (that's the way it works).
 * Returns: Bool_TRUE on success, _FALSE otherwise, like if the rs isn't
 * registered.
 *
 * AlRSreg_load(rs_name)
 * Takes: a string which is the name of the ruleset and also the name to
 * read it in as.  It is automatically registered.
 * Returns: Bool_TRUE on success, or _FALSE if the rs doesn't exist on disk, 
 * or if it is already registered, or if the format of the saved file is not
 * the current format.
 * NOTE: See "AlRSreg_find"
 * 
 * AlRSreg_find(rs_name)
 * Same as _load except it first checks to see if the rs is registered.  If
 * it is it returns it, otherwise it tries to find it on disk and has the
 * same behavior as _load.
 *
 * AlRSreg_remove(rs_name)
 * Takes: a string which is the name of the ruleset.  It removes the rs
 * from the registry and puts it on the delete-list.  It will not delete
 * the disk version (if there is one) until _saveall is called, at which
 * point it will be removed from disk as well.
 * Returns: Bool_TRUE unless, for example, the rs wasn't registered to begin
 * with.
 *
 * AlRSreg_saveall()
 * Saves to disk all registered rulesets after deleting from disk all rulesets 
 * on the delete-list.  If a ruleset was _removed and the _load'ed back in
 * it will be deleted then saved at the _saveall call.
 */


