All 161 task packages, including the 21 batch 6 C++17 tasks that passed
gates 1/2, are now in Git. rollout.catalog builds docs/task-catalog.{json,md}
from the task packages, a fresh trace5 calibration (128/128 PASS), every
verified controller receipt on the current task digest, documented holds
and digest-bound difficulty reviews. 123 tasks are usable (6 HARD),
5 are on hold and 33 still need a subprocess-only grader.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
125 lines
2.7 KiB
C++
125 lines
2.7 KiB
C++
#ifndef EMBEDDED_MODULE_PLAN_H
|
|
#define EMBEDDED_MODULE_PLAN_H
|
|
|
|
#include <cstddef>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace bootplan {
|
|
|
|
struct File {
|
|
std::string basename;
|
|
std::string text;
|
|
};
|
|
using Directory = std::vector<File>;
|
|
|
|
struct Request {
|
|
std::string module;
|
|
bool via_alias = false;
|
|
};
|
|
|
|
struct Load {
|
|
std::string module;
|
|
std::vector<std::string> options;
|
|
};
|
|
|
|
struct Dependency {
|
|
std::string module;
|
|
std::vector<std::string> pre;
|
|
std::vector<std::string> post;
|
|
};
|
|
|
|
struct OptionGroup {
|
|
std::string module;
|
|
std::vector<std::string> tokens;
|
|
};
|
|
|
|
struct Configuration {
|
|
std::vector<std::string> available;
|
|
std::vector<std::string> selected_files;
|
|
std::vector<std::string> blacklist;
|
|
std::vector<OptionGroup> options;
|
|
std::vector<Dependency> dependencies;
|
|
};
|
|
|
|
enum class Error {
|
|
none = 0,
|
|
invalid = 1,
|
|
cycle = 2,
|
|
busy = 3,
|
|
idle = 4
|
|
};
|
|
|
|
enum class Kind {
|
|
idle = 0,
|
|
open = 1,
|
|
emit = 2,
|
|
close = 3,
|
|
missing = 4,
|
|
reused = 5,
|
|
skipped = 6,
|
|
cycle = 7
|
|
};
|
|
|
|
struct Event {
|
|
Error error = Error::none;
|
|
Kind kind = Kind::idle;
|
|
std::string module;
|
|
};
|
|
|
|
struct Snapshot {
|
|
bool busy = false;
|
|
std::vector<Load> committed;
|
|
std::vector<Load> staged;
|
|
std::vector<std::string> skipped;
|
|
std::vector<std::string> missing;
|
|
std::vector<std::string> pending_missing;
|
|
std::size_t accepted = 0;
|
|
std::size_t suppressed = 0;
|
|
std::size_t failed = 0;
|
|
std::size_t cancelled = 0;
|
|
};
|
|
|
|
struct BatchResult {
|
|
Error error = Error::none;
|
|
std::vector<Load> load;
|
|
std::vector<std::string> skipped;
|
|
std::vector<std::string> missing;
|
|
std::vector<std::string> selected_files;
|
|
};
|
|
|
|
bool canonical_module(const std::string &raw, std::string &output);
|
|
Error statements(const std::string &text,
|
|
std::vector<std::vector<std::string>> &output);
|
|
Error compile_configuration(const std::vector<Directory> &directories,
|
|
const std::vector<std::string> &available,
|
|
Configuration &output);
|
|
|
|
struct PlannerState;
|
|
class Planner {
|
|
public:
|
|
explicit Planner(const Configuration &configuration);
|
|
~Planner();
|
|
Planner(Planner &&) noexcept;
|
|
Planner &operator=(Planner &&) noexcept;
|
|
Planner(const Planner &) = delete;
|
|
Planner &operator=(const Planner &) = delete;
|
|
|
|
Error begin(const Request &request);
|
|
Event tick();
|
|
void cancel();
|
|
void reset();
|
|
Snapshot snapshot() const;
|
|
|
|
private:
|
|
std::unique_ptr<PlannerState> state_;
|
|
};
|
|
|
|
BatchResult plan(const std::vector<Directory> &directories,
|
|
const std::vector<std::string> &available,
|
|
const std::vector<Request> &requests);
|
|
|
|
}
|
|
#endif
|