a = subprocess.Popen("cpp -E -dD -Iinclude/ include/editeng/eeitem.hxx", stdout=subprocess.PIPE, shell=True)
with a.stdout as txt: for line in txt:
line = line.strip()
originalLine = line ifnot line.startswith("#define "): continue # strip the '#define' off the front
idx1 = line.find(" ")
line = line[idx1:len(line)].strip() # extract the name
idx1 = line.find(" ") if (idx1 == -1): continue
macroName = line[0:idx1].strip()
line = line[idx1:len(line)].strip() # ignore internal stuff if macroName.startswith("_"): continue # strip any trailing comments
idx1 = line.find("//") if (idx1 != -1):
line = line[0:idx1].strip()
idx1 = line.find("/*") if (idx1 != -1):
line = line[0:idx1].strip() if len(line) == 0: continue # strip brackets if line[0] == "(":
line = line[1:] if line[len(line)-1] == ")":
line = line[0:len(line)-1]
macroValue = line.strip() # ignore macros that #define strings, not interested in those if (macroValue.find("\"") != -1): continue # ignore the multiline macros if (macroValue.find("\\") != -1): continue # check for redefinitions if macroNameToValue.has_key(macroName):
print("Redefinition:\n\t", macroNameToOriginalLine[macroName], "\n\t", originalLine) else:
macroNameToValue[macroName] = macroValue
macroNameToOriginalLine[macroName] = originalLine
# decode the constants into their numeric values recursively
macroValueToName = dict() for macroName in macroNameToValue:
macroValue = macroNameToValue[macroName] try:
macroValue = extractMacroValue(macroName)
macroValueToName[macroValue] = macroName except KeyError:
print("warning: could not decode macro ", macroName)
for macroValue in sorted(macroValueToName):
macroName = macroValueToName[macroValue]
print(repr(macroNameToValue[macroName]).rjust(5), " ", macroName)
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.1Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.