Please enable JavaScript to view this site.

A-Shell Reference

Added April 2013

.OFFSET(struct.member)

Similar to .SIZEOF(var) except that it returns the offset to the specified member variable within the specified structure, starting from 1, rather than the size of the variable, and it only works on fields within structures. Also, in the case of arrays, .OFFSET only returns the offset to the base of the array, and doesn't actually allow the use of subscripts. The specified structure name can either be a defined structure name, or a MAP'd or DIMX'd instance of it. For example:

DEFSTRUCT ST_1

    MAP2 FLD1,S,10

    MAP2 FLD2,S,13

    MAP3 FLD3(4),F

ENDSTRUCT

MAP1 VAR,ST_1

DIMX VX(10),ST_1

 

For example:

? "Offset of FLD1 in ST_1: "; .OFFSET(ST_1.FLD1)   ! 1

? "Offset of FLD2 in VAR : "; .OFFSET(VAR.FLD2)    ! 11

? "Offset of FLD3 in VX(): "; .OFFSET(VX().FLD3()) ! 24

Note the empty parentheses () in the third example.

History

2013 April, A-Shell 6.1.1350:  Function added to A-Shell