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

30 lines
1.1 KiB
C

#include "stream.h"
int export_job(const struct job *j,const struct ports *p,struct report *r)
{
struct plan plan;FILE *stack[3];int roles[3];int top=0;int next=0;int state=0;
if(build_plan(j,&plan,r)!=0) return -1;
int required=j->flags?3:2;
while(state!=4) {
if(state==0) {
FILE *f=p->open(p->context,next,j->serial);
if(!f) {r->error=10;r->role=next;state=3;}
else {stack[top]=f;roles[top++]=next;if(++next==required){state=1;next=0;}}
} else if(state==1) {
if(next==plan.count){state=2;next=0;continue;}
struct line *line=&plan.lines[next++];
if(p->write(p->context,stack[line->role],line->text.bytes,line->text.length)) {r->error=20;r->role=line->role;state=3;}
else r->delivered[line->role]+=line->text.length;
} else if(state==2) {
if(next==required){state=3;continue;}
int role=next++;
if(p->flush(p->context,stack[role])){r->error=30;r->role=role;state=3;}
} else {
if(top==0){state=4;continue;}
--top;
int result=p->close(p->context,stack[top]);
if(result && r->error==0){r->error=40;r->role=roles[top];}
}
}
return r->error?-1:0;
}