wikiheaders: Add support for SDL_FORCE_INLINE functions.
parent
239b34d760
commit
3c86af5901
|
@ -612,6 +612,12 @@ while (my $d = readdir(DH)) {
|
|||
$decl = $_;
|
||||
$str = '';
|
||||
$has_doxygen = 0;
|
||||
} elsif (/\A\s*SDL_FORCE_INLINE/) { # a (forced-inline) function declaration without a doxygen comment?
|
||||
$symtype = 1; # function declaration
|
||||
@templines = ();
|
||||
$decl = $_;
|
||||
$str = '';
|
||||
$has_doxygen = 0;
|
||||
} elsif (not /\A\/\*\*\s*\Z/) { # not doxygen comment start?
|
||||
push @contents, $_;
|
||||
next;
|
||||
|
@ -645,6 +651,8 @@ while (my $d = readdir(DH)) {
|
|||
chomp($decl);
|
||||
if ($decl =~ /\A\s*extern\s+(SDL_DEPRECATED\s+|)DECLSPEC/) {
|
||||
$symtype = 1; # function declaration
|
||||
} elsif ($decl =~ /\A\s*SDL_FORCE_INLINE/) {
|
||||
$symtype = 1; # (forced-inline) function declaration
|
||||
} elsif ($decl =~ /\A\s*\#\s*define\s+/) {
|
||||
$symtype = 2; # macro
|
||||
} elsif ($decl =~ /\A\s*(typedef\s+|)(struct|union)/) {
|
||||
|
@ -667,6 +675,21 @@ while (my $d = readdir(DH)) {
|
|||
my $sym = '';
|
||||
|
||||
if ($symtype == 1) { # a function
|
||||
my $is_forced_inline = ($decl =~ /\A\s*SDL_FORCE_INLINE/);
|
||||
|
||||
if ($is_forced_inline) {
|
||||
if (not $decl =~ /\)\s*(\{.*|)\s*\Z/) {
|
||||
while (<FH>) {
|
||||
chomp;
|
||||
push @decllines, $_;
|
||||
s/\A\s+//;
|
||||
s/\s+\Z//;
|
||||
$decl .= " $_";
|
||||
last if /\)\s*(\{.*|)\s*\Z/;
|
||||
}
|
||||
}
|
||||
$decl =~ s/\s*\)\s*(\{.*|)\s*\Z/);/;
|
||||
} else {
|
||||
if (not $decl =~ /\)\s*;/) {
|
||||
while (<FH>) {
|
||||
chomp;
|
||||
|
@ -677,13 +700,16 @@ while (my $d = readdir(DH)) {
|
|||
last if /\)\s*;/;
|
||||
}
|
||||
}
|
||||
|
||||
$decl =~ s/\s+\);\Z/);/;
|
||||
}
|
||||
|
||||
$decl =~ s/\s+\Z//;
|
||||
|
||||
if ($decl =~ /\A\s*extern\s+(SDL_DEPRECATED\s+|)DECLSPEC\s+(const\s+|)(unsigned\s+|)(.*?)\s*(\*?)\s*SDLCALL\s+(.*?)\s*\((.*?)\);/) {
|
||||
if (!$is_forced_inline && $decl =~ /\A\s*extern\s+(SDL_DEPRECATED\s+|)DECLSPEC\s+(const\s+|)(unsigned\s+|)(.*?)\s*(\*?)\s*SDLCALL\s+(.*?)\s*\((.*?)\);/) {
|
||||
$sym = $6;
|
||||
#$decl =~ s/\A\s*extern\s+DECLSPEC\s+(.*?)\s+SDLCALL/$1/;
|
||||
} elsif ($is_forced_inline && $decl =~ /\A\s*SDL_FORCE_INLINE\s+(SDL_DEPRECATED\s+|)(const\s+|)(unsigned\s+|)(.*?)([\*\s]+)(.*?)\s*\((.*?)\);/) {
|
||||
$sym = $6;
|
||||
} else {
|
||||
#print "Found doxygen but no function sig:\n$str\n\n";
|
||||
foreach (@templines) {
|
||||
|
@ -695,6 +721,7 @@ while (my $d = readdir(DH)) {
|
|||
next;
|
||||
}
|
||||
|
||||
if (!$is_forced_inline) { # !!! FIXME: maybe we need to do this for forced-inline stuff too?
|
||||
$decl = ''; # build this with the line breaks, since it looks better for syntax highlighting.
|
||||
foreach (@decllines) {
|
||||
if ($decl eq '') {
|
||||
|
@ -708,6 +735,7 @@ while (my $d = readdir(DH)) {
|
|||
}
|
||||
$decl .= "\n";
|
||||
}
|
||||
}
|
||||
} elsif ($symtype == 2) { # a macro
|
||||
if ($decl =~ /\A\s*\#\s*define\s+(.*?)(\(.*?\)|)\s+/) {
|
||||
$sym = $1;
|
||||
|
|
Loading…
Reference in New Issue