adapted the sampler to check for "<methodsynopsis>..." type signatures

fixed midi2endpoint.xml and midi2producer.xml accordingly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18852 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2006-09-15 12:18:01 +00:00
parent f257fcab01
commit 71d23319cb
3 changed files with 80 additions and 31 deletions

View File

@ -31,8 +31,8 @@
<title>Name()</title> <title>Name()</title>
<methodsynopsis> <methodsynopsis>
<type>const char *</type> <type><modifier>const</modifier> char *</type>
<methodname>Name</methodname> <methodname>Name</methodname><void/>
<modifier>const</modifier> <modifier>const</modifier>
</methodsynopsis> </methodsynopsis>
@ -56,7 +56,7 @@
<methodsynopsis> <methodsynopsis>
<void/> <methodname>SetName</methodname> <void/> <methodname>SetName</methodname>
<methodparam><modifier>const</modifier><type>char *</type><parameter>name</parameter></methodparam> <methodparam><type><modifier>const</modifier>char *</type><parameter>name</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
@ -89,7 +89,7 @@
<title>ID()</title> <title>ID()</title>
<methodsynopsis> <methodsynopsis>
<type>int32</type> <methodname>Name</methodname> <void/> <modifier>const</modifier> <type>int32</type> <methodname>ID</methodname> <void/> <modifier>const</modifier>
</methodsynopsis> </methodsynopsis>
<para> <para>
@ -390,7 +390,7 @@ if (endp->IsConsumer())
<methodsynopsis> <methodsynopsis>
<type>status_t</type> <methodname>SetProperties</methodname> <type>status_t</type> <methodname>SetProperties</methodname>
<methodparam><modifier>const</modifier><type>BMessage *</type><parameter>properties</parameter></methodparam> <methodparam><type><modifier>const</modifier>BMessage *</type><parameter>properties</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>

View File

@ -25,7 +25,7 @@
<methodsynopsis> <methodsynopsis>
<type>status_t</type> <type>status_t</type>
<methodname>Connect</methodname> <methodname>Connect</methodname>
<methodparam><type>BMidiConsumer *</type> <parameter>cons</parameter></methodparam> <methodparam><type><modifier>const</modifier>BMidiConsumer *</type> <parameter>cons</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
@ -56,7 +56,7 @@
<methodsynopsis> <methodsynopsis>
<type>status_t</type> <type>status_t</type>
<methodname>Disconnect</methodname> <methodname>Disconnect</methodname>
<methodparam><type>BMidiConsumer *</type> <parameter>cons</parameter></methodparam> <methodparam><type><modifier>const</modifier>BMidiConsumer *</type> <parameter>cons</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
@ -84,7 +84,8 @@
<methodsynopsis> <methodsynopsis>
<type>bool</type> <type>bool</type>
<methodname>IsConnected</methodname> <methodname>IsConnected</methodname>
<methodparam><type>BMidiConsumer *</type> <parameter>cons</parameter></methodparam> <methodparam><type><modifier>const</modifier>BMidiConsumer *</type> <parameter>cons</parameter></methodparam>
<modifier>const</modifier>
</methodsynopsis> </methodsynopsis>
<para> <para>

View File

@ -80,6 +80,7 @@ sub HandleTextline {
# skip 'typedef' or 'struct' region. # skip 'typedef' or 'struct' region.
(/^typedef/ || /^struct/ || /^namespace/) && do { (/^typedef/ || /^struct/ || /^namespace/) && do {
$gIsIgnoring = 1; $gIsIgnoring = 1;
if ( /^namespace.*}$/ ) { $gIsIgnoring = 0; }
last SWITCH; last SWITCH;
}; };
@ -193,24 +194,58 @@ sub PrintFunction {
$funcname = pop(); $funcname = pop();
$functype = join(' ', @_); $functype = join(' ', @_);
if ( $funcname =~ /^\*/ ) {
$funcname = $';
$functype = $functype . " *";
}
# handle func arg list. # handle func arg list.
# split(/[ ]*,[ ]*/, $funcargs); split(/[ ]*,[ ]*/, $funcargs);
# my @args = @_; my @args = @_;
# for (@args) { for (@args) {
# if ( /[ ]*=[ ]*/ ) { $_ = $`; } # for default value; ex. (short X = 100) $paramconst = "";
# split(/[ ]+/); if ( /const*/ ) { $paramconst = "<modifier>const</modifier>"; }
# pop(); if ( /[ ]*=[ ]*/ ) { $_ = $`; } # for default value; ex. (short X = 100)
# $_ = join(' ',@_); split(/[ ]+/);
# } $paramname = pop();
# $funcargs = join(', ', @args); $paramtype = pop();
if ( $paramname =~ /^\*/ ) {
$paramname = $';
$paramtype = $paramtype . " *";
}
$_ = "<type>" . $paramconst . $paramtype . "</type> <parameter>" . $paramname . "</parameter>"
}
$funcargs = join('</methodparam><methodparam>', @args);
if ($functype) { if ($functype) {
$functype = $functype . " " $_ = $functype;
$funcmod = "";
if ( s/^virtual[ ]*// ) {
$funcmod .= "virtual"
}
if ( s/^static[ ]*// ) {
if ( $funcmod =~ /^$/ ) {
$funcmode .= " ";
}
$funcmode .= "static"
}
if ( /^void/ ) {
$functype = $funcmode . "<void/>"
} else {
$typeconst = "";
if ( /^const / ) { $typeconst = "<modifier>const</modifier>"; $_ = $'; }
$functype = $funcmode . "<type>" . $typeconst . $_ . "</type>"
}
} }
if ($funcconst) { if ($funcconst) {
$funcconst = " " . $funcconst $funcconst = " " . "<modifier>" . $funcconst . "</modifier>"
} }
$_ = $functype . $funcname . "(" . $funcargs . ")" . $funcconst; if ($funcargs) {
$funcargs = "<methodparam>" . $funcargs . "</methodparam>"
} else {
$funcargs = "<void/>"
}
$_ = $functype . " <methodname>" . $funcname . "</methodname> " . $funcargs . $funcconst;
ValidateDocbook(); ValidateDocbook();
# print "FUNC = TYPE($funcname)+NAME($funcname)+ARGS($funcargs)\n"; # print "FUNC = TYPE($funcname)+NAME($funcname)+ARGS($funcargs)\n";
# print $funcname . "\t" x CalcTabs($funcname,5) . $functype . "(" . $funcargs . ")"; # print $funcname . "\t" x CalcTabs($funcname,5) . $functype . "(" . $funcargs . ")";
@ -224,26 +259,39 @@ sub PrintFunction {
sub ValidateDocbook { sub ValidateDocbook {
open(IN2, $gDocbookpath) || die "Can't open '$gDocbookpath'"; open(IN2, $gDocbookpath) || die "Can't open '$gDocbookpath'";
# we drop every space for the moment
s/[\t ]//g;
my $line = ""; my $line = "";
my $last1 = ""; my $pattern = $_;
my $last2 = "";
my $input = $_ ;
my $pattern = "<title>" . $_ . "</title>" ;
my $found = 0; my $found = 0;
my $ignoring = 1;
while (<IN2>) { while (<IN2>) {
chomp; chomp;
s/^[\t ]+//; s/^[\t ]+//;
s/[\t ]+$//; s/[\t ]+$//;
$line = $last1 . $last2 . " " . $_ ; s/[\t ]//g;
if ($ignoring) {
if ( m/<methodsynopsis>/ ) {
$line = $';
$ignoring = 0;
}
} else {
$line .= $_;
if ( index($line, $pattern) >= 0 ) { if ( index($line, $pattern) >= 0 ) {
$found = 1; $found = 1;
break; break;
} }
$last1 = $last2; if ( $line =~ /<\/methodsynopsis>/ ) {
$last2 = $_; $line = "";
$ignoring = 1;
}
}
} }
if ( $found == 0 ) { if ( $found == 0 ) {
print $input . "\n" ; print $pattern . "\n" ;
} }
close IN2; close IN2;
} }