Newer
Older
tconfpy / example.cfg
# A 'tconfpy' Example Configuration File 
# Copyright 2003-2004 TundraWare Inc.
# $Id: example.cfg,v 1.100 2004/04/21 20:39:21 tundra Exp $
#
# This is designed to illustrate the various features
# of the 'tconfpy' configuration language.
#
# Test this out by running the following command
#
#      python test-tc.py debug litvars example.cfg
# OR   python test-tc.py symtbl debug litvars example.cfg
#
# Whitespace is ignored and used here for neatness
# Everything is case-sensitive except values for booleans


#####
# Creating And Modifing Variables
#####

foo = 123          # Creates variable 'foo' and sets its value to "123"
foo = bar          # Changes the value of 'foo' to "bar"


#####
# Variable References - Getting The Value Of A Variable
#####

boing = [foo]      # Creates variable 'boing' and sets its value to "bar"

#####
# 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
#####

[NS1]          # Changes namespace to 'NS1'

foo = 100      # Creates 'NS1.foo' and sets its value to "100'

NAMESPACE=NS2  # Changes namespace to 'NS2'

bar = [.NS1.foo]   # Sets 'NS2.bar' to "100" - notice the escaped variable reference

NAMESPACE =    # Reset namespace back to root - can also be done with [] on line by itself


#####
# Existential Conditionals
#####


# Logical AND

.ifall $USER bar  # Both environment variable 'USER' and variable 'bar' must
                  # Exist for this to be true
 
   ifall = True   # Notice you cannot use variable 'IFALL' - it is predefines as Read Only

.else             # If either or both did not exist - this is optional

    ifall = FALSE

.endif            # This is required


# Logical OR

.ifany $USER bar  # Either environment variable 'USER' or variable 'bar' must
                  # exist for this to be true
 
   ifany = TRUE

.else
 
   ifany = I don't THINK so!

.endif


# Logical NOR

.ifnone $USER bar # Neither environment variable 'USER' or variable
                  # 'bar' must exist for this to be true
 
   ifnone = TRUE

.else

   ifnone = No Way Jose'

.endif


#####
# Comparison Conditionals
#####

.if .NS2.bar == 100

    ifequ = yup

.endif

.if .NS2.bar != 1000

    ifnotequ = yup

.endif


#####
# Literal Text Processing
#####

MyMsg = Hello World!

.ifall [foo]
    .literal

      /* Here is some C Code - Variable Refs below replaced only
         if litvars option selected from test-tc.py */

      [HASH]include <stdio.h>

      main()
	{
	  printf("[MyMsg]");
	}

    .endliteral
.endif