1994-03-24 06:14:11 +08:00
|
|
|
/* Remote serial interface for local (hardwired) serial ports for Macintosh.
|
|
|
|
Copyright 1994 Free Software Foundation, Inc.
|
Wed Jun 15 17:36:07 1994 Stan Shebs (shebs@andros.cygnus.com)
* mpw-make.in (.c.o, .gc.o): Prefix segment names with gdb_.
(top.c.o, annotate.c.o): Add build rules.
* macgdb.r (SysTypes.r): Include.
('vers'): New resource, version info.
(mFile, mEdit, mDebug): Enable all menu items.
(mDebug): Add key equivalents for continue, step, next.
(wConsole): Add zoom and close boxes to window.
* mac-xdep.c (new_console_window): New function, code taken from
mac_init.
(mac_command_loop): Use GetCaretTime for wait interval, call
do_idle on null events.
(do_idle): New function.
(zoom_window): Implement zooming.
(v_scroll_proc): New function, handles vertical scrolling.
(activate_window): Do activation of console window.
(do_menu_command): Implement items of file, edit, and debug menus.
(do_keyboard_command): Fix command extraction.
(adjust_console_sizes, adjust_console_text): New functions.
(hacked_fprintf, hacked_vfprintf, hacked_fputs, hacked_fputc,
hacked_putc): Don't call draw_console.
* ser-mac.c (mac_open): Add an error message for invalid ports.
(first_mac_write): New global.
(mac_write): Use first_mac_write to sleep on first several writes.
1994-06-16 09:03:01 +08:00
|
|
|
Contributed by Cygnus Support. Written by Stan Shebs.
|
1994-03-24 06:14:11 +08:00
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
1995-08-02 11:41:12 +08:00
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
1994-03-24 06:14:11 +08:00
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "serial.h"
|
|
|
|
|
|
|
|
#include <Types.h>
|
|
|
|
#include <Devices.h>
|
1994-07-02 02:44:26 +08:00
|
|
|
/* This is the regular Mac Serial.h, but copied to a different name
|
|
|
|
so as not to get confused with the GDB serial.h above. */
|
|
|
|
#include "MacSerial.h"
|
1994-03-24 06:14:11 +08:00
|
|
|
|
|
|
|
/* This is unused for now. We just return a placeholder. */
|
|
|
|
|
|
|
|
struct mac_ttystate
|
|
|
|
{
|
|
|
|
int bogus;
|
|
|
|
};
|
|
|
|
|
|
|
|
static int mac_open PARAMS ((serial_t scb, const char *name));
|
|
|
|
static void mac_raw PARAMS ((serial_t scb));
|
|
|
|
static int mac_readchar PARAMS ((serial_t scb, int timeout));
|
|
|
|
static int mac_setbaudrate PARAMS ((serial_t scb, int rate));
|
|
|
|
static int mac_write PARAMS ((serial_t scb, const char *str, int len));
|
|
|
|
static void mac_close PARAMS ((serial_t scb));
|
|
|
|
static serial_ttystate mac_get_tty_state PARAMS ((serial_t scb));
|
|
|
|
static int mac_set_tty_state PARAMS ((serial_t scb, serial_ttystate state));
|
|
|
|
static char *aptr PARAMS ((short p));
|
|
|
|
|
|
|
|
short input_refnum;
|
|
|
|
short output_refnum;
|
|
|
|
|
|
|
|
char *mac_input_buffer;
|
|
|
|
char *mac_output_buffer;
|
|
|
|
|
|
|
|
static int
|
|
|
|
mac_open (scb, name)
|
|
|
|
serial_t scb;
|
|
|
|
const char *name;
|
|
|
|
{
|
|
|
|
OSErr err;
|
|
|
|
|
|
|
|
/* Alloc buffer space first - that way any allocation failures are
|
|
|
|
intercepted before the serial driver gets involved. */
|
|
|
|
if (mac_input_buffer == NULL)
|
1996-01-09 08:37:35 +08:00
|
|
|
mac_input_buffer = (char *) xmalloc (4096);
|
1994-03-24 06:14:11 +08:00
|
|
|
/* Match on a name and open a port. */
|
|
|
|
if (strcmp (name, "modem") == 0)
|
|
|
|
{
|
|
|
|
err = OpenDriver ("\p.AIn", &input_refnum);
|
|
|
|
if (err != 0)
|
|
|
|
{
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
err = OpenDriver ("\p.AOut", &output_refnum);
|
|
|
|
if (err != 0)
|
|
|
|
{
|
|
|
|
CloseDriver (input_refnum);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (strcmp (name, "printer") == 0)
|
|
|
|
{
|
|
|
|
err = OpenDriver ("\p.BIn", &input_refnum);
|
|
|
|
if (err != 0)
|
|
|
|
{
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
err = OpenDriver ("\p.BOut", &output_refnum);
|
|
|
|
if (err != 0)
|
|
|
|
{
|
|
|
|
CloseDriver (input_refnum);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
/* fake */
|
|
|
|
scb->fd = 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1995-03-18 07:21:12 +08:00
|
|
|
error ("You must specify a valid serial port name; your choices are `modem' or `printer'.");
|
1994-03-24 06:14:11 +08:00
|
|
|
errno = ENOENT;
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
/* We got something open. */
|
|
|
|
if (1 /* using custom buffer */)
|
1996-01-09 08:37:35 +08:00
|
|
|
SerSetBuf (input_refnum, mac_input_buffer, 4096);
|
1994-03-24 06:14:11 +08:00
|
|
|
/* Set to a GDB-preferred state. */
|
|
|
|
SerReset (input_refnum, stop10|noParity|data8|baud9600);
|
|
|
|
SerReset (output_refnum, stop10|noParity|data8|baud9600);
|
|
|
|
{
|
|
|
|
CntrlParam cb;
|
|
|
|
struct SerShk *handshake;
|
|
|
|
|
|
|
|
cb.ioCRefNum = output_refnum;
|
|
|
|
cb.csCode = 14;
|
|
|
|
handshake = (struct SerShk *) &cb.csParam[0];
|
|
|
|
handshake->fXOn = 0;
|
|
|
|
handshake->fCTS = 0;
|
|
|
|
handshake->xOn = 0;
|
|
|
|
handshake->xOff = 0;
|
|
|
|
handshake->errs = 0;
|
|
|
|
handshake->evts = 0;
|
|
|
|
handshake->fInX = 0;
|
|
|
|
handshake->fDTR = 0;
|
|
|
|
err = PBControl ((ParmBlkPtr) &cb, 0);
|
|
|
|
if (err < 0)
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
/* fake */
|
|
|
|
scb->fd = 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
mac_noop (scb)
|
|
|
|
serial_t scb;
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
mac_raw (scb)
|
|
|
|
serial_t scb;
|
|
|
|
{
|
|
|
|
/* Always effectively in raw mode. */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Read a character with user-specified timeout. TIMEOUT is number of seconds
|
|
|
|
to wait, or -1 to wait forever. Use timeout of 0 to effect a poll. Returns
|
|
|
|
char if successful. Returns -2 if timeout expired, EOF if line dropped
|
|
|
|
dead, or -3 for any other error (see errno in that case). */
|
|
|
|
|
|
|
|
static int
|
|
|
|
mac_readchar (scb, timeout)
|
|
|
|
serial_t scb;
|
|
|
|
int timeout;
|
|
|
|
{
|
|
|
|
int status, n;
|
* mpw-make.in (VERSION): Update to 4.12.3.
(SiowGDB): New target, GDB using SIOW library.
(init-new.c): New target, attempt to generate init.c from sources.
(main.c.o, top.c.o): Put each in its own segment.
* main.c (main) [MPW]: Always call mac_init.
* utils.c (query) [MPW]: Always return "yes" if in MacGDB, output
an extra newline otherwise.
* mac-xdep.c: More comments in various places, remove junk.
(mac_init): Add tests for MPW and SIOW.
(use_wne, has_color_qd): Renamed.
(use_color_qd): New variable.
(grow_window): Only do console resizing to console window,
call resize_console_window.
(zoom_window): Call resize_console_window.
(resize_console_window, scroll_text): New functions.
(adjust_console_sizes): Always align viewrect to even multiples of
text lines.
(adjust_console_text): Always scroll by whole lines.
(hacked_vfprintf, hacked_puts, hacked_fputc, hacked_putc): Force a
recalculation of scroll positions if a newline was output.
(hacked_fflush): Similarly, for flushing.
(hacked_fgetc): New function, aborts if called in MacGDB.
* ser-mac.c (mac_readchar): Rename starttime to start_time,
remove debugging printf.
(mac_write): Sleep on first 4 writes.
(sec_sleep): New function, works like standard sleep.
* macgdb.r: Adjust positioning and contents of About box.
Set minimum size to 2000K, preferred size to 5000K.
* config/m68k/xm-mpw.h (fgetc): Define as a macro.
1994-06-23 03:57:02 +08:00
|
|
|
/* time_t */ unsigned long start_time, now;
|
1994-03-24 06:14:11 +08:00
|
|
|
OSErr err;
|
|
|
|
CntrlParam cb;
|
|
|
|
IOParam pb;
|
|
|
|
|
|
|
|
if (scb->bufcnt-- > 0)
|
|
|
|
return *scb->bufp++;
|
|
|
|
|
* mpw-make.in (VERSION): Update to 4.12.3.
(SiowGDB): New target, GDB using SIOW library.
(init-new.c): New target, attempt to generate init.c from sources.
(main.c.o, top.c.o): Put each in its own segment.
* main.c (main) [MPW]: Always call mac_init.
* utils.c (query) [MPW]: Always return "yes" if in MacGDB, output
an extra newline otherwise.
* mac-xdep.c: More comments in various places, remove junk.
(mac_init): Add tests for MPW and SIOW.
(use_wne, has_color_qd): Renamed.
(use_color_qd): New variable.
(grow_window): Only do console resizing to console window,
call resize_console_window.
(zoom_window): Call resize_console_window.
(resize_console_window, scroll_text): New functions.
(adjust_console_sizes): Always align viewrect to even multiples of
text lines.
(adjust_console_text): Always scroll by whole lines.
(hacked_vfprintf, hacked_puts, hacked_fputc, hacked_putc): Force a
recalculation of scroll positions if a newline was output.
(hacked_fflush): Similarly, for flushing.
(hacked_fgetc): New function, aborts if called in MacGDB.
* ser-mac.c (mac_readchar): Rename starttime to start_time,
remove debugging printf.
(mac_write): Sleep on first 4 writes.
(sec_sleep): New function, works like standard sleep.
* macgdb.r: Adjust positioning and contents of About box.
Set minimum size to 2000K, preferred size to 5000K.
* config/m68k/xm-mpw.h (fgetc): Define as a macro.
1994-06-23 03:57:02 +08:00
|
|
|
time (&start_time);
|
1994-03-24 06:14:11 +08:00
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
cb.ioCRefNum = input_refnum;
|
|
|
|
cb.csCode = 2;
|
|
|
|
err = PBStatus ((ParmBlkPtr) &cb, 0);
|
|
|
|
if (err < 0)
|
|
|
|
return SERIAL_ERROR;
|
|
|
|
n = *((long *) &cb.csParam[0]);
|
|
|
|
if (n > 0)
|
|
|
|
{
|
|
|
|
pb.ioRefNum = input_refnum;
|
|
|
|
pb.ioBuffer = (Ptr) (scb->buf);
|
|
|
|
pb.ioReqCount = (n > 64 ? 64 : n);
|
|
|
|
err = PBRead ((ParmBlkPtr) &pb, 0);
|
|
|
|
if (err < 0)
|
|
|
|
return SERIAL_ERROR;
|
|
|
|
scb->bufcnt = pb.ioReqCount;
|
|
|
|
scb->bufcnt--;
|
|
|
|
scb->bufp = scb->buf;
|
|
|
|
return *scb->bufp++;
|
|
|
|
}
|
|
|
|
else if (timeout == 0)
|
|
|
|
return SERIAL_TIMEOUT;
|
|
|
|
else if (timeout == -1)
|
|
|
|
;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
time (&now);
|
* mpw-make.in (VERSION): Update to 4.12.3.
(SiowGDB): New target, GDB using SIOW library.
(init-new.c): New target, attempt to generate init.c from sources.
(main.c.o, top.c.o): Put each in its own segment.
* main.c (main) [MPW]: Always call mac_init.
* utils.c (query) [MPW]: Always return "yes" if in MacGDB, output
an extra newline otherwise.
* mac-xdep.c: More comments in various places, remove junk.
(mac_init): Add tests for MPW and SIOW.
(use_wne, has_color_qd): Renamed.
(use_color_qd): New variable.
(grow_window): Only do console resizing to console window,
call resize_console_window.
(zoom_window): Call resize_console_window.
(resize_console_window, scroll_text): New functions.
(adjust_console_sizes): Always align viewrect to even multiples of
text lines.
(adjust_console_text): Always scroll by whole lines.
(hacked_vfprintf, hacked_puts, hacked_fputc, hacked_putc): Force a
recalculation of scroll positions if a newline was output.
(hacked_fflush): Similarly, for flushing.
(hacked_fgetc): New function, aborts if called in MacGDB.
* ser-mac.c (mac_readchar): Rename starttime to start_time,
remove debugging printf.
(mac_write): Sleep on first 4 writes.
(sec_sleep): New function, works like standard sleep.
* macgdb.r: Adjust positioning and contents of About box.
Set minimum size to 2000K, preferred size to 5000K.
* config/m68k/xm-mpw.h (fgetc): Define as a macro.
1994-06-23 03:57:02 +08:00
|
|
|
if (now > start_time + timeout)
|
1994-03-24 06:14:11 +08:00
|
|
|
return SERIAL_TIMEOUT;
|
|
|
|
}
|
1995-03-18 07:21:12 +08:00
|
|
|
PROGRESS (1);
|
1994-03-24 06:14:11 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mac_{get set}_tty_state() are both dummys to fill out the function
|
|
|
|
vector. Someday, they may do something real... */
|
|
|
|
|
|
|
|
static serial_ttystate
|
|
|
|
mac_get_tty_state (scb)
|
|
|
|
serial_t scb;
|
|
|
|
{
|
|
|
|
struct mac_ttystate *state;
|
|
|
|
|
|
|
|
state = (struct mac_ttystate *) xmalloc (sizeof *state);
|
|
|
|
|
|
|
|
return (serial_ttystate) state;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
mac_set_tty_state (scb, ttystate)
|
|
|
|
serial_t scb;
|
|
|
|
serial_ttystate ttystate;
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
mac_noflush_set_tty_state (scb, new_ttystate, old_ttystate)
|
|
|
|
serial_t scb;
|
|
|
|
serial_ttystate new_ttystate;
|
|
|
|
serial_ttystate old_ttystate;
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
mac_print_tty_state (scb, ttystate)
|
|
|
|
serial_t scb;
|
|
|
|
serial_ttystate ttystate;
|
|
|
|
{
|
|
|
|
/* Nothing to print. */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1995-04-16 05:22:14 +08:00
|
|
|
/* If there is a tricky formula to relate real baud rates
|
|
|
|
to what the serial driver wants, we should use it. Until
|
|
|
|
we get one, this table will have to do. */
|
|
|
|
|
|
|
|
static struct {
|
|
|
|
int real_rate;
|
|
|
|
int bits;
|
|
|
|
} mac_baud_rate_table[] = {
|
|
|
|
{ 57600, baud57600 },
|
1995-06-16 06:10:27 +08:00
|
|
|
{ 38400, 1 },
|
1995-04-16 05:22:14 +08:00
|
|
|
{ 19200, baud19200 },
|
|
|
|
{ 9600, baud9600 },
|
|
|
|
{ 7200, baud7200 },
|
|
|
|
{ 4800, baud4800 },
|
|
|
|
{ 3600, baud3600 },
|
|
|
|
{ 2400, baud2400 },
|
|
|
|
{ 1800, baud1800 },
|
|
|
|
{ 1200, baud1200 },
|
|
|
|
{ 600, baud600 },
|
|
|
|
{ 300, baud300 },
|
|
|
|
{ 0, 0 }
|
|
|
|
};
|
|
|
|
|
1994-03-24 06:14:11 +08:00
|
|
|
static int
|
|
|
|
mac_set_baud_rate (scb, rate)
|
|
|
|
serial_t scb;
|
|
|
|
int rate;
|
|
|
|
{
|
1995-04-16 05:22:14 +08:00
|
|
|
int i, bits;
|
|
|
|
|
|
|
|
for (i = 0; mac_baud_rate_table[i].real_rate != 0; ++i)
|
|
|
|
{
|
|
|
|
if (mac_baud_rate_table[i].real_rate == rate)
|
|
|
|
{
|
|
|
|
bits = mac_baud_rate_table[i].bits;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SerReset (input_refnum, stop10|noParity|data8|bits);
|
|
|
|
SerReset (output_refnum, stop10|noParity|data8|bits);
|
1994-03-24 06:14:11 +08:00
|
|
|
}
|
|
|
|
|
1995-03-07 17:03:37 +08:00
|
|
|
static int
|
|
|
|
mac_set_stop_bits (scb, num)
|
|
|
|
serial_t scb;
|
|
|
|
int num;
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
Wed Jun 15 17:36:07 1994 Stan Shebs (shebs@andros.cygnus.com)
* mpw-make.in (.c.o, .gc.o): Prefix segment names with gdb_.
(top.c.o, annotate.c.o): Add build rules.
* macgdb.r (SysTypes.r): Include.
('vers'): New resource, version info.
(mFile, mEdit, mDebug): Enable all menu items.
(mDebug): Add key equivalents for continue, step, next.
(wConsole): Add zoom and close boxes to window.
* mac-xdep.c (new_console_window): New function, code taken from
mac_init.
(mac_command_loop): Use GetCaretTime for wait interval, call
do_idle on null events.
(do_idle): New function.
(zoom_window): Implement zooming.
(v_scroll_proc): New function, handles vertical scrolling.
(activate_window): Do activation of console window.
(do_menu_command): Implement items of file, edit, and debug menus.
(do_keyboard_command): Fix command extraction.
(adjust_console_sizes, adjust_console_text): New functions.
(hacked_fprintf, hacked_vfprintf, hacked_fputs, hacked_fputc,
hacked_putc): Don't call draw_console.
* ser-mac.c (mac_open): Add an error message for invalid ports.
(first_mac_write): New global.
(mac_write): Use first_mac_write to sleep on first several writes.
1994-06-16 09:03:01 +08:00
|
|
|
int first_mac_write = 0;
|
|
|
|
|
1994-03-24 06:14:11 +08:00
|
|
|
static int
|
|
|
|
mac_write (scb, str, len)
|
|
|
|
serial_t scb;
|
|
|
|
const char *str;
|
|
|
|
int len;
|
|
|
|
{
|
|
|
|
OSErr err;
|
|
|
|
IOParam pb;
|
|
|
|
|
* mpw-make.in (VERSION): Update to 4.12.3.
(SiowGDB): New target, GDB using SIOW library.
(init-new.c): New target, attempt to generate init.c from sources.
(main.c.o, top.c.o): Put each in its own segment.
* main.c (main) [MPW]: Always call mac_init.
* utils.c (query) [MPW]: Always return "yes" if in MacGDB, output
an extra newline otherwise.
* mac-xdep.c: More comments in various places, remove junk.
(mac_init): Add tests for MPW and SIOW.
(use_wne, has_color_qd): Renamed.
(use_color_qd): New variable.
(grow_window): Only do console resizing to console window,
call resize_console_window.
(zoom_window): Call resize_console_window.
(resize_console_window, scroll_text): New functions.
(adjust_console_sizes): Always align viewrect to even multiples of
text lines.
(adjust_console_text): Always scroll by whole lines.
(hacked_vfprintf, hacked_puts, hacked_fputc, hacked_putc): Force a
recalculation of scroll positions if a newline was output.
(hacked_fflush): Similarly, for flushing.
(hacked_fgetc): New function, aborts if called in MacGDB.
* ser-mac.c (mac_readchar): Rename starttime to start_time,
remove debugging printf.
(mac_write): Sleep on first 4 writes.
(sec_sleep): New function, works like standard sleep.
* macgdb.r: Adjust positioning and contents of About box.
Set minimum size to 2000K, preferred size to 5000K.
* config/m68k/xm-mpw.h (fgetc): Define as a macro.
1994-06-23 03:57:02 +08:00
|
|
|
if (first_mac_write++ < 4)
|
Wed Jun 15 17:36:07 1994 Stan Shebs (shebs@andros.cygnus.com)
* mpw-make.in (.c.o, .gc.o): Prefix segment names with gdb_.
(top.c.o, annotate.c.o): Add build rules.
* macgdb.r (SysTypes.r): Include.
('vers'): New resource, version info.
(mFile, mEdit, mDebug): Enable all menu items.
(mDebug): Add key equivalents for continue, step, next.
(wConsole): Add zoom and close boxes to window.
* mac-xdep.c (new_console_window): New function, code taken from
mac_init.
(mac_command_loop): Use GetCaretTime for wait interval, call
do_idle on null events.
(do_idle): New function.
(zoom_window): Implement zooming.
(v_scroll_proc): New function, handles vertical scrolling.
(activate_window): Do activation of console window.
(do_menu_command): Implement items of file, edit, and debug menus.
(do_keyboard_command): Fix command extraction.
(adjust_console_sizes, adjust_console_text): New functions.
(hacked_fprintf, hacked_vfprintf, hacked_fputs, hacked_fputc,
hacked_putc): Don't call draw_console.
* ser-mac.c (mac_open): Add an error message for invalid ports.
(first_mac_write): New global.
(mac_write): Use first_mac_write to sleep on first several writes.
1994-06-16 09:03:01 +08:00
|
|
|
{
|
1995-03-18 07:21:12 +08:00
|
|
|
sleep (1);
|
Wed Jun 15 17:36:07 1994 Stan Shebs (shebs@andros.cygnus.com)
* mpw-make.in (.c.o, .gc.o): Prefix segment names with gdb_.
(top.c.o, annotate.c.o): Add build rules.
* macgdb.r (SysTypes.r): Include.
('vers'): New resource, version info.
(mFile, mEdit, mDebug): Enable all menu items.
(mDebug): Add key equivalents for continue, step, next.
(wConsole): Add zoom and close boxes to window.
* mac-xdep.c (new_console_window): New function, code taken from
mac_init.
(mac_command_loop): Use GetCaretTime for wait interval, call
do_idle on null events.
(do_idle): New function.
(zoom_window): Implement zooming.
(v_scroll_proc): New function, handles vertical scrolling.
(activate_window): Do activation of console window.
(do_menu_command): Implement items of file, edit, and debug menus.
(do_keyboard_command): Fix command extraction.
(adjust_console_sizes, adjust_console_text): New functions.
(hacked_fprintf, hacked_vfprintf, hacked_fputs, hacked_fputc,
hacked_putc): Don't call draw_console.
* ser-mac.c (mac_open): Add an error message for invalid ports.
(first_mac_write): New global.
(mac_write): Use first_mac_write to sleep on first several writes.
1994-06-16 09:03:01 +08:00
|
|
|
}
|
1994-03-24 06:14:11 +08:00
|
|
|
pb.ioRefNum = output_refnum;
|
|
|
|
pb.ioBuffer = (Ptr) str;
|
|
|
|
pb.ioReqCount = len;
|
|
|
|
err = PBWrite ((ParmBlkPtr) &pb, 0);
|
|
|
|
if (err < 0)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
* mpw-make.in (VERSION): Update to 4.12.3.
(SiowGDB): New target, GDB using SIOW library.
(init-new.c): New target, attempt to generate init.c from sources.
(main.c.o, top.c.o): Put each in its own segment.
* main.c (main) [MPW]: Always call mac_init.
* utils.c (query) [MPW]: Always return "yes" if in MacGDB, output
an extra newline otherwise.
* mac-xdep.c: More comments in various places, remove junk.
(mac_init): Add tests for MPW and SIOW.
(use_wne, has_color_qd): Renamed.
(use_color_qd): New variable.
(grow_window): Only do console resizing to console window,
call resize_console_window.
(zoom_window): Call resize_console_window.
(resize_console_window, scroll_text): New functions.
(adjust_console_sizes): Always align viewrect to even multiples of
text lines.
(adjust_console_text): Always scroll by whole lines.
(hacked_vfprintf, hacked_puts, hacked_fputc, hacked_putc): Force a
recalculation of scroll positions if a newline was output.
(hacked_fflush): Similarly, for flushing.
(hacked_fgetc): New function, aborts if called in MacGDB.
* ser-mac.c (mac_readchar): Rename starttime to start_time,
remove debugging printf.
(mac_write): Sleep on first 4 writes.
(sec_sleep): New function, works like standard sleep.
* macgdb.r: Adjust positioning and contents of About box.
Set minimum size to 2000K, preferred size to 5000K.
* config/m68k/xm-mpw.h (fgetc): Define as a macro.
1994-06-23 03:57:02 +08:00
|
|
|
mac_close (serial_t scb)
|
1994-03-24 06:14:11 +08:00
|
|
|
{
|
|
|
|
if (input_refnum)
|
|
|
|
{
|
|
|
|
if (1 /* custom buffer */)
|
|
|
|
SerSetBuf (input_refnum, mac_input_buffer, 0);
|
|
|
|
CloseDriver (input_refnum);
|
|
|
|
input_refnum = 0;
|
|
|
|
}
|
|
|
|
if (output_refnum)
|
|
|
|
{
|
|
|
|
if (0 /* custom buffer */)
|
1996-07-10 08:05:46 +08:00
|
|
|
SerSetBuf (input_refnum, mac_output_buffer, 0);
|
1994-03-24 06:14:11 +08:00
|
|
|
CloseDriver (output_refnum);
|
|
|
|
output_refnum = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct serial_ops mac_ops =
|
|
|
|
{
|
|
|
|
"hardwire",
|
|
|
|
0,
|
|
|
|
mac_open,
|
|
|
|
mac_close,
|
|
|
|
mac_readchar,
|
|
|
|
mac_write,
|
|
|
|
mac_noop, /* flush output */
|
|
|
|
mac_noop, /* flush input */
|
|
|
|
mac_noop, /* send break -- currently only for nindy */
|
|
|
|
mac_raw,
|
|
|
|
mac_get_tty_state,
|
|
|
|
mac_set_tty_state,
|
|
|
|
mac_print_tty_state,
|
|
|
|
mac_noflush_set_tty_state,
|
|
|
|
mac_set_baud_rate,
|
1995-03-07 17:03:37 +08:00
|
|
|
mac_set_stop_bits,
|
1998-03-07 04:38:45 +08:00
|
|
|
mac_noop, /* wait for output to drain */
|
1994-03-24 06:14:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
_initialize_ser_mac ()
|
|
|
|
{
|
|
|
|
serial_add_interface (&mac_ops);
|
|
|
|
}
|