home *** CD-ROM | disk | FTP | other *** search
- -- Chapter 15 - Programming example 3
-
- -- Interface of NewAdderPkg
- package NewAdderPkg is
- type MY_ARRAY is array(INTEGER range <>) of FLOAT;
- procedure Add_Em_Up(In_Dat : in MY_ARRAY;
- Sum : out FLOAT);
- end NewAdderPkg;
-
-
- -- Implementation of NewAdderPkg
- package body NewAdderPkg is
- procedure Add_Em_Up(In_Dat : in MY_ARRAY;
- Sum : out FLOAT) is
- Total : FLOAT;
- begin
- Total := 0.0;
- for Index in In_Dat'FIRST..In_Dat'LAST loop
- Total := Total + In_Dat(Index);
- end loop;
- Sum := Total;
- end Add_Em_Up;
- end NewAdderPkg;
-
-
-
-
- -- Result of execution
-
- -- (This is not a stand alone package, so it has no output.)
-
-