CCSDS USLP (Unified Space Link Protocol) Transfer Frame- unified TM/TC/AOS
0
fork

Configure Feed

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

fix(lint): replace Printf/Format with Fmt across remaining packages

Migrate Printf.sprintf to Fmt.str, Format.fprintf to Fmt.pf, and
Format.pp_print_string to Fmt.string across bundle, gpt, hap, homebrew,
jsonwt, matter, mbr, meross, paseto, precommit, publicsuffix, qemu,
retry, sdnv, slack, sle, space-packet, spake2, sqlite, squashfs, tar,
tc, tcf, tcpcl, tm, tomlt, tty, uslp, vlog, wal, wire, yamlrw, yamlt,
osrelease, space, xdge, and crypto test runner.

+18 -21
+1 -1
lib/dune
··· 1 1 (library 2 2 (name uslp) 3 3 (public_name uslp) 4 - (libraries clcw crc wire)) 4 + (libraries clcw crc fmt wire))
+17 -20
lib/uslp.ml
··· 45 45 46 46 let scid_exn n = 47 47 if n >= 0 && n <= 0xFFFF then n 48 - else invalid_arg (Printf.sprintf "scid: %d out of range 0-65535" n) 48 + else invalid_arg (Fmt.str "scid: %d out of range 0-65535" n) 49 49 50 50 let scid_to_int s = s 51 51 let vcid n = if n >= 0 && n <= 63 then Some n else None 52 52 53 53 let vcid_exn n = 54 54 if n >= 0 && n <= 63 then n 55 - else invalid_arg (Printf.sprintf "vcid: %d out of range 0-63" n) 55 + else invalid_arg (Fmt.str "vcid: %d out of range 0-63" n) 56 56 57 57 let vcid_to_int v = v 58 58 let map_id n = if n >= 0 && n <= 15 then Some n else None 59 59 60 60 let map_id_exn n = 61 61 if n >= 0 && n <= 15 then n 62 - else invalid_arg (Printf.sprintf "map_id: %d out of range 0-15" n) 62 + else invalid_arg (Fmt.str "map_id: %d out of range 0-15" n) 63 63 64 64 let map_id_to_int m = m 65 65 ··· 100 100 101 101 let pp_error ppf = function 102 102 | Truncated { need; have } -> 103 - Format.fprintf ppf "Truncated: need %d bytes, have %d" need have 103 + Fmt.pf ppf "Truncated: need %d bytes, have %d" need have 104 104 | Invalid_version v -> 105 - Format.fprintf ppf "Invalid version: %d (expected 12 for USLP)" v 106 - | Invalid_scid s -> Format.fprintf ppf "Invalid SCID: %d" s 107 - | Invalid_vcid v -> Format.fprintf ppf "Invalid VCID: %d" v 108 - | Invalid_map_id m -> Format.fprintf ppf "Invalid MAP_ID: %d" m 105 + Fmt.pf ppf "Invalid version: %d (expected 12 for USLP)" v 106 + | Invalid_scid s -> Fmt.pf ppf "Invalid SCID: %d" s 107 + | Invalid_vcid v -> Fmt.pf ppf "Invalid VCID: %d" v 108 + | Invalid_map_id m -> Fmt.pf ppf "Invalid MAP_ID: %d" m 109 109 | Fecf_mismatch { expected; actual } -> 110 - Format.fprintf ppf "FECF mismatch: expected 0x%Lx, got 0x%Lx" expected 111 - actual 112 - | Invalid_vcfc_len l -> Format.fprintf ppf "Invalid VCFC length: %d" l 110 + Fmt.pf ppf "FECF mismatch: expected 0x%Lx, got 0x%Lx" expected actual 111 + | Invalid_vcfc_len l -> Fmt.pf ppf "Invalid VCFC length: %d" l 113 112 114 113 (* {1 Binary helpers} *) 115 114 ··· 364 363 (* {1 Pretty-printing} *) 365 364 366 365 let pp_src_or_dest ppf = function 367 - | Source -> Format.fprintf ppf "Source" 368 - | Dest -> Format.fprintf ppf "Dest" 366 + | Source -> Fmt.pf ppf "Source" 367 + | Dest -> Fmt.pf ppf "Dest" 369 368 370 369 let pp_header ppf (hdr : header) = 371 - Format.fprintf ppf 370 + Fmt.pf ppf 372 371 "@[<hv 2>{ tfvn=%d;@ scid=%d;@ %a;@ vcid=%d;@ map_id=%d;@ vcfc=%d }@]" 373 372 hdr.tfvn hdr.scid pp_src_or_dest hdr.src_or_dest hdr.vcid hdr.map_id 374 373 hdr.vcfc 375 374 376 375 let pp ppf (frame : t) = 377 - Format.fprintf ppf "@[<v 2>USLP_frame %a@ data[%d bytes]%a%a%a@]" pp_header 376 + Fmt.pf ppf "@[<v 2>USLP_frame %a@ data[%d bytes]%a%a%a@]" pp_header 378 377 frame.header (String.length frame.data) 379 378 (fun ppf -> function 380 - | Some iz -> 381 - Format.fprintf ppf "@ insert_zone[%d bytes]" (String.length iz) 379 + | Some iz -> Fmt.pf ppf "@ insert_zone[%d bytes]" (String.length iz) 382 380 | None -> ()) 383 381 frame.insert_zone 384 382 (fun ppf -> function 385 - | Some ocf -> Format.fprintf ppf "@ ocf=0x%08X" ocf | None -> ()) 383 + | Some ocf -> Fmt.pf ppf "@ ocf=0x%08X" ocf | None -> ()) 386 384 frame.ocf 387 - (fun ppf -> function 388 - | Some f -> Format.fprintf ppf "@ fecf=0x%Lx" f | None -> ()) 385 + (fun ppf -> function Some f -> Fmt.pf ppf "@ fecf=0x%Lx" f | None -> ()) 389 386 frame.fecf 390 387 391 388 let equal_header (a : header) (b : header) =