1 /* OBSOLETE /* Top level support for Mac interface to GDB, the GNU debugger. */
2 /* OBSOLETE Copyright 1994, 1995, 1998, 2000, 2001 Free Software Foundation, Inc. */
3 /* OBSOLETE Contributed by Cygnus Support. Written by Stan Shebs. */
5 /* OBSOLETE This file is part of GDB. */
7 /* OBSOLETE This program is free software; you can redistribute it and/or modify */
8 /* OBSOLETE it under the terms of the GNU General Public License as published by */
9 /* OBSOLETE the Free Software Foundation; either version 2 of the License, or */
10 /* OBSOLETE (at your option) any later version. */
12 /* OBSOLETE This program is distributed in the hope that it will be useful, */
13 /* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */
14 /* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
15 /* OBSOLETE GNU General Public License for more details. */
17 /* OBSOLETE You should have received a copy of the GNU General Public License */
18 /* OBSOLETE along with this program; if not, write to the Free Software */
19 /* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, */
20 /* OBSOLETE Boston, MA 02111-1307, USA. */ */
22 /* OBSOLETE #include "defs.h" */
24 /* OBSOLETE #include <readline/readline.h> */
25 /* OBSOLETE #include <readline/history.h> */
27 /* OBSOLETE #include <Types.h> */
28 /* OBSOLETE #include <Resources.h> */
29 /* OBSOLETE #include <QuickDraw.h> */
30 /* OBSOLETE #include <Fonts.h> */
31 /* OBSOLETE #include <Events.h> */
32 /* OBSOLETE #include <Windows.h> */
33 /* OBSOLETE #include <Menus.h> */
34 /* OBSOLETE #include <TextEdit.h> */
35 /* OBSOLETE #include <Dialogs.h> */
36 /* OBSOLETE #include <Desk.h> */
37 /* OBSOLETE #include <ToolUtils.h> */
38 /* OBSOLETE #include <Memory.h> */
39 /* OBSOLETE #include <SegLoad.h> */
40 /* OBSOLETE #include <Files.h> */
41 /* OBSOLETE #include <Folders.h> */
42 /* OBSOLETE #include <OSUtils.h> */
43 /* OBSOLETE #include <OSEvents.h> */
44 /* OBSOLETE #include <DiskInit.h> */
45 /* OBSOLETE #include <Packages.h> */
46 /* OBSOLETE #include <Traps.h> */
47 /* OBSOLETE #include <Lists.h> */
48 /* OBSOLETE #include <Gestalt.h> */
49 /* OBSOLETE #include <PPCToolbox.h> */
50 /* OBSOLETE #include <AppleEvents.h> */
51 /* OBSOLETE #include <StandardFile.h> */
52 /* OBSOLETE #include <Sound.h> */
54 /* OBSOLETE #ifdef MPW */
55 /* OBSOLETE #define QD(whatever) (qd.##whatever) */
56 /* OBSOLETE #define QDPat(whatever) (&(qd.##whatever)) */
57 /* OBSOLETE #endif /* MPW */ */
59 /* OBSOLETE #ifdef THINK_C */
60 /* OBSOLETE #define QD(whatever) (whatever) */
63 /* OBSOLETE #define p2c(pstr,cbuf) \ */
64 /* OBSOLETE strncpy(cbuf, ((char *) (pstr) + 1), pstr[0]); \ */
65 /* OBSOLETE cbuf[pstr[0]] = '\0'; */
67 /* OBSOLETE #define pascalify(STR) \ */
68 /* OBSOLETE sprintf(tmpbuf, " %s", STR); \ */
69 /* OBSOLETE tmpbuf[0] = strlen(STR); */
71 /* OBSOLETE #include "gdbcmd.h" */
72 /* OBSOLETE #include "call-cmds.h" */
73 /* OBSOLETE #include "symtab.h" */
74 /* OBSOLETE #include "inferior.h" */
75 /* OBSOLETE #include <signal.h> */
76 /* OBSOLETE #include "target.h" */
77 /* OBSOLETE #include "breakpoint.h" */
78 /* OBSOLETE #include "gdbtypes.h" */
79 /* OBSOLETE #include "expression.h" */
80 /* OBSOLETE #include "language.h" */
82 /* OBSOLETE #include "mac-defs.h" */
84 /* OBSOLETE int debug_openp = 0; */
86 /* OBSOLETE /* This is true if we are running as a standalone application. */ */
88 /* OBSOLETE int mac_app; */
90 /* OBSOLETE /* This is true if we are using WaitNextEvent. */ */
92 /* OBSOLETE int use_wne; */
94 /* OBSOLETE /* This is true if we have Color Quickdraw. */ */
96 /* OBSOLETE int has_color_qd; */
98 /* OBSOLETE /* This is true if we are using Color Quickdraw. */ */
100 /* OBSOLETE int use_color_qd; */
102 /* OBSOLETE int inbackground; */
104 /* OBSOLETE Rect dragrect = */
105 /* OBSOLETE {-32000, -32000, 32000, 32000}; */
106 /* OBSOLETE Rect sizerect; */
108 /* OBSOLETE int sbarwid = 15; */
110 /* OBSOLETE /* Globals for the console window. */ */
112 /* OBSOLETE WindowPtr console_window; */
114 /* OBSOLETE ControlHandle console_v_scrollbar; */
116 /* OBSOLETE Rect console_v_scroll_rect; */
118 /* OBSOLETE TEHandle console_text; */
120 /* OBSOLETE Rect console_text_rect; */
122 /* OBSOLETE /* This will go away eventually. */ */
123 /* OBSOLETE gdb_has_a_terminal (void) */
125 /* OBSOLETE return 1; */
128 /* OBSOLETE mac_init (void) */
130 /* OBSOLETE SysEnvRec se; */
131 /* OBSOLETE int eventloopdone = 0; */
132 /* OBSOLETE char *str; */
133 /* OBSOLETE Boolean gotevent; */
134 /* OBSOLETE Point mouse; */
135 /* OBSOLETE EventRecord event; */
136 /* OBSOLETE WindowPtr win; */
137 /* OBSOLETE RgnHandle cursorRgn; */
138 /* OBSOLETE int i; */
139 /* OBSOLETE Handle menubar; */
140 /* OBSOLETE MenuHandle menu; */
141 /* OBSOLETE Handle siow_resource; */
143 /* OBSOLETE mac_app = 0; */
145 /* OBSOLETE str = getenv ("DEBUG_GDB"); */
146 /* OBSOLETE if (str != NULL && str[0] != '\0') */
148 /* OBSOLETE if (strcmp (str, "openp") == 0) */
149 /* OBSOLETE debug_openp = 1; */
152 /* OBSOLETE /* Don't do anything if we`re running under MPW. */ */
153 /* OBSOLETE if (!StandAlone) */
154 /* OBSOLETE return; */
156 /* OBSOLETE /* Don't do anything if we're using SIOW. */ */
157 /* OBSOLETE /* This test requires that the siow 0 resource, as defined in */
158 /* OBSOLETE {RIncludes}siow.r, not be messed with. If it is, then the */
159 /* OBSOLETE standard Mac setup below will step on SIOW's Mac setup and */
160 /* OBSOLETE most likely crash the machine. */ */
161 /* OBSOLETE siow_resource = GetResource ('siow', 0); */
162 /* OBSOLETE if (siow_resource != nil) */
163 /* OBSOLETE return; */
165 /* OBSOLETE mac_app = 1; */
167 /* OBSOLETE /* Do the standard Mac environment setup. */ */
168 /* OBSOLETE InitGraf (&QD (thePort)); */
169 /* OBSOLETE InitFonts (); */
170 /* OBSOLETE FlushEvents (everyEvent, 0); */
171 /* OBSOLETE InitWindows (); */
172 /* OBSOLETE InitMenus (); */
173 /* OBSOLETE TEInit (); */
174 /* OBSOLETE InitDialogs (NULL); */
175 /* OBSOLETE InitCursor (); */
177 /* OBSOLETE /* Color Quickdraw is different from Classic QD. */ */
178 /* OBSOLETE SysEnvirons (2, &se); */
179 /* OBSOLETE has_color_qd = se.hasColorQD; */
180 /* OBSOLETE /* Use it if we got it. */ */
181 /* OBSOLETE use_color_qd = has_color_qd; */
183 /* OBSOLETE sizerect.top = 50; */
184 /* OBSOLETE sizerect.left = 50; */
185 /* OBSOLETE sizerect.bottom = 1000; */
186 /* OBSOLETE sizerect.right = 1000; */
188 /* OBSOLETE sizerect.bottom = screenBits.bounds.bottom - screenBits.bounds.top; */
189 /* OBSOLETE sizerect.right = screenBits.bounds.right - screenBits.bounds.left; */
190 /* OBSOLETE #endif */
192 /* OBSOLETE /* Set up the menus. */ */
193 /* OBSOLETE menubar = GetNewMBar (mbMain); */
194 /* OBSOLETE SetMenuBar (menubar); */
195 /* OBSOLETE /* Add the DAs etc as usual. */ */
196 /* OBSOLETE menu = GetMHandle (mApple); */
197 /* OBSOLETE if (menu != nil) */
199 /* OBSOLETE AddResMenu (menu, 'DRVR'); */
201 /* OBSOLETE DrawMenuBar (); */
203 /* OBSOLETE new_console_window (); */
206 /* OBSOLETE new_console_window (void) */
208 /* OBSOLETE /* Create the main window we're going to play in. */ */
209 /* OBSOLETE if (has_color_qd) */
210 /* OBSOLETE console_window = GetNewCWindow (wConsole, NULL, (WindowPtr) - 1L); */
212 /* OBSOLETE console_window = GetNewWindow (wConsole, NULL, (WindowPtr) - 1L); */
214 /* OBSOLETE SetPort (console_window); */
215 /* OBSOLETE console_text_rect = console_window->portRect; */
216 /* OBSOLETE /* Leave 8 pixels of blank space, for aesthetic reasons and to */
217 /* OBSOLETE make it easier to select from the beginning of a line. */ */
218 /* OBSOLETE console_text_rect.left += 8; */
219 /* OBSOLETE console_text_rect.bottom -= sbarwid - 1; */
220 /* OBSOLETE console_text_rect.right -= sbarwid - 1; */
221 /* OBSOLETE console_text = TENew (&console_text_rect, &console_text_rect); */
222 /* OBSOLETE TESetSelect (0, 40000, console_text); */
223 /* OBSOLETE TEDelete (console_text); */
224 /* OBSOLETE TEAutoView (1, console_text); */
226 /* OBSOLETE console_v_scroll_rect = console_window->portRect; */
227 /* OBSOLETE console_v_scroll_rect.bottom -= sbarwid - 1; */
228 /* OBSOLETE console_v_scroll_rect.left = console_v_scroll_rect.right - sbarwid; */
229 /* OBSOLETE console_v_scrollbar = */
230 /* OBSOLETE NewControl (console_window, &console_v_scroll_rect, */
231 /* OBSOLETE "\p", 1, 0, 0, 0, scrollBarProc, 0L); */
233 /* OBSOLETE ShowWindow (console_window); */
234 /* OBSOLETE SelectWindow (console_window); */
237 /* OBSOLETE mac_command_loop (void) */
239 /* OBSOLETE SysEnvRec se; */
240 /* OBSOLETE int eventloopdone = 0; */
241 /* OBSOLETE Boolean gotevent; */
242 /* OBSOLETE Point mouse; */
243 /* OBSOLETE EventRecord event; */
244 /* OBSOLETE WindowPtr win; */
245 /* OBSOLETE RgnHandle cursorRgn; */
246 /* OBSOLETE int i, tm; */
247 /* OBSOLETE Handle menubar; */
248 /* OBSOLETE MenuHandle menu; */
250 /* OBSOLETE /* Figure out if the WaitNextEvent Trap is available. */ */
251 /* OBSOLETE use_wne = */
252 /* OBSOLETE (NGetTrapAddress (0x60, ToolTrap) != NGetTrapAddress (0x9f, ToolTrap)); */
253 /* OBSOLETE /* Pass WaitNextEvent an empty region the first time through. */ */
254 /* OBSOLETE cursorRgn = NewRgn (); */
255 /* OBSOLETE /* Go into the main event-handling loop. */ */
256 /* OBSOLETE while (!eventloopdone) */
258 /* OBSOLETE /* Use WaitNextEvent if it is available, otherwise GetNextEvent. */ */
259 /* OBSOLETE if (use_wne) */
261 /* OBSOLETE get_global_mouse (&mouse); */
262 /* OBSOLETE adjust_cursor (mouse, cursorRgn); */
263 /* OBSOLETE tm = GetCaretTime (); */
264 /* OBSOLETE gotevent = WaitNextEvent (everyEvent, &event, tm, cursorRgn); */
268 /* OBSOLETE SystemTask (); */
269 /* OBSOLETE gotevent = GetNextEvent (everyEvent, &event); */
271 /* OBSOLETE /* First decide if the event is for a dialog or is just any old event. */ */
272 /* OBSOLETE if (FrontWindow () != nil && IsDialogEvent (&event)) */
274 /* OBSOLETE short itemhit; */
275 /* OBSOLETE DialogPtr dialog; */
277 /* OBSOLETE /* Handle all the modeless dialogs here. */ */
278 /* OBSOLETE if (DialogSelect (&event, &dialog, &itemhit)) */
282 /* OBSOLETE else if (gotevent) */
284 /* OBSOLETE /* Make sure we have the right cursor before handling the event. */ */
285 /* OBSOLETE adjust_cursor (event.where, cursorRgn); */
286 /* OBSOLETE do_event (&event); */
290 /* OBSOLETE do_idle (); */
295 /* OBSOLETE /* Collect the global coordinates of the mouse pointer. */ */
297 /* OBSOLETE get_global_mouse (Point *mouse) */
299 /* OBSOLETE EventRecord evt; */
301 /* OBSOLETE OSEventAvail (0, &evt); */
302 /* OBSOLETE *mouse = evt.where; */
305 /* OBSOLETE /* Change the cursor's appearance to be appropriate for the given mouse */
306 /* OBSOLETE location. */ */
308 /* OBSOLETE adjust_cursor (Point mouse, RgnHandle region) */
312 /* OBSOLETE /* Decipher an event, maybe do something with it. */ */
314 /* OBSOLETE do_event (EventRecord *evt) */
316 /* OBSOLETE short part, err, rslt = 0; */
317 /* OBSOLETE WindowPtr win; */
318 /* OBSOLETE Boolean hit; */
319 /* OBSOLETE char key; */
320 /* OBSOLETE Point pnt; */
322 /* OBSOLETE switch (evt->what) */
324 /* OBSOLETE case mouseDown: */
325 /* OBSOLETE /* See if the click happened in a special part of the screen. */ */
326 /* OBSOLETE part = FindWindow (evt->where, &win); */
327 /* OBSOLETE switch (part) */
329 /* OBSOLETE case inMenuBar: */
330 /* OBSOLETE adjust_menus (); */
331 /* OBSOLETE do_menu_command (MenuSelect (evt->where)); */
332 /* OBSOLETE break; */
333 /* OBSOLETE case inSysWindow: */
334 /* OBSOLETE SystemClick (evt, win); */
335 /* OBSOLETE break; */
336 /* OBSOLETE case inContent: */
337 /* OBSOLETE if (win != FrontWindow ()) */
339 /* OBSOLETE /* Bring the clicked-on window to the front. */ */
340 /* OBSOLETE SelectWindow (win); */
341 /* OBSOLETE /* Fix the menu to match the new front window. */ */
342 /* OBSOLETE adjust_menus (); */
343 /* OBSOLETE /* We always want to discard the event now, since clicks in a */
344 /* OBSOLETE windows are often irreversible actions. */ */
347 /* OBSOLETE /* Mouse clicks in the front window do something useful. */ */
348 /* OBSOLETE do_mouse_down (win, evt); */
349 /* OBSOLETE break; */
350 /* OBSOLETE case inDrag: */
351 /* OBSOLETE /* Standard drag behavior, no tricks necessary. */ */
352 /* OBSOLETE DragWindow (win, evt->where, &dragrect); */
353 /* OBSOLETE break; */
354 /* OBSOLETE case inGrow: */
355 /* OBSOLETE grow_window (win, evt->where); */
356 /* OBSOLETE break; */
357 /* OBSOLETE case inZoomIn: */
358 /* OBSOLETE case inZoomOut: */
359 /* OBSOLETE zoom_window (win, evt->where, part); */
360 /* OBSOLETE break; */
361 /* OBSOLETE case inGoAway: */
362 /* OBSOLETE close_window (win); */
363 /* OBSOLETE break; */
365 /* OBSOLETE break; */
366 /* OBSOLETE case keyDown: */
367 /* OBSOLETE case autoKey: */
368 /* OBSOLETE key = evt->message & charCodeMask; */
369 /* OBSOLETE /* Check for menukey equivalents. */ */
370 /* OBSOLETE if (evt->modifiers & cmdKey) */
372 /* OBSOLETE if (evt->what == keyDown) */
374 /* OBSOLETE adjust_menus (); */
375 /* OBSOLETE do_menu_command (MenuKey (key)); */
380 /* OBSOLETE if (evt->what == keyDown) */
382 /* OBSOLETE /* Random keypress, interpret it. */ */
383 /* OBSOLETE do_keyboard_command (key); */
386 /* OBSOLETE break; */
387 /* OBSOLETE case activateEvt: */
388 /* OBSOLETE activate_window ((WindowPtr) evt->message, evt->modifiers & activeFlag); */
389 /* OBSOLETE break; */
390 /* OBSOLETE case updateEvt: */
391 /* OBSOLETE update_window ((WindowPtr) evt->message); */
392 /* OBSOLETE break; */
393 /* OBSOLETE case diskEvt: */
394 /* OBSOLETE /* Call DIBadMount in response to a diskEvt, so that the user can format */
395 /* OBSOLETE a floppy. (from DTS Sample) */ */
396 /* OBSOLETE if (HiWord (evt->message) != noErr) */
398 /* OBSOLETE SetPt (&pnt, 50, 50); */
399 /* OBSOLETE err = DIBadMount (pnt, evt->message); */
401 /* OBSOLETE break; */
402 /* OBSOLETE case app4Evt: */
403 /* OBSOLETE /* Grab only a single byte. */ */
404 /* OBSOLETE switch ((evt->message >> 24) & 0xFF) */
406 /* OBSOLETE case 0xfa: */
407 /* OBSOLETE break; */
408 /* OBSOLETE case 1: */
409 /* OBSOLETE inbackground = !(evt->message & 1); */
410 /* OBSOLETE activate_window (FrontWindow (), !inbackground); */
411 /* OBSOLETE break; */
413 /* OBSOLETE break; */
414 /* OBSOLETE case kHighLevelEvent: */
415 /* OBSOLETE AEProcessAppleEvent (evt); */
416 /* OBSOLETE break; */
417 /* OBSOLETE case nullEvent: */
418 /* OBSOLETE do_idle (); */
419 /* OBSOLETE rslt = 1; */
420 /* OBSOLETE break; */
421 /* OBSOLETE default: */
422 /* OBSOLETE break; */
424 /* OBSOLETE return rslt; */
427 /* OBSOLETE /* Do any idle-time activities. */ */
429 /* OBSOLETE do_idle (void) */
431 /* OBSOLETE TEIdle (console_text); */
434 /* OBSOLETE grow_window (WindowPtr win, Point where) */
436 /* OBSOLETE long winsize; */
437 /* OBSOLETE int h, v; */
438 /* OBSOLETE GrafPtr oldport; */
440 /* OBSOLETE winsize = GrowWindow (win, where, &sizerect); */
441 /* OBSOLETE /* Only do anything if it actually changed size. */ */
442 /* OBSOLETE if (winsize != 0) */
444 /* OBSOLETE GetPort (&oldport); */
445 /* OBSOLETE SetPort (win); */
446 /* OBSOLETE if (win == console_window) */
448 /* OBSOLETE EraseRect (&win->portRect); */
449 /* OBSOLETE h = LoWord (winsize); */
450 /* OBSOLETE v = HiWord (winsize); */
451 /* OBSOLETE SizeWindow (win, h, v, 1); */
452 /* OBSOLETE resize_console_window (); */
454 /* OBSOLETE SetPort (oldport); */
458 /* OBSOLETE zoom_window (WindowPtr win, Point where, short part) */
460 /* OBSOLETE ZoomWindow (win, part, (win == FrontWindow ())); */
461 /* OBSOLETE if (win == console_window) */
463 /* OBSOLETE resize_console_window (); */
467 /* OBSOLETE resize_console_window (void) */
469 /* OBSOLETE adjust_console_sizes (); */
470 /* OBSOLETE adjust_console_scrollbars (); */
471 /* OBSOLETE adjust_console_text (); */
472 /* OBSOLETE InvalRect (&console_window->portRect); */
475 /* OBSOLETE close_window (WindowPtr win) */
479 /* OBSOLETE pascal void */
480 /* OBSOLETE v_scroll_proc (ControlHandle control, short part) */
482 /* OBSOLETE int oldval, amount = 0, newval; */
483 /* OBSOLETE int pagesize = ((*console_text)->viewRect.bottom - (*console_text)->viewRect.top) / (*console_text)->lineHeight; */
484 /* OBSOLETE if (part) */
486 /* OBSOLETE oldval = GetCtlValue (control); */
487 /* OBSOLETE switch (part) */
489 /* OBSOLETE case inUpButton: */
490 /* OBSOLETE amount = 1; */
491 /* OBSOLETE break; */
492 /* OBSOLETE case inDownButton: */
493 /* OBSOLETE amount = -1; */
494 /* OBSOLETE break; */
495 /* OBSOLETE case inPageUp: */
496 /* OBSOLETE amount = pagesize; */
497 /* OBSOLETE break; */
498 /* OBSOLETE case inPageDown: */
499 /* OBSOLETE amount = -pagesize; */
500 /* OBSOLETE break; */
501 /* OBSOLETE default: */
502 /* OBSOLETE /* (should freak out) */ */
503 /* OBSOLETE break; */
505 /* OBSOLETE SetCtlValue (control, oldval - amount); */
506 /* OBSOLETE newval = GetCtlValue (control); */
507 /* OBSOLETE amount = oldval - newval; */
508 /* OBSOLETE if (amount) */
509 /* OBSOLETE TEScroll (0, amount * (*console_text)->lineHeight, console_text); */
513 /* OBSOLETE do_mouse_down (WindowPtr win, EventRecord * event) */
515 /* OBSOLETE short part, value; */
516 /* OBSOLETE Point mouse; */
517 /* OBSOLETE ControlHandle control; */
519 /* OBSOLETE if (1 /*is_app_window(win) */ ) */
521 /* OBSOLETE SetPort (win); */
522 /* OBSOLETE mouse = event->where; */
523 /* OBSOLETE GlobalToLocal (&mouse); */
524 /* OBSOLETE part = FindControl (mouse, win, &control); */
525 /* OBSOLETE if (control == console_v_scrollbar) */
527 /* OBSOLETE switch (part) */
529 /* OBSOLETE case inThumb: */
530 /* OBSOLETE value = GetCtlValue (control); */
531 /* OBSOLETE part = TrackControl (control, mouse, nil); */
532 /* OBSOLETE if (part) */
534 /* OBSOLETE value -= GetCtlValue (control); */
535 /* OBSOLETE if (value) */
536 /* OBSOLETE TEScroll (0, value * (*console_text)->lineHeight, */
537 /* OBSOLETE console_text); */
539 /* OBSOLETE break; */
540 /* OBSOLETE default: */
541 /* OBSOLETE #if 0 /* don't deal with right now */ */
542 /* OBSOLETE #if 1 /* universal headers */ */
543 /* OBSOLETE value = TrackControl (control, mouse, (ControlActionUPP) v_scroll_proc); */
545 /* OBSOLETE value = TrackControl (control, mouse, (ProcPtr) v_scroll_proc); */
546 /* OBSOLETE #endif */
547 /* OBSOLETE #endif */
548 /* OBSOLETE break; */
553 /* OBSOLETE TEClick (mouse, 0, console_text); */
558 /* OBSOLETE scroll_text (int hlines, int vlines) */
562 /* OBSOLETE activate_window (WindowPtr win, int activate) */
564 /* OBSOLETE Rect grow_rect; */
566 /* OBSOLETE if (win == nil) */
567 /* OBSOLETE return; */
568 /* OBSOLETE /* It's convenient to make the activated window also be the */
569 /* OBSOLETE current GrafPort. */ */
570 /* OBSOLETE if (activate) */
571 /* OBSOLETE SetPort (win); */
572 /* OBSOLETE /* Activate the console window's scrollbar. */ */
573 /* OBSOLETE if (win == console_window) */
575 /* OBSOLETE if (activate) */
577 /* OBSOLETE TEActivate (console_text); */
578 /* OBSOLETE /* Cause the grow icon to be redrawn at the next update. */ */
579 /* OBSOLETE grow_rect = console_window->portRect; */
580 /* OBSOLETE grow_rect.top = grow_rect.bottom - sbarwid; */
581 /* OBSOLETE grow_rect.left = grow_rect.right - sbarwid; */
582 /* OBSOLETE InvalRect (&grow_rect); */
586 /* OBSOLETE TEDeactivate (console_text); */
587 /* OBSOLETE DrawGrowIcon (console_window); */
589 /* OBSOLETE HiliteControl (console_v_scrollbar, (activate ? 0 : 255)); */
593 /* OBSOLETE update_window (WindowPtr win) */
595 /* OBSOLETE int controls = 1, growbox = 0; */
596 /* OBSOLETE GrafPtr oldport; */
598 /* OBSOLETE /* Set the updating window to be the current grafport. */ */
599 /* OBSOLETE GetPort (&oldport); */
600 /* OBSOLETE SetPort (win); */
601 /* OBSOLETE /* recalc_depths(); */ */
602 /* OBSOLETE BeginUpdate (win); */
603 /* OBSOLETE if (win == console_window) */
605 /* OBSOLETE draw_console (); */
606 /* OBSOLETE controls = 1; */
607 /* OBSOLETE growbox = 1; */
609 /* OBSOLETE if (controls) */
610 /* OBSOLETE UpdateControls (win, win->visRgn); */
611 /* OBSOLETE if (growbox) */
612 /* OBSOLETE DrawGrowIcon (win); */
613 /* OBSOLETE EndUpdate (win); */
614 /* OBSOLETE SetPort (oldport); */
617 /* OBSOLETE adjust_menus (void) */
621 /* OBSOLETE do_menu_command (long which) */
623 /* OBSOLETE short menuid, menuitem; */
624 /* OBSOLETE short itemHit; */
625 /* OBSOLETE Str255 daname; */
626 /* OBSOLETE short daRefNum; */
627 /* OBSOLETE Boolean handledbyda; */
628 /* OBSOLETE WindowPtr win; */
629 /* OBSOLETE short ditem; */
630 /* OBSOLETE int i; */
631 /* OBSOLETE char cmdbuf[300]; */
633 /* OBSOLETE cmdbuf[0] = '\0'; */
634 /* OBSOLETE menuid = HiWord (which); */
635 /* OBSOLETE menuitem = LoWord (which); */
636 /* OBSOLETE switch (menuid) */
638 /* OBSOLETE case mApple: */
639 /* OBSOLETE switch (menuitem) */
641 /* OBSOLETE case miAbout: */
642 /* OBSOLETE Alert (128, nil); */
643 /* OBSOLETE break; */
645 /* OBSOLETE case miHelp: */
646 /* OBSOLETE /* (should pop up help info) */ */
647 /* OBSOLETE break; */
648 /* OBSOLETE #endif */
649 /* OBSOLETE default: */
650 /* OBSOLETE GetItem (GetMHandle (mApple), menuitem, daname); */
651 /* OBSOLETE daRefNum = OpenDeskAcc (daname); */
653 /* OBSOLETE break; */
654 /* OBSOLETE case mFile: */
655 /* OBSOLETE switch (menuitem) */
657 /* OBSOLETE case miFileNew: */
658 /* OBSOLETE if (console_window == FrontWindow ()) */
660 /* OBSOLETE close_window (console_window); */
662 /* OBSOLETE new_console_window (); */
663 /* OBSOLETE break; */
664 /* OBSOLETE case miFileOpen: */
665 /* OBSOLETE SysBeep (20); */
666 /* OBSOLETE break; */
667 /* OBSOLETE case miFileQuit: */
668 /* OBSOLETE ExitToShell (); */
669 /* OBSOLETE break; */
671 /* OBSOLETE break; */
672 /* OBSOLETE case mEdit: */
673 /* OBSOLETE /* handledbyda = SystemEdit(menuitem-1); */ */
674 /* OBSOLETE switch (menuitem) */
676 /* OBSOLETE case miEditCut: */
677 /* OBSOLETE TECut (console_text); */
678 /* OBSOLETE break; */
679 /* OBSOLETE case miEditCopy: */
680 /* OBSOLETE TECopy (console_text); */
681 /* OBSOLETE break; */
682 /* OBSOLETE case miEditPaste: */
683 /* OBSOLETE TEPaste (console_text); */
684 /* OBSOLETE break; */
685 /* OBSOLETE case miEditClear: */
686 /* OBSOLETE TEDelete (console_text); */
687 /* OBSOLETE break; */
689 /* OBSOLETE /* All of these operations need the same postprocessing. */ */
690 /* OBSOLETE adjust_console_sizes (); */
691 /* OBSOLETE adjust_console_scrollbars (); */
692 /* OBSOLETE adjust_console_text (); */
693 /* OBSOLETE break; */
694 /* OBSOLETE case mDebug: */
695 /* OBSOLETE switch (menuitem) */
697 /* OBSOLETE case miDebugTarget: */
698 /* OBSOLETE sprintf (cmdbuf, "target %s", "remote"); */
699 /* OBSOLETE break; */
700 /* OBSOLETE case miDebugRun: */
701 /* OBSOLETE sprintf (cmdbuf, "run"); */
702 /* OBSOLETE break; */
703 /* OBSOLETE case miDebugContinue: */
704 /* OBSOLETE sprintf (cmdbuf, "continue"); */
705 /* OBSOLETE break; */
706 /* OBSOLETE case miDebugStep: */
707 /* OBSOLETE sprintf (cmdbuf, "step"); */
708 /* OBSOLETE break; */
709 /* OBSOLETE case miDebugNext: */
710 /* OBSOLETE sprintf (cmdbuf, "next"); */
711 /* OBSOLETE break; */
713 /* OBSOLETE break; */
715 /* OBSOLETE HiliteMenu (0); */
716 /* OBSOLETE /* Execute a command if one had been given. Do here because a command */
717 /* OBSOLETE may longjmp before we get a chance to unhilite the menu. */ */
718 /* OBSOLETE if (strlen (cmdbuf) > 0) */
719 /* OBSOLETE execute_command (cmdbuf, 0); */
722 /* OBSOLETE char commandbuf[1000]; */
724 /* OBSOLETE do_keyboard_command (int key) */
726 /* OBSOLETE int startpos, endpos, i, len; */
727 /* OBSOLETE char *last_newline; */
728 /* OBSOLETE char buf[10], *text_str, *command, *cmd_start; */
729 /* OBSOLETE CharsHandle text; */
731 /* OBSOLETE if (key == '\015' || key == '\003') */
733 /* OBSOLETE text = TEGetText (console_text); */
734 /* OBSOLETE HLock ((Handle) text); */
735 /* OBSOLETE text_str = *text; */
736 /* OBSOLETE startpos = (*console_text)->selStart; */
737 /* OBSOLETE endpos = (*console_text)->selEnd; */
738 /* OBSOLETE if (startpos != endpos) */
740 /* OBSOLETE len = endpos - startpos; */
741 /* OBSOLETE cmd_start = text_str + startpos; */
745 /* OBSOLETE for (i = startpos - 1; i >= 0; --i) */
746 /* OBSOLETE if (text_str[i] == '\015') */
747 /* OBSOLETE break; */
748 /* OBSOLETE last_newline = text_str + i; */
749 /* OBSOLETE len = (text_str + startpos) - 1 - last_newline; */
750 /* OBSOLETE cmd_start = last_newline + 1; */
752 /* OBSOLETE if (len > 1000) */
753 /* OBSOLETE len = 999; */
754 /* OBSOLETE if (len < 0) */
755 /* OBSOLETE len = 0; */
756 /* OBSOLETE strncpy (commandbuf + 1, cmd_start, len); */
757 /* OBSOLETE commandbuf[1 + len] = 0; */
758 /* OBSOLETE command = commandbuf + 1; */
759 /* OBSOLETE HUnlock ((Handle) text); */
760 /* OBSOLETE commandbuf[0] = strlen (command); */
762 /* OBSOLETE /* Insert a newline and recalculate before doing any command. */ */
763 /* OBSOLETE key = '\015'; */
764 /* OBSOLETE TEKey (key, console_text); */
765 /* OBSOLETE TEInsert (buf, 1, console_text); */
766 /* OBSOLETE adjust_console_sizes (); */
767 /* OBSOLETE adjust_console_scrollbars (); */
768 /* OBSOLETE adjust_console_text (); */
770 /* OBSOLETE if (strlen (command) > 0) */
772 /* OBSOLETE execute_command (command, 0); */
773 /* OBSOLETE bpstat_do_actions (&stop_bpstat); */
778 /* OBSOLETE /* A self-inserting character. This includes delete. */ */
779 /* OBSOLETE TEKey (key, console_text); */
783 /* OBSOLETE /* Draw all graphical stuff in the console window. */ */
785 /* OBSOLETE draw_console (void) */
787 /* OBSOLETE SetPort (console_window); */
788 /* OBSOLETE TEUpdate (&(console_window->portRect), console_text); */
791 /* OBSOLETE /* Cause an update of a given window's entire contents. */ */
793 /* OBSOLETE force_update (WindowPtr win) */
795 /* OBSOLETE GrafPtr oldport; */
797 /* OBSOLETE if (win == nil) */
798 /* OBSOLETE return; */
799 /* OBSOLETE GetPort (&oldport); */
800 /* OBSOLETE SetPort (win); */
801 /* OBSOLETE EraseRect (&win->portRect); */
802 /* OBSOLETE InvalRect (&win->portRect); */
803 /* OBSOLETE SetPort (oldport); */
806 /* OBSOLETE adjust_console_sizes (void) */
808 /* OBSOLETE Rect tmprect; */
810 /* OBSOLETE tmprect = console_window->portRect; */
811 /* OBSOLETE /* Move and size the scrollbar. */ */
812 /* OBSOLETE MoveControl (console_v_scrollbar, tmprect.right - sbarwid, 0); */
813 /* OBSOLETE SizeControl (console_v_scrollbar, sbarwid + 1, tmprect.bottom - sbarwid + 1); */
814 /* OBSOLETE /* Move and size the text. */ */
815 /* OBSOLETE tmprect.left += 7; */
816 /* OBSOLETE tmprect.right -= sbarwid; */
817 /* OBSOLETE tmprect.bottom -= sbarwid; */
818 /* OBSOLETE InsetRect (&tmprect, 1, 1); */
819 /* OBSOLETE (*console_text)->destRect = tmprect; */
820 /* OBSOLETE /* Fiddle bottom of viewrect to be even multiple of text lines. */ */
821 /* OBSOLETE tmprect.bottom = tmprect.top */
822 /* OBSOLETE + ((tmprect.bottom - tmprect.top) / (*console_text)->lineHeight) */
823 /* OBSOLETE * (*console_text)->lineHeight; */
824 /* OBSOLETE (*console_text)->viewRect = tmprect; */
827 /* OBSOLETE adjust_console_scrollbars (void) */
829 /* OBSOLETE int lines, newmax, value; */
831 /* OBSOLETE (*console_v_scrollbar)->contrlVis = 0; */
832 /* OBSOLETE lines = (*console_text)->nLines; */
833 /* OBSOLETE newmax = lines - (((*console_text)->viewRect.bottom */
834 /* OBSOLETE - (*console_text)->viewRect.top) */
835 /* OBSOLETE / (*console_text)->lineHeight); */
836 /* OBSOLETE if (newmax < 0) */
837 /* OBSOLETE newmax = 0; */
838 /* OBSOLETE SetCtlMax (console_v_scrollbar, newmax); */
839 /* OBSOLETE value = ((*console_text)->viewRect.top - (*console_text)->destRect.top) */
840 /* OBSOLETE / (*console_text)->lineHeight; */
841 /* OBSOLETE SetCtlValue (console_v_scrollbar, value); */
842 /* OBSOLETE (*console_v_scrollbar)->contrlVis = 0xff; */
843 /* OBSOLETE ShowControl (console_v_scrollbar); */
846 /* OBSOLETE /* Scroll the TE record so that it is consistent with the scrollbar(s). */ */
848 /* OBSOLETE adjust_console_text (void) */
850 /* OBSOLETE TEScroll (((*console_text)->viewRect.left */
851 /* OBSOLETE - (*console_text)->destRect.left) */
852 /* OBSOLETE - 0 /* get h scroll value */ , */
853 /* OBSOLETE ((((*console_text)->viewRect.top - (*console_text)->destRect.top) */
854 /* OBSOLETE / (*console_text)->lineHeight) */
855 /* OBSOLETE - GetCtlValue (console_v_scrollbar)) */
856 /* OBSOLETE * (*console_text)->lineHeight, */
857 /* OBSOLETE console_text); */
860 /* OBSOLETE /* Readline substitute. */ */
862 /* OBSOLETE char * */
863 /* OBSOLETE readline (char *prrompt) */
865 /* OBSOLETE return gdb_readline (prrompt); */
868 /* OBSOLETE char *rl_completer_word_break_characters; */
870 /* OBSOLETE char *rl_completer_quote_characters; */
872 /* OBSOLETE int (*rl_completion_entry_function) (); */
874 /* OBSOLETE int rl_point; */
876 /* OBSOLETE char *rl_line_buffer; */
878 /* OBSOLETE char *rl_readline_name; */
880 /* OBSOLETE /* History substitute. */ */
883 /* OBSOLETE add_history (char *buf) */
888 /* OBSOLETE stifle_history (int n) */
893 /* OBSOLETE unstifle_history (void) */
898 /* OBSOLETE read_history (char *name) */
903 /* OBSOLETE write_history (char *name) */
908 /* OBSOLETE history_expand (char *x, char **y) */
912 /* OBSOLETE extern HIST_ENTRY * */
913 /* OBSOLETE history_get (int xxx) */
915 /* OBSOLETE return NULL; */
918 /* OBSOLETE int history_base; */
920 /* OBSOLETE char * */
921 /* OBSOLETE filename_completion_function (char *text, char *name) */
923 /* OBSOLETE return "?"; */
926 /* OBSOLETE char * */
927 /* OBSOLETE tilde_expand (char *str) */
929 /* OBSOLETE return xstrdup (str); */
932 /* OBSOLETE /* Modified versions of standard I/O. */ */
934 /* OBSOLETE #undef fprintf */
937 /* OBSOLETE hacked_fprintf (FILE * fp, const char *fmt,...) */
939 /* OBSOLETE int ret; */
940 /* OBSOLETE va_list ap; */
942 /* OBSOLETE va_start (ap, fmt); */
943 /* OBSOLETE if (mac_app && (fp == stdout || fp == stderr)) */
945 /* OBSOLETE char buf[1000]; */
947 /* OBSOLETE ret = vsprintf (buf, fmt, ap); */
948 /* OBSOLETE TEInsert (buf, strlen (buf), console_text); */
951 /* OBSOLETE ret = vfprintf (fp, fmt, ap); */
952 /* OBSOLETE va_end (ap); */
953 /* OBSOLETE return ret; */
956 /* OBSOLETE #undef printf */
959 /* OBSOLETE hacked_printf (const char *fmt,...) */
961 /* OBSOLETE int ret; */
962 /* OBSOLETE va_list ap; */
964 /* OBSOLETE va_start (ap, fmt); */
965 /* OBSOLETE ret = hacked_vfprintf (stdout, fmt, ap); */
966 /* OBSOLETE va_end (ap); */
967 /* OBSOLETE return ret; */
970 /* OBSOLETE #undef vfprintf */
973 /* OBSOLETE hacked_vfprintf (FILE * fp, const char *format, va_list args) */
975 /* OBSOLETE if (mac_app && (fp == stdout || fp == stderr)) */
977 /* OBSOLETE char buf[1000]; */
978 /* OBSOLETE int ret; */
980 /* OBSOLETE ret = vsprintf (buf, format, args); */
981 /* OBSOLETE TEInsert (buf, strlen (buf), console_text); */
982 /* OBSOLETE if (strchr (buf, '\n')) */
984 /* OBSOLETE adjust_console_sizes (); */
985 /* OBSOLETE adjust_console_scrollbars (); */
986 /* OBSOLETE adjust_console_text (); */
988 /* OBSOLETE return ret; */
991 /* OBSOLETE return vfprintf (fp, format, args); */
994 /* OBSOLETE #undef fputs */
996 /* OBSOLETE hacked_fputs (const char *s, FILE * fp) */
998 /* OBSOLETE if (mac_app && (fp == stdout || fp == stderr)) */
1000 /* OBSOLETE TEInsert (s, strlen (s), console_text); */
1001 /* OBSOLETE if (strchr (s, '\n')) */
1003 /* OBSOLETE adjust_console_sizes (); */
1004 /* OBSOLETE adjust_console_scrollbars (); */
1005 /* OBSOLETE adjust_console_text (); */
1007 /* OBSOLETE return 0; */
1010 /* OBSOLETE return fputs (s, fp); */
1013 /* OBSOLETE #undef fputc */
1015 /* OBSOLETE hacked_fputc (const char c, FILE * fp) */
1017 /* OBSOLETE if (mac_app && (fp == stdout || fp == stderr)) */
1019 /* OBSOLETE char buf[1]; */
1021 /* OBSOLETE buf[0] = c; */
1022 /* OBSOLETE TEInsert (buf, 1, console_text); */
1023 /* OBSOLETE if (c == '\n') */
1025 /* OBSOLETE adjust_console_sizes (); */
1026 /* OBSOLETE adjust_console_scrollbars (); */
1027 /* OBSOLETE adjust_console_text (); */
1029 /* OBSOLETE return c; */
1032 /* OBSOLETE return fputc (c, fp); */
1035 /* OBSOLETE #undef putc */
1037 /* OBSOLETE hacked_putc (const char c, FILE * fp) */
1039 /* OBSOLETE if (mac_app && (fp == stdout || fp == stderr)) */
1041 /* OBSOLETE char buf[1]; */
1043 /* OBSOLETE buf[0] = c; */
1044 /* OBSOLETE TEInsert (buf, 1, console_text); */
1045 /* OBSOLETE if (c == '\n') */
1047 /* OBSOLETE adjust_console_sizes (); */
1048 /* OBSOLETE adjust_console_scrollbars (); */
1049 /* OBSOLETE adjust_console_text (); */
1051 /* OBSOLETE return c; */
1054 /* OBSOLETE return fputc (c, fp); */
1057 /* OBSOLETE #undef fflush */
1059 /* OBSOLETE hacked_fflush (FILE * fp) */
1061 /* OBSOLETE if (mac_app && (fp == stdout || fp == stderr)) */
1063 /* OBSOLETE adjust_console_sizes (); */
1064 /* OBSOLETE adjust_console_scrollbars (); */
1065 /* OBSOLETE adjust_console_text (); */
1066 /* OBSOLETE return 0; */
1068 /* OBSOLETE return fflush (fp); */
1071 /* OBSOLETE #undef fgetc */
1073 /* OBSOLETE hacked_fgetc (FILE * fp) */
1075 /* OBSOLETE if (mac_app && (fp == stdin)) */
1077 /* OBSOLETE /* Catch any attempts to use this. */ */
1078 /* OBSOLETE DebugStr ("\pShould not be reading from stdin!"); */
1079 /* OBSOLETE return '\n'; */
1081 /* OBSOLETE return fgetc (fp); */
This page took 0.051648 seconds and 5 git commands to generate.