From 97ec4b0937af406e42e3535006e4c3074deaecb2 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 12 Jun 2024 16:54:19 -0400 Subject: [PATCH] wikiheaders: fixed to work with not-SDL3 projects. (SDL2 still uses DECLSPEC, not SDL_DECLSPEC.) --- build-scripts/wikiheaders.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build-scripts/wikiheaders.pl b/build-scripts/wikiheaders.pl index e2f3afd950..42e8fa61fa 100755 --- a/build-scripts/wikiheaders.pl +++ b/build-scripts/wikiheaders.pl @@ -768,7 +768,7 @@ while (my $d = readdir(DH)) { #print("CATEGORY FOR '$dent' CHANGED TO " . (defined($current_wiki_category) ? "'$current_wiki_category'" : '(undef)') . "\n"); push @contents, $_; next; - } elsif (/\A\s*extern\s+(SDL_DEPRECATED\s+|)(SDLMAIN_|SDL_)DECLSPEC/) { # a function declaration without a doxygen comment? + } elsif (/\A\s*extern\s+(SDL_DEPRECATED\s+|)(SDLMAIN_|SDL_)?DECLSPEC/) { # a function declaration without a doxygen comment? $symtype = 1; # function declaration @templines = (); $decl = $_; @@ -841,7 +841,7 @@ while (my $d = readdir(DH)) { $lineno++ if defined $decl; $decl = '' if not defined $decl; chomp($decl); - if ($decl =~ /\A\s*extern\s+(SDL_DEPRECATED\s+|)(SDLMAIN_|SDL_)DECLSPEC/) { + if ($decl =~ /\A\s*extern\s+(SDL_DEPRECATED\s+|)(SDLMAIN_|SDL_)?DECLSPEC/) { $symtype = 1; # function declaration } elsif ($decl =~ /\A\s*SDL_FORCE_INLINE/) { $symtype = 1; # (forced-inline) function declaration @@ -917,7 +917,7 @@ while (my $d = readdir(DH)) { my $paramsstr = undef; - if (!$is_forced_inline && $decl =~ /\A\s*extern\s+(SDL_DEPRECATED\s+|)(SDLMAIN_|SDL_)DECLSPEC\s+(const\s+|)(unsigned\s+|)(.*?)([\*\s]+)(\*?)\s*SDLCALL\s+(.*?)\s*\((.*?)\);/) { + if (!$is_forced_inline && $decl =~ /\A\s*extern\s+(SDL_DEPRECATED\s+|)(SDLMAIN_|SDL_)?DECLSPEC\s+(const\s+|)(unsigned\s+|)(.*?)([\*\s]+)(\*?)\s*SDLCALL\s+(.*?)\s*\((.*?)\);/) { $sym = $8; $rettype = "$3$4$5$6"; $paramsstr = $9; @@ -985,7 +985,7 @@ while (my $d = readdir(DH)) { foreach (@decllines) { if ($decl eq '') { $decl = $_; - $decl =~ s/\Aextern\s+(SDL_DEPRECATED\s+|)(SDLMAIN_|SDL_)DECLSPEC\s+(.*?)\s+(\*?)SDLCALL\s+/$3$4 /; + $decl =~ s/\Aextern\s+(SDL_DEPRECATED\s+|)(SDLMAIN_|SDL_)?DECLSPEC\s+(.*?)\s+(\*?)SDLCALL\s+/$3$4 /; } else { my $trimmed = $_; # !!! FIXME: trim space for SDL_DEPRECATED if it was used, too.