-
Notifications
You must be signed in to change notification settings - Fork 3
/
IKForth.4th
69 lines (53 loc) · 1.49 KB
/
IKForth.4th
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
REPORT-NEW-NAME OFF
: debugger s" lib/~jp/debugger.f" included ;
: load_chess s" app/~ik/chess.4th" included ;
\ : a1 >r rp@ 1 type r> drop ;
\ USER TYPE-RESULT 1 CELLS USER-ALLOC
\ : type (s c-addr len - )
\ >R >R
\ 0
\ TYPE-RESULT
\ R> R> SWAP
\ STDOUT
\ WriteConsole \ ( hOut, PChar( S ), Length( S ), Result, nil );
\ ;
[DEFINED] RaiseException [IF]
: NTHROW (S exc-id -- )
>R 0 0 0 R> RaiseException ;
[THEN]
: .RS RP@ DUP RDEPTH CELLS + SWAP
?DO I @ 1 CELLS - DUP HERE U< IF @ DUP CODE>NAME SWAP ." 0x" H.8 SPACE NAME>STRING TYPE CR
ELSE DROP THEN 1 CELLS +LOOP ;
: .RSV RP@ DUP RDEPTH CELLS + SWAP
?DO I @ 1 CELLS - ." 0x" H.8 CR 1 CELLS +LOOP ;
: .RSVC RP@ DUP RDEPTH CELLS + SWAP
?DO I @ 1 CELLS - @ ." 0x" H.8 CR 1 CELLS +LOOP ;
: .RS-DAB RP@ DUP RDEPTH CELLS+ SWAP
?DO I
DUP ." @ 0x" H.8 SPACE
@ CELL-
DUP DATA-AREA-BASE HERE ROT WITHIN
IF
@ DUP CODE>NAME SWAP ." 0x" H.8 SPACE NAME>STRING TYPE CR
ELSE
." 0x" H.8 CR
THEN
1 CELLS
+LOOP
;
: t.rs2 .rs-dab ;
: t.rs1 123 >r t.rs2 r> drop ;
: st1 s" 123" s" 123" compare . ;
: st2 s" 231" s" 123" compare . ;
: st3 s" 123" s" 213" compare . ;
: st4 s" " s" " compare . ;
: st5 s" " s" 1" compare . ;
: st6 s" 1" s" " compare . ;
: st st1 st2 st3 st4 st5 st6 ;
\ st
requires" lib/~ik/open-interpreter.4th"
requires" lib/~ik/peimage.4th"
CR .( Startup ) CR
STARTUP-CHAIN CHAIN.SHOW
CR .( Shutdown ) CR
SHUTDOWN-CHAIN CHAIN.SHOW