-------- SIMTEL20 Ada Software Repository Prologue ------------ -- -* -- Unit name : TBD_PACKAGE -* -- Version : 1.1 -* -- Author : Bryce Bardin -* -- Ada Projects Section -* -- Software Engineering Division -* -- Ground Systems Group -* -- Hughes Aircraft Company -* -- Fullerton, CA -* -- -* -- -* -- -* -- DDN Address -* -- Copyright : (c) 1985 -* -- Date created : -* -- Release date : 3 Dec 85 -* -- Last update : 3 Dec 85 -* -- Machine/System Compiled/Run on : -* -- Vax 11/785 VMS 4.1 Dec-Ada -* --------------------------------------------------------------- -- -* -- Keywords : TBD_Package ----------------: -* -- -* -- Abstract : -* ----------------: -* -- -* -- TBD stands for "To Be Determined". This package is -* -- intended to be used during design to aid in producing -* -- partial designs that are expressed in valid Ada. It also -* -- may be used advantageously in development while the -* -- implementation is incomplete or in rapid prototyping. -* -- -* -- In particular, it supplies type definitions, range -* -- limits, and default values which may be used to assist in -* -- describing unknown or partially defined types, objects, -* -- and values. In addition, it supplies a place-holding -* -- procedure call. -* -- -* -- If this TBD_PACKAGE is used, simple searches for the -* -- string "TBD" -* -- may be used to find many places where the design is -* -- incomplete. -* -- -* -- N.B.: The types defined here should be used to derive -* -- those used in the design, rather than being used directly -* -- (see the usage given below for examles of the style). -* -- -* -- -* ------------------ Revision history --------------------------- -- -* -- DATE VERSION AUTHOR HISTORY -* -- -* ------------------ Distribution and Copyright ----------------- -- -* -- This prologue must be included in all copies of this -* -- software. -* -- -* -- This software is copyright by the author. -* -- -* -- This software is released to the Ada community. -* -- This software is released to the Public Domain (note: -* -- software released to the Public Domain is not subject -* -- to copyright protection). -* -- Restrictions on use or distribution: NONE -* -- -* ------------------ 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-------------------------------- generic type ITEM is private ; VALUE : in ITEM ; function TBD_VALUE return ITEM ; function TBD_VALUE return ITEM is begin return VALUE ; end TBD_VALUE; with TBD_VALUE ; with SYSTEM ; package TBD_PACKAGE is --======================================================================== -- -- Author : Bryce Bardin -- Ada Projects Section -- Software Engineering Division -- Ground Systems Group -- Hughes Aircraft Company -- Fullerton, CA -- --======================================================================== type TBD_TYPE is (TBD) ; -- The following construct should rarely, if ever, be necessary. -- For an arbitrary unknown type: -- type UNKNOWN is new TBD_TYPE ; -- ANONYMOUS : UNKNOWN := TBD ; -- -------------------------------------------------------------------------- -- -- function TBD return INTEGER ; function TBD is new TBD_VALUE ( INTEGER , 1 ) ; -- -- function TBD return FLOAT ; function TBD is new TBD_VALUE ( FLOAT , 1.0 ) ; -- -- function TBD return BOOLEAN ; function TBD is new TBD_VALUE ( BOOLEAN , TRUE ) ; -- -- For an unknown value of any user-defined type, T: -- function TBD is new TBD_VALUE ( T , ) ; -- OBJECT : T := TBD ; -- -- N.B.: The usage of the predefined types INTEGER and FLOAT (which -- are machine dependent) should, as a matter of policy, generally be -- avoided unless the usage is clearly portable (e.g., in small index -- ranges for loops). -- -- For an unknown value of type INTEGER: -- INT : INTEGER := TBD ; -- -- For an unknown value of type FLOAT: -- FLT : FLOAT := TBD ; -- -- For an unknown value of type BOOLEAN; -- BOOL : BOOLEAN := TBD ; -- and -- if TBD then ... end if ; -- --======================================================================== -- -- The constructs given below are recommended and will usually convey -- the abstraction desired more concisely and correctly. The also -- are easily evolved into the required final form. -- --======================================================================== TBD_INT : constant := 1 ; TBD_REAL : constant := 1.0 ; TBD_FLT : constant := TBD_REAL ; -- an alias TBD_FIX : constant := TBD_REAL ; -- an alias -- For unknown static integer values: -- type STATIC is range 0 .. TBD_INT ; -- -- For unknown static real values: -- type IMMOBLE is digits 6 range 1.0 .. TBD_FLT ; -- -------------------------------------------------------------------------- -- -- The smallest (most negative) integer possible: TBD_MIN_INT : constant := SYSTEM.MIN_INT ; -- -- The largest integer possible: TBD_MAX_INT : constant := SYSTEM.MAX_INT ; -- -- The largest range integer type possible: type TBD_INTEGER is range TBD_MIN_INT .. TBD_MAX_INT ; -- -- function TBD return TBD_INTEGER ; function TBD is new TBD_VALUE ( TBD_INTEGER , 1 ) ; -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- For an integer type of unknown range [case 1]: -- type MY_INTEGER is range TBD_MIN_INT .. TBD_MAX_INT ; -- type MY_POSITIVE is range 1 .. TBD_MAX_INT ; -- -- N.B.: Only integer literal values and named numbers are available. -- MINE : MY_INTEGER := 3 ; -- ME : MY_POSITIVE := TBD_INT ; -- -- When the design is complete the form should be: -- type MY_INTEGER is range N .. M ; -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- For an integer type of unknown range [case 2]: -- type UNKNOWN is new TBD_INTEGER [range TBD .. TBD] ; -- -- N.B.: Both TBD and integer literal values are available. -- INCOGNITO : UNKNOWN := TBD ; -- ANONYMOUS : UNKNOWN range 0 .. TBD := 1 ; -- -- When the design is complete, the form should be: -- type UNKNOWN is range N .. M ; -- INCOGNITO : UNKNOWN := N ; -- ANONYMOUS : UNKNOWN range 0 .. M := 1 ; -- -------------------------------------------------------------------------- -- TBD_DIGITS : constant := SYSTEM.MAX_DIGITS ; -- -- The most precise floating point type possible: type TBD_FLOAT is digits TBD_DIGITS ; -- -- function TBD return TBD_FLOAT ; function TBD is new TBD_VALUE ( TBD_FLOAT , 1.0 ) ; -- -- The largest floating point value possible : TBD_MAX_FLT : constant := 2.0 ** TBD_FLOAT'SAFE_EMAX * ( 1.0 -1.0 /2.0 ** TBD_FLOAT'MANTISSA ) ; -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- For a floating-point type of unknown precision (and range) [case 1]: -- type YOUR_FLOAT is digits TBD_DIGITS -- [ range -TBD_MAX_FLT .. TBD_MAX_FLT ] ; -- -- N.B.: Only real literal values and named numbers are available. -- YOURS : YOUR_FLOAT range -TBD_MAX_FLT .. 100.0 := TBD_FLT ; -- -- When the design is complete, the form shoud be : -- type YOUR_FLOAT is digits D [ range F .. L ] -- YOURS : YOUR_FLOAT range X .. Y := Z ; -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- For a floating-point type of unknown precision (and range) [case 2]: -- type MY_FLOAT is new TBD_FLOAT ; -- [ range -TBD_MAX_FLT .. TBD_MAX_FLT ] ; -- -- N.B.: Both TBD and real literal values are available. -- MINE : MY_FLOAT := TBD ; -- YOURS : MY_FLOAT range 0.0 .. MY_FLOAT'LAST := 1.0 ; -- -- When the design is complete, the form should be: -- type MY_FLOAT is digits D [ range F .. L ] ; -- MINE : MY_FLOAT := X ; -- ------------------------------------------------------------------------ -- TBD_DELTA : constant := 1.0 ; -- arbitrary -- TBD_MAX_FIX : constant := 1.0 / SYSTEM.FINE_DELTA ; -- -- The largest range fixed-point type with the given delta: type TBD_FIXED is delta TBD_DELTA range -TBD_MAX_FIX .. TBD_MAX_FIX ; -- -- function TBD return TBD_FIXED ; function TBD is new TBD_VALUE ( TBD_FIXED , 1.0 ) ; -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- For a fixed-point type of unknown precision (and range) [case 1]: -- type MY_FIXED is delta TBD_DELTA range -TBD_FIX .. TBD_MAX_FIX ; -- -- N.B.: Only real literal values and named numbers are available. -- MINE : MY_FIXED := 1.0 ; -- MY : MY_FIXED range 1.0 .. TBD_MAX_FIX := TBD_FIX ; -- -- When the design is complete, the form should be: -- type MY_FIXED is delta D range F .. L ; -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- For a fixed-point type of unknown precision and range [case 2]: -- type YOUR_FIXED is new TBD_FIXED [ delta TBD ] [ range TBD .. TBD ] ; -- -- N.B.: Both TBD and real literal values are available. -- YOURS : YOUR_FIXED := TBD ; -- YOU : YOUR_FIXED range 0.0 .. TBD_MAX_FIX := 1.0 ; -- -- When the design is complete, the form should be: -- type YOUR_FIXED is delta D range F .. L ; -- -------------------------------------------------------------------------- -- -- For an enumeration type with unknown values: -- type MY_ENUM is (TBD) ; -- ENUM : MY_ENUM := TBD ; -- -- For an enumeration type with some known and some unknown values: -- type UNCERTAIN is ( KNOWN , TBD ) ; -- AMBIGUOUS : UNCERTAIN := TBD : -- -------------------------------------------------------------------------- -- procedure TBD ; -- -- For processing which is not yet defined: -- TBD ; -- -- N.B.: Don't use null statements for this purpose since they should -- be reserved for intentional null processing. -- -------------------------------------------------------------------------- end TBD_PACKAGE ; package body TBD_PACKAGE is procedure TBD is begin null ; end TBD ; end TBD_PACKAGE ;