<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<!-- %% -->
<!-- %A  options.msk                    GAP documentation             Steve Linton -->
<!-- %% -->
<!-- %A  @(#)<M>Id: options.msk,v 1.9 2002/06/07 14:04:42 gap Exp </M> -->
<!-- %% -->
<!-- %Y  (C) 1998 School Math and Comp. Sci., University of St Andrews, Scotland -->
<!-- %Y  Copyright (C) 2002 The GAP Group -->
<!-- %% -->
<Chapter Label="Options Stack">
<Heading>Options Stack</Heading>

<#Include Label="[1]{options}">


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="sect:Options Stack">
<Heading>Functions Dealing with the Options Stack</Heading>

<#Include Label="PushOptions">
<#Include Label="PopOptions">
<#Include Label="ResetOptionsStack">
<#Include Label="OnQuit">
<#Include Label="ValueOption">
<#Include Label="DisplayOptionsStack">
<#Include Label="InfoOptions">

</Section>

<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="sect:Options Stack Example">
<Heading>Options Stack &ndash; an Example</Heading>

The example below shows simple manipulation of the Options Stack,
first using <Ref Func="PushOptions"/> and <Ref Func="PopOptions"/>
and then using the special function calling syntax. 
<P/>
<Example><![CDATA[
gap> foo := function()
> Print("myopt1 = ", ValueOption("myopt1"),
>       " myopt2 = ",ValueOption("myopt2"),"\n");
> end;
function(  ) ... end
gap> foo();
myopt1 = fail myopt2 = fail
gap> PushOptions(rec(myopt1 := 17));
gap> foo();
myopt1 = 17 myopt2 = fail
gap> DisplayOptionsStack();
[ rec(
      myopt1 := 17 ) ]
gap> PopOptions();
gap> foo();
myopt1 = fail myopt2 = fail
gap> foo( : myopt1, myopt2 := [Z(3),"aardvark"]);
myopt1 = true myopt2 = [ Z(3), "aardvark" ]
gap> DisplayOptionsStack();
[  ]
gap> 
]]></Example>

</Section>
</Chapter>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<!-- %% -->
<!-- %E -->

