| 1 |
-- CA13002.A |
| 2 |
-- |
| 3 |
-- Grant of Unlimited Rights |
| 4 |
-- |
| 5 |
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, |
| 6 |
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained |
| 7 |
-- unlimited rights in the software and documentation contained herein. |
| 8 |
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making |
| 9 |
-- this public release, the Government intends to confer upon all |
| 10 |
-- recipients unlimited rights equal to those held by the Government. |
| 11 |
-- These rights include rights to use, duplicate, release or disclose the |
| 12 |
-- released technical data and computer software in whole or in part, in |
| 13 |
-- any manner and for any purpose whatsoever, and to have or permit others |
| 14 |
-- to do so. |
| 15 |
-- |
| 16 |
-- DISCLAIMER |
| 17 |
-- |
| 18 |
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR |
| 19 |
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED |
| 20 |
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE |
| 21 |
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE |
| 22 |
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A |
| 23 |
-- PARTICULAR PURPOSE OF SAID MATERIAL. |
| 24 |
--* |
| 25 |
-- |
| 26 |
-- OBJECTIVE: |
| 27 |
-- Check that two library child units and/or subunits may have the same |
| 28 |
-- simple names if they have distinct expanded names. |
| 29 |
-- |
| 30 |
-- TEST DESCRIPTION: |
| 31 |
-- Declare a package that provides some primitive functionality (minimal |
| 32 |
-- terminal driver operations in this case). Add child packages to |
| 33 |
-- expand the functionality for different but related contexts (different |
| 34 |
-- terminal kinds). Add child packages, or subunits, to the children to |
| 35 |
-- provide the same high level operation for each of the different |
| 36 |
-- contexts (terminals). Since the operations are the same, at the leaf |
| 37 |
-- level they are likely to have the same names. |
| 38 |
-- |
| 39 |
-- The main program "with"s the child packages. Check that the |
| 40 |
-- child units and subunits perform as expected. |
| 41 |
-- |
| 42 |
-- |
| 43 |
-- CHANGE HISTORY: |
| 44 |
-- 06 Dec 94 SAIC ACVC 2.0 |
| 45 |
-- |
| 46 |
--! |
| 47 |
|
| 48 |
-- Public parent. |
| 49 |
package CA13002_0 is -- Terminal_Driver. |
| 50 |
|
| 51 |
type TC_Name is (First_Child, Second_Child, Third_Child, Fourth_Child); |
| 52 |
type TC_Call_From is (First_Grandchild, Second_Grandchild, First_Subunit, |
| 53 |
Second_Subunit); |
| 54 |
type TC_Calls_Arr is array (TC_Name, TC_Call_From) of boolean; |
| 55 |
TC_Calls : TC_Calls_Arr := (others => (others => false)); |
| 56 |
|
| 57 |
-- In real application, Send_Control_Sequence sends keystrokes from |
| 58 |
-- the terminal, i.e., space, escape, etc. |
| 59 |
procedure Send_Control_Sequence (Row : in TC_Name; |
| 60 |
Col : in TC_Call_From); |
| 61 |
|
| 62 |
end CA13002_0; |
| 63 |
|
| 64 |
--==================================================================-- |
| 65 |
|
| 66 |
-- First child. |
| 67 |
package CA13002_0.CA13002_1 is -- Terminal_Driver.VT100 |
| 68 |
|
| 69 |
-- Move cursor up, down, left, or right. |
| 70 |
procedure Move_Cursor (Col : in TC_Call_From); |
| 71 |
|
| 72 |
end CA13002_0.CA13002_1; |
| 73 |
|
| 74 |
--==================================================================-- |
| 75 |
|
| 76 |
-- First grandchild. |
| 77 |
procedure CA13002_0.CA13002_1.CA13002_5; -- Terminal_Driver.VT100.Cursor_Up |
| 78 |
|
| 79 |
--==================================================================-- |
| 80 |
|
| 81 |
-- Second child. |
| 82 |
package CA13002_0.CA13002_2 is -- Terminal_Driver.IBM3270 |
| 83 |
|
| 84 |
procedure Move_Cursor (Col : in TC_Call_From); |
| 85 |
|
| 86 |
end CA13002_0.CA13002_2; |
| 87 |
|
| 88 |
--==================================================================-- |
| 89 |
|
| 90 |
-- Second grandchild. |
| 91 |
procedure CA13002_0.CA13002_2.CA13002_5; -- Terminal_Driver.IBM3270.Cursor_Up |
| 92 |
|
| 93 |
--==================================================================-- |
| 94 |
|
| 95 |
-- Third child. |
| 96 |
package CA13002_0.CA13002_3 is -- Terminal_Driver.DOS_ANSI |
| 97 |
|
| 98 |
procedure Move_Cursor (Col : in TC_Call_From); |
| 99 |
|
| 100 |
procedure CA13002_5; -- Terminal_Driver.DOS_ANSI.Cursor_Up |
| 101 |
-- implementation will be as a |
| 102 |
-- separate subunit. |
| 103 |
end CA13002_0.CA13002_3; |
| 104 |
|
| 105 |
--==================================================================-- |
| 106 |
|
| 107 |
-- Fourth child. |
| 108 |
package CA13002_0.CA13002_4 is -- Terminal_Driver.WYSE |
| 109 |
|
| 110 |
procedure Move_Cursor (Col : in TC_Call_From); |
| 111 |
|
| 112 |
procedure CA13002_5; -- Terminal_Driver.WYSE.Cursor_Up |
| 113 |
-- implementation will be as a |
| 114 |
-- separate subunit. |
| 115 |
|
| 116 |
end CA13002_0.CA13002_4; |
| 117 |
|
| 118 |
--==================================================================-- |
| 119 |
|
| 120 |
-- Terminal_Driver. |
| 121 |
package body CA13002_0 is |
| 122 |
|
| 123 |
procedure Send_Control_Sequence (Row : in TC_Name; |
| 124 |
Col : in TC_Call_From) is |
| 125 |
begin |
| 126 |
-- Reads a key and takes action. |
| 127 |
TC_Calls (Row, Col) := true; |
| 128 |
end Send_Control_Sequence; |
| 129 |
|
| 130 |
end CA13002_0; |
| 131 |
|
| 132 |
--==================================================================-- |
| 133 |
|
| 134 |
-- Terminal_Driver.VT100. |
| 135 |
package body CA13002_0.CA13002_1 is |
| 136 |
|
| 137 |
procedure Move_Cursor (Col : in TC_Call_From) is |
| 138 |
begin |
| 139 |
Send_Control_Sequence (First_Child, Col); |
| 140 |
end Move_Cursor; |
| 141 |
|
| 142 |
end CA13002_0.CA13002_1; |
| 143 |
|
| 144 |
--==================================================================-- |
| 145 |
|
| 146 |
-- Terminal_Driver.VT100.Cursor_Up. |
| 147 |
procedure CA13002_0.CA13002_1.CA13002_5 is |
| 148 |
begin |
| 149 |
Move_Cursor (First_Grandchild); -- from Terminal_Driver.VT100. |
| 150 |
end CA13002_0.CA13002_1.CA13002_5; |
| 151 |
|
| 152 |
--==================================================================-- |
| 153 |
|
| 154 |
-- Terminal_Driver.IBM3270. |
| 155 |
package body CA13002_0.CA13002_2 is |
| 156 |
|
| 157 |
procedure Move_Cursor (Col : in TC_Call_From) is |
| 158 |
begin |
| 159 |
Send_Control_Sequence (Second_Child, Col); |
| 160 |
end Move_Cursor; |
| 161 |
|
| 162 |
end CA13002_0.CA13002_2; |
| 163 |
|
| 164 |
--==================================================================-- |
| 165 |
|
| 166 |
-- Terminal_Driver.IBM3270.Cursor_Up. |
| 167 |
procedure CA13002_0.CA13002_2.CA13002_5 is |
| 168 |
begin |
| 169 |
Move_Cursor (Second_Grandchild); -- from Terminal_Driver.IBM3270. |
| 170 |
end CA13002_0.CA13002_2.CA13002_5; |
| 171 |
|
| 172 |
--==================================================================-- |
| 173 |
|
| 174 |
-- Terminal_Driver.DOS_ANSI. |
| 175 |
package body CA13002_0.CA13002_3 is |
| 176 |
|
| 177 |
procedure Move_Cursor (Col : in TC_Call_From) is |
| 178 |
begin |
| 179 |
Send_Control_Sequence (Third_Child, Col); |
| 180 |
end Move_Cursor; |
| 181 |
|
| 182 |
procedure CA13002_5 is separate; |
| 183 |
|
| 184 |
end CA13002_0.CA13002_3; |
| 185 |
|
| 186 |
--==================================================================-- |
| 187 |
|
| 188 |
-- Terminal_Driver.DOS_ANSI.Cursor_Up. |
| 189 |
separate (CA13002_0.CA13002_3) |
| 190 |
procedure CA13002_5 is |
| 191 |
begin |
| 192 |
Move_Cursor (First_Subunit); -- from Terminal_Driver.DOS_ANSI. |
| 193 |
end CA13002_5; |
| 194 |
|
| 195 |
--==================================================================-- |
| 196 |
|
| 197 |
-- Terminal_Driver.WYSE. |
| 198 |
package body CA13002_0.CA13002_4 is |
| 199 |
|
| 200 |
procedure Move_Cursor (Col : in TC_Call_From) is |
| 201 |
begin |
| 202 |
Send_Control_Sequence (Fourth_Child, Col); |
| 203 |
end Move_Cursor; |
| 204 |
|
| 205 |
procedure CA13002_5 is separate; |
| 206 |
|
| 207 |
end CA13002_0.CA13002_4; |
| 208 |
|
| 209 |
--==================================================================-- |
| 210 |
|
| 211 |
-- Terminal_Driver.WYSE.Cursor_Up. |
| 212 |
separate (CA13002_0.CA13002_4) |
| 213 |
procedure CA13002_5 is |
| 214 |
begin |
| 215 |
Move_Cursor (Second_Subunit); -- from Terminal_Driver.WYSE. |
| 216 |
end CA13002_5; |
| 217 |
|
| 218 |
--==================================================================-- |
| 219 |
|
| 220 |
with CA13002_0.CA13002_1.CA13002_5; -- Terminal_Driver.VT100.Cursor_Up, |
| 221 |
-- implicitly with parent, CA13002_0. |
| 222 |
with CA13002_0.CA13002_2.CA13002_5; -- Terminal_Driver.IBM3270.Cursor_Up. |
| 223 |
with CA13002_0.CA13002_3; -- Terminal_Driver.DOS_ANSI. |
| 224 |
with CA13002_0.CA13002_4; -- Terminal_Driver.WYSE. |
| 225 |
with Report; |
| 226 |
use CA13002_0; -- All primitive subprograms directly |
| 227 |
-- visible. |
| 228 |
|
| 229 |
procedure CA13002 is |
| 230 |
Expected_Calls : constant CA13002_0.TC_Calls_Arr |
| 231 |
:= ((true, false, false, false), |
| 232 |
(false, true , false, false), |
| 233 |
(false, false, true , false), |
| 234 |
(false, false, false, true )); |
| 235 |
begin |
| 236 |
Report.Test ("CA13002", "Check that two library units and/or subunits " & |
| 237 |
"may have the same simple names if they have distinct " & |
| 238 |
"expanded names"); |
| 239 |
|
| 240 |
-- Note that the leaves all have the same name. |
| 241 |
-- Call the first grandchild. |
| 242 |
CA13002_0.CA13002_1.CA13002_5; |
| 243 |
|
| 244 |
-- Call the second grandchild. |
| 245 |
CA13002_0.CA13002_2.CA13002_5; |
| 246 |
|
| 247 |
-- Call the first subunit. |
| 248 |
CA13002_0.CA13002_3.CA13002_5; |
| 249 |
|
| 250 |
-- Call the second subunit. |
| 251 |
CA13002_0.CA13002_4.CA13002_5; |
| 252 |
|
| 253 |
if TC_Calls /= Expected_Calls then |
| 254 |
Report.Failed ("Wrong result"); |
| 255 |
end if; |
| 256 |
|
| 257 |
Report.Result; |
| 258 |
|
| 259 |
end CA13002; |