| |
---|
| | value of \fCmyfloat\fP into a string and compare it to the |
---|
| | .B string |
---|
| | \fC"6.023"\fP on the Right Hand Side. |
---|
| | |
---|
| | Similarly, variables are coerced as strings when they are referenced |
---|
| | in substitutions: |
---|
| | |
---|
| | .ft C \" Courier |
---|
| | .nf |
---|
| | # Assume 'myfloat' has been predefined to be a floating point variable |
---|
| | # Assume 'mybool' has been predefined to be a boolean variable |
---|
| | |
---|
| | myfloat = 3.14 |
---|
| | mybool = True |
---|
| | |
---|
| | myvar = [myfloat] is [mybool] |
---|
| | |
---|
| | # This sets 'myvar' to the string '3.14 is True' |
---|
| | .fi |
---|
| | .ft \" revert |
---|
| | |
---|
| | This can be tricky when dealing with Boolean variables. As described |
---|
| | later in this document, you can do conditional tests based on the |
---|
| | .B state |
---|
| | of a Boolean, but if you do this: |
---|
| |
---|
| | .fi |
---|
| | .ft \" revert |
---|
| | |
---|
| | Where, \fCMYCONTROL\fP is a regular old string variable - i.e., It has not |
---|
| | been defined to be a boolean by either a Template or Initial Symbol table |
---|
| | been defined to be a Boolean by either a Template or Initial Symbol table |
---|
| | passed to the parser. |
---|
| | |
---|
| | .TP |
---|
| | .B VarDescriptor.Default (Default: \fCEmpty String\fP) |
---|
| |
---|
| | variables already in the symbol table, \fCtconfpy\fP does nothing to this |
---|
| | attribute. This attribute is not actually used by \fCtconfpy\fP for anything. |
---|
| | It is provided as a convenience so that the calling program can easily |
---|
| | "reset" every variable to its default value if desired. |
---|
| | |
---|
| | The one place \fCVarDescriptor.Default\fP is used within the parser is when |
---|
| | using Variable Templates. Suppose a \fCFoo\fP is a templated variable and the |
---|
| | configuration file contains the statement: |
---|
| | |
---|
| | .ft C \" Courier |
---|
| | .nf |
---|
| | Foo = |
---|
| | .fi |
---|
| | .ft \" revert |
---|
| | |
---|
| | This will reset the templated variable to its |
---|
| | .B default |
---|
| | value. This is unlike the case of a "normal" variable where such |
---|
| | a statement sets it to a null string - literally the Right Hand Side |
---|
| | contains nothing in this case. The section entitled, |
---|
| | .B Using Variable Templates |
---|
| | discusses the rationale' for these semantics. |
---|
| | |
---|
| | .TP |
---|
| | .B VarDescriptor.LegalVals (Default: \fC[]\fP) |
---|
| | |
---|
| |
---|
| | |
---|
| | .SS Some Further Notes On Boolean Variables |
---|
| | |
---|
| | One last note here concerns Boolean variables. Booleans are actually |
---|
| | stored in the symbol table as the Python boolean values, \fCTrue\fP or |
---|
| | stored in the symbol table as the Python Boolean values, \fCTrue\fP or |
---|
| | \fCFalse\fP. |
---|
| | However, \fCtconfpy\fP accepts user statements that set the value of the |
---|
| | boolean in a number of formats: |
---|
| | Boolean in a number of formats: |
---|
| | |
---|
| | .ft C \" Courier |
---|
| | .nf |
---|
| | |
---|
| |
---|
| | \fCtRUE\fP, \fCTRUE\fP, and \fCtrue\fP are all accepted, for example. |
---|
| | |
---|
| | .B NOTE HOWEVER: |
---|
| | If the user wants to do a conditional test on the value of |
---|
| | a boolean they |
---|
| | a Boolean they |
---|
| | .B must |
---|
| | observe case and test for either \fCTrue\fP or \fCFalse\fP: |
---|
| | |
---|
| | .ft C \" Courier |
---|
| |
---|
| | .fi |
---|
| | .ft \" revert |
---|
| | |
---|
| | .SH DOCUMENT REVISION INFORMATION |
---|
| | $Id: tconfpy.3,v 1.152 2005/01/19 08:31:33 tundra Exp $ |
---|
| | |
---|
| | $Id: tconfpy.3,v 1.153 2005/01/19 09:15:10 tundra Exp $ |
---|
| | |
---|
| | |