Files
BFM-decomp/include/common.h
T
Drew T c8c9fd20c1 feat(phase-16): S5 driver+supervisor+safe-exit + NULL fix + sig_unify pipeline
- common.h: +NULL (byte-neutral; recovers 54/106 m2c CC1-fails that were just NULL-undeclared)
- tools/auto_driver.py: never-stop worklist loop (m2c -> sig_unify -> byte-gate -> propagate ->
  commit), STOP-sentinel safe-exit at every fn boundary, heartbeat.json
- tools/auto_supervisor.sh (pure-bash babysitter, relaunch-on-crash, reap permuters, MCP-off),
  auto_stop.sh (touch .run/auto/STOP), auto_status.sh (remote check-in)
- p16_known_answer.py: +--gate (whole-binary capability test)
- YIELD REALITY (honest, P9): macro+sig_unify whole-binary = 4/16 (25%) on KNOWN-matchable,
  ~1% on the unmatched hard tail. The permuter is the untested differentiator -> overnight test.
- CURRENT_PHASE: full night's findings + Drew's never-stop/safe-exit/graduated-ladder refinements
2026-06-18 23:15:31 -06:00

45 lines
1.8 KiB
C

/* common.h — shared prelude for every matched C translation unit under src/.
*
* Created Phase 6 (the asm->c flip): splat emits `#include "common.h"` at the top
* of each generated src/ file, but does NOT generate the header itself — it is a
* hand-maintained, COMMITTED file (unlike the gitignored include/ .inc macros).
*
* For the all-INCLUDE_ASM scaffold only `include_asm.h` is required; the fixed-width
* typedefs below are the psyq/sotn convention, here ready for the first matched C.
* Grow this (PSY-Q types, hardware-register decls, shared structs) as functions match.
*/
#ifndef COMMON_H
#define COMMON_H
#include "include_asm.h"
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
typedef signed char s8;
typedef short s16;
typedef int s32;
typedef float f32;
/* wider scalars (Phase 16: m2c's M2C_UNK64 needs s64). Byte-neutral — no existing match uses them. */
typedef unsigned long long u64;
typedef long long s64;
typedef double f64;
/* m2c --valid-syntax compat (Phase 16, cookbook §15) — the BYTE-FAITHFUL macros only.
* M2C_FIELD(p,t,o) == *(t)((s8*)p+o): identical codegen to `p->field`, so m2c struct-heavy
* output compiles AND byte-matches without a struct definition. The NON-faithful m2c macros
* (M2C_ERROR/MULT_HI/CLZ/GTE/...) are deliberately left UNDEFINED: a draft using one fails to
* compile = an early "not m2c-matchable, defer" signal (it could never byte-match anyway). */
typedef s32 M2C_UNK;
typedef s8 M2C_UNK8;
typedef s16 M2C_UNK16;
typedef s32 M2C_UNK32;
typedef s64 M2C_UNK64;
#define M2C_FIELD(expr, type_ptr, offset) (*(type_ptr)((s8 *)(expr) + (offset)))
#define M2C_BITWISE(type, expr) ((type)(expr))
#ifndef NULL
#define NULL ((void *)0) /* m2c emits NULL for null pointers; byte-neutral (== 0) */
#endif
#endif /* COMMON_H */