home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume34 / vms_rtl_kbd / part01 / README < prev   
Encoding:
Text File  |  1992-12-19  |  3.4 KB  |  127 lines

  1. README                                       18/12/92
  2.  
  3.  
  4.                             K B D $ R O U T I N E S
  5.  
  6.  
  7.              << Single keypress under VMS in C, Pascal and Ada >>
  8.  
  9.  
  10.  Copyright (C) 1992 Centre d'Etudes de la Navigation Aerienne.
  11.    Author: Martin VICENTE (DGAC/CENA/SID)
  12.    E-mail: vicente@cenaath.cena.dgac.fr
  13.    Mail:   C.E.N.A. - Orly Sud 205 - 94 542 ORLY AEROGARE CEDEX, FRANCE
  14.  
  15.  
  16. How to detect a single keystroke under VMS (without RETURN) ?
  17. *************************************************************
  18.  
  19.     Perhaps many of you did have to solve this problem, and had found 
  20.     solutions: SMG$ libraries, system calls.
  21.  
  22.     Calling a SMG Run-Time Library's routine permit effectively to solve
  23.     it (polling on SMG$READ_KEYSTROKE with no time-out), but it has a 
  24.     disastrous consequences over CPU load.
  25.  
  26.     the system call solution is certainly the best one, but this need to
  27.     be initiate.
  28.  
  29.     So we developped this RTL's extension which thus offers to users an
  30.     interface much easier to manipulate.
  31.     It is accessible to C, Pascal and Ada developer. 
  32.  
  33.  
  34. The package contains these files:
  35. *********************************
  36.  
  37.     In C:
  38.  
  39.         KBD$ROUTINES.H          Header file
  40.         DEMO_KBD$ROUTINES.C      Demonstration program
  41.  
  42.     In Pascal:
  43.  
  44.         PASCAL$KBD_ROUTINES.PAS      Routine declaration
  45.         DEMO_KBD$ROUTINES.PAS      Demonstration program
  46.  
  47.     In Ada:
  48.  
  49.         KBD_.ADA          Specification declaration
  50.         DEMO_KBD_ROUTINES.ADA      Demonstration program
  51.  
  52.  
  53. The KBD library is made of 6 routines:
  54. **************************************
  55.  
  56.     KBD$CLOSE_KEYBOARD:     Free memory from data-structures associated to this 
  57.              unit.
  58.  
  59.     KBD$CVT_ANSI_SMG:     Convert the ANSI sequence of a key into a SMG code.
  60.  
  61.     KBD$FLUSH_KEYBOARD:  Empty the keyboard buffer.
  62.  
  63.     KBD$KEY_PRESSED:     Indicate if at least one key is present in the buffer.
  64.  
  65.     KBD$OPEN_KEYBOARD:     Creation and initialization of the data-structures 
  66.              associated to the unit.
  67.  
  68.     KBD$READ_KEYSTROKE:  Extract the next key from the buffer; if the latter is
  69.              empty, wait for an action onto the keyboard.
  70.  
  71.  
  72. implementation's description
  73. ****************************
  74.  
  75.     This unit is based on the producer-consumer algorithm, uses VAX/VMS
  76.     primaries (System Services: $GETDVI, $QIO, etc), a breaking subroutine
  77.     (AST) and the PASCAL$PPL_ROUTINES library.
  78.     
  79.     The producer is a breaking subroutine activated by an action onto 
  80.     the keyboard, feeding a buffer memory. The consumer is the 
  81.     KBD$READ_KEYSTROKE which take, each call, an ANSI sequence from buffer
  82.     memory. The keyboard's buffer is managed in a circle.
  83.  
  84.     When the buffer is full, the user is warned by a sound beep.
  85.  
  86.  
  87. PRACTICAL USE:
  88. **************
  89.  
  90.     1/ Create your own object library:
  91.  
  92.         $ LIBRARY/CREATE/OBJECT MYLIB
  93.  
  94.        If you want do give another name to the library, or if you have already
  95.        got one, you've got to modify the "LIB" variable in the BUILD.COM file.
  96.  
  97.     2/ Compile and insert KBD$ROUTINES unit into the library:
  98.  
  99.         $ @BUILD
  100.         $ @BUILD 3  (ou KP3)
  101.  
  102.     3/ Compile and insert error messages into the library:
  103.  
  104.         $ MESSAGE KBDMSG
  105.         $ LIBRARY/REPLACE MYLIB KBDMSG
  106.  
  107.     4/ In Pascal
  108.  
  109.         $ PASCAL DEMO_KBD$ROUTINES
  110.         $ LINK DEMO_KBD$ROUTINES, MYLIB/LIBRARY
  111.         $ RUN DEMO_KBD$ROUTINES
  112.  
  113.     5/ In C
  114.  
  115.         $ CC DEMO_KBD$ROUTINES
  116.         $ LINK DEMO_KBD$ROUTINES, MYLIB/LIBRARY, LINK_CC.OPT/OPTION
  117.         $ RUN DEMO_KBD$ROUTINES
  118.  
  119.     6/ In Ada
  120.  
  121.         $ ACS SET LIBRARY MYLIBADA
  122.         $ ADA KBD_
  123.         $ ADA DEMO_KBD_ROUTINES
  124.         $ DEFINE LNK$LIBRARY MYLIB
  125.         $ ACS LINK DEMO_KBD_ROUTINES
  126.         $ DEASSIGN LNK$LIBRARY
  127.