Fix a type in Secion LP. Thanks for Jacint
3 # This file is a part of LEMON, a generic C++ optimization library.
5 # Copyright (C) 2003-2010
6 # Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 # (Egervary Research Group on Combinatorial Optimization, EGRES).
9 # Permission to use, modify and distribute this software is granted
10 # provided that this copyright notice appears in all copies. For
11 # precise terms see the accompanying LICENSE file.
13 # This software is provided "AS IS" with no warranty of any kind,
14 # express or implied, and with no claim as to its suitability for any
26 def sec_inc(section, lev):
27 while len(section)<lev:
40 def compare_sec(id1, id2):
44 c1=c1*max_sec_number+int(s)
45 for i in range(len(id1), max_sec_depth+1):
50 c2=c2*max_sec_number+int(s)
51 for i in range(len(id2), max_sec_depth+1):
61 for doxfile in os.listdir('.'):
62 if doxfile[-4:]=='.dox':
63 for l in open(doxfile).readlines():
64 gr = re.match(r"(^[[]PAGE[]].*[[]PAGE[]])?(.*)$", l).groups()
67 page_files[page]=doxfile
70 for l in open("toc.txt").readlines():
72 if len(sl)==2 and len(sl[0])>0:
74 section=sec_inc(section,lev)
75 t_sec=copy.copy(section)
77 print format_sec(t_sec),t_link
78 ind[t_link]=[t_sec,'','']
80 ind[t_link][1]=prev_page
82 ind[prev_page][2]=t_link
84 ordered_pages.append(t_link)
85 toc[format_sec(t_sec)]=t_link
87 for doxfile in os.listdir('.'):
88 if doxfile[-4:]=='.dox':
89 print 'Generate ',doxfile
91 fo=open(os.path.join("gen-dox",doxfile),"w")
92 for l in open(doxfile).readlines():
93 gr = re.match(r"(^[[]PAGE[]].*[[]PAGE[]])?(^[[]SEC[]].*[[]SEC[]])?(^[[]TRAILER[]])?(^[[]TOC[]])?(.*)$", l).groups()
96 fo.write("\page %s %s%s\n"%(page,
97 format_sec(ind[page][0]),gr[4]))
100 fo.write("\section %s %s%s\n"%(sec,
101 format_sec(ind[sec][0]),gr[4]))
103 prev_page=ind[page][1]
105 prev_str= ( '<< \\ref '+prev_page+' ')
108 next_page=ind[page][2]
110 next_str= ( ' \\ref '+next_page+' >>')
113 fo.write('%s| \\ref sec_toc "Home" |%s\n'%\
116 secs = [ x for x in toc ]
117 secs.sort(compare_sec)
119 fo.write("%s - \\ref %s\n"%(' '*((len(ind[toc[num]][0]))),
125 fpdf=open(os.path.join("gen-pdf-dox","full.dox"),"w")
126 for doxfile in [page_files[p] for p in ordered_pages]:
128 for l in open(doxfile).readlines():
129 gr = re.match(r"(^[[]PAGE[]].*[[]PAGE[]])?(^[[]SEC[]].*[[]SEC[]])?(^[[]TRAILER[]])?(^[[]TOC[]])?(.*)$", l).groups()
132 fpdf.write("\page %s %s\n"%(page,gr[4]))
135 fpdf.write("\section %s %s\n"%(sec,gr[4]))
141 fpdf.write(gr[4]+'\n')