Debian Codegraph @

contrib/xview/demo/debugview.l

raw
1 ;;;
2 ;;; Debug tool with window
3 ;;; 1988.8.13 by M.Inaba
4 ;;; 1989.11.24 revised for X-window
5 ;;;
6 (defun define-debug-view-frame (&optional (frame nil))
7 (setq *debug-view-frame*
8 (instance sunview-frame :init frame
9 :name "Debug tool" :x 500 :y 0))
10 )
11 (defvar *last-form* nil)
12 (defvar *last-file* "")
13 (defun define-debug-view-panel nil
14 (setq *debug-view-panel*
15 (instance sunview-panel :init *debug-view-frame*
16 :x 0 :height 256
17 :col-num 1 :item-size 20))
18
19 (setq *eval-button*
20 (instance
21 panel-button-item :init *debug-view-panel*
22 :name "Eval"
23 :nproc
24 #'(lambda ()
25 (let ((form (read-from-string (get_selection))))
26 (if form
27 (setq *last-form* form))
28 (eval *last-form*)))
29 ))
30 (setq *describe-button*
31 (instance
32 panel-button-item :init *debug-view-panel*
33 :name "Describe"
34 :nproc
35 #'(lambda ()
36 (describe (read-from-string (get_selection)))
37 )))
38 (setq *pf-button*
39 (instance
40 panel-button-item :init *debug-view-panel*
41 :name "Pf"
42 :nproc
43 #'(lambda ()
44 (let ((func (read-from-string (get_selection))))
45 (pf func))
46 )))
47 (setq *inspect-button*
48 (instance
49 panel-button-item :init *debug-view-panel*
50 :name "Inspect"
51 ))
52 (send *inspect-button*
53 :nproc
54 #'(lambda ()
55 (let ((obj
56 (read (make-string-input-stream (get_selection)) nil nil)))
57 (catch 'inspect
58 (inspect1 obj (string obj)))
59 )))
60 (setq *break-button*
61 (instance
62 panel-button-item :init *debug-view-panel*
63 :name "Break"
64 :nproc
65 #'(lambda ()
66 (let ((func (read-from-string (get_selection))))
67 (break func))
68 )))
69 (setq *trace-button*
70 (instance
71 panel-button-item :init *debug-view-panel*
72 :name "Trace"
73 :nproc
74 #'(lambda ()
75 (let ((func (read-from-string (get_selection))))
76 (trace func))
77 )))
78 (setq *step-button*
79 (instance
80 panel-button-item :init *debug-view-panel*
81 :name "Step"
82 :nproc
83 #'(lambda ()
84 (let ((form (read-from-string (get_selection))))
85 (step form))
86 )))
87 (setq *ls-button*
88 (instance
89 panel-button-item :init *debug-view-panel*
90 :name "Ls ~A*"
91 ))
92 (send *ls-button*
93 :nproc
94 #'(lambda ()
95 (let ((file (get_selection)))
96 (unix:system (format nil "ls ~A*" file))
97 )))
98 (setq *lsl-button*
99 (instance
100 panel-button-item :init *debug-view-panel*
101 :name "Ls -l ~A"
102 ))
103 (send *lsl-button*
104 :nproc
105 #'(lambda ()
106 (let ((file (get_selection)))
107 (unix:system (format nil "ls -l ~A" file))
108 )))
109 (setq *load-button*
110 (instance
111 panel-button-item :init *debug-view-panel*
112 :name "Load"
113 ))
114 (send *load-button*
115 :nproc
116 #'(lambda ()
117 (let ((file (get_selection)))
118 (if
119 (> (length file) 0)
120 (setq *last-file* file))
121 (if (> (length *last-file*) 0)
122 (load *last-file*)))
123 ))
124 )
125 ;;;
126 ;;;
127 (defun debug-view (&optional (parent nil))
128 (notify_do_dispatch)
129 (define-debug-view-frame)
130 ;;;
131 (define-debug-view-panel)
132 (send *debug-view-panel* :fit)
133 ;;;
134 (send *debug-view-frame* :show t)
135 (send *debug-view-frame* :fit)
136 )
137 ;;
138 (format t "(debug-view) :top-level of debugview.l~%")
139
140 ;;;;
141 ;;;;
142 ;;;;
143 (defclass debugmenu
144 :super sunview-user-frame
145 :slots
146 (last-file
147 pf-func
148 last-form
149 inspected-object
150 debugpanel
151 debugcanvas)
152 )
153 (defmethod debugmenu
154 (:eval (event)
155 (let ((form (read-from-string (get_selection) nil nil)))
156 (if form
157 (setq last-form form))
158 (eval last-form)))
159 (:describe (event)
160 (describe (read-from-string (get_selection) nil nil))
161 )
162 (:pf (event)
163 (setq pf-func (read-from-string (get_selection) nil nil))
164 (pf pf-func))
165 (:inspect (event)
166 (setq inspected-object
167 (read (make-string-input-stream (get_selection)) nil nil))
168 (catch 'inspect
169 (inspect1 inspected-object (string inspected-object)))
170 )
171 (:break (event)
172 (setq break-func (read-from-string (get_selection)))
173 (break break-func))
174 (:trace (event)
175 (setq trace-func (read-from-string (get_selection)))
176 (trace trace-func))
177 (:step (event)
178 (setq step-form (read-from-string (get_selection)))
179 (step step-form))
180 (:ls (event)
181 (let ((file (get_selection)))
182 (unix:system (format nil "ls ~A*" file))
183 ))
184 (:ls-l (event)
185 (let ((file (get_selection)))
186 (unix:system (format nil "ls -l ~A" file))
187 ))
188 (:load (event)
189 (let ((file (get_selection)))
190 (if
191 (> (length file) 0)
192 (setq load-file file))
193 (if (> (length load-file) 0)
194 (load load-file)))
195 )
196 (:test-choice
197 (value event)
198 (:click-test
199 (click button pos time)
200 (format t "click=~A,button=~A, pos=~A,time=~A~%"
201 click button pos time)
202 )
203 (:init
204 nil
205 (send-super :init :title "debug menu")
206 (setq debugpanel
207 (send self :open-panel
208 :col-num 1)) ; :vertical t
209 (send self :create-button :eval :title "Eval" )
210 (send self :create-button :describe :title "Describe" )
211 (send self :create-button :pf :title "Pf" )
212 (send self :create-button :inspect :title "Inspect" )
213 (send self :create-button :break :title "Break" )
214 (send self :create-button :step :title "Step" )
215 (send self :create-button :trace :title "Trace" )
216 (send self :create-button :ls :title "Ls" )
217 (send self :create-button :ls :title "Ls-L")
218 (send self :create-button :load :title "Load" )
219 (setq choice-test
220 (send self :create-choice :test-choice
221 :title "Test choice"
222 :display_level panel_current
223 :vertical t
224 :choices
225 #(object face edge 2dlnseg vertex junction)))
226 (send self :create-toggle
227 :test-choice :vertical t
228 :title "Test toggle"
229 :choices #(object face edge 2dlnseg vertex junction))
230 (send self :create-slider
231 :test-choice :title "Test slider"
232 :vertical t :notify_level panel_all
233 :min_value -100 :value 0 :max_value 100)
234 (send self :create-text :test-choice
235 :title "Test-text" :length 20
236 :vertical t)
237 (send debugpanel :fit)
238 ;;;
239 (setq debugcanvas
240 (send self :open-canvas
241 :width 300 :height 300))
242 (send self :create-clicked-eproc debugcanvas :click-test)
243 (send self :create-dragging-eproc debugcanvas :click-test)
244 ; (send self :create-moving-eproc debugcanvas :click-test)
245 (send self :create-drag-started-eproc debugcanvas :click-test)
246 (send self :create-drag-finished-eproc debugcanvas :click-test)
247 (send debugcanvas :fit)
248 (send self :fit)
249 (send self :show t)
250 self
251 )
252 )
253 ;;;
254 ;;;
255 (defun demenu (&optional (parent nil))
256 (setq *debugmenu* (instance debugmenu :init))
257 )
258 ;;
259 (format t "(debugmenu) :top-level of debugview.l~%")