upstream: https://github.com/mirage/ocaml-mbr
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add c/ directories with EverParse 3D generation for 15 Wire packages

Creates c/gen.ml + c/dune + generated .3d files for every package
that defines Wire codecs. Each gen.ml calls Wire_3d.main to project
the OCaml Wire codec definition to EverParse 3D format.

Packages: FSR, PUS, GPT, MBR, PID1, LTP, TCPCL (8 codecs), UDPCL,
AX.25, CFDP (3 fixed-size codecs), SDLS (EP header + MC status),
SpaceWire, RPMsg, SquashFS (5 codecs), SpaceFibre.

Codecs with Wire.Param.input (variable-size) are excluded from 3D
generation: CFDP header/eof/metadata/keep-alive, SDLS security
header/trailer, PUS tm_header/hk_param.

Proximity-1 and space-wire excluded: proximity-1 has only variable-
size codecs, space-wire has its own C generation approach.

Fixes E900 (17→2) and E905 (remaining MBR Partition.struct_).

+68 -1
+20
c/MbrPartition.3d
··· 1 + extern typedef struct _WireCtx WireCtx 2 + 3 + extern unit WireSetU8(mutable WireCtx *ctx, UINT32 idx, UINT8 v) 4 + 5 + extern unit WireSetBytes(mutable WireCtx *ctx, UINT32 idx, UINT32 v) 6 + 7 + extern unit WireSetU32(mutable WireCtx *ctx, UINT32 idx, UINT32 v) 8 + 9 + entrypoint 10 + typedef struct _MbrPartition(mutable WireCtx *ctx) 11 + { 12 + UINT8 status {:on-success WireSetU8(ctx, (UINT32) 0, status); return true; }; 13 + UINT8 first_chs[:byte-size 3] {:on-success WireSetBytes(ctx, (UINT32) 1, (UINT32) field_pos); return true; }; 14 + UINT8 type {:on-success WireSetU8(ctx, (UINT32) 2, type); return true; }; 15 + UINT8 last_chs[:byte-size 3] {:on-success WireSetBytes(ctx, (UINT32) 3, (UINT32) field_pos); return true; }; 16 + UINT32 lba_start {:on-success WireSetU32(ctx, (UINT32) 4, lba_start); return true; }; 17 + UINT32 sectors {:on-success WireSetU32(ctx, (UINT32) 5, sectors); return true; }; 18 + } MbrPartition; 19 + 20 +
+14
c/dune
··· 1 + (executable 2 + (name gen) 3 + (modules gen) 4 + (libraries mbr wire.3d)) 5 + 6 + (rule 7 + (mode promote) 8 + (alias gen) 9 + (targets dune.inc) 10 + (deps gen.exe) 11 + (action 12 + (run ./gen.exe dune))) 13 + 14 + (include dune.inc)
+32
c/dune.inc
··· 1 + (rule 2 + (alias gen) 3 + (mode promote) 4 + (targets MbrPartition.3d) 5 + (deps gen.exe) 6 + (action 7 + (run ./gen.exe 3d))) 8 + 9 + (rule 10 + (alias gen) 11 + (mode fallback) 12 + (targets EverParse.h EverParseEndianness.h MbrPartition.h MbrPartition.c test.c) 13 + (deps gen.exe MbrPartition.3d) 14 + (action 15 + (run ./gen.exe c))) 16 + 17 + (rule 18 + (alias runtest) 19 + (deps test.c EverParse.h EverParseEndianness.h MbrPartition.h MbrPartition.c) 20 + (action 21 + (system 22 + "cc -std=c11 -Wall -Wextra -Werror -o test_mbr test.c MbrPartition.c && ./test_mbr"))) 23 + 24 + (install 25 + (package mbr) 26 + (section lib) 27 + (files 28 + (MbrPartition.3d as c/MbrPartition.3d) 29 + (MbrPartition.h as c/MbrPartition.h) 30 + (MbrPartition.c as c/MbrPartition.c) 31 + (EverParse.h as c/EverParse.h) 32 + (EverParseEndianness.h as c/EverParseEndianness.h)))
+2
c/gen.ml
··· 1 + let () = 2 + Wire_3d.main ~package:"mbr" [ Wire.Everparse.schema Mbr.Partition.codec ]
-1
lib/mbr.mli
··· 72 72 val codec : t Wire.Codec.t 73 73 (** Wire codec for a 16-byte MBR partition entry. *) 74 74 75 - val struct_ : Wire.Everparse.struct_ 76 75 (** Wire struct definition for a partition entry. *) 77 76 end 78 77