2007-11-25 19:42:40 +00:00
|
|
|
/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
|
2007-06-01 11:08:33 +00:00
|
|
|
#ifndef _CONFIG_H
|
|
|
|
#define _CONFIG_H
|
|
|
|
|
2007-10-09 09:04:57 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"{
|
|
|
|
#endif
|
|
|
|
|
2007-08-22 07:52:33 +00:00
|
|
|
typedef struct
|
2007-06-01 11:08:33 +00:00
|
|
|
{
|
|
|
|
#define MACRO_CONFIG_INT(name,def,min,max) int name;
|
|
|
|
#define MACRO_CONFIG_STR(name,len,def) char name[len];
|
2007-12-15 10:24:49 +00:00
|
|
|
#include "e_config_variables.h"
|
2007-06-01 11:08:33 +00:00
|
|
|
#undef MACRO_CONFIG_INT
|
|
|
|
#undef MACRO_CONFIG_STR
|
2007-08-22 07:52:33 +00:00
|
|
|
} CONFIGURATION;
|
2007-06-01 11:08:33 +00:00
|
|
|
|
2007-08-22 07:52:33 +00:00
|
|
|
extern CONFIGURATION config;
|
2007-06-01 11:08:33 +00:00
|
|
|
|
2008-01-16 22:14:06 +00:00
|
|
|
void config_init();
|
2007-07-27 00:03:28 +00:00
|
|
|
void config_set(const char *line);
|
2007-06-01 11:08:33 +00:00
|
|
|
void config_reset();
|
|
|
|
void config_load(const char *filename);
|
2007-06-01 11:17:10 +00:00
|
|
|
void config_save(const char *filename);
|
2007-06-01 11:08:33 +00:00
|
|
|
|
2008-01-16 22:14:06 +00:00
|
|
|
typedef int (*config_int_getter)(CONFIGURATION *c);
|
|
|
|
typedef const char *(*config_str_getter)(CONFIGURATION *c);
|
|
|
|
typedef void (*config_int_setter)(CONFIGURATION *c, int val);
|
|
|
|
typedef void (*config_str_setter)(CONFIGURATION *c, const char *str);
|
|
|
|
|
2007-08-22 07:52:33 +00:00
|
|
|
#define MACRO_CONFIG_INT(name,def,min,max) int config_get_ ## name (CONFIGURATION *c);
|
|
|
|
#define MACRO_CONFIG_STR(name,len,def) const char *config_get_ ## name (CONFIGURATION *c);
|
2007-12-15 10:24:49 +00:00
|
|
|
#include "e_config_variables.h"
|
2007-06-01 12:24:13 +00:00
|
|
|
#undef MACRO_CONFIG_INT
|
|
|
|
#undef MACRO_CONFIG_STR
|
|
|
|
|
2007-08-22 07:52:33 +00:00
|
|
|
#define MACRO_CONFIG_INT(name,def,min,max) void config_set_ ## name (CONFIGURATION *c, int val);
|
|
|
|
#define MACRO_CONFIG_STR(name,len,def) void config_set_ ## name (CONFIGURATION *c, const char *str);
|
2007-12-15 10:24:49 +00:00
|
|
|
#include "e_config_variables.h"
|
2007-06-01 11:08:33 +00:00
|
|
|
#undef MACRO_CONFIG_INT
|
|
|
|
#undef MACRO_CONFIG_STR
|
|
|
|
|
2007-10-09 09:04:57 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-06-01 11:08:33 +00:00
|
|
|
#endif
|