src/keyevent.c
/************************************************************************/
/*									*/
/*			p r o c e s s _ i o _ e v e n t s		*/
/*									*/
/*	Periodically, or After a SIGIO interrupt which happens		*/
/*		1. When TCP input becomes available.			*/
/*		2. When a NIT ethernet packet becomes available.	*/
/*		3. When a console/log/stderr msg needs to be printed.	*/
/*									*/
/*									*/
/*	Statics:  LispReadFds	A 32-bit vector with a 1 for each	*/
/*				FD that can get SIGIO interrupts.	*/
/*				12/04/2020 - now an fd_set		*/
/*									*/
/*		  LispWindowFd	The keyboard/window FD, for keyboard	*/
/*				and mouse events.			*/
/*									*/
/*		  LispIOFds	A bit vector of TCP FDs, or other	*/
/*				FDs Lisp is doing async I/O on.		*/
/*				Activity on any of these will signal	*/
/*				the Lisp IOInterrupt interrupt.		*/
/*				12/04/2020 - now an fd_set		*/
/*									*/
/*		  ether_fd	The raw ethernet FD, for 10MB I/O	*/
/*									*/
/*		  EtherReadFds	A bit vector with the raw enet's	*/
/*				bit turned on.  To speed up processing.	*/
/*				12/04/2020 - now obsolete		*/
/*									*/
/*		  LogFileFd	A bit vector with the log-file's	*/
/*				bit on, for capturing console msgs.	*/
/*				12/04/2020 - now just the FD number	*/
/*									*/
/*									*/
/*									*/
/************************************************************************/
p r o c e s s _ i o _ e v e n t s

Periodically, or After a SIGIO interrupt which happens
1. When TCP input becomes available.
2. When a NIT ethernet packet becomes available.
3. When a console/log/stderr msg needs to be printed.

LispReadFds   A 32-bit vector with a 1 for each
FD that can get SIGIO interrupts.

LispWindowFd  The keyboard/window FD, for keyboard
and mouse events.

LispIOFds     A bit vector of TCP FDs, or other
FDs Lisp is doing async I/O on.
Activity on any of these will signal
the Lisp IOInterrupt interrupt.

ether_fd      The raw ethernet FD, for 10MB I/O

EtherReadFds  A bit vector with the raw enet's
bit turned on.  To speed up processing.

LogFileFd     A bit vector with the log-file's
bit on, for capturing console msgs.
p r o c e s s _ i o _ e v e n t s Periodically or After a SIGIO interrupt which happens 1 . When TCP input becomes available . 2 . When a NIT ethernet packet becomes available . 3 . When a console / log / stderr msg needs to be printed . LispReadFds A 32 - bit vector with a 1 for each FD that can get SIGIO interrupts . LispWindowFd The keyboard / window FD for keyboard and mouse events . LispIOFds A bit vector of TCP FDs or other FDs Lisp is doing async I / O on . Activity on any of these will signal the Lisp IOInterrupt interrupt . ether_fd The raw ethernet FD for 10MB I / O EtherReadFds A bit vector with the raw enet ' s bit turned on . To speed up processing . LogFileFd A bit vector with the log - file ' s bit on for capturing console msgs .
void process_io_events()
{
#ifndef DOS
  fd_set rfds;
  u_int iflags;
  int i;
  memcpy(&rfds, &LispReadFds, sizeof(rfds));
  if (select(32, &rfds, NULL, NULL, &SelectTimeout) > 0) {
#ifdef MAIKO_ENABLE_ETHERNET
    if (ether_fd >= 0 && FD_ISSET(ether_fd, &rfds)) { 
      DBPRINT(("Handling enet interrupt.\n\n"));
      check_ether();
    }
#endif 
#ifdef RS232
    if (RS232C_Fd >= 0 && (FD_ISSET(RS232C_Fd, &rfds) || (RS232C_remain_data && rs232c_lisp_is_ready())))
      rs232c_read();
#endif 
#if defined(MAIKO_HANDLE_CONSOLE_MESSAGES) && defined(LOGINT)
    if (LogFileFd >= 0 && FD_ISSET(LogFileFd, &rfds)) { 
      flush_pty();          
      ((INTSTAT *)Addr68k_from_LADDR(*INTERRUPTSTATE_word))->LogFileIO = 1;
      *PENDINGINTERRUPT68k = ATOM_T;
      Irq_Stk_End = Irq_Stk_Check = 0;
    }
#endif
    iflags = 0;
    for (i = 0; i < 32; i++)
        if (FD_ISSET(i, &rfds) & FD_ISSET(i, &LispIOFds)) iflags |= 1 << i;
    if (iflags) { 
      u_int *flags;
      flags = (u_int *)Addr68k_from_LADDR(*IOINTERRUPTFLAGS_word);
      *flags = iflags;
      ((INTSTAT *)Addr68k_from_LADDR(*INTERRUPTSTATE_word))->IOInterrupt = 1;
      *PENDINGINTERRUPT68k = ATOM_T;
      Irq_Stk_End = Irq_Stk_Check = 0;
    }
  }
#endif 
}
void process_io_events ( ) { #ifndef DOS fd_set rfds ; u_int iflags ; int i ; memcpy ( & rfds , & LispReadFds , sizeof ( rfds ) ) ; if ( select ( 32 , & rfds , NULL , NULL , & SelectTimeout ) > 0 ) { #ifdef MAIKO_ENABLE_ETHERNET if ( ether_fd >= 0 && FD_ISSET ( ether_fd , & rfds ) ) { DBPRINT ( ( " \n \n " ) ) ; check_ether ( ) ; } #endif #ifdef RS232 if ( RS232C_Fd >= 0 && ( FD_ISSET ( RS232C_Fd , & rfds ) || ( RS232C_remain_data && rs232c_lisp_is_ready ( ) ) ) ) rs232c_read ( ) ; #endif #if defined ( MAIKO_HANDLE_CONSOLE_MESSAGES ) && defined ( LOGINT ) if ( LogFileFd >= 0 && FD_ISSET ( LogFileFd , & rfds ) ) { flush_pty ( ) ; ( ( INTSTAT * ) Addr68k_from_LADDR ( * INTERRUPTSTATE_word ) ) -> LogFileIO = 1 ; * PENDINGINTERRUPT68k = ATOM_T ; Irq_Stk_End = Irq_Stk_Check = 0 ; } #endif iflags = 0 ; for ( i = 0 ; i < 32 ; i ++ ) if ( FD_ISSET ( i , & rfds ) & FD_ISSET ( i , & LispIOFds ) ) iflags |= 1 << i ; if ( iflags ) { u_int * flags ; flags = ( u_int * ) Addr68k_from_LADDR ( * IOINTERRUPTFLAGS_word ) ; * flags = iflags ; ( ( INTSTAT * ) Addr68k_from_LADDR ( * INTERRUPTSTATE_word ) ) -> IOInterrupt = 1 ; * PENDINGINTERRUPT68k = ATOM_T ; Irq_Stk_End = Irq_Stk_Check = 0 ; } } #endif }
p r o c e s s _ i o _ e v e n t s
p r o c e s s _ i o _ e v e n t s
/* Raw ethernet (NIT) I/O happened, so handle it. */ /* MAIKO_ENABLE_ETHERNET */ /* RS232 */ /* There's info in the log file.  Tell Lisp to print it. */ /* move the msg(s) to the log file */ /* There's activity on a Lisp-opened FD.  Tell Lisp. */ /* #endif */ /* DOS */