[net.sources] OSSI: SINumberIO

biagioni@unc.UUCP (Edoardo Biagioni) (11/06/86)

(***************************************************************************)
(***                                                                     ***)
(***                                                                     ***)
(***                        O  S  S  I                                   ***)
(***                        ==========                                   ***)
(***                                                                     ***)
(**)               DEFINITION MODULE SINumberIO;                         (**)
(***               ============================                          ***)
(***                                                                     ***)
(***   This module defines some facilities for number input-output.      ***)
(***                                                                     ***)
(***---------------------------------------------------------------------***)
(***                                                                     ***)
(***   Hardware:             independent                                 ***)
(***   Operating System:     independent                                 ***)
(***   Compiler:             independent                                 ***)
(***                                                                     ***)
(***   Version:      3.0                                                 ***)
(***   Implemented:  see copyright                                       ***)
(***   Date:         1986-03-12                                          ***)
(***                                                                     ***)
(***---------------------------------------------------------------------***)
(***                                                                     ***)
(***   Copyright 1984, 1985, 1986 by                                     ***)
(***      E. S. Biagioni                                                 ***)
(***      G. Heiser                                                      ***)
(***      K. Hinrichs                                                    ***)
(***      C. Muller                                                      ***)
(***                                                                     ***)
(***   Institut fuer Informatik                                          ***)
(***   ETH Zuerich                                                       ***)
(***   CH 8092 Zuerich                                                   ***)
(***   Switzerland                                                       ***)
(***                                                                     ***)
(***   Department of Computer Science                                    ***)
(***   University of North Carolina                                      ***)
(***   Chapel Hill, North Carolina 27514                                 ***)
(***   U.S.A.                                                            ***)
(***                                                                     ***)
(*** Permission to copy without fee all of this material is granted      ***)
(*** provided that the copies are not made or distributed for direct     ***)
(*** commercial advantage, that this OSSI copyright notice is            ***)
(*** included in the copy, that the module is not modified in any way    ***)
(*** except where necessary for compilation on a particular system,      ***)
(*** and that the module is always distributed in its original form.     ***)
(*** Distribution of this module in a modified form without including    ***)
(*** the original version is a violation of this copyright notice.       ***)
(***                                                                     ***)
(***---------------------------------------------------------------------***)
(***                                                                     ***)
(***   Updates:                                                          ***)
(***                                                                     ***)
(***                                                                     ***)
(***************************************************************************)

FROM SISystem IMPORT
  SIResult;


EXPORT QUALIFIED
  WriteCard,
  WriteInt,
  WriteReal,
  WriteOct,
  WriteHex,
  ReadCard,
  ReadInt,
  ReadReal,
  ReadOct,
  ReadHex;


(* the following input/output procedures are all defined like the
   corresponding string procedures in SIConversions *)

PROCEDURE WriteCard (c: CARDINAL; field: CARDINAL);

PROCEDURE WriteInt (i: INTEGER; field: CARDINAL);

PROCEDURE WriteReal (r: REAL; field, digits: CARDINAL; scientific: BOOLEAN);

PROCEDURE WriteOct (c: CARDINAL; field: CARDINAL);

PROCEDURE WriteHex (c: CARDINAL; field: CARDINAL);

(* In the following, (result # SIDone) implies the number could not
   be read, either because no number was entered or because the
   number overflowed the machine representation. In the former
   case result is SIConversions.NumberNotFound(), in the latter it is
   SIConversions.NumberOverflow().
   The calling program should offer a choice of aborting or restarting
   the entire operation before requesting the number again *)

PROCEDURE ReadCard (VAR c: CARDINAL; VAR result : SIResult);

PROCEDURE ReadInt (VAR i: INTEGER; VAR result : SIResult);

PROCEDURE ReadReal (VAR r: REAL; VAR result : SIResult);

PROCEDURE ReadOct (VAR c: CARDINAL; VAR result : SIResult);

PROCEDURE ReadHex (VAR c: CARDINAL; VAR result : SIResult);

END SINumberIO.