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

71 lines
1.7 KiB
C

#include "descriptor.h"
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
static int number(const char **cursor, uint64_t *value) {
char *end;
unsigned long long parsed;
const char *text = *cursor;
while (isspace((unsigned char)*text)) {
++text;
}
if (!isdigit((unsigned char)*text)) {
return 0;
}
errno = 0;
parsed = strtoull(text, &end, 10);
if (end == text || errno == ERANGE || (*end && !isspace((unsigned char)*end))) {
return 0;
}
*value = (uint64_t)parsed;
*cursor = end;
return 1;
}
static unsigned arguments_for(char operation) {
switch (operation) {
case 'B':
return 2;
case 'A':
return 3;
case 'C':
return 1;
default:
return 0;
}
}
int command_read(const char *line, struct command *command) {
const char *cursor = line;
uint64_t slot;
unsigned count;
unsigned index;
if (line == NULL || command == NULL) {
return 0;
}
memset(command, 0, sizeof(*command));
while (isspace((unsigned char)*cursor)) {
++cursor;
}
command->operation = *cursor++;
if (command->operation == '\0' || strchr("BASCXDQ", command->operation) == NULL) {
return 0;
}
if (!isspace((unsigned char)*cursor)) {
return 0;
}
if (!number(&cursor, &slot) || slot >= DEVICE_SLOTS) {
return 0;
}
command->slot = (unsigned)slot;
count = arguments_for(command->operation);
for (index = 0; index < count; ++index) {
if (!number(&cursor, &command->arguments[index])) {
return 0;
}
}
while (isspace((unsigned char)*cursor)) {
++cursor;
}
return *cursor == '\0';
}