(*
    Title: 	KeyInput
    LastEdit:	"Wed Oct 17 12:46:14 1984"
    Author: 	Mick Jordan
		Acorn Research Centre

*)

DEFINITION MODULE KeyInput;
FROM Streams IMPORT Stream;
FROM KeyTypes IMPORT KeyData;

EXPORT QUALIFIED NKeys, NextKey, IsKeyData;

(* This module should be used to read key files.
   First call "IsKeyData" to verify that the stream
   does actually contain key data.  Then call "NKeys"
   to find out how many "KeyData" records there are.
   Then call "NextKey" that many times to get the
   actual records. 
*)

PROCEDURE IsKeyData(s: Stream; VAR version: CARDINAL): BOOLEAN;
(* TRUE iff stream 's' does have key data on it.
Also sets 'version' to the embedded version number.
*)

PROCEDURE NKeys(s: Stream): CARDINAL;
(*  returns the number of key records in key file
opened on 's'.
*)
PROCEDURE NextKey(s: Stream; VAR keyData: KeyData): BOOLEAN;
(*  sets 'keyData' to the next entry on the stream,
returning TRUE if ok, else FALSE.
*)


END KeyInput.
