Function Reference


_DebugReportData

Writes to debugging session the content of a data

#include <Debug.au3>
_DebugReportData ( Const ByRef $vVar [, $sTitle = ""DebugReportData"." [, $sArrayRange = "" [, $iFlags = 0 [, $vUser_Separator = Default [, $sHeader = Default [, $iDesired_Colwidth = Default [, $hUser_Function = ""]]]]]]] )

Parameters

$vVar an Variable to be reported.
$sTitle [optional] Title for Report. Default = "DebugReportData".
$sArrayRange [optional] Range of rows/columns to display. Default ("") = entire array. (See below for details)
$iFlags [optional] Determine UDF options. Add required values together
    $ARRAYDISPLAY_COLALIGNLEFT (0) = (default) Column text alignment - left
    $ARRAYDISPLAY_TRANSPOSE (1) = Transposes the array (2D only)
    $ARRAYDISPLAY_COLALIGNRIGHT (2) = Column text alignment - right
    $ARRAYDISPLAY_NOROW (64) = No 'Row' column displayed
$vUser_Separator [optional] Sets column display option when copying data to clipboard.
    Character = Delimiter between columns.
    Number = Fixed column width - longer items will be truncated.
    Default = Current separator character (usually "|").
$sHeader [optional] Column names in header (string of names separated by current separator character - usually "|"). Default see Remarks.

Return Value

None, @error and @extended of the caller are preserved.

Remarks

If no _DebugSetup() have been issued the function always returns.

If the function is passed a non-array variable works as _DebugReportVar().
If a string is passed with $sTitle = Default, it wiil be reported as is.
This is usefull to replace SciTE ConsoleWrite() debug line to be reported.

If an array is passed, the reported output will be formatted by column, better report than _DebugReportVar().
All optional parameters starting $sArrayRange are used as _DebugArrayDisplay().
$ARRAYDISPLAY_COLALIGNCENTER is not implemented.

The $sArrayRange parameter syntax is as follows:

"7" Show rows 0-7 with all columns
"7:" Show rows 7-end with all columns
"|7" Show all rows with columns 0-7
"|7:" Show all rows with columns 7-end
"7|7" Show rows 0-7 with columns 0-7
"5:7" Show rows 5-7 with all columns
"|5:7" Show all rows with columns 5-7
"7|5:7" Show rows 0-7 with columns 5-7
"5:7|7" Show rows 5-7 with columns 0-7
"5:7|5:7" Show rows 5-7 with columns 5-7

Any column values are ignored for 1D arrays.

$sHeader names (separated by the current separator character) will be used for as many columns as there are names. If no, or not enough, custom names are specified then the default header of "Row|Col0" for 1D arrays or "Row|Col0|Col1|...|Col n" for 2D is substituted. If the array is displayed transposed, the header is ignored.
The variable $ARRAYDISPLAY_ROWPREFIX can be set to change the prefix of the row numbering (default: #).

An array element containing another array or a Map is displayed as {Array} or {Map}.

When using $ARRAYDISPLAY_TRANSPOSE or $sArrayRange, a copy of the $aArray is created, so additional memory is used.

Related

_DebugReportVar, _DebugArrayDisplay

Example

#include <Debug.au3>

_DebugSetup("_DebugReportData examples", True)

Local $aArray2D[5][5]
For $r = 0 To UBound($aArray2D, 1) - 1
    For $c = 0 To UBound($aArray2D, 2) - 1
        $aArray2D[$r][$c] = $r & "," & $c
    Next
Next

_DebugReportData($aArray2D, "Array2D")
_DebugReportData($aArray2D, "Array2D NO ROW no header", "", $ARRAYDISPLAY_NOROW)
_DebugReportData($aArray2D, "Array2D no header Transposed", "", $ARRAYDISPLAY_TRANSPOSE)

_DebugReportData($aArray2D, "Array2D header col0", "", 0, Default, "zero")
_DebugReportData($aArray2D, "Array2D header col0 Transposed", "", $ARRAYDISPLAY_TRANSPOSE, Default, "zero")
_DebugReportData($aArray2D, "Array2D header col0 col1", "", 0, Default, "zero|one")
_DebugReportData($aArray2D, "Array2D header col0 col1 (|1)", "|1", 0, Default, "zero|one")

_DebugReportData($aArray2D, "Array2D header col0 col1 (|1:2)", "|1:2", 0, Default, "zero|one")
_DebugReportData($aArray2D, "Array2D header col0 col1 (|1:2)", "|1:2 Transposed", $ARRAYDISPLAY_TRANSPOSE, Default, "zero|one")
_DebugReportData($aArray2D, "Array2D NO ROW header col0 col1 (|1:2)", "|1:2", $ARRAYDISPLAY_NOROW, Default, "zero|one")
_DebugReportData($aArray2D, "Array2D NO ROW header col0 col1 (|1:2) Transposed", "|1:2", $ARRAYDISPLAY_NOROW + $ARRAYDISPLAY_TRANSPOSE, Default, "zero|one")
_DebugReportData($aArray2D, "Array2D header col0 col1 (2:3|1:2)", "2:3|1:2", 0, Default, "zero|one")

_DebugReportData($aArray2D, "Array2D header col0 col1 (2:3|1:2) Transposed", "2:3|1:2", $ARRAYDISPLAY_TRANSPOSE, Default, "zero|one")
_DebugReportData($aArray2D, "Array2D NO ROW header col0 col1 (2:3|1:2)", "2:3|1:2", $ARRAYDISPLAY_NOROW, Default, "zero|one")

Local $aArray[7] = [1, 1.1, "string", Binary(0x010203), Ptr(-1), False, Default]
_DebugReportData($aArray, "Array")

Local $aArray3D[5][2][3]
For $r = 0 To UBound($aArray3D, 1) - 1
    For $c = 0 To UBound($aArray3D, 2) - 1
        For $k = 0 To UBound($aArray3D, 3) - 1
            $aArray3D[$r][$c][$k] = $r & "," & $c & "," & $k
        Next
    Next
Next

_DebugReportData($aArray3D, "$Array3D")

Local $aArray4D[5][2][2][10]
_DebugReportData($aArray4D, "$Array4D")

Local $iInt = -1
_DebugReportData($iInt, "$iInt")

Local $iInt64 = 2 ^ 63
_DebugReportData($iInt64, "$iInt64")

Local $bBool = True
_DebugReportData($bBool, "$bBool")

Local $fFloat = 1.1
_DebugReportData($fFloat, "$fFloat")

Local $vKeyword = Default
_DebugReportData($vKeyword, "$vKeyword")

Local $sString = "stringstring"
_DebugReportData($sString, "$sString")

Local $dBinary = Binary("0x0102030405060708")
_DebugReportData($dBinary, "$dbinary")

$dBinary = Binary("abcdefghij")
_DebugReportData($dBinary, "$dbinary")

Local $pPtr = Ptr(0)
_DebugReportData($pPtr, "$pPtr")

Local $hWnd = WinActive("", "")
_DebugReportData($hWnd, "$hWnd")

Local $tDllstruct = DllStructCreate("int; ptr")
_DebugReportData($tDllstruct, "$tDllstruct")

Local $oObj = ObjCreate("shell.application")
_DebugReportData($oObj, "$oObj")

_DebugReport( @CRLF & "=== ConsoleWrite() can be replaced by _DebugReportData() when using Debug lines ===" & @CRLF)
; _DebugReportData() can be used in Debug Line instead of ConsoleWrite(), _DebugSetup() must be added before
Local $iRet = 1
;~ ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iRet = ' & $iRet & @CRLF & '>Error code: ' & @error & '    Extended code: ' & @extended & ' (0x' & Hex(@extended) & ')' & @CRLF) ;### Debug Console
_DebugReportData('@@ Debug(' & @ScriptLineNumber & ') : $iRet = ' & $iRet & @CRLF & '>Error code: ' & @error & '    Extended code: ' & @extended & ' (0x' & Hex(@extended) & ')' & @CRLF) ;### Debug Console

; for Array 1D or 2D, it is better to use directly _DebugReportData() which will produce an output formattend by column(s)
ReDim $aArray2D[5][2]
For $r = 0 To UBound($aArray2D, 1) - 1
    For $c = 0 To UBound($aArray2D, 2) - 1
        $aArray2D[$r][$c] = $r & "," & $c
    Next
Next

_DebugReportData($aArray2D, "$Array2D display by columns")
_DebugReportVar("$Array2D by _DebugReportVar()", $aArray2D)