diff --git a/example.cfg b/example.cfg index 6138d19..986b85d 100644 --- a/example.cfg +++ b/example.cfg @@ -1,6 +1,6 @@ # 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. @@ -25,6 +25,7 @@ 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 ##### @@ -34,6 +35,13 @@ 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 ##### @@ -41,12 +49,6 @@ # 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 @@ -174,28 +176,34 @@ # 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 @@ -204,3 +212,34 @@ 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 +