Debian Codegraph @

source_2005/pre_dirs.mss

raw
1 @comment{ $Source: e:\\cvsroot/ARM/Source/pre_dirs.mss,v $ }
2 @comment{ $Revision: 1.28 $ $Date: 2006/10/19 06:40:30 $ $Author: Randy $ }
3 @Part(predefdirs, Root="ada.mss")
4
5 @Comment{$Date: 2006/10/19 06:40:30 $}
6
7 @RMNewPage@Comment{For printed RM Ada 2007}
8 @LabeledAddedClause{Version=[2],Name=[The Package Directories]}
9
10 @begin{Intro}
11 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]}
12 @ChgAdded{Version=[2],Text=[The package Directories provides operations
13 for manipulating files and directories, and their names.]}
14 @begin{Discussion}
15 @ChgRef{Version=[2],Kind=[AddedNormal]}
16 @ChgAdded{Version=[2],Text=[The notes for this clause contain the expected
17 interpretations of some of the operations on various target systems.
18 @lquotes@;Unix@rquotes@; refers to the UNIX@latin1(174) operating system,
19 and in most cases also covers Unix-like systems such as Linux and POSIX.
20 @lquotes@;Windows@latin1(174)@rquotes@; refers to the Microsoft@latin1(174)
21 Windows@latin1(174) 2000 operating system and usually also covers most
22 other versions that use the Win32 API.]}
23 @end{Discussion}
24 @end{Intro}
25
26 @begin{StaticSem}
27 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]}
28 @ChgAdded{Version=[2],KeepNext=[T],Type=[Leading],Text=[The library package
29 Directories has the following declaration:]}
30 @begin{Example}
31 @ChgRef{Version=[2],Kind=[AddedNormal]}
32 @ChgAdded{Version=[2],Text=[@key{with} Ada.IO_Exceptions;
33 @key{with} Ada.Calendar;
34 @key{package} Ada.Directories @key{is}@ChildUnit{Parent=[Ada],Child=[Directories]}]}
35
36 @ChgRef{Version=[2],Kind=[AddedNormal]}
37 @ChgAdded{Version=[2],Text=[ -- @RI[Directory and file operations:]]}
38
39 @ChgRef{Version=[2],Kind=[AddedNormal]}
40 @ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Current_Directory} @key{return} String;]}
41
42 @ChgRef{Version=[2],Kind=[AddedNormal]}
43 @ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Set_Directory} (Directory : in String);]}
44
45 @ChgRef{Version=[2],Kind=[AddedNormal]}
46 @ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Create_Directory} (New_Directory : @key{in} String;
47 Form : @key{in} String := "");]}
48
49 @ChgRef{Version=[2],Kind=[AddedNormal]}
50 @ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Delete_Directory} (Directory : @key{in} String);]}
51
52 @ChgRef{Version=[2],Kind=[AddedNormal]}
53 @ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Create_Path} (New_Directory : @key{in} String;
54 Form : @key{in} String := "");]}
55
56 @ChgRef{Version=[2],Kind=[AddedNormal]}
57 @ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Delete_Tree} (Directory : @key{in} String);]}
58
59 @ChgRef{Version=[2],Kind=[AddedNormal]}
60 @ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Delete_File} (Name : @key{in} String);]}
61
62 @ChgRef{Version=[2],Kind=[AddedNormal]}
63 @ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Rename} (Old_Name, New_Name : @key{in} String);]}
64
65 @ChgRef{Version=[2],Kind=[AddedNormal]}
66 @ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Copy_File} (Source_Name,
67 Target_Name : @key{in} String;
68 Form : @key{in} String := "");]}
69
70 @ChgRef{Version=[2],Kind=[AddedNormal]}
71 @ChgAdded{Version=[2],Text=[ -- @RI[File and directory name operations:]]}
72
73 @ChgRef{Version=[2],Kind=[AddedNormal]}
74 @ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Full_Name} (Name : @key{in} String) @key{return} String;]}
75
76 @ChgRef{Version=[2],Kind=[AddedNormal]}
77 @ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Simple_Name} (Name : @key{in} String) @key{return} String;]}
78
79 @ChgRef{Version=[2],Kind=[AddedNormal]}
80 @ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Containing_Directory} (Name : @key{in} String) @key{return} String;]}
81
82 @ChgRef{Version=[2],Kind=[AddedNormal]}
83 @ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Extension} (Name : @key{in} String) @key{return} String;]}
84
85 @ChgRef{Version=[2],Kind=[AddedNormal]}
86 @ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Base_Name} (Name : @key{in} String) @key{return} String;]}
87
88 @ChgRef{Version=[2],Kind=[AddedNormal]}
89 @ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Compose} (Containing_Directory : @key{in} String := "";
90 Name : @key{in} String;
91 Extension : @key{in} String := "") @key{return} String;]}
92
93 @ChgRef{Version=[2],Kind=[AddedNormal]}
94 @ChgAdded{Version=[2],Text=[ -- @RI{File and directory queries:}]}
95
96 @ChgRef{Version=[2],Kind=[AddedNormal]}
97 @ChgAdded{Version=[2],Text=[ @key{type} @AdaTypeDefn{File_Kind} @key{is} (Directory, Ordinary_File, Special_File);]}
98
99 @ChgRef{Version=[2],Kind=[AddedNormal]}
100 @ChgAdded{Version=[2],Text=[ @key{type} @AdaTypeDefn{File_Size} @key{is range} 0 .. @RI{implementation-defined};]}
101
102 @ChgRef{Version=[2],Kind=[AddedNormal]}
103 @ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Exists} (Name : @key{in} String) @key{return} Boolean;]}
104
105 @ChgRef{Version=[2],Kind=[AddedNormal]}
106 @ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Kind} (Name : @key{in} String) @key{return} File_Kind;]}
107
108 @ChgRef{Version=[2],Kind=[AddedNormal]}
109 @ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Size} (Name : @key{in} String) @key{return} File_Size;]}
110
111 @ChgRef{Version=[2],Kind=[AddedNormal]}
112 @ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Modification_Time} (Name : @key{in} String) @key{return} Ada.Calendar.Time;]}
113
114 @ChgRef{Version=[2],Kind=[AddedNormal]}
115 @ChgAdded{Version=[2],Text=[ -- @RI{Directory searching:}]}
116
117 @ChgRef{Version=[2],Kind=[AddedNormal]}
118 @ChgAdded{Version=[2],Text=[ @key{type} @AdaTypeDefn{Directory_Entry_Type} @key{is limited private};]}
119
120 @ChgRef{Version=[2],Kind=[AddedNormal]}
121 @ChgAdded{Version=[2],Text=[ @key{type} @AdaTypeDefn{Filter_Type} @key{is array} (File_Kind) @key{of} Boolean;]}
122
123 @ChgRef{Version=[2],Kind=[AddedNormal]}
124 @ChgAdded{Version=[2],Text=[ @key{type} @AdaTypeDefn{Search_Type} @key{is limited private};]}
125
126 @ChgRef{Version=[2],Kind=[AddedNormal]}
127 @ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Start_Search} (Search : @key{in out} Search_Type;
128 Directory : @key{in} String;
129 Pattern : @key{in} String;
130 Filter : @key{in} Filter_Type := (@key{others} => True));]}
131
132 @ChgRef{Version=[2],Kind=[AddedNormal]}
133 @ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{End_Search} (Search : @key{in out} Search_Type);]}
134
135 @ChgRef{Version=[2],Kind=[AddedNormal]}
136 @ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{More_Entries} (Search : @key{in} Search_Type) @key{return} Boolean;]}
137
138 @ChgRef{Version=[2],Kind=[AddedNormal]}
139 @ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Get_Next_Entry} (Search : @key{in out} Search_Type;
140 Directory_Entry : @key{out} Directory_Entry_Type);]}
141
142 @ChgRef{Version=[2],Kind=[AddedNormal]}
143 @ChgAdded{Version=[2],Text=[ @key{procedure} Search (
144 Directory : @key{in} String;
145 Pattern : @key{in} String;
146 Filter : @key{in} Filter_Type := (@key{others} => True);
147 Process : @key{not null access procedure} (
148 Directory_Entry : @key{in} Directory_Entry_Type));]}
149
150 @ChgRef{Version=[2],Kind=[AddedNormal]}
151 @ChgAdded{Version=[2],Text=[ -- @RI{Operations on Directory Entries:}]}
152
153 @ChgRef{Version=[2],Kind=[AddedNormal]}
154 @ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Simple_Name} (Directory_Entry : @key{in} Directory_Entry_Type)
155 @key{return} String;]}
156
157 @ChgRef{Version=[2],Kind=[AddedNormal]}
158 @ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Full_Name} (Directory_Entry : @key{in} Directory_Entry_Type)
159 @key{return} String;]}
160
161 @ChgRef{Version=[2],Kind=[AddedNormal]}
162 @ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Kind} (Directory_Entry : @key{in} Directory_Entry_Type)
163 @key{return} File_Kind;]}
164
165 @ChgRef{Version=[2],Kind=[AddedNormal]}
166 @ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Size} (Directory_Entry : @key{in} Directory_Entry_Type)
167 @key{return} File_Size;]}
168
169 @ChgRef{Version=[2],Kind=[AddedNormal]}
170 @ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Modification_Time} (Directory_Entry : @key{in} Directory_Entry_Type)
171 @key{return} Ada.Calendar.Time;]}
172
173 @ChgRef{Version=[2],Kind=[AddedNormal]}
174 @ChgAdded{Version=[2],Text=[ @AdaExcDefn{Status_Error} : @key{exception renames} Ada.IO_Exceptions.Status_Error;
175 @AdaExcDefn{Name_Error} : @key{exception renames} Ada.IO_Exceptions.Name_Error;
176 @AdaExcDefn{Use_Error} : @key{exception renames} Ada.IO_Exceptions.Use_Error;
177 @AdaExcDefn{Device_Error} : @key{exception renames} Ada.IO_Exceptions.Device_Error;]}
178
179 @ChgRef{Version=[2],Kind=[AddedNormal]}
180 @ChgAdded{Version=[2],Text=[@key{private}
181 -- @RI{Not specified by the language.}
182 @key{end} Ada.Directories;]}
183
184 @end{Example}
185
186 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]}
187 @ChgAdded{Version=[2],Text=[External files may be classified as directories,
188 special files, or ordinary
189 files. A @i<directory> is an external file that is a container for files on
190 the target system. A @i<special file> is an external file that cannot be
191 created or read by a predefined Ada input-output package. External files that
192 are not special files or directories are called @i<ordinary files>.
193 @Defn{directory}
194 @Defn{special file}
195 @Defn{ordinary file}]}
196 @begin{Ramification}
197 @ChgRef{Version=[2],Kind=[AddedNormal]}
198 @ChgAdded{Version=[2],Text=[A directory is an external file, although it may
199 not have a name on some targets. A directory is not a special file, as it
200 can be created and read by Directories.]}
201 @end{Ramification}
202 @begin{Discussion}
203 @ChgRef{Version=[2],Kind=[AddedNormal]}
204 @ChgAdded{Version=[2],Text=[Devices and soft links are examples of
205 special files on Windows@latin1(174) and Unix.]}
206
207 @ChgRef{Version=[2],Kind=[AddedNormal]}
208 @ChgAdded{Version=[2],Text=[Even if an implementation provides a package
209 to create and read soft links, such links are still special files.]}
210 @end{Discussion}
211
212 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]}
213 @ChgAdded{Version=[2],Text=[A @i<file name> is a string identifying an external
214 file. Similarly, a
215 @i<directory name> is a string identifying a directory. The interpretation of
216 file names and directory names is implementation-defined.
217 @Defn{directory name}
218 @Defn{file name}]}
219 @ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@Chg{Version=[2],New=[The
220 interpretation of file names and directory names.],Old=[]}]}
221
222 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]}
223 @ChgAdded{Version=[2],Text=[The @i<full name> of an external file is a
224 full specification of the name of
225 the file. If the external environment allows alternative specifications of the
226 name (for example, abbreviations), the full name should not use such
227 alternatives. A full name typically will include the names of all of the
228 directories that contain the item. The @i<simple name> of an external file is
229 the name of the item, not including any containing directory names. Unless
230 otherwise specified, a file name or directory name parameter in a call to
231 a predefined Ada input-output subprogram can be a full name, a simple name,
232 or any other form of name supported by the implementation.
233 @Defn2{Term=[full name],Sec=[of a file]}
234 @Defn2{Term=[simple name],Sec=[of a file]}]}
235 @begin{Discussion}
236 @ChgRef{Version=[2],Kind=[AddedNormal]}
237 @ChgAdded{Version=[2],Text=[The full name on Unix is a complete path to the
238 root. For Windows@latin1(174), the full name includes a complete path, as well as a disk
239 name ("C:") or network share name. For both systems, the simple name is
240 the part of the name following the last '/' (or '\' for Windows@latin1(174)). For
241 example, in the name "/usr/randy/ada-directories.ads",
242 "ada-directories.ads" is the simple name.]}
243 @end{Discussion}
244 @begin{Ramification}
245 @ChgRef{Version=[2],Kind=[AddedNormal]}
246 @ChgAdded{Version=[2],Text=[It is possible for a file or directory name to be
247 neither a full name nor a simple name. For instance, the Unix name
248 "../parent/myfile" is neither a full name nor a simple name.]}
249 @end{Ramification}
250
251 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]}
252 @ChgAdded{Version=[2],Text=[The @i<default directory> is the directory that is
253 used if a directory or
254 file name is not a full name (that is, when the name does not fully identify
255 all of the containing directories).
256 @Defn{default directory}]}
257
258 @begin{Discussion}
259 @ChgRef{Version=[2],Kind=[AddedNormal]}
260 @ChgAdded{Version=[2],Text=[The default directory is the one maintained by
261 the familiar @lquotes@;cd@rquotes@; command on Unix and Windows@latin1(174). Note that
262 Windows@latin1(174) maintains
263 separate default directories for each disk drive; implementations should
264 use the natural implementation.]}
265 @end{Discussion}
266
267 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]}
268 @ChgAdded{Version=[2],Text=[A @i<directory entry> is a single item in a
269 directory, identifying a single
270 external file (including directories and special files).
271 @Defn{directory entry}]}
272
273 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]}
274 @ChgAdded{Version=[2],Text=[For each function that returns a string, the
275 lower bound of the returned value is 1.]}
276
277 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]}
278 @ChgAdded{Version=[2],Type=[Leading],
279 Text=[The following file and directory operations are provided:]}
280
281 @begin{DescribeCode}
282
283 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
284 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Current_Directory @key{return} String;]}
285 @end{Example}
286 @ChgRef{Version=[2],Kind=[AddedNormal]}
287 @ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the full directory name
288 for the current default directory.
289 The name returned shall be suitable for a future call to Set_Directory.
290 The exception Use_Error is propagated if a default directory is not
291 supported by the external environment.]}
292
293 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
294 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Set_Directory (Directory : @key{in} String);]}
295 @end{Example}
296 @ChgRef{Version=[2],Kind=[AddedNormal]}
297 @ChgAdded{Version=[2],Type=[Trailing],Text=[Sets the current default directory.
298 The exception Name_Error is
299 propagated if the string given as Directory does not identify an existing
300 directory. The exception Use_Error is propagated if the external environment
301 does not support making Directory (in the absence of Name_Error) a default
302 directory.]}
303
304 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
305 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Create_Directory (New_Directory : @key{in} String;
306 Form : @key{in} String := "");]}
307 @end{Example}
308 @ChgRef{Version=[2],Kind=[AddedNormal]}
309 @ChgAdded{Version=[2],Type=[Trailing],Text=[Creates a directory with name
310 New_Directory. The Form parameter can be
311 used to give system-dependent characteristics of the directory; the
312 interpretation of the Form parameter is implementation-defined. A null string
313 for Form specifies the use of the default options of the implementation of the
314 new directory. The exception Name_Error is propagated if the string given as
315 New_Directory does not allow the identification of a directory. The exception
316 Use_Error is propagated if the external environment does not support the
317 creation of a directory with the given name (in the absence of Name_Error) and
318 form.]}
319
320 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
321 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Delete_Directory (Directory : @key{in} String);]}
322 @end{Example}
323 @ChgRef{Version=[2],Kind=[AddedNormal]}
324 @ChgAdded{Version=[2],Type=[Trailing],Text=[Deletes an existing empty directory
325 with name Directory. The exception
326 Name_Error is propagated if the string given as Directory does not identify an
327 existing directory. The exception Use_Error is propagated if the external
328 environment does not support the deletion of the directory (or some portion of
329 its contents) with the given name (in the absence of Name_Error).]}
330
331 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
332 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Create_Path (New_Directory : @key{in} String;
333 Form : @key{in} String := "");]}
334 @end{Example}
335 @ChgRef{Version=[2],Kind=[AddedNormal]}
336 @ChgAdded{Version=[2],Type=[Trailing],Text=[Creates zero or more directories with
337 name New_Directory. Each
338 non-existent directory named by New_Directory is created.@Redundant[ For example, on a
339 typical Unix system, Create_Path ("/usr/me/my"); would create directory "me" in
340 directory "usr", then create directory "my" in directory "me".] The Form parameter
341 can be used to give system-dependent characteristics of the directory; the
342 interpretation of the Form parameter is implementation-defined. A null string
343 for Form specifies the use of the default options of the implementation of the
344 new directory. The exception Name_Error is propagated if the string given as
345 New_Directory does not allow the identification of any directory. The exception
346 Use_Error is propagated if the external environment does not support the
347 creation of any directories with the given name (in the absence of Name_Error)
348 and form.]}
349
350 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
351 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Delete_Tree (Directory : @key{in} String);]}
352 @end{Example}
353 @ChgRef{Version=[2],Kind=[AddedNormal]}
354 @ChgAdded{Version=[2],Type=[Trailing],Text=[Deletes an existing directory with
355 name Directory. The directory and
356 all of its contents (possibly including other directories) are deleted. The
357 exception Name_Error is propagated if the string given as Directory does not
358 identify an existing directory. The exception Use_Error is propagated if the
359 external environment does not support the deletion of the directory or some
360 portion of its contents with the given name (in the absence of Name_Error). If
361 Use_Error is propagated, it is unspecified whether a portion of the contents of
362 the directory is deleted.]}
363
364 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
365 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Delete_File (Name : @key{in} String);]}
366 @end{Example}
367 @ChgRef{Version=[2],Kind=[AddedNormal]}
368 @ChgAdded{Version=[2],Type=[Trailing],Text=[Deletes an existing ordinary or
369 special file with name Name. The exception
370 Name_Error is propagated if the string given as Name does not identify an
371 existing ordinary or special external file. The exception Use_Error is
372 propagated if the external environment does not support the deletion of the
373 file with the given name (in the absence of Name_Error).]}
374
375 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
376 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Rename (Old_Name, New_Name : @key{in} String);]}
377 @end{Example}
378 @ChgRef{Version=[2],Kind=[AddedNormal]}
379 @ChgAdded{Version=[2],Type=[Trailing],Text=[Renames an existing external file
380 (including directories) with name Old_Name
381 to New_Name. The exception Name_Error is propagated if the string given as
382 Old_Name does not identify an existing external file. The exception Use_Error
383 is propagated if the external environment does not support the renaming of the
384 file with the given name (in the absence of Name_Error). In particular,
385 Use_Error is propagated if a file or directory already exists with name
386 New_Name.]}
387
388 @begin{ImplNote}
389 @ChgRef{Version=[2],Kind=[AddedNormal]}
390 @ChgAdded{Version=[2],Text=[This operation is expected to work within a
391 a single directory, and implementers are encouraged to support it across
392 directories on a single device. Copying files from one device to another
393 is discouraged (that's what Copy_File is for). However, there is no
394 requirement to detect file copying by the target system. If the target
395 system has an API that gives that for @lquotes@;free@rquotes, it can be
396 used. For Windows@latin1(174), for instance, MoveFile can be used to
397 implement Rename.]}
398 @end{ImplNote}
399
400 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
401 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Copy_File (Source_Name,
402 Target_Name : @key{in} String;
403 Form : @key{in} String);]}
404 @end{Example}
405 @ChgRef{Version=[2],Kind=[AddedNormal]}
406 @ChgAdded{Version=[2],Type=[Trailing],Text=[Copies the contents of the existing
407 external file with name Source_Name to an external file with name Target_Name.
408 The resulting external file is a duplicate of the source external file. The
409 Form parameter can be used to give system-dependent characteristics of the
410 resulting external file; the interpretation of the Form parameter is
411 implementation-defined. Exception Name_Error is propagated if the string given
412 as Source_Name does not identify an existing external ordinary or special file,
413 or if the string given as Target_Name does not allow the identification of an
414 external file. The exception Use_Error is propagated if the external
415 environment does not support creating the file with the name given by
416 Target_Name and form given by Form, or copying of the file with the name given
417 by Source_Name (in the absence of Name_Error).]}
418 @begin{Ramification}
419 @ChgRef{Version=[2],Kind=[AddedNormal]}
420 @ChgAdded{Version=[2],Text=[Name_Error is always raised if Source_Name
421 identifies a directory. It is up to the implementation whether
422 special files can be copied, or if Use_Error will be raised.]}
423 @end{Ramification}
424
425 @end{DescribeCode}
426
427 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]}
428 @ChgAdded{Version=[2],Type=[Leading],Text=[The following file and directory
429 name operations are provided:]}
430
431 @begin{DescribeCode}
432
433 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
434 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Full_Name (Name : @key{in} String) @key{return} String;]}
435 @end{Example}
436 @ChgRef{Version=[2],Kind=[AddedNormal]}
437 @ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the full name corresponding
438 to the file name specified by
439 Name. The exception Name_Error is propagated if the string given as Name does
440 not allow the identification of an external file (including directories and
441 special files).]}
442 @begin{Discussion}
443 @ChgRef{Version=[2],Kind=[AddedNormal]}
444 @ChgAdded{Version=[2],Text=[Full name means that no abbreviations are
445 used in the returned name, and that it is a full specification of the name.
446 Thus, for Unix and Windows@latin1(174), the result should be a full path that does not
447 contain any "." or ".." directories. Typically, the default directory
448 is used to fill in any missing information.]}
449 @end{Discussion}
450
451 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
452 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Simple_Name (Name : @key{in} String) @key{return} String;]}
453 @end{Example}
454 @ChgRef{Version=[2],Kind=[AddedNormal]}
455 @ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the simple name portion of
456 the file name specified by Name.
457 The exception Name_Error is propagated if the string given as Name does not
458 allow the identification of an external file (including directories and special
459 files).]}
460
461 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
462 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Containing_Directory (Name : @key{in} String) @key{return} String;]}
463 @end{Example}
464 @ChgRef{Version=[2],Kind=[AddedNormal]}
465 @ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the name of the containing
466 directory of the external file
467 (including directories) identified by Name. (If more than one directory can
468 contain Name, the directory name returned is implementation-defined.) The
469 exception Name_Error is propagated if the string given as Name does not allow
470 the identification of an external file. The exception Use_Error is propagated
471 if the external file does not have a containing directory.]}
472 @begin{Discussion}
473 @ChgRef{Version=[2],Kind=[AddedNormal]}
474 @ChgAdded{Version=[2],Text=[This is purely a string manipulation function.
475 If Name is not given as a full name, the containing directory probably
476 won't be one, either. For example, if Containing_Directory ("..\AARM\RM-A-8")
477 is called on Windows@latin1(174), the result should be "..\AARM". If there is no
478 path at all on the name, the result should be "." (which represents the
479 current directory). Use Full_Name on the result of Containing_Directory
480 if the full name is needed.]}
481 @end{Discussion}
482
483 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
484 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Extension (Name : @key{in} String) @key{return} String;]}
485 @end{Example}
486 @ChgRef{Version=[2],Kind=[AddedNormal]}
487 @ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the extension name
488 corresponding to Name. The extension name
489 is a portion of a simple name (not including any separator characters),
490 typically used to identify the file class. If the external environment does not
491 have extension names, then the null string is returned. The exception
492 Name_Error is propagated if the string given as Name does not allow the
493 identification of an external file.]}
494 @begin{Discussion}
495 @ChgRef{Version=[2],Kind=[AddedNormal]}
496 @ChgAdded{Version=[2],Text=[For Unix and Windows@latin1(174), the extension is the
497 portion of the simple name following the rightmost period. For example,
498 in the simple name "RM-A-8.html", the extension is "html".]}
499 @end{Discussion}
500
501 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
502 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Base_Name (Name : @key{in} String) @key{return} String;]}
503 @end{Example}
504 @ChgRef{Version=[2],Kind=[AddedNormal]}
505 @ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the base name corresponding
506 to Name. The base name is the
507 remainder of a simple name after removing any extension and extension
508 separators. The exception Name_Error is propagated if the string given as Name
509 does not allow the identification of an external file (including directories and
510 special files).]}
511 @begin{Discussion}
512 @ChgRef{Version=[2],Kind=[AddedNormal]}
513 @ChgAdded{Version=[2],Text=[For Unix and Windows@latin1(174), the base name is the
514 portion of the simple name preceding the rightmost period (except for the
515 special directory names "." and "..", whose Base_Name is "." and "..").
516 For example, in the simple name "RM-A-8.html", the base name is "RM-A-8".]}
517 @end{Discussion}
518
519 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
520 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Compose (Containing_Directory : @key{in} String := "";
521 Name : @key{in} String;
522 Extension : @key{in} String := "") @key{return} String;]}
523 @end{Example}
524 @ChgRef{Version=[2],Kind=[AddedNormal]}
525 @ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the name of the external
526 file with the specified
527 Containing_Directory, Name, and Extension. If Extension is the null string,
528 then Name is interpreted as a simple name; otherwise Name is interpreted as a
529 base name. The exception Name_Error is propagated if the string given as
530 Containing_Directory is not null and does not allow the identification of a
531 directory, or if the string given as Extension is not null and is not a
532 possible extension, or if the string given as Name is not a possible simple
533 name (if Extension is null) or base name (if Extension is non-null).]}
534
535 @begin{Ramification}
536 @ChgRef{Version=[2],Kind=[AddedNormal]}
537 @ChgAdded{Version=[2],Text=[The above definition implies that if
538 the Extension is null, for Unix and Windows@latin1(174) no '.' is added to Name.]}
539 @end{Ramification}
540 @begin{Discussion}
541 @ChgRef{Version=[2],Kind=[AddedNormal]}
542 @ChgAdded{Version=[2],Text=[If Name is null, Name_Error should be raised,
543 as nothing is not a possible simple name or base name.]}
544
545 @ChgRef{Version=[2],Kind=[AddedNormal]}
546 @ChgAdded{Version=[2],Text=[Generally, Compose(Containing_Directory(F),
547 Base_Name(F),Extension(F)) = F. However, this is not true on Unix or
548 Windows@latin1(174) for file names that end with a '.';
549 Compose(Base_Name("Fooey."),Extension("Fooey.")) = "Fooey".
550 This is not a problem for Windows@latin1(174), as the names have the same meaning with
551 or without the '.', but these are different names for Unix. Thus,
552 care needs to be taken on Unix; if Extension is null, Base_Name should
553 be avoided. (That's not usually a problem with file names generated by a
554 program.)]}
555 @end{Discussion}
556
557 @end{DescribeCode}
558
559 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]}
560 @ChgAdded{Version=[2],Type=[Leading],Text=[The following file and directory
561 queries and types are provided:]}
562
563 @begin{DescribeCode}
564
565 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
566 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{type} File_Kind @key{is} (Directory, Ordinary_File, Special_File);]}
567 @end{Example}
568 @ChgRef{Version=[2],Kind=[AddedNormal]}
569 @ChgAdded{Version=[2],Type=[Trailing],Text=[The type File_Kind represents the
570 kind of file represented by an external file or directory.]}
571
572 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
573 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{type} File_Size @key{is range} 0 .. @RI<implementation-defined>;]}
574 @end{Example}
575 @ChgRef{Version=[2],Kind=[AddedNormal]}
576 @ChgAdded{Version=[2],Type=[Trailing],Text=[The type File_Size represents the
577 size of an external file.]}
578 @ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@Chg{Version=[2],New=[The
579 maximum value for a file size in Directories.],Old=[]}]}
580
581 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
582 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Exists (Name : @key{in} String) @key{return} Boolean;]}
583 @end{Example}
584 @ChgRef{Version=[2],Kind=[AddedNormal]}
585 @ChgAdded{Version=[2],Type=[Trailing],Text=[Returns True if an external file
586 represented by Name exists, and False
587 otherwise. The exception Name_Error is propagated if the string given as Name
588 does not allow the identification of an external file (including directories
589 and special files).]}
590
591 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
592 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Kind (Name : @key{in} String) @key{return} File_Kind;]}
593 @end{Example}
594 @ChgRef{Version=[2],Kind=[AddedNormal]}
595 @ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the kind of
596 external file represented by Name. The exception
597 Name_Error is propagated if the string given as Name does not allow the
598 identification of an existing external file.]}
599
600 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
601 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Size (Name : @key{in} String) @key{return} File_Size;]}
602 @end{Example}
603 @ChgRef{Version=[2],Kind=[AddedNormal]}
604 @ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the size of the
605 external file represented by Name. The size of
606 an external file is the number of stream elements contained in the file.
607 If the external file is not an ordinary file, the
608 result is implementation-defined. The exception Name_Error is propagated if the
609 string given as Name does not allow the identification of an existing external
610 file. The exception Constraint_Error is propagated if the file size is not a
611 value of type File_Size.]}
612 @ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@Chg{Version=[2],New=[The
613 result for Directories.Size for a directory or special file],Old=[]}]}
614 @begin{Discussion}
615 @ChgRef{Version=[2],Kind=[AddedNormal]}
616 @ChgAdded{Version=[2],Type=[Trailing],Text=[We allow raising Constraint_Error,
617 so that an implementation for a system with 64-bit file sizes does not
618 need to support full numerics on 64-bit integers just to implement
619 this package. Of course, if 64-bit integers are available on such a system,
620 they should be used when defining type File_Size.]}
621 @end{Discussion}
622
623 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
624 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Modification_Time (Name : @key{in} String) @key{return} Ada.Calendar.Time;]}
625 @end{Example}
626 @ChgRef{Version=[2],Kind=[AddedNormal]}
627 @ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the time that the
628 external file represented by Name was most
629 recently modified. If the external file is not an ordinary file, the result is
630 implementation-defined. The exception Name_Error is propagated if the string
631 given as Name does not allow the identification of an existing external file.
632 The exception Use_Error is propagated if the external environment does not
633 support reading the modification time of the file with the name given by
634 Name (in the absence of Name_Error).]}
635 @ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@Chg{Version=[2],New=[The
636 result for Directories.Modification_Time for a directory or special file.],
637 Old=[]}]}
638
639 @end{DescribeCode}
640
641 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]}
642 @ChgAdded{Version=[2],Type=[Leading],Text=[The following directory searching
643 operations and types are provided:]}
644
645 @begin{DescribeCode}
646
647 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
648 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{type} Directory_Entry_Type @key{is limited private};]}
649 @end{Example}
650 @ChgRef{Version=[2],Kind=[AddedNormal]}
651 @ChgAdded{Version=[2],Type=[Trailing],Text=[The type Directory_Entry_Type represents a single item in a directory.
652 These items can only be created by the Get_Next_Entry procedure in this
653 package. Information about the item can be obtained from the functions declared
654 in this package. A default-initialized object of this type is invalid; objects
655 returned from Get_Next_Entry are valid.]}
656
657 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
658 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{type} Filter_Type @key{is array} (File_Kind) @key{of} Boolean;]}
659 @end{Example}
660 @ChgRef{Version=[2],Kind=[AddedNormal]}
661 @ChgAdded{Version=[2],Type=[Trailing],Text=[The type Filter_Type specifies which directory entries are provided
662 from a search operation. If the Directory component is True, directory entries
663 representing directories are provided. If the Ordinary_File component is True,
664 directory entries representing ordinary files are provided. If the Special_File
665 component is True, directory entries representing special files are provided.]}
666
667 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
668 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{type} Search_Type @key{is limited private};]}
669 @end{Example}
670 @ChgRef{Version=[2],Kind=[AddedNormal]}
671 @ChgAdded{Version=[2],Type=[Trailing],Text=[The type Search_Type contains the
672 state of a directory search. A
673 default-initialized Search_Type object has no entries available (function
674 More_Entries returns False). Type Search_Type needs finalization
675 (see @RefSecNum{User-Defined Assignment and Finalization}).]}
676
677 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
678 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Start_Search (Search : @key{in out} Search_Type;
679 Directory : @key{in} String;
680 Pattern : @key{in} String;
681 Filter : @key{in} Filter_Type := (@key{others} => True));]}
682 @end{Example}
683 @ChgRef{Version=[2],Kind=[AddedNormal]}
684 @ChgAdded{Version=[2],Type=[Trailing],Text=[Starts a search
685 in the directory named by
686 Directory for entries matching Pattern. Pattern represents a pattern for
687 matching file names. If Pattern is null, all items in the directory are matched; otherwise,
688 the interpretation of Pattern is implementation-defined. Only items that match
689 Filter will be returned. After a successful call on Start_Search, the object
690 Search may have entries available, but it may have no entries available if no
691 files or directories match Pattern and Filter. The exception Name_Error is
692 propagated if the string given by Directory does not identify an existing
693 directory, or if Pattern does not allow the identification of any possible
694 external file or directory. The exception Use_Error is propagated if the
695 external environment does not support the searching of the directory with the
696 given name (in the absence of Name_Error). When Start_Search propagates
697 Name_Error or Use_Error, the object Search will have no entries available.]}
698 @ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@Chg{Version=[2],New=[The
699 interpretation of a non-null search pattern in Directories.],Old=[]}]}
700
701 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
702 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} End_Search (Search : @key{in out} Search_Type);]}
703 @end{Example}
704 @ChgRef{Version=[2],Kind=[AddedNormal]}
705 @ChgAdded{Version=[2],Type=[Trailing],Text=[Ends the search represented
706 by Search. After a successful call on
707 End_Search, the object Search will have no entries available.]}
708
709 @begin{Ramification}
710 @ChgRef{Version=[2],Kind=[AddedNormal]}
711 @ChgAdded{Version=[2],Text=[The only way that a call to End_Search could be
712 unsuccessful if Device_Error (see @RefSecNum{Exceptions in Input-Output}) is
713 raised because of an underlying failure (or bug).]}
714 @end{Ramification}
715
716 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
717 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} More_Entries (Search : @key{in} Search_Type) @key{return} Boolean;]}
718 @end{Example}
719 @ChgRef{Version=[2],Kind=[AddedNormal]}
720 @ChgAdded{Version=[2],Type=[Trailing],Text=[Returns True if more entries are
721 available to be returned by a call
722 to Get_Next_Entry for the specified search object, and False otherwise.]}
723
724 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
725 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Get_Next_Entry (Search : @key{in out} Search_Type;
726 Directory_Entry : @key{out} Directory_Entry_Type);]}
727 @end{Example}
728 @ChgRef{Version=[2],Kind=[AddedNormal]}
729 @ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the next Directory_Entry
730 for the search described by Search
731 that matches the pattern and filter. If no further matches are available,
732 Status_Error is raised. It is implementation-defined as to whether the results
733 returned by this routine are altered if the contents of the directory are
734 altered while the Search object is valid (for example, by another program). The
735 exception Use_Error is propagated if the external environment does not support
736 continued searching of the directory represented by Search.]}
737 @ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@Chg{Version=[2],New=[The
738 results of a Directories search if the contents of the directory are
739 altered while a search is in progress.],Old=[]}]}
740
741 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
742 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Search (
743 Directory : @key{in} String;
744 Pattern : @key{in} String;
745 Filter : @key{in} Filter_Type := (others => True);
746 Process : @key{not null access procedure} (
747 Directory_Entry : @key{in} Directory_Entry_Type));]}
748 @end{Example}
749 @ChgRef{Version=[2],Kind=[AddedNormal]}
750 @ChgAdded{Version=[2],Type=[Trailing],Text=[Searches in the directory named by
751 Directory for entries matching Pattern. The subprogram designated by Process
752 is called with each matching entry in turn. Pattern represents a pattern for
753 matching file names. If Pattern is null, all items in the directory are matched;
754 otherwise, the interpretation of Pattern is implementation-defined. Only
755 items that match Filter will be returned.
756 The exception Name_Error is propagated if the string given by Directory
757 does not identify an existing directory, or if Pattern does not allow the
758 identification of any possible external file or directory. The exception
759 Use_Error is propagated if the external environment does not support the
760 searching of the directory with the given name (in the absence of
761 Name_Error).]}
762 @Comment{The implementation-defined case is handled above.}
763 @begin{Discussion}
764 @ChgRef{Version=[2],Kind=[AddedNormal]}
765 @ChgAdded{Version=[2],Text=[@lquotes@;In turn@rquotes means that the
766 calls to the subprogram designated by Process are not made in parallel;
767 they can be made in any order but must be in sequence.]}
768 @end{Discussion}
769
770 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
771 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Simple_Name (Directory_Entry : @key{in} Directory_Entry_Type)
772 @key{return} String;]}
773 @end{Example}
774 @ChgRef{Version=[2],Kind=[AddedNormal]}
775 @ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the simple external name
776 of the external file (including
777 directories) represented by Directory_Entry. The format of the name returned is
778 implementation-defined. The exception Status_Error is propagated if
779 Directory_Entry is invalid.]}
780
781 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
782 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Full_Name (Directory_Entry : @key{in} Directory_Entry_Type)
783 @key{return} String;]}
784 @end{Example}
785 @ChgRef{Version=[2],Kind=[AddedNormal]}
786 @ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the full external name of
787 the external file (including
788 directories) represented by Directory_Entry. The format of the name returned is
789 implementation-defined. The exception Status_Error is propagated if
790 Directory_Entry is invalid.]}
791
792 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
793 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Kind (Directory_Entry : @key{in} Directory_Entry_Type)
794 @key{return} File_Kind;]}
795 @end{Example}
796 @ChgRef{Version=[2],Kind=[AddedNormal]}
797 @ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the kind of external file
798 represented by Directory_Entry. The
799 exception Status_Error is propagated if Directory_Entry is invalid.]}
800
801 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
802 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Size (Directory_Entry : @key{in} Directory_Entry_Type)
803 @key{return} File_Size;]}
804 @end{Example}
805 @ChgRef{Version=[2],Kind=[AddedNormal]}
806 @ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the size of the external
807 file represented by Directory_Entry.
808 The size of an external file is the number of stream elements contained in
809 the file. If the external file represented by
810 Directory_Entry is not an ordinary file, the result is implementation-defined.
811 The exception Status_Error is propagated if Directory_Entry is invalid. The
812 exception Constraint_Error is propagated if the file size is not a value of
813 type File_Size.]}
814
815 @begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]}
816 @ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Modification_Time (Directory_Entry : @key{in} Directory_Entry_Type)
817 @key{return} Ada.Calendar.Time;]}
818 @end{Example}
819 @ChgRef{Version=[2],Kind=[AddedNormal]}
820 @ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the time that the external
821 file represented by Directory_Entry
822 was most recently modified. If the external file represented by Directory_Entry
823 is not an ordinary file, the result is implementation-defined. The exception
824 Status_Error is propagated if Directory_Entry is invalid. The exception
825 Use_Error is propagated if the external environment does not support
826 reading the modification time of the file represented by Directory_Entry.]}
827
828 @end{DescribeCode}
829
830 @end{StaticSem}
831
832 @begin{ImplReq}
833
834 @ChgRef{Version=[2],Kind=[AddedNormal]}
835 @ChgAdded{Version=[2],Text=[For Copy_File, if Source_Name identifies an
836 existing external ordinary file created by a predefined Ada input-output
837 package, and Target_Name and Form can be used in the Create operation of that
838 input-output package with mode Out_File without raising an exception, then
839 Copy_File shall not propagate Use_Error.]}
840
841 @begin{Discussion}
842 @ChgRef{Version=[2],Kind=[AddedNormal]}
843 @ChgAdded{Version=[2],Text=[This means that Copy_File will copy any file
844 that the Ada programmer could copy (by writing some possibly complicated
845 Ada code).]}
846 @end{Discussion}
847 @end{ImplReq}
848
849 @begin{ImplAdvice}
850
851 @ChgRef{Version=[2],Kind=[AddedNormal]}
852 @ChgAdded{Version=[2],Text=[If other information about a file
853 (such as the owner or creation date) is available in a directory entry,
854 the implementation
855 should provide functions in a child package Directories.Information to
856 retrieve it.@ChildUnit{Parent=[Ada.Directories],Child=[Information]}]}
857 @ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],
858 Text=[Package Directories.Information should be provided to retrieve
859 other information about a file.]}]}
860
861 @begin{ImplNote}
862
863 @ChgRef{Version=[2],Kind=[AddedNormal]}
864 @ChgAdded{Version=[2],Type=[Leading],Text=[For Windows@latin1(174),
865 Directories.Information should contain at least the following routines:]}
866
867 @begin{Example}
868 @ChgRef{Version=[2],Kind=[AddedNormal]}
869 @ChgAdded{Version=[2],Text=[@key{package} Ada.Directories.Information @key{is}
870 -- @RI[System-specific directory information.]
871 -- @RI[Version for the Microsoft@latin1(174) Windows@latin1(174) operating system.]]}
872
873 @ChgRef{Version=[2],Kind=[AddedNormal]}
874 @ChgAdded{Version=[2],Text=[ @key{function} Creation_Time (Name : @key{in} String) @key{return} Ada.Calendar.Time;]}
875
876 @ChgRef{Version=[2],Kind=[AddedNormal]}
877 @ChgAdded{Version=[2],Text=[ @key{function} Last_Access_Time (Name : @key{in} String) @key{return} Ada.Calendar.Time;]}
878
879 @ChgRef{Version=[2],Kind=[AddedNormal]}
880 @ChgAdded{Version=[2],Text=[ @key{function} Is_Read_Only (Name : @key{in} String) @key{return} Boolean;]}
881
882 @ChgRef{Version=[2],Kind=[AddedNormal]}
883 @ChgAdded{Version=[2],Text=[ @key{function} Needs_Archiving (Name : @key{in} String) @key{return} Boolean;
884 -- @RI[This generally means that the file needs to be backed up.]
885 -- @RI[The flag is only cleared by backup programs.]]}
886
887 @ChgRef{Version=[2],Kind=[AddedNormal]}
888 @ChgAdded{Version=[2],Text=[ @key{function} Is_Compressed (Name : @key{in} String) @key{return} Boolean;]}
889
890 @ChgRef{Version=[2],Kind=[AddedNormal]}
891 @ChgAdded{Version=[2],Text=[ @key{function} Is_Encrypted (Name : @key{in} String) @key{return} Boolean;]}
892
893 @ChgRef{Version=[2],Kind=[AddedNormal]}
894 @ChgAdded{Version=[2],Text=[ @key{function} Is_Hidden (Name : @key{in} String) @key{return} Boolean;]}
895
896 @ChgRef{Version=[2],Kind=[AddedNormal]}
897 @ChgAdded{Version=[2],Text=[ @key{function} Is_System (Name : @key{in} String) @key{return} Boolean;]}
898
899 @ChgRef{Version=[2],Kind=[AddedNormal]}
900 @ChgAdded{Version=[2],Text=[ @key{function} Is_Offline (Name : @key{in} String) @key{return} Boolean;]}
901
902 @ChgRef{Version=[2],Kind=[AddedNormal]}
903 @ChgAdded{Version=[2],Text=[ @key{function} Is_Temporary (Name : @key{in} String) @key{return} Boolean;]}
904
905 @ChgRef{Version=[2],Kind=[AddedNormal]}
906 @ChgAdded{Version=[2],Text=[ @key{function} Is_Sparse (Name : @key{in} String) @key{return} Boolean;]}
907
908 @ChgRef{Version=[2],Kind=[AddedNormal]}
909 @ChgAdded{Version=[2],Text=[ @key{function} Is_Not_Indexed (Name : @key{in} String) @key{return} Boolean;]}
910
911 @ChgRef{Version=[2],Kind=[AddedNormal]}
912 @ChgAdded{Version=[2],Text=[ @key{function} Creation_Time (Directory_Entry : @key{in} Directory_Entry_Type)
913 @key{return} Ada.Calendar.Time;]}
914
915 @ChgRef{Version=[2],Kind=[AddedNormal]}
916 @ChgAdded{Version=[2],Text=[ @key{function} Last_Access_Time (Directory_Entry : @key{in} Directory_Entry_Type)
917 @key{return} Ada.Calendar.Time;]}
918
919 @ChgRef{Version=[2],Kind=[AddedNormal]}
920 @ChgAdded{Version=[2],Text=[ @key{function} Is_Read_Only (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]}
921
922 @ChgRef{Version=[2],Kind=[AddedNormal]}
923 @ChgAdded{Version=[2],Text=[ @key{function} Needs_Archiving (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;
924 -- @RI[This generally means that the file needs to be backed up.]
925 -- @RI[The flag is only cleared by backup programs.]]}
926
927 @ChgRef{Version=[2],Kind=[AddedNormal]}
928 @ChgAdded{Version=[2],Text=[ @key{function} Is_Compressed (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]}
929
930 @ChgRef{Version=[2],Kind=[AddedNormal]}
931 @ChgAdded{Version=[2],Text=[ @key{function} Is_Encrypted (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]}
932
933 @ChgRef{Version=[2],Kind=[AddedNormal]}
934 @ChgAdded{Version=[2],Text=[ @key{function} Is_Hidden (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]}
935
936 @ChgRef{Version=[2],Kind=[AddedNormal]}
937 @ChgAdded{Version=[2],Text=[ @key{function} Is_System (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]}
938
939 @ChgRef{Version=[2],Kind=[AddedNormal]}
940 @ChgAdded{Version=[2],Text=[ @key{function} Is_Offline (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]}
941
942 @ChgRef{Version=[2],Kind=[AddedNormal]}
943 @ChgAdded{Version=[2],Text=[ @key{function} Is_Temporary (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]}
944
945 @ChgRef{Version=[2],Kind=[AddedNormal]}
946 @ChgAdded{Version=[2],Text=[ @key{function} Is_Sparse (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]}
947
948 @ChgRef{Version=[2],Kind=[AddedNormal]}
949 @ChgAdded{Version=[2],Text=[ @key{function} Is_Not_Indexed (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]}
950
951 @ChgRef{Version=[2],Kind=[AddedNormal]}
952 @ChgAdded{Version=[2],Text=[ -- @RI[Additional implementation-defined subprograms allowed here.]
953 @key{end} Ada.Directories.Information;]}
954 @end{Example}
955
956
957 @ChgRef{Version=[2],Kind=[AddedNormal]}
958 @ChgAdded{Version=[2],Type=[Leading],Text=[For Unix-like systems (Unix,
959 POSIX, Linux, etc.), Directories.Information should contain at least the
960 following routines:]}
961
962 @begin{Example}
963 @ChgRef{Version=[2],Kind=[AddedNormal]}
964 @ChgAdded{Version=[2],Text=[@key{package} Ada.Directories.Information @key{is}
965 -- @RI[System-specific directory information.]
966 -- @RI[Unix and similar systems version.]]}
967
968 @ChgRef{Version=[2],Kind=[AddedNormal]}
969 @ChgAdded{Version=[2],Text=[ @key{function} Last_Access_Time (Name : @key{in} String) @key{return} Ada.Calendar.Time;]}
970
971 @ChgRef{Version=[2],Kind=[AddedNormal]}
972 @ChgAdded{Version=[2],Text=[ @key{function} Last_Status_Change_Time (Name : @key{in} String) @key{return} Ada.Calendar.Time;]}
973
974 @ChgRef{Version=[2],Kind=[AddedNormal]}
975 @ChgAdded{Version=[2],Text=[ @key{type} Permission @key{is}
976 (Others_Execute, Others_Write, Others_Read,
977 Group_Execute, Group_Write, Group_Read,
978 Owner_Execute, Owner_Write, Owner_Read,
979 Set_Group_ID, Set_User_ID);]}
980
981 @ChgRef{Version=[2],Kind=[AddedNormal]}
982 @ChgAdded{Version=[2],Text=[ @key{type} Permission_Set_Type @key{is array} (Permission) @key{of} Boolean;]}
983
984 @ChgRef{Version=[2],Kind=[AddedNormal]}
985 @ChgAdded{Version=[2],Text=[ @key{function} Permission_Set (Name : @key{in} String) @key{return} Permission_Set_Type;]}
986
987 @ChgRef{Version=[2],Kind=[AddedNormal]}
988 @ChgAdded{Version=[2],Text=[ @key{function} Owner (Name : @key{in} String) @key{return} String;
989 -- @RI[Returns the image of the User_Id. If a definition of User_Id]
990 -- @RI[is available, an implementation-defined version of Owner]
991 -- @RI[returning User_Id should also be defined.]]}
992
993 @ChgRef{Version=[2],Kind=[AddedNormal]}
994 @ChgAdded{Version=[2],Text=[ @key{function} Group (Name : @key{in} String) @key{return} String;
995 -- @RI[Returns the image of the User_Id. If a definition of Group_Id]
996 -- @RI[is available, an implementation-defined version of Group]
997 -- @RI[returning Group_Id should also be defined.]]}
998
999 @ChgRef{Version=[2],Kind=[AddedNormal]}
1000 @ChgAdded{Version=[2],Text=[ @key{function} Is_Block_Special_File (Name : @key{in} String) @key{return} Boolean;]}
1001
1002 @ChgRef{Version=[2],Kind=[AddedNormal]}
1003 @ChgAdded{Version=[2],Text=[ @key{function} Is_Character_Special_File (Name : @key{in} String) @key{return} Boolean;]}
1004
1005 @ChgRef{Version=[2],Kind=[AddedNormal]}
1006 @ChgAdded{Version=[2],Text=[ @key{function} Is_FIFO (Name : @key{in} String) @key{return} Boolean;]}
1007
1008 @ChgRef{Version=[2],Kind=[AddedNormal]}
1009 @ChgAdded{Version=[2],Text=[ @key{function} Is_Symbolic_Link (Name : @key{in} String) @key{return} Boolean;]}
1010
1011 @ChgRef{Version=[2],Kind=[AddedNormal]}
1012 @ChgAdded{Version=[2],Text=[ @key{function} Is_Socket (Name : @key{in} String) @key{return} Boolean;]}
1013
1014 @ChgRef{Version=[2],Kind=[AddedNormal]}
1015 @ChgAdded{Version=[2],Text=[ @key{function} Last_Access_Time (Directory_Entry : @key{in} Directory_Entry_Type)
1016 @key{return} Ada.Calendar.Time;]}
1017
1018 @ChgRef{Version=[2],Kind=[AddedNormal]}
1019 @ChgAdded{Version=[2],Text=[ @key{function} Last_Status_Change_Time (Directory_Entry : @key{in} Directory_Entry_Type)
1020 @key{return} Ada.Calendar.Time;]}
1021
1022 @ChgRef{Version=[2],Kind=[AddedNormal]}
1023 @ChgAdded{Version=[2],Text=[ @key{function} Permission_Set (Directory_Entry : @key{in} Directory_Entry_Type)
1024 @key{return} Permission_Set_Type;]}
1025
1026 @ChgRef{Version=[2],Kind=[AddedNormal]}
1027 @ChgAdded{Version=[2],Text=[ @key{function} Owner (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} String;
1028 -- @RI[See Owner above.]]}
1029
1030 @ChgRef{Version=[2],Kind=[AddedNormal]}
1031 @ChgAdded{Version=[2],Text=[ @key{function} Group (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} String;
1032 -- @RI[See Group above.]]}
1033
1034 @ChgRef{Version=[2],Kind=[AddedNormal]}
1035 @ChgAdded{Version=[2],Text=[ @key{function} Is_Block_Special_File (Directory_Entry : @key{in} Directory_Entry_Type)
1036 @key{return} Boolean;]}
1037
1038 @ChgRef{Version=[2],Kind=[AddedNormal]}
1039 @ChgAdded{Version=[2],Text=[ @key{function} Is_Character_Special_File (Directory_Entry : @key{in} Directory_Entry_Type)
1040 @key{return} Boolean;]}
1041
1042 @ChgRef{Version=[2],Kind=[AddedNormal]}
1043 @ChgAdded{Version=[2],Text=[ @key{function} Is_FIFO (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]}
1044
1045 @ChgRef{Version=[2],Kind=[AddedNormal]}
1046 @ChgAdded{Version=[2],Text=[ @key{function} Is_Symbolic_Link (Directory_Entry : @key{in} Directory_Entry_Type)
1047 @key{return} Boolean;]}
1048
1049 @ChgRef{Version=[2],Kind=[AddedNormal]}
1050 @ChgAdded{Version=[2],Text=[ @key{function} Is_Socket (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]}
1051
1052 @ChgRef{Version=[2],Kind=[AddedNormal]}
1053 @ChgAdded{Version=[2],Text=[ -- @RI[Additional implementation-defined subprograms allowed here.]
1054 @key{end} Ada.Directories.Information;]}
1055 @end{Example}
1056
1057 @ChgRef{Version=[2],Kind=[AddedNormal]}
1058 @ChgAdded{Version=[2],Text=[We give these definitions to give guidance so that
1059 every implementation for a given target is not unnecessarily different.
1060 Implementers are encouraged to make packages for other targets as similar to
1061 these as possible.]}
1062
1063 @end{ImplNote}
1064
1065
1066 @ChgRef{Version=[2],Kind=[AddedNormal]}
1067 @ChgAdded{Version=[2],Text=[Start_Search and Search should raise Use_Error if
1068 Pattern is malformed, but not if it could represent a file in the directory but
1069 does not actually do so.]}
1070 @ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],
1071 Text=[Directories.Start_Search and Directories.Search should raise Use_Error
1072 for malformed patterns.]}]}
1073
1074 @ChgRef{Version=[2],Kind=[AddedNormal]}
1075 @ChgAdded{Version=[2],Text=[Rename should be supported at least when both
1076 New_Name and Old_Name are simple names and New_Name does not identify an
1077 existing external file.]}
1078 @ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],
1079 Text=[Directories.Rename should be supported at least when both New_Name and
1080 Old_Name are simple names and New_Name does not identify an existing
1081 external file.]}]}
1082
1083 @begin{Discussion}
1084 @ChgRef{Version=[2],Kind=[AddedNormal]}
1085 @ChgAdded{Version=[2],Text=[@Lquotes@;Supported@rquotes@; includes raising
1086 an exception if either name is malformed, the file to rename doesn't exist,
1087 insufficient permission for the operation exists, or similar problems. But
1088 this advice requires implementations to document what they do, and tells
1089 implementers that simply raising Use_Error isn't acceptable.]}
1090 @end{Discussion}
1091
1092 @end{ImplAdvice}
1093
1094 @begin{Notes}
1095
1096 @ChgRef{Version=[2],Kind=[AddedNormal]}
1097 @ChgAdded{Version=[2],Text=[The operations Containing_Directory,
1098 Full_Name, Simple_Name,
1099 Base_Name, Extension, and Compose operate on file names, not external files.
1100 The files identified by these operations do not need to exist. Name_Error is
1101 raised only if the file name is malformed and cannot possibly identify a file.
1102 Of these operations, only the result of Full_Name depends on the current
1103 default directory; the result of the others depends only on their parameters.]}
1104
1105 @ChgRef{Version=[2],Kind=[AddedNormal]}
1106 @ChgAdded{Version=[2],Text=[Using access types, values of Search_Type and
1107 Directory_Entry_Type can be
1108 saved and queried later. However, another task or application can modify or
1109 delete the file represented by a Directory_Entry_Type value or the directory
1110 represented by a Search_Type value; such a value can only give the information
1111 valid at the time it is created. Therefore, long-term storage of these values
1112 is not recommended.]}
1113
1114 @ChgRef{Version=[2],Kind=[AddedNormal]}
1115 @ChgAdded{Version=[2],Text=[If the target system does not support directories
1116 inside of directories, then Kind will never return Directory and
1117 Containing_Directory will always raise Use_Error.]}
1118
1119 @ChgRef{Version=[2],Kind=[AddedNormal]}
1120 @ChgAdded{Version=[2],Text=[If the target system does not support creation or
1121 deletion of directories, then Create_Directory, Create_Path, Delete_Directory,
1122 and Delete_Tree will always propagate Use_Error.]}
1123
1124 @ChgRef{Version=[2],Kind=[AddedNormal]}
1125 @ChgAdded{Version=[2],Text=[To move a file or directory to a different
1126 location, use Rename. Most target systems will allow renaming of files from one
1127 directory to another. If the target file or directory might already exist, it
1128 should be deleted first.]}
1129 @begin{Discussion}
1130 @ChgRef{Version=[2],Kind=[AddedNormal]}
1131 @ChgAdded{Version=[2],Type=[Leading],Text=[While Rename is only guaranteed to
1132 work for name changes within a single directory, its unlikely that
1133 implementers would purposely prevent functionality present in the underlying
1134 system from working. To move a file totally portably, it's necessary to
1135 handle failure of the Rename and fall back to Copy_File and Delete:]}
1136 @begin{Example}
1137 @ChgAdded{Version=[2],Text=[@key[begin]
1138 Rename (Source, Target);
1139 @key[exception]
1140 @key[when] Use_Error =>
1141 Copy_File (Source, Target);
1142 Delete (Source);
1143 @key[end];]}
1144 @end{Example}
1145 @end{Discussion}
1146 @end{Notes}
1147
1148 @begin{Extend95}
1149 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]}
1150 @ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95}
1151 Package Ada.Directories is new.]}
1152 @end{Extend95}
1153