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

74 lines
1.7 KiB
C

#include "decimal.h"
static void clear_pending(df_stream *stream)
{
stream->length = 0;
stream->discarding = 0;
}
void df_stream_init(df_stream *stream)
{
clear_pending(stream);
stream->bytes = 0;
stream->frames = 0;
}
static void consume_content(df_stream *stream, unsigned char byte)
{
if (stream->discarding) {
return;
}
if (stream->length == DF_FRAME_MAX) {
stream->discarding = 1;
return;
}
stream->pending[stream->length] = byte;
stream->length += 1;
}
static void consume_frame(df_stream *stream, df_state *state)
{
if (stream->discarding) {
df_reject(state, DF_OVERFLOW);
} else {
df_apply(state, stream->pending, stream->length);
}
stream->frames += 1;
clear_pending(stream);
}
size_t df_feed(df_stream *stream,
df_state *state,
const unsigned char *data,
size_t length)
{
size_t completed = 0;
size_t i;
for (i = 0; i < length; ++i) {
unsigned char byte = data[i];
stream->bytes += 1;
if (byte == '\n') {
consume_frame(stream, state);
completed += 1;
} else {
consume_content(stream, byte);
}
}
return completed;
}
int df_finish(df_stream *stream, df_state *state)
{
int status;
if (stream->length == 0 && !stream->discarding) {
return 0;
}
status = stream->discarding ? DF_OVERFLOW : DF_SYNTAX;
df_reject(state, status);
stream->frames += 1;
clear_pending(stream);
return 1;
}
size_t df_pending(const df_stream *stream)
{
return stream->length;
}
int df_discarding(const df_stream *stream)
{
return stream->discarding ? 1 : 0;
}