diff --git a/src/documentation/haiku_book/midi/midi2endpoint.xml b/src/documentation/haiku_book/midi/midi2endpoint.xml
index 2274ae2ef8..2c2da1bc06 100644
--- a/src/documentation/haiku_book/midi/midi2endpoint.xml
+++ b/src/documentation/haiku_book/midi/midi2endpoint.xml
@@ -31,8 +31,8 @@
Name()
- const char *
- Name
+ const char *
+ Name
const
@@ -56,7 +56,7 @@
SetName
- constchar *name
+ constchar *name
@@ -89,7 +89,7 @@
ID()
- int32 Name const
+ int32 ID const
@@ -390,7 +390,7 @@ if (endp->IsConsumer())
status_t SetProperties
- constBMessage *properties
+ constBMessage *properties
diff --git a/src/documentation/haiku_book/midi/midi2producer.xml b/src/documentation/haiku_book/midi/midi2producer.xml
index d66123449a..ab2b98cf70 100644
--- a/src/documentation/haiku_book/midi/midi2producer.xml
+++ b/src/documentation/haiku_book/midi/midi2producer.xml
@@ -25,7 +25,7 @@
status_t
Connect
- BMidiConsumer * cons
+ constBMidiConsumer * cons
@@ -56,7 +56,7 @@
status_t
Disconnect
- BMidiConsumer * cons
+ constBMidiConsumer * cons
@@ -84,7 +84,8 @@
bool
IsConnected
- BMidiConsumer * cons
+ constBMidiConsumer * cons
+ const
diff --git a/src/tools/docbook/headersampler/HeaderSampler.pl b/src/tools/docbook/headersampler/HeaderSampler.pl
index c0c530bc67..8b41d23a27 100644
--- a/src/tools/docbook/headersampler/HeaderSampler.pl
+++ b/src/tools/docbook/headersampler/HeaderSampler.pl
@@ -80,6 +80,7 @@ sub HandleTextline {
# skip 'typedef' or 'struct' region.
(/^typedef/ || /^struct/ || /^namespace/) && do {
$gIsIgnoring = 1;
+ if ( /^namespace.*}$/ ) { $gIsIgnoring = 0; }
last SWITCH;
};
@@ -193,24 +194,58 @@ sub PrintFunction {
$funcname = pop();
$functype = join(' ', @_);
+ if ( $funcname =~ /^\*/ ) {
+ $funcname = $';
+ $functype = $functype . " *";
+ }
+
# handle func arg list.
-# split(/[ ]*,[ ]*/, $funcargs);
-# my @args = @_;
-# for (@args) {
-# if ( /[ ]*=[ ]*/ ) { $_ = $`; } # for default value; ex. (short X = 100)
-# split(/[ ]+/);
-# pop();
-# $_ = join(' ',@_);
-# }
-# $funcargs = join(', ', @args);
+ split(/[ ]*,[ ]*/, $funcargs);
+ my @args = @_;
+ for (@args) {
+ $paramconst = "";
+ if ( /const*/ ) { $paramconst = "const"; }
+ if ( /[ ]*=[ ]*/ ) { $_ = $`; } # for default value; ex. (short X = 100)
+ split(/[ ]+/);
+ $paramname = pop();
+ $paramtype = pop();
+ if ( $paramname =~ /^\*/ ) {
+ $paramname = $';
+ $paramtype = $paramtype . " *";
+ }
+ $_ = "" . $paramconst . $paramtype . " " . $paramname . ""
+ }
+ $funcargs = join('', @args);
if ($functype) {
- $functype = $functype . " "
+ $_ = $functype;
+ $funcmod = "";
+ if ( s/^virtual[ ]*// ) {
+ $funcmod .= "virtual"
+ }
+ if ( s/^static[ ]*// ) {
+ if ( $funcmod =~ /^$/ ) {
+ $funcmode .= " ";
+ }
+ $funcmode .= "static"
+ }
+ if ( /^void/ ) {
+ $functype = $funcmode . ""
+ } else {
+ $typeconst = "";
+ if ( /^const / ) { $typeconst = "const"; $_ = $'; }
+ $functype = $funcmode . "" . $typeconst . $_ . ""
+ }
}
if ($funcconst) {
- $funcconst = " " . $funcconst
+ $funcconst = " " . "" . $funcconst . ""
}
- $_ = $functype . $funcname . "(" . $funcargs . ")" . $funcconst;
+ if ($funcargs) {
+ $funcargs = "" . $funcargs . ""
+ } else {
+ $funcargs = ""
+ }
+ $_ = $functype . " " . $funcname . " " . $funcargs . $funcconst;
ValidateDocbook();
# print "FUNC = TYPE($funcname)+NAME($funcname)+ARGS($funcargs)\n";
# print $funcname . "\t" x CalcTabs($funcname,5) . $functype . "(" . $funcargs . ")";
@@ -224,26 +259,39 @@ sub PrintFunction {
sub ValidateDocbook {
open(IN2, $gDocbookpath) || die "Can't open '$gDocbookpath'";
+
+ # we drop every space for the moment
+ s/[\t ]//g;
+
my $line = "";
- my $last1 = "";
- my $last2 = "";
- my $input = $_ ;
- my $pattern = "" . $_ . "" ;
+ my $pattern = $_;
my $found = 0;
+ my $ignoring = 1;
+
while () {
chomp;
s/^[\t ]+//;
s/[\t ]+$//;
- $line = $last1 . $last2 . " " . $_ ;
- if ( index($line, $pattern) >= 0 ) {
- $found = 1;
- break;
+ s/[\t ]//g;
+ if ($ignoring) {
+ if ( m// ) {
+ $line = $';
+ $ignoring = 0;
+ }
+ } else {
+ $line .= $_;
+ if ( index($line, $pattern) >= 0 ) {
+ $found = 1;
+ break;
+ }
+ if ( $line =~ /<\/methodsynopsis>/ ) {
+ $line = "";
+ $ignoring = 1;
+ }
}
- $last1 = $last2;
- $last2 = $_;
}
if ( $found == 0 ) {
- print $input . "\n" ;
+ print $pattern . "\n" ;
}
close IN2;
}