home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume34 / vms_rtl_kbd / part01 / pascal$kbd_routines.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-12-19  |  7.0 KB  |  259 lines

  1. (*
  2. ------------------ Distribution and Copyright -----------------
  3. --
  4. -- This software is copyright by the CENA/DGAC/FRANCE
  5. -- All rights reserved.
  6. --
  7. -- No part of the material protected by this copyright notice
  8. -- may be reproduced or utilized for commercial use in any form
  9. -- without written permission of the copyright owner.
  10. --
  11. -- It may be reproduced or utilized for R&D use in Non Profit
  12. -- Organization
  13. --
  14. ---------------------------------------------------------------
  15.  
  16.  
  17. ------------------ Disclaimer ---------------------------------
  18. --
  19. -- This software and its documentation are provided "AS IS" and
  20. -- without any expressed or implied warranties whatsoever.
  21. -- No warranties as to performance, merchantability, or fitness
  22. -- for a particular purpose exist.
  23. --
  24. -- Because of the diversity of conditions and hardware under
  25. -- which this software may be used, no warranty of fitness for
  26. -- a particular purpose is offered.  The user is advised to
  27. -- test the software thoroughly before relying on it.  The user
  28. -- must assume the entire risk and liability of using this
  29. -- software.
  30. --
  31. -- In no event shall any person or organization of people be
  32. -- held responsible for any direct, indirect, consequential
  33. -- or inconsequential damages or lost profits.
  34. --                                                           
  35. -------------------END-PROLOGUE--------------------------------
  36. *)
  37.  
  38.  
  39.  
  40.  
  41. (*****************************************************************************)
  42. (*****************************************************************************)
  43. (**                                        **)
  44. (**                           PASCAL$KBD_ROUTINES                           **)
  45. (**                                        **)
  46. (******** Copyright (C) 1992 Centre d'Etudes de la Navigation Aerienne *******)
  47. (*****************************************************************************)
  48.  
  49.  
  50.  
  51.  
  52. (*
  53.  * Titre:       PASCAL$KBD_ROUTINES
  54.  *
  55.  * Sujet:       Declarations des routines KBD$xxx ("Keyboard Routines").
  56.  *
  57.  * Version:       1.0
  58.  *
  59.  * Description:           Ce module contient la declaration de la fonction
  60.  *                 KBD$READ_KEYSTROKE permettant d'attendre une action au
  61.  *           clavier et renvoyant la sequence ANSI correspondant a la
  62.  *           touche actionnee.
  63.  *
  64.  *                     Pour utiliser KBD$READ_KEYSTROKE, il necessaire
  65.  *           d'appeler au prealable la fonction KBD$OPEN_KEYBOARD et de
  66.  *           terminer par KBD$CLOSE_KEYBOARD.
  67.  *                 La routine KBD$OPEN_KEYBOARD permet, entre autres, de ne
  68.  *           creer le tampon clavier que si l'on desire reellement
  69.  *           utiliser KBD$READ_KEYSTROKE.
  70.  *
  71.  *                     Lorsque le tampon est plein, l'utilisateur est prevenu
  72.  *                 par un beep sonore.
  73.  *
  74.  *               La fonction KBD$FLUSH_KEYBOARD permet de vider le
  75.  *           tampon clavier.
  76.  *
  77.  *                    Afin de pouvoir recuperer les codes emis par CTRL/C,
  78.  *                 CTRL/O, CTRL/Q, CTRL/S, CTRL/T, CTRL/X, CTRL/Y et F6, il est
  79.  *                 necessaire d'entrer la commande DCL "SET TERMINAL/PASTHRU
  80.  *                 /NOTTSYNC".
  81.  *
  82.  * Langage:       PASCAL NON STANDARD
  83.  *
  84.  * Fichier:       PASCAL$KBD_ROUTINES_V_1_0.PAS
  85.  *
  86.  * Module:       PASCAL$KBD_ROUTINES
  87.  *
  88.  * Environnement:  Machine cible:          VAX
  89.  *           Systeme d'exploitation: VAX/VMS Version 5.4-3
  90.  *           Compilateur:            VAX Pascal Version 4.3
  91.  *
  92.  * Auteur:       Martin VICENTE (DGAC/CENA/SID)
  93.  *
  94.  *           E-mail: vicente@cenaath.cena.dgac.fr
  95.  *
  96.  *           Mail:   C.E.N.A.
  97.  *               Div. Support Informatique & Developpement
  98.  *               Orly Sud 205
  99.  *               94 542 ORLY AEROGARE CEDEX, FRANCE
  100.  *
  101.  *
  102.  * Creation:       19/05/92
  103.  *
  104.  * Modification:   26/05/92
  105.  *
  106.  *)
  107.  
  108.  
  109.  
  110.  
  111. MODULE  pascal$kbd_routines;
  112.  
  113.  
  114.  
  115.  
  116. (*===========================================================================*)
  117.     [HIDDEN] TYPE
  118. (*===========================================================================*)
  119.  
  120.  
  121.     $UWORD = [WORD] 0..65535;
  122.  
  123.  
  124. (*===========================================================================*)
  125.     TYPE
  126. (*===========================================================================*)
  127.  
  128.  
  129.     KBD$T_ESCAPE_OVERFLOW_BUFFER = PACKED ARRAY [1..4] OF CHAR;
  130.  
  131.     KBD$T_ANSI_SEQUENCE = PACKED RECORD
  132.                      ascii         : CHAR;
  133.                  escOverBuffer : KBD$T_ESCAPE_OVERFLOW_BUFFER
  134.                   END;
  135.  
  136.  
  137. (*===========================================================================*)
  138. (*                         CONDITION VALUE RETURNED                          *)
  139. (*===========================================================================*)
  140.  
  141.  
  142. VAR  KBD$_NORMAL,
  143.      KBD$_ALREADYOPEN,
  144.      KBD$_OPENERROR,
  145.      KBD$_ALREADYCLOSE,
  146.      KBD$_CLOSEERROR,
  147.      KBD$_NOTOPEN,
  148.      KBD$_READERROR,
  149.      KBD$_KEYPRESERROR,
  150.      KBD$_FLUSHERROR
  151.  
  152.      : [EXTERNAL,VALUE] UNSIGNED;
  153.  
  154.  
  155.  
  156.  
  157. (*****************************************************************************)
  158. (*****************************************************************************)
  159. (**                        KBD$ FUNCTION DECLARATION                        **)
  160. (*****************************************************************************)
  161. (*****************************************************************************)
  162.  
  163.  
  164.  
  165.  
  166. (*
  167.  * KBD$CLOSE_KEYBOARD
  168.  *
  169.  *   Libere la memoire des structures de donnees associees a ce module.
  170.  *)
  171.  
  172. FUNCTION  kbd$close_keyboard : UNSIGNED;
  173.  
  174. EXTERNAL;
  175.  
  176.  
  177. (*
  178.  * KBD$CVT_ANSI_SMG
  179.  *
  180.  *   Convertit la sequence ANSI d'une touche en un code SMG.
  181.  *
  182.  *   Liste des codes pouvant etre renvoyes (ils sont definis dans
  183.  *   SYS$LIBRARY:PASCAL$SMG_ROUTINES):
  184.  *
  185.  *    ascii (0 - 255)        SMG$K_TRM_UP        SMG$K_TRM_DOWN
  186.  *    SMG$K_TRM_RIGHT        SMG$K_TRM_LEFT        SMG$K_TRM_ENTER
  187.  *    SMG$K_TRM_PF1        SMG$K_TRM_PF2        SMG$K_TRM_PF3
  188.  *    SMG$K_TRM_PF4        SMG$K_TRM_COMMA        SMG$K_TRM_MINUS
  189.  *    SMG$K_TRM_PERIOD    SMG$K_TRM_KP0        SMG$K_TRM_KP1
  190.  *    SMG$K_TRM_KP2        SMG$K_TRM_KP3        SMG$K_TRM_KP4
  191.  *    SMG$K_TRM_KP5        SMG$K_TRM_KP6        SMG$K_TRM_KP7
  192.  *    SMG$K_TRM_KP8        SMG$K_TRM_KP9        SMG$K_TRM_FIND
  193.  *    SMG$K_TRM_INSERT_HERE    SMG$K_TRM_REMOVE    SMG$K_TRM_SELECT
  194.  *    SMG$K_TRM_PREV_SCREEN    SMG$K_TRM_NEXT_SCREEN    SMG$K_TRM_F6
  195.  *    SMG$K_TRM_F7        SMG$K_TRM_F8        SMG$K_TRM_F9
  196.  *    SMG$K_TRM_F10        SMG$K_TRM_F11        SMG$K_TRM_F12
  197.  *    SMG$K_TRM_F13        SMG$K_TRM_F14        SMG$K_TRM_HELP
  198.  *    SMG$K_TRM_DO        SMG$K_TRM_F17        SMG$K_TRM_F18
  199.  *    SMG$K_TRM_F19        SMG$K_TRM_F20        SMG$K_TRM_UP
  200.  *    SMG$K_TRM_DOWN        SMG$K_TRM_RIGHT        SMG$K_TRM_LEFT
  201.  *    SMG$K_TRM_UNKNOWN
  202.  *)
  203.  
  204. FUNCTION  kbd$cvt_ansi_smg (sequence : kbd$t_ansi_sequence) : $UWORD;
  205.  
  206. EXTERNAL;
  207.  
  208.  
  209. (*
  210.  * KBD$FLUSH_KEYBOARD
  211.  *
  212.  *   Vide le tampon clavier.
  213.  *)
  214.  
  215. FUNCTION  kbd$flush_keyboard : UNSIGNED;
  216.  
  217. EXTERNAL;
  218.  
  219.  
  220. (*
  221.  * KBD$KEY_PRESSED
  222.  *
  223.  *   Indique si au moins une touche est presente dans le tampon.
  224.  *)
  225.  
  226. FUNCTION  kbd$key_pressed (VAR yes : BOOLEAN) : UNSIGNED;
  227.  
  228. EXTERNAL;
  229.  
  230.  
  231. (*
  232.  * KBD$OPEN_KEYBOARD
  233.  *
  234.  *   Creation et initialisation des structures de donnees associees au module.
  235.  *)
  236.  
  237. FUNCTION  kbd$open_keyboard : UNSIGNED;
  238.  
  239. EXTERNAL;
  240.  
  241.  
  242. (*
  243.  * KBD$READ_KEYSTROKE
  244.  *
  245.  *   Extrait la touche suivante du tampon; si ce dernier est vide, se met en
  246.  *   attente d'une action au clavier.
  247.  *)
  248.  
  249. FUNCTION  kbd$read_keystroke (VAR key : kbd$t_ansi_sequence) : UNSIGNED;
  250.  
  251. EXTERNAL;
  252.  
  253.  
  254.  
  255.  
  256. (*****************************************************************************)
  257.  
  258. END (* PASCAL$KBD_ROUTINES *).
  259.