Overview

Structure libraries may contain parsing functions for file formats or functions to be used to provide general data manipulation helpers (e.g. recalculating a checksum).  Functions include a list of expressions delimited by semicolons and can include arithmetic and bitwise operations, conditionals, loops, functional calls, etc.

Please see the Expressions Reference Overview for information on expression definitions and features.

Functions may be executed from Structure Viewer by pressing the hammer icon located on the structure viewer window and then selecting the desired function.

Form:

function <function name>

{

    <expression1>;

    <expression2>;

    ...

};

 

Example:

function AutoParseZipSelection

{

    UQWord pos = __getCaretPos() ;

    UQWord end = pos + __getCaretSel() ;

    while (pos < end)

    {

        switch (__getUDWordAt(pos))

        {

        case SIGNATURE.LocalFileHeader:

            pos += __addStructureAt(pos, "LocalFileHeader", "") ;

            break ;

        case SIGNATURE.ArchiveExtraData:

            pos += __addStructureAt(pos, "ArchiveExtraData", "") ;

            break ;

        case SIGNATURE.EndOfCentralDirectory:

            pos += __addStructureAt(pos, "EndOfCentralDirectory", "") ;

            break ;

        case SIGNATURE.DigitalSignature:

            pos += __addStructureAt(pos, "DigitalSignature", "") ;

            break ;

        case SIGNATURE.CentralDirectoryFileHeader:

            pos += __addStructureAt(pos, "CentralDirectoryFileHeader", "") ;

            break ;

        case SIGNATURE.ZIP64EndOfCentralDirectory:

            pos += __addStructureAt(pos, "ZIP64EndOfCentralDirectory", "") ;

            break ;

        case SIGNATURE.ZIP64EndOfCentralDirectoryLocator:

            pos += __addStructureAt(pos, "ZIP64EndOfCentralDirectoryLocator", "") ;

            break ;

        default:

            pos += 4 ;

            break ;

        } ;

    } ;

}

More Information on Structure Definitions

Definition Overview, Data Types, Enumerated Types, Arrays, Strings, Bitfields, Expressions, Conditionals, Functions, Verification, Library Settings, Structure Settings, and Reserved Words and Symbols.