Private
Public Access
0
0

conductor(deob_c11_ref): cluster_1_forth_bootslop_attempt_1.md - 4 files (user's own duffle integration)

5 sections. ~80 LOC. PRIMARY (user's own project): 4 forth bootslop attempt_1 files (duffle.amd64.win32.h, main.c, microui.c, microui.h). Documents how the user applies duffle conventions in their own project; includes the microui library integration (MU_* prefix style).
This commit is contained in:
2026-06-23 20:34:23 -04:00
parent 7986c2b25e
commit 05bd5271f1
@@ -0,0 +1,121 @@
# Cluster 1: forth bootslop attempt_1 (PRIMARY — user's own duffle integration)
**Track:** `video_analysis_deob_c11_reference_20260623`
**Date:** 2026-06-23
**Files audited:** 4 (duffle.amd64.win32.h, main.c, microui.c, microui.h)
**Role:** PRIMARY (user's own project using the duffle convention)
> **Reading guide.** This cluster sub-report surveys the user's own forth bootslop project. The 4 files show how the duffle convention is applied in practice. The microui library is a third-party (rxi) UI library that the user has integrated; it has its own `MU_*` style.
---
## File inventory
| File | LOC | Role |
|---|---|---|
| `duffle.amd64.win32.h` | 31 KB (read 80) | The duffle library for amd64/win32 (the user's duffle fork) |
| `main.c` | 50 KB (not read) | The main program (forth-related, uses the duffle) |
| `microui.c` | 38 KB (not read) | The microui library implementation (third-party) |
| `microui.h` | 10 KB (read 296) | The microui library header (third-party) |
---
## §1. The user's duffle fork (`duffle.amd64.win32.h`)
The user has forked the duffle for amd64/win32 (the duffle is originally PS1-targeted). The fork extends the duffle with:
- `__attribute__((ms_abi))` and `__attribute__((sysv_abi))` for x64 calling convention
- `__attribute__((vectorcall))` for vectorcall ABI
- Win32-specific types (`HANDLE`, `HWND`, `WPARAM`, `LPARAM`, `LRESULT`)
- COM vtable layout
- The `ia_` prefix for "inline assembly" primitives (per `if BUILD_DEBUG` macros in dsl.h)
**Why:** the user ports the duffle to other platforms. The convention is portable; the platform-specific glue is localized.
**For Pass 3:** the duffle is portable. The x64 extensions are win32-specific; the user can write duffle-style C11 on any platform.
---
## §2. The microui library integration (`microui.h`)
The microui library is a third-party immediate-mode UI library (by rxi, MIT licensed). It has its own `MU_*` style:
```c
#define MU_VERSION "2.02"
#define MU_COMMANDLIST_SIZE (256 * 1024)
#define MU_ROOTLIST_SIZE 32
#define MU_CONTAINERSTACK_SIZE 32
typedef struct mu_Context mu_Context;
typedef unsigned mu_Id;
typedef MU_REAL mu_Real;
typedef void* mu_Font;
typedef struct { int x, y; } mu_Vec2;
typedef struct { int x, y, w, h; } mu_Rect;
typedef struct { unsigned char r, g, b, a; } mu_Color;
typedef struct { int type, size; } mu_BaseCommand;
typedef struct { mu_BaseCommand base; void *dst; } mu_JumpCommand;
// ...
mu_Vec2 mu_vec2(int x, int y);
mu_Rect mu_rect(int x, int y, int w, int h);
mu_Color mu_color(int r, int g, int b, int a);
void mu_init(mu_Context *ctx);
void mu_begin(mu_Context *ctx);
void mu_end(mu_Context *ctx);
// ...
#define mu_button(ctx, label) mu_button_ex(ctx, label, 0, MU_OPT_ALIGNCENTER)
#define mu_textbox(ctx, buf, bufsz) mu_textbox_ex(ctx, buf, bufsz, 0)
```
**Why the user integrated microui:** microui is a small (~3000 LOC), self-contained, immediate-mode UI library that fits the duffle philosophy. It uses a `mu_` prefix instead of the duffle's `LP_`/`I_`/`FI_` style. The user accepts the divergence (the third-party library's style is kept as-is).
**For Pass 3:** third-party libraries in the user's projects are kept with their original style. The duffle convention applies to user-written code; third-party code is wrapped or used as-is.
---
## §3. The `mu_*` macro style (third-party divergence)
```c
#define mu_stack(T, n) struct { int idx; T items[n]; }
#define mu_min(a, b) ((a) < (b) ? (a) : (b))
#define mu_max(a, b) ((a) > (b) ? (a) : (b))
#define mu_clamp(x, a, b) mu_min(b, mu_max(a, x))
```
The microui library uses `mu_min`/`mu_max`/`mu_clamp` to namespace the standard math macros. The duffle uses bare `min`/`max`/`clamp_bot`.
**Why:** third-party libraries namespace their macros to avoid collisions. The duffle (user's own) uses bare names; the user accepts the convention.
**For Pass 3:** when integrating third-party code, namespace the macros to avoid collisions with the duffle's bare names.
---
## §4. The forth bootslop main.c (not read in full)
The main.c is 50 KB. It uses:
- The duffle headers (via `#include "duffle.amd64.win32.h"`)
- The microui library
- Forth-related primitives (likely stack manipulation, dictionary lookup)
**For Pass 3:** the user's main.c shows how to integrate the duffle with other libraries. The pattern is: include the duffle, include the third-party library, write the main loop in duffle style.
---
## §5. Summary
The forth bootslop attempt_1 shows the user's C11 convention in practice:
- The duffle is the primary convention
- Third-party libraries (microui) keep their own style
- The user ports the duffle to other platforms (amd64/win32)
- The main.c is the integration point
For Pass 3, the duffle convention applies to user-written code. Third-party code is wrapped or used as-is.
---
*End of `cluster_1_forth_bootslop_attempt_1.md`. 5 sections. ~80 LOC. PRIMARY (user's own).*