-- ++ -- -- UNIT OF: TR1_ADA_FUNCTION -- -- UNIT DESCRIPTION: -- -- This is the TR2 Ada module, used to test the PDF report tool on Ada code. -- -- This is an example of a unit whose component is described elsewhere. It is -- expected that most units will look like this. This particular test case -- happens to be an Ada function body. -- -- INPUT/OUTPUT DATA ELEMENTS: -- -- This unit only has one input element, and returns a value. -- -- UNIT ALGORITHMS: -- -- This is a simple if statement. -- -- We don't make extensive use of variant records for this. -- -- UNIT ERROR HANDLING: -- -- No errors are handled. -- -- UNIT LOGIC FLOW: -- -- The only decision point in the procedure is the if statement, where we check -- to see whether the input element is greater than 10. -- -- REQUIREMENTS ALLOCATED TO THIS UNIT: -- -- To be a good test low-level case. -- -- LOCAL DATA ELEMENTS: -- -- Just one variable, of type integer. -- -- INTERRUPTS AND SIGNALS: -- -- None used. -- -- UNIT DATA CONVERSION: -- -- USE OF OTHER ELEMENTS: -- -- This function has a with statement for tr3_ada_pack, in order to get access -- to data types that are defined there. -- -- DATA STRUCTURES: -- -- All of the data structures are defined in tr3_ada_pack, and not here. -- -- LOCAL DATA FILES: -- -- No local data files are used. -- -- LIMITATIONS -- -- This function doesn't do much, and hence there are no limitations. -- -- -- with tr3_ada_pack; use tr3_ada_pack; function tr2_func_1 (p1 : in tr3_type_5 := 17) return tr3_subtype_1 is -- ++ -- FUNCTIONAL DESCRIPTION: -- -- This is a function that is a compilation unit inside a low level -- component, for testing PDS reports. -- -- FORMAL PARAMETERS: -- -- p1: -- A restricted integer, defaulting to 17. Actually, we use a type -- definition from another module for determining the type of this -- parameter. -- -- RETURN VALUE: -- -- An integer restricted even further -- -- -- tr2_var_1 : integer := 2; begin if p1 > 10 then return p1/2; else return p1; end if; end tr2_func_1;