From b5b1fe7fc0cf460d6204c18ba7bb4c40f7597efa Mon Sep 17 00:00:00 2001 From: Wiimm Date: Tue, 11 Jul 2023 16:18:26 +0200 Subject: SZS v2.35a --- project/dclib/dclib-debug.c | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) (limited to 'project/dclib/dclib-debug.c') diff --git a/project/dclib/dclib-debug.c b/project/dclib/dclib-debug.c index a5d978f..a3af57f 100644 --- a/project/dclib/dclib-debug.c +++ b/project/dclib/dclib-debug.c @@ -597,6 +597,21 @@ bool mark_used ( ccp name, ... ) /////////////// hexdump /////////////// /////////////////////////////////////////////////////////////////////////////// +uint HexDump ( FILE * f, int indent, u64 addr, int addr_fw, int row_len, + const void * p_data, size_t count ) +{ + // return the number of printed lines + if ( !f || !p_data || !count ) + return 0; + + XDump_t xd; + InitializeXDumpEx(&xd,f,indent,addr,addr_fw,row_len); + const int stat = XDump(&xd,p_data,count,true); + return stat < 0 ? 0 : stat; +} + +//----------------------------------------------------------------------------- + uint HexDump16 ( FILE * f, int indent, u64 addr, const void * data, size_t count ) { @@ -613,19 +628,32 @@ uint HexDump20 ( FILE * f, int indent, u64 addr, return HexDump(f,indent,addr,4,20,data,count); } -//----------------------------------------------------------------------------- +/////////////////////////////////////////////////////////////////////////////// -uint HexDump ( FILE * f, int indent, u64 addr, int addr_fw, int row_len, +uint HexDumpCRLF ( FILE * f, int indent, u64 addr, int addr_fw, int row_len, const void * p_data, size_t count ) +{ + const typeof(hexdump_eol)saved_eol = hexdump_eol; + hexdump_eol = "\r\n"; + const uint stat = HexDump(f,indent,addr,addr_fw,row_len,p_data,count); + hexdump_eol = saved_eol; + return stat; +} + +//----------------------------------------------------------------------------- + +uint HexDump16CRLF ( FILE * f, int indent, u64 addr, const void * data, size_t count ) { // return the number of printed lines - if ( !f || !p_data || !count ) - return 0; + return HexDumpCRLF(f,indent,addr,4,16,data,count); +} - XDump_t xd; - InitializeXDumpEx(&xd,f,indent,addr,addr_fw,row_len); - const int stat = XDump(&xd,p_data,count,true); - return stat < 0 ? 0 : stat; +//----------------------------------------------------------------------------- + +uint HexDump20CRLF ( FILE * f, int indent, u64 addr, const void * data, size_t count ) +{ + // return the number of printed lines + return HexDumpCRLF(f,indent,addr,4,20,data,count); } /////////////////////////////////////////////////////////////////////////////// -- cgit v1.3.1