bootstrap/include/config.h

35 lines
857 B
C
Raw Normal View History

#ifndef _SPEC_CONFIG_H
#define _SPEC_CONFIG_H
struct Config {
2023-11-23 15:07:22 +00:00
// The directory the `spec` command was run from.
// OWNERSHIP: Does not own this pointer.
const char *cwd;
// The root directory housing our specs.
// OWNERSHIP: Does not own this pointer.
const char *root_dir;
2023-11-23 15:07:22 +00:00
// The name of the spec we want to load.
// OWNERSHIP: Does not own this pointer.
const char *target;
};
enum ConfigError {
2023-11-23 15:07:22 +00:00
// Indicates the $CWD could not be retrieved.
CE_ENV_CWD_INVALID = 1,
// Indicates the `$SPEC_ROOT_DIR` environment variable is empty.
2023-11-23 15:07:22 +00:00
CE_ENV_SPEC_ROOT_DIR_INVALID,
// Indicates the target argument is invalid.
2023-11-23 15:07:22 +00:00
CE_TARGET_INVALID,
};
2023-11-23 14:40:17 +00:00
enum ConfigError config_load(
2023-11-23 15:07:22 +00:00
const char *cwd,
2023-11-23 11:09:32 +00:00
const char *root_dir,
const char *target,
2023-11-23 14:40:17 +00:00
struct Config **config
2023-11-23 11:09:32 +00:00
);
2023-11-23 14:40:17 +00:00
void config_free(struct Config *config);
#endif /* _SPEC_CONFIG_H */