1 \ @(#) dump_struct.fth 97/12/10 1.1
\r
2 \ Dump contents of structure showing values and member names.
\r
5 \ Copyright 1987 Phil Burk
\r
6 \ All Rights Reserved.
\r
8 \ MOD: PLB 9/4/88 Print size too.
\r
9 \ MOD: PLB 9/9/88 Print U/S , add ADST
\r
10 \ MOD: PLB 12/6/90 Modified to work with H4th
\r
11 \ 941109 PLB Converted to pforth. Added RP detection.
\r
12 \ 090609 PLB Convert >rel to use->rel and ..! to s!
\r
14 include? task-member.fth member.fth
\r
15 include? task-c_struct c_struct.fth
\r
17 ANEW TASK-DUMP_STRUCT
\r
19 : EMIT-TO-COLUMN ( char col -- )
\r
20 out @ - 0 max 80 min 0
\r
26 : STACK.NFAS ( fencenfa topnfa -- 0 nfa0 nfa1 ... )
\r
27 \ Fill stack with nfas of words until fence hit.
\r
29 0 r> ( set terminator )
\r
30 BEGIN ( -- 0 n0 n1 ... top )
\r
33 \ dup n>link @ \ JForth
\r
34 dup prevname \ HForth
\r
39 : DST.DUMP.TYPE ( +-size -- , dump data type, 941109)
\r
54 : DUMP.MEMBER ( addr member-pfa -- , dump member of structure)
\r
55 ob.stats ( -- addr offset size )
\r
56 >r + r> ( -- addr' size )
\r
57 dup ABS 4 > ( -- addr' size flag )
\r
58 IF cr 2dup swap . . ABS dump
\r
59 ELSE tuck @bytes 10 .r ( -- size )
\r
60 3 spaces dst.dump.type
\r
65 : DUMP.STRUCT ( addr-data addr-structure -- )
\r
66 >newline swap >r ( -- as , save addr-data for dumping )
\r
67 \ dup cell+ @ over + \ JForth
\r
68 dup code> >name swap cell+ @ over + \ HForth
\r
69 stack.nfas ( fill stack with nfas of members )
\r
72 WHILE ( continue until non-zero )
\r
73 dup name> >body r@ swap dump.member
\r
74 bl 18 emit-to-column id. cr
\r
79 : DST ( addr <name> -- , dump contents of structure )
\r
82 IF [compile] literal compile dump.struct
\r
87 : ADST ( absolute_address -- , dump structure )
\r
88 use->rel [compile] dst \ mod 090609
\r
91 \ For Testing Purposes
\r
109 $ 12345678 afoo s! along1
\r
110 $ -665 afoo s! ashort1
\r
112 $ 43 afoo s! abyte2
\r
113 -234 afoo .. agoo s! goo_height
\r