CVS difference for acats/cxb/cxb3008.a
--- acats/cxb/cxb3008.a 1998/09/26 01:07:20 1.1
+++ acats/cxb/cxb3008.a 1998/09/27 03:12:43 1.2
@@ -2,15 +2,16 @@
--
-- Grant of Unlimited Rights
--
--- 00-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687 and
--- e U.S. Government obtained unlimited rights in the
--- tation contained herein. Unlimited rights are
--- 227-7013(a)(19). By making this public release,
--- ds to confer upon all recipients unlimited rights
--- by the Government. These rights include rights to
--- ase or disclose the released technical data and
--- whole or in part, in any manner and for any purpose
--- ave or permit others to do so.
+-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
+-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
+-- unlimited rights in the software and documentation contained herein.
+-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
+-- this public release, the Government intends to confer upon all
+-- recipients unlimited rights equal to those held by the Government.
+-- These rights include rights to use, duplicate, release or disclose the
+-- released technical data and computer software in whole or in part, in
+-- any manner and for any purpose whatsoever, and to have or permit others
+-- to do so.
--
-- DISCLAIMER
--
@@ -37,7 +38,7 @@
-- is discarded; parameter modification is the desired effect.
-- 2) A C function that returns an int value (strlen) is used as the
-- completion of an Ada function specification.
--- t returns a double value (atof) is used as the
+-- 3) A C function that returns a double value (strtod) is used as the
-- completion of an Ada function specification.
--
-- This test assumes that the following characters are all included
@@ -58,13 +59,17 @@
-- CHANGE HISTORY:
-- 12 Oct 95 SAIC Initial prerelease version.
-- 09 May 96 SAIC Incorporated reviewer comments for ACVC 2.1.
---
+-- 01 DEC 97 EDS Replaced all references of C function atof with
+-- C function strtod.
+-- 29 JUN 98 EDS Give Ada function corresponding to strtod a
+-- second parameter.
--!
with Report;
with Ada.Exceptions;
with Interfaces.C; -- N/A => ERROR
with Interfaces.C.Strings; -- N/A => ERROR
+with Interfaces.C.Pointers;
procedure CXB3008 is
begin
@@ -78,6 +83,11 @@
package IC renames Interfaces.C;
package ICS renames Interfaces.C.Strings;
+ package ICP is new Interfaces.C.Pointers
+ ( Index => IC.size_t,
+ Element => IC.char,
+ Element_Array => IC.char_array,
+ Default_Terminator => IC.nul );
use Ada.Exceptions;
use type IC.char;
@@ -104,7 +114,9 @@
-- name. The_String must contain a valid floating-point number; if
-- not, the value returned is zero.
- function String_To_Double (The_String : in IC.char_array)
+-- type Acc_ptr is access IC.char_array;
+ function String_To_Double (The_String : in IC.char_array ;
+ End_Ptr : ICP.Pointer := null)
return IC.double;
@@ -119,10 +131,10 @@
pragma Import (C, String_Length, "strlen");
- -- Use the <stdlib.h> atof function as a completion to the
+ -- Use the <stdlib.h> strtod function as a completion to the
-- String_To_Double function specification.
- pragma Import (C, String_To_Double, "atof");
+ pragma Import (C, String_To_Double, "strtod");
TC_String : constant String := "Just a Test";
@@ -192,14 +204,14 @@
if Double_Result + String_To_Double(Char_Source) /= 5150.00 then
Report.Failed("Incorrect result returned from the imported " &
- "version of function atof - 1");
+ "version of function strtod - 1");
end if;
Char_Source(0..9) := "xxx$10.00x"; -- String doesn't contain a
-- valid floating point value.
if String_To_Double(Char_Source) /= 0.0 then
Report.Failed("Incorrect result returned from the imported " &
- "version of function atof - 2");
+ "version of function strtod - 2");
end if;
Questions? Ask the ACAA Technical Agent