PageRenderTime 48ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/DyneTK/fltk/Flio_Inspector.cxx

http://dynee5.googlecode.com/
C++ | 614 lines | 425 code | 76 blank | 113 comment | 50 complexity | ff149f9f9427eb7a2f5a81abd8621607 MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.0
  1. //
  2. // "$Id$"
  3. //
  4. // Flio_Inspector implementation for the FLIO extension to FLTK.
  5. //
  6. // Copyright 2002-2007 by Matthias Melcher.
  7. //
  8. // This library is free software; you can redistribute it and/or
  9. // modify it under the terms of the GNU Library General Public
  10. // License as published by the Free Software Foundation; either
  11. // version 2 of the License, or (at your option) any later version.
  12. //
  13. // This library is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. // Library General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Library General Public
  19. // License along with this library; if not, write to the Free Software
  20. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  21. // USA.
  22. //
  23. // Please report all bugs and problems to "flio@matthiasm.com".
  24. //
  25. #include "Flio_Inspector.h"
  26. #include "globals.h"
  27. #include "allNewt.h"
  28. #include <stdlib.h>
  29. #include <stdio.h>
  30. #include <string.h>
  31. #include <ctype.h>
  32. #include <FL/Fl_Button.H>
  33. #include <FL/Fl_Image.H>
  34. #ifndef WIN32
  35. # define Sleep(a) sleep((a)/1000)
  36. //# define Sleep(a) usleep((a)*1000)
  37. # include <unistd.h>
  38. # include <arpa/inet.h>
  39. #else
  40. # include <windows.h>
  41. # include <winsock2.h>
  42. #endif
  43. extern Fl_Button *wInspectorConnect;
  44. extern Fl_Image *toolbox_open_pixmap;
  45. extern Fl_Image *toolbox_closed_pixmap;
  46. extern Fl_Window *wConnect;
  47. Flio_Inspector::Flio_Inspector(int X, int Y, int W, int H, const char *L)
  48. : Flio_Mnp4_Protocol(X, Y, W, H, L),
  49. pattern_(0L),
  50. nPattern_(0),
  51. NPattern_(0),
  52. found_(0L),
  53. received_(0L),
  54. error_(0L),
  55. buffer_(0L),
  56. nBuffer_(0),
  57. NBuffer_(0),
  58. nReceive_(0)
  59. {
  60. }
  61. Flio_Inspector::~Flio_Inspector()
  62. {
  63. }
  64. /*---------------------------------------------------------------------------*/
  65. /**
  66. * Compile and send a script command to the Newton.
  67. */
  68. int Flio_Inspector::sendScript(const char *script)
  69. {
  70. // compile the string
  71. NEWT_DUMPBC = 1;
  72. //NEWT_DUMPSYNTAX = 1;
  73. newtRefVar obj = NBCCompileStr((char*)script, true);
  74. // FIXME test for error
  75. //NewtPrintObject(stdout, obj);
  76. newtRefVar nsof = NsMakeNSOF(0, obj, NewtMakeInt30(2));
  77. // FIXME test for error
  78. //NewtPrintObject(stdout, nsof);
  79. // if it is a binary, send it to the inspector
  80. if (NewtRefIsBinary(nsof)) {
  81. uint32_t size = NewtBinaryLength(nsof);
  82. uint8_t *data = NewtRefToBinary(nsof);
  83. send_data_block((unsigned char*)"newt", 4);
  84. send_data_block((unsigned char*)"ntp ", 4);
  85. send_data_block((unsigned char*)"lscb", 4);
  86. unsigned char b1[] = { size>>24, size>>16, size>>8, size };
  87. send_data_block(b1, 4);
  88. send_data_block((unsigned char*)data, size);
  89. }
  90. return 0;
  91. }
  92. /*---------------------------------------------------------------------------*/
  93. int Flio_Inspector::deletePackage(const char *symbol)
  94. {
  95. // hack to convert the (usually ASCII) symbol into a UTF16BE
  96. int sLen = 2*strlen(symbol)+2;
  97. char *sName = (char*)calloc(sLen, 1);
  98. const char *s = symbol;
  99. char *d = sName;
  100. while (*s) { *d++ = 0; *d++ = *s++; }
  101. // send "Delete Package"
  102. send_data_block((unsigned char*)"newt", 4);
  103. send_data_block((unsigned char*)"ntp ", 4);
  104. send_data_block((unsigned char*)"pkgX", 4);
  105. uint32_t len = htonl(sLen);
  106. send_data_block((unsigned char*)(&len), 4);
  107. send_data_block((unsigned char*)sName, sLen);
  108. free(sName);
  109. Sleep(1000); // 1 sec.
  110. return 0;
  111. }
  112. /*---------------------------------------------------------------------------*/
  113. int Flio_Inspector::sendPackage(const char *filename)
  114. {
  115. // read the package itself from disk
  116. uint8_t *buffer;
  117. FILE *f = fopen(filename, "rb");
  118. if (!f) {
  119. InspectorPrintf("Can't open package %s\n", filename);
  120. }
  121. fseek(f, 0, SEEK_END);
  122. int nn = ftell(f);
  123. fseek(f, 0, SEEK_SET);
  124. buffer = (uint8_t*)malloc(nn);
  125. fread(buffer, 1, nn, f);
  126. fclose(f);
  127. // send the package
  128. send_data_block((unsigned char*)"newt", 4);
  129. send_data_block((unsigned char*)"ntp ", 4);
  130. send_data_block((unsigned char*)"pkg ", 4);
  131. uint32_t len = htonl(nn);
  132. send_data_block((unsigned char*)(&len), 4);
  133. Sleep(1000);
  134. send_data_block((unsigned char*)buffer, nn);
  135. free(buffer);
  136. return 0;
  137. }
  138. int Flio_Inspector::open(const char *port, int bps)
  139. {
  140. int err = Flio_Mnp4_Protocol::open(port, bps);
  141. waitForCommand();
  142. return err;
  143. }
  144. unsigned char term1[4] = {
  145. 0x6e, 0x65, 0x77, 0x74,
  146. // newt
  147. };
  148. unsigned char term2[4] = {
  149. 0x6e, 0x74, 0x70, 0x20,
  150. // ntp
  151. };
  152. unsigned char term3[4] = {
  153. 0x74, 0x65, 0x72, 0x6d,
  154. // term
  155. };
  156. unsigned char term4[4] = {
  157. 0x00, 0x00, 0x00, 0x00,
  158. // ....
  159. };
  160. void Flio_Inspector::cancel()
  161. {
  162. close();
  163. Sleep(1000);
  164. Flio_Mnp4_Protocol::close();
  165. }
  166. void Flio_Inspector::close()
  167. {
  168. send_data_block(term1, sizeof(term1));
  169. send_data_block(term2, sizeof(term2));
  170. send_data_block(term3, sizeof(term3));
  171. send_data_block(term4, sizeof(term4));
  172. // FIXME: actually, we should wait for the request to terminate by the Newton
  173. // and reply accordingly
  174. //Flio_Mnp4_Serial::close();
  175. }
  176. int Flio_Inspector::on_connect()
  177. {
  178. wInspectorConnect->image(toolbox_open_pixmap);
  179. UpdateMainMenu();
  180. if (wConnect)
  181. wConnect->hide();
  182. return 1;
  183. }
  184. int Flio_Inspector::on_disconnect()
  185. {
  186. wInspectorConnect->image(toolbox_closed_pixmap);
  187. wInspectorConnect->redraw();
  188. UpdateMainMenu();
  189. return 1;
  190. }
  191. static unsigned char send_okln1[] = { 0x6E, 0x65, 0x77, 0x74, 0x6E, 0x74, 0x70, 0x20, };
  192. static unsigned char send_okln2[] = { 0x6F, 0x6B, 0x6C, 0x6E, };
  193. static unsigned char send_okln3[] = { 0x00, 0x01, 0x00, 0x00, 0x00, };
  194. int Flio_Inspector::on_receive()
  195. {
  196. int n = get_block_size();
  197. unsigned char *buf = get_block();
  198. if (buf[1]==4) {
  199. int offset = buf[0]+1;
  200. buf += offset;
  201. n -= offset;
  202. /*
  203. while (n>0) {
  204. if (!consume_block(buf, n)) {
  205. printf("**** WARNING: unidentified block\n");
  206. return 0;
  207. }
  208. }*/
  209. while (n) {
  210. if (nPattern_) {
  211. // we are scanning for a pattern
  212. if (nBuffer_<nPattern_) {
  213. buffer_[nBuffer_++] = buf[0];
  214. buf++; n--;
  215. } else {
  216. memmove(buffer_, buffer_+1, nPattern_-1);
  217. buffer_[nBuffer_-1] = buf[0];
  218. buf++; n--;
  219. }
  220. if (nBuffer_==nPattern_ && memcmp(buffer_, pattern_, nPattern_)==0)
  221. (this->*found_)();
  222. else if (nBuffer_==nPattern_)
  223. printf("Can't sync\n");
  224. } else {
  225. if (nBuffer_<nReceive_) {
  226. buffer_[nBuffer_++] = buf[0];
  227. buf++; n--;
  228. }
  229. if (nBuffer_==nReceive_)
  230. (this->*received_)();
  231. }
  232. }
  233. return 1;
  234. } else {
  235. printf("**** ERROR: unexpected block type %d\n", buf[1]);
  236. return 0;
  237. }
  238. }
  239. #include "fltk/Flmm_Console.h"
  240. extern Flmm_Console *wConsole;
  241. unsigned int Flio_Inspector::get_uint(const unsigned char *src)
  242. {
  243. return (src[0]<<24)|(src[1]<<16)|(src[2]<<8)|(src[3]);
  244. }
  245. int Flio_Inspector::scan_for(unsigned char *pattern, int size, Call found, Call error, double timeout)
  246. {
  247. if (NPattern_<size) {
  248. NPattern_ = size+32;
  249. pattern_ = (unsigned char*)realloc(pattern_, NPattern_);
  250. }
  251. if (NBuffer_<size) {
  252. NBuffer_ = size+256;
  253. buffer_ = (unsigned char*)realloc(buffer_, NBuffer_);
  254. }
  255. memcpy(pattern_, pattern, size);
  256. nPattern_ = size;
  257. nBuffer_ = 0;
  258. nReceive_ = 0;
  259. found_ = found;
  260. error_ = error;
  261. return 0;
  262. }
  263. int Flio_Inspector::wait_for(int n, Call received, Call error, double timeout)
  264. {
  265. nBuffer_ = 0;
  266. return wait_for_more(n, received, error, timeout);
  267. }
  268. int Flio_Inspector::wait_for_more(int n, Call received, Call error, double timeout)
  269. {
  270. int size = nBuffer_ + n;
  271. if (NBuffer_<size+2) { // always have space to add a trailing zero in UTF-16!
  272. NBuffer_ = size+256;
  273. buffer_ = (unsigned char*)realloc(buffer_, NBuffer_);
  274. }
  275. nPattern_ = 0;
  276. nReceive_ = nBuffer_ + n;
  277. received_ = received;
  278. error_ = error;
  279. if (n==0)
  280. (this->*received_)();
  281. return 0;
  282. }
  283. void Flio_Inspector::waitForCommand() {
  284. scan_for((unsigned char*)"newtntp ", 8, &Flio_Inspector::gotNewtNtk, &Flio_Inspector::gotErr);
  285. }
  286. void Flio_Inspector::gotErr() {
  287. printf("*** ERROR *** while waiting for data\n");
  288. }
  289. void Flio_Inspector::gotNewtNtk() {
  290. wait_for_more(4, &Flio_Inspector::gotNewtNtk4, &Flio_Inspector::gotErr);
  291. }
  292. void Flio_Inspector::gotNewtNtk4() {
  293. //printf("gotNewtNtk4 '%.4s'\n", buffer_+8);
  294. if (memcmp(buffer_+8, "cnnt", 4)==0)
  295. // cnnt: wait for a size and unknown block. Send connection ack
  296. wait_for_more(4, &Flio_Inspector::gotNewtNtkCnnt, &Flio_Inspector::gotErr);
  297. else if (memcmp(buffer_+8, "fobj", 4)==0)
  298. // fobj: size, NSOF
  299. wait_for_more(4, &Flio_Inspector::gotNewtNtkFobj, &Flio_Inspector::gotErr);
  300. else if (memcmp(buffer_+8, "rslt", 4)==0)
  301. // rslt: wait for size and a result code identifier
  302. wait_for_more(4, &Flio_Inspector::gotNewtNtkRslt, &Flio_Inspector::gotErr);
  303. else if (memcmp(buffer_+8, "text", 4)==0)
  304. // text: wait for size, then text block, then dump to console
  305. wait_for_more(4, &Flio_Inspector::gotNewtNtkText, &Flio_Inspector::gotErr);
  306. else if (memcmp(buffer_+8, "eerr", 4)==0)
  307. // eerr: exception, size, text
  308. wait_for_more(8, &Flio_Inspector::gotNewtNtkEerr, &Flio_Inspector::gotErr);
  309. else if (memcmp(buffer_+8, "eref", 4)==0)
  310. // eerr: size, text, text, errno, garble
  311. wait_for_more(4, &Flio_Inspector::gotNewtNtkEref, &Flio_Inspector::gotErr);
  312. else if (memcmp(buffer_+8, "fstk", 4)==0)
  313. // fstk: size, stack dump in NSOF format
  314. wait_for_more(4, &Flio_Inspector::gotNewtNtkFstk, &Flio_Inspector::gotErr);
  315. else if (memcmp(buffer_+8, "eext", 4)==0)
  316. // eext: ?? just dump
  317. wait_for_more(4, &Flio_Inspector::gotNewtNtkFstk, &Flio_Inspector::gotErr);
  318. else {
  319. printf("*** ERROR *** Inspector received unknown command %.4s\n", buffer_+8);
  320. waitForCommand();
  321. }
  322. }
  323. void Flio_Inspector::gotNewtNtkCnnt() {
  324. send_data_block(send_okln1, sizeof(send_okln1));
  325. send_data_block(send_okln2, sizeof(send_okln2));
  326. send_data_block(send_okln3, sizeof(send_okln3));
  327. unsigned int n = get_uint(buffer_+12);
  328. wait_for_more(n, &Flio_Inspector::waitForCommand, &Flio_Inspector::gotErr);
  329. }
  330. void Flio_Inspector::gotNewtNtkRslt() {
  331. unsigned int n = get_uint(buffer_+12);
  332. wait_for_more(n, &Flio_Inspector::waitForCommand, &Flio_Inspector::gotErr);
  333. }
  334. void Flio_Inspector::gotNewtNtkFobj() {
  335. unsigned int n = get_uint(buffer_+12);
  336. wait_for_more(n, &Flio_Inspector::gotNewtNtkFobjSize, &Flio_Inspector::gotErr);
  337. }
  338. void Flio_Inspector::gotNewtNtkFobjSize() {
  339. newtRef obj = NewtReadNSOF((uint8_t*)(buffer_+0x10), nBuffer_-0x10);
  340. if (NewtRefIsFrame(obj)) {
  341. newtRef interp = NewtGetFrameSlot(obj, NewtFindSlotIndex(obj, NSSYM(interpretation)));
  342. if (NewtRefIsSymbol(interp)) {
  343. if (NewtSymbolEqual(interp, NSSYM(screenshot))) {
  344. InspectorSnapshotUpdate(obj);
  345. goto done;
  346. }
  347. }
  348. }
  349. #ifdef _DEBUG
  350. //dumpBuffer();
  351. NewtPrintObject(stdout, obj);
  352. #endif
  353. done:
  354. waitForCommand();
  355. }
  356. void Flio_Inspector::gotNewtNtkText() {
  357. unsigned int n = get_uint(buffer_+12);
  358. wait_for_more(n, &Flio_Inspector::gotNewtNtkTextSize, &Flio_Inspector::gotErr);
  359. }
  360. void Flio_Inspector::gotNewtNtkTextSize() {
  361. unsigned int i, n = get_uint(buffer_+12);
  362. unsigned char *s = buffer_+16;
  363. for (i=0; i<n; i++) {
  364. if (*s=='\r') *s = '\n';
  365. s++;
  366. }
  367. *s = 0;
  368. wConsole->insert((char*)buffer_+16);
  369. waitForCommand();
  370. }
  371. void Flio_Inspector::gotNewtNtkEerr() {
  372. unsigned int n = get_uint(buffer_+16);
  373. wait_for_more(n, &Flio_Inspector::gotNewtNtkEerrSize, &Flio_Inspector::gotErr);
  374. }
  375. void Flio_Inspector::gotNewtNtkEerrSize() {
  376. unsigned int i, n = get_uint(buffer_+16);
  377. /*unsigned int ex =*/ get_uint(buffer_+12);
  378. unsigned char *s = buffer_+20;
  379. for (i=0; i<n; i++) {
  380. if (*s=='\r') *s = '\n';
  381. s++;
  382. }
  383. *s = 0;
  384. wConsole->insert((char*)buffer_+20);
  385. waitForCommand();
  386. }
  387. void Flio_Inspector::gotNewtNtkEref() {
  388. unsigned int n = get_uint(buffer_+12);
  389. wait_for_more(n+8, &Flio_Inspector::gotNewtNtkErefSize, &Flio_Inspector::gotErr);
  390. }
  391. void Flio_Inspector::gotNewtNtkErefSize() {
  392. unsigned int i;
  393. /*unsigned int n =*/ get_uint(buffer_+12);
  394. unsigned int n1 = get_uint(buffer_+16);
  395. /*unsigned int n2 =*/ get_uint(buffer_+20+n1);
  396. unsigned char *s = buffer_+20;
  397. for (i=0; i<n1; i++) {
  398. if (*s=='\r') *s = '\n';
  399. s++;
  400. }
  401. *s = 0; // ouch!
  402. wConsole->insert("Exception: ");
  403. wConsole->insert((char*)buffer_+20);
  404. wConsole->insert("\n");
  405. // at n2, we have an NSOF containing errorCode and symbol
  406. waitForCommand();
  407. }
  408. void Flio_Inspector::gotNewtNtkFstk() {
  409. unsigned int n = get_uint(buffer_+12);
  410. wait_for_more(n, &Flio_Inspector::gotNewtNtkFstkSize, &Flio_Inspector::gotErr);
  411. }
  412. void Flio_Inspector::gotNewtNtkFstkSize() {
  413. wConsole->insert("Unhandled fstk chunk\n");
  414. dumpBuffer();
  415. waitForCommand();
  416. }
  417. void Flio_Inspector::dumpBuffer()
  418. {
  419. int i, j;
  420. for (i=0; i<nBuffer_; i+=16) {
  421. char buf[78];
  422. memset(buf, 32, 78); buf[76] = '\n'; buf[77] = 0;
  423. sprintf(buf, "%08x", i); buf[8] = ' ';
  424. for (j=i; (j<i+16) && (j<nBuffer_); j++) {
  425. unsigned char c = buffer_[j];
  426. sprintf(buf+10+3*(j-i), "%02x", c); buf[12+3*(j-i)] = ' ';
  427. if (isprint(c))
  428. buf[59+j-i] = c;
  429. else
  430. buf[59+j-i] = '.';
  431. }
  432. wConsole->insert(buf);
  433. }
  434. }
  435. // This happens when we press "EXIT": newtntp code
  436. unsigned char dataX0219[150] = {
  437. 0x02, 0x06, 0x06, 0x07, 0x05, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x07, 0x0c, 0x69, 0x6e, 0x73, 0x74,
  438. 0x72, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x07, 0x08, 0x6c, 0x69, 0x74, 0x65, 0x72, 0x61,
  439. 0x6c, 0x73, 0x07, 0x08, 0x61, 0x72, 0x67, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x07, 0x07, 0x6e, 0x75,
  440. 0x6d, 0x41, 0x72, 0x67, 0x73, 0x07, 0x0c, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x65, 0x72, 0x49,
  441. 0x6e, 0x66, 0x6f, 0x07, 0x09, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x03, 0x03,
  442. 0x09, 0x02, 0x18, 0x28, 0x02, 0x04, 0x01, 0x09, 0x03, 0x07, 0x0d, 0x45, 0x78, 0x69, 0x74, 0x42,
  443. 0x72, 0x65, 0x61, 0x6b, 0x4c, 0x6f, 0x6f, 0x70, 0x06, 0x03, 0x07, 0x0d, 0x5f, 0x6e, 0x65, 0x78,
  444. 0x74, 0x41, 0x72, 0x67, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x07, 0x07, 0x5f, 0x70, 0x61, 0x72, 0x65,
  445. 0x6e, 0x74, 0x07, 0x0c, 0x5f, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x6f, 0x72,
  446. 0x0a, 0x0a, 0x0a, 0x00, 0x00, 0x0a,
  447. // .....class..instructions..literals..argFrame..numArgs..DebuggerI
  448. // nfo..CodeBlock.....(.......ExitBreakLoop...._nextArgFrame.._pare
  449. // nt.._implementor......
  450. };
  451. // changing the stack trace: newtntp code
  452. unsigned char dataX0179[147] = {
  453. 0x02, 0x06, 0x06, 0x07, 0x05, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x07, 0x0c, 0x69, 0x6e, 0x73, 0x74,
  454. 0x72, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x07, 0x08, 0x6c, 0x69, 0x74, 0x65, 0x72, 0x61,
  455. 0x6c, 0x73, 0x07, 0x08, 0x61, 0x72, 0x67, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x07, 0x07, 0x6e, 0x75,
  456. 0x6d, 0x41, 0x72, 0x67, 0x73, 0x07, 0x0c, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x65, 0x72, 0x49,
  457. 0x6e, 0x66, 0x6f, 0x07, 0x09, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x03, 0x03,
  458. 0x09, 0x02, 0x18, 0x28, 0x02, 0x04, 0x01, 0x09, 0x03, 0x07, 0x0a, 0x53, 0x74, 0x61, 0x63, 0x6b,
  459. 0x54, 0x72, 0x61, 0x63, 0x65, 0x06, 0x03, 0x07, 0x0d, 0x5f, 0x6e, 0x65, 0x78, 0x74, 0x41, 0x72,
  460. 0x67, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x07, 0x07, 0x5f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x07,
  461. 0x0c, 0x5f, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x0a, 0x0a, 0x0a,
  462. 0x00, 0x00, 0x0a,
  463. // .....class..instructions..literals..argFrame..numArgs..DebuggerI
  464. // nfo..CodeBlock.....(.......StackTrace...._nextArgFrame.._parent.
  465. // ._implementor......
  466. };
  467. // changing the print depth: newtntp code
  468. unsigned char dataX0141[148] = {
  469. 0x02, 0x06, 0x06, 0x07, 0x05, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x07, 0x0c, 0x69, 0x6e, 0x73, 0x74,
  470. 0x72, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x07, 0x08, 0x6c, 0x69, 0x74, 0x65, 0x72, 0x61,
  471. 0x6c, 0x73, 0x07, 0x08, 0x61, 0x72, 0x67, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x07, 0x07, 0x6e, 0x75,
  472. 0x6d, 0x41, 0x72, 0x67, 0x73, 0x07, 0x0c, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x65, 0x72, 0x49,
  473. 0x6e, 0x66, 0x6f, 0x07, 0x09, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x03, 0x04,
  474. 0x09, 0x02, 0x20, 0xa8, 0x70, 0x02, 0x04, 0x01, 0x09, 0x03, 0x07, 0x0a, 0x70, 0x72, 0x69, 0x6e,
  475. 0x74, 0x44, 0x65, 0x70, 0x74, 0x68, 0x06, 0x03, 0x07, 0x0d, 0x5f, 0x6e, 0x65, 0x78, 0x74, 0x41,
  476. 0x72, 0x67, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x07, 0x07, 0x5f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74,
  477. 0x07, 0x0c, 0x5f, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x0a, 0x0a,
  478. 0x0a, 0x00, 0x00, 0x0a,
  479. // .....class..instructions..literals..argFrame..numArgs..DebuggerI
  480. // nfo..CodeBlock.... ?p.......printDepth...._nextArgFrame.._parent
  481. // .._implementor......
  482. };
  483. // pressing the "trace" button: newtntp code
  484. unsigned char dataX0068[143] = {
  485. 0x02, 0x06, 0x06, 0x07, 0x05, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x07, 0x0c, 0x69, 0x6e, 0x73, 0x74,
  486. 0x72, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x07, 0x08, 0x6c, 0x69, 0x74, 0x65, 0x72, 0x61,
  487. 0x6c, 0x73, 0x07, 0x08, 0x61, 0x72, 0x67, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x07, 0x07, 0x6e, 0x75,
  488. 0x6d, 0x41, 0x72, 0x67, 0x73, 0x07, 0x0c, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x65, 0x72, 0x49,
  489. 0x6e, 0x66, 0x6f, 0x07, 0x09, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x03, 0x04,
  490. 0x09, 0x02, 0x22, 0xa8, 0x70, 0x02, 0x04, 0x01, 0x09, 0x03, 0x07, 0x05, 0x74, 0x72, 0x61, 0x63,
  491. 0x65, 0x06, 0x03, 0x07, 0x0d, 0x5f, 0x6e, 0x65, 0x78, 0x74, 0x41, 0x72, 0x67, 0x46, 0x72, 0x61,
  492. 0x6d, 0x65, 0x07, 0x07, 0x5f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x07, 0x0c, 0x5f, 0x69, 0x6d,
  493. 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x0a, 0x0a, 0x0a, 0x00, 0x00, 0x0a,
  494. // .....class..instructions..literals..argFrame..numArgs..DebuggerI
  495. // nfo..CodeBlock...."?p.......trace...._nextArgFrame.._parent.._im
  496. // plementor......
  497. };
  498. // pressing "stop":
  499. unsigned char dataX0018[153] = {
  500. 0x02, 0x06, 0x06, 0x07, 0x05, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x07, 0x0c, 0x69, 0x6e, 0x73, 0x74,
  501. 0x72, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x07, 0x08, 0x6c, 0x69, 0x74, 0x65, 0x72, 0x61,
  502. 0x6c, 0x73, 0x07, 0x08, 0x61, 0x72, 0x67, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x07, 0x07, 0x6e, 0x75,
  503. 0x6d, 0x41, 0x72, 0x67, 0x73, 0x07, 0x0c, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x65, 0x72, 0x49,
  504. 0x6e, 0x66, 0x6f, 0x07, 0x09, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x03, 0x06,
  505. 0x09, 0x02, 0x27, 0x00, 0x1a, 0xa8, 0x70, 0x02, 0x04, 0x01, 0x09, 0x03, 0x07, 0x0d, 0x62, 0x72,
  506. 0x65, 0x61, 0x6b, 0x4f, 0x6e, 0x54, 0x68, 0x72, 0x6f, 0x77, 0x73, 0x06, 0x03, 0x07, 0x0d, 0x5f,
  507. 0x6e, 0x65, 0x78, 0x74, 0x41, 0x72, 0x67, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x07, 0x07, 0x5f, 0x70,
  508. 0x61, 0x72, 0x65, 0x6e, 0x74, 0x07, 0x0c, 0x5f, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e,
  509. 0x74, 0x6f, 0x72, 0x0a, 0x0a, 0x0a, 0x00, 0x00, 0x0a,
  510. // .....class..instructions..literals..argFrame..numArgs..DebuggerI
  511. // nfo..CodeBlock....'..?p.......breakOnThrows...._nextArgFrame.._p
  512. // arent.._implementor......
  513. };
  514. /*
  515. "pkgX" DeletePackage
  516. "code" HandleCodeBlock which takes an NSOF function frame and
  517. interpretes it.
  518. "rslt" Returns some result back to NTK
  519. "text" Sends some text header to NTK
  520. "eext" Enter Breakloop
  521. "bext" Exit Breakloop
  522. "eref" Sends Exception Data (cahr *msg, RefArg data)
  523. "estr" Sends Exception Data (char *msg, char *data)
  524. "eerr" Sends Exception Data (char *msg, long ErrNo)
  525. "fstk" Sends a stackframe to NTK
  526. "okln" Sent by NTK to ACK connection, if not Newton respods with
  527. Error -28016
  528. "cnnt" Requests an NTK connection from the desktop
  529. "term" Requests disconnect (?) (Not quite sure about yet)
  530. "pkg " LoadPackage
  531. "stou" Set timeout
  532. "dpkg" ?? Probably request for Package Download
  533. "fobj" Sends any arbitrary Newton Object as NSOF to NTK
  534. */
  535. //
  536. // End of "$Id$".
  537. //