diff --git a/test-tc.py b/test-tc.py index cbd388e..62f0d3b 100755 --- a/test-tc.py +++ b/test-tc.py @@ -3,7 +3,7 @@ # Copyright (c) 2003-2005 TundraWare Inc. All Rights Reserved. PROGNAME = "tconfpy Test Driver" -RCSID = "$Id: test-tc.py,v 1.144 2005/01/19 23:11:42 tundra Exp $" +RCSID = "$Id: test-tc.py,v 1.145 2005/01/20 09:51:33 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -208,13 +208,14 @@ if len(sys.argv) < 2: print BANNER - print "Usage: test-tc.py [symtbl] [nonewvars] [templates] [temponly] [limitns] [litvars] [nopredefs] [debug] file file ..." + print "Usage: test-tc.py [symtbl] [inmem] [nonewvars] [templates] [temponly] [limitns] [litvars] [nopredefs] [debug] file file ..." sys.exit(1) # Process all the requested configuration files, # dumping the what tconfpy returns for each one. ST = False +INMEM = False ALLOWVAR = True TEMPLATE = False TEMPONLY = False @@ -232,6 +233,9 @@ if fn == "symtbl": ST = True + elif fn == "inmem": + INMEM = True + elif fn == "nonewvars": ALLOWVAR = False @@ -257,6 +261,9 @@ # Everything else presumed to be a configuration file else: + # Preserve the file name for later use + name = fn + # The default is no pre-defined symbols st = SymbolTable() @@ -296,8 +303,20 @@ if TEMPLATE: tl = BuildSymTbl(templs, istemplate=True) - + # Support for in-memory parsing + + if INMEM: + fn = [] + + try: + x=open(name) + fn = x.readlines() + x.close() + + except: + print "Cannot Open File: '%s'!" % name + # Call the parser and process the results retval = ParseConfig(fn, @@ -314,9 +333,9 @@ print "Total Lines Processed: %s " % retval.TotalLines if retval.ErrMsgs: - print "Errors Were Found In '%s'!" % fn + print "Errors Were Found In '%s'!" % name else: - print "No Errors Found In '%s'!" % fn + print "No Errors Found In '%s'!" % name print