#ifndef __REPO_LIST_H
#define __REPO_LIST_H
#ifndef __DEBUG__
#define __DEBUG__ 0
#endif
#ifndef ST_GLOBAL
#define ST_GLOBAL 1
#endif
#ifndef ST_REPOS
#define ST_REPOS 2
#endif
#ifndef DT_NUMERICAL
#define DT_NUMERICAL 0x01
#endif
#ifndef DT_PATH
#define DT_PATH 0x02
#endif
#ifndef DT_STRING
#define DT_STRING 0x04
#endif
struct section
{
int type;
unsigned char *name;
struct dlist *list;
};
struct variable
{
unsigned char *name;
union
{
int val;
unsigned char *vptr;
} _v;
unsigned int type;
};
struct repo
{
unsigned char *path;
struct dlist *list;
};
extern struct dlist *config;
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*rlist_errfunc)( const char *fmt, ... );
extern void rlist_error( const char *fmt, ... ) __attribute__((format (printf,1,2)));
extern rlist_errfunc rlist_fatal; /* Default Fatal Error Function == rlist_error() */
extern struct dlist *read_config( void );
extern void print_config( struct strbuf *sb, struct dlist *list );
extern struct variable *lookup( struct repo *repo, struct variable *variable );
extern struct variable *lookup_global( struct section *section, struct variable *variable );
extern struct repo *lookup_repo( struct dlist *config, const char *path );
extern struct section *lookup_section( struct dlist *config, const char *name );
extern struct section *lookup_global_section( struct dlist *config );
extern int repolist_length( struct dlist *config );
extern struct repo *repolist_nth( struct dlist *config, int n );
extern int repo_position( struct dlist *config, struct repo *repo );
extern struct dlist *parent_section_node_repolist_nth( struct dlist *config, int n );
extern struct dlist *parent_rlist_node_repolist_nth( struct dlist *config, int n );
extern void free_config( void );
#ifdef __cplusplus
}
#endif
#endif /* __REPO_LIST_H */