0
|
1 |
#
|
|
2 |
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
# All rights reserved.
|
|
4 |
# This component and the accompanying materials are made available
|
|
5 |
# under the terms of "Eclipse Public License v1.0"
|
|
6 |
# which accompanies this distribution, and is available
|
|
7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
#
|
|
9 |
# Initial Contributors:
|
|
10 |
# Nokia Corporation - initial contribution.
|
|
11 |
#
|
|
12 |
# Contributors:
|
|
13 |
#
|
|
14 |
# Description:
|
|
15 |
#
|
|
16 |
#!/usr/local/bin/perl
|
|
17 |
#
|
|
18 |
# doxy.pl
|
|
19 |
#
|
|
20 |
# THis script generates doxygen formatted documentation from source code
|
|
21 |
#
|
|
22 |
# ***********************************************************************
|
|
23 |
#
|
|
24 |
# Change history:
|
|
25 |
#
|
|
26 |
# 13.06.2005 This could be v.1.0
|
|
27 |
#
|
|
28 |
#
|
|
29 |
#
|
|
30 |
# ***********************************************************************
|
|
31 |
use strict;
|
|
32 |
use Tk;
|
|
33 |
use Tk::NoteBook;
|
|
34 |
use Tk::DirTree;
|
|
35 |
use Tk::DialogBox;
|
|
36 |
use Cwd;
|
|
37 |
use File::Copy;
|
|
38 |
my ($TOP_GIF);
|
|
39 |
$TOP_GIF='top.gif';
|
|
40 |
|
|
41 |
|
|
42 |
#
|
|
43 |
# finds doc-dirs where is Mainpage.dox
|
|
44 |
#
|
|
45 |
sub find_doc {
|
|
46 |
|
|
47 |
my ($rdir_list, $cf, $path, $last_dir, $dir);
|
|
48 |
$rdir_list = shift;
|
|
49 |
$cf = shift;
|
|
50 |
|
|
51 |
$path = cwd();
|
|
52 |
$last_dir=$path;
|
|
53 |
$last_dir=~s/.*\///;
|
|
54 |
|
|
55 |
if ($last_dir=~m/^$$cf{'document_dir'}$/) {
|
|
56 |
|
|
57 |
$path=~s/\/$$cf{'document_dir'}.*//;
|
|
58 |
|
|
59 |
if (-s $$cf{'mainpage'}) {
|
|
60 |
push(@$rdir_list, $path);
|
|
61 |
}
|
|
62 |
}
|
|
63 |
|
|
64 |
foreach $dir (<*>) {
|
|
65 |
if (-d $dir) {
|
|
66 |
chdir $dir;
|
|
67 |
&find_doc($rdir_list, $cf);
|
|
68 |
chdir "..";
|
|
69 |
}
|
|
70 |
}
|
|
71 |
}
|
|
72 |
|
|
73 |
#
|
|
74 |
# rips class hierarchy from hierarchy.html
|
|
75 |
#
|
|
76 |
sub rip_hierarchy {
|
|
77 |
my ($rlines, $line, $l_count, $page);
|
|
78 |
|
|
79 |
$rlines = shift;
|
|
80 |
$page = shift;
|
|
81 |
|
|
82 |
$l_count = 0;
|
|
83 |
open (HIERARCHY, $page);
|
|
84 |
while ($line = <HIERARCHY>) {
|
|
85 |
chomp($line);
|
|
86 |
if ($line=~m/\<\/ul\>/) {
|
|
87 |
if ($l_count==1) {
|
|
88 |
push (@$rlines, $line."\n");
|
|
89 |
}
|
|
90 |
$l_count--;
|
|
91 |
}
|
|
92 |
if ($line=~m/\<ul\>/) {
|
|
93 |
$l_count++;
|
|
94 |
}
|
|
95 |
if ($l_count > 0) {
|
|
96 |
$line=~s/\<h1\>.*\<\/h1\>//;
|
|
97 |
push (@$rlines, $line."\n");
|
|
98 |
}
|
|
99 |
#if ($line=~m/\<h1\>.*\<ul\>/) {
|
|
100 |
# $line=~s/\<h1\>.*\<\/h1\>//;
|
|
101 |
# push (@$rlines, $line."\n");
|
|
102 |
# $l_count++;
|
|
103 |
#}
|
|
104 |
}
|
|
105 |
close (HIERARCHY);
|
|
106 |
}
|
|
107 |
|
|
108 |
#
|
|
109 |
# rips class hierarchy from annotated.html
|
|
110 |
#
|
|
111 |
sub rip_annotated {
|
|
112 |
my ($rlines, $line, $page);
|
|
113 |
|
|
114 |
$rlines = shift;
|
|
115 |
$page = shift;
|
|
116 |
|
|
117 |
open (ANNOTATED, $page);
|
|
118 |
#$line = "<h1>Class Hierarchy</h1>This inheritance list is sorted roughly, but not completely, alphabetically:<ul>\n";
|
|
119 |
$line = "This inheritance list is sorted roughly, but not completely, alphabetically:<ul>\n";
|
|
120 |
push (@$rlines, $line);
|
|
121 |
while ($line = <ANNOTATED>) {
|
|
122 |
chomp($line);
|
|
123 |
if ($line=~m/.*<tr.*indexkey.*indexvalue.*tr>/) {
|
|
124 |
$line=~s/^.*<tr>.*<a//;
|
|
125 |
$line=~s/<\/td>.*$//;
|
|
126 |
$line=~s/^/<li><a/;
|
|
127 |
push (@$rlines, $line."\n");
|
|
128 |
}
|
|
129 |
}
|
|
130 |
close (ANNOTATED);
|
|
131 |
}
|
|
132 |
|
|
133 |
#
|
|
134 |
# finds right place from Mainpage.dox and inserts
|
|
135 |
# ripped lines
|
|
136 |
#
|
|
137 |
sub find_replace {
|
|
138 |
my ($rlines, $infile, $tmpfile, $cf);
|
|
139 |
$rlines = shift;
|
|
140 |
$cf = shift;
|
|
141 |
|
|
142 |
$infile = $$cf{'document_dir'}.'/'.$$cf{'mainpage'};
|
|
143 |
$tmpfile = $infile.'.tmp';
|
|
144 |
|
|
145 |
open (IN_F, $infile) or die "Cannot open input file $infile : $!";
|
|
146 |
open (TMP_F, "> $tmpfile") or die "Cannot open tmp file $tmpfile : $!";
|
|
147 |
while (<IN_F>) {
|
|
148 |
unless ((/\s*\<h1\>.*\<ul\>/) ||
|
|
149 |
(/\s*\<li\>/) ||
|
|
150 |
(/\s*\<ul\>/) ||
|
|
151 |
(/\s*\<\/ul\>/) ||
|
|
152 |
(/\s*\*\//))
|
|
153 |
{
|
|
154 |
print TMP_F $_;
|
|
155 |
}
|
|
156 |
}
|
|
157 |
print TMP_F @$rlines;
|
|
158 |
print TMP_F ' */';
|
|
159 |
close (IN_F);
|
|
160 |
close (TMP_F);
|
|
161 |
unlink $infile or die "Cannot unlink file : $!";
|
|
162 |
rename $tmpfile, $infile or die "Cannot rename file : $!";
|
|
163 |
}
|
|
164 |
|
|
165 |
#
|
|
166 |
# Decides from what file class hierarchy should be taken
|
|
167 |
# routes hierarchy lines to replace-function
|
|
168 |
#
|
|
169 |
sub update_mainpage {
|
|
170 |
my ($cf, @lines, $hierarchy, $annotated);
|
|
171 |
$cf = shift;
|
|
172 |
@lines = ();
|
|
173 |
|
|
174 |
$hierarchy = $$cf{'document_dir'}.'/hierarchy.html';
|
|
175 |
$annotated = $$cf{'document_dir'}.'/annotated.html';
|
|
176 |
|
|
177 |
if (-s $hierarchy) {
|
|
178 |
&rip_hierarchy(\@lines, $hierarchy);
|
|
179 |
}
|
|
180 |
elsif (-s $annotated) {
|
|
181 |
&rip_annotated(\@lines, $annotated);
|
|
182 |
}
|
|
183 |
|
|
184 |
if (-s $$cf{'document_dir'}.'/'.$$cf{'mainpage'}) {
|
|
185 |
&find_replace(\@lines, $cf);
|
|
186 |
}
|
|
187 |
}
|
|
188 |
|
|
189 |
#
|
|
190 |
# runs doxygen in each dir from where Mainpage.dox is found
|
|
191 |
# updates class hierarchy in Mainpage.dox
|
|
192 |
#
|
|
193 |
sub do_doxy {
|
|
194 |
my ($dir, $list, $cf, $doxy_com, $path);
|
|
195 |
$list = shift;
|
|
196 |
$cf = shift;
|
|
197 |
$path = shift() .'/'."$TOP_GIF";
|
|
198 |
|
|
199 |
$doxy_com = $$cf{'doxy_command'}.' '.$$cf{'doxyfile'};
|
|
200 |
|
|
201 |
foreach $dir (@$list) {
|
|
202 |
chdir $dir;
|
|
203 |
copy($path, $$cf{'document_dir'}.'/');
|
|
204 |
system($doxy_com) == 0
|
|
205 |
or die "Cannot execute command $doxy_com : $?";
|
|
206 |
# &update_mainpage($cf);
|
|
207 |
# system($doxy_com) == 0
|
|
208 |
# or die "Cannot execute command $doxy_com : $?";
|
|
209 |
}
|
|
210 |
}
|
|
211 |
|
|
212 |
#
|
|
213 |
# checks that configuration file item exist and is defined
|
|
214 |
#
|
|
215 |
sub check_conf_item {
|
|
216 |
my $cf = shift;
|
|
217 |
my $prop = shift;
|
|
218 |
|
|
219 |
die "$prop not found from configuration file." if !exists $$cf{$prop};
|
|
220 |
die "$prop not defined in configuration file." if !defined $$cf{$prop};
|
|
221 |
}
|
|
222 |
|
|
223 |
#
|
|
224 |
# checks configuration file items
|
|
225 |
#
|
|
226 |
sub check_configuration {
|
|
227 |
my $cf = shift;
|
|
228 |
check_conf_item ($cf, 'mainpage');
|
|
229 |
check_conf_item ($cf, 'document_dir');
|
|
230 |
check_conf_item ($cf, 'doxyfile');
|
|
231 |
check_conf_item ($cf, 'doxy_command');
|
|
232 |
check_conf_item ($cf, 'root_path');
|
|
233 |
check_conf_item ($cf, 'footer');
|
|
234 |
check_conf_item ($cf, 'header');
|
|
235 |
check_conf_item ($cf, 'stylesheet');
|
|
236 |
}
|
|
237 |
|
|
238 |
#
|
|
239 |
# loads configuration file and validates it
|
|
240 |
#
|
|
241 |
sub conf {
|
|
242 |
my $cf = shift;
|
|
243 |
my $c_file = shift;
|
|
244 |
|
|
245 |
open (CONFF, $c_file) or die "Cannot open configuration file : $!";
|
|
246 |
while (<CONFF>) {
|
|
247 |
chomp;
|
|
248 |
s/#.*//;
|
|
249 |
s/^\s+//;
|
|
250 |
s/\s+$//;
|
|
251 |
next unless length;
|
|
252 |
my ($var, $value) = split (/\s*=\s*/, $_, 2);
|
|
253 |
$$cf{$var} = $value;
|
|
254 |
}
|
|
255 |
close(CONFF);
|
|
256 |
check_configuration($cf);
|
|
257 |
}
|
|
258 |
|
|
259 |
#
|
|
260 |
# GUI : opens file browse window
|
|
261 |
#
|
|
262 |
sub gui_browse_file {
|
|
263 |
my $mp = shift;
|
|
264 |
my $top = shift;
|
|
265 |
my $ext = shift;
|
|
266 |
my $typelabel = shift;
|
|
267 |
my $type = shift;
|
|
268 |
my $initialfile = shift;
|
|
269 |
my $title = shift;
|
|
270 |
my $fi;
|
|
271 |
|
|
272 |
$fi = $$top->getOpenFile( -defaultextension => "$ext",
|
|
273 |
-filetypes =>
|
|
274 |
[["$typelabel", "$type"],
|
|
275 |
['All files', '*']
|
|
276 |
],
|
|
277 |
-initialdir => Cwd::cwd(),
|
|
278 |
-initialfile => "$initialfile",
|
|
279 |
-title => "$title"
|
|
280 |
);
|
|
281 |
$fi=~s/^.*\///;
|
|
282 |
$$mp = $fi;
|
|
283 |
}
|
|
284 |
|
|
285 |
#
|
|
286 |
# GUI : opens directory tree browser
|
|
287 |
#
|
|
288 |
sub gui_browse_root_path {
|
|
289 |
my $mp = shift;
|
|
290 |
my $top = shift;
|
|
291 |
my $fi = 0;
|
|
292 |
|
|
293 |
my $dir = Cwd::cwd();
|
|
294 |
|
|
295 |
my $popup = $$top->Toplevel(-title=>'Browse');
|
|
296 |
|
|
297 |
$popup->Scrolled('DirTree',
|
|
298 |
-scrollbars => 'osoe',
|
|
299 |
-width => 50,
|
|
300 |
-height => 30,
|
|
301 |
-selectmode => 'browse',
|
|
302 |
-exportselection => 1,
|
|
303 |
-browsecmd => sub{$dir=shift;},
|
|
304 |
-command => sub{$fi=1;}
|
|
305 |
)->pack(-fill => "both", -expand => 1);
|
|
306 |
|
|
307 |
$popup->waitVariable(\$fi);
|
|
308 |
if ($fi==1) {
|
|
309 |
$dir=~s/\//\\/g;
|
|
310 |
$$mp = $dir;
|
|
311 |
}
|
|
312 |
$popup->destroy();
|
|
313 |
}
|
|
314 |
|
|
315 |
#
|
|
316 |
# GUI : Returns constant text when pressing doxycommand default button
|
|
317 |
#
|
|
318 |
sub gui_browse_doxycommand {
|
|
319 |
my $mp = shift;
|
|
320 |
my $top = shift;
|
|
321 |
$$mp = "doxygen";
|
|
322 |
}
|
|
323 |
|
|
324 |
#
|
|
325 |
# GUI : Returns constant text when pressing docdir default button
|
|
326 |
#
|
|
327 |
sub gui_browse_docdir {
|
|
328 |
my $mp = shift;
|
|
329 |
my $top = shift;
|
|
330 |
$$mp = "doc";
|
|
331 |
}
|
|
332 |
|
|
333 |
#
|
|
334 |
# GUI : Opens configuration file browse window
|
|
335 |
#
|
|
336 |
sub gui_browse_open_conf {
|
|
337 |
my $cf = shift;
|
|
338 |
my $top = shift;
|
|
339 |
my $bk = shift;
|
|
340 |
|
|
341 |
my $fi;
|
|
342 |
|
|
343 |
$fi = $$top->getOpenFile( -defaultextension => ".conf",
|
|
344 |
-filetypes =>
|
|
345 |
[['Doxy configurationfile', '.conf'],
|
|
346 |
['All files', '*']
|
|
347 |
],
|
|
348 |
-initialdir => Cwd::cwd(),
|
|
349 |
-initialfile => '',
|
|
350 |
-title => 'Select doxy.pl configuration file'
|
|
351 |
);
|
|
352 |
&conf($cf, $fi);
|
|
353 |
$fi=~s/^.*\///;
|
|
354 |
$$bk->pageconfigure("tab1", -label => $fi);
|
|
355 |
}
|
|
356 |
|
|
357 |
#
|
|
358 |
# GUI : saves configuration file
|
|
359 |
#
|
|
360 |
sub gui_save_conf {
|
|
361 |
my $cf = shift;
|
|
362 |
my $file = shift;
|
|
363 |
my $key;
|
|
364 |
|
|
365 |
open (SAVE_FILE, "> $file")
|
|
366 |
or die "Cannot open file $file to save : $!";
|
|
367 |
|
|
368 |
foreach $key (keys %$cf) {
|
|
369 |
print SAVE_FILE "$key=$$cf{$key}\n";
|
|
370 |
}
|
|
371 |
|
|
372 |
close (SAVE_FILE);
|
|
373 |
}
|
|
374 |
|
|
375 |
#
|
|
376 |
# GUI : opens file save dialog for configuration file
|
|
377 |
#
|
|
378 |
sub gui_browse_save_conf {
|
|
379 |
my $cf = shift;
|
|
380 |
my $top = shift;
|
|
381 |
my $bk = shift;
|
|
382 |
my $fi;
|
|
383 |
my $le = $$bk->pagecget("tab1", -label);
|
|
384 |
|
|
385 |
$fi = $$top->getSaveFile( -defaultextension => ".conf",
|
|
386 |
-filetypes =>
|
|
387 |
[['Doxy configuration', '.conf'],
|
|
388 |
['All files', '*']
|
|
389 |
],
|
|
390 |
-initialdir => Cwd::cwd(),
|
|
391 |
-initialfile => $le,
|
|
392 |
-title => 'Save doxy configuration file'
|
|
393 |
);
|
|
394 |
&gui_save_conf($cf, $fi);
|
|
395 |
$fi=~s/^.*\///;
|
|
396 |
$$bk->pageconfigure("tab1", -label => $fi);
|
|
397 |
}
|
|
398 |
|
|
399 |
#
|
|
400 |
# GUI : creates menu resource
|
|
401 |
#
|
|
402 |
sub gui_create_menu {
|
|
403 |
my $top = shift;
|
|
404 |
my $cf = shift;
|
|
405 |
my $bk = shift;
|
|
406 |
|
|
407 |
my $menu =
|
|
408 |
[
|
|
409 |
[Cascade => "~File", -tearoff => 0, -menuitems =>
|
|
410 |
[
|
|
411 |
[Button => "~Open", -command => [\&gui_browse_open_conf, \%$cf, \$$top, \$$bk]],
|
|
412 |
[Button => "~Save", -command => [\&gui_browse_save_conf, \%$cf, \$$top, \$$bk]],
|
|
413 |
[Button => "~Quit", -command => sub{exit();}],
|
|
414 |
]
|
|
415 |
],
|
|
416 |
];
|
|
417 |
|
|
418 |
my $menub = $$top->Menu(-menuitems => $menu);
|
|
419 |
$$top->configure(-menu => $menub);
|
|
420 |
}
|
|
421 |
|
|
422 |
#
|
|
423 |
# GUI : handles what happens when pressing run button
|
|
424 |
#
|
|
425 |
sub gui_run {
|
|
426 |
my $cf = shift;
|
|
427 |
&check_configuration($cf);
|
|
428 |
&update_doxyfile($cf);
|
|
429 |
my (@dir_list, $path);
|
|
430 |
$path = cwd();
|
|
431 |
chdir $$cf{root_path};
|
|
432 |
&find_doc(\@dir_list, $cf);
|
|
433 |
&do_doxy(\@dir_list, $cf, $path);
|
|
434 |
chdir $path;
|
|
435 |
}
|
|
436 |
|
|
437 |
#
|
|
438 |
# GUI : creates dialog inside tab folder
|
|
439 |
#
|
|
440 |
sub gui_create_tab {
|
|
441 |
my $book = shift;
|
|
442 |
my $top = shift;
|
|
443 |
my $configuration = shift;
|
|
444 |
my $tab = shift;
|
|
445 |
my $label = shift;
|
|
446 |
|
|
447 |
my $conf_tab;
|
|
448 |
|
|
449 |
$conf_tab = $$book->add( $tab, -label=>$label );
|
|
450 |
|
|
451 |
my $frame = $conf_tab->Frame()->pack(-anchor=>'n');
|
|
452 |
|
|
453 |
$frame->Label(-text=>'')->grid(-column=>0,-row=>0,-sticky=>'ew');
|
|
454 |
$frame->Label(-text=>'')->grid(-column=>1,-row=>0,-sticky=>'ew');
|
|
455 |
$frame->Label(-text=>'')->grid(-column=>2,-row=>0,-sticky=>'ew');
|
|
456 |
|
|
457 |
|
|
458 |
$frame->Label(-text=>'Mainpage:',-anchor=>'w')->grid(-column=>0,-row=>1,-sticky=>'ew');
|
|
459 |
$frame->Entry(-textvariable=>\$$configuration{mainpage})->grid(-column=>1,-row=>1,-sticky=>'ew');
|
|
460 |
$frame->Button( -text => "Browse",
|
|
461 |
-command => [\&gui_browse_file, \$$configuration{mainpage}, \$$top, '.dox','Doxygen mainpage', '.dox', 'Mainpage.dox', 'Select mainpage filename'],
|
|
462 |
-width => 5)->
|
|
463 |
grid(-column=>2,-row=>1,-sticky=>'ew', -padx=>5, -pady=>5);
|
|
464 |
|
|
465 |
|
|
466 |
$frame->Label(-text=>'Doxyfile:',-anchor=>'w')->grid(-column=>0,-row=>2,-sticky=>'ew');
|
|
467 |
$frame->Entry(-textvariable=>\$$configuration{doxyfile})->grid(-column=>1,-row=>2,-sticky=>'ew');
|
|
468 |
$frame->Button( -text => "Browse",
|
|
469 |
-command => [\&gui_browse_file, \$$configuration{doxyfile}, \$$top,'','Doxygen configurationfile','Doxyfile','Doxyfile', 'Select doxygen configuration filename'],
|
|
470 |
-width => 5)->
|
|
471 |
grid(-column=>2,-row=>2,-sticky=>'ew', -padx=>5, -pady=>5);
|
|
472 |
|
|
473 |
$frame->Label(-text=>'Doxy command:',-anchor=>'w')->grid(-column=>0,-row=>3,-sticky=>'ew');
|
|
474 |
$frame->Entry(-textvariable=>\$$configuration{doxy_command})->grid(-column=>1,-row=>3,-sticky=>'ew');
|
|
475 |
$frame->Button( -text => "Default",
|
|
476 |
-command => [\&gui_browse_doxycommand, \$$configuration{doxy_command}, \$$top],
|
|
477 |
-width => 5)->
|
|
478 |
grid(-column=>2,-row=>3,-sticky=>'ew', -padx=>5, -pady=>5);
|
|
479 |
|
|
480 |
$frame->Label(-text=>'Document dir:',-anchor=>'w')->grid(-column=>0,-row=>4,-sticky=>'ew');
|
|
481 |
$frame->Entry(-textvariable=>\$$configuration{document_dir})->grid(-column=>1,-row=>4,-sticky=>'ew');
|
|
482 |
$frame->Button( -text => "Default",
|
|
483 |
-command => [\&gui_browse_docdir, \$$configuration{document_dir}, \$$top],
|
|
484 |
-width => 5)->
|
|
485 |
grid(-column=>2,-row=>4,-sticky=>'ew', -padx=>5, -pady=>5);
|
|
486 |
|
|
487 |
$frame->Label(-text=>'Header file:',-anchor=>'w')->grid(-column=>0,-row=>5,-sticky=>'ew');
|
|
488 |
$frame->Entry(-textvariable=>\$$configuration{header})->grid(-column=>1,-row=>5,-sticky=>'ew');
|
|
489 |
$frame->Button( -text => "Browse",
|
|
490 |
-command => [\&gui_browse_file, \$$configuration{header}, \$$top, '.html', 'Header file', '.html', 'header.html', 'Select header filename'],
|
|
491 |
-width => 5)->
|
|
492 |
grid(-column=>2,-row=>5,-sticky=>'ew', -padx=>5, -pady=>5);
|
|
493 |
|
|
494 |
$frame->Label(-text=>'Footer file:',-anchor=>'w')->grid(-column=>0,-row=>6,-sticky=>'ew');
|
|
495 |
$frame->Entry(-textvariable=>\$$configuration{footer})->grid(-column=>1,-row=>6,-sticky=>'ew');
|
|
496 |
$frame->Button( -text => "Browse",
|
|
497 |
-command => [\&gui_browse_file, \$$configuration{footer}, \$$top, '.html', 'Footer file', '.html', 'footer.html', 'Select footer filename'],
|
|
498 |
-width => 5)->
|
|
499 |
grid(-column=>2,-row=>6,-sticky=>'ew', -padx=>5, -pady=>5);
|
|
500 |
|
|
501 |
$frame->Label(-text=>'Stylesheet:',-anchor=>'w')->grid(-column=>0,-row=>7,-sticky=>'ew');
|
|
502 |
$frame->Entry(-textvariable=>\$$configuration{stylesheet})->grid(-column=>1,-row=>7,-sticky=>'ew');
|
|
503 |
$frame->Button( -text => "Browse",
|
|
504 |
-command => [\&gui_browse_file, \$$configuration{stylesheet}, \$$top,'.css','Stylesheet', '.css', 'stylesheet.css','Select stylesheet filename'],
|
|
505 |
-width => 5)->
|
|
506 |
grid(-column=>2,-row=>7,-sticky=>'ew', -padx=>5, -pady=>5);
|
|
507 |
|
|
508 |
$frame->Label(-text=>'Root path:',-anchor=>'w')->grid(-column=>0,-row=>8,-sticky=>'ew');
|
|
509 |
$frame->Entry(-textvariable=>\$$configuration{root_path})->grid(-column=>1,-row=>8,-sticky=>'ew');
|
|
510 |
$frame->Button( -text => "Browse",
|
|
511 |
-command => [\&gui_browse_root_path, \$$configuration{root_path}, \$$top],
|
|
512 |
-width => 5)->
|
|
513 |
grid(-column=>2,-row=>8,-sticky=>'ew', -padx=>5, -pady=>5);
|
|
514 |
|
|
515 |
$frame->Button( -text => "Run",
|
|
516 |
-command => [\&gui_run, \%$configuration],
|
|
517 |
-width => 5)->
|
|
518 |
grid(-column=>1,-row=>9,-sticky=>'ew', -padx=>5, -pady=>5);
|
|
519 |
|
|
520 |
}
|
|
521 |
|
|
522 |
#
|
|
523 |
# GUI : Creates GUI
|
|
524 |
#
|
|
525 |
sub gui {
|
|
526 |
my ($mw, @dir_list, $book, $tab);
|
|
527 |
my (%configuration);
|
|
528 |
|
|
529 |
$mw = new MainWindow;
|
|
530 |
$mw->geometry( "450x400" );
|
|
531 |
|
|
532 |
&gui_create_menu(\$mw, \%configuration, \$book);
|
|
533 |
|
|
534 |
$book = $mw->NoteBook()->pack( -fill=>'both', -expand=>1 );
|
|
535 |
|
|
536 |
&gui_create_tab(\$book, \$mw, \%configuration, "tab1", "Configuration");
|
|
537 |
|
|
538 |
MainLoop;
|
|
539 |
}
|
|
540 |
|
|
541 |
#
|
|
542 |
# Updates property in doxygen configuration file
|
|
543 |
#
|
|
544 |
sub update_doxyfile_item {
|
|
545 |
my $fi = shift;
|
|
546 |
my $file = shift;
|
|
547 |
my $doxfile = shift;
|
|
548 |
|
|
549 |
my $find = "($fi)(\\s*)(=)(\\s*)(.*)";
|
|
550 |
|
|
551 |
$file=~s/\\/\\\\/g;
|
|
552 |
my $replace = "\\1\\2\\3\\4$file";
|
|
553 |
|
|
554 |
system ("perl -p -i.ftr -e \"s/$find/$replace/\" $doxfile") == 0
|
|
555 |
or die "Cannot update $fi to $doxfile : $?";
|
|
556 |
}
|
|
557 |
|
|
558 |
#
|
|
559 |
# List of properties to update in doxygen configuration
|
|
560 |
#
|
|
561 |
sub update_doxyfile {
|
|
562 |
my $cf = shift;
|
|
563 |
update_doxyfile_item("HTML_HEADER", $$cf{header}, $$cf{doxyfile});
|
|
564 |
update_doxyfile_item("HTML_FOOTER", $$cf{footer}, $$cf{doxyfile});
|
|
565 |
update_doxyfile_item("HTML_STYLESHEET", $$cf{stylesheet}, $$cf{doxyfile});
|
|
566 |
update_doxyfile_item("HTML_OUTPUT", $$cf{document_dir}, $$cf{doxyfile});
|
|
567 |
#update_doxyfile_item("INCLUDE_PATH", $$cf{include_path}, $$cf{doxyfile});
|
|
568 |
}
|
|
569 |
|
|
570 |
#
|
|
571 |
# commandline mode
|
|
572 |
#
|
|
573 |
sub batch {
|
|
574 |
my ($c_file) = shift;
|
|
575 |
if (-s $c_file) {
|
|
576 |
my (%conf);
|
|
577 |
&conf(\%conf, $c_file);
|
|
578 |
&update_doxyfile(\%conf);
|
|
579 |
my (@dir_list, $path);
|
|
580 |
$path = cwd();
|
|
581 |
chdir $conf{root_path};
|
|
582 |
&find_doc(\@dir_list, \%conf);
|
|
583 |
&do_doxy(\@dir_list, \%conf, $path);
|
|
584 |
chdir $path;
|
|
585 |
}
|
|
586 |
else {
|
|
587 |
die "Configuration file \"$c_file\" not found : $!";
|
|
588 |
}
|
|
589 |
}
|
|
590 |
|
|
591 |
#
|
|
592 |
# Main program :
|
|
593 |
#
|
|
594 |
# if no arguments -> run gui
|
|
595 |
#
|
|
596 |
if (0 == scalar(@ARGV)) {
|
|
597 |
gui();
|
|
598 |
exit();
|
|
599 |
}
|
|
600 |
#
|
|
601 |
# with arguments -> run cmdline version
|
|
602 |
#
|
|
603 |
batch(@ARGV[0]); |