diff --git a/doc/doxygen/SConscript b/doc/doxygen/SConscript index a95b470..3bc870f 100644 --- a/doc/doxygen/SConscript +++ b/doc/doxygen/SConscript @@ -15,12 +15,6 @@ def print_generate_doxygen(target, source, env): def print_generate_doxygen_header(target, source, env): print "generating doxygen header ", target[0].path -def make_defs(target, source, env): - os.environ['PATH']=env['ENV']['PATH'] - env.Execute("grep -v \"#include\" "+source[0].abspath+"| "+env['CPP'] +" -C -DIMP_DOXYGEN -dM - | grep -v \"define __\" > "+target[0].abspath) -def print_make_defs(target, source, env): - print "running cpp ", str(target), str(source) - def make_output(nodes): return " "+"\\\n ".join(['"'+x.abspath+'"' for x in nodes]) @@ -106,15 +100,8 @@ def generate_doxygen(target, source, env): outfile.close() - -if not env.get('DOXYGEN', None) or not env.get('CPP', None) or not env.get('DOT', None): - print "Warning: IMP documentation requires doxygen, cpp and graphviz." - Return - env.Append(BUILDERS = {'RunDoxygen': Builder(action=env.Action(run_doxygen, print_doxygen))}) -env.Append(BUILDERS = {'MakeDefs': Builder(action=env.Action(make_defs, - make_defs))}) docdir = scons_tools.install.get_install_directory(env, 'docdir', 'html') @@ -139,25 +126,8 @@ for h in Glob("#/build/include/*.h", ondisk=False) \ + Glob("#/build/include/IMP/*/*.h", ondisk=False): if h.path.find("internal")==-1: rawheaders.append(h) -headers=[] -config=[] -# leftover from attempt to get things to work with 1.6.1. -macros=[] -for h in rawheaders: - if h.path.endswith('macros.h'): - macros.append(h) - elif h.path.endswith('config.h'): - config.append(h) - else: - headers.append(h) - -headers= config+macros+headers -macrodef=[] -for m in macros: - nm='generated/' + m.abspath[m.abspath.rfind("/")+1:]+".def" - #print nm - macrodef.append(env.MakeDefs(source=m, target=nm)) -sources = headers + macrodef + +sources = rawheaders for d in ["#/kernel/doc/", "#/modules/*/doc/", "#/kernel/examples/", diff --git a/doc/doxygen/doxygen.conf-in b/doc/doxygen/doxygen.conf-in index 82f0215..39a740a 100644 --- a/doc/doxygen/doxygen.conf-in +++ b/doc/doxygen/doxygen.conf-in @@ -753,8 +753,7 @@ INPUT_FILTER = # non of the patterns match the file name, INPUT_FILTER is applied. FILTER_PATTERNS = \ - *.py=@IMP_SOURCE_PATH@/doc/doxygen/doxypy.py \ - *.h=@IMP_SOURCE_PATH@/doc/doxygen/preprocess.py + *.py=@IMP_SOURCE_PATH@/doc/doxygen/doxypy.py # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source @@ -1436,13 +1435,13 @@ ENABLE_PREPROCESSING = YES # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. -MACRO_EXPANSION = NO +MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. -EXPAND_ONLY_PREDEF = YES +EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. diff --git a/doc/doxygen/preprocess.py b/doc/doxygen/preprocess.py deleted file mode 100755 index 5659623..0000000 --- a/doc/doxygen/preprocess.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/python -import sys -import re -import StringIO -import os -import tempfile -import glob -import shutil - -def handle_namespace(infile, outfile): - #print "filtering ", sys.argv[1] - txt= infile.read() - lines = txt.splitlines() - beg= re.compile("IMP[ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*_BEGIN_NAMESPACE") - end= re.compile("IMP[ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*_END_NAMESPACE") - export= re.compile("IMP[ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*EXPORT") - merge=re.compile("\\\\\\\\$") - for l in lines: - #if l=="IMP_BEGIN_NAMESPACE": - # print >> outfile, "#1" - # outfile.write("namespace IMP {\n") - #elif l=="IMP_END_NAMESPACE": - # print >> outfile, "#2" - # outfile.write("}\n") - if beg.match(l): - #print "match 0" - #print >> outfile, "#3" - mname= l[3:l.find("_")] - outfile.write("namespace IMP {\n") - if mname!="": - outfile.write("namespace "+ mname.lower()+ "{\n") - elif end.match(l): - #print "match 1" - #print >> outfile, "#4" - outfile.write("}\n}\n") - elif merge.search(l): - #print>>sys.stderr, "merging ", l - outfile.write(l) - elif export.search(l): - #print "match 2" - #print >> outfile, "#5" - mo= export.search(l) - #print "found", mo.start, mo.end - outfile.write(l[0:mo.start()]) - outfile.write(l[mo.end():]) - outfile.write("\n") - elif l.startswith("#include"): - #print >> outfile, "#6" - pass - else: - #print >> outfile, "#7" - #print "HITHERE" - outfile.write(l) - outfile.write("\n") - -def cleanup(infile): - txt= infile.read() - lines = txt.splitlines() - for l in lines: - if len(l)>0 and l[0]=="#": - pass - else: - print l.replace("##", "").replace("#", "") - -def main(): - txt= open(sys.argv[1]) - #if sys.argv[1].endswith("/macros.h"): - # open("/tmp/macros.h", "w").write(txt.read()) - if sys.argv[1].endswith("macros.h"): - print txt.read() - else: - pns= StringIO.StringIO() - defs= glob.glob('doc/doxygen/generated/*.def') - macros=[] - for d in defs: - macros.append("-imacros") - macros.append(d) - handle_namespace(txt, pns) - tmpdir = tempfile.mkdtemp() - infile = os.path.join(tmpdir, 'pns.h') - outfile = os.path.join(tmpdir, 'cppout') - try: - open(infile, "w").write(pns.getvalue()) - command="cpp -C "+ " ".join(macros) + " %s > %s" % (infile, outfile) - ret=os.system(command) - if ret != 0: - lns= pns.getvalue().split("\n") - #for i in range(0, len(lns)): - # print >>sys.stderr, i, lns[i] - else: - print "ok" - cleanup(open(outfile, "r")) - finally: - shutil.rmtree(tmpdir, ignore_errors=True) - -if __name__ == '__main__': - main()