Forráskód Böngészése

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

Reference Issue #9557.
Ryan C. Gordon 11 hónapja
szülő
commit
d29b861a76

+ 20 - 7
build-scripts/wikiheaders.pl

@@ -859,20 +859,33 @@ while (my $d = readdir(DH)) {
                 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");
         }

+ 5 - 0
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)

+ 1 - 0
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

+ 2 - 0
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.
  *