mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-06-03 10:27:40 +00:00
wikiheaders: Defines directly following a non-struct typedef are documented.
The idea is that if you have a `typedef Uint32 MyFlags` that has a bunch of defines that are meant to be bitflags, you can pack them into the same wiki page automatically. This only works with `typedef`s that are _not_ struct/union/enums, and it only pulls in `#define` lines that immediately follow the typedef line. Even a blank line or a comment will signal to stop including lines for this page!
This commit is contained in:
parent
47ff4addd4
commit
2fb024ab8e
3 changed files with 15 additions and 6 deletions
|
@ -858,6 +858,21 @@ 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!
|
||||
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.
|
||||
last;
|
||||
}
|
||||
$additional_decl .= "$_\n";
|
||||
push @decllines, $_;
|
||||
$lastpos = tell(FH);
|
||||
}
|
||||
$decl .= "\n$additional_decl" if ($additional_decl ne '');
|
||||
} else {
|
||||
die("Unexpected symtype $symtype");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue