| 1 |
@comment{ $Source: e:\\cvsroot/ARM/Source/pre_environ.mss,v $ } |
| 2 |
@comment{ $Revision: 1.8 $ $Date: 2005/12/06 06:34:05 $ $Author: Randy $ } |
| 3 |
@Part(predefenviron, Root="ada.mss") |
| 4 |
|
| 5 |
@Comment{$Date: 2005/12/06 06:34:05 $} |
| 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 |
@ChgAdded{Version=[2],Text=[@key{package} Ada.Environment_Variables @key{is}@ChildUnit{Parent=[Ada],Child=[Environment_Variables]} |
| 28 |
@key{pragma} Preelaborate(Environment_Variables);]} |
| 29 |
|
| 30 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 31 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Value} (Name : @key{in} String) @key{return} String;]} |
| 32 |
|
| 33 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 34 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Exists} (Name : @key{in} String) @key{return} Boolean;]} |
| 35 |
|
| 36 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 37 |
@ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Set} (Name : @key{in} String; Value : @key{in} String);]} |
| 38 |
|
| 39 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 40 |
@ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Clear} (Name : @key{in} String); |
| 41 |
@key{procedure} @AdaSubDefn{Clear};]} |
| 42 |
|
| 43 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 44 |
@ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Iterate} ( |
| 45 |
Process : @key{not null access procedure} (Name, Value : @key{in} String));]} |
| 46 |
|
| 47 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 48 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[@key{end} Ada.Environment_Variables;]} |
| 49 |
@end{Example} |
| 50 |
|
| 51 |
@begin{DescribeCode} |
| 52 |
|
| 53 |
@begin{Example} |
| 54 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 55 |
@ChgAdded{Version=[2],KeepNext=[T],Text=[@key{function} Value (Name : @key{in} String) @key{return} String;]} |
| 56 |
@end{Example} |
| 57 |
|
| 58 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 59 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[If the external execution |
| 60 |
environment supports environment variables, then Value returns the value of the |
| 61 |
environment variable with the given name. If no environment variable with the |
| 62 |
given name exists, then Constraint_Error is propagated. If the execution |
| 63 |
environment does not support environment variables, then Program_Error is |
| 64 |
propagated.]} |
| 65 |
|
| 66 |
@begin{Example} |
| 67 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 68 |
@ChgAdded{Version=[2],KeepNext=[T],Text=[@key{function} Exists (Name : @key{in} String) @key{return} Boolean;]} |
| 69 |
@end{Example} |
| 70 |
|
| 71 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 72 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[If the external execution environment |
| 73 |
supports environment variables and an environment variable with the given name |
| 74 |
currently exists, then Exists returns True; otherwise it returns False.]} |
| 75 |
|
| 76 |
@begin{Example} |
| 77 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 78 |
@ChgAdded{Version=[2],KeepNext=[T],Text=[@key{procedure} Set (Name : @key{in} String; Value : @key{in} String);]} |
| 79 |
@end{Example} |
| 80 |
|
| 81 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 82 |
@ChgAdded{Version=[2],Text=[If the external execution |
| 83 |
environment supports environment variables, then Set first clears any existing |
| 84 |
environment variable with the given name, and then defines a single new |
| 85 |
environment variable with the given name and value. Otherwise Program_Error is |
| 86 |
propagated.]} |
| 87 |
|
| 88 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 89 |
@ChgAdded{Version=[2],Text=[If implementation-defined circumstances prohibit |
| 90 |
the definition of an environment variable with the given name and value, then |
| 91 |
Constraint_Error is propagated.]} |
| 92 |
@ChgImplDef{Version=[2],Kind=[AddedNormal], |
| 93 |
Text=[@Chg{Version=[2],New=[The circumstances where an environment variable |
| 94 |
cannot be defined.],Old=[]}]} |
| 95 |
|
| 96 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 97 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[It is implementation defined |
| 98 |
whether there exist values for which the call Set(Name, Value) has the same |
| 99 |
effect as Clear (Name).]} |
| 100 |
@ChgImplDef{Version=[2],Kind=[AddedNormal], |
| 101 |
Text=[@Chg{Version=[2],New=[Environment names for which Set has the effect of |
| 102 |
Clear.],Old=[]}]} |
| 103 |
|
| 104 |
@begin{Example} |
| 105 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 106 |
@ChgAdded{Version=[2],KeepNext=[T],Text=[@key{procedure} Clear (Name : @key{in} String);]} |
| 107 |
@end{Example} |
| 108 |
|
| 109 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 110 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[If the external execution |
| 111 |
environment supports environment variables, then Clear deletes all existing |
| 112 |
environment variable with the given name. Otherwise Program_Error is |
| 113 |
propagated.]} |
| 114 |
|
| 115 |
@begin{Example} |
| 116 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 117 |
@ChgAdded{Version=[2],KeepNext=[T],Text=[@key{procedure} Clear;]} |
| 118 |
@end{Example} |
| 119 |
|
| 120 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 121 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[If the external execution |
| 122 |
environment supports environment variables, |
| 123 |
then Clear deletes all existing environment variables. Otherwise Program_Error |
| 124 |
is propagated.]} |
| 125 |
|
| 126 |
@begin{Example} |
| 127 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 128 |
@ChgAdded{Version=[2],KeepNext=[T],Text=[@key{procedure} Iterate ( |
| 129 |
Process : @key{not null access procedure} (Name, Value : @key{in} String));]} |
| 130 |
@end{Example} |
| 131 |
|
| 132 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 133 |
@ChgAdded{Version=[2],Text=[If the external execution environment supports |
| 134 |
environment variables, then Iterate calls the subprogram designated by Process |
| 135 |
for each existing environment variable, passing the name and value of that |
| 136 |
environment variable. Otherwise Program_Error is propagated.]} |
| 137 |
|
| 138 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 139 |
@ChgAdded{Version=[2],Text=[If several environment variables exist that have |
| 140 |
the same name, Process is called once for each such variable.]} |
| 141 |
|
| 142 |
@end{DescribeCode} |
| 143 |
@end{StaticSem} |
| 144 |
|
| 145 |
@begin{Bounded} |
| 146 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 147 |
@ChgAdded{Version=[2],Type=[Leading],Text=[@PDefn2{Term=(bounded error),Sec=(cause)} |
| 148 |
It is a bounded error to call Value if more than one environment variable |
| 149 |
exists with the given name; the possible outcomes are that:]} |
| 150 |
@begin{itemize} |
| 151 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 152 |
@ChgAdded{Version=[2],Text=[one of the values is returned, and that |
| 153 |
same value is returned in subsequent calls in the absence of changes to |
| 154 |
the environment; or]} |
| 155 |
|
| 156 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 157 |
@ChgAdded{Version=[2],Text=[Program_Error is propagated.]} |
| 158 |
@end{Itemize} |
| 159 |
@end{Bounded} |
| 160 |
|
| 161 |
@begin{Erron} |
| 162 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 163 |
@ChgAdded{Version=[2],Text=[@PDefn2{Term=(erroneous execution),Sec=(cause)} |
| 164 |
Making calls to the procedures Set or Clear concurrently with calls to any |
| 165 |
subprogram of package Environment_Variables, or to any instantiation of Iterate, |
| 166 |
results in erroneous execution.]} |
| 167 |
|
| 168 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 169 |
@ChgAdded{Version=[2],Text=[Making calls to the procedures Set or Clear in the actual subprogram |
| 170 |
corresponding to the Process parameter of Iterate results in erroneous |
| 171 |
execution.]} |
| 172 |
@end{Erron} |
| 173 |
|
| 174 |
@begin{DocReq} |
| 175 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 176 |
@ChgAdded{Version=[2],Text=[An implementation shall document how the |
| 177 |
operations of this package behave if |
| 178 |
environment variables are changed by external mechanisms (for instance, |
| 179 |
calling operating system services).]} |
| 180 |
@ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 181 |
Text=[The behavior of package Environment_Variables when environment variables |
| 182 |
are changed by external mechanisms.]}]} |
| 183 |
@end{DocReq} |
| 184 |
|
| 185 |
@begin{ImplPerm} |
| 186 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 187 |
@ChgAdded{Version=[2],Text=[An implementation running on a system that does |
| 188 |
not support environment variables is permitted to define the operations of |
| 189 |
package Environment_Variables with the semantics corresponding to the case |
| 190 |
where the external execution environment does support environment variables. In |
| 191 |
this case, it shall provide a mechanism to initialize a nonempty set of |
| 192 |
environment variables prior to the execution of a partition.]} |
| 193 |
@end{ImplPerm} |
| 194 |
|
| 195 |
@begin{ImplAdvice} |
| 196 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 197 |
@ChgAdded{Version=[2],Text=[If the execution environment supports subprocesses, |
| 198 |
the currently defined environment variables should be used to initialize the |
| 199 |
environment variables of a subprocess.]} |
| 200 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 201 |
Text=[If the execution environment supports subprocesses, |
| 202 |
the current environment variables should be used to initialize the |
| 203 |
environment variables of a subprocess.]}]} |
| 204 |
|
| 205 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 206 |
@ChgAdded{Version=[2],Text=[Changes to the environment variables made outside the control of this package |
| 207 |
should be reflected immediately in the effect of the operations of this package. |
| 208 |
Changes to the environment variables made using this package should be reflected |
| 209 |
immediately in the external execution environment. This package should not |
| 210 |
perform any buffering of the environment variables.]} |
| 211 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 212 |
Text=[Changes to the environment variables made outside the control of |
| 213 |
Environment_Variables should be reflected immediately.]}]} |
| 214 |
|
| 215 |
@end{ImplAdvice} |
| 216 |
|
| 217 |
@begin{Extend95} |
| 218 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00370-01]} |
| 219 |
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95} |
| 220 |
Package Environment_Variables is new.]} |
| 221 |
@end{Extend95} |
| 222 |
|