File: cl2doxy.pl

package info (click to toggle)
clanlib 1.0~svn3827-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 24,696 kB
  • sloc: cpp: 101,591; xml: 6,410; makefile: 1,742; ansic: 463; perl: 424; php: 247; sh: 53
file content (75 lines) | stat: -rw-r--r-- 1,416 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/perl

use English;

$detailed_type = "";

open (FILE, $ARGV[0]) || die;
while ($line = <FILE>)
{
	if ($line =~ /\/\/([a-zA-Z0-9-].*)\n$/)
	{
		# We are in a documentation block.
		$doc_text = $1;

		if ($doc_text =~ /^- (.*)$/)
		{
			$doc_text = "$1";
		}
		elsif ($doc_text =~ /^param (.*): (.*)$/)
		{
			$doc_text = "\\param $1 $2";
		}
		elsif ($doc_text =~ /^return: (.*)$/)
		{
			$doc_text = "\\return $1";
		}
		
		if ($documentation_block)
		{
			print "\n";
			$line =~ s/\/\/[a-zA-Z0-9:-].*\n$/    $doc_text/;
		}
		else
		{
			$line =~ s/\/\/[a-zA-Z0-9:-].*\n$/\/** $doc_text/;
			$documentation_block = 1;
		}
	}
	elsif ($documentation_block)
	{
		# End of doc block.
		print "*/\n";
		$documentation_block = 0;
	}
	
	$line =~ s/\/\/:(.*$)/\/** \\brief $1*\//;

	if ($line =~ /\/\/! (clan.*?)="(.*)"$/)
	{
		$groupname = "$1_$2";
		$groupdescription = "$1 $2";
		$groupname =~ s/[ :\/]/_/g;
		
		$line =~ s/\/\/! clan.*?=".*"($)/\/** \\addtogroup $groupname $groupdescription *\/$1/;
		$line .= "//\@{\n";
		$in_module = 1;
	}
	$line =~ s/\/\/! (header.*)($)/\/** $1 *\/$2/;
	if ($ingroup == 1)
	{
		$ingroup = 0 if ($line =~ s/^(}.*$)/\/\/\@}\n$1/);
		$line =~ s/\/\/! (.*?):(.*$)/\n\/\/\@}\n\/** \\name $1 *\/$2\n\/\/\@{\n/;
	}
	elsif ($line =~ s/\/\/! (.*?):(.*$)/\/** \\name $1 *\/$2\n\/\/\@{\n/)
	{
		$ingroup=1;
	}
	
	print $line;
}
if ($in_module)
{
	print "//\@}\n";
}
close (FILE);