bfc1508d (kx 2023-03-24 03:55:33 +0300 1)
bfc1508d (kx 2023-03-24 03:55:33 +0300 2) #ifndef __REPO_LIST_H
bfc1508d (kx 2023-03-24 03:55:33 +0300 3) #define __REPO_LIST_H
bfc1508d (kx 2023-03-24 03:55:33 +0300 4)
bfc1508d (kx 2023-03-24 03:55:33 +0300 5) #ifndef __DEBUG__
bfc1508d (kx 2023-03-24 03:55:33 +0300 6) #define __DEBUG__ 0
bfc1508d (kx 2023-03-24 03:55:33 +0300 7) #endif
bfc1508d (kx 2023-03-24 03:55:33 +0300 8)
bfc1508d (kx 2023-03-24 03:55:33 +0300 9) #ifndef ST_GLOBAL
bfc1508d (kx 2023-03-24 03:55:33 +0300 10) #define ST_GLOBAL 1
bfc1508d (kx 2023-03-24 03:55:33 +0300 11) #endif
bfc1508d (kx 2023-03-24 03:55:33 +0300 12) #ifndef ST_REPOS
bfc1508d (kx 2023-03-24 03:55:33 +0300 13) #define ST_REPOS 2
bfc1508d (kx 2023-03-24 03:55:33 +0300 14) #endif
bfc1508d (kx 2023-03-24 03:55:33 +0300 15)
bfc1508d (kx 2023-03-24 03:55:33 +0300 16) #ifndef DT_NUMERICAL
bfc1508d (kx 2023-03-24 03:55:33 +0300 17) #define DT_NUMERICAL 0x01
bfc1508d (kx 2023-03-24 03:55:33 +0300 18) #endif
bfc1508d (kx 2023-03-24 03:55:33 +0300 19) #ifndef DT_PATH
bfc1508d (kx 2023-03-24 03:55:33 +0300 20) #define DT_PATH 0x02
bfc1508d (kx 2023-03-24 03:55:33 +0300 21) #endif
bfc1508d (kx 2023-03-24 03:55:33 +0300 22) #ifndef DT_STRING
bfc1508d (kx 2023-03-24 03:55:33 +0300 23) #define DT_STRING 0x04
bfc1508d (kx 2023-03-24 03:55:33 +0300 24) #endif
bfc1508d (kx 2023-03-24 03:55:33 +0300 25)
bfc1508d (kx 2023-03-24 03:55:33 +0300 26) struct section
bfc1508d (kx 2023-03-24 03:55:33 +0300 27) {
bfc1508d (kx 2023-03-24 03:55:33 +0300 28) int type;
bfc1508d (kx 2023-03-24 03:55:33 +0300 29) unsigned char *name;
bfc1508d (kx 2023-03-24 03:55:33 +0300 30) struct dlist *list;
bfc1508d (kx 2023-03-24 03:55:33 +0300 31) };
bfc1508d (kx 2023-03-24 03:55:33 +0300 32)
bfc1508d (kx 2023-03-24 03:55:33 +0300 33) struct variable
bfc1508d (kx 2023-03-24 03:55:33 +0300 34) {
bfc1508d (kx 2023-03-24 03:55:33 +0300 35) unsigned char *name;
bfc1508d (kx 2023-03-24 03:55:33 +0300 36) union
bfc1508d (kx 2023-03-24 03:55:33 +0300 37) {
bfc1508d (kx 2023-03-24 03:55:33 +0300 38) int val;
bfc1508d (kx 2023-03-24 03:55:33 +0300 39) unsigned char *vptr;
bfc1508d (kx 2023-03-24 03:55:33 +0300 40) } _v;
bfc1508d (kx 2023-03-24 03:55:33 +0300 41) unsigned int type;
bfc1508d (kx 2023-03-24 03:55:33 +0300 42) };
bfc1508d (kx 2023-03-24 03:55:33 +0300 43)
bfc1508d (kx 2023-03-24 03:55:33 +0300 44) struct repo
bfc1508d (kx 2023-03-24 03:55:33 +0300 45) {
bfc1508d (kx 2023-03-24 03:55:33 +0300 46) unsigned char *path;
bfc1508d (kx 2023-03-24 03:55:33 +0300 47) struct dlist *list;
bfc1508d (kx 2023-03-24 03:55:33 +0300 48) };
bfc1508d (kx 2023-03-24 03:55:33 +0300 49)
bfc1508d (kx 2023-03-24 03:55:33 +0300 50) extern struct dlist *config;
bfc1508d (kx 2023-03-24 03:55:33 +0300 51)
bfc1508d (kx 2023-03-24 03:55:33 +0300 52)
bfc1508d (kx 2023-03-24 03:55:33 +0300 53) #ifdef __cplusplus
bfc1508d (kx 2023-03-24 03:55:33 +0300 54) extern "C" {
bfc1508d (kx 2023-03-24 03:55:33 +0300 55) #endif
bfc1508d (kx 2023-03-24 03:55:33 +0300 56)
bfc1508d (kx 2023-03-24 03:55:33 +0300 57) typedef void (*rlist_errfunc)( const char *fmt, ... );
bfc1508d (kx 2023-03-24 03:55:33 +0300 58)
bfc1508d (kx 2023-03-24 03:55:33 +0300 59) extern void rlist_error( const char *fmt, ... ) __attribute__((format (printf,1,2)));
bfc1508d (kx 2023-03-24 03:55:33 +0300 60) extern rlist_errfunc rlist_fatal; /* Default Fatal Error Function == rlist_error() */
bfc1508d (kx 2023-03-24 03:55:33 +0300 61)
bfc1508d (kx 2023-03-24 03:55:33 +0300 62)
bfc1508d (kx 2023-03-24 03:55:33 +0300 63) extern struct dlist *read_config( void );
bfc1508d (kx 2023-03-24 03:55:33 +0300 64) extern void print_config( struct strbuf *sb, struct dlist *list );
bfc1508d (kx 2023-03-24 03:55:33 +0300 65) extern struct variable *lookup( struct repo *repo, struct variable *variable );
bfc1508d (kx 2023-03-24 03:55:33 +0300 66) extern struct variable *lookup_global( struct section *section, struct variable *variable );
bfc1508d (kx 2023-03-24 03:55:33 +0300 67) extern struct repo *lookup_repo( struct dlist *config, const char *path );
bfc1508d (kx 2023-03-24 03:55:33 +0300 68) extern struct section *lookup_section( struct dlist *config, const char *name );
bfc1508d (kx 2023-03-24 03:55:33 +0300 69) extern struct section *lookup_global_section( struct dlist *config );
bfc1508d (kx 2023-03-24 03:55:33 +0300 70)
bfc1508d (kx 2023-03-24 03:55:33 +0300 71) extern int repolist_length( struct dlist *config );
bfc1508d (kx 2023-03-24 03:55:33 +0300 72) extern struct repo *repolist_nth( struct dlist *config, int n );
bfc1508d (kx 2023-03-24 03:55:33 +0300 73) extern int repo_position( struct dlist *config, struct repo *repo );
bfc1508d (kx 2023-03-24 03:55:33 +0300 74)
bfc1508d (kx 2023-03-24 03:55:33 +0300 75) extern struct dlist *parent_section_node_repolist_nth( struct dlist *config, int n );
bfc1508d (kx 2023-03-24 03:55:33 +0300 76) extern struct dlist *parent_rlist_node_repolist_nth( struct dlist *config, int n );
bfc1508d (kx 2023-03-24 03:55:33 +0300 77)
bfc1508d (kx 2023-03-24 03:55:33 +0300 78) extern void free_config( void );
bfc1508d (kx 2023-03-24 03:55:33 +0300 79)
bfc1508d (kx 2023-03-24 03:55:33 +0300 80)
bfc1508d (kx 2023-03-24 03:55:33 +0300 81) #ifdef __cplusplus
bfc1508d (kx 2023-03-24 03:55:33 +0300 82) }
bfc1508d (kx 2023-03-24 03:55:33 +0300 83) #endif
bfc1508d (kx 2023-03-24 03:55:33 +0300 84)
bfc1508d (kx 2023-03-24 03:55:33 +0300 85) #endif /* __REPO_LIST_H */