home *** CD-ROM | disk | FTP | other *** search
- /* ShowStructure.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.
- *
- * Show all fields of the specified structure type at the specified or
- * current address.
- *
- * Syntax: ShowStructure structure [address]
- *
- * Binding: bindrx struct ShowStructure
- *
- */
-
- options results
- if ( arg() > 0 ) then
- DO
- argline = arg(1)
- parse var argline structure" "address
- structure = strip(structure)
- address = strip(address)
- if ( structure = "" ) then
- DO
- 'Print Bad syntax'
- exit
- END
- if ( address = "" ) then
- DO
- CurrentAddr
- address = result
- END
- call StructureOffset.rexx structure 'sizeof('
- if ( datatype(left(result,4),'X') ) then
- DO
- structdata = getclip('StructureMembers')
- done = 0
- firstline = 1
- firstpos = 1
- DO until ( done ~= 0 )
- nextpos = pos('0a'x, structdata, firstpos )
- if ( nextpos = 0 ) then
- DO
- done = 1
- END
- else
- DO
- structline = substr(structdata,firstpos,nextpos-firstpos)
- offset = substr(structline,4,4)
- size = strip(substr(structline,16,4))
- member = substr(structline,22)
-
- if ( firstline = 1 ) then
- DO
- Print structure '(at' address', size' offset')'
- firstline = 0
- END
- else
- DO
- 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 ' +'offset' = 'memberaddress member '=' contents
-
- END
- firstpos = nextpos + 1
- END
- END
- END
- else
- DO
- Print result
- END
- END
- else
- DO
- 'Print Bad syntax'
- END
-