| |
---|
| | |
---|
| | # Program Information |
---|
| | |
---|
| | PROGNAME = "tconfpy" |
---|
| | RCSID = "$Id: tconfpy.py,v 1.142 2004/03/25 01:29:17 tundra Exp $" |
---|
| | RCSID = "$Id: tconfpy.py,v 1.143 2004/03/25 04:42:50 tundra Exp $" |
---|
| | VERSION = RCSID.split()[2] |
---|
| | |
---|
| | # Copyright Information |
---|
| | |
---|
| |
---|
| | ########### |
---|
| | |
---|
| | # Literals |
---|
| | |
---|
| | eERROR = "ERROR" |
---|
| | |
---|
| | eIFBAD = "'%s' Or '%s' Missing" % (EQUIV, NOTEQUIV) |
---|
| | eNOVARREF = "Must Have At Least One Variable Reference" |
---|
| | eSTARTUP = "<Program Starting>" |
---|
| | eERROR = "ERROR" |
---|
| | |
---|
| | eIFBAD = "'%s' Or '%s' Missing" % (EQUIV, NOTEQUIV) |
---|
| | eBADDEFAULT = "Type Of Default Value Does Not Agree With Type Declared" |
---|
| | eBADLEGALVAL = "Type Of One Or More LegalVals Does Not Agree With Type Declared" |
---|
| | eBADMINMAX = "Type Of Min Or Max Value Does Not Agree With Type Declared" |
---|
| | eNOTDESCRIPT = "Invalid Descriptor Type" |
---|
| | eNOVARREF = "Must Have At Least One Variable Reference" |
---|
| | eSTARTUP = "<Program Starting>" |
---|
| | |
---|
| | # Messages |
---|
| | |
---|
| | Messages["eBADCOND"] = FILENUM + "Bad '%s' Directive. %s" |
---|
| | Messages["eBADSYNTAX"] = FILENUM + "Syntax Error. Statement Not In Known Form" |
---|
| | Messages["eCONFOPEN"] = FILENUM + "Cannot Open The File '%s'" |
---|
| | Messages["eDESCRIPTBAD"] = "API Error: Bad Descriptor Passed For Variable '%s'" |
---|
| | Messages["eDESCRIPTBAD"] = "API Error: %s For Variable '%s'" |
---|
| | 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["eSTRINGLONG"] = FILENUM + "String '%s' Longer Than Max Allowed Length, %d" |
---|
| | Messages["eSTRINGSHORT"] = FILENUM + "String '%s' Shorter Than Min Allowed Length, %d" |
---|
| | Messages["eTYPEBAD"] = FILENUM + "Type Mismatch. '%s' Must Be Assigned Values Of Type %s Only" |
---|
| | Messages["eVALSMALL"] = FILENUM + "%d Is Smaller Than The Minimum Allowed, %d" |
---|
| | Messages["eVALLARGE"] = FILENUM + "%d Is Larger Than The Maximum Allowed, %d" |
---|
| | Messages["eVALLARGE"] = FILENUM + "%d Is Larger Than The Maximum Allowed, %d" |
---|
| | Messages["eVARUNDEF"] = FILENUM + "Attempt To Reference Undefined Variable '%s'" |
---|
| | |
---|
| | |
---|
| | ########### |
---|
| |
---|
| | |
---|
| | # Make sure we got a Var Descriptor Object |
---|
| | if not isinstance(des, VarDescriptor): |
---|
| | desok = False |
---|
| | detail = eNOTDESCRIPT |
---|
| | |
---|
| | # Check various entries for type agreement |
---|
| | |
---|
| | dt = des.Type |
---|
| | |
---|
| | if des.Default and type(des.Default) != dt: |
---|
| | desok = False |
---|
| | detail = eBADDEFAULT |
---|
| | |
---|
| | for lv in des.LegalVals: |
---|
| | if type(lv) != dt: |
---|
| | desok = False |
---|
| | detail = eBADLEGALVAL |
---|
| | |
---|
| | for mm in (des.Min, des.Max): |
---|
| | if mm and type(mm) != TYPE_INT: |
---|
| | desok = False |
---|
| | detail = eBADMINMAX |
---|
| | |
---|
| | # Update or error based on validity of descriptor |
---|
| | if desok: |
---|
| | SymTable[sym] = des |
---|
| | |
---|
| | # Invalid descriptor passed |
---|
| | else: |
---|
| | ErrorMsg("eDESCRIPTBAD", sym) |
---|
| | ErrorMsg("eDESCRIPTBAD", (detail, sym)) |
---|
| | return (SymTable, ErrMsgs, WarnMsgs, DebugMsgs, LiteralLines) |
---|
| | |
---|
| | # Make sure the symbol table has a valid namespace |
---|
| | |
---|
| |
---|
| | |