mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1331 lines
47 KiB

  1. --- pilot-link-0.11.7/src/pilot-debug.c 2002-12-02 15:32:47.000000000 +0100
  2. +++ pilot-link-0.11.7-rock/src/pilot-debug.c 2004-02-25 00:11:06.000000000 +0100
  3. @@ -1549,526 +1549,526 @@
  4. return TCL_OK;
  5. }
  6. - Tcl_VarEval(interp,"\
  7. -
  8. -### /*** Generate remote UI window ***/
  9. -
  10. -set tkdbg 1
  11. -
  12. -toplevel .remote
  13. -wm title .remote {Palm Remote UI}
  14. -
  15. -catch {
  16. - if {[file exists {tools/pix/case.gif}]} {
  17. - set dir {tools}
  18. - } elseif {[file exists {",LIBDIR,"/pix/case.gif}]} {
  19. - set dir {",LIBDIR,"/pix}
  20. - } else {
  21. - error {No pix}
  22. - }
  23. - image create photo Case -format gif -file \"$dir/pix/case.gif\"
  24. - image create photo B1 -format gif -file \"$dir/pix/b1.gif\"
  25. - image create photo B2 -format gif -file \"$dir/pix/b2.gif\"
  26. - image create photo B3 -format gif -file \"$dir/pix/b3.gif\"
  27. - image create photo B4 -format gif -file \"$dir/pix/b4.gif\"
  28. - image create photo B5 -format gif -file \"$dir/pix/b5.gif\"
  29. - image create photo B6 -format gif -file \"$dir/pix/b6.gif\"
  30. - image create photo B7 -format gif -file \"$dir/pix/b7.gif\"
  31. -}
  32. -
  33. -canvas .remote.c -width 221 -height 337
  34. -
  35. -.remote.c create rectangle 27 29 196 260 -outline {red} -tag screen -fill {blue}
  36. -.remote.c create rectangle 0 280 18 306 -outline {red} -tag button1 -fill {blue}
  37. -.remote.c create oval 23 276 52 307 -outline {red} -tag button2 -fill {blue}
  38. -.remote.c create oval 63 276 92 307 -outline {red} -tag button3 -fill {blue}
  39. -.remote.c create rectangle 97 277 127 294 -outline {red} -tag button4 -fill {blue}
  40. -.remote.c create rectangle 97 300 127 317 -outline {red} -tag button5 -fill {blue}
  41. -.remote.c create oval 133 276 162 307 -outline {red} -tag button6 -fill {blue}
  42. -.remote.c create oval 171 276 200 307 -outline {red} -tag button7 -fill {blue}
  43. -
  44. -.remote.c create rectangle 33 32 187 253 -outline black -tag screen
  45. -.remote.c create rectangle 33 200 61 225 -outline black -tag screen
  46. -.remote.c create rectangle 33 225 61 253 -outline black -tag screen
  47. -.remote.c create rectangle 160 200 187 225 -outline black -tag screen
  48. -.remote.c create rectangle 160 225 187 253 -outline black -tag screen
  49. -.remote.c create rectangle 62 200 159 253 -outline black -tag screen
  50. -
  51. -set buttons(1) 0
  52. -
  53. -proc holdbutton {button} {
  54. - global buttons
  55. - if {$button==1} {
  56. - set buttons($button) [after 1000 \"continuebutton $button\"]
  57. - } else {
  58. - pushbutton $button
  59. - set buttons($button) [after 250 \"holdbutton $button\"]
  60. - }
  61. -}
  62. -
  63. -proc continuebutton {button} {
  64. - global buttons
  65. - if {$button==1} {
  66. - pushbutton 0
  67. - }
  68. - set buttons($button) \"\"
  69. -}
  70. -
  71. -proc releasebutton {button} {
  72. - global buttons
  73. - if {$buttons($button)!=\"\"} {
  74. - if {$button==1} {
  75. - pushbutton 1
  76. - }
  77. - after cancel $buttons($button)
  78. - set buttons($button) \"\"
  79. - }
  80. -}
  81. -
  82. -.remote.c bind button1 <ButtonPress-1> {.remote.c itemconfigure button1 -fill green; update; holdbutton 1}
  83. -.remote.c bind button1 <ButtonRelease-1> {.remote.c itemconfigure button1 -fill blue; releasebutton 1}
  84. -
  85. -.remote.c bind button2 <ButtonPress-1> {.remote.c itemconfigure button2 -fill green; update; holdbutton 2}
  86. -.remote.c bind button2 <ButtonRelease-1> {.remote.c itemconfigure button2 -fill blue; releasebutton 2}
  87. -
  88. -.remote.c bind button3 <ButtonPress-1> {.remote.c itemconfigure button3 -fill green; update; holdbutton 3}
  89. -.remote.c bind button3 <ButtonRelease-1> {.remote.c itemconfigure button3 -fill blue; releasebutton 3}
  90. -
  91. -.remote.c bind button4 <ButtonPress-1> {.remote.c itemconfigure button4 -fill green; update; holdbutton 4}
  92. -.remote.c bind button4 <ButtonRelease-1> {.remote.c itemconfigure button4 -fill blue; releasebutton 4}
  93. -
  94. -.remote.c bind button5 <ButtonPress-1> {.remote.c itemconfigure button5 -fill green; update; holdbutton 5}
  95. -.remote.c bind button5 <ButtonRelease-1> {.remote.c itemconfigure button5 -fill blue; releasebutton 5}
  96. -
  97. -.remote.c bind button6 <ButtonPress-1> {.remote.c itemconfigure button6 -fill green; update; holdbutton 6}
  98. -.remote.c bind button6 <ButtonRelease-1> {.remote.c itemconfigure button6 -fill blue; releasebutton 6}
  99. -
  100. -.remote.c bind button7 <ButtonPress-1> {.remote.c itemconfigure button7 -fill green; update; holdbutton 7}
  101. -.remote.c bind button7 <ButtonRelease-1> {.remote.c itemconfigure button7 -fill blue; releasebutton 7}
  102. -
  103. -catch {
  104. - .remote.c create image 0 282 -image B1 -anchor nw -tag downbutton1
  105. - .remote.c create image 22 274 -image B2 -anchor nw -tag downbutton2
  106. - .remote.c create image 60 275 -image B3 -anchor nw -tag downbutton3
  107. - .remote.c create image 93 278 -image B4 -anchor nw -tag downbutton4
  108. - .remote.c create image 95 298 -image B5 -anchor nw -tag downbutton5
  109. - .remote.c create image 131 275 -image B6 -anchor nw -tag downbutton6
  110. - .remote.c create image 169 274 -image B7 -anchor nw -tag downbutton7
  111. -
  112. - .remote.c create image 0 0 -image Case -anchor nw
  113. -
  114. - .remote.c bind button1 <ButtonPress-1> {.remote.c raise downbutton1; update; holdbutton 1}
  115. - .remote.c bind button1 <ButtonRelease-1> {.remote.c lower downbutton1; releasebutton 1}
  116. -
  117. - .remote.c bind button2 <ButtonPress-1> {.remote.c raise downbutton2; update; holdbutton 2}
  118. - .remote.c bind button2 <ButtonRelease-1> {.remote.c lower downbutton2; releasebutton 2}
  119. -
  120. - .remote.c bind button3 <ButtonPress-1> {.remote.c raise downbutton3; update; holdbutton 3}
  121. - .remote.c bind button3 <ButtonRelease-1> {.remote.c lower downbutton3; releasebutton 3}
  122. -
  123. - .remote.c bind button4 <ButtonPress-1> {.remote.c raise downbutton4; update; holdbutton 4}
  124. - .remote.c bind button4 <ButtonRelease-1> {.remote.c lower downbutton4; releasebutton 4}
  125. -
  126. - .remote.c bind button5 <ButtonPress-1> {.remote.c raise downbutton5; update; holdbutton 5}
  127. - .remote.c bind button5 <ButtonRelease-1> {.remote.c lower downbutton5; releasebutton 5}
  128. -
  129. - .remote.c bind button6 <ButtonPress-1> {.remote.c raise downbutton6; update; holdbutton 6}
  130. - .remote.c bind button6 <ButtonRelease-1> {.remote.c lower downbutton6; releasebutton 6}
  131. -
  132. - .remote.c bind button7 <ButtonPress-1> {.remote.c raise downbutton7; update; holdbutton 7}
  133. - .remote.c bind button7 <ButtonRelease-1> {.remote.c lower downbutton7; releasebutton 7}
  134. -
  135. -
  136. - .remote.c itemconfigure button1 -outline {} -fill {}
  137. - .remote.c raise button1
  138. - .remote.c itemconfigure button2 -outline {} -fill {}
  139. - .remote.c raise button2
  140. - .remote.c itemconfigure button3 -outline {} -fill {}
  141. - .remote.c raise button3
  142. - .remote.c itemconfigure button4 -outline {} -fill {}
  143. - .remote.c raise button4
  144. - .remote.c itemconfigure button5 -outline {} -fill {}
  145. - .remote.c raise button5
  146. - .remote.c itemconfigure button6 -outline {} -fill {}
  147. - .remote.c raise button6
  148. - .remote.c itemconfigure button7 -outline {} -fill {}
  149. - .remote.c raise button7
  150. - .remote.c itemconfigure screen -outline {} -fill {}
  151. - .remote.c raise screen
  152. -}
  153. -
  154. -pack .remote.c -side top
  155. -
  156. -.remote.c bind screen <ButtonPress-1> {pen %x %y 1}
  157. -.remote.c bind screen <B1-Motion> {pen %x %y 1}
  158. -.remote.c bind screen <ButtonRelease-1> {pen %x %y 0}
  159. -
  160. -global KeyQueue
  161. -global KeyQueueId
  162. -global KeyQueueDelay
  163. -set KeyQueue {}
  164. -set KeyQueueId {}
  165. -set KeyQueueDelay 50
  166. -
  167. -proc readyqueue {} {
  168. - global KeyQueueId
  169. - global KeyQueueDelay
  170. - if {$KeyQueueId == {}} {
  171. - after $KeyQueueDelay { set KeyQueueId [ after idle {sendqueue} ] }
  172. - }
  173. -}
  174. -
  175. -proc queuekey {c} {
  176. - global KeyQueue
  177. - append KeyQueue $c
  178. - readyqueue
  179. -}
  180. -
  181. -proc sendqueue {} {
  182. - global KeyQueue
  183. - global KeyQueueId
  184. - if {[string length $KeyQueue] > 0} {
  185. - key [string index $KeyQueue 0]
  186. - set KeyQueue [string range $KeyQueue 1 end]
  187. - }
  188. - set KeyQueueId {}
  189. - if {[string length $KeyQueue] > 0} { readyqueue }
  190. -}
  191. -
  192. -bind .remote <KeyPress> {queuekey %A}
  193. -
  194. -## Handle pasting
  195. -proc do_paste { } {
  196. - if [catch {selection get} sel] {
  197. - if [catch {selection get -selection CLIPBOARD} sel] {
  198. - return
  199. - }
  200. - }
  201. - queuekey $sel
  202. -}
  203. -bind .remote <ButtonPress-2> {do_paste}
  204. -
  205. -##### /*** Generate remote console window ***/
  206. -
  207. -toplevel .console
  208. -wm title .console \"Palm Remote Console\"
  209. -scrollbar .console.y -orient vertical -command {.console.t yview}
  210. -text .console.t -yscrollcommand {.console.y set}
  211. -pack .console.t -fill both -expand yes -side left
  212. -pack .console.y -fill y -side right
  213. -focus .console.t
  214. -
  215. -#### /*** Generate pilot state window ***/
  216. -
  217. -toplevel .state
  218. -wm title .state {Palm State}
  219. -label .state.l1 -text {Active mode:}
  220. -label .state.l1x -text {Battery:}
  221. -label .state.l2 -text {Exception:}
  222. -label .state.l25 -text {Reset:}
  223. -label .state.l3 -text {Function:}
  224. -label .state.l4 -text {F-start:}
  225. -label .state.l5 -text {F-end:}
  226. -label .state.l6 -text {D0:}
  227. -label .state.l7 -text {A0:}
  228. -label .state.l8 -text {D1:}
  229. -label .state.l9 -text {A1:}
  230. -label .state.l10 -text {D2:}
  231. -label .state.l11 -text {A2:}
  232. -label .state.l12 -text {D3:}
  233. -label .state.l13 -text {A3:}
  234. -label .state.l14 -text {D4:}
  235. -label .state.l15 -text {A4:}
  236. -label .state.l16 -text {D5:}
  237. -label .state.l17 -text {A5:}
  238. -label .state.l18 -text {D6:}
  239. -label .state.l19 -text {A6:}
  240. -label .state.l20 -text {D7:}
  241. -
  242. -label .state.l21 -text {PC:}
  243. -label .state.l22 -text {SR:}
  244. -label .state.l23 -text {USP:}
  245. -label .state.l24 -text {SSP:}
  246. -
  247. -label .state.halted -text {None}
  248. -label .state.battery -text {Unknown}
  249. -label .state.exception -text {0}
  250. -label .state.reset -text {No}
  251. -label .state.funcname -text {}
  252. -label .state.funcstart -text {00000000}
  253. -label .state.funcend -text {00000000}
  254. -label .state.d0 -text {00000000}
  255. -label .state.a0 -text {00000000}
  256. -label .state.d1 -text {00000000}
  257. -label .state.a1 -text {00000000}
  258. -label .state.d2 -text {00000000}
  259. -label .state.a2 -text {00000000}
  260. -label .state.d3 -text {00000000}
  261. -label .state.a3 -text {00000000}
  262. -label .state.d4 -text {00000000}
  263. -label .state.a4 -text {00000000}
  264. -label .state.d5 -text {00000000}
  265. -label .state.a5 -text {00000000}
  266. -label .state.d6 -text {00000000}
  267. -label .state.a6 -text {00000000}
  268. -label .state.d7 -text {00000000}
  269. -label .state.pc -text {00000000}
  270. -label .state.sr -text {0000}
  271. -label .state.usp -text {00000000}
  272. -label .state.ssp -text {00000000}
  273. -
  274. -grid .state.l1 -column 0 -row 0 -sticky e -columnspan 2
  275. -grid .state.halted -column 2 -row 0 -sticky w -columnspan 2
  276. -
  277. -grid .state.l1x -column 0 -row 1 -sticky e -columnspan 2
  278. -grid .state.battery -column 2 -row 1 -sticky w -columnspan 2
  279. -
  280. -grid .state.l2 -column 0 -row 2 -sticky e -columnspan 2
  281. -grid .state.exception -column 2 -row 2 -sticky w -columnspan 2
  282. -
  283. -grid .state.l25 -column 0 -row 3 -sticky e -columnspan 2
  284. -grid .state.reset -column 2 -row 3 -sticky w -columnspan 2
  285. -
  286. -grid .state.l3 -column 0 -row 4 -sticky e -columnspan 2
  287. -grid .state.funcname -column 2 -row 4 -sticky w -columnspan 2
  288. -
  289. -grid .state.l4 -column 0 -row 5 -sticky e -columnspan 2
  290. -grid .state.funcstart -column 2 -row 5 -sticky w -columnspan 2
  291. -
  292. -grid .state.l5 -column 0 -row 6 -sticky e -columnspan 2
  293. -grid .state.funcend -column 2 -row 6 -sticky w -columnspan 2
  294. -
  295. -frame .state.rule1 -relief raised -bd 2 -height 4
  296. -grid .state.rule1 -column 0 -row 7 -columnspan 4 -sticky ew
  297. -
  298. -grid .state.l6 -column 0 -row 8 -sticky e
  299. -grid .state.d0 -column 1 -row 8 -sticky w
  300. -grid .state.l7 -column 2 -row 8 -sticky e
  301. -grid .state.a0 -column 3 -row 8 -sticky w
  302. -
  303. -grid .state.l8 -column 0 -row 9 -sticky e
  304. -grid .state.d1 -column 1 -row 9 -sticky w
  305. -grid .state.l9 -column 2 -row 9 -sticky e
  306. -grid .state.a1 -column 3 -row 9 -sticky w
  307. -
  308. -grid .state.l10 -column 0 -row 10 -sticky e
  309. -grid .state.d2 -column 1 -row 10 -sticky w
  310. -grid .state.l11 -column 2 -row 10 -sticky e
  311. -grid .state.a2 -column 3 -row 10 -sticky w
  312. -
  313. -grid .state.l12 -column 0 -row 11 -sticky e
  314. -grid .state.d3 -column 1 -row 11 -sticky w
  315. -grid .state.l13 -column 2 -row 11 -sticky e
  316. -grid .state.a3 -column 3 -row 11 -sticky w
  317. -
  318. -grid .state.l14 -column 0 -row 12 -sticky e
  319. -grid .state.d4 -column 1 -row 12 -sticky w
  320. -grid .state.l15 -column 2 -row 12 -sticky e
  321. -grid .state.a4 -column 3 -row 12 -sticky w
  322. -
  323. -grid .state.l16 -column 0 -row 13 -sticky e
  324. -grid .state.d5 -column 1 -row 13 -sticky w
  325. -grid .state.l17 -column 2 -row 13 -sticky e
  326. -grid .state.a5 -column 3 -row 13 -sticky w
  327. -
  328. -grid .state.l18 -column 0 -row 14 -sticky e
  329. -grid .state.d6 -column 1 -row 14 -sticky w
  330. -grid .state.l19 -column 2 -row 14 -sticky e
  331. -grid .state.a6 -column 3 -row 14 -sticky w
  332. -
  333. -grid .state.l20 -column 0 -row 15 -sticky e
  334. -grid .state.d7 -column 1 -row 15 -sticky w
  335. -
  336. -grid .state.l21 -column 0 -row 16 -sticky e
  337. -grid .state.pc -column 1 -row 16 -sticky w
  338. -grid .state.l22 -column 2 -row 16 -sticky e
  339. -grid .state.sr -column 3 -row 16 -sticky w
  340. -
  341. -grid .state.l23 -column 0 -row 17 -sticky e
  342. -grid .state.usp -column 1 -row 17 -sticky w
  343. -grid .state.l24 -column 2 -row 17 -sticky e
  344. -grid .state.ssp -column 3 -row 17 -sticky w
  345. -
  346. -label .state.bl2 -text {B1:}
  347. -label .state.bl4 -text {B2:}
  348. -label .state.bl6 -text {B3:}
  349. -label .state.bl8 -text {B4:}
  350. -label .state.bl10 -text {B5:}
  351. -label .state.bl12 -text {B6:}
  352. -
  353. -label .state.b1 -text {00000000}
  354. -label .state.b1a -text {Off}
  355. -label .state.b2 -text {00000000}
  356. -label .state.b2a -text {Off}
  357. -label .state.b3 -text {00000000}
  358. -label .state.b3a -text {Off}
  359. -label .state.b4 -text {00000000}
  360. -label .state.b4a -text {Off}
  361. -label .state.b5 -text {00000000}
  362. -label .state.b5a -text {Off}
  363. -label .state.b6 -text {00000000}
  364. -label .state.b6a -text {Off}
  365. -
  366. -frame .state.rule2 -relief raised -bd 2 -height 4
  367. -grid .state.rule2 -column 0 -row 18 -columnspan 4 -sticky ew
  368. -
  369. -grid .state.bl2 -column 0 -row 19 -sticky e
  370. -grid .state.b1 -column 1 -row 19 -sticky w
  371. -grid .state.b1a -column 2 -row 19 -sticky w
  372. -
  373. -grid .state.bl4 -column 0 -row 20 -sticky e
  374. -grid .state.b2 -column 1 -row 20 -sticky w
  375. -grid .state.b2a -column 2 -row 20 -sticky w
  376. -
  377. -grid .state.bl6 -column 0 -row 21 -sticky e
  378. -grid .state.b3 -column 1 -row 21 -sticky w
  379. -grid .state.b3a -column 2 -row 21 -sticky w
  380. -
  381. -grid .state.bl8 -column 0 -row 22 -sticky e
  382. -grid .state.b4 -column 1 -row 22 -sticky w
  383. -grid .state.b4a -column 2 -row 22 -sticky w
  384. -
  385. -grid .state.bl10 -column 0 -row 23 -sticky e
  386. -grid .state.b5 -column 1 -row 23 -sticky w
  387. -grid .state.b5a -column 2 -row 23 -sticky w
  388. -
  389. -grid .state.bl12 -column 0 -row 24 -sticky e
  390. -grid .state.b6 -column 1 -row 24 -sticky w
  391. -grid .state.b6a -column 2 -row 24 -sticky w
  392. -
  393. -### /*** Generate debugger console window ***/
  394. -
  395. -wm title . \"Palm Debugger Console\"
  396. -catch {
  397. - wm iconbitmap . {@pix/case.xbm}
  398. - wm iconbitmap .remote {@pix/case.xbm}
  399. - wm iconbitmap .console {@pix/case.xbm}
  400. - wm iconbitmap .state {@pix/case.xbm}
  401. - #wm iconmask . {@pix/casemask.xbm}
  402. -}
  403. -
  404. -frame .m -relief raised
  405. -frame .f
  406. -scrollbar .f.y -orient vertical -command {.f.t yview}
  407. -text .f.t -yscrollcommand {.f.y set} -wrap word
  408. -pack .f.t -fill both -expand yes -side left
  409. -pack .f.y -fill y -side right
  410. -pack [menubutton .m.file -text {File} -menu .m.file.m] -side left
  411. -#pack [menubutton .m.edit -text {Edit} -menu .m.edit.m] -side left
  412. -pack [menubutton .m.windows -text {Windows} -menu .m.windows.m] -side left
  413. -#pack [menubutton .m.help -text {display_help} -menu .m.help.m] -side right
  414. -
  415. -menu .m.file.m
  416. -menu .m.windows.m
  417. -#menu .m.edit.m
  418. -#menu .m.help.m
  419. -
  420. -#wm iconify .remote
  421. -#wm iconify .console
  422. -#wm iconify .state
  423. -
  424. -
  425. -proc ShowWindow {name1 name2 op} {
  426. - global show
  427. - if {$show($name2)} {
  428. - if {[wm state $name2] != \"normal\"} {
  429. - wm deiconify $name2
  430. - }
  431. - } else {
  432. - if {[wm state $name2] == \"normal\"} {
  433. - wm withdraw $name2
  434. - }
  435. - }
  436. -}
  437. -
  438. -
  439. -trace variable show w {ShowWindow}
  440. -
  441. -bind .remote <Unmap> { set show(.remote) 0 }
  442. -bind .console <Unmap> { set show(.console) 0 }
  443. -bind .state <Unmap> { set show(.state) 0 }
  444. -
  445. -bind .remote <Map> { set show(.remote) 1 }
  446. -bind .console <Map> { set show(.console) 1 }
  447. -bind .state <Map> { set show(.state) 1 }
  448. -
  449. -wm protocol .remote WM_DELETE_WINDOW { set show(.remote) 0 }
  450. -wm protocol .console WM_DELETE_WINDOW { set show(.console) 0 }
  451. -wm protocol .state WM_DELETE_WINDOW { set show(.state) 0 }
  452. -
  453. -set show(.remote) 0
  454. -set show(.console) 0
  455. -set show(.state) 0
  456. -
  457. -
  458. -.m.file.m add command -label {Exit} -command {exit}
  459. -
  460. -.m.windows.m add checkbutton -label {Remote UI} -var show(.remote)
  461. -.m.windows.m add checkbutton -label {Remote Console} -var show(.console)
  462. -.m.windows.m add checkbutton -label {Remote State} -var show(.state)
  463. -
  464. -pack .m -side top -fill x
  465. -pack .f -side top -fill both -expand yes
  466. -focus .f.t
  467. -
  468. -### /*** Configure console bindings ***/
  469. -
  470. -bind .console.t <Shift-KeyPress-Return> {tkTextInsert .console.t \"\\n\" ; break}
  471. -bind .f.t <Shift-KeyPress-Return> {tkTextInsert .f.t \"\\n\" ; break}
  472. -
  473. -bind .console.t <Control-KeyPress-Return> {tkTextInsert .console.t \"\\n\" ; break}
  474. -bind .f.t <Control-KeyPress-Return> {tkTextInsert .f.t \"\\n\" ; break}
  475. -
  476. -bind .console.t <KeyPress-Return> {Console [.console.t get {insert linestart} {insert lineend}] ; break}
  477. -bind .f.t <KeyPress-Return> {
  478. - set line [.f.t get {insert linestart} {insert lineend}]
  479. - set f [string first \">\" $line]
  480. - incr f
  481. - set line [string range $line $f end]
  482. - .f.t mark set insert {insert lineend}
  483. - .f.t insert insert \\n
  484. - Debugger $line
  485. - if {[.f.t compare insert != {insert linestart}]} {
  486. - .f.t insert insert \"\\n\"
  487. - }
  488. - .f.t insert insert \"pilot-debug> \"
  489. - .f.t see insert
  490. - break
  491. -}
  492. -
  493. -proc Console {cmd} {
  494. - .console.t mark set insert {insert lineend}
  495. - tkTextInsert .console.t \\n
  496. - transmit $cmd
  497. -}
  498. -
  499. -proc Debugger {cmd} {
  500. - #.f.t mark set insert {insert lineend}
  501. - #tkTextInsert .f.t \\n
  502. - if {[string length [string trim $cmd]]!=0} {
  503. - set code [catch {eval $cmd} message]
  504. - if {[string length $message]} {
  505. - set message [string trimright $message]
  506. - Say \"$message\\n\"
  507. - #if {[.f.t compare insert != {insert linestart}]} {
  508. - # Say \"\\\n\"
  509. - #}
  510. - }
  511. - }
  512. -}
  513. -
  514. -proc Say {text} {
  515. - global Interactive
  516. - if {$Interactive} {
  517. - .f.t insert insert \"$text\"
  518. - .f.t see insert
  519. - } else {
  520. - upvar result result
  521. - set result \"$result$text\"
  522. - }
  523. -}
  524. -
  525. -", NULL);
  526. + Tcl_VarEval(interp,
  527. +""
  528. +"\n"
  529. +"### /*** Generate remote UI window ***/\n"
  530. +"\n"
  531. +"set tkdbg 1\n"
  532. +"\n"
  533. +"toplevel .remote\n"
  534. +"wm title .remote {Palm Remote UI}\n"
  535. +"\n"
  536. +"catch {\n"
  537. +" if {[file exists {tools/pix/case.gif}]} {\n"
  538. +" set dir {tools}\n"
  539. +" } elseif {[file exists {",LIBDIR,"/pix/case.gif}]} {\n"
  540. +" set dir {",LIBDIR,"/pix}\n"
  541. +" } else {\n"
  542. +" error {No pix}\n"
  543. +" }\n"
  544. +" image create photo Case -format gif -file \"$dir/pix/case.gif\"\n"
  545. +" image create photo B1 -format gif -file \"$dir/pix/b1.gif\"\n"
  546. +" image create photo B2 -format gif -file \"$dir/pix/b2.gif\"\n"
  547. +" image create photo B3 -format gif -file \"$dir/pix/b3.gif\"\n"
  548. +" image create photo B4 -format gif -file \"$dir/pix/b4.gif\"\n"
  549. +" image create photo B5 -format gif -file \"$dir/pix/b5.gif\"\n"
  550. +" image create photo B6 -format gif -file \"$dir/pix/b6.gif\"\n"
  551. +" image create photo B7 -format gif -file \"$dir/pix/b7.gif\"\n"
  552. +"}\n"
  553. +"\n"
  554. +"canvas .remote.c -width 221 -height 337\n"
  555. +"\n"
  556. +".remote.c create rectangle 27 29 196 260 -outline {red} -tag screen -fill {blue}\n"
  557. +".remote.c create rectangle 0 280 18 306 -outline {red} -tag button1 -fill {blue}\n"
  558. +".remote.c create oval 23 276 52 307 -outline {red} -tag button2 -fill {blue}\n"
  559. +".remote.c create oval 63 276 92 307 -outline {red} -tag button3 -fill {blue}\n"
  560. +".remote.c create rectangle 97 277 127 294 -outline {red} -tag button4 -fill {blue}\n"
  561. +".remote.c create rectangle 97 300 127 317 -outline {red} -tag button5 -fill {blue}\n"
  562. +".remote.c create oval 133 276 162 307 -outline {red} -tag button6 -fill {blue}\n"
  563. +".remote.c create oval 171 276 200 307 -outline {red} -tag button7 -fill {blue}\n"
  564. +"\n"
  565. +".remote.c create rectangle 33 32 187 253 -outline black -tag screen\n"
  566. +".remote.c create rectangle 33 200 61 225 -outline black -tag screen\n"
  567. +".remote.c create rectangle 33 225 61 253 -outline black -tag screen\n"
  568. +".remote.c create rectangle 160 200 187 225 -outline black -tag screen\n"
  569. +".remote.c create rectangle 160 225 187 253 -outline black -tag screen\n"
  570. +".remote.c create rectangle 62 200 159 253 -outline black -tag screen\n"
  571. +"\n"
  572. +"set buttons(1) 0\n"
  573. +"\n"
  574. +"proc holdbutton {button} {\n"
  575. +" global buttons\n"
  576. +" if {$button==1} {\n"
  577. +" set buttons($button) [after 1000 \"continuebutton $button\"]\n"
  578. +" } else {\n"
  579. +" pushbutton $button\n"
  580. +" set buttons($button) [after 250 \"holdbutton $button\"]\n"
  581. +" }\n"
  582. +"}\n"
  583. +"\n"
  584. +"proc continuebutton {button} {\n"
  585. +" global buttons\n"
  586. +" if {$button==1} {\n"
  587. +" pushbutton 0\n"
  588. +" }\n"
  589. +" set buttons($button) \"\"\n"
  590. +"}\n"
  591. +"\n"
  592. +"proc releasebutton {button} {\n"
  593. +" global buttons\n"
  594. +" if {$buttons($button)!=\"\"} {\n"
  595. +" if {$button==1} {\n"
  596. +" pushbutton 1\n"
  597. +" }\n"
  598. +" after cancel $buttons($button)\n"
  599. +" set buttons($button) \"\"\n"
  600. +" }\n"
  601. +"}\n"
  602. +"\n"
  603. +".remote.c bind button1 <ButtonPress-1> {.remote.c itemconfigure button1 -fill green; update; holdbutton 1}\n"
  604. +".remote.c bind button1 <ButtonRelease-1> {.remote.c itemconfigure button1 -fill blue; releasebutton 1}\n"
  605. +"\n"
  606. +".remote.c bind button2 <ButtonPress-1> {.remote.c itemconfigure button2 -fill green; update; holdbutton 2}\n"
  607. +".remote.c bind button2 <ButtonRelease-1> {.remote.c itemconfigure button2 -fill blue; releasebutton 2}\n"
  608. +"\n"
  609. +".remote.c bind button3 <ButtonPress-1> {.remote.c itemconfigure button3 -fill green; update; holdbutton 3}\n"
  610. +".remote.c bind button3 <ButtonRelease-1> {.remote.c itemconfigure button3 -fill blue; releasebutton 3}\n"
  611. +"\n"
  612. +".remote.c bind button4 <ButtonPress-1> {.remote.c itemconfigure button4 -fill green; update; holdbutton 4}\n"
  613. +".remote.c bind button4 <ButtonRelease-1> {.remote.c itemconfigure button4 -fill blue; releasebutton 4}\n"
  614. +"\n"
  615. +".remote.c bind button5 <ButtonPress-1> {.remote.c itemconfigure button5 -fill green; update; holdbutton 5}\n"
  616. +".remote.c bind button5 <ButtonRelease-1> {.remote.c itemconfigure button5 -fill blue; releasebutton 5}\n"
  617. +"\n"
  618. +".remote.c bind button6 <ButtonPress-1> {.remote.c itemconfigure button6 -fill green; update; holdbutton 6}\n"
  619. +".remote.c bind button6 <ButtonRelease-1> {.remote.c itemconfigure button6 -fill blue; releasebutton 6}\n"
  620. +"\n"
  621. +".remote.c bind button7 <ButtonPress-1> {.remote.c itemconfigure button7 -fill green; update; holdbutton 7}\n"
  622. +".remote.c bind button7 <ButtonRelease-1> {.remote.c itemconfigure button7 -fill blue; releasebutton 7}\n"
  623. +"\n"
  624. +"catch {\n"
  625. +" .remote.c create image 0 282 -image B1 -anchor nw -tag downbutton1\n"
  626. +" .remote.c create image 22 274 -image B2 -anchor nw -tag downbutton2\n"
  627. +" .remote.c create image 60 275 -image B3 -anchor nw -tag downbutton3\n"
  628. +" .remote.c create image 93 278 -image B4 -anchor nw -tag downbutton4\n"
  629. +" .remote.c create image 95 298 -image B5 -anchor nw -tag downbutton5\n"
  630. +" .remote.c create image 131 275 -image B6 -anchor nw -tag downbutton6\n"
  631. +" .remote.c create image 169 274 -image B7 -anchor nw -tag downbutton7\n"
  632. +"\n"
  633. +" .remote.c create image 0 0 -image Case -anchor nw\n"
  634. +"\n"
  635. +" .remote.c bind button1 <ButtonPress-1> {.remote.c raise downbutton1; update; holdbutton 1}\n"
  636. +" .remote.c bind button1 <ButtonRelease-1> {.remote.c lower downbutton1; releasebutton 1}\n"
  637. +"\n"
  638. +" .remote.c bind button2 <ButtonPress-1> {.remote.c raise downbutton2; update; holdbutton 2}\n"
  639. +" .remote.c bind button2 <ButtonRelease-1> {.remote.c lower downbutton2; releasebutton 2}\n"
  640. +"\n"
  641. +" .remote.c bind button3 <ButtonPress-1> {.remote.c raise downbutton3; update; holdbutton 3}\n"
  642. +" .remote.c bind button3 <ButtonRelease-1> {.remote.c lower downbutton3; releasebutton 3}\n"
  643. +"\n"
  644. +" .remote.c bind button4 <ButtonPress-1> {.remote.c raise downbutton4; update; holdbutton 4}\n"
  645. +" .remote.c bind button4 <ButtonRelease-1> {.remote.c lower downbutton4; releasebutton 4}\n"
  646. +"\n"
  647. +" .remote.c bind button5 <ButtonPress-1> {.remote.c raise downbutton5; update; holdbutton 5}\n"
  648. +" .remote.c bind button5 <ButtonRelease-1> {.remote.c lower downbutton5; releasebutton 5}\n"
  649. +"\n"
  650. +" .remote.c bind button6 <ButtonPress-1> {.remote.c raise downbutton6; update; holdbutton 6}\n"
  651. +" .remote.c bind button6 <ButtonRelease-1> {.remote.c lower downbutton6; releasebutton 6}\n"
  652. +"\n"
  653. +" .remote.c bind button7 <ButtonPress-1> {.remote.c raise downbutton7; update; holdbutton 7}\n"
  654. +" .remote.c bind button7 <ButtonRelease-1> {.remote.c lower downbutton7; releasebutton 7}\n"
  655. +" \n"
  656. +" \n"
  657. +" .remote.c itemconfigure button1 -outline {} -fill {}\n"
  658. +" .remote.c raise button1\n"
  659. +" .remote.c itemconfigure button2 -outline {} -fill {}\n"
  660. +" .remote.c raise button2\n"
  661. +" .remote.c itemconfigure button3 -outline {} -fill {}\n"
  662. +" .remote.c raise button3\n"
  663. +" .remote.c itemconfigure button4 -outline {} -fill {}\n"
  664. +" .remote.c raise button4\n"
  665. +" .remote.c itemconfigure button5 -outline {} -fill {}\n"
  666. +" .remote.c raise button5\n"
  667. +" .remote.c itemconfigure button6 -outline {} -fill {}\n"
  668. +" .remote.c raise button6\n"
  669. +" .remote.c itemconfigure button7 -outline {} -fill {}\n"
  670. +" .remote.c raise button7\n"
  671. +" .remote.c itemconfigure screen -outline {} -fill {}\n"
  672. +" .remote.c raise screen\n"
  673. +"}\n"
  674. +"\n"
  675. +"pack .remote.c -side top\n"
  676. +"\n"
  677. +".remote.c bind screen <ButtonPress-1> {pen %x %y 1}\n"
  678. +".remote.c bind screen <B1-Motion> {pen %x %y 1}\n"
  679. +".remote.c bind screen <ButtonRelease-1> {pen %x %y 0}\n"
  680. +"\n"
  681. +"global KeyQueue\n"
  682. +"global KeyQueueId\n"
  683. +"global KeyQueueDelay\n"
  684. +"set KeyQueue {}\n"
  685. +"set KeyQueueId {}\n"
  686. +"set KeyQueueDelay 50\n"
  687. +"\n"
  688. +"proc readyqueue {} {\n"
  689. +" global KeyQueueId\n"
  690. +" global KeyQueueDelay\n"
  691. +" if {$KeyQueueId == {}} {\n"
  692. +" after $KeyQueueDelay { set KeyQueueId [ after idle {sendqueue} ] }\n"
  693. +" }\n"
  694. +"}\n"
  695. +"\n"
  696. +"proc queuekey {c} {\n"
  697. +" global KeyQueue\n"
  698. +" append KeyQueue $c\n"
  699. +" readyqueue\n"
  700. +"}\n"
  701. +"\n"
  702. +"proc sendqueue {} {\n"
  703. +" global KeyQueue\n"
  704. +" global KeyQueueId\n"
  705. +" if {[string length $KeyQueue] > 0} {\n"
  706. +" key [string index $KeyQueue 0]\n"
  707. +" set KeyQueue [string range $KeyQueue 1 end]\n"
  708. +" }\n"
  709. +" set KeyQueueId {}\n"
  710. +" if {[string length $KeyQueue] > 0} { readyqueue }\n"
  711. +"}\n"
  712. +"\n"
  713. +"bind .remote <KeyPress> {queuekey %A}\n"
  714. +"\n"
  715. +"## Handle pasting\n"
  716. +"proc do_paste { } {\n"
  717. +" if [catch {selection get} sel] {\n"
  718. +" if [catch {selection get -selection CLIPBOARD} sel] {\n"
  719. +" return\n"
  720. +" }\n"
  721. +" }\n"
  722. +" queuekey $sel\n"
  723. +"}\n"
  724. +"bind .remote <ButtonPress-2> {do_paste}\n"
  725. +"\n"
  726. +"##### /*** Generate remote console window ***/\n"
  727. +"\n"
  728. +"toplevel .console\n"
  729. +"wm title .console \"Palm Remote Console\"\n"
  730. +"scrollbar .console.y -orient vertical -command {.console.t yview}\n"
  731. +"text .console.t -yscrollcommand {.console.y set}\n"
  732. +"pack .console.t -fill both -expand yes -side left\n"
  733. +"pack .console.y -fill y -side right\n"
  734. +"focus .console.t\n"
  735. +"\n"
  736. +"#### /*** Generate pilot state window ***/\n"
  737. +"\n"
  738. +"toplevel .state\n"
  739. +"wm title .state {Palm State}\n"
  740. +"label .state.l1 -text {Active mode:}\n"
  741. +"label .state.l1x -text {Battery:}\n"
  742. +"label .state.l2 -text {Exception:}\n"
  743. +"label .state.l25 -text {Reset:}\n"
  744. +"label .state.l3 -text {Function:}\n"
  745. +"label .state.l4 -text {F-start:}\n"
  746. +"label .state.l5 -text {F-end:}\n"
  747. +"label .state.l6 -text {D0:}\n"
  748. +"label .state.l7 -text {A0:}\n"
  749. +"label .state.l8 -text {D1:}\n"
  750. +"label .state.l9 -text {A1:}\n"
  751. +"label .state.l10 -text {D2:}\n"
  752. +"label .state.l11 -text {A2:}\n"
  753. +"label .state.l12 -text {D3:}\n"
  754. +"label .state.l13 -text {A3:}\n"
  755. +"label .state.l14 -text {D4:}\n"
  756. +"label .state.l15 -text {A4:}\n"
  757. +"label .state.l16 -text {D5:}\n"
  758. +"label .state.l17 -text {A5:}\n"
  759. +"label .state.l18 -text {D6:}\n"
  760. +"label .state.l19 -text {A6:}\n"
  761. +"label .state.l20 -text {D7:}\n"
  762. +"\n"
  763. +"label .state.l21 -text {PC:}\n"
  764. +"label .state.l22 -text {SR:}\n"
  765. +"label .state.l23 -text {USP:}\n"
  766. +"label .state.l24 -text {SSP:}\n"
  767. +"\n"
  768. +"label .state.halted -text {None}\n"
  769. +"label .state.battery -text {Unknown}\n"
  770. +"label .state.exception -text {0}\n"
  771. +"label .state.reset -text {No}\n"
  772. +"label .state.funcname -text {}\n"
  773. +"label .state.funcstart -text {00000000}\n"
  774. +"label .state.funcend -text {00000000}\n"
  775. +"label .state.d0 -text {00000000}\n"
  776. +"label .state.a0 -text {00000000}\n"
  777. +"label .state.d1 -text {00000000}\n"
  778. +"label .state.a1 -text {00000000}\n"
  779. +"label .state.d2 -text {00000000}\n"
  780. +"label .state.a2 -text {00000000}\n"
  781. +"label .state.d3 -text {00000000}\n"
  782. +"label .state.a3 -text {00000000}\n"
  783. +"label .state.d4 -text {00000000}\n"
  784. +"label .state.a4 -text {00000000}\n"
  785. +"label .state.d5 -text {00000000}\n"
  786. +"label .state.a5 -text {00000000}\n"
  787. +"label .state.d6 -text {00000000}\n"
  788. +"label .state.a6 -text {00000000}\n"
  789. +"label .state.d7 -text {00000000}\n"
  790. +"label .state.pc -text {00000000}\n"
  791. +"label .state.sr -text {0000}\n"
  792. +"label .state.usp -text {00000000}\n"
  793. +"label .state.ssp -text {00000000}\n"
  794. +"\n"
  795. +"grid .state.l1 -column 0 -row 0 -sticky e -columnspan 2\n"
  796. +"grid .state.halted -column 2 -row 0 -sticky w -columnspan 2\n"
  797. +"\n"
  798. +"grid .state.l1x -column 0 -row 1 -sticky e -columnspan 2\n"
  799. +"grid .state.battery -column 2 -row 1 -sticky w -columnspan 2\n"
  800. +"\n"
  801. +"grid .state.l2 -column 0 -row 2 -sticky e -columnspan 2\n"
  802. +"grid .state.exception -column 2 -row 2 -sticky w -columnspan 2\n"
  803. +"\n"
  804. +"grid .state.l25 -column 0 -row 3 -sticky e -columnspan 2\n"
  805. +"grid .state.reset -column 2 -row 3 -sticky w -columnspan 2\n"
  806. +"\n"
  807. +"grid .state.l3 -column 0 -row 4 -sticky e -columnspan 2 \n"
  808. +"grid .state.funcname -column 2 -row 4 -sticky w -columnspan 2\n"
  809. +"\n"
  810. +"grid .state.l4 -column 0 -row 5 -sticky e -columnspan 2 \n"
  811. +"grid .state.funcstart -column 2 -row 5 -sticky w -columnspan 2\n"
  812. +"\n"
  813. +"grid .state.l5 -column 0 -row 6 -sticky e -columnspan 2 \n"
  814. +"grid .state.funcend -column 2 -row 6 -sticky w -columnspan 2\n"
  815. +"\n"
  816. +"frame .state.rule1 -relief raised -bd 2 -height 4\n"
  817. +"grid .state.rule1 -column 0 -row 7 -columnspan 4 -sticky ew\n"
  818. +"\n"
  819. +"grid .state.l6 -column 0 -row 8 -sticky e \n"
  820. +"grid .state.d0 -column 1 -row 8 -sticky w\n"
  821. +"grid .state.l7 -column 2 -row 8 -sticky e \n"
  822. +"grid .state.a0 -column 3 -row 8 -sticky w\n"
  823. +"\n"
  824. +"grid .state.l8 -column 0 -row 9 -sticky e \n"
  825. +"grid .state.d1 -column 1 -row 9 -sticky w\n"
  826. +"grid .state.l9 -column 2 -row 9 -sticky e \n"
  827. +"grid .state.a1 -column 3 -row 9 -sticky w\n"
  828. +"\n"
  829. +"grid .state.l10 -column 0 -row 10 -sticky e \n"
  830. +"grid .state.d2 -column 1 -row 10 -sticky w\n"
  831. +"grid .state.l11 -column 2 -row 10 -sticky e \n"
  832. +"grid .state.a2 -column 3 -row 10 -sticky w\n"
  833. +"\n"
  834. +"grid .state.l12 -column 0 -row 11 -sticky e \n"
  835. +"grid .state.d3 -column 1 -row 11 -sticky w\n"
  836. +"grid .state.l13 -column 2 -row 11 -sticky e \n"
  837. +"grid .state.a3 -column 3 -row 11 -sticky w\n"
  838. +"\n"
  839. +"grid .state.l14 -column 0 -row 12 -sticky e \n"
  840. +"grid .state.d4 -column 1 -row 12 -sticky w\n"
  841. +"grid .state.l15 -column 2 -row 12 -sticky e \n"
  842. +"grid .state.a4 -column 3 -row 12 -sticky w\n"
  843. +"\n"
  844. +"grid .state.l16 -column 0 -row 13 -sticky e \n"
  845. +"grid .state.d5 -column 1 -row 13 -sticky w\n"
  846. +"grid .state.l17 -column 2 -row 13 -sticky e \n"
  847. +"grid .state.a5 -column 3 -row 13 -sticky w\n"
  848. +"\n"
  849. +"grid .state.l18 -column 0 -row 14 -sticky e \n"
  850. +"grid .state.d6 -column 1 -row 14 -sticky w\n"
  851. +"grid .state.l19 -column 2 -row 14 -sticky e \n"
  852. +"grid .state.a6 -column 3 -row 14 -sticky w\n"
  853. +"\n"
  854. +"grid .state.l20 -column 0 -row 15 -sticky e \n"
  855. +"grid .state.d7 -column 1 -row 15 -sticky w\n"
  856. +"\n"
  857. +"grid .state.l21 -column 0 -row 16 -sticky e \n"
  858. +"grid .state.pc -column 1 -row 16 -sticky w\n"
  859. +"grid .state.l22 -column 2 -row 16 -sticky e \n"
  860. +"grid .state.sr -column 3 -row 16 -sticky w\n"
  861. +"\n"
  862. +"grid .state.l23 -column 0 -row 17 -sticky e \n"
  863. +"grid .state.usp -column 1 -row 17 -sticky w\n"
  864. +"grid .state.l24 -column 2 -row 17 -sticky e \n"
  865. +"grid .state.ssp -column 3 -row 17 -sticky w\n"
  866. +"\n"
  867. +"label .state.bl2 -text {B1:}\n"
  868. +"label .state.bl4 -text {B2:}\n"
  869. +"label .state.bl6 -text {B3:}\n"
  870. +"label .state.bl8 -text {B4:}\n"
  871. +"label .state.bl10 -text {B5:}\n"
  872. +"label .state.bl12 -text {B6:}\n"
  873. +"\n"
  874. +"label .state.b1 -text {00000000}\n"
  875. +"label .state.b1a -text {Off}\n"
  876. +"label .state.b2 -text {00000000}\n"
  877. +"label .state.b2a -text {Off}\n"
  878. +"label .state.b3 -text {00000000}\n"
  879. +"label .state.b3a -text {Off}\n"
  880. +"label .state.b4 -text {00000000}\n"
  881. +"label .state.b4a -text {Off}\n"
  882. +"label .state.b5 -text {00000000}\n"
  883. +"label .state.b5a -text {Off}\n"
  884. +"label .state.b6 -text {00000000}\n"
  885. +"label .state.b6a -text {Off}\n"
  886. +"\n"
  887. +"frame .state.rule2 -relief raised -bd 2 -height 4\n"
  888. +"grid .state.rule2 -column 0 -row 18 -columnspan 4 -sticky ew\n"
  889. +"\n"
  890. +"grid .state.bl2 -column 0 -row 19 -sticky e\n"
  891. +"grid .state.b1 -column 1 -row 19 -sticky w\n"
  892. +"grid .state.b1a -column 2 -row 19 -sticky w \n"
  893. +"\n"
  894. +"grid .state.bl4 -column 0 -row 20 -sticky e\n"
  895. +"grid .state.b2 -column 1 -row 20 -sticky w\n"
  896. +"grid .state.b2a -column 2 -row 20 -sticky w \n"
  897. +"\n"
  898. +"grid .state.bl6 -column 0 -row 21 -sticky e\n"
  899. +"grid .state.b3 -column 1 -row 21 -sticky w\n"
  900. +"grid .state.b3a -column 2 -row 21 -sticky w \n"
  901. +"\n"
  902. +"grid .state.bl8 -column 0 -row 22 -sticky e\n"
  903. +"grid .state.b4 -column 1 -row 22 -sticky w\n"
  904. +"grid .state.b4a -column 2 -row 22 -sticky w \n"
  905. +"\n"
  906. +"grid .state.bl10 -column 0 -row 23 -sticky e\n"
  907. +"grid .state.b5 -column 1 -row 23 -sticky w\n"
  908. +"grid .state.b5a -column 2 -row 23 -sticky w \n"
  909. +"\n"
  910. +"grid .state.bl12 -column 0 -row 24 -sticky e\n"
  911. +"grid .state.b6 -column 1 -row 24 -sticky w\n"
  912. +"grid .state.b6a -column 2 -row 24 -sticky w \n"
  913. +"\n"
  914. +"### /*** Generate debugger console window ***/\n"
  915. +"\n"
  916. +"wm title . \"Palm Debugger Console\"\n"
  917. +"catch {\n"
  918. +" wm iconbitmap . {@pix/case.xbm}\n"
  919. +" wm iconbitmap .remote {@pix/case.xbm}\n"
  920. +" wm iconbitmap .console {@pix/case.xbm}\n"
  921. +" wm iconbitmap .state {@pix/case.xbm}\n"
  922. +" #wm iconmask . {@pix/casemask.xbm}\n"
  923. +"}\n"
  924. +"\n"
  925. +"frame .m -relief raised\n"
  926. +"frame .f\n"
  927. +"scrollbar .f.y -orient vertical -command {.f.t yview}\n"
  928. +"text .f.t -yscrollcommand {.f.y set} -wrap word\n"
  929. +"pack .f.t -fill both -expand yes -side left\n"
  930. +"pack .f.y -fill y -side right\n"
  931. +"pack [menubutton .m.file -text {File} -menu .m.file.m] -side left\n"
  932. +"#pack [menubutton .m.edit -text {Edit} -menu .m.edit.m] -side left\n"
  933. +"pack [menubutton .m.windows -text {Windows} -menu .m.windows.m] -side left\n"
  934. +"#pack [menubutton .m.help -text {display_help} -menu .m.help.m] -side right\n"
  935. +"\n"
  936. +"menu .m.file.m\n"
  937. +"menu .m.windows.m\n"
  938. +"#menu .m.edit.m\n"
  939. +"#menu .m.help.m\n"
  940. +"\n"
  941. +"#wm iconify .remote\n"
  942. +"#wm iconify .console\n"
  943. +"#wm iconify .state\n"
  944. +"\n"
  945. +"\n"
  946. +"proc ShowWindow {name1 name2 op} {\n"
  947. +" global show\n"
  948. +" if {$show($name2)} {\n"
  949. +" if {[wm state $name2] != \"normal\"} {\n"
  950. +" wm deiconify $name2\n"
  951. +" }\n"
  952. +" } else {\n"
  953. +" if {[wm state $name2] == \"normal\"} {\n"
  954. +" wm withdraw $name2\n"
  955. +" }\n"
  956. +" }\n"
  957. +"}\n"
  958. +"\n"
  959. +"\n"
  960. +"trace variable show w {ShowWindow}\n"
  961. +"\n"
  962. +"bind .remote <Unmap> { set show(.remote) 0 }\n"
  963. +"bind .console <Unmap> { set show(.console) 0 }\n"
  964. +"bind .state <Unmap> { set show(.state) 0 }\n"
  965. +"\n"
  966. +"bind .remote <Map> { set show(.remote) 1 }\n"
  967. +"bind .console <Map> { set show(.console) 1 }\n"
  968. +"bind .state <Map> { set show(.state) 1 }\n"
  969. +"\n"
  970. +"wm protocol .remote WM_DELETE_WINDOW { set show(.remote) 0 }\n"
  971. +"wm protocol .console WM_DELETE_WINDOW { set show(.console) 0 }\n"
  972. +"wm protocol .state WM_DELETE_WINDOW { set show(.state) 0 }\n"
  973. +"\n"
  974. +"set show(.remote) 0\n"
  975. +"set show(.console) 0\n"
  976. +"set show(.state) 0\n"
  977. +"\n"
  978. +"\n"
  979. +".m.file.m add command -label {Exit} -command {exit}\n"
  980. +"\n"
  981. +".m.windows.m add checkbutton -label {Remote UI} -var show(.remote)\n"
  982. +".m.windows.m add checkbutton -label {Remote Console} -var show(.console)\n"
  983. +".m.windows.m add checkbutton -label {Remote State} -var show(.state)\n"
  984. +"\n"
  985. +"pack .m -side top -fill x\n"
  986. +"pack .f -side top -fill both -expand yes\n"
  987. +"focus .f.t\n"
  988. +"\n"
  989. +"### /*** Configure console bindings ***/\n"
  990. +"\n"
  991. +"bind .console.t <Shift-KeyPress-Return> {tkTextInsert .console.t \"\\n\" ; break}\n"
  992. +"bind .f.t <Shift-KeyPress-Return> {tkTextInsert .f.t \"\\n\" ; break}\n"
  993. +"\n"
  994. +"bind .console.t <Control-KeyPress-Return> {tkTextInsert .console.t \"\\n\" ; break}\n"
  995. +"bind .f.t <Control-KeyPress-Return> {tkTextInsert .f.t \"\\n\" ; break}\n"
  996. +"\n"
  997. +"bind .console.t <KeyPress-Return> {Console [.console.t get {insert linestart} {insert lineend}] ; break}\n"
  998. +"bind .f.t <KeyPress-Return> {\n"
  999. +" set line [.f.t get {insert linestart} {insert lineend}]\n"
  1000. +" set f [string first \">\" $line]\n"
  1001. +" incr f\n"
  1002. +" set line [string range $line $f end]\n"
  1003. +" .f.t mark set insert {insert lineend}\n"
  1004. +" .f.t insert insert \\n\n"
  1005. +" Debugger $line\n"
  1006. +" if {[.f.t compare insert != {insert linestart}]} {\n"
  1007. +" .f.t insert insert \"\\n\"\n"
  1008. +" }\n"
  1009. +" .f.t insert insert \"pilot-debug> \"\n"
  1010. +" .f.t see insert\n"
  1011. +" break\n"
  1012. +"}\n"
  1013. +"\n"
  1014. +"proc Console {cmd} {\n"
  1015. +" .console.t mark set insert {insert lineend}\n"
  1016. +" tkTextInsert .console.t \\n\n"
  1017. +" transmit $cmd\n"
  1018. +"}\n"
  1019. +"\n"
  1020. +"proc Debugger {cmd} {\n"
  1021. +" #.f.t mark set insert {insert lineend}\n"
  1022. +" #tkTextInsert .f.t \\n\n"
  1023. +" if {[string length [string trim $cmd]]!=0} {\n"
  1024. +" set code [catch {eval $cmd} message]\n"
  1025. +" if {[string length $message]} {\n"
  1026. +" set message [string trimright $message]\n"
  1027. +" Say \"$message\\n\"\n"
  1028. +" #if {[.f.t compare insert != {insert linestart}]} {\n"
  1029. +" # Say \"\\\n\"\n"
  1030. +" #}\n"
  1031. +" }\n"
  1032. +" }\n"
  1033. +"}\n"
  1034. +"\n"
  1035. +"proc Say {text} {\n"
  1036. +" global Interactive\n"
  1037. +" if {$Interactive} {\n"
  1038. +" .f.t insert insert \"$text\"\n"
  1039. +" .f.t see insert\n"
  1040. +" } else {\n"
  1041. +" upvar result result\n"
  1042. +" set result \"$result$text\"\n"
  1043. +" }\n"
  1044. +"}\n"
  1045. +"\n", NULL);
  1046. puts(interp->result);
  1047. created = 1;
  1048. @@ -2080,25 +2080,24 @@
  1049. static int proc_help(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
  1050. {
  1051. - Say("\
  1052. ---- display_help ---\n\
  1053. -g [<addr>] Go: Resume execution (if address is supplied,
  1054. - will start at that point)\n\
  1055. -t <addr1> [<addr2>] Till: Resume execution until addr1 (if addr2 is
  1056. - supplied, will start at that point)\n\
  1057. -coldboot Simulate the hard-reset (reset pin + power
  1058. - button press, i.e. lose all data)\n\
  1059. -warmboot Simulate a soft-reset (reset pin press)\n\
  1060. -pushbutton <button number> Simulate button push\n\
  1061. -mirror [bool] Continually view the Palm's screen in the
  1062. - Remote UI window (if bool supplied, can
  1063. - turn on or off mirroring, otherwise
  1064. - toggles)\n\
  1065. -getdisplay Show the Palm's display in the Remote UI
  1066. - window\n\
  1067. -updatedisplay Force a mirror refresh\n\
  1068. -feature Get/Set/Read Palm features\n\
  1069. -");
  1070. + Say("\n"
  1071. +"--- display_help ---\n\\n"
  1072. +"g [<addr>] Go: Resume execution (if address is supplied,\n"
  1073. +" will start at that point)\n\\n"
  1074. +"t <addr1> [<addr2>] Till: Resume execution until addr1 (if addr2 is\n"
  1075. +" supplied, will start at that point)\n\\n"
  1076. +"coldboot Simulate the hard-reset (reset pin + power\n"
  1077. +" button press, i.e. lose all data)\n\\n"
  1078. +"warmboot Simulate a soft-reset (reset pin press)\n\\n"
  1079. +"pushbutton <button number> Simulate button push\n\\n"
  1080. +"mirror [bool] Continually view the Palm's screen in the\n"
  1081. +" Remote UI window (if bool supplied, can\n"
  1082. +" turn on or off mirroring, otherwise\n"
  1083. +" toggles)\n\\n"
  1084. +"getdisplay Show the Palm's display in the Remote UI\n"
  1085. +" window\n\\n"
  1086. +"updatedisplay Force a mirror refresh\n\\n"
  1087. +"feature Get/Set/Read Palm features\n\\n");
  1088. return TCL_OK;
  1089. }
  1090. @@ -2151,55 +2150,54 @@
  1091. Tcl_CreateCommand(interp, cmds[i].name, cmds[i].proc, 0, NULL);
  1092. }
  1093. - Tcl_VarEval(interp,"\
  1094. -proc Say {text} {
  1095. - global Interactive
  1096. - if {$Interactive} {
  1097. - puts \"$text\"
  1098. - } else {
  1099. - upvar result result
  1100. - set result \"$result$text\"
  1101. - }
  1102. -}
  1103. -
  1104. -proc interactive {args} {
  1105. - global Interactive
  1106. - global errorInfo
  1107. - set hold $Interactive
  1108. - set Interactive 1
  1109. - set code [catch $args message]
  1110. - set Interactive $hold
  1111. - error $message $errorInfo $code
  1112. -}
  1113. -
  1114. -proc noninteractive {args} {
  1115. - global Interactive
  1116. - global errorInfo
  1117. - set hold $Interactive
  1118. - set Interactive 0
  1119. - set code [catch $args message]
  1120. - set Interactive $hold
  1121. - error $message $errorInfo $code
  1122. -}
  1123. -
  1124. -set Interactive 1
  1125. -
  1126. -proc bgerror {msg} {
  1127. - Say $msg
  1128. -}
  1129. -
  1130. -proc checkup {} {
  1131. - catch {noninteractive battery}
  1132. - after 10000 checkup
  1133. -}
  1134. -
  1135. -after 1000 checkup
  1136. -
  1137. -proc checkupin {time} {
  1138. - after $time {catch {noninteractive battery}}
  1139. -}
  1140. -
  1141. -",NULL);
  1142. + Tcl_VarEval(interp,
  1143. +"proc Say {text} {\n"
  1144. +" global Interactive\n"
  1145. +" if {$Interactive} {\n"
  1146. +" puts \"$text\"\n"
  1147. +" } else {\n"
  1148. +" upvar result result\n"
  1149. +" set result \"$result$text\"\n"
  1150. +" }\n"
  1151. +"}\n"
  1152. +"\n"
  1153. +"proc interactive {args} {\n"
  1154. +" global Interactive\n"
  1155. +" global errorInfo\n"
  1156. +" set hold $Interactive\n"
  1157. +" set Interactive 1\n"
  1158. +" set code [catch $args message]\n"
  1159. +" set Interactive $hold\n"
  1160. +" error $message $errorInfo $code\n"
  1161. +"}\n"
  1162. +"\n"
  1163. +"proc noninteractive {args} {\n"
  1164. +" global Interactive\n"
  1165. +" global errorInfo\n"
  1166. +" set hold $Interactive\n"
  1167. +" set Interactive 0\n"
  1168. +" set code [catch $args message]\n"
  1169. +" set Interactive $hold\n"
  1170. +" error $message $errorInfo $code\n"
  1171. +"}\n"
  1172. +"\n"
  1173. +"set Interactive 1\n"
  1174. +"\n"
  1175. +"proc bgerror {msg} {\n"
  1176. +" Say $msg\n"
  1177. +"}\n"
  1178. +"\n"
  1179. +"proc checkup {} {\n"
  1180. +" catch {noninteractive battery}\n"
  1181. +" after 10000 checkup\n"
  1182. +"}\n"
  1183. +"\n"
  1184. +"after 1000 checkup\n"
  1185. +"\n"
  1186. +"proc checkupin {time} {\n"
  1187. +" after $time {catch {noninteractive battery}}\n"
  1188. +"}\n"
  1189. +"\n", NULL);
  1190. Tcl_LinkVar(interp, "Interactive", (char*)&Interactive, TCL_LINK_INT);
  1191. @@ -2211,49 +2209,50 @@
  1192. Tcl_VarEval(interp,"set tkdbg 0", NULL);
  1193. #endif
  1194. - Say("Welcome to pilot-debug!\n\n\
  1195. - Type 'help' for further information.\n\
  1196. - Type 'exit' to quit the application\n\n");
  1197. + Say("Welcome to pilot-debug!\n\n"
  1198. +" Type 'help' for further information.\n"
  1199. +" Type 'exit' to quit the application\n");
  1200. #if 0
  1201. - Say("\tWelcome to pilot-debug!\n\n\
  1202. -
  1203. -Please connect your Palm and start console or debugging mode.\n\n\
  1204. -
  1205. -(Console mode is a background task that can respond to a few commands,\n
  1206. -most importantly RPC which lets any function on the Palm be invoked. The\n
  1207. -Palm operates as usual while console mode is active, except that since\n
  1208. -the serial port is held open, HotSync and other applications that use\n
  1209. -the serial port will not work. Debug mode is activated on demand or when\n
  1210. -the Palm crashes. In debug mode, the CPU is halted, and no commands may\n
  1211. -be executed, except via a debugging console like this one.)\n\n\
  1212. -
  1213. -In the absence of special utilities, the console can be started by the\n
  1214. -\".2\" shortcut, and debugging via \".1\". To clear either mode,\n
  1215. -reboot via the reset button. If console mode is active, you may also\n
  1216. -reboot via the \"coldboot\" or \"warmboot\" commands.\n\n\
  1217. -
  1218. -The Remote UI window lets you manipulate the Palm if console mode is\n
  1219. -active. By clicking the mouse button on the screen or buttons, you can\n
  1220. -simulate pen taps, and if you type anything while the window has the\n
  1221. -focus, the Palm will receive the keystrokes.\n\n\
  1222. -
  1223. -The Remote Console window is specifically for the transmission and\n
  1224. -reception of console packets. Pressing Return on a line will transmit\n
  1225. -it, and any incoming packets will be displayed here in addition to the\n
  1226. -Debug Console.\n\n\
  1227. -
  1228. -The Remote State window shows the current Palm CPU state. It is only\n
  1229. -updated on request or when the Palm halts.\n\n\
  1230. -
  1231. -
  1232. -The Debugging Console window is the primary interface for pilot-debug.\n
  1233. -Pressing Return on a line that contains text will execute that line as\n
  1234. -a Tcl command. (Try 'expr 3+4'.) All of the usual Tcl and Tk commands\n
  1235. -are available, as well as some special-purpose ones, including 'help',\n
  1236. -'coldboot', 'warmboot', 'attach', 't', and 'g', (the last one continues\n
  1237. -after the Palm halts.)\n\n\ Execute 'help' for the list of commands\n
  1238. -currently implemented.\n\n\ ");
  1239. + Say(
  1240. +"\tWelcome to pilot-debug!\n\n"
  1241. +"\n"
  1242. +"Please connect your Palm and start console or debugging mode.\n\n\\n"
  1243. +"\n"
  1244. +"(Console mode is a background task that can respond to a few commands,\n\n"
  1245. +"most importantly RPC which lets any function on the Palm be invoked. The\n\n"
  1246. +"Palm operates as usual while console mode is active, except that since\n\n"
  1247. +"the serial port is held open, HotSync and other applications that use\n\n"
  1248. +"the serial port will not work. Debug mode is activated on demand or when\n\n"
  1249. +"the Palm crashes. In debug mode, the CPU is halted, and no commands may\n\n"
  1250. +"be executed, except via a debugging console like this one.)\n\n\\n"
  1251. +"\n"
  1252. +"In the absence of special utilities, the console can be started by the\n\n"
  1253. +"\".2\" shortcut, and debugging via \".1\". To clear either mode,\n\n"
  1254. +"reboot via the reset button. If console mode is active, you may also\n\n"
  1255. +"reboot via the \"coldboot\" or \"warmboot\" commands.\n\n\\n"
  1256. +"\n"
  1257. +"The Remote UI window lets you manipulate the Palm if console mode is\n\n"
  1258. +"active. By clicking the mouse button on the screen or buttons, you can\n\n"
  1259. +"simulate pen taps, and if you type anything while the window has the\n\n"
  1260. +"focus, the Palm will receive the keystrokes.\n\n\\n"
  1261. +"\n"
  1262. +"The Remote Console window is specifically for the transmission and\n\n"
  1263. +"reception of console packets. Pressing Return on a line will transmit\n\n"
  1264. +"it, and any incoming packets will be displayed here in addition to the\n\n"
  1265. +"Debug Console.\n\n\ \n"
  1266. +"\n"
  1267. +"The Remote State window shows the current Palm CPU state. It is only\n\n"
  1268. +"updated on request or when the Palm halts.\n\n\\n"
  1269. +"\n"
  1270. +"\n"
  1271. +"The Debugging Console window is the primary interface for pilot-debug.\n\n"
  1272. +"Pressing Return on a line that contains text will execute that line as\n\n"
  1273. +"a Tcl command. (Try 'expr 3+4'.) All of the usual Tcl and Tk commands\n\n"
  1274. +"are available, as well as some special-purpose ones, including 'help',\n\n"
  1275. +"'coldboot', 'warmboot', 'attach', 't', and 'g', (the last one continues\n\n"
  1276. +"after the Palm halts.)\n\n\ Execute 'help' for the list of commands\n\n"
  1277. +"currently implemented.\n\n\ ");
  1278. #endif
  1279. /* Specify a user-specific startup file to invoke if the application is
  1280. @@ -2263,26 +2262,24 @@
  1281. Tcl_SetVar(interp, "tcl_rcFileName", "~/.pdebugrc", TCL_GLOBAL_ONLY);
  1282. - Tcl_VarEval(interp,"\
  1283. - set tcl_prompt1 myprompt
  1284. - proc myprompt {} {
  1285. - puts -nonewline \"pilot-debug> \"
  1286. - }
  1287. -
  1288. - ",NULL);
  1289. + Tcl_VarEval(interp,
  1290. +" set tcl_prompt1 myprompt\n"
  1291. +" proc myprompt {} {\n"
  1292. +" puts -nonewline \"pilot-debug> \"\n"
  1293. +" }\n"
  1294. +" \n", NULL);
  1295. /* Deal with command-line arguments */
  1296. - Tcl_VarEval(interp,"\
  1297. - if {$argc > 0} {
  1298. - set p [lindex $argv 0]
  1299. - set argv [lrange $argv 1 end]
  1300. - port $p
  1301. - } else {
  1302. - Say \"As you have not entered a serial port on the command like, you might like to \
  1303. -set one with 'port /dev/something'\\n\\n\"
  1304. - }
  1305. - ",NULL);
  1306. + Tcl_VarEval(interp,
  1307. +" if {$argc > 0} {\n"
  1308. +" set p [lindex $argv 0]\n"
  1309. +" set argv [lrange $argv 1 end]\n"
  1310. +" port $p\n"
  1311. +" } else {\n"
  1312. +" Say \"As you have not entered a serial port on the command like, you might like to \\n"
  1313. +"set one with 'port /dev/something'\\n\\n\"\n"
  1314. +" }\n", NULL);
  1315. return TCL_OK;
  1316. }