Structure Settings
Structure Definitions support various #pragma directives to control the properties of structure definitions. Like C/C++ pragma usage, the directives can be placed in different locations to control properties of elements defined after it.
Structure Setting #pragma directives must be defined within a structure definition.
Pointer Size
Suggested location
The structure viewer treats pointers to structures or data types as an absolute location to that data. For example, adding "UWord* myValue" to a structure definition is interpreted as "the next data (value) within the document represents an absolute value to a UWord".
By default, pointers are assumed to be 32bit. The ptrsize pragma directive can be used to change the default pointer size to 8 bit, 16bit, 32 bit, or 64 bit.
#pragma ptrsize(1) // Set pointer
size to 8 bit
#pragma ptrsize(2) // Set pointer size to 16 bit
#pragma ptrsize(4) // Set pointer size to 32 bit
#pragma ptrsize(8) // Set pointer size to 64 bit
NOTE: #pragma ptrsize is allow outside structure definitions. See Library Settings for other definitions allowed outside a structure definition.
The lockAt and floatAt pragma commands are used to suggest an initial locked or floating offset. If specified, the add structure dialog will pre-populate the offset and float/locked options when adding a structure.
#pragma lockAt(offset)
#pragma floatAt(offset)
Where offset can be a decimal (e.g. 32) or hexadecimal value (e.g. 0x20).
struct LocalFileHeader
{
#pragma lockAt(0x00000010)
char Signature[4]; // PK<0x03><0x04>
WORD VersionNeededToExtract;
WORD GeneralPurposeBitFlag;
WORD CompressionMethod;
DOSTIME LastModFileTime;
DOSDATE LastModFileDate;
DWORD Crc32;
DWORD CompressedSize;
DWORD UncompressedSize;
WORD FileNameLength;
WORD ExtraFieldLength;
};
Definition Overview, Data Types, Enumerated Types, Arrays, Strings, Bitfields, Expressions, Conditionals, Functions, Verification, Library Settings, Structure Settings, and Reserved Words and Symbols.