11\ Obvious pun intended...
2- \ Updated Tue, 31 May 2005 at 12:07 by David L. Paktor
3-
2+ \ Updated Tue, 17 Oct 2006 at 12:57 PDT by David L. Paktor
43
54alias // \
65fcode-version2
@@ -12,21 +11,41 @@ headers
1211char G emit
1312control G emit
1413control [ emit
14+ global-definitions
15+ \ Each dev-node will create its own debug-flag and alias it to debug-me?
16+ \ Each dev-node will create a macro called my-dev-name giving its device-name
17+ [macro] .fname&dev [function-name] type ." in " my-dev-name type
18+ [macro] name-my-dev my-dev-name device-name
19+ [macro] .dbg-enter debug-me? @ if ." Entering " .fname&dev cr then
20+ [macro] .dbg-leave debug-me? @ if ." Leaving " .fname&dev cr then
21+ device-definitions
22+
23+ \ Top-most device, named billy
24+ [macro] my-dev-name " billy"
25+ name-my-dev
26+
27+ variable debug-bell? debug-bell? off alias debug-me? debug-bell?
1528: bell
29+ .dbg-enter
1630 [char] G dup
1731 control G 3drop
32+ .dbg-leave
1833;
1934
2035: factl recursive ( n -- n! )
36+ ." Entering First vers. of " [function-name] type cr
2137 ?dup 0= if 1
22- else dup 1- * factl
38+ else dup 1- factl *
2339 then
40+ ." Leaving First vers. of " [function-name] type cr
2441;
2542
2643: factl ( n -- n! )
44+ ." Entering Second vers. of " [function-name] type cr
2745 ?dup 0= if 1 factl
2846 else dup 1- recurse *
2947 then
48+ ." Leaving Second vers. of " [function-name] type cr
3049;
3150
3251variable naught
@@ -41,31 +60,88 @@ struct
4160constant /four
4261
4362: peril
63+ .dbg-enter
4464 ['] noop is do-nothing
4565 100 is thirty
4666 5 is naught
4767 thirty dup - abort" Never Happen"
68+ .dbg-leave
4869;
4970
5071: thirty ( new-val -- )
72+ .dbg-enter
5173 dup to thirty
5274 alias .dec .d \ Should this be allowed?
5375 ." Dirty" .dec
76+ .dbg-leave
5477;
5578tokenizer[
5679alias fliteral1 fliteral // This should be a harmless remark.
5780h# deadc0de ]tokenizer fliteral1
5881
82+ \ First subsidiary device, "child" of billy
83+ new-device
84+ instance variable cheryl
85+ [macro] my-dev-name " cheryl"
86+ name-my-dev
87+
88+ instance
89+ \ Third-level device, "grandchild" of billy
90+ new-device
91+ [macro] my-dev-name " meryl"
92+ name-my-dev
93+
94+ variable beryl
95+
96+ variable debug-meryl? debug-meryl? off
97+ alias debug-me? debug-meryl?
98+ : meryl
99+ .dbg-enter
100+ cheryl
101+ alias .deck .dec
102+ alias feral cheryl
103+ alias .heck .h
104+ .dbg-leave
105+ ;
106+ finish-device
107+
108+ \ Now we're back to "cheryl"
109+
110+ variable debug-cheryl? debug-cheryl? off
111+ alias debug-me? debug-cheryl?
112+ : queryl
113+ .dbg-enter
114+ over rot dup nip drop swap \ Not the most useful code... ;-}
115+ .dbg-leave
116+ ;
117+ finish-device
118+
119+ \ Some interpretation-time after the fact markers...
120+ alias colon :
121+ overload [macro] : ." Cleared " [input-file-name] type ." line " [line-number] .d cr colon
122+
123+ alias semicolon ;
124+ overload [macro] ; semicolon ." Finished defining " [function-name] type cr
125+
126+ \ And we're back to billy.
59127: droop ( -- )
128+ .dbg-enter \ This will display Entering droop in billy
60129 twenty
61130 tokenizer[
62131 alias .x .h \ Should this generate a warning?
132+ [function-name]
63133 ]tokenizer
64134 0 ?do i .x loop
65- ;
135+ .dbg-leave
136+ ; f[ [function-name] ]f
137+ headerless
66138: ploop ( -- )
139+ .dbg-enter
67140 fifty 0 do i drop 2 +loop
141+ .dbg-leave
68142;
143+ overload alias : colon
144+ overload alias ; semicolon
69145
70146fcode-end
71147
0 commit comments