From the 101 lk/man/pth code-gen sources: 63 tasks (C11 36, C++17 27, 11 canonical families), 38 skipped for scope or duplication. Each task has at least one independent contract-edge defect, boundary types rotate, and public docs state trap clauses as plain contract prose. Claude reviewed 63/63 USABLE against current digests. Difficulty is unmeasured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
841 B
C
30 lines
841 B
C
#include "model_internal.h"
|
|
|
|
int fm_exit(struct fm_model *model, int process, int mode, unsigned int code)
|
|
{
|
|
struct fm_model transaction;
|
|
int stream;
|
|
int result;
|
|
int flush;
|
|
if (process < 0 || process >= FM_PROCESS_CAP ||
|
|
(mode != FM_NORMAL && mode != FM_QUICK) || code > 255) {
|
|
return FM_RANGE;
|
|
}
|
|
result = fm_process_check(model, process);
|
|
if (result != FM_OK) {
|
|
return result;
|
|
}
|
|
transaction = *model;
|
|
flush = mode == FM_NORMAL;
|
|
for (stream = 0; stream < FM_STREAM_CAP; ++stream) {
|
|
result = fm_finish_stream(&transaction, process, stream, flush);
|
|
if (result != FM_OK) {
|
|
return result;
|
|
}
|
|
}
|
|
transaction.processes[process].alive = 0;
|
|
transaction.processes[process].code = code;
|
|
*model = transaction;
|
|
return FM_OK;
|
|
}
|