2009-02-05 21:08:46 +00:00
|
|
|
#ifndef _INCLUDE_R_CONFIG_H_
|
|
|
|
#define _INCLUDE_R_CONFIG_H_
|
|
|
|
|
|
|
|
#include "r_types.h"
|
|
|
|
#include "r_util.h"
|
|
|
|
#include "list.h"
|
|
|
|
|
|
|
|
#define CN_BOOL 0x000001
|
|
|
|
#define CN_INT 0x000002
|
|
|
|
#define CN_OFFT 0x000004
|
|
|
|
#define CN_STR 0x000008
|
|
|
|
#define CN_RO 0x000010
|
|
|
|
#define CN_RW 0x000020
|
|
|
|
|
2009-12-24 02:17:53 +00:00
|
|
|
typedef struct r_config_node_t {
|
2009-02-05 21:08:46 +00:00
|
|
|
char *name;
|
|
|
|
int hash;
|
|
|
|
int flags;
|
|
|
|
char *value;
|
2009-07-08 11:49:55 +00:00
|
|
|
ut64 i_value;
|
|
|
|
ut64 *cb_ptr_q;
|
2009-02-05 21:08:46 +00:00
|
|
|
int *cb_ptr_i;
|
|
|
|
char **cb_ptr_s;
|
2009-03-12 01:42:35 +00:00
|
|
|
int (*callback)(void *user, void *data);
|
2009-02-05 21:08:46 +00:00
|
|
|
struct list_head list;
|
2010-01-26 00:28:33 +00:00
|
|
|
} RConfigNode;
|
2009-02-05 21:08:46 +00:00
|
|
|
|
2009-12-24 02:17:53 +00:00
|
|
|
typedef struct r_config_t {
|
2009-02-05 21:08:46 +00:00
|
|
|
int lock;
|
|
|
|
int last_notfound;
|
|
|
|
int n_nodes;
|
2009-03-12 01:42:35 +00:00
|
|
|
void *user;
|
2009-02-05 21:08:46 +00:00
|
|
|
void (*printf)(const char *str, ...);
|
|
|
|
struct list_head nodes;
|
2010-01-26 00:28:33 +00:00
|
|
|
} RConfig;
|
2009-02-05 21:08:46 +00:00
|
|
|
|
2009-12-24 02:17:53 +00:00
|
|
|
#ifdef R_API
|
2009-04-06 22:53:25 +00:00
|
|
|
R_API struct r_config_t *r_config_new(void *user);
|
|
|
|
R_API int r_config_free(struct r_config_t *cfg);
|
|
|
|
R_API int r_config_init(struct r_config_t *core, void *user);
|
2010-01-26 00:28:33 +00:00
|
|
|
R_API void r_config_lock(RConfig *cfg, int l);
|
|
|
|
R_API int r_config_eval(RConfig *cfg, const char *str);
|
|
|
|
R_API struct r_config_node_t *r_config_set_i(RConfig *cfg, const char *name, const ut64 i);
|
|
|
|
R_API struct r_config_node_t *r_config_set_cb(RConfig *cfg, const char *name, const char *value, int (*callback)(void *user, void *data));
|
|
|
|
R_API struct r_config_node_t *r_config_set_i_cb(RConfig *cfg, const char *name, int ivalue, int (*callback)(void *user, void *data));
|
|
|
|
R_API int r_config_rm(RConfig *cfg, const char *name);
|
|
|
|
R_API struct r_config_node_t *r_config_set(RConfig *cfg, const char *name, const char *value);
|
|
|
|
R_API ut64 r_config_get_i(RConfig *cfg, const char *name);
|
|
|
|
R_API const char *r_config_get(RConfig *cfg, const char *name);
|
|
|
|
R_API void r_config_list(RConfig *cfg, const char *str, int rad);
|
|
|
|
R_API struct r_config_node_t *r_config_node_get(RConfig *cfg, const char *name);
|
2009-04-06 22:53:25 +00:00
|
|
|
R_API struct r_config_node_t *r_config_node_new(const char *name, const char *value);
|
2010-01-26 00:28:33 +00:00
|
|
|
R_API int r_config_swap(RConfig *cfg, const char *name);
|
2009-12-24 02:17:53 +00:00
|
|
|
#endif
|
2009-02-05 21:08:46 +00:00
|
|
|
|
|
|
|
#endif
|