[pygccxml-commit] source/pyplusplus/experimental pypp_api.py,1.12,1.13
Brought to you by:
mbaas,
roman_yakovenko
From: Matthias B. <mb...@us...> - 2006-03-28 12:13:33
|
Update of /cvsroot/pygccxml/source/pyplusplus/experimental In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10368 Modified Files: pypp_api.py Log Message: Added the method log() and constructor args to enable special logging Index: pypp_api.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/experimental/pypp_api.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pypp_api.py 24 Mar 2006 17:29:16 -0000 1.12 --- pypp_api.py 28 Mar 2006 12:13:24 -0000 1.13 *************** *** 49,53 **** """ ! import os, os.path, re, time # Bring in everything I need from pyplusplus and pygccxml --- 49,53 ---- """ ! import os, os.path, re, time, types # Bring in everything I need from pyplusplus and pygccxml *************** *** 80,83 **** --- 80,86 ---- PRIVATE = ACCESS_TYPES.PRIVATE + QUERY = "query" + DECORATION = "decoration" + def cleanTemplateName(templateName): """ Build a clean template name. """ *************** *** 108,111 **** --- 111,116 ---- multiFile = False, useScope = False, + queryLog = None, + decorationLog = None, verbose = True): """Initialize module. *************** *** 135,138 **** --- 140,147 ---- @param useScope: If true the creators all use scope in their code. @type useScope: bool + @param queryLog: Query log file (file name or file-like object) + @type queryLog: str or file + @param decorationLog: Decoration log file (file name or file-like object) + @type decorationLog: str or file @param verbose: if true output status and command information as building the module. @type verbose: bool *************** *** 168,173 **** --- 177,206 ---- self.mStartTime = None # Begin of the parsing step self.mParseEndTime = None # The time when parsing was finished + + if queryLog: + self.log(QUERY, queryLog) + if decorationLog: + self.log(DECORATION, decorationLog) + print "Initialized module." + def log(self, type, logfile): + """Enable specific logging functionality. + + @param type: Identifies a log stream (QUERY or DECORATION) + @type type: str + @param logfile: The output file name or a file-like object + @type logfile: str or file + """ + if isinstance(logfile, types.StringTypes): + logfile = file(logfile, "wt") + + if type==QUERY: + declwrapper.query_log = logfile + elif type==DECORATION: + declwrapper.decoration_log = logfile + else: + raise ValueError, "Invalid log stream: %s"%type + def parse(self): |