diff --git a/tconfpy.py b/tconfpy.py index 88bde63..0e948c1 100755 --- a/tconfpy.py +++ b/tconfpy.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "tconfpy" -RCSID = "$Id: tconfpy.py,v 1.168 2004/04/13 21:40:07 tundra Exp $" +RCSID = "$Id: tconfpy.py,v 1.169 2004/04/13 23:06:01 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -288,31 +288,32 @@ # Messages -Messages["eBADCOND"] = FILENUM + "Bad '%s' Directive. %s" -Messages["eBADREGEX"] = FILENUM + "Bad Regular Expression, '%s', In Legal Values List For Variable '%s'" -Messages["eBADSYNTAX"] = FILENUM + "Syntax Error. Statement Not In Known Form" -Messages["eCONFOPEN"] = FILENUM + "Cannot Open The File '%s'" -Messages["eDESCRIPTBAD"] = "API Error: %s For Variable '%s'" -Messages["eELSENOIF"] = FILENUM + "'%s' Without Preceding '%s' Form" % (ELSE, IF) -Messages["eENDIFEXTRA"] = FILENUM + "'" + ENDIF + "' Without Matching Condition" -Messages["eENDIFMISS"] = FILENUM + "Missing %d" + " '%s' " % ENDIF + " Statement(s)" -Messages["eEQUIVEXTRA"] = FILENUM + "Only a single '%s' Or '%s' Operator Permitted" % (EQUIV, NOTEQUIV) -Messages["eIFEXTRATXT"] = FILENUM + "Extra Text On Line. '%s' Only Accepts Variable References As Arguments" -Messages["eNAMESPACENEW"] = FILENUM + "New Namespace Creation Not Permitted. Current Namespace Unchanged: '%s'" -Messages["eNOTLEGALVAL"] = FILENUM + "'%s' Not Found In List Of Legal Values For Variable '%s'" -Messages["eSTRINGLONG"] = FILENUM + "Right-Hand-Side Too Long. '%s' Must Be No More Than %s Characters Long" -Messages["eSTRINGSHORT"] = FILENUM + "Right-Hand-Side Too Short. '%s' Must Be At Least %s Characters Long" -Messages["eTYPEBAD"] = FILENUM + "Type Mismatch. '%s' Must Be Assigned Values Of Type %s Only" -Messages["eVALLARGE"] = FILENUM + "%s Is Larger Than The Maximum Allowed, %s, For Variable '%s'" -Messages["eVALSMALL"] = FILENUM + "%s Is Smaller Than The Minimum Allowed, %s, For Variable '%s'" -Messages["eVARNAMESPC"] = FILENUM + "Variable Names May Not Contain Whitespace" -Messages["eVARHASDELIM"] = FILENUM + "Variable Names May Not Include The '%s' Or '%s' Characters" % (DELIML, DELIMR) -Messages["eVARILLEGAL"] = FILENUM + "'%s' Is An Illegal Variable Name Here. Begins With '%s' Symbol" -Messages["eVARNEW"] = FILENUM + "New Variable Creation Not Permitted" -Messages["eVARNONAME"] = FILENUM + "Variable Name Evaluates To Null String. Not Permitted" -Messages["eVARREADONLY"] = FILENUM + "Variable '%s' Is Read-Only. Cannot Change Its Value" -Messages["eVARREFNEST"] = FILENUM + "Nested Variable References Are Not Permitted" -Messages["eVARUNDEF"] = FILENUM + "Attempt To Reference Undefined Variable '%s'" +Messages["eBADCOND"] = FILENUM + "Bad '%s' Directive. %s" +Messages["eBADREGEX"] = FILENUM + "Bad Regular Expression, '%s', In Legal Values List For Variable '%s'" +Messages["eBADSYNTAX"] = FILENUM + "Syntax Error. Statement Not In Known Form" +Messages["eCONFOPEN"] = FILENUM + "Cannot Open The File '%s'" +Messages["eDESCRIPTBAD"] = "API Error: %s For Variable '%s'" +Messages["eELSENOIF"] = FILENUM + "'%s' Without Preceding '%s' Form" % (ELSE, IF) +Messages["eENDIFEXTRA"] = FILENUM + "'" + ENDIF + "' Without Matching Condition" +Messages["eENDIFMISS"] = FILENUM + "Missing %d" + " '%s' " % ENDIF + " Statement(s)" +Messages["eEQUIVEXTRA"] = FILENUM + "Only a single '%s' Or '%s' Operator Permitted" % (EQUIV, NOTEQUIV) +Messages["eIFEXTRATXT"] = FILENUM + "Extra Text On Line. '%s' Only Accepts Variable References As Arguments" +Messages["eNAMESPACEILLEGAL"] = FILENUM + "'%s' Is An Illegal Namespace. Begins With '%s' Symbol" +Messages["eNAMESPACENEW"] = FILENUM + "New Namespace Creation Not Permitted. Current Namespace Unchanged: '%s'" +Messages["eNOTLEGALVAL"] = FILENUM + "'%s' Not Found In List Of Legal Values For Variable '%s'" +Messages["eSTRINGLONG"] = FILENUM + "Right-Hand-Side Too Long. '%s' Must Be No More Than %s Characters Long" +Messages["eSTRINGSHORT"] = FILENUM + "Right-Hand-Side Too Short. '%s' Must Be At Least %s Characters Long" +Messages["eTYPEBAD"] = FILENUM + "Type Mismatch. '%s' Must Be Assigned Values Of Type %s Only" +Messages["eVALLARGE"] = FILENUM + "%s Is Larger Than The Maximum Allowed, %s, For Variable '%s'" +Messages["eVALSMALL"] = FILENUM + "%s Is Smaller Than The Minimum Allowed, %s, For Variable '%s'" +Messages["eVARNAMESPC"] = FILENUM + "Variable Names May Not Contain Whitespace" +Messages["eVARHASDELIM"] = FILENUM + "Variable Names May Not Include The '%s' Or '%s' Characters" % (DELIML, DELIMR) +Messages["eVARILLEGAL"] = FILENUM + "'%s' Is An Illegal Variable Name Here. Begins With '%s' Symbol" +Messages["eVARNEW"] = FILENUM + "New Variable Creation Not Permitted" +Messages["eVARNONAME"] = FILENUM + "Variable Name Evaluates To Null String. Not Permitted" +Messages["eVARREADONLY"] = FILENUM + "Variable '%s' Is Read-Only. Cannot Change Its Value" +Messages["eVARREFNEST"] = FILENUM + "Nested Variable References Are Not Permitted" +Messages["eVARUNDEF"] = FILENUM + "Attempt To Reference Undefined Variable '%s'" ########### @@ -865,6 +866,11 @@ if not ALLOWNEWNS and ns != SymTable[NAMESPACE].Value and ns not in SymTable[NAMESPACE].LegalVals: ErrorMsg("eNAMESPACENEW", (cfgfile, linenum, SymTable[NAMESPACE].Value)) + # Make sure the namespace does not start with the ENVIRO introducer + + elif ns and ns[0] == ENVIRO: + ErrorMsg("eNAMESPACEILLEGAL", (cfgfile, linenum, ns, ENVIRO)) + # Install the new namespace else: @@ -1063,6 +1069,9 @@ elif EQUAL in line: + # Flag to set whether existing variable should be updated + update = True + if not CondStack[-1][1]: if DEBUG: DebugMsg("dLINEIGNORE", (cfgfile, linenum, orig, dNOTINCLUDE)) @@ -1089,7 +1098,6 @@ l = line[:e].strip() r = line[e+1:].strip() - # Make sure the variable name has no spaces in it if VarWhite.match(l): @@ -1137,10 +1145,15 @@ # Flag attempts to create new namespaces if this is disabled if not ALLOWNEWNS and r != SymTable[NAMESPACE].Value and r not in SymTable[NAMESPACE].LegalVals: ErrorMsg("eNAMESPACENEW", (cfgfile, linenum, SymTable[NAMESPACE].Value)) + update = False + # Make sure the new namespace does not start with the ENVIRO introducer + elif r and r[0] == ENVIRO: + ErrorMsg("eNAMESPACEILLEGAL", (cfgfile, linenum, r, ENVIRO)) + update = False + # Install the new namespace else: - if l == NSSEP + NAMESPACE: l=NAMESPACE @@ -1199,7 +1212,6 @@ # in that variable's descriptor else: - update = True des = SymTable[l] typ = des.Type lv = des.LegalVals