import sys, os, re HEADER="""
"""

FOOTER="""
""" prefixes = [ 'fz_', 'pdf_', 'xps_', 'cbz_', 'pdfapp_' ] def is_public(s): for prefix in prefixes: if s.startswith(prefix): return True return False def load_tags(): tags = {} for line in open("tags-xref").readlines(): ident, type, line, file, text = line.split(None, 4) if not is_public(ident): continue if type == 'function': tags[ident] = '%s' % (os.path.basename(file), line, ident) if type == 'typedef' or type == 'struct': tags[ident] = '%s' % (os.path.basename(file), line, ident) return tags tags = load_tags() def quote(s): return s.replace('&','&').replace('<','<').replace('>','>') print HEADER N = 1 for line in sys.stdin.readlines(): # expand tabs, html-quote special characters and colorize comments line = line.replace('\t', ' ').rstrip() line = quote(line) line = line.replace("/*", '/*') line = line.replace("*/", '*/') line = re.sub('^#include "([a-z-]*\.h)"', '#include "\\1"', line) # find identifiers and hyperlink to their definitions words = re.split("(\W+)", line) line = "" for word in words: if word in tags: word = tags[word] line += word #print('%4d %s' % (N, N, line)) print('%s' % (N, line)) N = N + 1 print FOOTER