cxaa017.a

来自「linux下编程用 编译软件」· A 代码 · 共 401 行 · 第 1/2 页

A
401
字号
-- CXAA017.A----                             Grant of Unlimited Rights----     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----     ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR--     DISCLOSED ARE AS IS.  THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED --     WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE--     SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE --     OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A--     PARTICULAR PURPOSE OF SAID MATERIAL.--*---- OBJECTIVE:--      Check that Ada.Text_IO function Look_Ahead sets parameter End_Of_Line--      to True if at the end of a line; otherwise check that it returns the--      next character from a file (without consuming it), while setting --      End_Of_Line to False.  --      --      Check that Ada.Text_IO function Get_Immediate will return the next--      control or graphic character in parameter Item from the specified --      file.  Check that the version of Ada.Text_IO function Get_Immediate --      with the Available parameter will, if a character is available in the--      specified file, return the character in parameter Item, and set --      parameter Available to True.--      -- TEST DESCRIPTION:--      This test exercises specific capabilities of two Text_IO subprograms, --      Look_Ahead and Get_Immediate.  A file is prepared that contains a --      variety of graphic and control characters on several lines.--      In processing this file, a call to Look_Ahead is performed to ensure--      that characters are available, then individual characters are --      extracted from the current line using Get_Immediate.  The characters--      returned from both subprogram calls are compared with the expected--      character result.  Processing on each file line continues until--      Look_Ahead indicates that the end of the line is next.  Separate--      verification is performed to ensure that all characters of each line--      are processed, and that the Available and End_Of_Line parameters--      of the subprograms are properly set in the appropriate instances.--      -- APPLICABILITY CRITERIA: --      This test is applicable to implementations capable of supporting--      external Text_IO files.----       -- CHANGE HISTORY:--      30 May 95   SAIC    Initial prerelease version.--      01 May 96   SAIC    Incorporated reviewer comments for ACVC 2.1.--      26 Feb 97   PWB.CTA Allowed for non-support of some IO operations.--!with Ada.Text_IO;package CXAA017_0 is   User_Defined_Input_File : aliased Ada.Text_IO.File_Type;end CXAA017_0;with CXAA017_0; use CXAA017_0;with Ada.Characters.Latin_1;with Ada.Exceptions;with Ada.Text_IO;  with Report;procedure CXAA017 is      use Ada.Characters.Latin_1;   use Ada.Exceptions;   use Ada.Text_IO;   Non_Applicable_System : exception;   No_Reset            : exception;begin   Report.Test ("CXAA017", "Check that Ada.Text_IO subprograms "         &                           "Look_Ahead and Get_Immediate are available " &                           "and produce correct results");   Test_Block:   declare      User_Input_Ptr    : File_Access := User_Defined_Input_File'Access;      UDLA_Char,          -- Acronym UDLA => "User Defined Look Ahead"      UDGI_Char,          -- Acronym UDGI => "User Defined Get Immediate"      TC_Char           : Character := Ada.Characters.Latin_1.NUL;      UDLA_End_Of_Line,      UDGI_Available    : Boolean   := False;      Char_Pos          : Natural;      -- This string contains five ISO 646 Control characters and six ISO 646       -- Graphic characters:      TC_String_1  : constant String := STX       &                                         SI        &                                         DC2       &                                         CAN       &                                         US        &                                         Space     &                                         Ampersand &                                         Solidus   &                                         'A'       &                                         LC_X      &                                         DEL;       -- This string contains two ISO 6429 Control and six ISO 6429 Graphic      -- characters:      TC_String_2  : constant String := IS4                         &                                         SCI                         &                                         Yen_Sign                    &                                         Masculine_Ordinal_Indicator &                                         UC_I_Grave                  &                                         Multiplication_Sign         &                                         LC_C_Cedilla                &                                         LC_Icelandic_Thorn;      TC_Number_Of_Strings : constant := 2;      type String_Access_Type    is access constant String;      type String_Ptr_Array_Type is         array (1..TC_Number_Of_Strings) of String_Access_Type;      TC_String_Ptr_Array : String_Ptr_Array_Type :=                               (new String'(TC_String_1),                               new String'(TC_String_2));      procedure Create_New_File (The_File : in out File_Type;                                 Mode     : in     File_Mode;                                 Next     : in     Integer) is      begin         Create (The_File, Mode, Report.Legal_File_Name(Next));      exception         -- The following two exceptions can be raised if a system is not         -- capable of supporting external Text_IO files.  The handler will         -- raise a user-defined exception which will result in a          -- Not_Applicable result for the test.         when Use_Error | Name_Error => raise Non_Applicable_System;      end Create_New_File;      procedure Load_File (The_File : in out File_Type) is      -- This procedure will load several strings into the file denoted      -- by the input parameter.  A call to New_Line will add line/page      -- termination characters, which will be available  for processing      -- along with the text in the file.      begin         Put_Line (The_File, TC_String_Ptr_Array(1).all);         New_Line (The_File, Spacing => 1);         Put_Line (The_File, TC_String_Ptr_Array(2).all);      end Load_File;   begin      -- Create user-defined text file that will serve as the appropriate      -- sources of input to the procedures under test.      Create_New_File (User_Defined_Input_File, Out_File, 1);      -- Enter several lines of text into the new input file.       -- The characters that make up these text strings will be processed       -- using the procedures being exercised in this test.      Load_File (User_Defined_Input_File);      -- Check that Mode_Error is raised by Look_Ahead and Get_Immedidate       -- if the mode of the file object is not In_File.      -- Currently, the file mode is Out_File.      begin         Look_Ahead(User_Defined_Input_File, UDLA_Char, UDLA_End_Of_Line);         Report.Failed("Mode_Error not raised by Look_Ahead");         Report.Comment("This char should never be printed: " & UDLA_Char);       exception         when Mode_Error => null;  -- OK, expected exception.         when The_Error : others =>             Report.Failed ("The following exception was raised during the " &                           "check that Look_Ahead raised Mode_Error when "  &                           "provided a file object that is not in In_File " &                           "mode: " & Exception_Name(The_Error));      end;      begin

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?