amos 2f32624d3b Batch 18 (20261026-C-hwe-codegen-18): add 100 calibrated HWE code-gen tasks; pause production for rollout
100 tasks from the HWE arm-linux code-gen pool (outside the lk/man/pth
range given to batch 22), each with at least one independent
contract-edge defect and plain public docs. Claude reviewed 100/100
USABLE against current digests; no ID or source overlap with main or
batch 22. Difficulty is unmeasured.

progress.md records the wrap-up: all Codex sessions and Qwen schedulers
stopped for the user's rollout, Qwen results so far (57 HARD of 373),
and what is left on each batch branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 17:52:13 +08:00

107 lines
4.0 KiB
C++

#include "dispatch.hpp"
#include <array>
#include <charconv>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using edf::Dispatcher;
namespace {
bool integer(const std::string& token, std::int64_t& value) {
if (token.empty()) return false;
const char* begin = token.data();
const char* end = begin + token.size();
auto result = std::from_chars(begin, end, value, 10);
return result.ec == std::errc{} && result.ptr == end;
}
void print_stats(const edf::Stats& s) {
std::cout << "S " << s.capacity << ' ' << s.now << ' ' << s.defined << ' ' << s.active
<< ' ' << s.submitted << ' ' << s.completed << ' ' << s.cancelled
<< ' ' << s.missed << ' ' << s.executed << '\n';
}
void print_views(const std::vector<edf::View>& views) {
std::cout << "V " << views.size() << '\n';
for (const auto& v : views) {
std::cout << "J " << v.id << ' ' << v.relative << ' ' << v.budget << ' ' << v.active
<< ' ' << v.release << ' ' << v.deadline << ' ' << v.remaining
<< ' ' << v.serial << ' ' << v.tag << '\n';
}
}
void print_run(const edf::RunResult& result) {
std::cout << "R " << result.code << ' ' << result.events.size() << '\n';
for (const auto& e : result.events) {
std::cout << "F " << e.id << ' ' << e.tag << ' ' << e.kind << ' ' << e.start
<< ' ' << e.end << ' ' << e.deadline << ' ' << e.serial
<< ' ' << e.used << ' ' << e.remaining << '\n';
}
}
}
int main() {
std::array<Dispatcher, 2> objects;
std::string line;
while (std::getline(std::cin, line)) {
std::istringstream input(line);
std::string command_token;
std::string slot_token;
std::int64_t slot = -1;
if (!(input >> command_token >> slot_token) || command_token.size() != 1 ||
!integer(slot_token, slot) || slot < 0 || slot > 1) {
return 2;
}
char command = command_token[0];
auto& object = objects[static_cast<std::size_t>(slot)];
if (command == 'b') {
std::string plan;
std::getline(input, plan);
if (!plan.empty()) {
if (plan.front() != ' ') return 2;
plan.erase(plan.begin());
}
auto result = edf::apply_plan(object, plan);
std::cout << "B " << result.code << ' ' << result.index << '\n';
continue;
}
std::vector<std::int64_t> a;
std::string token;
while (input >> token) {
std::int64_t value = 0;
if (!integer(token, value)) return 2;
a.push_back(value);
}
int code = edf::Invalid;
if (command == 'n' && a.size() == 2) {
code = object.reset(a[0], a[1]);
} else if (command == 'd' && a.size() == 3) {
code = object.define(a[0], a[1], a[2]);
} else if (command == 'u' && a.size() == 3) {
code = object.update(a[0], a[1], a[2]);
} else if (command == 'e' && a.size() == 1) {
code = object.erase(a[0]);
} else if (command == 'p' && a.size() == 3) {
code = object.post(a[0], a[1], a[2]);
} else if (command == 'c' && a.size() == 1) {
code = object.cancel(a[0]);
} else if (command == 't' && a.size() == 2) {
code = object.retime(a[0], a[1]);
} else if (command == 'a' && a.size() == 1) {
code = object.advance(a[0]);
} else if (command == 'r' && a.size() == 1) {
print_run(object.run(a[0]));
continue;
} else if (command == 's' && a.empty()) {
print_stats(object.stats());
continue;
} else if (command == 'v' && a.empty()) {
print_views(object.inspect());
continue;
} else if (command == 'y' && a.size() == 1 && a[0] >= 0 && a[0] <= 1) {
object = objects[a[0]];
code = edf::Ok;
} else {
return 2;
}
std::cout << "R " << code << '\n';
}
return 0;
}