mirror of
https://github.com/simh/simh.git
synced 2026-01-11 23:52:58 +00:00
SCP: Remove legacy support for OS2 and MetroWerks on Macintosh OS 9
This commit is contained in:
parent
f98156842a
commit
287f2928ab
4
scp.c
4
scp.c
@ -2878,10 +2878,6 @@ t_bool device_unit_tests = FALSE;
|
||||
t_stat stat = SCPE_OK;
|
||||
CTAB *docmdp = NULL;
|
||||
|
||||
#if defined (__MWERKS__) && defined (macintosh)
|
||||
argc = ccommand (&argv);
|
||||
#endif
|
||||
|
||||
/* Make sure that argv has at least 10 elements and that it ends in a NULL pointer */
|
||||
targv = (char **)calloc (1+MAX(10, argc), sizeof(*targv));
|
||||
for (i=0; i<argc; i++)
|
||||
|
||||
284
sim_console.c
284
sim_console.c
@ -181,7 +181,7 @@ int32 sim_dbg_int_char = 0; /* SIGINT char under deb
|
||||
static t_bool sigint_message_issued = FALSE;
|
||||
int32 sim_brk_char = 000; /* break character */
|
||||
int32 sim_tt_pchar = 0x00002780;
|
||||
#if defined (_WIN32) || defined (__OS2__) || (defined (__MWERKS__) && defined (macintosh))
|
||||
#if defined (_WIN32)
|
||||
int32 sim_del_char = '\b'; /* delete character */
|
||||
#else
|
||||
int32 sim_del_char = 0177;
|
||||
@ -3690,288 +3690,6 @@ if (program[0] != '\0') {
|
||||
return sim_messagef (SCPE_NOFNC, "Can't find a telnet program to connect to the console in a window\n");
|
||||
}
|
||||
|
||||
/* OS/2 routines, from Bruce Ray and Holger Veit */
|
||||
|
||||
#elif defined (__OS2__)
|
||||
|
||||
#include <conio.h>
|
||||
|
||||
static t_stat sim_os_ttinit (void)
|
||||
{
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
static t_stat sim_os_ttrun (void)
|
||||
{
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
static t_stat sim_os_ttcmd (void)
|
||||
{
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
static t_stat sim_os_ttclose (void)
|
||||
{
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
static t_bool sim_os_fd_isatty (int fd)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static t_stat sim_os_poll_kbd (void)
|
||||
{
|
||||
int c;
|
||||
|
||||
sim_debug (DBG_TRC, &sim_con_telnet, "sim_os_poll_kbd()\n");
|
||||
|
||||
#if defined (__EMX__)
|
||||
switch (c = _read_kbd(0,0,0)) { /* EMX has _read_kbd */
|
||||
|
||||
case -1: /* no char*/
|
||||
return SCPE_OK;
|
||||
|
||||
case 0: /* char pending */
|
||||
c = _read_kbd(0,1,0);
|
||||
break;
|
||||
|
||||
default: /* got char */
|
||||
break;
|
||||
}
|
||||
#else
|
||||
if (!kbhit ())
|
||||
return SCPE_OK;
|
||||
c = getch();
|
||||
#endif
|
||||
if ((c & 0177) == sim_del_char)
|
||||
c = 0177;
|
||||
if ((c & 0177) == sim_int_char)
|
||||
return SCPE_STOP;
|
||||
if (sim_brk_char && ((c & 0177) == sim_brk_char))
|
||||
return SCPE_BREAK;
|
||||
return c | SCPE_KFLAG;
|
||||
}
|
||||
|
||||
static t_bool sim_os_poll_kbd_ready (int ms_timeout) /* Don't know how to do this on this platform */
|
||||
{
|
||||
sim_os_ms_sleep (MIN(20,ms_timeout)); /* Wait a little */
|
||||
return TRUE; /* force a poll */
|
||||
}
|
||||
|
||||
static t_stat sim_os_putchar (int32 c)
|
||||
{
|
||||
if (c != 0177) {
|
||||
#if defined (__EMX__)
|
||||
putchar (c);
|
||||
#else
|
||||
putch (c);
|
||||
#endif
|
||||
fflush (stdout);
|
||||
}
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
/* Metrowerks CodeWarrior Macintosh routines, from Louis Chretien and
|
||||
Peter Schorn */
|
||||
|
||||
#elif defined (__MWERKS__) && defined (macintosh)
|
||||
|
||||
#include <console.h>
|
||||
#include <Mactypes.h>
|
||||
#include <string.h>
|
||||
#include <sioux.h>
|
||||
#include <unistd.h>
|
||||
#include <siouxglobals.h>
|
||||
#include <Traps.h>
|
||||
#include <LowMem.h>
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
Boolean SIOUXIsAppWindow(WindowPtr window);
|
||||
void SIOUXDoMenuChoice(long menuValue);
|
||||
void SIOUXUpdateMenuItems(void);
|
||||
void SIOUXUpdateScrollbar(void);
|
||||
int ps_kbhit(void);
|
||||
int ps_getch(void);
|
||||
|
||||
extern pSIOUXWin SIOUXTextWindow;
|
||||
static CursHandle iBeamCursorH = NULL; /* contains the iBeamCursor */
|
||||
|
||||
static void updateCursor(void) {
|
||||
WindowPtr window;
|
||||
window = FrontWindow();
|
||||
if (SIOUXIsAppWindow(window)) {
|
||||
GrafPtr savePort;
|
||||
Point localMouse;
|
||||
GetPort(&savePort);
|
||||
SetPort(window);
|
||||
#if TARGET_API_MAC_CARBON
|
||||
GetGlobalMouse(&localMouse);
|
||||
#else
|
||||
localMouse = LMGetMouseLocation();
|
||||
#endif
|
||||
GlobalToLocal(&localMouse);
|
||||
if (PtInRect(localMouse, &(*SIOUXTextWindow->edit)->viewRect) && iBeamCursorH) {
|
||||
SetCursor(*iBeamCursorH);
|
||||
}
|
||||
else {
|
||||
SetCursor(&qd.arrow);
|
||||
}
|
||||
TEIdle(SIOUXTextWindow->edit);
|
||||
SetPort(savePort);
|
||||
}
|
||||
else {
|
||||
SetCursor(&qd.arrow);
|
||||
TEIdle(SIOUXTextWindow->edit);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int ps_kbhit(void) {
|
||||
EventRecord event;
|
||||
int c;
|
||||
updateCursor();
|
||||
SIOUXUpdateScrollbar();
|
||||
while (GetNextEvent(updateMask | osMask | mDownMask | mUpMask | activMask |
|
||||
highLevelEventMask | diskEvt, &event)) {
|
||||
SIOUXHandleOneEvent(&event);
|
||||
}
|
||||
if (SIOUXQuitting) {
|
||||
exit(1);
|
||||
}
|
||||
if (EventAvail(keyDownMask,&event)) {
|
||||
c = event.message&charCodeMask;
|
||||
if ((event.modifiers & cmdKey) && (c > 0x20)) {
|
||||
GetNextEvent(keyDownMask, &event);
|
||||
SIOUXHandleOneEvent(&event);
|
||||
if (SIOUXQuitting) {
|
||||
exit(1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int ps_getch(void) {
|
||||
int c;
|
||||
EventRecord event;
|
||||
fflush(stdout);
|
||||
updateCursor();
|
||||
while(!GetNextEvent(keyDownMask,&event)) {
|
||||
if (GetNextEvent(updateMask | osMask | mDownMask | mUpMask | activMask |
|
||||
highLevelEventMask | diskEvt, &event)) {
|
||||
SIOUXUpdateScrollbar();
|
||||
SIOUXHandleOneEvent(&event);
|
||||
}
|
||||
}
|
||||
if (SIOUXQuitting) {
|
||||
exit(1);
|
||||
}
|
||||
c = event.message&charCodeMask;
|
||||
if ((event.modifiers & cmdKey) && (c > 0x20)) {
|
||||
SIOUXUpdateMenuItems();
|
||||
SIOUXDoMenuChoice(MenuKey(c));
|
||||
}
|
||||
if (SIOUXQuitting) {
|
||||
exit(1);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/* Note that this only works if the call to sim_ttinit comes before any output to the console */
|
||||
|
||||
static t_stat sim_os_ttinit (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
sim_debug (DBG_TRC, &sim_con_telnet, "sim_os_ttinit()\n");
|
||||
|
||||
/* this blank will later be replaced by the number of characters */
|
||||
char title[50] = " ";
|
||||
unsigned char ptitle[50];
|
||||
SIOUXSettings.autocloseonquit = TRUE;
|
||||
SIOUXSettings.asktosaveonclose = FALSE;
|
||||
SIOUXSettings.showstatusline = FALSE;
|
||||
SIOUXSettings.columns = 80;
|
||||
SIOUXSettings.rows = 40;
|
||||
SIOUXSettings.toppixel = 42;
|
||||
SIOUXSettings.leftpixel = 6;
|
||||
iBeamCursorH = GetCursor(iBeamCursor);
|
||||
strlcat(title, sim_name, sizeof(title));
|
||||
strlcat(title, " Simulator", sizeof(title));
|
||||
title[0] = strlen(title) - 1; /* Pascal string done */
|
||||
for (i = 0; i <= title[0]; i++) { /* copy to unsigned char */
|
||||
ptitle[i] = title[i];
|
||||
}
|
||||
SIOUXSetTitle(ptitle);
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
static t_stat sim_os_ttrun (void)
|
||||
{
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
static t_stat sim_os_ttcmd (void)
|
||||
{
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
static t_stat sim_os_ttclose (void)
|
||||
{
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
static t_bool sim_os_fd_isatty (int fd)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static t_stat sim_os_poll_kbd (void)
|
||||
{
|
||||
int c;
|
||||
|
||||
sim_debug (DBG_TRC, &sim_con_telnet, "sim_os_poll_kbd()\n");
|
||||
|
||||
if (!ps_kbhit ())
|
||||
return SCPE_OK;
|
||||
c = ps_getch();
|
||||
if ((c & 0177) == sim_del_char)
|
||||
c = 0177;
|
||||
if ((c & 0177) == sim_int_char)
|
||||
return SCPE_STOP;
|
||||
if (sim_brk_char && ((c & 0177) == sim_brk_char))
|
||||
return SCPE_BREAK;
|
||||
return c | SCPE_KFLAG;
|
||||
}
|
||||
|
||||
static t_bool sim_os_poll_kbd_ready (int ms_timeout) /* Don't know how to do this on this platform */
|
||||
{
|
||||
sim_os_ms_sleep (MIN(20,ms_timeout)); /* Wait a little */
|
||||
return TRUE; /* force a poll */
|
||||
}
|
||||
|
||||
static t_stat sim_os_putchar (int32 c)
|
||||
{
|
||||
if (c != 0177) {
|
||||
putchar (c);
|
||||
fflush (stdout);
|
||||
}
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
static t_stat sim_os_connect_telnet (int port)
|
||||
{
|
||||
return SCPE_NOFNC;
|
||||
}
|
||||
|
||||
|
||||
/* BSD UNIX routines */
|
||||
|
||||
#elif defined (BSDTTY)
|
||||
|
||||
45
sim_sock.c
45
sim_sock.c
@ -83,49 +83,6 @@ extern "C" {
|
||||
sim_setnonblock set socket non-blocking
|
||||
*/
|
||||
|
||||
/* First, all the non-implemented versions */
|
||||
|
||||
#if defined (__OS2__) && !defined (__EMX__)
|
||||
|
||||
void sim_init_sock (void)
|
||||
{
|
||||
}
|
||||
|
||||
void sim_cleanup_sock (void)
|
||||
{
|
||||
}
|
||||
|
||||
SOCKET sim_master_sock_ex (const char *hostport, int *parse_status, int opt_flags)
|
||||
{
|
||||
return INVALID_SOCKET;
|
||||
}
|
||||
|
||||
SOCKET sim_connect_sock_ex (const char *sourcehostport, const char *hostport, const char *default_host, const char *default_port, int opt_flags)
|
||||
{
|
||||
return INVALID_SOCKET;
|
||||
}
|
||||
|
||||
SOCKET sim_accept_conn (SOCKET master, char **connectaddr);
|
||||
{
|
||||
return INVALID_SOCKET;
|
||||
}
|
||||
|
||||
int sim_read_sock (SOCKET sock, char *buf, int nbytes)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int sim_write_sock (SOCKET sock, char *msg, int nbytes)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sim_close_sock (SOCKET sock)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#else /* endif unimpl */
|
||||
|
||||
/* UNIX, Win32, Macintosh, VMS, OS2 (Berkeley socket) routines */
|
||||
|
||||
@ -1416,8 +1373,6 @@ shutdown(sock, SD_BOTH);
|
||||
closesocket (sock);
|
||||
}
|
||||
|
||||
#endif /* end else !implemented */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -71,7 +71,7 @@ extern "C" {
|
||||
#pragma pop_macro ("PURE")
|
||||
#pragma pop_macro ("INT_PTR")
|
||||
|
||||
#elif !defined (__OS2__) || defined (__EMX__) /* VMS, Mac, Unix, OS/2 EMX */
|
||||
#else /* VMS, Mac, Unix */
|
||||
#include <sys/types.h> /* for fcntl, getpid */
|
||||
#include <sys/socket.h> /* for sockets */
|
||||
#include <string.h>
|
||||
|
||||
86
sim_timer.c
86
sim_timer.c
@ -552,92 +552,6 @@ return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#elif defined (__OS2__)
|
||||
|
||||
/* OS/2 routines, from Bruce Ray */
|
||||
|
||||
const t_bool rtc_avail = FALSE;
|
||||
|
||||
static uint32 _sim_os_msec (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sim_os_sleep (unsigned int sec)
|
||||
{
|
||||
}
|
||||
|
||||
uint32 sim_os_ms_sleep_init (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 sim_os_ms_sleep (unsigned int msec)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Metrowerks CodeWarrior Macintosh routines, from Ben Supnik */
|
||||
|
||||
#elif defined (__MWERKS__) && defined (macintosh)
|
||||
|
||||
#include <Timer.h>
|
||||
#include <Mactypes.h>
|
||||
#include <sioux.h>
|
||||
#include <unistd.h>
|
||||
#include <siouxglobals.h>
|
||||
#define NANOS_PER_MILLI 1000000
|
||||
#define MILLIS_PER_SEC 1000
|
||||
|
||||
const t_bool rtc_avail = TRUE;
|
||||
|
||||
static uint32 _sim_os_msec (void)
|
||||
{
|
||||
unsigned long long micros;
|
||||
UnsignedWide macMicros;
|
||||
unsigned long millis;
|
||||
|
||||
Microseconds (&macMicros);
|
||||
micros = *((unsigned long long *) &macMicros);
|
||||
millis = micros / 1000LL;
|
||||
return (uint32) millis;
|
||||
}
|
||||
|
||||
void sim_os_sleep (unsigned int sec)
|
||||
{
|
||||
sleep (sec);
|
||||
}
|
||||
|
||||
uint32 sim_os_ms_sleep_init (void)
|
||||
{
|
||||
return _compute_minimum_sleep ();
|
||||
}
|
||||
|
||||
uint32 sim_os_ms_sleep (unsigned int milliseconds)
|
||||
{
|
||||
uint32 stime = sim_os_msec ();
|
||||
struct timespec treq;
|
||||
|
||||
treq.tv_sec = milliseconds / MILLIS_PER_SEC;
|
||||
treq.tv_nsec = (milliseconds % MILLIS_PER_SEC) * NANOS_PER_MILLI;
|
||||
(void) nanosleep (&treq, NULL);
|
||||
return sim_os_msec () - stime;
|
||||
}
|
||||
|
||||
#if defined(NEED_CLOCK_GETTIME)
|
||||
int clock_gettime(int clk_id, struct timespec *tp)
|
||||
{
|
||||
struct timeval cur;
|
||||
|
||||
if (clk_id != CLOCK_REALTIME)
|
||||
return -1;
|
||||
gettimeofday (&cur, NULL);
|
||||
tp->tv_sec = cur.tv_sec;
|
||||
tp->tv_nsec = cur.tv_usec*1000;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
/* UNIX routines */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user