Form parameter - ytomino/drake GitHub Wiki
Contents
The format is "keyword1=value1,keyword2=value2,...".
All characters are lower case.
When In_File,
| Form (when In_File) | Which locking flag does Create/Open try |
|---|---|
| "shared=allow", "shared=yes" or "shared=no" | 0, FILE_SHARE_READ or FILE_SHARE_WRITE |
| "shared=read" or default | O_SHLOCK, FILE_SHARE_READ |
| "shared=deny" | O_EXLOCK, 0 |
When Out_File or Append_File (or Inout_File of Ada.Direct_IO),
| Form (when Out_File or Append_File) | Which locking flag does Create/Open try |
|---|---|
| "shared=allow", "shared=yes" or "shared=no" | 0, FILE_SHARE_READ or FILE_SHARE_WRITE |
| "shared=read" | O_SHLOCK, FILE_SHARE_READ |
| "shared=deny" or default | O_EXLOCK, 0 |
In POSIX, the locking flags are 0 (does not care, allows others to read/write), O_SHLOCK (allows others only to read) or O_EXLOCK (disallows others from reading/writing).
In Windows, the locking flags are the combinations of FILE_SHARE_READ (allows others to read) and FILE_SHARE_WRITE (allows others to write).
| Form | What does Create/Open do in that case |
|---|---|
| "wait=false" or default | raises Task_Error immediately |
| "wait=true" | waits until the lock has been acquired |
| Form | What does Create do |
|---|---|
| "overwrite=false" | fails if the file has existed |
| "overwrite=true" or default | always create new empty file |
Same as shared of Ada.Streams.Stream_IO.
Same as wait of Ada.Streams.Stream_IO.
Same as overwrite of Ada.Streams.Stream_IO.
Same as shared of Ada.Streams.Stream_IO.
Same as wait of Ada.Streams.Stream_IO.
Same as overwrite of Ada.Streams.Stream_IO.
Same as shared of Ada.Streams.Stream_IO.
Same as wait of Ada.Streams.Stream_IO.
Same as overwrite of Ada.Streams.Stream_IO.
| Form | What happens on writing |
|---|---|
| "private=false" or default | the change is shared and saved to the file |
| "private=true" | the change is local and not visible to others |
Same as shared of Ada.Streams.Stream_IO.
Same as wait of Ada.Streams.Stream_IO.
Same as overwrite of Ada.Streams.Stream_IO.
In POSIX, it assumes file contents are encoded as UTF-8.
| Form (in POSIX) | Text_IO | Wide_Text_IO | Wide_Wide_Text_IO | In external file |
|---|---|---|---|---|
| default | UTF-8 | UTF-16 | UTF-32 | UTF-8 |
In Windows,
| Form (in Windows) | Text_IO | Wide_Text_IO | Wide_Wide_Text_IO | In external file |
|---|---|---|---|---|
| "external=dbcs" or default | UTF-8 | UTF-16 | UTF-32 | Active Code Page |
| "external=utf-8" or "wcem=8" | UTF-8 | UTF-16 | UTF-32 | UTF-8 |
In POSIX,
| Form (in POSIX) | What does New_Line put |
|---|---|
| "nl=lf" or default | LF |
| "nl=cr" | CR |
| "nl=m" | CR & LF |
In Windows,
| Form (in Windows) | What does New_Line put |
|---|---|
| "nl=lf" | LF |
| "nl=cr" | CR |
| "nl=m" or default | CR & LF |
Form parameter has no effect for other subprograms except Copy_File.
| Form | What does Copy_File do |
|---|---|
| "overwrite=false" or "mode=copy" | fails if the file has existed |
| "overwrite=true", "mode=overwrite" or default | overwrites the existing file |