amos 8b7616bfd8 Batch 22 (20261027-C-hwe-hard-22): add 63 calibrated HWE hard-design tasks
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>
2026-10-27 16:14:57 +08:00

56 lines
1.5 KiB
C

#ifndef FORK_MODEL_H
#define FORK_MODEL_H
#include <stddef.h>
#define FM_PROCESS_CAP 8
#define FM_STREAM_CAP 3
#define FM_DESCRIPTION_CAP 3
#define FM_BUFFER_CAP 64
#define FM_FILE_CAP 512
enum fm_result {
FM_OK = 0,
FM_RANGE = 1,
FM_STATE = 2,
FM_BUSY = 3,
FM_CLOSED = 4,
FM_FULL = 5,
FM_NOSPACE = 6
};
enum fm_exit_mode {
FM_NORMAL = 0,
FM_QUICK = 1
};
struct fm_stream {
int description;
size_t length;
unsigned char pending[FM_BUFFER_CAP];
};
struct fm_process {
int used;
int alive;
unsigned int code;
struct fm_stream streams[FM_STREAM_CAP];
};
struct fm_description {
size_t offset;
size_t length;
unsigned int references;
unsigned int commits;
unsigned char bytes[FM_FILE_CAP];
};
struct fm_model {
size_t capacity;
struct fm_process processes[FM_PROCESS_CAP];
struct fm_description descriptions[FM_DESCRIPTION_CAP];
};
int fm_init(struct fm_model *model, size_t capacity);
int fm_open(struct fm_model *model, int process, int stream, int description);
int fm_write(struct fm_model *model, int process, int stream,
const unsigned char *bytes, size_t length);
int fm_flush(struct fm_model *model, int process, int stream);
int fm_close(struct fm_model *model, int process, int stream);
int fm_seek(struct fm_model *model, int process, int stream, size_t offset);
int fm_fork(struct fm_model *model, int parent, int child);
int fm_exit(struct fm_model *model, int process, int mode, unsigned int code);
#endif