SDL: wikiheaders: Allow blank lines in post-typedef `#define` blocks.

From d29b861a76b4d1d68d66df9d1d65db02e16f0936 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 25 Apr 2024 14:26:49 -0400
Subject: [PATCH] wikiheaders: Allow blank lines in post-typedef `#define`
 blocks.

Reference Issue #9557.
---
 build-scripts/wikiheaders.pl | 27 ++++++++++++++++++++-------
 include/SDL3/SDL_audio.h     |  5 +++++
 include/SDL3/SDL_keycode.h   |  1 +
 include/SDL3/SDL_video.h     |  2 ++
 4 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/build-scripts/wikiheaders.pl b/build-scripts/wikiheaders.pl
index 6de0518d168db..96d04edf43256 100755
--- a/build-scripts/wikiheaders.pl
+++ b/build-scripts/wikiheaders.pl
@@ -859,20 +859,33 @@ sub print_undocumented_section {
                 next;
             }
 
-            # We assume any `#define`s directly after the typedef are related to it: probably bitflags for an integer typedef. Even a blank line will signify an end!
+            # We assume any `#define`s directly after the typedef are related to it: probably bitflags for an integer typedef.
+            # Blank lines are allowed, anything else, even comments, are not.
+            my $blank_lines = 0;
             my $lastpos = tell(FH);
             my $additional_decl = '';
             while (<FH>) {
                 chomp;
-                if (not /\A\s*\#define\s+/) {
-                    seek(FH, $lastpos, 0);  # re-read this line again next time.
+
+                if (/\A\s*\Z/) {
+                    $blank_lines++;
+                } elsif (/\A\s*\#define\s+/) {
+                    if ($blank_lines > 0) {
+                        while ($blank_lines > 0) {
+                            $additional_decl .= "\n";
+                            push @decllines, '';
+                            $blank_lines--;
+                        }
+                    }
+                    $additional_decl .= "\n$_";
+                    push @decllines, $_;
+                    $lastpos = tell(FH);
+                } else {
+                    seek(FH, $lastpos, 0);  # re-read eaten lines again next time.
                     last;
                 }
-                $additional_decl .= "$_\n";
-                push @decllines, $_;
-                $lastpos = tell(FH);
             }
-            $decl .= "\n$additional_decl" if ($additional_decl ne '');
+            $decl .= $additional_decl;
         } else {
             die("Unexpected symtype $symtype");
         }
diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h
index 8e91fe7f3b467..323e1f3604411 100644
--- a/include/SDL3/SDL_audio.h
+++ b/include/SDL3/SDL_audio.h
@@ -85,16 +85,21 @@ extern "C" {
  * \sa SDL_AUDIO_ISUNSIGNED
  */
 typedef Uint16 SDL_AudioFormat;
+
 #define SDL_AUDIO_U8        0x0008  /**< Unsigned 8-bit samples */
 #define SDL_AUDIO_S8        0x8008  /**< Signed 8-bit samples */
+
 #define SDL_AUDIO_S16LE     0x8010  /**< Signed 16-bit samples */
 #define SDL_AUDIO_S16BE     0x9010  /**< As above, but big-endian byte order */
+
 #define SDL_AUDIO_S32LE     0x8020  /**< 32-bit integer samples */
 #define SDL_AUDIO_S32BE     0x9020  /**< As above, but big-endian byte order */
+
 #define SDL_AUDIO_F32LE     0x8120  /**< 32-bit floating point samples */
 #define SDL_AUDIO_F32BE     0x9120  /**< As above, but big-endian byte order */
 
 
+/* masks for different parts of SDL_AudioFormat. */
 #define SDL_AUDIO_MASK_BITSIZE       (0xFF)
 #define SDL_AUDIO_MASK_FLOAT         (1<<8)
 #define SDL_AUDIO_MASK_BIG_ENDIAN    (1<<12)
diff --git a/include/SDL3/SDL_keycode.h b/include/SDL3/SDL_keycode.h
index a4461903e0030..1eec03002ad62 100644
--- a/include/SDL3/SDL_keycode.h
+++ b/include/SDL3/SDL_keycode.h
@@ -47,6 +47,7 @@
  * \sa SDL_KeyCode
  */
 typedef Sint32 SDL_Keycode;
+
 #define SDLK_SCANCODE_MASK (1<<30)
 #define SDL_SCANCODE_TO_KEYCODE(X)  (X | SDLK_SCANCODE_MASK)
 #define SDLK_UNKNOWN    0
diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h
index e47da978ba683..db5694ec732d0 100644
--- a/include/SDL3/SDL_video.h
+++ b/include/SDL3/SDL_video.h
@@ -131,6 +131,7 @@ typedef struct SDL_Window SDL_Window;
  * \sa SDL_GetWindowFlags
  */
 typedef Uint32 SDL_WindowFlags;
+
 #define SDL_WINDOW_FULLSCREEN           0x00000001U /**< window is in fullscreen mode */
 #define SDL_WINDOW_OPENGL               0x00000002U /**< window usable with OpenGL context */
 #define SDL_WINDOW_OCCLUDED             0x00000004U /**< window is occluded */
@@ -155,6 +156,7 @@ typedef Uint32 SDL_WindowFlags;
 #define SDL_WINDOW_TRANSPARENT          0x40000000U /**< window with transparent buffer */
 #define SDL_WINDOW_NOT_FOCUSABLE        0x80000000U /**< window should not be focusable */
 
+
 /**
  * Used to indicate that you don't care what the window position is.
  *