amos 73a5240295 Batches 21 and 18: add 74 calibrated tasks (40 Bos redo, 34 HWE code-gen)
Batch 21 (20261027-A-bos-redo-21) rebuilt 40 of the 53 rejected Bos-qiao
environments: hidden assertions that ran inside the candidate's process
now run in a trusted parent that reads observations from a low-UID
worker; gold bytes are unchanged. 9 were excluded for scope (ROS2,
oversize, security core), 3 are blocked because the source requires an
exec bit the platform does not freeze, 1 lacks requests/bs4 in trace6.

Batch 18 (20261026-C-hwe-codegen-18) adds its last 34 of 134 tasks; the
first 100 landed in 2f32624d.

Claude reviewed 74/74 USABLE against current digests, canonical
families, no ID or source overlap with main, plain public docs. Only the
new task directories are taken; the stale pre-batch-20 copies of
concur-release-capsule and resource-temp-link on the batch 21 branch and
both branches' progress notes stay as main has them. Difficulty is
unmeasured.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 10:23:12 +08:00

90 lines
3.5 KiB
C++

#include "flash.hpp"
#include <array>
#include <iomanip>
#include <iostream>
#include <locale>
#include <sstream>
#include <string>
namespace {
std::string hex(const std::string& input) {
const char* digits = "0123456789abcdef";
std::string output;
for (unsigned char byte : input) {
output += digits[byte >> 4];
output += digits[byte & 15];
}
return output;
}
std::string decode(const std::string& input) {
if (input == "-") return {};
std::string output;
for (std::size_t i = 0; i + 1 < input.size(); i += 2) {
output += static_cast<char>(std::stoul(input.substr(i, 2), nullptr, 16));
}
return output;
}
void record(const flash::Result& result) {
std::cout << static_cast<int>(result.code) << ' ' << result.error.size() << ':' << hex(result.error);
std::cout << ' ' << result.fields.size();
for (auto field : result.fields) std::cout << ' ' << field;
const std::string data(result.data.begin(), result.data.end());
std::cout << ' ' << data.size() << ':' << hex(data) << '\n';
}
struct Grouping : std::numpunct<char> {
char do_thousands_sep() const override { return '~'; }
std::string do_grouping() const override { return "\1"; }
};
}
int main() {
std::array<flash::FlashBank, 2> banks;
std::string line;
while (std::getline(std::cin, line)) {
std::istringstream parser(line);
char mode;
int which;
parser >> mode >> which;
auto& bank = banks[static_cast<std::size_t>(which)];
if (mode == 'C') {
int flags;
std::string encoded;
parser >> flags >> encoded;
std::istringstream input(decode(encoded));
std::ostringstream output;
if (flags) {
output.imbue(std::locale(std::locale::classic(), new Grouping));
output << std::hex << std::showbase << std::showpos << std::setfill('!') << std::setw(19);
}
const auto result = flash::run_cli(input, output, bank);
const std::string text = output.str();
std::cout << "C " << result.physical << ' ' << result.processed << ' ' << result.syntax << ' ' << result.limited;
std::cout << ' ' << text.size() << ':' << hex(text) << '\n';
} else {
std::string verb;
parser >> verb;
std::vector<flash::Number> args;
flash::Number value;
while (parser >> value) args.push_back(value);
flash::Result result;
if (verb == "RESET") result = bank.reset();
if (verb == "ATTACH") result = bank.attach(args[0], args[1]);
if (verb == "DETACH") result = bank.detach(args[0]);
if (verb == "WREN") result = bank.wren(args[0]);
if (verb == "WRDI") result = bank.wrdi(args[0]);
if (verb == "PROGRAM") result = bank.program(args[0], args[1], args[2], args[3]);
if (verb == "ERASE") result = bank.erase(args[0], args[1]);
if (verb == "ADVANCE") result = bank.advance(args[0], args[1]);
if (verb == "READ") result = bank.read(args[0], args[1], args[2]);
if (verb == "WORD") result = bank.word(args[0], args[1], args[2]);
if (verb == "STATUS") result = bank.status(args[0]);
if (verb == "INSPECT") result = bank.inspect();
std::cout << "A ";
record(result);
}
std::cout << "I0 ";
record(banks[0].inspect());
std::cout << "I1 ";
record(banks[1].inspect());
}
return 0;
}