diff options
author | Vincent Celier <celier@adacore.com> | 2006-10-31 19:12:50 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2006-10-31 19:12:50 +0100 |
commit | 57d9e177cce10214c082971155459b7f0aefd953 (patch) | |
tree | a6ad98da233fca89e8715d0e80a09a71de2e509e /gcc | |
parent | 271ae089f369707a933bde440cf10290979a517f (diff) | |
download | gcc-57d9e177cce10214c082971155459b7f0aefd953.zip gcc-57d9e177cce10214c082971155459b7f0aefd953.tar.gz gcc-57d9e177cce10214c082971155459b7f0aefd953.tar.bz2 |
a-direct.ads, [...] (Search): New procedure in Ada 2005
2006-10-31 Vincent Celier <celier@adacore.com>
* a-direct.ads, a-direct.adb (Search): New procedure in Ada 2005
From-SVN: r118322
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/a-direct.adb | 26 | ||||
-rw-r--r-- | gcc/ada/a-direct.ads | 20 |
2 files changed, 44 insertions, 2 deletions
diff --git a/gcc/ada/a-direct.adb b/gcc/ada/a-direct.adb index 2cd29ed..694ad8c 100644 --- a/gcc/ada/a-direct.adb +++ b/gcc/ada/a-direct.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -835,6 +835,30 @@ package body Ada.Directories is end if; end Rename; + ------------ + -- Search -- + ------------ + + procedure Search + (Directory : String; + Pattern : String; + Filter : Filter_Type := (others => True); + Process : not null access procedure + (Directory_Entry : Directory_Entry_Type)) + is + Srch : Search_Type; + Directory_Entry : Directory_Entry_Type; + begin + Start_Search (Srch, Directory, Pattern, Filter); + + while More_Entries (Srch) loop + Get_Next_Entry (Srch, Directory_Entry); + Process (Directory_Entry); + end loop; + + End_Search (Srch); + end Search; + ------------------- -- Set_Directory -- ------------------- diff --git a/gcc/ada/a-direct.ads b/gcc/ada/a-direct.ads index 3e2a2b2..aee3fb4 100644 --- a/gcc/ada/a-direct.ads +++ b/gcc/ada/a-direct.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2004-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2006, Free Software Foundation, Inc. -- -- -- -- This specification is derived for use with GNAT from AI-00248, which is -- -- expected to be a part of a future expected revised Ada Reference Manual. -- @@ -340,6 +340,24 @@ package Ada.Directories is -- environment does not support continued searching of the directory -- represented by Search. + procedure Search + (Directory : String; + Pattern : String; + Filter : Filter_Type := (others => True); + Process : not null access procedure + (Directory_Entry : Directory_Entry_Type)); + -- Searches in the directory named by Directory for entries matching + -- Pattern. The subprogram designated by Process is called with each + -- matching entry in turn. Pattern represents a pattern for matching file + -- names. If Pattern is null, all items in the directory are matched; + -- otherwise, the interpretation of Pattern is implementation-defined. + -- Only items that match Filter will be returned. The exception Name_Error + -- is propagated if the string given by Directory does not identify + -- an existing directory, or if Pattern does not allow the identification + -- of any possible external file or directory. The exception Use_Error is + -- propagated if the external environment does not support the searching + -- of the directory with the given name (in the absence of Name_Error). + ------------------------------------- -- Operations on Directory Entries -- ------------------------------------- |