4 print FILE
"namespace @_[1] {\n";
8 print FILE
"} // namespace @_[1]\n";
12 print FILE
"class @_[1] {\n";
13 print FILE
"public:\n";
14 print FILE
"\t@_[1]();\n";
15 print FILE
"\t~@_[1]();\n";
20 # Copyright notice . . .
23 Aesalon, a tool to visualize a program's behaviour at run-time.
24 Copyright (C) 2010, Aesalon Development Team.
26 Aesalon is distributed under the terms of the GNU GPLv3. For more
27 licensing information, see the file LICENSE included with the distribution.
37 $filename = @_[0] . (lc @_[1]) . "/" . @_[2] . ".h\n";
40 $filename = @_[0] . "/" . @_[2] . ".h\n";
43 open(FILE
, ">$filename") or die("Can't open $filename . . .");
45 printCopyright
($filename);
47 # Inclusion guard . . .
48 #$guard = "Aesalon" . @_[3] . "_" . @_[1] . "_" . @_[2] . "_H";
50 $guard = "Aesalon@_[3]_@_[1]_@_[2]_H";
53 $guard = "Aesalon@_[3]_@_[2]_H";
56 # Remove duplicate . . .
57 #$guard =~ s/@_[1]@_[1]/@_[1]/e;
59 print FILE
"#ifndef $guard\n";
60 print FILE
"#define $guard\n\n";
62 openNamespace
(FILE
, @_[3]);
63 openNamespace
(FILE
, @_[1]) if @_[1] ne "";
67 classDefinition
(FILE
, @_[2]);
71 closeNamespace
(FILE
, @_[1]) if @_[1] ne "";
72 closeNamespace
(FILE
, @_[3]);
74 print FILE
"\n#endif\n";
80 $filename = @_[0] . (lc @_[1]) . "/" . @_[2] . ".cpp\n";
82 open(FILE
, ">$filename") or die("Can't open $filename . . .");
84 printCopyright
($filename);
87 print FILE
"#include \"" . (lc @_[1]) . "/@_[2].h\"\n\n";
90 print FILE
"#include \"@_[2].h\"\n\n";
93 openNamespace
(FILE
, @_[3]);
94 openNamespace
(FILE
, @_[1]) if @_[1] ne "";
98 closeNamespace
(FILE
, @_[1]) if @_[1] ne "";
99 closeNamespace
(FILE
, @_[3]);
104 sub extractNamespace
{
105 if(!(@_[0] =~ m/(.+)\:\:(.+)/)) { return "", @_[0]; }
107 # print "1: $1, 2: $2\n";
109 if($2 eq "") { return "", $1; }
113 $argumentCount = $#ARGV + 1;
115 if($argumentCount < 1) {
116 die("Not enough arguments given");
122 if($argumentCount == 1) {
126 if(lc $ARGV[0] eq "monitor") { $mode = "monitor"; }
127 elsif(lc $ARGV[0] eq "visualizer") { $mode = "visualizer"; }
128 elsif(lc $ARGV[0] eq "common") { $mode = "common"; }
134 if($mode eq "monitor") {
135 createHeader
("include/monitor/", extractNamespace
($ARGV[1]), "Monitor");
136 createSource
("monitor/src/", extractNamespace
($ARGV[1]), "Monitor");
138 elsif($mode eq "visualizer") {
141 elsif($mode eq "common") {
142 createHeader
("include/common", extractNamespace
($ARGV[1]), "Common");