lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev patch for Wattcp targets


From: Gisle Vanem
Subject: lynx-dev patch for Wattcp targets
Date: Tue, 30 Nov 1999 14:41:06 +0100

This patch is for Wattcp targets (Watt-32 and original wattcp).
When Lynx is sitting idle in getxkey() waiting for a keypress, no
network functions are called. Hence no sockets are procesessed,
"ICMP Echo replies" is sent etc. 

This patch has been tested with SLang and '-DDJGPP_KEYHANDLER' 
I'm not sure how to hook into 'SLkp_getkey()' or keyboard polling in
performed under raw PCcurses.

------------------------------ cut here 
--------------------------------------------
--- htdos.org Wed Nov 24 09:23:54 1999
+++ htdos.c Tue Nov 30 14:34:28 1999
@@ -135,3 +135,43 @@
     return (ret);
 }
 
+#if defined(DJGPP) && defined(DJGPP_KEYHANDLER)
+/* PUBLIC       getxkey()
+**              Replaces libc's getxkey() with polling of tcp/ip
+**              library (WatTcp or Watt-32). This is required to
+**              be able to finish off dead sockets, answer pings etc.
+**
+** ON EXIT:
+**      returns extended keypress.
+*/
+
+/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+#include <pc.h>
+#include <dpmi.h>
+#include <libc/farptrgs.h>
+#include <go32.h>
+
+int getxkey (void)
+{
+  __dpmi_regs r;
+
+  /* poll tcp/ip lib and yield to DPMI-host while nothing in
+   * keyboard buffer (head = tail) (simpler that kbhit).
+   */
+  while (_farpeekw(_dos_ds, 0x41a) == _farpeekw(_dos_ds, 0x41c))
+  {
+    tcp_tick (NULL);
+    __dpmi_yield();
+  }
+
+  r.h.ah = 0x10;
+  __dpmi_int(0x16, &r);
+
+  if (r.h.al == 0x00)
+    return 0x0100 | r.h.ah;
+  if (r.h.al == 0xe0)
+    return 0x0200 | r.h.ah;
+  return r.h.al;
+}
+#endif /* DJGPP && DJGPP_KEYHANDLER */
+
------------------------------ cut here 
--------------------------------------------

Gisle V.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]