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.8 KiB
C

#include "message.h"
#include <string.h>
void mm_stream_init(mm_stream *stream, mm_memory memory, mm_output output)
{
memset(stream, 0, sizeof(*stream));
stream->memory = memory;
stream->output = output;
}
static void attempt_started(mm_stats *stats)
{
stats->attempts += 1;
}
static void render_failed(mm_stats *stats)
{
stats->render_errors += 1;
}
static void render_finished(mm_stats *stats)
{
stats->rendered += 1;
}
static void output_failed(mm_stats *stats)
{
stats->output_errors += 1;
}
static void output_finished(mm_stats *stats, size_t length)
{
stats->sent += 1;
stats->sent_bytes += length;
}
int mm_emit(mm_stream *stream, const unsigned char *format, size_t length,
const mm_arg *args, size_t count)
{
unsigned char *message;
size_t message_length;
int status;
int submitted;
attempt_started(&stream->stats);
status = mm_render(format, length, args, count, stream->memory,
&message, &message_length);
if (status != MM_OK) {
render_failed(&stream->stats);
return status;
}
render_finished(&stream->stats);
submitted = stream->output.submit(stream->output.context, message, message_length);
stream->memory.release(stream->memory.context, message);
if (submitted != 0) {
output_failed(&stream->stats);
return MM_OUTPUT;
}
output_finished(&stream->stats, message_length);
return MM_OK;
}
void mm_stream_snapshot(const mm_stream *stream, mm_stats *stats)
{
stats->attempts = stream->stats.attempts;
stats->rendered = stream->stats.rendered;
stats->sent = stream->stats.sent;
stats->render_errors = stream->stats.render_errors;
stats->output_errors = stream->stats.output_errors;
stats->sent_bytes = stream->stats.sent_bytes;
}