37 .author =
"Elliot Haisley",
38 .desc =
"Meta code generation tool",
54 .brief =
"meta code generation tool",
61 .brief =
"output header file",
62 .args =
CT_ARGS(kHeaderOutputArgs),
69 .brief =
"output source file",
70 .args =
CT_ARGS(kSourceOutputArgs),
85 .header_output = header,
86 .source_output = source,
103 .zero_indexed_lines =
false,
109 int main(
int argc,
const char **argv)
139 if (parse.
root == NULL)
141 print_errors(err, init, logger, arena);
148 print_errors(err, init, logger, arena);
156 for (
size_t i = 0; i < nodes; i++)
163 for (
size_t j = 0; j < fields; j++)
167 io_printf(con,
"field: %.*s\n", (
int)field_name.
length, field_name.text);
tool_t make_tool(version_info_t version, arena_t *arena)
CT_NODISCARD STA_RET_STRING CT_OS_API char * os_error_string(os_error_t error, arena_t *arena)
convert an os error code to a string
int main(int argc, const char **argv)
CT_CONFIG_API cfg_field_t * config_string(cfg_group_t *group, const cfg_info_t *info, const char *initial)
add a new string field to a configuration group
#define CT_ARG_LONG(name)
CT_CONFIG_API cfg_group_t * config_root(const cfg_info_t *info, arena_t *arena)
create a new configuration group
#define CT_NEW_VERSION(major, minor, patch)
creates a new ctu_version_t from major, minor and patch
#define CT_EXIT_ERROR
the user has made an error
CT_MEMORY_API arena_t * get_global_arena(void)
get the global memory arena
CT_NODISCARD CT_IO_API io_t * io_file(const char *path, os_access_t mode, arena_t *arena)
create an IO object from a file
CT_NODISCARD CT_IO_API os_error_t io_error(const io_t *io)
get the last error from the io object
CT_IO_API io_t * io_stderr(void)
get the global stderr IO object
CT_IO_API io_t * io_stdout(void)
get the global stdout IO object
CT_IO_API size_t io_printf(io_t *io, STA_FORMAT_STRING const char *fmt,...)
printf to an io object
CT_JSON_API json_parse_t json_parse(io_t *io, logger_t *logger, arena_t *arena)
parse an io into a json value parse the contents of an io object into a json value
CT_NODISCARD CT_NOTIFY_API logger_t * logger_new(arena_t *arena)
create a new logger
CT_NODISCARD CT_NOTIFY_API typevec_t * logger_get_events(const logger_t *logs)
get the events from the logger
CT_SETUP_API setup_init_t setup_parse(int argc, const char **argv, setup_options_t setup)
parse the command line
CT_SETUP_API int setup_exit_help(setup_options_t setup, const setup_init_t *init)
print the help message and exit
CT_PUREFN CT_SETUP_API bool setup_should_exit(const setup_init_t *init)
accessor functions
CT_SETUP_API void setup_default(arena_t *arena)
initialise the runtime with default options
CT_SETUP_API setup_options_t setup_options(version_info_t info, cfg_group_t *root)
setup default options
CT_PUREFN CT_SETUP_API int setup_exit_code(const setup_init_t *init)
get the exit code
CT_NODISCARD CT_PUREFN CT_STD_API size_t typevec_len(const typevec_t *vec)
get the length of a vector
CT_NODISCARD CT_PUREFN CT_STD_API void * typevec_offset(const typevec_t *vec, size_t index)
get a pointer to the value at the given index
CT_NODISCARD CT_PUREFN CT_STD_API void * vector_get(const vector_t *vector, size_t index)
get a value from a vector
CT_NODISCARD CT_PUREFN CT_STD_API size_t vector_len(const vector_t *vector)
get the length of a vector
information about a configuration field
STA_FIELD_STRING const char * name
the name of this field
arena_t * arena
temporary arena
notification formatting options
print_options_t options
base print options
the result of parsing the command line
const colour_pallete_t * pallete
the chosen colour pallete
vector_t * posargs
the parsed position arguments
heading_style_t heading
the chosen heading style
default options shared by all tools
a non-owning view of text
size_t length
the number of characters in the text
version information for a driver/interface/plugin
const char * license
the license of this component