amos 9d633e9e67 Batch 15 (20261023-C-hwe-scale-15): 320 HWE-derived repair tasks
One user-space repair task per eligible HWE debug-diag / compile-deploy base
ID: 320 admitted (C 218, C++ 97, build scripts 5), 1 skipped by the content
filter. Each ships a public spec with a check-to-basis table, at least two
defects with single-fix fixtures, a symptom-masking fixture and an alternative
correct implementation. Claude re-checked all 320: structure, the HWE quality
items and trace6 Docker calibration receipts against current digests
(320/320 USABLE). Difficulty is unmeasured. Known follow-up: 212 tasks use 120
ad-hoc family names; the next batch maps them to the canonical list.
The batch's 1,256-line progress log stays in its factory report and the
36-local branch batch15-hwe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 01:55:56 +08:00

89 lines
2.4 KiB
C++

#include "request.hpp"
#include <cerrno>
#include <cstdint>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
namespace {
struct Event {
char kind;
std::int64_t first;
std::int64_t second;
};
class ScriptedPort final : public remaining::WaitPort {
public:
void push(Event event) { events_.push_back(event); }
int wait(const remaining::Time &requested, remaining::Time &left, int &error) override
{
Event event{'F', EAGAIN, 0};
if (cursor_ < events_.size()) {
event = events_[cursor_++];
}
int result = -1;
if (event.kind == 'S') {
result = 0;
error = 0;
} else if (event.kind == 'I') {
error = EINTR;
left = remaining::to_time(static_cast<std::uint64_t>(event.first));
} else if (event.kind == 'X') {
error = EINTR;
left = {event.first, event.second};
} else {
error = static_cast<int>(event.first);
left = {-7, -7};
}
std::cout << "W " << requested.sec << ' ' << requested.nsec << ' '
<< result << ' ' << error << '\n';
return result;
}
private:
std::vector<Event> events_;
std::size_t cursor_ = 0;
};
bool event_line(const std::string &line, Event &event)
{
std::istringstream input(line);
std::string prefix;
std::string extra;
if (!(input >> prefix) || prefix != "E" || !(input >> event.kind)) return false;
if (event.kind == 'S') return !(input >> extra);
if (event.kind == 'I' || event.kind == 'F') {
return bool(input >> event.first) && !(input >> extra);
}
if (event.kind == 'X') {
return bool(input >> event.first >> event.second) && !(input >> extra);
}
return false;
}
} // namespace
int main()
{
ScriptedPort port;
remaining::Manager manager(port);
remaining::Console console(manager);
std::string line;
while (std::getline(std::cin, line)) {
if (line.size() >= 2 && line[0] == 'E' && line[1] == ' ') {
Event event{};
if (!event_line(line, event)) return 2;
port.push(event);
continue;
}
std::string output;
if (!console.execute(line, output)) return 2;
if (!output.empty()) std::cout << "O " << output << '\n';
}
return std::cin.bad() ? 2 : 0;
}