Cthulhu  0.2.10
Cthulhu compiler collection
config.h File Reference
#include <ctu_config_api.h>
#include "core/analyze.h"
#include "core/compiler.h"
#include <stdbool.h>
#include <stddef.h>
#include <limits.h>
#include "config.inc"
Include dependency graph for config.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  cfg_arg_t
 
struct  cfg_arg_array_t
 
struct  cfg_info_t
 information about a configuration field More...
 
struct  cfg_int_t
 an integer field More...
 
struct  cfg_choice_t
 a choice in a set of options More...
 
struct  cfg_enum_t
 a choice from a set of options More...
 

Macros

#define CFG_TYPE(id, name)   id,
 
#define CFG_ARG(id, name, prefix)   id,
 
#define CT_ARG_SHORT(name)   { .style = eArgShort, .arg = (name) }
 
#define CT_ARG_LONG(name)   { .style = eArgLong, .arg = (name) }
 
#define CT_ARG_DOS(name)   { .style = eArgDOS, .arg = (name) }
 
#define CT_ARGS(it)   { .args = (it), .count = sizeof(it) / sizeof(cfg_arg_t) }
 

Typedefs

typedef typedefCT_BEGIN_API struct arena_t arena_t
 a memory allocator More...
 

Enumerations

enum  cfg_type_t { eConfigCount }
 the type of a configuration field More...
 
enum  arg_style_t { eArgCount }
 

Functions

CT_CONFIG_API cfg_group_tconfig_root (const cfg_info_t *info, arena_t *arena)
 create a new configuration group More...
 
CT_CONFIG_API cfg_group_tconfig_group (cfg_group_t *group, const cfg_info_t *info)
 add a new configuration group to a configuration group More...
 
CT_CONFIG_API cfg_field_tconfig_int (cfg_group_t *group, const cfg_info_t *info, cfg_int_t cfg)
 add a new integer field to a configuration group More...
 
CT_CONFIG_API cfg_field_tconfig_bool (cfg_group_t *group, const cfg_info_t *info, bool initial)
 add a new yes/no field to a configuration group More...
 
CT_CONFIG_API cfg_field_tconfig_string (cfg_group_t *group, const cfg_info_t *info, const char *initial)
 add a new string field to a configuration group More...
 
CT_CONFIG_API cfg_field_tconfig_vector (cfg_group_t *group, const cfg_info_t *info, vector_t *initial)
 add a new vector field to a configuration group More...
 
CT_CONFIG_API cfg_field_tconfig_enum (cfg_group_t *group, const cfg_info_t *info, cfg_enum_t cfg)
 add a new choice field to a configuration group More...
 
CT_CONFIG_API cfg_field_tconfig_flags (cfg_group_t *group, const cfg_info_t *info, cfg_enum_t cfg)
 add a new flags field to a configuration group More...
 
CT_PUREFN CT_CONFIG_API cfg_type_t cfg_get_type (const cfg_field_t *field)
 get the type of a configuration field More...
 
CT_PUREFN CT_CONFIG_API const cfg_info_tcfg_get_info (const cfg_field_t *field)
 get the information about a configuration field More...
 
CT_PUREFN CT_CONFIG_API const cfg_info_tcfg_group_info (const cfg_group_t *config)
 get the information about a configuration group More...
 
CT_PUREFN CT_CONFIG_API const cfg_int_tcfg_int_info (const cfg_field_t *field)
 get the information about an integer field More...
 
CT_PUREFN CT_CONFIG_API bool cfg_bool_info (const cfg_field_t *field)
 get the information about a yes/no field More...
 
CT_PUREFN CT_CONFIG_API const char * cfg_string_info (const cfg_field_t *field)
 get the information about a string field More...
 
CT_PUREFN CT_CONFIG_API const vector_tcfg_vector_info (const cfg_field_t *field)
 get the information about a vector field More...
 
CT_PUREFN CT_CONFIG_API const cfg_enum_tcfg_enum_info (const cfg_field_t *field)
 get the information about a choice field More...
 
CT_PUREFN CT_CONFIG_API const cfg_enum_tcfg_flags_info (const cfg_field_t *field)
 get the information about a flags field More...
 
CT_CONSTFN CT_CONFIG_API const char * cfg_type_string (cfg_type_t type)
 get the name of a configuration type More...
 
CT_CONSTFN CT_CONFIG_API const char * cfg_arg_string (arg_style_t style)
 get the name of an argument style More...
 
CT_CONSTFN CT_CONFIG_API const char * cfg_arg_prefix (arg_style_t style)
 get the prefix for an argument style More...
 
CT_PUREFN CT_CONFIG_API typevec_tcfg_get_groups (const cfg_group_t *config)
 get all subgroups in a configuration group More...
 
CT_PUREFN CT_CONFIG_API vector_tcfg_get_fields (const cfg_group_t *config)
 get all fields in a configuration group More...
 
CT_PUREFN CT_CONFIG_API int cfg_int_value (const cfg_field_t *field)
 get the current integer value of a configuration field More...
 
CT_PUREFN CT_CONFIG_API bool cfg_bool_value (const cfg_field_t *field)
 get the current boolean value of a configuration field More...
 
CT_PUREFN CT_CONFIG_API const char * cfg_string_value (const cfg_field_t *field)
 get the current string value of a configuration field More...
 
CT_PUREFN CT_CONFIG_API vector_tcfg_vector_value (const cfg_field_t *field)
 get the current vector value of a configuration field More...
 
CT_PUREFN CT_CONFIG_API size_t cfg_enum_value (const cfg_field_t *field)
 get the current enum value of a configuration field More...
 
CT_PUREFN CT_CONFIG_API size_t cfg_flags_value (const cfg_field_t *field)
 get the current flags value of a configuration field More...
 
CT_NODISCARD CT_CONFIG_API bool cfg_set_int (cfg_field_t *field, int value)
 set the current value of an int field More...
 
CT_CONFIG_API void cfg_set_bool (cfg_field_t *field, bool value)
 set the current value of a bool field More...
 
CT_CONFIG_API void cfg_set_string (cfg_field_t *field, char *value)
 set the current value of a string field More...
 
CT_CONFIG_API void cfg_vector_push (cfg_field_t *field, char *value)
 push a new value onto an array field More...
 
CT_CONFIG_API bool cfg_set_enum (cfg_field_t *field, const char *choice)
 set the current value of an enum field set the value via a string name More...
 
CT_CONFIG_API void cfg_set_enum_value (cfg_field_t *field, size_t value)
 set the current value of an enum field set the value via an integer value More...
 
CT_NODISCARD CT_CONFIG_API bool cfg_set_flag (cfg_field_t *field, const char *choice, bool set)
 set the current value of a flags field set the value via a string name More...
 
CT_CONFIG_API void cfg_set_flag_value (cfg_field_t *field, size_t value)
 set the current value of a flags field set the value via an integer value More...
 

Macro Definition Documentation

◆ CFG_ARG

#define CFG_ARG (   id,
  name,
  prefix 
)    id,

Definition at line 39 of file config.h.

◆ CFG_TYPE

#define CFG_TYPE (   id,
  name 
)    id,

Definition at line 28 of file config.h.