CPIPMain¶
CPIPMain.py – Preprocess the file or the files in a directory.
-
class
cpip.CPIPMain.FigVisitorDot(lenPrefix=0)¶ Simple visitor that collects parent/child links for plotting the graph with dot.
-
visitGraph(theFigNode, theDepth, theLine)¶ .
-
-
class
cpip.CPIPMain.FigVisitorLargestCommanPrefix¶ Simple visitor that walks the tree and finds the largest common file name prefix.
-
visitGraph(theFigNode, theDepth, theLine)¶ Capture the file name.
-
-
class
cpip.CPIPMain.MainJobSpec(incHandler, preDefMacros, preIncFiles, diagnostic, pragmaHandler, keepGoing, conditionalLevel, dumpList, helpMap, includeDOT, cmdLine, gccExtensions)¶ -
cmdLine¶ Alias for field number 10
-
conditionalLevel¶ Alias for field number 6
-
diagnostic¶ Alias for field number 3
-
dumpList¶ Alias for field number 7
-
gccExtensions¶ Alias for field number 11
-
helpMap¶ Alias for field number 8
-
incHandler¶ Alias for field number 0
-
includeDOT¶ Alias for field number 9
-
keepGoing¶ Alias for field number 5
-
pragmaHandler¶ Alias for field number 4
-
preDefMacros¶ Alias for field number 1
-
preIncFiles¶ Alias for field number 2
-
-
class
cpip.CPIPMain.PpProcessResult(ituPath, indexPath, tuIndexFileName, total_files, total_lines, total_bytes)¶ -
indexPath¶ Alias for field number 1
-
ituPath¶ Alias for field number 0
-
total_bytes¶ Alias for field number 5
-
total_files¶ Alias for field number 3
-
total_lines¶ Alias for field number 4
-
tuIndexFileName¶ Alias for field number 2
-
-
cpip.CPIPMain.main()¶ Processes command line to preprocess a file or a directory.
-
cpip.CPIPMain.preProcessFilesMP(dIn, dOut, jobSpec, glob, recursive, jobs)¶ Multiprocessing code to preprocess directories. Returns a count of ITUs processed.
-
cpip.CPIPMain.preprocessDirToOutput(inDir, outDir, jobSpec, globMatch, recursive, numJobs)¶ Pre-process all the files in a directory. Returns a count of the TUs. This uses multiprocessing where possible. Any Exception (such as a KeyboardInterupt) will terminate this function but write out an index of what has been achieved so far.
-
cpip.CPIPMain.preprocessFileToOutput(ituPath, outDir, jobSpec)¶ Preprocess a single file. May raise ExceptionCpip (or worse!). Returns a:
PpProcessResult(ituPath, indexPath, tuIndexFileName(ituPath) total_files, total_lines, total_bytes)
-
cpip.CPIPMain.preprocessFileToOutputNoExcept(ituPath, *args, **kwargs)¶ Preprocess a single file and catch all ExceptionCpip exceptions and log them.
-
cpip.CPIPMain.retFileCountMap(theLexer)¶ Visits the Lexers file include graph and returns a dict of: {file_name : (inclusion_count, line_count, bytes_count).
The line_count, bytes_count are obtained by reading the file.
-
cpip.CPIPMain.retOptionMap(theOptParser, theOpts)¶ Returns map of {opt_name : (value, help), ...} from the current options.
-
cpip.CPIPMain.writeIndexHtml(theItuS, theOutDir, theJobSpec, time_start, total_files, total_lines, total_bytes)¶ Writes the top level index.html page for a pre-processed file.
theOutDir - The output directory.
theTuS - The list of translation units processed.
theCmdLine - The command line as a string.
theOptMap is a map of {opt_name : (value, help), ...} from the command line options. TODO: This is fine but has too many levels of indent.
-
cpip.CPIPMain.writeTuIndexHtml(theOutDir, theTuPath, theLexer, theFileCountMap, theTokenCntr, hasIncDot, macroHistoryIndexName)¶ Write the index.html for a single TU.
- theOutDir
- The output directory to write to.
- theTuPath
- The path to the original ITU.
- theLexer
- The pre-processing Lexer that has pre-processed the ITU/TU.
- theFileCountMap
- dict of {file_path : data, ...} where data is things like inclusion count, lines, bytes and so on.
- theTokenCntr
cpip.core.PpTokenCount.PpTokenCountcontaining the token counts.- hasIncDot
- bool to emit graphviz .dot files.
- macroHistoryIndexName
- String of the filename of the macro history.
Returns: (total_files, total_lines, total_bytes) as integers.