Debian Codegraph @

Documentation/Reference/cl2doxy.pl

raw
1 #!/usr/bin/perl
2
3 use English;
4
5 $detailed_type = "";
6
7 open (FILE, $ARGV[0]) || die;
8 while ($line = <FILE>)
9 {
10 if ($line =~ /\/\/([a-zA-Z0-9-].*)\n$/)
11 {
12 # We are in a documentation block.
13 $doc_text = $1;
14
15 if ($doc_text =~ /^- (.*)$/)
16 {
17 $doc_text = "$1";
18 }
19 elsif ($doc_text =~ /^param (.*): (.*)$/)
20 {
21 $doc_text = "\\param $1 $2";
22 }
23 elsif ($doc_text =~ /^return: (.*)$/)
24 {
25 $doc_text = "\\return $1";
26 }
27
28 if ($documentation_block)
29 {
30 print "\n";
31 $line =~ s/\/\/[a-zA-Z0-9:-].*\n$/ $doc_text/;
32 }
33 else
34 {
35 $line =~ s/\/\/[a-zA-Z0-9:-].*\n$/\/** $doc_text/;
36 $documentation_block = 1;
37 }
38 }
39 elsif ($documentation_block)
40 {
41 # End of doc block.
42 print "*/\n";
43 $documentation_block = 0;
44 }
45
46 $line =~ s/\/\/:(.*$)/\/** \\brief $1*\//;
47
48 if ($line =~ /\/\/! (clan.*?)="(.*)"$/)
49 {
50 $groupname = "$1_$2";
51 $groupdescription = "$1 $2";
52 $groupname =~ s/[ :\/]/_/g;
53
54 $line =~ s/\/\/! clan.*?=".*"($)/\/** \\addtogroup $groupname $groupdescription *\/$1/;
55 $line .= "//\@{\n";
56 $in_module = 1;
57 }
58 $line =~ s/\/\/! (header.*)($)/\/** $1 *\/$2/;
59 if ($ingroup == 1)
60 {
61 $ingroup = 0 if ($line =~ s/^(}.*$)/\/\/\@}\n$1/);
62 $line =~ s/\/\/! (.*?):(.*$)/\n\/\/\@}\n\/** \\name $1 *\/$2\n\/\/\@{\n/;
63 }
64 elsif ($line =~ s/\/\/! (.*?):(.*$)/\/** \\name $1 *\/$2\n\/\/\@{\n/)
65 {
66 $ingroup=1;
67 }
68
69 print $line;
70 }
71 if ($in_module)
72 {
73 print "//\@}\n";
74 }
75 close (FILE);