2023-11-22 21:55:55 +00:00
|
|
|
#ifndef _SPEC_CONFIG_H
|
|
|
|
#define _SPEC_CONFIG_H
|
2023-11-22 21:39:27 +00:00
|
|
|
|
|
|
|
struct Config {
|
|
|
|
// The root directory housing our specs. This string is nonempty.
|
2023-11-22 21:55:55 +00:00
|
|
|
const char *root_dir;
|
2023-11-22 21:39:27 +00:00
|
|
|
// The name of the spec we want to load. This string is nonempty.
|
|
|
|
const char *target;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ConfigError {
|
2023-11-22 21:55:55 +00:00
|
|
|
// Indicates the `$SPEC_ROOT_DIR` environment variable is empty.
|
|
|
|
ENV_SPEC_ROOT_DIR_MISSING = 1,
|
|
|
|
// Indicates the `$SPEC_ROOT_DIR` environment variable is not set.
|
|
|
|
ENV_SPEC_ROOT_DIR_EMPTY,
|
2023-11-22 21:39:27 +00:00
|
|
|
// Indicates the target argument is invalid.
|
|
|
|
INVALID_TARGET,
|
|
|
|
};
|
|
|
|
|
2023-11-23 11:09:32 +00:00
|
|
|
enum ConfigError load_config(
|
|
|
|
const char *root_dir,
|
|
|
|
const char *target,
|
|
|
|
struct Config *config
|
|
|
|
);
|
2023-11-22 21:39:27 +00:00
|
|
|
|
|
|
|
void free_config(struct Config *config);
|
|
|
|
|
2023-11-22 21:55:55 +00:00
|
|
|
#endif /* _SPEC_CONFIG_H */
|