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

108 lines
4.2 KiB
C++

#include "stream.hpp"
#include <array>
#include <iostream>
#include <sstream>
#include <string>
using captured::Bytes;
namespace {
Bytes unhex(const std::string& word) {
if (word == "-") { return {}; }
Bytes result;
for (std::size_t i = 0; i < word.size(); i += 2) {
result.push_back(static_cast<std::uint8_t>(std::stoul(word.substr(i, 2), nullptr, 16)));
}
return result;
}
std::string hex(const Bytes& data) {
if (data.empty()) { return "-"; }
const char* digits = "0123456789abcdef";
std::string result;
for (std::uint8_t byte : data) {
result.push_back(digits[byte >> 4]);
result.push_back(digits[byte & 15]);
}
return result;
}
}
int main() {
std::array<captured::Device, 2> devices;
unsigned selected = 0;
std::string line;
while (std::getline(std::cin, line)) {
std::istringstream input(line);
std::string operation;
input >> operation;
auto& device = devices[selected];
std::uint64_t a = 0, b = 0;
std::int64_t mode = 0;
std::string word;
std::cout << operation;
if (operation == "U") {
input >> selected;
std::cout << ' ' << selected;
} else if (operation == "Z") {
input >> a;
std::cout << ' ' << device.reset(a);
} else if (operation == "M") {
input >> mode;
std::cout << ' ' << device.set_mode(mode);
} else if (operation == "G") {
std::cout << ' ' << device.get_mode();
} else if (operation == "C") {
std::cout << ' ' << device.capacity();
} else if (operation == "B") {
input >> a >> b;
std::cout << ' ' << device.begin(a, b);
} else if (operation == "A") {
input >> a >> b >> word;
const Bytes data = unhex(word);
const auto result = device.append(a, data, b);
std::cout << ' ' << result.status << ' ' << result.count << ' ' << hex(result.data) << ' ' << hex(data);
} else if (operation == "F") {
input >> a;
std::cout << ' ' << device.finish(a);
} else if (operation == "X") {
input >> a;
std::cout << ' ' << device.cancel(a);
} else if (operation == "R" || operation == "P") {
input >> a;
const auto result = operation == "R" ? device.read(a) : device.peek(a);
std::cout << ' ' << result.status << ' ' << result.count << ' ' << hex(result.data);
} else if (operation == "S") {
const auto stats = device.stats();
std::cout << ' ' << stats.accepted << ' ' << stats.consumed << ' ' << stats.completed
<< ' ' << stats.canceled << ' ' << stats.buffered << ' ' << stats.active;
} else if (operation == "I") {
input >> a;
const auto snapshot = device.inspect(a);
std::cout << ' ' << snapshot.status << ' ' << snapshot.id << ' ' << snapshot.total
<< ' ' << snapshot.accepted << ' ' << snapshot.remaining << ' ' << snapshot.captured_mode;
} else if (operation == "L") {
const auto ids = device.active_ids();
std::cout << ' ' << ids.size();
for (auto id : ids) { std::cout << ' ' << id; }
} else if (operation == "T") {
input >> mode >> word;
const Bytes data = unhex(word);
const auto result = captured::transform(data, mode);
std::cout << ' ' << hex(result) << ' ' << hex(data);
} else if (operation == "H") {
input >> word;
const Bytes data = unhex(word);
const auto result = captured::parse_mode(data);
std::cout << ' ' << result << ' ' << hex(data);
} else if (operation == "N") {
input >> mode;
const auto result = captured::mode_name(mode);
std::cout << ' ' << result;
} else if (operation == "W") {
input >> word;
const Bytes request = unhex(word);
const auto result = device.packet(request);
std::cout << ' ' << result.status << ' ' << hex(result.payload) << ' ' << hex(request);
}
std::cout << '\n';
}
return 0;
}