Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter FiveGeneral Functions (continued)

HexBufferToBlock Function

Overview

The HexBufferToBlock function creates a formatted hexadecimal string based on input data and various options.

Syntax/Parameters

Syntax

string = HexBufferToBlock ( parameter data, [int size], [int base], [dword flags] );

Parameters

data

A variable, literal, calculated value or a Data Object handle. If a variable is supplied, it can be an array or a complex object. If it is an object or array, it must be structured as contiguous memory.

size

An optional int containing the size of data to dump as hex. If omitted or zero, this parameter defaults to the size of data. For Data Objects, the default size is the last data position, not the allocated size.

base

An optional int containing the base address to display. This allows for offsets in the display data. It does not affect the actual data being displayed, only the legend.

flags

An optional dword of bitwise flags to control output. See Remarks below. The default is 0x00000000 which is HD_INDEX_16_BITS and HD_WIDTH_16 displaying a 16-bit leading address and 16 bytes on a line.

Return Value

Returns a string containing the formatted data or an empty string on failure. Use the GetLastError function to retrieve error information.

Remarks

  Code Bitwise Value   Comment
             
  Legend/Index:      
    HD_INDEX_MASK   0x00000003   Index Format Mask
    HD_INDEX_16_BITS   0x00000000   16-Bit Index (0000 : )
    HD_INDEX_8_BITS   0x00000001   8-Bit Index (00 : )
    HD_INDEX_32_BITS   0x00000002   32-Bit Index (00000000 : )
    HD_INDEX_NONE    0x00000003   No Index
  Data Break/Spacing:        
    HD_4_BREAK   0x00000010   Add extra space every 4 bytes displayed
    HD_8_BREAK   0x00000020   Add extra space every 8 bytes displayed
  Output Flags:        
    HD_ADD_LF   0x00000100   Add in line feed so line endings are 0x0D 0x0A
    HD_ADD_TEXT   0x00000200   Add text version of bytes at the end of each line
  Data Output Width:        
    HD_WIDTH_MASK   0x000F0000   Format Width Mask
    HD_WIDTH_4   0x00010000   Format as 4 byte quads
    HD_WIDTH_8   0x00020000   Format as 8 bytes
    HD_WIDTH_16   0x00000000   Format as 16 bytes
  Combinations:      
    HD_8_TEXT   0x00020201   Small buffer output (1-255 bytes) with text
    HD_16_TEXT   0x00000202   Medium buffer output (32-bit index) with text

 

The HexBufferToBlock function will produce an output string that supports multiple lines. The string is limited to 1 MB.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic