12 open (CLASSFILE
, $file) || die "Could not open file $ARGV[0]";
14 @raw_data = <CLASSFILE
>;
18 foreach $line ( @raw_data ) {
20 $line =~ /^([^ ]*) (.*)/;
23 parseCommand
($command, $line);
30 my ($cmd, $line) = @_;
32 parseCreateClass
($line) if $cmd eq "CC";
34 push ( @
{$cClass->{ PUBLIC_CTOR
}}, parseCreateConstructor
($line) ) if $cmd eq "CTOR+";
35 push ( @
{$cClass->{ PRIVATE_CTOR
}}, parseCreateConstructor
($line) ) if $cmd eq "CTOR-";
36 push ( @
{$cClass->{ PROTECTED_CTOR
}}, parseCreateConstructor
($line) ) if $cmd eq "CTOR#";
38 push ( @
{$cClass->{ PUBLIC_FUNCTIONS
}}, parseCreateFunction
($line) ) if $cmd eq "F+";
39 push ( @
{$cClass->{ PRIVATE_FUNCTIONS
}}, parseCreateFunction
($line) ) if $cmd eq "F-";
40 push ( @
{$cClass->{ PROTECTED_FUNCTIONS
}}, parseCreateFunction
($line) ) if $cmd eq "F#";
42 push ( @
{$cClass->{ PUBLIC_ATTRIBUTES
}}, parseCreateAttribute
($line) ) if $cmd eq "A+";
43 push ( @
{$cClass->{ PRIVATE_ATTRIBUTES
}}, parseCreateAttribute
($line) ) if $cmd eq "A-";
44 push ( @
{$cClass->{ PROTECTED_ATTRIBUTES
}}, parseCreateAttribute
($line) ) if $cmd eq "A#";
48 sub parseCreateConstructor
54 $attrib_str =~ s/ //g;
55 @attribs = split(/,/,$attrib_str);
57 foreach my $attrib (@attribs) {
58 $attrib =~ /^(.*):(.*)$/;
65 push @
{$attr}, $attribHash;
70 COMMENTS
=> $lastComments
76 sub parseCreateFunction
80 $line =~ /^([\w]*)[\W]*\((.*)\)[\W]*:[\W]*(.*)$/;
85 $attrib_str =~ s/ //g;
86 @attribs = split(/,/,$attrib_str);
88 foreach my $attrib (@attribs) {
89 $attrib =~ /^(.*):(.*)$/;
96 push @
{$attr}, $attribHash;
100 FUNCTION_NAME
=> $name,
103 VALIDATORS
=> parseValidators
($line),
104 COMMENTS
=> $lastComments
115 push @
{$lastComments},$line;
122 if($line =~ /\{(.*)\}/ ) {
124 print $line . " => " . $val . "\n";
125 @content = split(/,/,$val);
130 sub parseCreateAttribute
135 $line =~ /^([\w]*):([\w]*)/;
141 VALIDATORS
=> parseValidators
($line),
142 COMMENTS
=> $lastComments
157 PROTECTED_CTOR
=> [ ],
159 PUBLIC_FUNCTIONS
=> [ ],
160 PRIVATE_FUNCTIONS
=> [ ],
161 PROTECTED_FUNCTIONS
=> [ ],
163 PUBLIC_ATTRIBUTES
=> [ ],
164 PRIVATE_ATTRIBUTES
=> [ ],
165 PROTECTED_ATTRIBUTES
=> [ ]
168 $cClass->{ 'CLASSNAME' } = $line;
175 push @classes,$cClass;
186 my $s = "<<@{$val}>>";
197 foreach my $func (@funcs)
201 foreach my $attrib (@
{$func->{ ATTRIBS
}})
203 $attrib_str .="," if ($setComma == 1);
205 $attrib_str .= " " . $attrib->{NAME
} . ":" .
209 print " " . $func->{ FUNCTION_NAME
} . " (";
211 print " ) : " . $func->{ RETVAL
} . dumpValidators
($func->{VALIDATORS
}) . "\n";
219 foreach my $attr (@attribs)
221 print " " . $attr->{ NAME
} . " : " . $attr->{ TYPE
} . dumpValidators
($attr->{VALIDATORS
}) ."\n";
227 foreach my $class (@classes)
229 my $className = $class->{ CLASSNAME
};
230 print "Class description for $className:\n";
231 if(@
{$cClass->{ PUBLIC_FUNCTIONS
}} != 0)
233 print " Public functions:\n";
234 dumpFunctions @
{$cClass->{ PUBLIC_FUNCTIONS
}};
236 if(@
{$cClass->{ PROTECTED_FUNCTIONS
}} != 0)
238 print " Protected functions:\n";
239 dumpFunctions @
{$cClass->{ PROTECTED_FUNCTIONS
}};
242 if(@
{$cClass->{ PRIVATE_FUNCTIONS
}} != 0)
244 print " Private functions:\n";
245 dumpFunctions @
{$cClass->{ PRIVATE_FUNCTIONS
}};
248 if ( @
{$cClass->{ PUBLIC_ATTRIBUTES
}} != 0 )
250 print " Public attributes:\n";
251 dumpAttribs @
{$cClass->{ PUBLIC_ATTRIBUTES
}};
253 if ( @
{$cClass->{ PRIVATE_ATTRIBUTES
}} != 0 )
255 print " Private attributes:\n";
256 dumpAttribs @
{$cClass->{ PRIVATE_ATTRIBUTES
}};