1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 (declare (special dcaconses X Y screenheight tty-type))
18 (declare (special idel-lines-availablep idel-chars-availablep screenlinelen))
19
20
21
22 (defun DCTL-init ()
23 (setq dcaconses (list (ascii 33) '= nil nil))
24 (setq screenheight 24.)
25 (setq screenlinelen 79.)
26 (setq idel-lines-availablep t
27 idel-chars-availablep t)
28 (setq tty-type 'adm2)
29 (Rtyo 33)(Rprinc "*")
30 (setq X 0 Y 0))
31
32
33
34 (defun DCTL-position-cursor (x y)
35 (prog (ycost
36 xcost
37 what
38 cost)
39 (and (= x X)(= y Y)
40 (return nil))
41 (setq what 1
42 cost (+ 1 y x))
43 (and (> cost 4)
44 (setq what 0
45 cost 4))
46 (setq ycost (abs (- y Y)))
47 (setq xcost (abs (- x X)))
48 (and (< (+ ycost xcost) cost)
49 (setq what 3
50 cost (+ ycost xcost)))
51 (and (< (+ 1 ycost x) cost)
52 (setq what 2))
53 (cond ((= what 0)
54
55
56
57 (rplaca (cddr dcaconses) (+ 40 y))
58 (rplaca (cdddr dcaconses) (+ 40 x))
59
60 (Rprinc (implode dcaconses))
61 (setq X x Y y)
62 (return nil))
63
64 ((= what 1)
65 (Rtyo 36)
66 (setq X 0 Y 0))
67
68
69 ((= what 2)
70 (Rtyo 15)
71 (setq X 0)))
72
73
74
75
76 (cond ((< X x)
77 (do ex X (1+ ex)(= ex x)(Rtyo 14)))
78 ((< x X)
79 (do ex x (1+ ex)(= ex X)(Rtyo 10))))
80 (cond ((< Y y)
81 (do wy Y (1+ wy)(= wy y)(Rtyo 12)))
82 ((< y Y)
83 (do wy y (1+ wy)(= wy Y)(Rtyo 13))))
84 (setq X x Y y)
85 (return nil)))
86
87
88
89 (defun DCTL-display-char-string (string)
90 (setq X (+ X (stringlength string)))
91 (Rprinc string))
92
93
94
95 (defun DCTL-clear-rest-of-screen ()
96 (Rtyo 33)(Rprinc "Y"))
97
98
99
100 (defun DCTL-kill-line ()
101 (Rtyo 33)(Rprinc "T"))
102
103
104
105 (defun DCTL-insert-char-string (str)
106 (do i (stringlength str) (1- i) (= i 0)
107 (Rtyo 33)(Rprinc "Q"))
108 (Rprinc str)
109 (setq X (+ X (stringlength str))))
110
111
112
113 (defun DCTL-delete-chars (n)
114 (do i 1 (1+ i)(> i n)
115 (Rtyo 33)(Rprinc "W")))
116
117
118
119 (defun DCTL-insert-lines (n)
120 (do i 1 (1+ i)(> i n)
121 (Rtyo 33)(Rprinc "E")))
122
123
124
125 (defun DCTL-delete-lines (n)
126 (do i 1 (1+ i)(> i n)
127 (Rtyo 33)(Rprinc "R")))