home *** CD-ROM | disk | FTP | other *** search
-
- ------------------ Distribution and Copyright -----------------
- --
- -- This software is copyright by the CENA/DGAC/FRANCE
- -- All rights reserved.
- --
- -- No part of the material protected by this copyright notice
- -- may be reproduced or utilized for commercial use in any form
- -- without written permission of the copyright owner.
- --
- -- It may be reproduced or utilized for R&D use in Non Profit
- -- Organization
- --
- ---------------------------------------------------------------
-
-
- ------------------ Disclaimer ---------------------------------
- --
- -- This software and its documentation are provided "AS IS" and
- -- without any expressed or implied warranties whatsoever.
- -- No warranties as to performance, merchantability, or fitness
- -- for a particular purpose exist.
- --
- -- Because of the diversity of conditions and hardware under
- -- which this software may be used, no warranty of fitness for
- -- a particular purpose is offered. The user is advised to
- -- test the software thoroughly before relying on it. The user
- -- must assume the entire risk and liability of using this
- -- software.
- --
- -- In no event shall any person or organization of people be
- -- held responsible for any direct, indirect, consequential
- -- or inconsequential damages or lost profits.
- --
- -------------------END-PROLOGUE--------------------------------
-
-
-
-
- --*****************************************************************************
- --*****************************************************************************
- --** **
- --** D E M O D E S R O U T I N E S K B D $ **
- --** **
- --******** Copyright (C) 1992 Centre d'Etudes de la Navigation Aerienne *******
- --*****************************************************************************
-
-
-
-
- -- ++
- --
- -- Titre: DEMO DES ROUTINES KBD$
- --
- -- Sujet: Programme de demonstration des routines KBD$.
- --
- -- Version: 1.0
- --
- -- Description: Ce programme de demonstration met en oeuvre la fonction
- -- KBD$READ_KEYSTROKE permettant d'attendre une action au
- -- clavier et renvoyant la sequence ANSI correspondant a la
- -- touche actionnee.
- --
- -- Lorsque le tampon est plein, l'utilisateur est prevenu
- -- par un beep sonore emit par le sous-programme d'IT.
- --
- -- Afin de pouvoir recuperer les codes emis par CTRL/C,
- -- CTRL/O, CTRL/Q, CTRL/S, CTRL/T, CTRL/X, CTRL/Y et F6, il est
- -- necessaire d'entrer la commande DCL "SET TERMINAL/PASTHRU
- -- /NOTTSYNC".
- --
- -- Pour utiliser KBD$READ_KEYSTROKE, vous devez appeler au
- -- prealable la fonction KBD$OPEN_KEYBOARD et terminer par
- -- KBD$CLOSE_KEYBOARD.
- -- La routine KBD$OPEN_KEYBOARD permet, entre autres, de ne
- -- creer la zone tampon que si l'on desire reellement utiliser
- -- KBD$READ_KEYSTROKE.
- --
- -- Langage: ADA
- --
- -- Fichier: DEMO_KBD_ROUTINES.ADA
- --
- -- Environnement: Machine cible: VAX
- -- Systeme d'exploitation: VAX/VMS Version 5.4
- -- Compilateur: VAX Ada Version 2.1-28
- --
- -- Auteur: Martin VICENTE (DGAC/CENA/SID)
- --
- -- E-mail: vicente@cenaath.cena.dgac.fr
- --
- -- Mail: C.E.N.A.
- -- Div. Support Informatique & Developpement
- -- Orly Sud 205
- -- 94 542 ORLY AEROGARE CEDEX, FRANCE
- --
- -- Creation: 25/05/92
- --
- -- Modification: 25/05/92
- --
- -- --
-
-
-
-
- with CONDITION_HANDLING;
- with SYSTEM;
- with LIB;
- with KBD;
- with TEXT_IO;
-
- use CONDITION_HANDLING;
- use SYSTEM;
- use KBD;
- use TEXT_IO;
-
-
- procedure DEMO_KBD_ROUTINES is
-
-
- COND_VALUE : COND_VALUE_TYPE;
- YES : BOOLEAN;
- I : INTEGER;
- KEY : T_ANSI_SEQUENCE;
- CODE : UNSIGNED_WORD;
-
-
- procedure CHECK (COND_VALUE : in COND_VALUE_TYPE) is
- begin
- if not SUCCESS (COND_VALUE) then
- STOP (COND_VALUE);
- end if;
- end CHECK;
-
-
- package LOCAL_INTEGER_IO is new TEXT_IO.INTEGER_IO(INTEGER);
- use LOCAL_INTEGER_IO;
-
-
- begin
-
- OPEN_KEYBOARD (COND_VALUE => COND_VALUE);
- CHECK (COND_VALUE => COND_VALUE);
-
- PUT_LINE ("Press a key.");
-
- loop
- KEY_PRESSED (COND_VALUE => COND_VALUE, YES => YES);
- CHECK (COND_VALUE => COND_VALUE);
- exit when YES;
- end loop;
-
- PUT_LINE ("Five loop...");
-
- for I in 1..5 loop
- PUT ("Programme principal (loop): ");
- PUT (I);
- NEW_LINE;
- LIB.WAIT (STATUS => COND_VALUE, SECONDS => 1.0);
- CHECK (COND_VALUE => COND_VALUE);
- end loop;
-
- PUT_LINE ("Five readkey...");
-
- for I in 1..5 loop
- PUT ("Programme principal (SMG code): ");
- READ_KEYSTROKE (COND_VALUE => COND_VALUE, KEY => KEY);
- CHECK (COND_VALUE => COND_VALUE);
- CVT_ANSI_SMG (SMG_CODE => CODE, SEQUENCE => KEY);
- PUT (natural (CODE));
- NEW_LINE;
- end loop;
-
- PUT_LINE ("Five loop...");
-
- for I in 1..5 loop
- PUT ("Programme principal (loop): ");
- PUT (I);
- NEW_LINE;
- delay 1.0;
- -- LIB.WAIT (STATUS => COND_VALUE, SECONDS => 1.0);
- -- CHECK (COND_VALUE => COND_VALUE);
- end loop;
-
- PUT_LINE ("Flush keyboard.");
-
- FLUSH_KEYBOARD (COND_VALUE => COND_VALUE);
- CHECK (COND_VALUE => COND_VALUE);
-
- PUT_LINE ("Five loop...");
-
- for I in 1..5 loop
- PUT ("Programme principal (loop): ");
- PUT (I);
- NEW_LINE;
- delay 1.0;
- -- LIB.WAIT (STATUS => COND_VALUE, SECONDS => 1.0);
- -- CHECK (COND_VALUE => COND_VALUE);
- end loop;
-
- PUT_LINE ("End");
-
- CLOSE_KEYBOARD (COND_VALUE => COND_VALUE);
- CHECK (COND_VALUE => COND_VALUE);
-
- end DEMO_KBD_ROUTINES;
-