OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [ada/] [acats/] [support/] [fb20a00.a] - Blame information for rev 720

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 720 jeremybenn
-- FB20A00.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
-- FOUNDATION DESCRIPTION:
27
--      This test performs a search for the first instance of a specified
28
--      substring within a specified string, returning boolean result.
29
--      (Case insensitive analysis)  Both the string and the substring are
30
--      made upper case.  Successive slices are taken from the input string
31
--      and compared with the substring. If a match is found, the search is
32
--      terminated immediately. The search continues until the last index
33
--      position from which a substring-length slice can be constructed is
34
--      passed.
35
--
36
-- CHANGE HISTORY:
37
--      06 Dec 94   SAIC    ACVC 2.0
38
--
39
--!
40
 
41
package FB20A00 is
42
 
43
   function Find ( Str : in String ;
44
                   Sub : in String ) return Boolean;
45
 
46
end FB20A00;
47
 
48
     --=================================================================--
49
 
50
package body FB20A00 is
51
 
52
   function Find ( Str : in String ;
53
                   Sub : in String ) return Boolean is
54
 
55
      New_Str : String (Str'First .. Str'Last);
56
      New_Sub : String (Sub'First .. Sub'Last);
57
 
58
      Pos : Integer := Str'First ;             -- Character index.
59
 
60
 
61
      function Upper_Case (Str : in String) return String is
62
         subtype Upper is Character range 'A' .. 'Z' ;
63
         subtype Lower is Character range 'a' .. 'z' ;
64
         Ret : String (Str'First .. Str'Last) ;
65
         Pos : Integer;
66
      begin
67
         for I in Str'Range loop
68
            if ( Str (I) in Lower ) then
69
               Pos := Upper'Pos (Upper'First) +
70
                      ( Lower'Pos (Str(I)) - Lower'Pos(Lower'First) ) ;
71
               Ret (I) := Upper'Val (Pos) ;
72
            else
73
               Ret (I) := Str (I);
74
            end if ;
75
         end loop ;
76
         return (Ret) ;
77
      end Upper_Case;
78
 
79
   begin
80
 
81
 
82
      New_Str := Upper_Case (Str);             -- Convert Str and Sub to upper
83
      New_Sub := Upper_Case (Sub);             -- case for comparison.
84
 
85
      while ( Pos <= New_Str'Last-New_Sub'Length+1 )  -- Search until no more
86
        and then                                      -- sub-string-length
87
        ( New_Str ( Pos .. Pos+New_Sub'Length-1 ) /= New_Sub ) -- slices
88
                                                               -- remain.
89
      loop
90
         Pos := Pos + 1 ;
91
      end loop ;
92
 
93
      if ( Pos > New_Str'Last-New_Sub'Length+1 ) then  -- Substring not found.
94
         return (False);
95
      else
96
         return (True);
97
      end if ;
98
 
99
   end Find;
100
 
101
end FB20A00;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.