home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3644 < prev    next >
Text File  |  1991-07-16  |  41KB  |  1,210 lines

  1. Newsgroups: alt.sources
  2. From: jtsillas@sprite.ma30.bull.com (James Tsillas)
  3. Subject: mxgdb Part 6/9
  4. Date: 16 Jul 91 13:10:53
  5. Message-ID: <JTSILLAS.91Jul16131053@sprite.ma30.bull.com>
  6.  
  7.  
  8.  
  9. ---- Cut Here and feed the following to sh ----
  10. #!/bin/sh
  11. # this is mxgdb.06 (part 6 of a multipart archive)
  12. # do not concatenate these parts, unpack them in order with /bin/sh
  13. # file mxgdb/gdb_regex.h continued
  14. #
  15. if test ! -r _shar_seq_.tmp; then
  16.     echo 'Please unpack part 1 first!'
  17.     exit 1
  18. fi
  19. (read Scheck
  20.  if test "$Scheck" != 6; then
  21.     echo Please unpack part "$Scheck" next!
  22.     exit 1
  23.  else
  24.     exit 0
  25.  fi
  26. ) < _shar_seq_.tmp || exit 1
  27. if test ! -f _shar_wnt_.tmp; then
  28.     echo 'x - still skipping mxgdb/gdb_regex.h'
  29. else
  30. echo 'x - continuing file mxgdb/gdb_regex.h'
  31. sed 's/^X//' << 'SHAR_EOF' >> 'mxgdb/gdb_regex.h' &&
  32. #define O_INFO_DIR                  5 /* NEW for GDB */
  33. #define O_FRAME_CURR        6      /* O_FRAME_CURR = O_UPDOWN */
  34. #define O_UPDOWN             6
  35. #define O_BELL                7
  36. #define O_SEARCH            8
  37. #define O_INFO_LINE            9    /* Instead of O_FILE */
  38. #define O_PRINT                10
  39. #define O_DEBUG                11
  40. #define O_DIRECTORY            12            
  41. #define O_LIST                13 /* for dbx, O_LIST = O_SEARCH */
  42. #define O_DISPLAY            14
  43. #define O_DISPLAY_INFO        15
  44. #define O_PWD                16
  45. #define O_CD                16    /* O_PWD = O_CD */
  46. #define O_RECEIVED_SIGNAL    17    /* test program received signal */
  47. #define O_EXEC_DISPLAY        18    /* special for filter_display_info  */
  48. #define O_READING_SYMBOLS    19  /* special for filter_reading_symbols */
  49. #define O_HELP                  20
  50. X
  51. #define    C_ANY            -1
  52. #define C_EXEC            0
  53. #define C_BREAK            1    /* Instead of C_STOPAT & C_STOPIN */
  54. #define C_INFO_DIR        2    /* NEW for GDB */
  55. #define C_FRAME_CURR            3
  56. #define C_UPDOWN        4
  57. #define C_CLEAR         5
  58. #define C_FINISH        6            /* Instead of C_FUNC */
  59. #define C_INFO_LINE        7            /* Instead of C_FILE */
  60. #define C_SYMBOL_FILE            8
  61. #define C_CD            9
  62. #define C_DIRECTORY        10            /* Instead of C_USE */
  63. #define C_PWD            11
  64. #define C_LIST            12
  65. #define C_SEARCH        13
  66. #define C_DISPLAY_INFO            14    /* must be BEFORE C_DISPLAY ! */
  67. #define C_DISPLAY        15
  68. #define C_UNDISPLAY        16
  69. #define C_PRINT            17
  70. #define C_INFO_BREAK            18
  71. #define C_SOURCE        19
  72. #define C_EXEC_FILE        20
  73. #define C_CORE_FILE             21
  74. #define C_DEFINE                22
  75. #define C_DOCUMENT              23
  76. #define C_END                   24
  77. #define C_HELP                  25
  78. X
  79. /*--------------------------------------------------------------------------+
  80. |                                    |
  81. |                                DBX    |
  82. |                                                                            |
  83. | Reading symbolic information...                                            |
  84. | Read 46 symbols                                                            |
  85. | (dbx)                                                                        |
  86. | (dbx)                                                                        |
  87. | stopped in main at line 5 in file "pw.c"                                    |
  88. |     5             for (i=0; i<100; i++)                                        |
  89. | (dbx) use                                                                    |
  90. | /usr1/gnu_sun4/xdbx/                                                        |
  91. | (dbx) file                                                                |
  92. | pw.c                                                                        |
  93. | (dbx) file                                                                |
  94. | No current source file                                                    |
  95. |                                                                            |
  96. +--------------------------------------------------------------------------*/
  97. /*--------------------------------------------------------------------------+
  98. |                                                                            |
  99. |                                GDB                                            |
  100. |                                                                            |
  101. | Reading symbol data from /usr1/gnu_sun4/xdbx/pw...done.                    |
  102. | Type "help" for a list of commands.                                        |
  103. | (gdb)                                                                        |
  104. | (gdb)                                                                        |
  105. | Bpt 1, main () (pw.c line 5)                                                |
  106. | 5                  for (i=0; i<100; i++)                                        |
  107. | (gdb) info directories                                                    |
  108. | Source directories searched: /usr1/gnu_sun4/xdbx:/usr1/toto                |
  109. | (gdb) info line                                                            |
  110. | Line 10 of "pw.c" starts at pc 0x22dc and ends at 0x22e4.                    |
  111. | (gdb) info line                                                            |
  112. | No source file specified.                                                    |
  113. |                                                                            |
  114. +--------------------------------------------------------------------------*/
  115. /*--------------------------------------------------------------------------+
  116. |                                                                            |
  117. |                                GDB -fullname                                |
  118. |                                                                            |
  119. |                                                                            |
  120. |    We use option -fullname (see dbxoptions() in xdbx.c).                    |
  121. |                                                                            |
  122. | GDB prints (see source.c of gdb):                                            |
  123. |                                                                            |
  124. |        "\032\032%s:%d:%d:%s:0x%x\n", s->fullname,                            |
  125. |        line, s->line_charpos[line - 1],                                    |
  126. |        mid_statement ? "middle" : "beg",                                    |
  127. |        get_frame_pc (get_current_frame()));                                |
  128. |                                                                            |
  129. | (gdb) break main                                                            |
  130. | Reading in symbols for pw.c...done.                                        |
  131. | Breakpoint 1 at 0x229c: file pw.c, line 5.                                |
  132. | (gdb) run                                                                    |
  133. | Starting program: /usr1/gnu_sun4/xdbx/pw                                    |
  134. |                                                                            |
  135. | Bpt 1, main () (pw.c line 5)                                                |
  136. | /usr1/gnu_sun4/xdbx/pw.c:5:17:beg:0x229c                                    |
  137. | (gdb) step                                                                |
  138. | /usr1/gnu_sun4/xdbx/pw.c:6:40:beg:0x22b0                                    |
  139. | (gdb)                                                                        |
  140. |                                                                            |
  141. | (gdb) info directories                                                    |
  142. | Source directories searched: /usr1/gnu_sun4/xdbx                            |
  143. | (gdb) info line                                                            |
  144. | Line 10 of "pw.c" starts at pc 0x22dc and ends at 0x22e4.                    |
  145. | (gdb) info line                                                            |
  146. | No source file specified.                                                    |
  147. | (gdb) info line                                                            |
  148. | Line number 34 is out of range for "bug1.c".                                |
  149. |                                                                            |
  150. | (gdb) display i                                                            |
  151. | 3: i = 0                                                                    |
  152. | (gdb) display                                                                |
  153. | 4: i + 1 = 1                                                                |
  154. | 3: i = 0                                                                    |
  155. | (gdb) undisplay 2                                                            |
  156. | (gdb) display                                                                |
  157. | (gdb)                                                                     |
  158. |                                                                            |
  159. | (gdb) up                                                                    |
  160. | #2  0x2314 in main () (pw.c line 35)                                        |
  161. | /usr1/gnu_sun4/xdbx/pw.c:35:158:beg:0x2360                                |
  162. | (gdb) up                                                                    |
  163. | Initial frame selected; you cannot go up.                                    |
  164. | (gdb)                                                                        |
  165. |                                                                            |
  166. | (gdb) down                                                                |
  167. | #0  glop (number=1) (pw2.c line 5)                                        |
  168. | /usr1/gnu_sun4/xdbx/pw2.c:5:33:beg:0x2360                                    |
  169. | (gdb) down                                                                |
  170. | Bottom (i.e., innermost) frame selected; you cannot go down.                |
  171. | (gdb)                                                                        |
  172. |                                                                            |
  173. | (gdb) pwd                                                                    |
  174. | Working directory /usr1/gnu_sun4/xdbx.                                    |
  175. | (gdb) cd ..                                                                |
  176. | Working directory /usr1/gnu_sun4.                                            |
  177. | (gdb) cd xdbx                                                                |
  178. | Working directory /usr1/gnu_sun4/xdbx.                                    |
  179. | (gdb) cd toto                                                                |
  180. | toto: No such file or directory.                                            |
  181. | (gdb)                                                                        |
  182. |                                                                            |
  183. | Program exited with code 01.                                                |
  184. | (gdb)                                                                        |
  185. |                                                                            |
  186. +--------------------------------------------------------------------------*/
  187. /*
  188. X
  189. X        .        --> any character but '\n'
  190. X        *        --> any character 0 to n times
  191. X        +        --> any character 1 to n times
  192. X        ?        --> any character 0 or 1 time
  193. X        ^        --> begin of line or NOT following character
  194. X        $        --> end of line or '$'
  195. X        \\w        --> character '0..9a..zA...Z'
  196. X        \\W        --> character NOT '0..9a..zA...Z'
  197. X        \\<        --> word begin (word is composed of 0..9a..zA...Z)
  198. X        \\>        --> word end (word is composed of 0..9a..zA...Z)
  199. X        \\b        --> word bound
  200. X        \\B        --> not word bound
  201. X        \\|        --> means OR
  202. X        \\`        --> begin buffer
  203. X        \\\'    --> end buffer
  204. X        
  205. X        
  206. >>    WARNING : be carefull with \\| (OR) : the re_match() function
  207. >>    will NOT correctly update the string for a pattern which is
  208. >>    optional !
  209. >>    --> The number SHOULD NOT point to a patterm which is optional ! 
  210. X
  211. */
  212. X
  213. X    /* (PW)5DEC90: I have a problem if we say \\(Bpt.*\n\\)? in exec pattern.
  214. X        That is why I have two cases : with or without Bpt...
  215. X        Note that 'exec without Message' includes 'exec with Message'.
  216. X        We display 'Bpt...' in the message window. */
  217. X        
  218. X    /* (PW)14JAN91 (v1.01) : use 
  219. X           \\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\)
  220. X    instead of
  221. X        \\(\\([0-9]+:.*\n\\)*\\)
  222. X    for display pattern.
  223. X    */
  224. X    
  225. X
  226. static PatternRec output_pattern[] = {
  227. X    /* exec with Message after */
  228. X    {"\\(.*\n\\)*\032\032\\([^ ]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ ]+\\):0x.+\n\\([ ]*[^0-9].*\n\\)\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\)",
  229. X     NULL,
  230. X     {6, -1, -1, 3, 2, 7}
  231. X    },
  232. X    /* exec with Message before */
  233. X    {"\\(.*\n\\)*\\([ ]*[^ ].*\n\\)\032\032\\([^ ]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ ]+\\):0x.+\n\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\)",
  234. X     NULL,
  235. X     {2, -1, -1, 4, 3, 7}    
  236. X    },
  237. X    /* exec without Message */
  238. X    {"\\(.*\n\\)*\032\032\\(\\([^ ]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ ]+\\):0x.+\n\\)\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\)",
  239. X     NULL,
  240. X     {2, -1, -1, 4, 3, 7}
  241. X    },
  242. X    /* done */
  243. X    {"\\(.*\n\\)*\n\\(Program terminated with signal \\|Program exited with code 0\\|Program exited normally\\).*\n\\(.*\n\\)*",
  244. X     NULL,
  245. X     {-1, -1, -1, -1, -1, -1}
  246. X    },
  247. X    /* break */
  248. X    {"\\(.*\n\\)*Breakpoint \\([0-9]+\\) at [^ ]+: file \\([^ ]+\\), line \\([0-9]+\\).\n",
  249. X     NULL,
  250. X     {-1, 2, -1, 4, 3, -1}
  251. X    },
  252. X    /* info directories */
  253. X    {"Source directories searched:[ ]*\\([^ ]+\\)[ ]*\n",
  254. X     NULL,
  255. X     { -1, -1, -1, -1, 1, -1}
  256. X    },
  257. X    /* up, down */
  258. X    {"\\(.*\n\\)*\\(#[0-9]+[ ]+\\(0x[^ ]+[ ]+in[ ]+\\)?\\([^ ]+\\).*\n\\)\\(Source file is more recent than executable.\n\\)?\032\032\\([^ ]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ ]+\\):0x.+\n",
  259. X     NULL,
  260. X     {2, -1, 4, 7, 6, -1}    
  261. X    },
  262. X    /* bell */
  263. X    {"\\(Undefined command: .*\n\\|Already at the \\(top\\|bottom\\) call level\n\\|\
  264. No active stack frames\n\\|no program to run\n\\|no process to run\n\\|\
  265. program is not active\n\\|can't continue execution\n\\|\
  266. .*\ncan't write to process.*\n\\|\
  267. \\(Top\\|End\\)-of-file; did not find search string:.*\n\\)",
  268. X     NULL,
  269. X     {-1, -1, -1, -1, -1}
  270. X    },
  271. X    /* search */
  272. X    {"\\([0-9]+\\).*\n",
  273. X     NULL,
  274. X     {-1, -1, -1, 1, -1, -1}
  275. X    },
  276. X    /* info line */
  277. X    {"\\(Line \\(number \\)?[0-9]+ \\(of\\|is out of range for\\) \"\\([^ ]+\\)\".*\\)\n",
  278. X     NULL,
  279. X     {-1, -1, -1, -1, 4, -1}
  280. X    },
  281. X    /* print */
  282. X    {"\\(warning: .*\n\\)?\\(\\(.*\\) = .*\n\\(.*\n\\)*\\)",
  283. X     NULL,
  284. X     { 3, -1, -1, -1, -1, 2}
  285. X    },
  286. X    /* start gdb (debug)  */
  287. X    {"\\(.*\n\\)*Type \"help\" for a list of commands.\n",
  288. X     NULL,
  289. X     { -1, -1, -1, -1, -1, -1}
  290. X    },
  291. X    /* directory */
  292. X    {"\\([^ ]+ is already in the source path.[ ]*\n\\)*Source directories searched:[ ]*\\([^ ]+\\)[ ]*\n",
  293. X     NULL,
  294. X     { -1, -1, -1, -1, 1, -1}
  295. X    },
  296. X    /* list */
  297. X    {"\\(.*\n\\)*\\(\\([0-9]+\\).*\n\\)",
  298. X     NULL,
  299. X     { -1, -1, -1, 3, -1, -1}
  300. X    },
  301. X    /* display */
  302. X    {"\\([0-9]+:.*\n\\)",
  303. X     NULL,
  304. X     { -1, -1, -1, -1, -1, 1}
  305. X    },
  306. X    /* info display */
  307. X    {"\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\)",
  308. X     NULL,
  309. X     { -1, -1, -1, -1, -1, 1}
  310. X    },
  311. X    /* pwd or cd */
  312. X    {"Working directory[ ]+\\([^ ]+\\).[ ]*\n\\([ ]*(canonically[ ]+\\([^ ]+\\)).\n\\)?",
  313. X     NULL,
  314. X     { 1, -1, -1, -1, -1, 3}
  315. X    },
  316. X    /* program received signal */
  317. X    {"\\(.*\n\\)*\n\\(Program received signal \\([-]?[0-9]+\\), [^ ]+.*\n\\)\\(.*\n\\)*",
  318. X    NULL,
  319. X     {  2, 3, -1, -1, -1, -1}
  320. X    },
  321. X    /* special for test in filter_display_info() */
  322. X    {"\\([^0-9].*\n\\)*\\([0-9]+:.*\n\\)\\(.*\n\\)*",
  323. X     NULL,
  324. X     { -1, -1, -1, -1, -1, 2}
  325. X    },
  326. X    /* special for test in filter_reading_symbols() */
  327. X    {"\\(.*\n\\)*\\(Reading in symbols for .*done.\n\\)\\(.*\n\\)*",
  328. X     NULL,
  329. X     { 2, -1, -1, -1, -1, -1}
  330. X    }, 
  331. X    {"\\(.*\n\\)*", NULL, {-1, -1, -1, -1, -1, -1}
  332. X    },
  333. X    NULL 
  334. };
  335. X
  336. /*
  337. X
  338. X    To simplify the patterns, I used for example :
  339. X    
  340. X        "fr[ame]*" instead of "frame\\|fram\\|fra||fr".
  341. X        
  342. X    This will cause 'frmeame' to be accepted. But this is
  343. X    no problem because 'Undefined command' output is parsed
  344. X    before parsing the command line (see parse() in parser.c).
  345. */
  346. X
  347. static PatternRec command_pattern[] = {
  348. X    /* run -r - cont - c - next - n - step - s - nexti - ni - stepi - si - return
  349. X    jump - until - u */
  350. X    {"[ ]*\\(run\\|r\\|cont\\|c\\|next\\|n\\|step\\|s\\|nexti\\|stepi\\|ni\\|si\\|ret[urn]*\\|j[ump]*\\|unt[il]*\\|u\\)\\( .*\\)?\n",
  351. X                                            NULL, {-1, -1, -1, -1, -1, -1}},
  352. X    /* break - tbreak */
  353. X    {"[ ]*\\(t\\)?\\(b\\|br\\|bre\\|brea\\|break\\)\\( .*\\)?\n",
  354. X                                            NULL, {-1, -1, -1, -1, -1, -1}},
  355. X    {"[ ]*info[ ]+directories[ ]*\n",        NULL, {-1, -1, -1, -1, -1, -1}},
  356. X    
  357. X    /* 'frame' is special case of 'frame n' since it does not change the
  358. X    current frame. Else 'frame n' is like up or down. */
  359. X    {"[ ]*fr[ame]*[ ]*\n",                    NULL, {-1, -1, -1, -1, -1, -1}},
  360. X    {"[ ]*\\(up\\|down\\|dow\\|do\\|fr[ame]*\\)\\( .*\\)?\n", 
  361. X                                            NULL, {-1, -1, -1, -1, -1, -1}},
  362. X                                            
  363. X    /* delete - d - clear - enable - disable - dis - disa */
  364. X    /* gdb commands 'delete display' 'enable display' and 'delete environment'
  365. X    are also found here. This is superfluous, but no problem */
  366. X    
  367. X    {"[ ]*\\(del[ete]*\\|d\\|cl[ear]*\\|en[able]*\\|disab[le]*\\|dis\\|disa\\)\\( .*\\)?\n",
  368. X                                            NULL, {-1, -1, -1, -1, -1, -1}},
  369. X                                            
  370. X    {"[ ]*fi[nish]*[ ]*\n",                    NULL, {-1, -1, -1, -1, -1, -1}},
  371. X    {"[ ]*info[ ]+line[ ]*\n",                NULL, {-1, -1, -1, -1, -1, -1}},
  372. X    
  373. X    /* symbol-file */
  374. X    {"[ ]*sy.*\n",                             NULL, {-1, -1, -1, -1, -1, -1}},
  375. X    {"[ ]*cd[ ]*[^ ]+[ ]*\n",                 NULL, {-1, -1, -1, -1, -1, -1}},
  376. X    
  377. X    /* directory */
  378. X    {"[ ]*dir.*\n",                            NULL, {-1, -1, -1, -1, -1, -1}},
  379. X    
  380. X    {"[ ]*pwd[ ]*\n",                        NULL, {-1, -1, -1, -1, -1, -1}},
  381. X    /* list */
  382. X    {"[ ]*l.*\n",                             NULL, {-1, -1, -1, -1, -1, -1}},
  383. X    
  384. X    /* forward-search or reverse-search or search */
  385. X    
  386. X    {"[ ]*\\(fo[rward-search]*\\|rev[erse-search]*\\|sea[rch]*\\)[ ]*",
  387. X                                            NULL, {-1, -1, -1, -1, -1, -1}},
  388. X    
  389. X    /* 'display' is a special case of 'display exp' since it does not
  390. X    add any expression to be displayed */
  391. X    {"[ ]*disp[lay]*[ ]*\n",                            NULL, {-1, -1, -1, -1, -1, -1}},
  392. X    {"[ ]*disp[lay]\\(/[^ ]+\\)?*[ ]*[^ ]+[ ]*.*\n",    NULL, {-1, -1, -1, -1, -1, -1}},
  393. X    
  394. X    /* undisplay */
  395. X    {"[ ]*und.*\n",                            NULL, {-1, -1, -1, -1, -1, -1}},
  396. X    
  397. X    /* Note that Token.mesg (if any) is updated with print command (see 1) */
  398. X    
  399. X    {"[ ]*print[ ]*\\([^ ]?\\([ ]+[^ ]+\\)*\\)[ ]*\n",    NULL, { 1, -1, -1, -1, -1, -1}},
  400. X    {"[ ]*info[ ]+break[ ]*\n",                NULL, {-1, -1, -1, -1, -1, -1}},
  401. X    
  402. X    /* source (note that Token.TK_FILE is updated here) */
  403. X    {"[ ]*so[urce]*[ ]*\\(.*\\)\n",         NULL, {-1, -1, -1, -1,  1, -1}},
  404. X    
  405. X    /* exec-file (just used internally) */
  406. X    {"[ ]*exec-file .*\n",                     NULL, {-1, -1, -1, -1, -1, -1}},
  407. X
  408. X    /* core-file */
  409. X    {"[ ]*cor[e-file]*.*\n", NULL,
  410. X       {-1, -1, -1, -1, -1, -1}},
  411. X
  412. X    /* define */
  413. X    {"[ ]*def[ine]*[ ]+[^ ]+\n", NULL,
  414. X       {-1, -1, -1, -1, -1, -1}},
  415. X
  416. X    /* document */
  417. X    {"[ ]*doc[ument]*[ ]+[^ ]+\n", NULL,
  418. X       {-1, -1, -1, -1, -1, -1}},
  419. X
  420. X    /* end of define or document */
  421. X    {"[ ]*end[].*", NULL,
  422. X       {-1, -1, -1, -1, -1, -1}},
  423. X
  424. X    {"[ ]*help.*\n", NULL,
  425. X       {-1, -1, -1, -1, -1, -1}},
  426. X
  427. X    NULL
  428. };
  429. SHAR_EOF
  430. echo 'File mxgdb/gdb_regex.h is complete' &&
  431. chmod 0664 mxgdb/gdb_regex.h ||
  432. echo 'restore of mxgdb/gdb_regex.h failed'
  433. Wc_c="`wc -c < 'mxgdb/gdb_regex.h'`"
  434. test 17655 -eq "$Wc_c" ||
  435.     echo 'mxgdb/gdb_regex.h: original size 17655, current size' "$Wc_c"
  436. rm -f _shar_wnt_.tmp
  437. fi
  438. # ============= mxgdb/getpagesize.h ==============
  439. if test -f 'mxgdb/getpagesize.h' -a X"$1" != X"-c"; then
  440.     echo 'x - skipping mxgdb/getpagesize.h (File already exists)'
  441.     rm -f _shar_wnt_.tmp
  442. else
  443. > _shar_wnt_.tmp
  444. echo 'x - extracting mxgdb/getpagesize.h (Text)'
  445. sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/getpagesize.h' &&
  446. /* $Id: getpagesize.h,v 1.1.1.1 1991/05/16 21:42:20 jtsillas Exp $ */
  447. X
  448. #ifdef BSD
  449. #ifndef BSD4_1
  450. #define HAVE_GETPAGESIZE
  451. #endif
  452. #endif
  453. X
  454. #ifndef HAVE_GETPAGESIZE
  455. X
  456. #include <sys/param.h>
  457. X
  458. #ifdef EXEC_PAGESIZE
  459. #define getpagesize() EXEC_PAGESIZE
  460. #else
  461. #ifdef NBPG
  462. #define getpagesize() NBPG * CLSIZE
  463. #ifndef CLSIZE
  464. #define CLSIZE 1
  465. #endif /* no CLSIZE */
  466. #else /* no NBPG */
  467. #ifdef NBPC
  468. #define getpagesize() NBPC
  469. #else
  470. #define getpagesize() NBPP
  471. #endif
  472. #endif /* no NBPG */
  473. #endif /* no EXEC_PAGESIZE */
  474. X
  475. #endif /* not HAVE_GETPAGESIZE */
  476. X
  477. SHAR_EOF
  478. chmod 0664 mxgdb/getpagesize.h ||
  479. echo 'restore of mxgdb/getpagesize.h failed'
  480. Wc_c="`wc -c < 'mxgdb/getpagesize.h'`"
  481. test 539 -eq "$Wc_c" ||
  482.     echo 'mxgdb/getpagesize.h: original size 539, current size' "$Wc_c"
  483. rm -f _shar_wnt_.tmp
  484. fi
  485. # ============= mxgdb/windows.c ==============
  486. if test -f 'mxgdb/windows.c' -a X"$1" != X"-c"; then
  487.     echo 'x - skipping mxgdb/windows.c (File already exists)'
  488.     rm -f _shar_wnt_.tmp
  489. else
  490. > _shar_wnt_.tmp
  491. echo 'x - extracting mxgdb/windows.c (Text)'
  492. sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/windows.c' &&
  493. static char rcsid[] = "$Id: windows.c,v 1.5 1991/07/11 21:14:20 jtsillas Exp $";
  494. X
  495. /*****************************************************************************
  496. X *
  497. X *  xdbx - X Window System interface to dbx
  498. X *
  499. X *  Copyright 1989, 1990 The University of Texas at Austin
  500. X *
  501. X *  Permission to use, copy, modify, and distribute this software and its
  502. X *  documentation for any purpose and without fee is hereby granted,
  503. X *  provided that the above copyright notice appear in all copies and that
  504. X *  both that copyright notice and this permission notice appear in
  505. X *  supporting documentation, and that the name of The University of Texas
  506. X *  not be used in advertising or publicity pertaining to distribution of
  507. X *  the software without specific, written prior permission.  The
  508. X *  University of Texas makes no representations about the suitability of
  509. X *  this software for any purpose.  It is provided "as is" without express
  510. X *  or implied warranty.
  511. X *
  512. X *  THE UNIVERSITY OF TEXAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
  513. X *  SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  514. X *  FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS BE LIABLE FOR ANY
  515. X *  SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
  516. X *  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
  517. X *  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  518. X *  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  519. X *
  520. X *  Author:      Po Cheung, The University of Texas at Austin
  521. X *  Created:       March 10, 1989
  522. X *
  523. X *****************************************************************************/
  524. X
  525. /*  windows.c:
  526. X *
  527. X *    CreateTitleBar() :    Create title bar.
  528. X *    CreateFileLabel() :    Create file label in file window.
  529. X *    CreateLineLabel() :    Create line label in file window.
  530. X *    CreateFileWindow() :    Create file window.
  531. X *    CreateMessageWindow() :    Create message window.
  532. X *    CreateDisplayWindow() :    Create display window.
  533. X *    CreateSubWindows() :    Create the subwindows.
  534. X *    UpdateFileLabel() :    Update file label.
  535. X *    UpdateLineLabel() :    Update line label.
  536. X *    UpdateMessageWindow() :    Update message window.
  537. X */
  538. X
  539. #include "global.h"
  540. X
  541. #include <Xm/Xm.h>
  542. #include <Xm/PanedW.h>
  543. #include <Xm/RowColumn.h>
  544. #include <Xm/Form.h>
  545. #include <Xm/Label.h>
  546. #include <Xm/CascadeB.h>
  547. #include <Xm/ScrolledW.h>
  548. #include <Xm/PushB.h>
  549. #include <Xm/MessageB.h>
  550. X
  551. Widget    fileWindow,            /* parent of fileLabel and lineLabel */
  552. X    messageWindow,            /* window for displaying messages */
  553. X    separator,            /* separator in vpane */
  554. X    displayWindow,            /* area for displaying variables */
  555. X        fileSel,
  556. X        displayFD,
  557. X        topMenuBar,
  558. X        topForm,
  559. X        fileCButton, commandsCButton,
  560. X        filePMenu, commandPMenu,
  561. X        filePbutton, searchPbutton, quitPbutton,
  562. X        runningCbutton, helpPMenu, helpCButton,
  563. X        helpFD, helpselectscroll, helpupbutton, helpquitbutton;
  564. X
  565. Widget vpane, exitWarning;
  566. X
  567. static Widget     fileLabel,        /* filename of displayed text */
  568. X        lineLabel;        /* line number of caret position */
  569. X
  570. /*
  571. X *  Private routines for creating various subwindows for xdbx.
  572. X */
  573. X
  574. static void CreateFileLabel(parent)
  575. Widget parent;
  576. {
  577. X    Arg     args[MAXARGS];
  578. X
  579. X    XtSetArg(args[0], XmNlabelString, 
  580. X         XmStringCreateLtoR("No Source File                         ",
  581. X                XmSTRING_DEFAULT_CHARSET));
  582. X    XtSetArg(args[1], XmNleftAttachment, XmATTACH_FORM);
  583. X    fileLabel = XtCreateManagedWidget("fileLabel", xmLabelWidgetClass, 
  584. X                      parent, args, 2);
  585. }
  586. X
  587. static void CreateLineLabel(parent)
  588. Widget parent;
  589. {
  590. X    Arg     args[MAXARGS];
  591. X
  592. X    XtSetArg(args[0], XmNlabelString, 
  593. X         XmStringCreateLtoR("0     ", XmSTRING_DEFAULT_CHARSET));
  594. X    XtSetArg(args[1], XmNrightAttachment, XmATTACH_FORM);
  595. X    lineLabel = XtCreateManagedWidget("lineLabel", xmLabelWidgetClass, 
  596. X                      parent, args, 2);
  597. X   
  598. }
  599. X
  600. static void CreateFileWindow(parent)
  601. Widget parent;
  602. {
  603. X    Arg     args[MAXARGS];
  604. X    Dimension   height;
  605. X
  606. X    fileWindow = XtCreateManagedWidget("fileWindow", xmFormWidgetClass,
  607. X                      parent, args, 0);
  608. X
  609. X
  610. X    XtSetArg(args[0], XmNheight, &height);
  611. X    XtGetValues(fileWindow, args, 1);
  612. X    XtSetArg(args[0], XmNpaneMinimum, height);
  613. X    XtSetArg(args[1], XmNpaneMaximum, height); 
  614. X    XtSetValues(fileWindow, args, 2);
  615. X
  616. X    CreateFileLabel(fileWindow);
  617. X    CreateLineLabel(fileWindow);
  618. }
  619. X
  620. static void CreateMessageWindow(parent)
  621. Widget parent;
  622. {
  623. X    Arg     args[MAXARGS];
  624. X    Cardinal     n;
  625. X    Dimension   height;
  626. X
  627. X    n = 0;
  628. X    XtSetArg(args[0], XmNalignment, XmALIGNMENT_BEGINNING);
  629. X    XtSetArg(args[1], XmNlabelString, 
  630. X         XmStringCreateLtoR("", 
  631. X                XmSTRING_DEFAULT_CHARSET));
  632. X
  633. X    messageWindow = XtCreateManagedWidget("messageWindow", xmLabelWidgetClass,
  634. X                      parent, args, 2);
  635. X
  636. X    XtSetArg(args[0], XmNheight, &height);
  637. X    XtGetValues(messageWindow, args, 1);
  638. X    XtSetArg(args[0], XmNpaneMinimum, height);
  639. X    XtSetArg(args[1], XmNpaneMaximum, height); 
  640. X    XtSetValues(messageWindow, args, 2);
  641. X    
  642. }
  643. X
  644. static void SelectVar(w, event, params, num_params)
  645. X    Widget w;
  646. X    XEvent *event;
  647. X    String *params;
  648. X    Cardinal *num_params;
  649. {
  650. X  char *displayString, *term1, *term2;
  651. X  XmTextPosition pos, bottom, left, right;
  652. X  
  653. X  displayString = (char *) XmTextGetString(w);
  654. X  pos = XmTextGetInsertionPosition(w);
  655. X  bottom = XmTextGetLastPosition(w);
  656. X
  657. X  if(displayString && *displayString)
  658. X    {
  659. X      left = pos;
  660. X      right = pos;
  661. X      while(left > 0 && displayString[left-1] != '\n') left--;
  662. X      while(right <=  bottom && displayString[right] != '\n') right++;
  663. X      
  664. X      XmTextSetSelection(w, left, right, 0);
  665. X    }
  666. X  if(displayString) XtFree(displayString);
  667. }
  668. X
  669. X
  670. /*  Create a window for displaying variables as specified by the display
  671. X *  command in dbx.
  672. X */
  673. static void CreateDisplayWindow(parent)
  674. Widget parent;
  675. {
  676. X    Arg     args[MAXARGS];
  677. X    Widget      displaySW;
  678. X
  679. X    static XtActionsRec display_actions[] = {
  680. X    {"SelectVar",     (XtActionProc) SelectVar},
  681. X        {NULL, NULL}
  682. X    };
  683. X
  684. X    
  685. X    XtSetArg(args[0], XmNdialogTitle, 
  686. X         XmStringCreateLtoR("Auto Display", XmSTRING_DEFAULT_CHARSET)); 
  687. X
  688. X    displayFD = XmCreateFormDialog(parent, "displayFD", args, 1);
  689. X
  690. X    XtSetArg(args[0], XmNeditable, False);
  691. X    XtSetArg(args[1], XmNeditMode, XmMULTI_LINE_EDIT);
  692. X    XtSetArg(args[2], XmNscrollLeftSide, True);
  693. X    XtSetArg(args[3], XmNcursorPositionVisible, False);
  694. X    XtSetArg(args[4], XmNscrollBarDisplayPolicy, XmSTATIC);
  695. X    XtSetArg(args[5], XmNscrollHorizontal, True);
  696. X    XtSetArg(args[6], XmNscrollVertical, True);
  697. X
  698. X    displayWindow = (Widget) XmCreateScrolledText(displayFD, "displayWindow",
  699. X                                          args, 7);
  700. X    XtManageChild(displayWindow);
  701. X
  702. X    XtAppAddActions(app_context, display_actions, XtNumber(display_actions));
  703. X
  704. X    displaySW = XtParent(displayWindow);
  705. X    XtSetArg(args[0], XmNleftAttachment, XmATTACH_FORM);
  706. X    XtSetArg(args[1], XmNrightAttachment, XmATTACH_FORM);    
  707. X    XtSetArg(args[2], XmNbottomAttachment, XmATTACH_FORM);
  708. X    XtSetArg(args[3], XmNtopAttachment, XmATTACH_FORM);
  709. X    XtSetValues(displaySW, args, 4);
  710. }
  711. X
  712. /*  Create a window for displaying variables as specified by the display
  713. X *  command in dbx.
  714. X */
  715. X
  716. extern char helpstack[5][40];
  717. extern int helpstackidx;
  718. extern char help_buttons_use_flag;
  719. X
  720. void HelpQuitActivate(w, client_data, call_data)
  721. X     Widget w;
  722. X     XtPointer client_data;
  723. X     XmPushButtonCallbackStruct *call_data;
  724. {
  725. X  XtUnmanageChild(helpFD);
  726. }
  727. X
  728. void HelpUpActivate(w, client_data, call_data)
  729. X     Widget w;
  730. X     XtPointer client_data;
  731. X     XmArrowButtonCallbackStruct *call_data;
  732. {
  733. X  char command[256];
  734. X
  735. X  --helpstackidx;
  736. X  sprintf(command, "help %s\n", helpstack[helpstackidx-1]);
  737. X  help_buttons_use_flag=1;
  738. X  query_dbx(command);
  739. X  help_buttons_use_flag=0;
  740. }
  741. X
  742. void ManageQuit(w, client_data, call_data)
  743. X     Widget w;
  744. X     XtPointer client_data;
  745. X     XmPushButtonCallbackStruct *call_data;
  746. {
  747. X  XtManageChild(exitWarning);
  748. }
  749. X
  750. Widget scrollselect;
  751. X
  752. static void CreateHelpWindow(parent)
  753. Widget parent;
  754. {
  755. X    Arg     args[MAXARGS];
  756. X    Widget      helpSW; 
  757. X    int        nlabel, nbutton;
  758. X
  759. X    XtSetArg(args[0], XmNdialogTitle, 
  760. X         XmStringCreateLtoR("MXGDB help", XmSTRING_DEFAULT_CHARSET)); 
  761. X
  762. X    helpFD = XmCreateFormDialog(parent, "helpFD", args, 1);
  763. X    XtSetArg(args[0], XmNscrollingPolicy, XmAUTOMATIC);
  764. X    XtSetArg(args[1], XmNleftAttachment, XmATTACH_FORM);
  765. X    XtSetArg(args[2], XmNrightAttachment, XmATTACH_FORM);
  766. X    XtSetArg(args[3], XmNtopAttachment, XmATTACH_FORM);
  767. X    XtSetArg(args[4], XmNbottomAttachment, XmATTACH_FORM);
  768. X    
  769. X    scrollselect = XtCreateManagedWidget("scrollselect", 
  770. X                         xmScrolledWindowWidgetClass,
  771. X                         helpFD, args, 5);
  772. X    helpselectscroll = XtCreateManagedWidget("helpselectscroll",
  773. X                         xmFormWidgetClass,
  774. X                         scrollselect, args, 0);
  775. X    XmScrolledWindowSetAreas(scrollselect, NULL, NULL, helpselectscroll);
  776. X
  777. X    
  778. X    XtSetArg(args[0], XmNarrowDirection, XmARROW_UP);
  779. X    XtSetArg(args[1], XmNtopAttachment, XmATTACH_FORM);
  780. X    XtSetArg(args[2], XmNrightAttachment, XmATTACH_FORM);
  781. X    helpupbutton = XmCreateArrowButton(helpFD, "helpupbutton", args, 3);
  782. X    XtAddCallback(helpupbutton, XmNactivateCallback, HelpUpActivate, NULL);
  783. X
  784. X    XtSetArg(args[0], XmNlabelString, 
  785. X         XmStringCreateLtoR("Quit", XmSTRING_DEFAULT_CHARSET));
  786. X    XtSetArg(args[1], XmNtopAttachment, XmATTACH_FORM);
  787. X    XtSetArg(args[2], XmNleftAttachment, XmATTACH_FORM);
  788. X    helpquitbutton = XtCreateManagedWidget("helpquitbutton", 
  789. X                       xmPushButtonWidgetClass,
  790. X                       helpFD, args, 3);
  791. X    XtAddCallback(helpquitbutton, XmNactivateCallback, HelpQuitActivate, NULL);
  792. X
  793. X    for(nlabel=0; nlabel < NHELPLABELS; nlabel++) 
  794. X    helplabels[nlabel] = NULL;
  795. X    for(nbutton=0; nbutton < NHELPBUTTONS; nbutton++) 
  796. X    helpbuttons[nbutton] = NULL;
  797. X
  798. }
  799. X
  800. X
  801. void CreateFileMenuPane(parent)
  802. Widget parent;
  803. {
  804. X  Arg args[MAXARGS];
  805. X
  806. X  filePMenu = XmCreatePulldownMenu(parent, "filePMenu", args, 0);
  807. X  XtSetArg(args[0], XmNsubMenuId, filePMenu);
  808. X  XtSetArg(args[1], XmNlabelString, 
  809. X       XmStringCreateLtoR("File", XmSTRING_DEFAULT_CHARSET));
  810. X  XtSetArg(args[2], XmNmnemonic, 'F');
  811. X  fileCButton = XmCreateCascadeButton(parent,"fileCButton", args, 3);
  812. X  XtManageChild(fileCButton);
  813. X
  814. X  XtSetArg(args[0], XmNlabelString, 
  815. X       XmStringCreateLtoR("File...", XmSTRING_DEFAULT_CHARSET));
  816. X  XtSetArg(args[1], XmNaccelerator, "Ctrl <Key> f");
  817. X  XtSetArg(args[2], XmNacceleratorText,
  818. X       XmStringCreateLtoR("!f", XmSTRING_DEFAULT_CHARSET));
  819. X  filePbutton = XmCreatePushButtonGadget(filePMenu, "filePbutton", args, 3);
  820. X  XtManageChild(filePbutton);
  821. X
  822. X  XtSetArg(args[0], XmNlabelString, 
  823. X       XmStringCreateLtoR("Search...", XmSTRING_DEFAULT_CHARSET));
  824. X  XtSetArg(args[1], XmNaccelerator, "Ctrl <Key> s");
  825. X  XtSetArg(args[2], XmNacceleratorText,
  826. X       XmStringCreateLtoR("!s", XmSTRING_DEFAULT_CHARSET));
  827. X  searchPbutton = XmCreatePushButtonGadget(filePMenu,
  828. X                       "searchPbutton", args, 3); 
  829. X  XtManageChild(searchPbutton);
  830. X
  831. X  XtSetArg(args[0], XmNlabelString, 
  832. X       XmStringCreateLtoR("Exit", XmSTRING_DEFAULT_CHARSET));
  833. X  XtSetArg(args[1], XmNaccelerator, "Ctrl <Key> e");
  834. X  XtSetArg(args[2], XmNacceleratorText,
  835. X       XmStringCreateLtoR("!e", XmSTRING_DEFAULT_CHARSET));
  836. X  quitPbutton = XmCreatePushButtonGadget(filePMenu, "quitPbutton", args, 3);
  837. X  XtManageChild(quitPbutton);
  838. X  
  839. X  XtAddCallback(filePbutton, XmNactivateCallback, File, NULL);
  840. X  XtAddCallback(searchPbutton, XmNactivateCallback, PopupSearch, NULL);
  841. X  XtAddCallback(quitPbutton, XmNactivateCallback, ManageQuit, NULL);
  842. }
  843. X
  844. static MenuButtonStruct helpButtons[] ={
  845. X  { NULL, "Gdb Help...", "", "helpPMB", Help, "Ctrl <Key> h", "!h" },
  846. };
  847. X
  848. static MenuButtonStruct runningButtons[] = {
  849. X  { NULL, "Run", "run\n", "runPMB", DoIt, "Ctrl <Key> r", "!r" },
  850. X  { NULL, "Continue", "cont\n", "contPMB", DoIt, "", "" },
  851. X  { NULL, "Next", "next\n", "nextPMB", DoIt, "Ctrl <Key> n", "!n" },
  852. X  { NULL, "Step", "step\n", "stepPMB", DoIt, "Ctrl <Key> s", "!t" },
  853. X  { NULL, "Finish", "finish\n", "finishPMB", DoIt, "", "" },
  854. };
  855. X
  856. static MenuButtonStruct dataButtons[] = {
  857. X  { NULL, "Print", "", "printPMB", Print, "Ctrl <Key> p", "!p"},
  858. X  { NULL, "Display...", "", "displayPMB", Display_, "", ""},
  859. X  { NULL, "Undisplay", "", "undisplayPMB", Undisplay, "", "" },
  860. };
  861. X
  862. static MenuButtonStruct breakpointsButtons[] = {
  863. X  { NULL, "Break", "break", "breakPMB", Break, "Ctrl <Key> b", "!b" },
  864. X  { NULL, "Clear", "", "clearPMB", Clear, "", "" },
  865. X  { NULL, "Tbreak", "tbreak", "tbreakPMB", Break, "", ""},
  866. };
  867. X
  868. static MenuButtonStruct stackButtons[] = {
  869. X  { NULL, "Up", "up\n", "upPMB", DoIt, "Ctrl <Key> u", "!u" },
  870. X  { NULL, "Down", "down\n", "downPMB", DoIt, "Ctrl <Key> d", "!d" },
  871. };
  872. X
  873. static MenuButtonStruct infoButtons[] = {
  874. X  { NULL, "Locals", "info locals\n", "ilocalsPMB", DoIt, "", "" },
  875. X  { NULL, "Args", "info args\n", "iargsPMB", DoIt, "", "" },
  876. X  { NULL, "Stack", "info stack\n", "istackPMB", DoIt, "", "" },
  877. };
  878. X
  879. static PMCBStruct commandMB[] = {
  880. X  { NULL, NULL, "Running", "runningPM", "runningCB", runningButtons, 5, 'R'},
  881. X  { NULL, NULL, "Data", "dataPM", "dataCB", dataButtons, 3, 'D' },
  882. X  { NULL, NULL, "Breakpoints", "breakpointsPM", "breakpointsCB", 
  883. X      breakpointsButtons, 3, 'B' },
  884. X  { NULL, NULL, "Stack", "stackPM", "stackCB", stackButtons, 2, 'S' },
  885. X  { NULL, NULL, "Info", "infoPM", "infoCB", infoButtons, 3, 'I' },
  886. };
  887. X
  888. void CreateMenuButton(parent, Buttons, nbuttons)
  889. Widget parent;
  890. MenuButtonStruct Buttons[];
  891. int nbuttons;
  892. {
  893. X  Arg args[5];
  894. X  int widgetcount;
  895. X  Cardinal nargs;
  896. X
  897. X  for(widgetcount=0; widgetcount<nbuttons; widgetcount++)
  898. X    {
  899. X      XtSetArg(args[0], XmNlabelString, 
  900. X      XmStringCreateLtoR(Buttons[widgetcount].Label, 
  901. X                  XmSTRING_DEFAULT_CHARSET));
  902. X      nargs = 1;
  903. X      if(*Buttons[widgetcount].accel != '\0')
  904. X    {
  905. X      XtSetArg(args[1], XmNaccelerator, Buttons[widgetcount].accel);
  906. X      XtSetArg(args[2], XmNacceleratorText, 
  907. X           XmStringCreateLtoR(Buttons[widgetcount].acceltext, 
  908. X                      XmSTRING_DEFAULT_CHARSET));
  909. X      nargs = 3;
  910. X    }
  911. X      Buttons[widgetcount].Button = 
  912. X    XmCreatePushButtonGadget(parent,
  913. X                 Buttons[widgetcount].RN, 
  914. X                 args, nargs);
  915. X      XtManageChild(Buttons[widgetcount].Button);
  916. X      XtAddCallback(Buttons[widgetcount].Button, 
  917. X            XmNactivateCallback, 
  918. X            Buttons[widgetcount].CB, 
  919. X            Buttons[widgetcount].Argument);
  920. X    }
  921. }
  922. X
  923. void CreatePulldownMenu(parent, MenuPane, Npanes)
  924. Widget parent;
  925. PMCBStruct MenuPane[];
  926. int Npanes;
  927. {
  928. X  Arg args[MAXARGS];
  929. X  int widgetcount;
  930. X
  931. X
  932. X  for(widgetcount=0; widgetcount<Npanes; widgetcount++)
  933. X    {
  934. X      MenuPane[widgetcount].PM = 
  935. X    XmCreatePulldownMenu(parent, MenuPane[widgetcount].RNPM, 
  936. X                 args, 0);
  937. X      XtSetArg(args[0], XmNlabelString, 
  938. X           XmStringCreateLtoR(MenuPane[widgetcount].Label, 
  939. X                  XmSTRING_DEFAULT_CHARSET));
  940. X      XtSetArg(args[1], XmNsubMenuId, MenuPane[widgetcount].PM);
  941. X      XtSetArg(args[2], XmNmnemonic, MenuPane[widgetcount].mnemonic);
  942. X      MenuPane[widgetcount].CB = 
  943. X    XmCreateCascadeButton(parent, MenuPane[widgetcount].RNCB,
  944. X                         args, 3);
  945. X      XtManageChild(MenuPane[widgetcount].CB);
  946. X      CreateMenuButton(MenuPane[widgetcount].PM, 
  947. X               MenuPane[widgetcount].Buttons,
  948. X               MenuPane[widgetcount].Nbuttons);
  949. X    }
  950. }
  951. X
  952. void CreateMenuPane(parent)
  953. Widget parent;
  954. {
  955. X  Arg args[MAXARGS];
  956. X  
  957. X  topForm = XtCreateManagedWidget("topForm", xmFormWidgetClass, parent,
  958. X                  args, 0);
  959. X  
  960. X  XtSetArg(args[0], XmNtopAttachment, XmATTACH_FORM);
  961. X  XtSetArg(args[1], XmNleftAttachment, XmATTACH_FORM);
  962. X  XtSetArg(args[2], XmNrightAttachment, XmATTACH_FORM);
  963. X  topMenuBar = XmCreateMenuBar(topForm, "topMenuBar", args, 3);
  964. X  XtManageChild(topMenuBar);
  965. X
  966. X  XtSetArg(args[0], XmNbottomAttachment, XmATTACH_FORM);
  967. X  XtSetArg(args[3], XmNtopWidget, topMenuBar);
  968. X  XtSetArg(args[4], XmNtopAttachment, XmATTACH_WIDGET);
  969. X  vpane = XtCreateManagedWidget( "vpane", xmPanedWindowWidgetClass,
  970. X                    topForm, args, 5);
  971. X
  972. X  CreateFileMenuPane(topMenuBar);
  973. X
  974. X  commandPMenu = XmCreatePulldownMenu(topMenuBar, "commandPMenu", args, 0);
  975. X
  976. X  XtSetArg(args[0], XmNsubMenuId, commandPMenu);
  977. X  XtSetArg(args[1], XmNlabelString, 
  978. X       XmStringCreateLtoR("Commands", XmSTRING_DEFAULT_CHARSET));
  979. X  XtSetArg(args[2], XmNmnemonic, 'C');
  980. X  commandsCButton = XmCreateCascadeButton(topMenuBar, "commandsCButton",
  981. X                      args, 3);
  982. X  XtManageChild(commandsCButton);
  983. X
  984. X  CreatePulldownMenu(commandPMenu, commandMB, 5);
  985. X
  986. X  helpPMenu = XmCreatePulldownMenu(topMenuBar, "helpPMenu", args, 0);
  987. X  XtSetArg(args[0], XmNsubMenuId, helpPMenu);
  988. X  XtSetArg(args[1], XmNlabelString, 
  989. X       XmStringCreateLtoR("Help", XmSTRING_DEFAULT_CHARSET));
  990. X  XtSetArg(args[2], XmNmnemonic, 'H');
  991. X  helpCButton = XmCreateCascadeButton(topMenuBar, "helpCButton",
  992. X                      args, 3);
  993. X  XtManageChild(helpCButton);
  994. X  CreateMenuButton(helpPMenu, helpButtons, 1);
  995. X
  996. }
  997. X
  998. X
  999. /*
  1000. X *  Top level function for creating all the xdbx subwindows.
  1001. X */
  1002. void CreateSubWindows(parent)
  1003. Widget parent;
  1004. {
  1005. X  Arg     args[MAXARGS];
  1006. X  Cardinal     n;
  1007. X  XmFontList labelFontList;
  1008. X  
  1009. X    
  1010. X  labelFontList = XmFontListCreate(XLoadQueryFont(XtDisplay(toplevel), 
  1011. X        "-adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859-1"),
  1012. X        XmSTRING_DEFAULT_CHARSET);
  1013. X                          
  1014. X    
  1015. X  CreateMenuPane(parent);
  1016. X  CreateFileWindow(vpane);
  1017. X  CreateSourceWindow(vpane);
  1018. X  CreateMessageWindow(vpane);
  1019. X  CreateDialogWindow(vpane);
  1020. X
  1021. X  XtSetArg(args[0], XmNdialogTitle, 
  1022. X       XmStringCreateLtoR("Symbol/Source Select", 
  1023. X                  XmSTRING_DEFAULT_CHARSET));
  1024. X  fileSel = XmCreateFileSelectionDialog(toplevel, "fileSel", args, 1);
  1025. X  XtSetArg(args[0], XmNkeyboardFocusPolicy, XmPOINTER);
  1026. X  XtSetValues(XtParent(fileSel), args, 1);
  1027. X
  1028. X  XtSetArg(args[1], XmNhighlightOnEnter, True);
  1029. X  XtSetArg(args[0], XmNfontList, labelFontList);
  1030. X  XtSetValues(XmFileSelectionBoxGetChild(fileSel, 
  1031. X                     XmDIALOG_FILTER_TEXT), args, 2);
  1032. X  XtSetValues(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_TEXT), args, 2);
  1033. X  XtSetValues(XmFileSelectionBoxGetChild(fileSel, 
  1034. X                     XmDIALOG_FILTER_LABEL), args, 1);
  1035. X  XtSetValues(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_DIR_LIST), args, 1);
  1036. X  XtSetValues(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_DIR_LIST_LABEL), 
  1037. X          args, 1);
  1038. X  XtSetValues(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_LIST), args, 1);
  1039. X  XtSetValues(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_LIST_LABEL), 
  1040. X          args, 1);
  1041. X  XtSetValues(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_OK_BUTTON), 
  1042. X          args, 1);
  1043. X  XtSetValues(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_APPLY_BUTTON), 
  1044. X          args, 1);
  1045. X  XtSetValues(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_CANCEL_BUTTON), 
  1046. X          args, 1);
  1047. X  XtSetValues(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_SELECTION_LABEL), 
  1048. X          args, 1);
  1049. X
  1050. X  XtUnmanageChild(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_HELP_BUTTON));
  1051. X
  1052. X  XtAddCallback(fileSel, XmNokCallback, OKCallBack, NULL);
  1053. X  XtAddCallback(fileSel, XmNcancelCallback, CancelCallBack, NULL);
  1054. X
  1055. X  CreateDisplayWindow(toplevel);
  1056. X  CreateHelpWindow(toplevel);
  1057. X  CreateSearchPopup(toplevel);
  1058. X
  1059. X  XtSetArg(args[0], XmNmessageString,
  1060. X       XmStringCreateLtoR("OK to Exit Mxgdb?", 
  1061. X                  XmSTRING_DEFAULT_CHARSET));
  1062. X  XtSetArg(args[1], XmNdialogTitle, 
  1063. X       XmStringCreateLtoR("Mxgdb - Alert", 
  1064. X                  XmSTRING_DEFAULT_CHARSET));
  1065. X  exitWarning = XmCreateQuestionDialog(toplevel, "exitWarning", args, 2);
  1066. X  XtAddCallback(exitWarning, XmNokCallback, Quit, NULL);
  1067. X  XtUnmanageChild(XmMessageBoxGetChild(exitWarning, XmDIALOG_HELP_BUTTON));
  1068. X  XtSetArg(args[0], XmNfontList, labelFontList);
  1069. X  XtSetValues(XmMessageBoxGetChild(exitWarning, XmDIALOG_CANCEL_BUTTON)
  1070. X          , args, 1);
  1071. X  XtSetValues(XmMessageBoxGetChild(exitWarning, XmDIALOG_OK_BUTTON)
  1072. X          , args, 1);
  1073. X  XtSetValues(XmMessageBoxGetChild(exitWarning, XmDIALOG_CANCEL_BUTTON)
  1074. X          , args, 1);
  1075. X  XtSetValues(XmMessageBoxGetChild(exitWarning, XmDIALOG_MESSAGE_LABEL)
  1076. X          , args, 1);
  1077. X
  1078. /*
  1079. X *  Routines for updating fields for the filename and line number
  1080. X *  in the file window, and the execution status in the message window.
  1081. X */
  1082. X
  1083. void UpdateFileLabel(string)
  1084. char *string;
  1085. {
  1086. X    Arg     args[MAXARGS];
  1087. X
  1088. X    XtSetArg(args[0], XmNlabelString, 
  1089. X         XmStringCreateLtoR(string, XmSTRING_DEFAULT_CHARSET));
  1090. X    XtSetValues(fileLabel, args, 1);
  1091. X
  1092. }
  1093. X
  1094. void UpdateLineLabel(line)
  1095. Cardinal line;
  1096. {
  1097. X    Arg     args[MAXARGS];
  1098. X    Cardinal     n;
  1099. X    char     string[10];
  1100. X
  1101. X    n = 0;
  1102. X    if (line > 0)
  1103. X        sprintf(string, "%d", line);
  1104. X    else
  1105. X    strcpy(string, "");
  1106. X    XtSetArg(args[0], XmNlabelString, 
  1107. X         XmStringCreateLtoR(string, XmSTRING_DEFAULT_CHARSET));
  1108. X    XtSetValues(lineLabel, args, 1);
  1109. }
  1110. X
  1111. /*--------------------------------------------------------------------------+
  1112. X  |                                        |
  1113. X  |    Note : UpdateMessageWindow assumes that the format string        |
  1114. X  |            can only contain one %s specifier.            |
  1115. X  |        arg is either NULL or is a string.                |
  1116. X  |        format is a string (never NULL).                |
  1117. X  |                                        |
  1118. X  +--------------------------------------------------------------------------*/
  1119. void UpdateMessageWindow(format, arg)
  1120. X     char *format, *arg;
  1121. {
  1122. X  char *message;
  1123. X  char string[LINESIZ];
  1124. X  int fulllength;
  1125. X  Arg     args[MAXARGS];
  1126. X  Cardinal     n;
  1127. X  
  1128. X  fulllength = strlen ("  ") + strlen (format) + 1
  1129. X    + ((arg == NULL) ? 0 : strlen (arg));
  1130. X
  1131. X  if (fulllength > LINESIZ)
  1132. X    message = (char*) XtMalloc (fulllength);
  1133. X  else
  1134. X    message = string;
  1135. X  
  1136. X  strcpy(message, "  ");
  1137. X  sprintf(message + strlen(message), format, arg);
  1138. X
  1139. X  XtSetArg(args[0], XmNlabelString, 
  1140. X       XmStringCreateLtoR(message, XmSTRING_DEFAULT_CHARSET));
  1141. X  XtSetValues(messageWindow, args, 1);
  1142. X  
  1143. X  if (fulllength > LINESIZ)
  1144. X    XtFree(message);
  1145. }
  1146. X
  1147. void ClearMessageWindow()
  1148. {
  1149. X    Arg     args[MAXARGS];
  1150. X
  1151. X    XtSetArg(args[0], XmNlabelString, 
  1152. X         XmStringCreateLtoR("", XmSTRING_DEFAULT_CHARSET));
  1153. X    XtSetValues(messageWindow, args, 1);
  1154. }
  1155. X
  1156. SHAR_EOF
  1157. chmod 0664 mxgdb/windows.c ||
  1158. echo 'restore of mxgdb/windows.c failed'
  1159. Wc_c="`wc -c < 'mxgdb/windows.c'`"
  1160. test 21601 -eq "$Wc_c" ||
  1161.     echo 'mxgdb/windows.c: original size 21601, current size' "$Wc_c"
  1162. rm -f _shar_wnt_.tmp
  1163. fi
  1164. # ============= mxgdb/handler.c ==============
  1165. if test -f 'mxgdb/handler.c' -a X"$1" != X"-c"; then
  1166.     echo 'x - skipping mxgdb/handler.c (File already exists)'
  1167.     rm -f _shar_wnt_.tmp
  1168. else
  1169. > _shar_wnt_.tmp
  1170. echo 'x - extracting mxgdb/handler.c (Text)'
  1171. sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/handler.c' &&
  1172. static char rcsid[] = "$Id: handler.c,v 1.1.1.1 1991/05/16 21:42:25 jtsillas Exp $";
  1173. X
  1174. /*****************************************************************************
  1175. X *
  1176. X *  xdbx - X Window System interface to the dbx debugger
  1177. X *
  1178. X *  Copyright 1989 The University of Texas at Austin
  1179. X *  Copyright 1990 Microelectronics and Computer Technology Corporation
  1180. X *
  1181. X *  Permission to use, copy, modify, and distribute this software and its
  1182. X *  documentation for any purpose and without fee is hereby granted,
  1183. X *  provided that the above copyright notice appear in all copies and that
  1184. X *  both that copyright notice and this permission notice appear in
  1185. X *  supporting documentation, and that the name of The University of Texas
  1186. X *  and Microelectronics and Computer Technology Corporation (MCC) not be 
  1187. X *  used in advertising or publicity pertaining to distribution of
  1188. X *  the software without specific, written prior permission.  The
  1189. X *  University of Texas and MCC makes no representations about the 
  1190. X *  suitability of this software for any purpose.  It is provided "as is" 
  1191. X *  without express or implied warranty.
  1192. X *
  1193. X *  THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
  1194. SHAR_EOF
  1195. true || echo 'restore of mxgdb/handler.c failed'
  1196. fi
  1197. echo 'End of  part 6'
  1198. echo 'File mxgdb/handler.c is continued in part 7'
  1199. echo 7 > _shar_seq_.tmp
  1200. exit 0
  1201. --
  1202.  == James Tsillas                    Bull HN Information Systems Inc. ==
  1203.  == (508) 294-2937                   300 Concord Road   826A          ==
  1204.  == jtsillas@bubba.ma30.bull.com     Billerica, MA 01821              ==
  1205.  ==                                                                   ==
  1206.  == The opinions expressed above are solely my own and do not reflect ==
  1207.  == those of my employer.                                             ==
  1208.             -== no solicitations please ==-
  1209.