Daily bump.
[official-gcc.git] / gcc / ada / g-diopit.ads
blob051c2814a547d831bf14e26fc8d2f349a1677d6d
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- G N A T . D I R E C T O R Y _ O P E R A T I O N S . I T E R A T I O N --
6 -- --
7 -- S p e c --
8 -- --
9 -- $Revision$
10 -- --
11 -- Copyright (C) 2001 Ada Core Technologies, Inc. --
12 -- --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
23 -- --
24 -- As a special exception, if other files instantiate generics from this --
25 -- unit, or you link this unit with other files to produce an executable, --
26 -- this unit does not by itself cause the resulting executable to be --
27 -- covered by the GNU General Public License. This exception does not --
28 -- however invalidate any other reasons why the executable file might be --
29 -- covered by the GNU Public License. --
30 -- --
31 -- GNAT is maintained by Ada Core Technologies Inc (http://www.gnat.com). --
32 -- --
33 ------------------------------------------------------------------------------
35 -- Iterators among files
37 package GNAT.Directory_Operations.Iteration is
39 generic
40 with procedure Action
41 (Item : String;
42 Index : Positive;
43 Quit : in out Boolean);
44 procedure Find
45 (Root_Directory : Dir_Name_Str;
46 File_Pattern : String);
47 -- Recursively searches the directory structure rooted at Root_Directory.
48 -- This provides functionality similar to the UNIX 'find' command.
49 -- Action will be called for every item matching the regular expression
50 -- File_Pattern (see GNAT.Regexp). Item is the full pathname to the file
51 -- starting with Root_Directory that has been matched. Index is set to one
52 -- for the first call and is incremented by one at each call. The iterator
53 -- will pass in the value False on each call to Action. The iterator will
54 -- terminate after passing the last matched path to Action or after
55 -- returning from a call to Action which sets Quit to True.
56 -- Raises GNAT.Regexp.Error_In_Regexp if File_Pattern is ill formed.
58 generic
59 with procedure Action
60 (Item : String;
61 Index : Positive;
62 Quit : in out Boolean);
63 procedure Wildcard_Iterator (Path : Path_Name);
64 -- Calls Action for each path matching Path. Path can include wildcards '*'
65 -- and '?' and [...]. The rules are:
67 -- * can be replaced by any sequence of characters
68 -- ? can be replaced by a single character
69 -- [a-z] match one character in the range 'a' through 'z'
70 -- [abc] match either character 'a', 'b' or 'c'
72 -- Item is the filename that has been matched. Index is set to one for the
73 -- first call and is incremented by one at each call. The iterator's
74 -- termination can be controlled by setting Quit to True. It is by default
75 -- set to False.
77 -- For example, if we have the following directory structure:
78 -- /boo/
79 -- foo.ads
80 -- /sed/
81 -- foo.ads
82 -- file/
83 -- foo.ads
84 -- /sid/
85 -- foo.ads
86 -- file/
87 -- foo.ads
88 -- /life/
90 -- A call with expression "/s*/file/*" will call Action for the following
91 -- items:
92 -- /sed/file/foo.ads
93 -- /sid/file/foo.ads
95 end GNAT.Directory_Operations.Iteration;