diff --git a/tconfpy.3 b/tconfpy.3 index 7679df9..1dbe39e 100644 --- a/tconfpy.3 +++ b/tconfpy.3 @@ -73,6 +73,12 @@ \'tconfpy.\'. So \'retval=ParseConfig(...\' becomes \'retval = tconfpy.ParseConfig(...\' and so on. +You will also find the test driver code provided in the \*(TC package +helpful as you read through the following sections. \'test-tc.py\' is +a utility to help you learn and exercise the \*(TC API. Perusing the +code therein is helpful as an example of the topics discussed below. + + .SS API Overview The \*(TC API consists of a single call. Only the configuration file to be processed is a required parameter, all the others are optional @@ -91,35 +97,54 @@ where: -.B cfgfile - The the name of a file containing configuration information +.fi -.B InitialSymTbl - A pre-populated symbol table (a Python dictionary). Defaults to - an empty symbol table. As described below, this must contain - valid \'VarDescriptor\' entries for each symbol in the table. +.TP +.B cfgfile (Required Parameter - No Default) -.B AllowNewVars - Allow the user to create new variables in the configuration - file. Defaults to True. -.B AllowNewNamespaces - Allow new namespaces to be created in the configuration file. - Defaults to True. +The the name of a file containing configuration information -.B Debug - Defaults to False. If set to True, \*(TC will provide detailed - debugging information about each line processed when it returns. +.TP +.B InitialSymTbl (Default: {}) -.B LiteralVars - Defaults to False. If set to True this option Enables variable - substitutions within \'.literal\' blocks of a configuration file. - See the section in the language reference below on \'.literal\' - usage for details. +A pre-populated symbol table (a Python dictionary). As described +below, this must contain valid \'VarDescriptor\' entries for each +symbol in the table. + +.TP +.B AllowNewVars (Default: True) + + +Allow the user to create new variables in the configuration file. + +.TP +.B AllowNewNamespaces (Default: True) + + +Allow new namespaces to be created in the configuration file. + +.TP +.B Debug (Default: False) + + +If set to True, \*(TC will provide detailed debugging information +about each line processed when it returns. + +.TP +.B LiteralVars (Default: False) + + +If set to True this option enables variable substitutions within +\'.literal\' blocks of a configuration file. See the section in the +language reference below on \'.literal\' usage for details. + +.TP .B retval - An object of type \'tconfpy.RetObj\' used to return parsing - results. + + +An object of type \'tconfpy.RetObj\' used to return parsing results. .SS Reasons For Passing An Initial Symbol Table @@ -225,8 +250,8 @@ When \*(TC encounters a new variable in a configuration file, it just instantiates one of these descriptor objects with these defaults for that variable. That is, variables newly-defined in a configuration -file are entered into the symbol table as string types with no -restriction on content or length. +file are entered into the symbol table as string types, with an +initial value of "" and with no restriction on content or length. But, when you create variables under program control to "prime" an initial symbol table, you can modify the content of any of these @@ -241,13 +266,14 @@ .TP .B VarDescriptor.Value (Default: Empty String) -Hold the current value for the variable. +Holds the current value for the variable. .TP .B VarDescriptor.Writeable (Default: True) Sets whether or not the user can change the variable's value. Setting -this attribute to False makes the variable "Read Only". +this attribute to False makes the variable +.B Read Only. .TP .B VarDescriptor.Type (Default: TYPE_STRING) @@ -278,18 +304,27 @@ the right-hand-side of an assignment to the type declared for that variable. The least fussy operation here is when the variable is defined as TYPE_STRING because pretty much everything can be coerced -into a string. For example, here is how \'foo = 3+8j\' is treated: +into a string. For example, here is how \'foo = 3+8j\' is treated for +different type declarations: -If VarDescriptor.Type = TYPE_COMPLEX then Var.Descriptor.Value will -hold the -.B complex number -3+8j. +.nf -If VarDescriptor.Type = TYPE_STRING then Var.Descriptor.Value will -hold the -.B string -"3+8j". +VarDescriptor.Type VarDescriptor.Value +------------------ ------------------- + +TYPE_BOOL Type Error +TYPE_COMPLEX 3+8j (A complex number) +TYPE_FLOAT Type Error +TYPE_INT Type Error +TYPE_STRING \'3+8j\' (A string) +.fi + +This is why the default type for newly-defined variables in +the configuration file is TYPE_STRING: they can accept +pretty much +.B any +value. .TP .B VarDescriptor.Default (Default: Empty String) @@ -378,6 +413,13 @@ AND of the appropriate type AND one of the legal values AND within the min/max range. +\*(TC makes no attempt to harmonize these validation +conditions with each other. If you specify a value in +\'LegalVals\' that is, say, lower than allowed by +\'Min\' you will always get an error when the user sets +the variable to that value: It passed the \'LegalVals\' +validation but failed it for \'Min\'. + One last note here concerns Boolean variables. Booleans are actually stored in the symbol table as True or False. However, \*(TC accepts user statements in a number of @@ -462,13 +504,13 @@ .fi -Note, however, that there is one big drawback to disabling -new variable creation. \*(TC processes the configuration -file on a line-by-line basis. No line "continuation" is -supported. For really long variable names and ease of -maintenance, it is sometimes helpful to create "intermediate" -variables what hold temporary values used to construct -a variable actually needed by the calling program. For example: +Note, however, that there is one big drawback to disabling new +variable creation. \*(TC processes the configuration file on a +line-by-line basis. No line "continuation" is supported. For really +long variable values and ease of maintenance, it is sometimes helpful +to create "intermediate" variables what hold temporary values used to +construct a variable actually needed by the calling program. For +example: .nf @@ -689,6 +731,7 @@ .SH INSTALLATION + There are three ways to install \*(TC depending on your preferences and type of system. In each of these installation methods you must be logged in with root authority on Unix-like systems or as the