| | # A 'tconfpy' Example Configuration File |
---|
| | # Copyright 2003-2004 TundraWare Inc. |
---|
| | # $Id: example.cfg,v 1.101 2004/04/21 21:03:49 tundra Exp $ |
---|
| | # $Id: example.cfg,v 1.102 2004/04/21 21:16:04 tundra Exp $ |
---|
| | # |
---|
| | # This is designed to illustrate the various features |
---|
| | # of the 'tconfpy' configuration language. |
---|
| | # |
---|
| |
---|
| | ##### |
---|
| | |
---|
| | foo = 123 # Creates variable 'foo' and sets its value to "123" |
---|
| | foo = bar # Changes the value of 'foo' to "bar" |
---|
| | Foo = blat # Variable names are case sensistive: New variable 'Foo' introduced here |
---|
| | |
---|
| | |
---|
| | ##### |
---|
| | # Variable References - Getting The Value Of A Variable |
---|
| | ##### |
---|
| | |
---|
| | boing = [foo] # Creates variable 'boing' and sets its value to "bar" |
---|
| | |
---|
| | ##### |
---|
| | # Indirect variable access |
---|
| | ##### |
---|
| | |
---|
| | [foo] = baz # Creates variable 'bar' and sets its value to "baz" |
---|
| | |
---|
| | |
---|
| | ##### |
---|
| | # Accessing Environment Variables |
---|
| | ##### |
---|
| |
---|
| | boo = [$USER] # Creates varaible 'boo' and assigns it the value |
---|
| | # of the environment variable 'USER'. This will |
---|
| | # cause an error of 'USER' is not defined. |
---|
| | |
---|
| | ##### |
---|
| | # Indirect variable access |
---|
| | ##### |
---|
| | |
---|
| | [foo] = baz # Creates variable 'bar' and sets its value to "baz" |
---|
| | |
---|
| | |
---|
| | ##### |
---|
| | # Namespaces |
---|
| | ##### |
---|
| |
---|
| | |
---|
| | # Some of these examples purposely introduce a type/value |
---|
| | # error to illustrate how 'tconfpy' does validation. |
---|
| | |
---|
| | |
---|
| | # Write Protection |
---|
| | |
---|
| | ro1 = Something # Error: 'ro1' is a Read Only variable |
---|
| | |
---|
| | |
---|
| | # Type Enforcement |
---|
| | |
---|
| | int1 = 4s # Error: 'int1' only accepts integers |
---|
| | int1 = 4s # Error: 'int1' only accepts integers |
---|
| | |
---|
| | |
---|
| | # Value Enforcement |
---|
| | |
---|
| | int1 = 11 # Error: Value must be one of 1, 2, or 23 |
---|
| | int1 = 11 # Error: Value must be one of 1, 2, or 23 |
---|
| | |
---|
| | |
---|
| | # Value Enforcement For Namespace Names |
---|
| | |
---|
| | # You can make this fail if you supply 'test-tc.py' the 'limitns' option |
---|
| | |
---|
| | [XYZ] # Error: Namespaces are limited to strings starting with 'NS' |
---|
| | [] # But this always works because the root namespace is always legal |
---|
| | [XYZ] # Error: Namespaces are limited to strings starting with 'NS' |
---|
| | [] # But this always works because the root namespace is always legal |
---|
| | |
---|
| | |
---|
| | # Enforcing String Content |
---|
| | |
---|
| | str1 = box # Fine |
---|
| | str1 = bax # Also Fine |
---|
| | str1 = Bax # Also Fine |
---|
| | str1 = FunStuff # Error: Does not match any of the validation regular expressions |
---|
| | |
---|
| | # Enforcing String Lengths |
---|
| | |
---|
| |
---|
| | str1 = ab # Too short: must be at least 3 characters long |
---|
| | str1 = abcccccccccccc # Too long: must be 8 or less characters long |
---|
| | |
---|
| | |
---|
| | # Setting Booleans |
---|
| | |
---|
| | # This is the one case where the right-hand-side of the assignment is |
---|
| | # INsensitive to case. |
---|
| | |
---|
| | # Booleans can be set with: Yes/No, True/False, 1/0, and On/Off |
---|
| | |
---|
| | bool1 = yEs |
---|
| | bool1 = 0 |
---|
| | bool1 = yessir # Error: Unrecognized boolean value |
---|
| | |
---|
| | # No matter how you set it, the *value* of a boolean is always stored as |
---|
| | # 'True' or 'False'. This matters when doing Comparison Conditionals |
---|
| | |
---|
| | .if [bool1] == False |
---|
| | |
---|
| | bool1was = False |
---|
| | |
---|
| | .else |
---|
| | |
---|
| | bool1was = True |
---|
| | |
---|
| | .endif |
---|
| | |
---|
| | .if [bool1] == Off # Will always be false - a boolean never takes on |
---|
| | # the value of anything other than 'True' or 'False' |
---|
| | # something |
---|
| | |
---|
| | .endif |
---|
| | |
---|
| | |
---|
| | |