home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume34 / vms_rtl_kbd / part02 / demo_kbd$routines.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-12-19  |  4.8 KB  |  176 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. (**               D E M O   D E S   R O U T I N E S   K B D $               **)
  45. (**                                                                         **)
  46. (******** Copyright (C) 1992 Centre d'Etudes de la Navigation Aerienne *******)
  47. (*****************************************************************************)
  48.  
  49.  
  50.  
  51.  
  52. (*
  53.  * Titre:       DEMO DES ROUTINES KBD$
  54.  *
  55.  * Sujet:       Programme de demonstration des routines KBD$.
  56.  *
  57.  * Version:       1.0
  58.  *
  59.  * Description:           Ce programme de demonstration met en oeuvre 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.  *               Lorsque le tampon est plein, l'utilisateur est prevenu
  65.  *                 par un beep sonore emit par le sous-programme d'IT.
  66.  *
  67.  *               Afin de pouvoir recuperer les codes emis par CTRL/C,
  68.  *                 CTRL/O, CTRL/Q, CTRL/S, CTRL/T, CTRL/X, CTRL/Y et F6, il est
  69.  *                 necessaire d'entrer la commande DCL "SET TERMINAL/PASTHRU
  70.  *                 /NOTTSYNC".
  71.  *
  72.  *                     Pour utiliser KBD$READ_KEYSTROKE, vous devez appeler au
  73.  *           prealable la fonction KBD$OPEN_KEYBOARD et terminer par
  74.  *           KBD$CLOSE_KEYBOARD.
  75.  *                 La routine KBD$OPEN_KEYBOARD permet, entre autres, de ne
  76.  *           creer la zone tampon que si l'on desire reellement utiliser
  77.  *                 KBD$READ_KEYSTROKE.
  78.  *
  79.  * Langage:       PASCAL QUASI STANDARD
  80.  *
  81.  * Fichier:       DEMO_PASCAL$KBD_ROUTINES.PAS
  82.  *                       
  83.  * Environnement:  Machine cible:          VAX
  84.  *           Systeme d'exploitation: VAX/VMS Version 5.4-3
  85.  *           Compilateur:            VAX Pascal Version 4.3
  86.  *
  87.  * Auteur:       Martin VICENTE (DGAC/CENA/SID)
  88.  *
  89.  *           E-mail: vicente@cenaath.cena.dgac.fr
  90.  *
  91.  *           Mail:   C.E.N.A.
  92.  *               Div. Support Informatique & Developpement
  93.  *               Orly Sud 205
  94.  *               94 542 ORLY AEROGARE CEDEX, FRANCE
  95.  *
  96.  * Creation:       19/05/92
  97.  *
  98.  * Modification:   26/05/92
  99.  *
  100.  *)
  101.  
  102.  
  103.  
  104.  
  105. [INHERIT( 'sys$library:pascal$lib_routines',
  106.       'vic$library:pascal$kbd_routines'  )]
  107.  
  108.  
  109. PROGRAM  demo_kbd$routines (output);
  110.  
  111.  
  112. PROCEDURE  perform (cond_value : UNSIGNED);
  113.  
  114. BEGIN
  115.  
  116.    IF NOT Odd (cond_value) THEN LIB$STOP (cond_value)
  117.  
  118. END (* perform *);
  119.  
  120.  
  121. VAR
  122.  
  123.    yes : BOOLEAN;
  124.    i   : INTEGER;
  125.    key : KBD$T_ANSI_SEQUENCE;
  126.  
  127.  
  128. BEGIN
  129.  
  130.    perform (KBD$OPEN_KEYBOARD);
  131.  
  132.    Writeln ('Press a key.');
  133.  
  134.    REPEAT
  135.       perform (KBD$KEY_PRESSED (yes))
  136.    UNTIL yes;
  137.  
  138.    Writeln ('Five loop...');
  139.  
  140.    FOR i := 1 TO 5 DO BEGIN
  141.       Writeln ('Programme principal (loop): ', i:2);
  142.       perform (LIB$WAIT (1))
  143.    END {FOR};
  144.  
  145.    Writeln ('Five readkey...');
  146.  
  147.    FOR i := 1 TO 5 DO BEGIN
  148.       Write ('Programme principal (SMG code): ');
  149.       perform (KBD$READ_KEYSTROKE (key));
  150.       Writeln (KBD$CVT_ANSI_SMG (key):5)
  151.    END {FOR};
  152.  
  153.    Writeln ('Five loop...');
  154.  
  155.    FOR i := 1 TO 5 DO BEGIN
  156.       Writeln ('Programme principal (loop): ', i:2);
  157.       perform (LIB$WAIT (1))
  158.    END {FOR};
  159.  
  160.    Writeln ('Flush keyboard.');
  161.  
  162.    perform (KBD$FLUSH_KEYBOARD);
  163.  
  164.    Writeln ('Five loop...');
  165.  
  166.    FOR i := 1 TO 5 DO BEGIN
  167.       Writeln ('Programme principal (loop): ', i:2);
  168.       perform (LIB$WAIT (1))
  169.    END {FOR};
  170.  
  171.    Writeln ('End');
  172.  
  173.    perform (KBD$CLOSE_KEYBOARD)
  174.  
  175. END (* DEMO PASCAL$KBD_ROUTINES *).
  176.