wikiheaders: Deal with SDLMAIN_DECLSPEC functions.

This commit is contained in:
Ryan C. Gordon 2024-05-03 09:31:27 -04:00
parent ab5b904890
commit 3348d0caaf
No known key found for this signature in database
GPG key ID: FA148B892AB48044

View file

@ -642,7 +642,7 @@ while (my $d = readdir(DH)) {
$ignoring_lines = 1; $ignoring_lines = 1;
push @contents, $_; push @contents, $_;
next; next;
} elsif (/\A\s*extern\s+(SDL_DEPRECATED\s+|)DECLSPEC/) { # a function declaration without a doxygen comment? } elsif (/\A\s*extern\s+(SDL_DEPRECATED\s+|)(SDLMAIN_)?DECLSPEC/) { # a function declaration without a doxygen comment?
$symtype = 1; # function declaration $symtype = 1; # function declaration
@templines = (); @templines = ();
$decl = $_; $decl = $_;
@ -689,7 +689,7 @@ while (my $d = readdir(DH)) {
$lineno++ if defined $decl; $lineno++ if defined $decl;
$decl = '' if not defined $decl; $decl = '' if not defined $decl;
chomp($decl); chomp($decl);
if ($decl =~ /\A\s*extern\s+(SDL_DEPRECATED\s+|)DECLSPEC/) { if ($decl =~ /\A\s*extern\s+(SDL_DEPRECATED\s+|)(SDLMAIN_)?DECLSPEC/) {
$symtype = 1; # function declaration $symtype = 1; # function declaration
} elsif ($decl =~ /\A\s*SDL_FORCE_INLINE/) { } elsif ($decl =~ /\A\s*SDL_FORCE_INLINE/) {
$symtype = 1; # (forced-inline) function declaration $symtype = 1; # (forced-inline) function declaration
@ -749,8 +749,8 @@ while (my $d = readdir(DH)) {
$decl =~ s/\s+\Z//; $decl =~ s/\s+\Z//;
if (!$is_forced_inline && $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+|)(SDLMAIN_)?DECLSPEC\s+(const\s+|)(unsigned\s+|)(.*?)\s*(\*?)\s*SDLCALL\s+(.*?)\s*\((.*?)\);/) {
$sym = $6; $sym = $7;
#$decl =~ s/\A\s*extern\s+DECLSPEC\s+(.*?)\s+SDLCALL/$1/; #$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*\((.*?)\);/) { } elsif ($is_forced_inline && $decl =~ /\A\s*SDL_FORCE_INLINE\s+(SDL_DEPRECATED\s+|)(const\s+|)(unsigned\s+|)(.*?)([\*\s]+)(.*?)\s*\((.*?)\);/) {
$sym = $6; $sym = $6;
@ -770,7 +770,7 @@ while (my $d = readdir(DH)) {
foreach (@decllines) { foreach (@decllines) {
if ($decl eq '') { if ($decl eq '') {
$decl = $_; $decl = $_;
$decl =~ s/\Aextern\s+(SDL_DEPRECATED\s+|)DECLSPEC\s+(.*?)\s+(\*?)SDLCALL\s+/$2$3 /; $decl =~ s/\Aextern\s+(SDL_DEPRECATED\s+|)(SDLMAIN_)?DECLSPEC\s+(.*?)\s+(\*?)SDLCALL\s+/$3$4 /;
} else { } else {
my $trimmed = $_; my $trimmed = $_;
# !!! FIXME: trim space for SDL_DEPRECATED if it was used, too. # !!! FIXME: trim space for SDL_DEPRECATED if it was used, too.