Cthulhu  0.2.10
Cthulhu compiler collection
common.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-3.0-only
2 
3 #pragma once
4 
5 #include "config/config.h"
6 
7 #include "base/panic.h"
8 
9 typedef struct typevec_t typevec_t;
10 
11 typedef struct cfg_field_t
12 {
14  const cfg_info_t *info;
15 
16  union {
19  const char *string_config;
22  };
23 
24  union {
25  int int_value;
26  bool bool_value;
27  char *string_value;
28  size_t enum_value;
29  size_t flags_value;
31  };
32 } cfg_field_t;
33 
34 typedef struct cfg_group_t
35 {
37  const cfg_info_t *info;
38 
41 } cfg_group_t;
42 
43 #define ASSERT_FIELD_TYPE(field, type) CTASSERT(cfg_get_type(field) == (type))
typedefCT_BEGIN_API struct cfg_group_t cfg_group_t
Definition: config.h:15
cfg_type_t
the type of a configuration field
Definition: config.h:27
an allocator object
Definition: arena.h:86
a choice from a set of options
Definition: config.h:107
vector_t * vec_value
Definition: common.h:30
const char * string_config
Definition: common.h:19
vector_t * vec_config
Definition: common.h:20
char * string_value
Definition: common.h:27
bool bool_value
Definition: common.h:26
cfg_enum_t enum_config
Definition: common.h:21
const cfg_info_t * info
Definition: common.h:14
size_t flags_value
Definition: common.h:29
int int_value
Definition: common.h:25
cfg_int_t int_config
Definition: common.h:17
size_t enum_value
Definition: common.h:28
cfg_type_t type
Definition: common.h:13
bool bool_config
Definition: common.h:18
typevec_t * groups
Definition: common.h:39
const cfg_info_t * info
Definition: common.h:37
vector_t * fields
Definition: common.h:40
arena_t * arena
Definition: common.h:36
information about a configuration field
Definition: config.h:69
an integer field
Definition: config.h:82
A vector with a fixed type size.
Definition: vector.h:24
a generic vector of pointers
Definition: vector.c:16