home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR19 / LANKEY1.ZIP / LANKEYC.C < prev    next >
Text File  |  1993-05-07  |  2KB  |  64 lines

  1. /* LANKEYC.C - extended C language routines for use with Clipper programs
  2.  
  3.   contains : C_INKEY()    - time-slice function called by P_INKEY()
  4.              C_PEEK()     - classic PEEK function
  5.  
  6.   requires Microsoft C Compiler 5.1
  7.  
  8.   compile command:  CL /c /AL /Zl /Oalt /FPa /Gs lankeyc.c
  9.  
  10.   author: Shawn B. Lipscomb, Intelligent Decisions, Inc.
  11. */
  12.  
  13.  
  14. #include "extend.h"
  15. #include "stdlib.h"
  16. #include "math.h"
  17. #include "bios.h"
  18.  
  19. CLIPPER c_inkey()
  20. /*
  21.   Time-slice function called by P_INKEY() that allows a non-dedicated network
  22.   server time to print part of a spooled print job.  There are better ways to
  23.   sense when half a second has passed, but this method has proven to provide
  24.   the maximum benefit to the network spooler.
  25.   Syntax : C_INKEY(nKeybdTailPtr)
  26. */
  27. {
  28.   int mMidnight,pTailPos;
  29.   int far *KeybdBuffTail;
  30.   long mTimesUp,mTimeIs;
  31.  
  32.   pTailPos=_parni(1);
  33.  
  34.   /* create pointer to location of pointer to keyboard buffer tail */
  35.   KeybdBuffTail=(int far *) 0x041C;
  36.  
  37.   _bios_timeofday(_TIME_GETCLOCK,&mTimesUp);
  38.   mTimesUp+=9;      /* 18.2 ticks/second, and I want to wait half a second */
  39.   mTimeIs=0L;
  40.   mMidnight=0;
  41.  
  42.   while (!kbhit() && (*KeybdBuffTail == pTailPos) && (mTimeIs < mTimesUp) && (! mMidnight))
  43.     mMidnight=_bios_timeofday(_TIME_GETCLOCK,&mTimeIs);
  44.  
  45.   _ret();
  46. }
  47.  
  48.  
  49. CLIPPER c_peek()
  50. /*
  51.   Classical Peek function.
  52.   Called by P_INKEY() to get the pointer to the keyboard buffer which will
  53.   later get passed onto C_INKEY().
  54.   Syntax : C_PEEK(nAddress)
  55. */
  56. {
  57.   long pAddress;
  58.   int far *mPointer;
  59.  
  60.   pAddress=_parni(1);
  61.   mPointer=(int far *) pAddress;
  62.   _retni(*mPointer);
  63. }
  64.