next up previous
Next: adding a directive/assertion Up: Code Examples Previous: simplify()ing the rhs

adding a switch to Polaris

Adding a switch to Polaris is very easy. You simply edit the file /groups/polaris/switches to contain a line for the switch and a default value, plus a short comment about the meaning of the switch, and the possible values of the switch. Then, within Polaris wherever you need the value which was specified for the switch (for example, a switch called ``example_sw''), you write switch_value(``example_sw'').

The intention for switches is that they be generally read-only within Polaris. They should not be used for communication between components of Polaris (set and reset multiple times by components of Polaris). However, applications built on top of Polaris may want to provide a hard-coded set of default values for some switches, and to support this, we supply the routine define_switch for setting the value. To set the switch ``example_sw'' to 3, you would use the call define_switch(``example_sw'', 3). The intention is to define the value once, then leave the switch read-only after that.



Jay Hoeflinger
Mon Apr 21 11:52:18 CDT 1997