52 lines
1.2 KiB
C
52 lines
1.2 KiB
C
/* date = June 17th 2023 10:48 pm */
|
|
|
|
#ifndef VN_CONFIG_H
|
|
#define VN_CONFIG_H
|
|
|
|
enum config_entry_type
|
|
{
|
|
Config_Entry_S32,
|
|
Config_Entry_S64,
|
|
Config_Entry_B32,
|
|
};
|
|
|
|
struct config_entry
|
|
{
|
|
string Name;
|
|
void *Target;
|
|
config_entry_type Type;
|
|
|
|
config_entry *Next;
|
|
config_entry *Prev;
|
|
|
|
config_entry *NextInternal;
|
|
};
|
|
|
|
struct config_entry_bucket
|
|
{
|
|
config_entry *First;
|
|
config_entry *Last;
|
|
};
|
|
|
|
struct config
|
|
{
|
|
memory_arena Arena;
|
|
config_entry_bucket EntryBuckets[32];
|
|
|
|
// sixten(NOTE): Keeps track of the order in which the entries were declared. (Used during saving)
|
|
config_entry *FirstInternal;
|
|
config_entry *LastInternal;
|
|
};
|
|
|
|
static config_entry *Config_FindEntryByName(config *Config, string Name);
|
|
|
|
static void Config_BindEntry(config *Config, string Name, config_entry_type Type, void *Target);
|
|
inline void Config_BindS32(config *Config, string Name, s32 *Target, s32 Default);
|
|
inline void Config_BindS64(config *Config, string Name, s64 *Target, s64 Default);
|
|
inline void Config_BindB32(config *Config, string Name, b32 *Target, b32 Default);
|
|
|
|
static void Config_ReadFile(config *Config, string Path);
|
|
static void Config_WriteFile(config *Config);
|
|
|
|
#endif //VN_CONFIG_H
|