*** empty log message ***
[chuck-blob.git] / exile / ugen_doc.pl
bloba278af9d201513fed9212ccd72bfa616e5fe5903
1 #! /usr/bin/perl
4 sub open_ugen;
5 sub close_ugen;
6 sub open_flist;
7 sub close_flist;
8 sub print_extends;
9 sub print_function;
10 sub cleanup;
12 $ugen_open = 0;
13 $flist_open = 0;
14 $ugen_name = "";
16 sub open_namespace;
17 sub close_namespace;
18 sub open_export;
19 sub close_export;
20 sub add_param;
22 $namespace_open = 0;
23 $export_open = 0;
24 $namespace_name ="";
25 $export_name ="";
26 @export_comments = ();
27 $export_param_num = 0;
28 %library_notes = (
29 'stk' => '(STK Import)'
32 $lib_src = "";
33 $lib_note = "";
35 $doc_class_name = "";
36 $doc_info_open = 0;
37 %doc_brief;
38 %doc_data;
40 foreach ( @ARGV ) {
42 $file = $_;
44 open ( SOURCE , $file ) || printf " cannot open file \n";
45 while ( <SOURCE> ) {
47 if ( /\/\*\! \\class\s*(\w*)/ ) {
48 $doc_info_open = 1;
49 $doc_class_name = $1;
50 #print "dox for $1\n";
51 $doc_brief{$doc_class_name} = "";
52 $doc_data{$doc_class_name} = "";
54 elsif ( $doc_info_open ) {
55 if ( /(.*)\*\// ) {
56 $doc_data{$doc_class_name} .= $1;
57 #print "dox brief $doc_class_name - ".$doc_brief{$doc_class_name}."\n";
58 #print "dox data $doc_class_name - ".$doc_data{$doc_class_name}."\n";
59 $doc_info_open = 0;
60 $doc_class_name = "";
62 elsif ( /\\brief (.*)/ ) {
63 $doc_brief{$doc_class_name} = $1;
65 else {
66 $doc_data{$doc_class_name} .= $_;
71 close ( SOURCE );
72 open ( SOURCE , $file ) || printf " cannot open file \n";
73 while ( <SOURCE> ) {
75 if ( /\/\/\!(.*)$/ ) {
76 # print "comment - $1\n";
77 push @comments, $1;
80 if ( /DLL_QUERY\s+(\w*)_query/ ) {
81 $lib_src = $1;
82 $lib_note = $library_notes{$1};
83 @comments = ();
85 if ( /QUERY->ugen_add\s*\(\s*(.*?)\)/ ) {
86 open_ugen ( split ( /[\s,\"]+/ , $1 ) , @comments);
87 @comments = ();
89 if ( /QUERY->ugen_extends\s*\(\s*(.*?)\)/ ) {
90 print_extends ( split ( /[\s,\"]+/ , $1 ) , @comments);
91 @comments = ();
93 if ( /QUERY->ugen_ctrl\s*\(\s*(.*?)\)/ ) {
94 print_function ( split ( /[\s,\"]+/ , $1 ) , @comments);
95 @comments = ();
98 if ( /QUERY->set_name\s*\(\s*(.*?)\)/ ) {
99 open_namespace ( split ( /[\s,\"]+/ , $1 ) , @comments);
100 @comments = ();
103 if ( /QUERY->add_export\s*\(\s*(.*?)\)/ ) {
104 open_export ( split ( /[\s,\"]+/ , $1 ) , @comments);
105 @comments = ();
108 if ( /QUERY->add_param\s*\(\s*(.*?)\)/ ) {
109 add_param ( split ( /[\s,\"]+/ , $1 ) , @comments);
110 @comments = ();
114 cleanup();
115 close ( SOURCE );
120 sub open_ugen {
121 my ( $query, $name, $arg2, @comments ) = @_;
122 cleanup();
123 $ugen_name = $name;
125 $brief = $doc_brief{$ugen_name};
126 $data = $doc_data{$ugen_name};
127 if ( $brief ne "" ) { @comments = ( $brief, @comments ); }
130 print "
131 <br>
132 <a name=\"$ugen_name\"> </a>
133 <table width=100% border=0 bgcolor=d9d9d9 cellpadding=1 cellspacing=0>
134 <tr><td><table width=100% border=0 bgcolor=fdfdfd cellpadding=1 cellspacing=2>
135 <tr><td align=left><font face=verdana size=2>
136 <font color=#339933>[ugen]</font>: <b>$ugen_name</b> $lib_note<br>
138 foreach ( @comments ) { print "- $_<br />\n"; }
139 if ( $data ne "" ) { print "<pre>$data</pre>"; }
140 $ugen_open = 1;
143 sub close_ugen {
144 if ( $flist_open ) { close_flist(); }
146 print "</td></tr></table></td></tr></table>\n\n";
148 # printf "-end $ugen_name\n";
150 $ugen_name = "";
151 $ugen_open = 0;
154 sub print_extends {
155 my ( $query, $parent ) = @_;
156 print "extends <b><a href=\"#$parent\">$parent</a></b><br />";
160 sub cleanup {
161 if ( $ugen_open ) { close_ugen(); }
162 if ( $export_open ) { close_export(); }
165 sub open_flist {
167 print "<br>
168 [ctrl param]:
169 <ul>\n\n";
170 $flist_open = 1;
173 sub close_flist {
175 print "\n</ul>\n";
176 $flist_open = 0;
179 sub print_function {
180 my ($query, $ctor, $cget, $type, $name, @comments) = @_;
181 if ( !$flist_open ) { open_flist(); }
183 $comm = join ( "<br />", @comments);
184 $access = "";
186 if ( $ctor ne "NULL" && $cget ne "NULL" ) { $access = "READ/WRITE"; }
187 elsif ( $ctor ne "NULL" ) { $access = "WRITE only" }
188 elsif ( $cget ne "NULL" ) { $access = "READ only" }
189 print "<b>.$name</b> - ( $type , $access ) - $comm<br/>\n";
190 # print "---member $type $name $ctor $cget -- $comm\n";
196 sub open_namespace {
197 my ( $query, $name ) = @_;
198 $namespace_open = 1;
201 sub close_namespace {
202 $namespace_open = 0;
205 sub open_export {
206 my ( $query, $type, $name, $func, $flag, @comments ) = @_;
207 cleanup();
208 @export_comments=@comments;
210 print "[function]: $type <b>$name</b>( ";
211 $export_param_num = 0;
212 $export_open = 1;
215 sub close_export {
217 print " );<br/>\n";
218 foreach ( @export_comments ) { print "- $_<br />\n"; }
219 $export_open = 0;
222 sub add_param {
223 my ($query, $type, $name, @comments ) = @_;
224 push ( @export_comments, @comments );
225 $sep = "";
226 if ( $export_param_num ) { $sep = ", "; }
227 print "$sep$type $name";
228 $export_param_num ++;