home *** CD-ROM | disk | FTP | other *** search
- /* ShowMember.wack
- *
- * (c) Copyright 1992-1993 Commodore-Amiga, Inc. All rights reserved.
- *
- * This software is provided as-is and is subject to change; no warranties
- * are made. All use is at your own risk. No liability or responsibility
- * is assumed.
- *
- * This script considers the current or specified address to be a
- * structure of the type you specify, and displays up to a long word
- * of the specified member. That is, if the specified member is a
- * byte, word, long-word, or pointer, then its value is shown. If
- * the member is an embedded structure, then the first long word
- * of the structure's contents is shown.
- *
- * Sets SpareAddress to point at the address of the member.
- *
- * Syntax: ShowMember structure member [address]
- *
- * Binding: bindrx showmember ShowMember
- *
- */
-
- options results
- if ( arg() > 0 ) then
- DO
- argline = arg(1)
- parse var argline structure" "member" "address
- structure = strip(structure)
- member = strip(member)
- address = strip(address)
- if ( ( structure = "" ) | ( member = "" ) ) then
- DO
- 'Print Bad syntax'
- exit
- END
- if ( address = "" ) then
- DO
- CurrentAddr
- address = result
- END
- call StructureOffset.rexx structure member
- if ( datatype(left(result,4),'X') ) then
- DO
- offset = left(result,4)
- size = strip(substr(result,5,4))
- member = substr(result,9)
- memberaddress = d2x(x2d(address)+x2d(offset))
- if ( size = 1 ) then
- DO
- readbyte memberaddress
- END
- else if ( size = 2 ) then
- DO
- readword memberaddress
- END
- else
- DO
- readlong memberaddress
- END
- contents = result
- Print structure'.'member' (at 'address'+'offset' = 'memberaddress') =' contents
- SpareAddr memberaddress
- END
- else
- DO
- Print result
- END
- END
- else
- DO
- 'Print Bad syntax'
- END
-