| 1 |
@comment{ $Source: e:\\cvsroot/ARM/Source/pre_environ.mss,v $ } |
| 2 |
@comment{ $Revision: 1.16 $ $Date: 2019/01/12 03:52:47 $ $Author: randy $ } |
| 3 |
@Part(predefenviron, Root="ada.mss") |
| 4 |
|
| 5 |
@Comment{$Date: 2019/01/12 03:52:47 $} |
| 6 |
|
| 7 |
@LabeledAddedClause{Version=[2],Name=[The Package Environment_Variables]} |
| 8 |
|
| 9 |
@begin{Intro} |
| 10 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 11 |
@ChgAdded{Version=[2],Text=[@Defn{environment variable} |
| 12 |
The package Environment_Variables allows a program to |
| 13 |
read or modify environment variables. Environment variables are name-value |
| 14 |
pairs, where both the name and value are strings. The definition of what |
| 15 |
constitutes an @i{environment variable}, and the meaning of the name and value, |
| 16 |
are implementation defined.]} |
| 17 |
@ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@Chg{Version=[2],New=[The |
| 18 |
definition and meaning of an environment variable.],Old=[]}]} |
| 19 |
@end{Intro} |
| 20 |
|
| 21 |
@begin{StaticSem} |
| 22 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 23 |
@ChgAdded{Version=[2],KeepNext=[T],Type=[Leading],Text=[The library package |
| 24 |
Environment_Variables has the following declaration:]} |
| 25 |
@begin{Example} |
| 26 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 27 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0241-1]} |
| 28 |
@ChgAdded{Version=[2],Text=[@key{package} Ada.Environment_Variables@Chg{Version=[5],New=[],Old=[ @key{is}]}@ChildUnit{Parent=[Ada],Child=[Environment_Variables]} |
| 29 |
@Chg{Version=[5],New=[@key{with}],Old=[@key{pragma}]} Preelaborate@Chg{Version=[5],New=[, Nonblocking @key{is}],Old=[(Environment_Variables);]}]} |
| 30 |
|
| 31 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 32 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Value} (Name : @key{in} String) @key{return} String;]} |
| 33 |
|
| 34 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0285-1]} |
| 35 |
@ChgAdded{Version=[3],Text=[ @key{function} @AdaSubDefn{Value} (Name : @key{in} String; Default : @key{in} String) @key{return} String;]} |
| 36 |
|
| 37 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 38 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Exists} (Name : @key{in} String) @key{return} Boolean;]} |
| 39 |
|
| 40 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 41 |
@ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Set} (Name : @key{in} String; Value : @key{in} String);]} |
| 42 |
|
| 43 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 44 |
@ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Clear} (Name : @key{in} String); |
| 45 |
@key{procedure} @AdaSubDefn{Clear};]} |
| 46 |
|
| 47 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 48 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0248-1]} |
| 49 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0286-1]} |
| 50 |
@ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Iterate}@Chg{Version=[3],New=[],Old=[ (]} |
| 51 |
@Chg{Version=[3],New=[(],Old=[ ]}Process : @key{not null access procedure} (Name, Value : @key{in} String))@Chg{Version=[5],New=[ |
| 52 |
@key[with] Allows_Exit],Old=[]};]} |
| 53 |
|
| 54 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 55 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[@key{end} Ada.Environment_Variables;]} |
| 56 |
@end{Example} |
| 57 |
|
| 58 |
@begin{DescribeCode} |
| 59 |
|
| 60 |
@begin{Example} |
| 61 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 62 |
@ChgAdded{Version=[2],KeepNext=[T],Text=[@key{function} Value (Name : @key{in} String) @key{return} String;]} |
| 63 |
@end{Example} |
| 64 |
|
| 65 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 66 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[If the external execution |
| 67 |
environment supports environment variables, then Value returns the value of the |
| 68 |
environment variable with the given name. If no environment variable with the |
| 69 |
given name exists, then Constraint_Error is propagated. If the execution |
| 70 |
environment does not support environment variables, then Program_Error is |
| 71 |
propagated.]} |
| 72 |
|
| 73 |
@begin{Example} |
| 74 |
@ChgRef{Version=[3],Kind=[Added]} |
| 75 |
@ChgAdded{Version=[3],KeepNext=[T],Text=[@key{function} Value (Name : @key{in} String; Default : @key{in} String) @key{return} String;]} |
| 76 |
@end{Example} |
| 77 |
|
| 78 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0285-1]} |
| 79 |
@ChgAdded{Version=[3],Type=[Trailing],Text=[If the external execution |
| 80 |
environment supports environment variables and an environment variable with the |
| 81 |
given name currently exists, then Value returns its value; otherwise, it returns |
| 82 |
Default.]} |
| 83 |
|
| 84 |
@begin{Example} |
| 85 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 86 |
@ChgAdded{Version=[2],KeepNext=[T],Text=[@key{function} Exists (Name : @key{in} String) @key{return} Boolean;]} |
| 87 |
@end{Example} |
| 88 |
|
| 89 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 90 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]} |
| 91 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[If the external execution environment |
| 92 |
supports environment variables and an environment variable with the given name |
| 93 |
currently exists, then Exists returns True; |
| 94 |
otherwise@Chg{Version=[3],New=[,],Old=[]} |
| 95 |
it returns False.]} |
| 96 |
|
| 97 |
@begin{Example} |
| 98 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 99 |
@ChgAdded{Version=[2],KeepNext=[T],Text=[@key{procedure} Set (Name : @key{in} String; Value : @key{in} String);]} |
| 100 |
@end{Example} |
| 101 |
|
| 102 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 103 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]} |
| 104 |
@ChgAdded{Version=[2],Text=[If the external execution |
| 105 |
environment supports environment variables, then Set first clears any existing |
| 106 |
environment variable with the given name, and then defines a single new |
| 107 |
environment variable with the given name and value. |
| 108 |
Otherwise@Chg{Version=[3],New=[,],Old=[]} Program_Error is |
| 109 |
propagated.]} |
| 110 |
|
| 111 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 112 |
@ChgAdded{Version=[2],Text=[If implementation-defined circumstances prohibit |
| 113 |
the definition of an environment variable with the given name and value, then |
| 114 |
Constraint_Error is propagated.]} |
| 115 |
@ChgImplDef{Version=[2],Kind=[AddedNormal], |
| 116 |
Text=[@Chg{Version=[2],New=[The circumstances where an environment variable |
| 117 |
cannot be defined.],Old=[]}]} |
| 118 |
|
| 119 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 120 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[It is implementation defined |
| 121 |
whether there exist values for which the call Set(Name, Value) has the same |
| 122 |
effect as Clear (Name).]} |
| 123 |
@ChgImplDef{Version=[2],Kind=[AddedNormal], |
| 124 |
Text=[@Chg{Version=[2],New=[Environment names for which Set has the effect of |
| 125 |
Clear.],Old=[]}]} |
| 126 |
|
| 127 |
@begin{Example} |
| 128 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 129 |
@ChgAdded{Version=[2],KeepNext=[T],Text=[@key{procedure} Clear (Name : @key{in} String);]} |
| 130 |
@end{Example} |
| 131 |
|
| 132 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 133 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1],ARef=[AI05-0269-1]} |
| 134 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[If the external execution |
| 135 |
environment supports environment variables, then Clear deletes all existing |
| 136 |
environment @Chg{Version=[3],New=[variables],Old=[variable]} with the given |
| 137 |
name. Otherwise@Chg{Version=[3],New=[,],Old=[]} Program_Error is propagated.]} |
| 138 |
|
| 139 |
@begin{Example} |
| 140 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 141 |
@ChgAdded{Version=[2],KeepNext=[T],Text=[@key{procedure} Clear;]} |
| 142 |
@end{Example} |
| 143 |
|
| 144 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 145 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]} |
| 146 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[If the external execution |
| 147 |
environment supports environment variables, |
| 148 |
then Clear deletes all existing environment variables. |
| 149 |
Otherwise@Chg{Version=[3],New=[,],Old=[]} Program_Error is |
| 150 |
propagated.]} |
| 151 |
|
| 152 |
@begin{Example} |
| 153 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 154 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0248-1]} |
| 155 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0286-1]} |
| 156 |
@ChgAdded{Version=[2],Text=[@key{procedure} Iterate@Chg{Version=[3],New=[],Old=[ (]} |
| 157 |
@Chg{Version=[3],New=[(],Old=[ ]}Process : @key{not null access procedure} (Name, Value : @key{in} String))@Chg{Version=[5],New=[ |
| 158 |
@key[with] Allows_Exit],Old=[]};]} |
| 159 |
@end{Example} |
| 160 |
|
| 161 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 162 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]} |
| 163 |
@ChgAdded{Version=[2],Text=[If the external execution environment supports |
| 164 |
environment variables, then Iterate calls the subprogram designated by Process |
| 165 |
for each existing environment variable, passing the name and value of that |
| 166 |
environment variable. |
| 167 |
Otherwise@Chg{Version=[3],New=[,],Old=[]} Program_Error is |
| 168 |
propagated.]} |
| 169 |
|
| 170 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 171 |
@ChgAdded{Version=[2],Text=[If several environment variables exist that have |
| 172 |
the same name, Process is called once for each such variable.]} |
| 173 |
|
| 174 |
@end{DescribeCode} |
| 175 |
@end{StaticSem} |
| 176 |
|
| 177 |
@begin{Bounded} |
| 178 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 179 |
@ChgAdded{Version=[2],Type=[Leading],Text=[@PDefn2{Term=(bounded error),Sec=(cause)} |
| 180 |
It is a bounded error to call Value if more than one environment variable |
| 181 |
exists with the given name; the possible outcomes are that:]} |
| 182 |
@begin{itemize} |
| 183 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 184 |
@ChgAdded{Version=[2],Text=[one of the values is returned, and that |
| 185 |
same value is returned in subsequent calls in the absence of changes to |
| 186 |
the environment; or]} |
| 187 |
|
| 188 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 189 |
@ChgAdded{Version=[2],Text=[Program_Error is propagated.]} |
| 190 |
@end{Itemize} |
| 191 |
@end{Bounded} |
| 192 |
|
| 193 |
@begin{Erron} |
| 194 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 195 |
@ChgAdded{Version=[2],Text=[@PDefn2{Term=(erroneous execution),Sec=(cause)} |
| 196 |
Making calls to the procedures Set or Clear concurrently with calls to any |
| 197 |
subprogram of package Environment_Variables, or to any instantiation of Iterate, |
| 198 |
results in erroneous execution.]} |
| 199 |
|
| 200 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 201 |
@ChgAdded{Version=[2],Text=[Making calls to the procedures Set or Clear in the actual subprogram |
| 202 |
corresponding to the Process parameter of Iterate results in erroneous |
| 203 |
execution.]} |
| 204 |
@end{Erron} |
| 205 |
|
| 206 |
@begin{DocReq} |
| 207 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 208 |
@ChgAdded{Version=[2],Text=[An implementation shall document how the |
| 209 |
operations of this package behave if |
| 210 |
environment variables are changed by external mechanisms (for instance, |
| 211 |
calling operating system services).]} |
| 212 |
@ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 213 |
Text=[The behavior of package Environment_Variables when environment variables |
| 214 |
are changed by external mechanisms.]}]} |
| 215 |
@end{DocReq} |
| 216 |
|
| 217 |
@begin{ImplPerm} |
| 218 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 219 |
@ChgAdded{Version=[2],Text=[An implementation running on a system that does |
| 220 |
not support environment variables is permitted to define the operations of |
| 221 |
package Environment_Variables with the semantics corresponding to the case |
| 222 |
where the external execution environment does support environment variables. In |
| 223 |
this case, it shall provide a mechanism to initialize a nonempty set of |
| 224 |
environment variables prior to the execution of a partition.]} |
| 225 |
@end{ImplPerm} |
| 226 |
|
| 227 |
@begin{ImplAdvice} |
| 228 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 229 |
@ChgAdded{Version=[2],Text=[If the execution environment supports subprocesses, |
| 230 |
the currently defined environment variables should be used to initialize the |
| 231 |
environment variables of a subprocess.]} |
| 232 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 233 |
Text=[If the execution environment supports subprocesses, |
| 234 |
the current environment variables should be used to initialize the |
| 235 |
environment variables of a subprocess.]}]} |
| 236 |
|
| 237 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 238 |
@ChgAdded{Version=[2],Text=[Changes to the environment variables made outside the control of this package |
| 239 |
should be reflected immediately in the effect of the operations of this package. |
| 240 |
Changes to the environment variables made using this package should be reflected |
| 241 |
immediately in the external execution environment. This package should not |
| 242 |
perform any buffering of the environment variables.]} |
| 243 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 244 |
Text=[Changes to the environment variables made outside the control of |
| 245 |
Environment_Variables should be reflected immediately.]}]} |
| 246 |
|
| 247 |
@end{ImplAdvice} |
| 248 |
|
| 249 |
@begin{Extend95} |
| 250 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 251 |
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95} |
| 252 |
Package Environment_Variables is new.]} |
| 253 |
@end{Extend95} |
| 254 |
|
| 255 |
@begin{Incompatible2005} |
| 256 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0285-1]} |
| 257 |
@ChgAdded{Version=[3],Text=[@Defn{incompatibilities with Ada 2005} |
| 258 |
A new overloaded function Value is added to Environment_Variables. |
| 259 |
If Environment_Variables is referenced in a @nt{use_clause}, and an entity |
| 260 |
@i<E> with the name Value is defined in a package that is also referenced in a |
| 261 |
@nt{use_clause}, the entity @i<E> may no longer be use-visible, resulting in |
| 262 |
errors. This should be rare and is easily fixed if it does occur.]} |
| 263 |
@end{Incompatible2005} |
| 264 |
|
| 265 |
|
| 266 |
@LabeledAddedSubClause{Version=[5],Name=[The Packages Wide_Environment_Variables and Wide_Wide_Environment_Variables]} |
| 267 |
|
| 268 |
@begin{Intro} |
| 269 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0021-1]} |
| 270 |
@ChgAdded{Version=[5],Text=[The packages Wide_Environment_Variables and |
| 271 |
Wide_Wide_Environment_Variables allow a program to read or modify environment |
| 272 |
variables.]} |
| 273 |
@end{Intro} |
| 274 |
|
| 275 |
@begin{StaticSem} |
| 276 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0021-1]} |
| 277 |
@ChgAdded{Version=[5],Text=[The specification of package Wide_Environment_Variables is the same as for |
| 278 |
Environment_Variables, except that each occurrence of String is replaced by |
| 279 |
Wide_String.@ChildUnit{Parent=[Ada],Child=[Wide_Environment_Variables]}]} |
| 280 |
|
| 281 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0021-1]} |
| 282 |
@ChgAdded{Version=[5],Text=[The specification of package |
| 283 |
Wide_Wide_Environment_Variables is the same as for Environment_Variables, except |
| 284 |
that each occurrence of String is replaced by |
| 285 |
Wide_Wide_String.@ChildUnit{Parent=[Ada],Child=[Wide_Wide_Environment_Variables]}]} |
| 286 |
@end{StaticSem} |
| 287 |
|
| 288 |
|
| 289 |
@begin{Extend2012} |
| 290 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0021-1]} |
| 291 |
@ChgAdded{Version=[5],Text=[@Defn{extensions to Ada 2012} |
| 292 |
These packages are new.]} |
| 293 |
@end{Extend2012} |
| 294 |
|
| 295 |
|