Commit | Line | Data |
---|---|---|
d036b4d9 AC |
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. */ | |
4 | /* OBSOLETE */ | |
5 | /* OBSOLETE This file is part of GDB. */ | |
6 | /* OBSOLETE */ | |
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. */ | |
11 | /* OBSOLETE */ | |
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. */ | |
16 | /* OBSOLETE */ | |
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. */ */ | |
21 | /* OBSOLETE */ | |
22 | /* OBSOLETE #include "defs.h" */ | |
23 | /* OBSOLETE */ | |
24 | /* OBSOLETE #include <readline/readline.h> */ | |
25 | /* OBSOLETE #include <readline/history.h> */ | |
26 | /* OBSOLETE */ | |
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> */ | |
53 | /* OBSOLETE */ | |
54 | /* OBSOLETE #ifdef MPW */ | |
55 | /* OBSOLETE #define QD(whatever) (qd.##whatever) */ | |
56 | /* OBSOLETE #define QDPat(whatever) (&(qd.##whatever)) */ | |
57 | /* OBSOLETE #endif /* MPW */ */ | |
58 | /* OBSOLETE */ | |
59 | /* OBSOLETE #ifdef THINK_C */ | |
60 | /* OBSOLETE #define QD(whatever) (whatever) */ | |
61 | /* OBSOLETE #endif */ | |
62 | /* OBSOLETE */ | |
63 | /* OBSOLETE #define p2c(pstr,cbuf) \ */ | |
64 | /* OBSOLETE strncpy(cbuf, ((char *) (pstr) + 1), pstr[0]); \ */ | |
65 | /* OBSOLETE cbuf[pstr[0]] = '\0'; */ | |
66 | /* OBSOLETE */ | |
67 | /* OBSOLETE #define pascalify(STR) \ */ | |
68 | /* OBSOLETE sprintf(tmpbuf, " %s", STR); \ */ | |
69 | /* OBSOLETE tmpbuf[0] = strlen(STR); */ | |
70 | /* OBSOLETE */ | |
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" */ | |
81 | /* OBSOLETE */ | |
82 | /* OBSOLETE #include "mac-defs.h" */ | |
83 | /* OBSOLETE */ | |
84 | /* OBSOLETE int debug_openp = 0; */ | |
85 | /* OBSOLETE */ | |
86 | /* OBSOLETE /* This is true if we are running as a standalone application. */ */ | |
87 | /* OBSOLETE */ | |
88 | /* OBSOLETE int mac_app; */ | |
89 | /* OBSOLETE */ | |
90 | /* OBSOLETE /* This is true if we are using WaitNextEvent. */ */ | |
91 | /* OBSOLETE */ | |
92 | /* OBSOLETE int use_wne; */ | |
93 | /* OBSOLETE */ | |
94 | /* OBSOLETE /* This is true if we have Color Quickdraw. */ */ | |
95 | /* OBSOLETE */ | |
96 | /* OBSOLETE int has_color_qd; */ | |
97 | /* OBSOLETE */ | |
98 | /* OBSOLETE /* This is true if we are using Color Quickdraw. */ */ | |
99 | /* OBSOLETE */ | |
100 | /* OBSOLETE int use_color_qd; */ | |
101 | /* OBSOLETE */ | |
102 | /* OBSOLETE int inbackground; */ | |
103 | /* OBSOLETE */ | |
104 | /* OBSOLETE Rect dragrect = */ | |
105 | /* OBSOLETE {-32000, -32000, 32000, 32000}; */ | |
106 | /* OBSOLETE Rect sizerect; */ | |
107 | /* OBSOLETE */ | |
108 | /* OBSOLETE int sbarwid = 15; */ | |
109 | /* OBSOLETE */ | |
110 | /* OBSOLETE /* Globals for the console window. */ */ | |
111 | /* OBSOLETE */ | |
112 | /* OBSOLETE WindowPtr console_window; */ | |
113 | /* OBSOLETE */ | |
114 | /* OBSOLETE ControlHandle console_v_scrollbar; */ | |
115 | /* OBSOLETE */ | |
116 | /* OBSOLETE Rect console_v_scroll_rect; */ | |
117 | /* OBSOLETE */ | |
118 | /* OBSOLETE TEHandle console_text; */ | |
119 | /* OBSOLETE */ | |
120 | /* OBSOLETE Rect console_text_rect; */ | |
121 | /* OBSOLETE */ | |
122 | /* OBSOLETE /* This will go away eventually. */ */ | |
123 | /* OBSOLETE gdb_has_a_terminal (void) */ | |
124 | /* OBSOLETE { */ | |
125 | /* OBSOLETE return 1; */ | |
126 | /* OBSOLETE } */ | |
127 | /* OBSOLETE */ | |
128 | /* OBSOLETE mac_init (void) */ | |
129 | /* OBSOLETE { */ | |
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; */ | |
142 | /* OBSOLETE */ | |
143 | /* OBSOLETE mac_app = 0; */ | |
144 | /* OBSOLETE */ | |
145 | /* OBSOLETE str = getenv ("DEBUG_GDB"); */ | |
146 | /* OBSOLETE if (str != NULL && str[0] != '\0') */ | |
147 | /* OBSOLETE { */ | |
148 | /* OBSOLETE if (strcmp (str, "openp") == 0) */ | |
149 | /* OBSOLETE debug_openp = 1; */ | |
150 | /* OBSOLETE } */ | |
151 | /* OBSOLETE */ | |
152 | /* OBSOLETE /* Don't do anything if we`re running under MPW. */ */ | |
153 | /* OBSOLETE if (!StandAlone) */ | |
154 | /* OBSOLETE return; */ | |
155 | /* OBSOLETE */ | |
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; */ | |
164 | /* OBSOLETE */ | |
165 | /* OBSOLETE mac_app = 1; */ | |
166 | /* OBSOLETE */ | |
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 (); */ | |
176 | /* OBSOLETE */ | |
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; */ | |
182 | /* OBSOLETE */ | |
183 | /* OBSOLETE sizerect.top = 50; */ | |
184 | /* OBSOLETE sizerect.left = 50; */ | |
185 | /* OBSOLETE sizerect.bottom = 1000; */ | |
186 | /* OBSOLETE sizerect.right = 1000; */ | |
187 | /* OBSOLETE #if 0 */ | |
188 | /* OBSOLETE sizerect.bottom = screenBits.bounds.bottom - screenBits.bounds.top; */ | |
189 | /* OBSOLETE sizerect.right = screenBits.bounds.right - screenBits.bounds.left; */ | |
190 | /* OBSOLETE #endif */ | |
191 | /* OBSOLETE */ | |
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) */ | |
198 | /* OBSOLETE { */ | |
199 | /* OBSOLETE AddResMenu (menu, 'DRVR'); */ | |
200 | /* OBSOLETE } */ | |
201 | /* OBSOLETE DrawMenuBar (); */ | |
202 | /* OBSOLETE */ | |
203 | /* OBSOLETE new_console_window (); */ | |
204 | /* OBSOLETE } */ | |
205 | /* OBSOLETE */ | |
206 | /* OBSOLETE new_console_window (void) */ | |
207 | /* OBSOLETE { */ | |
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); */ | |
211 | /* OBSOLETE else */ | |
212 | /* OBSOLETE console_window = GetNewWindow (wConsole, NULL, (WindowPtr) - 1L); */ | |
213 | /* OBSOLETE */ | |
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); */ | |
225 | /* OBSOLETE */ | |
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); */ | |
232 | /* OBSOLETE */ | |
233 | /* OBSOLETE ShowWindow (console_window); */ | |
234 | /* OBSOLETE SelectWindow (console_window); */ | |
235 | /* OBSOLETE } */ | |
236 | /* OBSOLETE */ | |
237 | /* OBSOLETE mac_command_loop (void) */ | |
238 | /* OBSOLETE { */ | |
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; */ | |
249 | /* OBSOLETE */ | |
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) */ | |
257 | /* OBSOLETE { */ | |
258 | /* OBSOLETE /* Use WaitNextEvent if it is available, otherwise GetNextEvent. */ */ | |
259 | /* OBSOLETE if (use_wne) */ | |
260 | /* OBSOLETE { */ | |
261 | /* OBSOLETE get_global_mouse (&mouse); */ | |
262 | /* OBSOLETE adjust_cursor (mouse, cursorRgn); */ | |
263 | /* OBSOLETE tm = GetCaretTime (); */ | |
264 | /* OBSOLETE gotevent = WaitNextEvent (everyEvent, &event, tm, cursorRgn); */ | |
265 | /* OBSOLETE } */ | |
266 | /* OBSOLETE else */ | |
267 | /* OBSOLETE { */ | |
268 | /* OBSOLETE SystemTask (); */ | |
269 | /* OBSOLETE gotevent = GetNextEvent (everyEvent, &event); */ | |
270 | /* OBSOLETE } */ | |
271 | /* OBSOLETE /* First decide if the event is for a dialog or is just any old event. */ */ | |
272 | /* OBSOLETE if (FrontWindow () != nil && IsDialogEvent (&event)) */ | |
273 | /* OBSOLETE { */ | |
274 | /* OBSOLETE short itemhit; */ | |
275 | /* OBSOLETE DialogPtr dialog; */ | |
276 | /* OBSOLETE */ | |
277 | /* OBSOLETE /* Handle all the modeless dialogs here. */ */ | |
278 | /* OBSOLETE if (DialogSelect (&event, &dialog, &itemhit)) */ | |
279 | /* OBSOLETE { */ | |
280 | /* OBSOLETE } */ | |
281 | /* OBSOLETE } */ | |
282 | /* OBSOLETE else if (gotevent) */ | |
283 | /* OBSOLETE { */ | |
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); */ | |
287 | /* OBSOLETE } */ | |
288 | /* OBSOLETE else */ | |
289 | /* OBSOLETE { */ | |
290 | /* OBSOLETE do_idle (); */ | |
291 | /* OBSOLETE } */ | |
292 | /* OBSOLETE } */ | |
293 | /* OBSOLETE } */ | |
294 | /* OBSOLETE */ | |
295 | /* OBSOLETE /* Collect the global coordinates of the mouse pointer. */ */ | |
296 | /* OBSOLETE */ | |
297 | /* OBSOLETE get_global_mouse (Point *mouse) */ | |
298 | /* OBSOLETE { */ | |
299 | /* OBSOLETE EventRecord evt; */ | |
300 | /* OBSOLETE */ | |
301 | /* OBSOLETE OSEventAvail (0, &evt); */ | |
302 | /* OBSOLETE *mouse = evt.where; */ | |
303 | /* OBSOLETE } */ | |
304 | /* OBSOLETE */ | |
305 | /* OBSOLETE /* Change the cursor's appearance to be appropriate for the given mouse */ | |
306 | /* OBSOLETE location. */ */ | |
307 | /* OBSOLETE */ | |
308 | /* OBSOLETE adjust_cursor (Point mouse, RgnHandle region) */ | |
309 | /* OBSOLETE { */ | |
310 | /* OBSOLETE } */ | |
311 | /* OBSOLETE */ | |
312 | /* OBSOLETE /* Decipher an event, maybe do something with it. */ */ | |
313 | /* OBSOLETE */ | |
314 | /* OBSOLETE do_event (EventRecord *evt) */ | |
315 | /* OBSOLETE { */ | |
316 | /* OBSOLETE short part, err, rslt = 0; */ | |
317 | /* OBSOLETE WindowPtr win; */ | |
318 | /* OBSOLETE Boolean hit; */ | |
319 | /* OBSOLETE char key; */ | |
320 | /* OBSOLETE Point pnt; */ | |
321 | /* OBSOLETE */ | |
322 | /* OBSOLETE switch (evt->what) */ | |
323 | /* OBSOLETE { */ | |
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) */ | |
328 | /* OBSOLETE { */ | |
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 ()) */ | |
338 | /* OBSOLETE { */ | |
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. */ */ | |
345 | /* OBSOLETE } */ | |
346 | /* OBSOLETE else */ | |
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; */ | |
364 | /* OBSOLETE } */ | |
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) */ | |
371 | /* OBSOLETE { */ | |
372 | /* OBSOLETE if (evt->what == keyDown) */ | |
373 | /* OBSOLETE { */ | |
374 | /* OBSOLETE adjust_menus (); */ | |
375 | /* OBSOLETE do_menu_command (MenuKey (key)); */ | |
376 | /* OBSOLETE } */ | |
377 | /* OBSOLETE } */ | |
378 | /* OBSOLETE else */ | |
379 | /* OBSOLETE { */ | |
380 | /* OBSOLETE if (evt->what == keyDown) */ | |
381 | /* OBSOLETE { */ | |
382 | /* OBSOLETE /* Random keypress, interpret it. */ */ | |
383 | /* OBSOLETE do_keyboard_command (key); */ | |
384 | /* OBSOLETE } */ | |
385 | /* OBSOLETE } */ | |
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) */ | |
397 | /* OBSOLETE { */ | |
398 | /* OBSOLETE SetPt (&pnt, 50, 50); */ | |
399 | /* OBSOLETE err = DIBadMount (pnt, evt->message); */ | |
400 | /* OBSOLETE } */ | |
401 | /* OBSOLETE break; */ | |
402 | /* OBSOLETE case app4Evt: */ | |
403 | /* OBSOLETE /* Grab only a single byte. */ */ | |
404 | /* OBSOLETE switch ((evt->message >> 24) & 0xFF) */ | |
405 | /* OBSOLETE { */ | |
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; */ | |
412 | /* OBSOLETE } */ | |
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; */ | |
423 | /* OBSOLETE } */ | |
424 | /* OBSOLETE return rslt; */ | |
425 | /* OBSOLETE } */ | |
426 | /* OBSOLETE */ | |
427 | /* OBSOLETE /* Do any idle-time activities. */ */ | |
428 | /* OBSOLETE */ | |
429 | /* OBSOLETE do_idle (void) */ | |
430 | /* OBSOLETE { */ | |
431 | /* OBSOLETE TEIdle (console_text); */ | |
432 | /* OBSOLETE } */ | |
433 | /* OBSOLETE */ | |
434 | /* OBSOLETE grow_window (WindowPtr win, Point where) */ | |
435 | /* OBSOLETE { */ | |
436 | /* OBSOLETE long winsize; */ | |
437 | /* OBSOLETE int h, v; */ | |
438 | /* OBSOLETE GrafPtr oldport; */ | |
439 | /* OBSOLETE */ | |
440 | /* OBSOLETE winsize = GrowWindow (win, where, &sizerect); */ | |
441 | /* OBSOLETE /* Only do anything if it actually changed size. */ */ | |
442 | /* OBSOLETE if (winsize != 0) */ | |
443 | /* OBSOLETE { */ | |
444 | /* OBSOLETE GetPort (&oldport); */ | |
445 | /* OBSOLETE SetPort (win); */ | |
446 | /* OBSOLETE if (win == console_window) */ | |
447 | /* OBSOLETE { */ | |
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 (); */ | |
453 | /* OBSOLETE } */ | |
454 | /* OBSOLETE SetPort (oldport); */ | |
455 | /* OBSOLETE } */ | |
456 | /* OBSOLETE } */ | |
457 | /* OBSOLETE */ | |
458 | /* OBSOLETE zoom_window (WindowPtr win, Point where, short part) */ | |
459 | /* OBSOLETE { */ | |
460 | /* OBSOLETE ZoomWindow (win, part, (win == FrontWindow ())); */ | |
461 | /* OBSOLETE if (win == console_window) */ | |
462 | /* OBSOLETE { */ | |
463 | /* OBSOLETE resize_console_window (); */ | |
464 | /* OBSOLETE } */ | |
465 | /* OBSOLETE } */ | |
466 | /* OBSOLETE */ | |
467 | /* OBSOLETE resize_console_window (void) */ | |
468 | /* OBSOLETE { */ | |
469 | /* OBSOLETE adjust_console_sizes (); */ | |
470 | /* OBSOLETE adjust_console_scrollbars (); */ | |
471 | /* OBSOLETE adjust_console_text (); */ | |
472 | /* OBSOLETE InvalRect (&console_window->portRect); */ | |
473 | /* OBSOLETE } */ | |
474 | /* OBSOLETE */ | |
475 | /* OBSOLETE close_window (WindowPtr win) */ | |
476 | /* OBSOLETE { */ | |
477 | /* OBSOLETE } */ | |
478 | /* OBSOLETE */ | |
479 | /* OBSOLETE pascal void */ | |
480 | /* OBSOLETE v_scroll_proc (ControlHandle control, short part) */ | |
481 | /* OBSOLETE { */ | |
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) */ | |
485 | /* OBSOLETE { */ | |
486 | /* OBSOLETE oldval = GetCtlValue (control); */ | |
487 | /* OBSOLETE switch (part) */ | |
488 | /* OBSOLETE { */ | |
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; */ | |
504 | /* OBSOLETE } */ | |
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); */ | |
510 | /* OBSOLETE } */ | |
511 | /* OBSOLETE } */ | |
512 | /* OBSOLETE */ | |
513 | /* OBSOLETE do_mouse_down (WindowPtr win, EventRecord * event) */ | |
514 | /* OBSOLETE { */ | |
515 | /* OBSOLETE short part, value; */ | |
516 | /* OBSOLETE Point mouse; */ | |
517 | /* OBSOLETE ControlHandle control; */ | |
518 | /* OBSOLETE */ | |
519 | /* OBSOLETE if (1 /*is_app_window(win) */ ) */ | |
520 | /* OBSOLETE { */ | |
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) */ | |
526 | /* OBSOLETE { */ | |
527 | /* OBSOLETE switch (part) */ | |
528 | /* OBSOLETE { */ | |
529 | /* OBSOLETE case inThumb: */ | |
530 | /* OBSOLETE value = GetCtlValue (control); */ | |
531 | /* OBSOLETE part = TrackControl (control, mouse, nil); */ | |
532 | /* OBSOLETE if (part) */ | |
533 | /* OBSOLETE { */ | |
534 | /* OBSOLETE value -= GetCtlValue (control); */ | |
535 | /* OBSOLETE if (value) */ | |
536 | /* OBSOLETE TEScroll (0, value * (*console_text)->lineHeight, */ | |
537 | /* OBSOLETE console_text); */ | |
538 | /* OBSOLETE } */ | |
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); */ | |
544 | /* OBSOLETE #else */ | |
545 | /* OBSOLETE value = TrackControl (control, mouse, (ProcPtr) v_scroll_proc); */ | |
546 | /* OBSOLETE #endif */ | |
547 | /* OBSOLETE #endif */ | |
548 | /* OBSOLETE break; */ | |
549 | /* OBSOLETE } */ | |
550 | /* OBSOLETE } */ | |
551 | /* OBSOLETE else */ | |
552 | /* OBSOLETE { */ | |
553 | /* OBSOLETE TEClick (mouse, 0, console_text); */ | |
554 | /* OBSOLETE } */ | |
555 | /* OBSOLETE } */ | |
556 | /* OBSOLETE } */ | |
557 | /* OBSOLETE */ | |
558 | /* OBSOLETE scroll_text (int hlines, int vlines) */ | |
559 | /* OBSOLETE { */ | |
560 | /* OBSOLETE } */ | |
561 | /* OBSOLETE */ | |
562 | /* OBSOLETE activate_window (WindowPtr win, int activate) */ | |
563 | /* OBSOLETE { */ | |
564 | /* OBSOLETE Rect grow_rect; */ | |
565 | /* OBSOLETE */ | |
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) */ | |
574 | /* OBSOLETE { */ | |
575 | /* OBSOLETE if (activate) */ | |
576 | /* OBSOLETE { */ | |
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); */ | |
583 | /* OBSOLETE } */ | |
584 | /* OBSOLETE else */ | |
585 | /* OBSOLETE { */ | |
586 | /* OBSOLETE TEDeactivate (console_text); */ | |
587 | /* OBSOLETE DrawGrowIcon (console_window); */ | |
588 | /* OBSOLETE } */ | |
589 | /* OBSOLETE HiliteControl (console_v_scrollbar, (activate ? 0 : 255)); */ | |
590 | /* OBSOLETE } */ | |
591 | /* OBSOLETE } */ | |
592 | /* OBSOLETE */ | |
593 | /* OBSOLETE update_window (WindowPtr win) */ | |
594 | /* OBSOLETE { */ | |
595 | /* OBSOLETE int controls = 1, growbox = 0; */ | |
596 | /* OBSOLETE GrafPtr oldport; */ | |
597 | /* OBSOLETE */ | |
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) */ | |
604 | /* OBSOLETE { */ | |
605 | /* OBSOLETE draw_console (); */ | |
606 | /* OBSOLETE controls = 1; */ | |
607 | /* OBSOLETE growbox = 1; */ | |
608 | /* OBSOLETE } */ | |
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); */ | |
615 | /* OBSOLETE } */ | |
616 | /* OBSOLETE */ | |
617 | /* OBSOLETE adjust_menus (void) */ | |
618 | /* OBSOLETE { */ | |
619 | /* OBSOLETE } */ | |
620 | /* OBSOLETE */ | |
621 | /* OBSOLETE do_menu_command (long which) */ | |
622 | /* OBSOLETE { */ | |
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]; */ | |
632 | /* OBSOLETE */ | |
633 | /* OBSOLETE cmdbuf[0] = '\0'; */ | |
634 | /* OBSOLETE menuid = HiWord (which); */ | |
635 | /* OBSOLETE menuitem = LoWord (which); */ | |
636 | /* OBSOLETE switch (menuid) */ | |
637 | /* OBSOLETE { */ | |
638 | /* OBSOLETE case mApple: */ | |
639 | /* OBSOLETE switch (menuitem) */ | |
640 | /* OBSOLETE { */ | |
641 | /* OBSOLETE case miAbout: */ | |
642 | /* OBSOLETE Alert (128, nil); */ | |
643 | /* OBSOLETE break; */ | |
644 | /* OBSOLETE #if 0 */ | |
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); */ | |
652 | /* OBSOLETE } */ | |
653 | /* OBSOLETE break; */ | |
654 | /* OBSOLETE case mFile: */ | |
655 | /* OBSOLETE switch (menuitem) */ | |
656 | /* OBSOLETE { */ | |
657 | /* OBSOLETE case miFileNew: */ | |
658 | /* OBSOLETE if (console_window == FrontWindow ()) */ | |
659 | /* OBSOLETE { */ | |
660 | /* OBSOLETE close_window (console_window); */ | |
661 | /* OBSOLETE } */ | |
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; */ | |
670 | /* OBSOLETE } */ | |
671 | /* OBSOLETE break; */ | |
672 | /* OBSOLETE case mEdit: */ | |
673 | /* OBSOLETE /* handledbyda = SystemEdit(menuitem-1); */ */ | |
674 | /* OBSOLETE switch (menuitem) */ | |
675 | /* OBSOLETE { */ | |
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; */ | |
688 | /* OBSOLETE } */ | |
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) */ | |
696 | /* OBSOLETE { */ | |
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; */ | |
712 | /* OBSOLETE } */ | |
713 | /* OBSOLETE break; */ | |
714 | /* OBSOLETE } */ | |
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); */ | |
720 | /* OBSOLETE } */ | |
721 | /* OBSOLETE */ | |
722 | /* OBSOLETE char commandbuf[1000]; */ | |
723 | /* OBSOLETE */ | |
724 | /* OBSOLETE do_keyboard_command (int key) */ | |
725 | /* OBSOLETE { */ | |
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; */ | |
730 | /* OBSOLETE */ | |
731 | /* OBSOLETE if (key == '\015' || key == '\003') */ | |
732 | /* OBSOLETE { */ | |
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) */ | |
739 | /* OBSOLETE { */ | |
740 | /* OBSOLETE len = endpos - startpos; */ | |
741 | /* OBSOLETE cmd_start = text_str + startpos; */ | |
742 | /* OBSOLETE } */ | |
743 | /* OBSOLETE else */ | |
744 | /* OBSOLETE { */ | |
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; */ | |
751 | /* OBSOLETE } */ | |
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); */ | |
761 | /* OBSOLETE */ | |
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 (); */ | |
769 | /* OBSOLETE */ | |
770 | /* OBSOLETE if (strlen (command) > 0) */ | |
771 | /* OBSOLETE { */ | |
772 | /* OBSOLETE execute_command (command, 0); */ | |
773 | /* OBSOLETE bpstat_do_actions (&stop_bpstat); */ | |
774 | /* OBSOLETE } */ | |
775 | /* OBSOLETE } */ | |
776 | /* OBSOLETE else */ | |
777 | /* OBSOLETE { */ | |
778 | /* OBSOLETE /* A self-inserting character. This includes delete. */ */ | |
779 | /* OBSOLETE TEKey (key, console_text); */ | |
780 | /* OBSOLETE } */ | |
781 | /* OBSOLETE } */ | |
782 | /* OBSOLETE */ | |
783 | /* OBSOLETE /* Draw all graphical stuff in the console window. */ */ | |
784 | /* OBSOLETE */ | |
785 | /* OBSOLETE draw_console (void) */ | |
786 | /* OBSOLETE { */ | |
787 | /* OBSOLETE SetPort (console_window); */ | |
788 | /* OBSOLETE TEUpdate (&(console_window->portRect), console_text); */ | |
789 | /* OBSOLETE } */ | |
790 | /* OBSOLETE */ | |
791 | /* OBSOLETE /* Cause an update of a given window's entire contents. */ */ | |
792 | /* OBSOLETE */ | |
793 | /* OBSOLETE force_update (WindowPtr win) */ | |
794 | /* OBSOLETE { */ | |
795 | /* OBSOLETE GrafPtr oldport; */ | |
796 | /* OBSOLETE */ | |
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); */ | |
804 | /* OBSOLETE } */ | |
805 | /* OBSOLETE */ | |
806 | /* OBSOLETE adjust_console_sizes (void) */ | |
807 | /* OBSOLETE { */ | |
808 | /* OBSOLETE Rect tmprect; */ | |
809 | /* OBSOLETE */ | |
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; */ | |
825 | /* OBSOLETE } */ | |
826 | /* OBSOLETE */ | |
827 | /* OBSOLETE adjust_console_scrollbars (void) */ | |
828 | /* OBSOLETE { */ | |
829 | /* OBSOLETE int lines, newmax, value; */ | |
830 | /* OBSOLETE */ | |
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); */ | |
844 | /* OBSOLETE } */ | |
845 | /* OBSOLETE */ | |
846 | /* OBSOLETE /* Scroll the TE record so that it is consistent with the scrollbar(s). */ */ | |
847 | /* OBSOLETE */ | |
848 | /* OBSOLETE adjust_console_text (void) */ | |
849 | /* OBSOLETE { */ | |
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); */ | |
858 | /* OBSOLETE } */ | |
859 | /* OBSOLETE */ | |
860 | /* OBSOLETE /* Readline substitute. */ */ | |
861 | /* OBSOLETE */ | |
862 | /* OBSOLETE char * */ | |
863 | /* OBSOLETE readline (char *prrompt) */ | |
864 | /* OBSOLETE { */ | |
865 | /* OBSOLETE return gdb_readline (prrompt); */ | |
866 | /* OBSOLETE } */ | |
867 | /* OBSOLETE */ | |
868 | /* OBSOLETE char *rl_completer_word_break_characters; */ | |
869 | /* OBSOLETE */ | |
870 | /* OBSOLETE char *rl_completer_quote_characters; */ | |
871 | /* OBSOLETE */ | |
872 | /* OBSOLETE int (*rl_completion_entry_function) (); */ | |
873 | /* OBSOLETE */ | |
874 | /* OBSOLETE int rl_point; */ | |
875 | /* OBSOLETE */ | |
876 | /* OBSOLETE char *rl_line_buffer; */ | |
877 | /* OBSOLETE */ | |
878 | /* OBSOLETE char *rl_readline_name; */ | |
879 | /* OBSOLETE */ | |
880 | /* OBSOLETE /* History substitute. */ */ | |
881 | /* OBSOLETE */ | |
882 | /* OBSOLETE void */ | |
883 | /* OBSOLETE add_history (char *buf) */ | |
884 | /* OBSOLETE { */ | |
885 | /* OBSOLETE } */ | |
886 | /* OBSOLETE */ | |
887 | /* OBSOLETE void */ | |
888 | /* OBSOLETE stifle_history (int n) */ | |
889 | /* OBSOLETE { */ | |
890 | /* OBSOLETE } */ | |
891 | /* OBSOLETE */ | |
892 | /* OBSOLETE int */ | |
893 | /* OBSOLETE unstifle_history (void) */ | |
894 | /* OBSOLETE { */ | |
895 | /* OBSOLETE } */ | |
896 | /* OBSOLETE */ | |
897 | /* OBSOLETE int */ | |
898 | /* OBSOLETE read_history (char *name) */ | |
899 | /* OBSOLETE { */ | |
900 | /* OBSOLETE } */ | |
901 | /* OBSOLETE */ | |
902 | /* OBSOLETE int */ | |
903 | /* OBSOLETE write_history (char *name) */ | |
904 | /* OBSOLETE { */ | |
905 | /* OBSOLETE } */ | |
906 | /* OBSOLETE */ | |
907 | /* OBSOLETE int */ | |
908 | /* OBSOLETE history_expand (char *x, char **y) */ | |
909 | /* OBSOLETE { */ | |
910 | /* OBSOLETE } */ | |
911 | /* OBSOLETE */ | |
912 | /* OBSOLETE extern HIST_ENTRY * */ | |
913 | /* OBSOLETE history_get (int xxx) */ | |
914 | /* OBSOLETE { */ | |
915 | /* OBSOLETE return NULL; */ | |
916 | /* OBSOLETE } */ | |
917 | /* OBSOLETE */ | |
918 | /* OBSOLETE int history_base; */ | |
919 | /* OBSOLETE */ | |
920 | /* OBSOLETE char * */ | |
921 | /* OBSOLETE filename_completion_function (char *text, char *name) */ | |
922 | /* OBSOLETE { */ | |
923 | /* OBSOLETE return "?"; */ | |
924 | /* OBSOLETE } */ | |
925 | /* OBSOLETE */ | |
926 | /* OBSOLETE char * */ | |
927 | /* OBSOLETE tilde_expand (char *str) */ | |
928 | /* OBSOLETE { */ | |
929 | /* OBSOLETE return xstrdup (str); */ | |
930 | /* OBSOLETE } */ | |
931 | /* OBSOLETE */ | |
932 | /* OBSOLETE /* Modified versions of standard I/O. */ */ | |
933 | /* OBSOLETE */ | |
934 | /* OBSOLETE #undef fprintf */ | |
935 | /* OBSOLETE */ | |
936 | /* OBSOLETE int */ | |
937 | /* OBSOLETE hacked_fprintf (FILE * fp, const char *fmt,...) */ | |
938 | /* OBSOLETE { */ | |
939 | /* OBSOLETE int ret; */ | |
940 | /* OBSOLETE va_list ap; */ | |
941 | /* OBSOLETE */ | |
942 | /* OBSOLETE va_start (ap, fmt); */ | |
943 | /* OBSOLETE if (mac_app && (fp == stdout || fp == stderr)) */ | |
944 | /* OBSOLETE { */ | |
945 | /* OBSOLETE char buf[1000]; */ | |
946 | /* OBSOLETE */ | |
947 | /* OBSOLETE ret = vsprintf (buf, fmt, ap); */ | |
948 | /* OBSOLETE TEInsert (buf, strlen (buf), console_text); */ | |
949 | /* OBSOLETE } */ | |
950 | /* OBSOLETE else */ | |
951 | /* OBSOLETE ret = vfprintf (fp, fmt, ap); */ | |
952 | /* OBSOLETE va_end (ap); */ | |
953 | /* OBSOLETE return ret; */ | |
954 | /* OBSOLETE } */ | |
955 | /* OBSOLETE */ | |
956 | /* OBSOLETE #undef printf */ | |
957 | /* OBSOLETE */ | |
958 | /* OBSOLETE int */ | |
959 | /* OBSOLETE hacked_printf (const char *fmt,...) */ | |
960 | /* OBSOLETE { */ | |
961 | /* OBSOLETE int ret; */ | |
962 | /* OBSOLETE va_list ap; */ | |
963 | /* OBSOLETE */ | |
964 | /* OBSOLETE va_start (ap, fmt); */ | |
965 | /* OBSOLETE ret = hacked_vfprintf (stdout, fmt, ap); */ | |
966 | /* OBSOLETE va_end (ap); */ | |
967 | /* OBSOLETE return ret; */ | |
968 | /* OBSOLETE } */ | |
969 | /* OBSOLETE */ | |
970 | /* OBSOLETE #undef vfprintf */ | |
971 | /* OBSOLETE */ | |
972 | /* OBSOLETE int */ | |
973 | /* OBSOLETE hacked_vfprintf (FILE * fp, const char *format, va_list args) */ | |
974 | /* OBSOLETE { */ | |
975 | /* OBSOLETE if (mac_app && (fp == stdout || fp == stderr)) */ | |
976 | /* OBSOLETE { */ | |
977 | /* OBSOLETE char buf[1000]; */ | |
978 | /* OBSOLETE int ret; */ | |
979 | /* OBSOLETE */ | |
980 | /* OBSOLETE ret = vsprintf (buf, format, args); */ | |
981 | /* OBSOLETE TEInsert (buf, strlen (buf), console_text); */ | |
982 | /* OBSOLETE if (strchr (buf, '\n')) */ | |
983 | /* OBSOLETE { */ | |
984 | /* OBSOLETE adjust_console_sizes (); */ | |
985 | /* OBSOLETE adjust_console_scrollbars (); */ | |
986 | /* OBSOLETE adjust_console_text (); */ | |
987 | /* OBSOLETE } */ | |
988 | /* OBSOLETE return ret; */ | |
989 | /* OBSOLETE } */ | |
990 | /* OBSOLETE else */ | |
991 | /* OBSOLETE return vfprintf (fp, format, args); */ | |
992 | /* OBSOLETE } */ | |
993 | /* OBSOLETE */ | |
994 | /* OBSOLETE #undef fputs */ | |
995 | /* OBSOLETE */ | |
996 | /* OBSOLETE hacked_fputs (const char *s, FILE * fp) */ | |
997 | /* OBSOLETE { */ | |
998 | /* OBSOLETE if (mac_app && (fp == stdout || fp == stderr)) */ | |
999 | /* OBSOLETE { */ | |
1000 | /* OBSOLETE TEInsert (s, strlen (s), console_text); */ | |
1001 | /* OBSOLETE if (strchr (s, '\n')) */ | |
1002 | /* OBSOLETE { */ | |
1003 | /* OBSOLETE adjust_console_sizes (); */ | |
1004 | /* OBSOLETE adjust_console_scrollbars (); */ | |
1005 | /* OBSOLETE adjust_console_text (); */ | |
1006 | /* OBSOLETE } */ | |
1007 | /* OBSOLETE return 0; */ | |
1008 | /* OBSOLETE } */ | |
1009 | /* OBSOLETE else */ | |
1010 | /* OBSOLETE return fputs (s, fp); */ | |
1011 | /* OBSOLETE } */ | |
1012 | /* OBSOLETE */ | |
1013 | /* OBSOLETE #undef fputc */ | |
1014 | /* OBSOLETE */ | |
1015 | /* OBSOLETE hacked_fputc (const char c, FILE * fp) */ | |
1016 | /* OBSOLETE { */ | |
1017 | /* OBSOLETE if (mac_app && (fp == stdout || fp == stderr)) */ | |
1018 | /* OBSOLETE { */ | |
1019 | /* OBSOLETE char buf[1]; */ | |
1020 | /* OBSOLETE */ | |
1021 | /* OBSOLETE buf[0] = c; */ | |
1022 | /* OBSOLETE TEInsert (buf, 1, console_text); */ | |
1023 | /* OBSOLETE if (c == '\n') */ | |
1024 | /* OBSOLETE { */ | |
1025 | /* OBSOLETE adjust_console_sizes (); */ | |
1026 | /* OBSOLETE adjust_console_scrollbars (); */ | |
1027 | /* OBSOLETE adjust_console_text (); */ | |
1028 | /* OBSOLETE } */ | |
1029 | /* OBSOLETE return c; */ | |
1030 | /* OBSOLETE } */ | |
1031 | /* OBSOLETE else */ | |
1032 | /* OBSOLETE return fputc (c, fp); */ | |
1033 | /* OBSOLETE } */ | |
1034 | /* OBSOLETE */ | |
1035 | /* OBSOLETE #undef putc */ | |
1036 | /* OBSOLETE */ | |
1037 | /* OBSOLETE hacked_putc (const char c, FILE * fp) */ | |
1038 | /* OBSOLETE { */ | |
1039 | /* OBSOLETE if (mac_app && (fp == stdout || fp == stderr)) */ | |
1040 | /* OBSOLETE { */ | |
1041 | /* OBSOLETE char buf[1]; */ | |
1042 | /* OBSOLETE */ | |
1043 | /* OBSOLETE buf[0] = c; */ | |
1044 | /* OBSOLETE TEInsert (buf, 1, console_text); */ | |
1045 | /* OBSOLETE if (c == '\n') */ | |
1046 | /* OBSOLETE { */ | |
1047 | /* OBSOLETE adjust_console_sizes (); */ | |
1048 | /* OBSOLETE adjust_console_scrollbars (); */ | |
1049 | /* OBSOLETE adjust_console_text (); */ | |
1050 | /* OBSOLETE } */ | |
1051 | /* OBSOLETE return c; */ | |
1052 | /* OBSOLETE } */ | |
1053 | /* OBSOLETE else */ | |
1054 | /* OBSOLETE return fputc (c, fp); */ | |
1055 | /* OBSOLETE } */ | |
1056 | /* OBSOLETE */ | |
1057 | /* OBSOLETE #undef fflush */ | |
1058 | /* OBSOLETE */ | |
1059 | /* OBSOLETE hacked_fflush (FILE * fp) */ | |
1060 | /* OBSOLETE { */ | |
1061 | /* OBSOLETE if (mac_app && (fp == stdout || fp == stderr)) */ | |
1062 | /* OBSOLETE { */ | |
1063 | /* OBSOLETE adjust_console_sizes (); */ | |
1064 | /* OBSOLETE adjust_console_scrollbars (); */ | |
1065 | /* OBSOLETE adjust_console_text (); */ | |
1066 | /* OBSOLETE return 0; */ | |
1067 | /* OBSOLETE } */ | |
1068 | /* OBSOLETE return fflush (fp); */ | |
1069 | /* OBSOLETE } */ | |
1070 | /* OBSOLETE */ | |
1071 | /* OBSOLETE #undef fgetc */ | |
1072 | /* OBSOLETE */ | |
1073 | /* OBSOLETE hacked_fgetc (FILE * fp) */ | |
1074 | /* OBSOLETE { */ | |
1075 | /* OBSOLETE if (mac_app && (fp == stdin)) */ | |
1076 | /* OBSOLETE { */ | |
1077 | /* OBSOLETE /* Catch any attempts to use this. */ */ | |
1078 | /* OBSOLETE DebugStr ("\pShould not be reading from stdin!"); */ | |
1079 | /* OBSOLETE return '\n'; */ | |
1080 | /* OBSOLETE } */ | |
1081 | /* OBSOLETE return fgetc (fp); */ | |
1082 | /* OBSOLETE } */ |