mirror of
https://github.com/nigels-com/glew.git
synced 2024-11-22 05:45:07 +00:00
Sort the enums (tokens) in a stable manner for consistency in include files.
This commit is contained in:
parent
cf67153325
commit
3739be33b0
@ -142,7 +142,25 @@ sub output_tokens($$)
|
||||
{
|
||||
local $, = "\n";
|
||||
print "\n";
|
||||
print map { &{$fnc}($_, $tbl->{$_}) } sort { hex ${$tbl}{$a} <=> hex ${$tbl}{$b} } keys %{$tbl};
|
||||
print map { &{$fnc}($_, $tbl->{$_}) } sort {
|
||||
if (${$tbl}{$a} eq ${$tbl}{$b}) {
|
||||
$a cmp $b
|
||||
} else {
|
||||
if (${$tbl}{$a} =~ /_/) {
|
||||
if (${$tbl}{$b} =~ /_/) {
|
||||
$a cmp $b
|
||||
} else {
|
||||
-1
|
||||
}
|
||||
} else {
|
||||
if (${$tbl}{$b} =~ /_/) {
|
||||
1
|
||||
} else {
|
||||
hex ${$tbl}{$a} <=> hex ${$tbl}{$b}
|
||||
}
|
||||
}
|
||||
}
|
||||
} keys %{$tbl};
|
||||
print "\n";
|
||||
} else {
|
||||
print STDERR "no keys in table!\n";
|
||||
|
@ -336,8 +336,26 @@ foreach my $spec (sort @speclist)
|
||||
|
||||
my $prefix = $ext;
|
||||
$prefix =~ s/^(.+?)(_.+)$/$1/;
|
||||
foreach my $token (sort { hex ${$tokens}{$a} <=> hex ${$tokens}{$b} } keys %{$tokens})
|
||||
{
|
||||
foreach my $token (sort {
|
||||
if (${$tokens}{$a} eq ${$tokens}{$b}) {
|
||||
$a cmp $b
|
||||
} else {
|
||||
if (${$tokens}{$a} =~ /_/) {
|
||||
if (${$tokens}{$b} =~ /_/) {
|
||||
$a cmp $b
|
||||
} else {
|
||||
-1
|
||||
}
|
||||
} else {
|
||||
if (${$tokens}{$b} =~ /_/) {
|
||||
1
|
||||
} else {
|
||||
hex ${$tokens}{$a} <=> hex ${$tokens}{$b}
|
||||
}
|
||||
}
|
||||
}
|
||||
} keys %{$tokens})
|
||||
{
|
||||
if ($token =~ /^$prefix\_.*/i)
|
||||
{
|
||||
print EXT "\t" . $token . " " . ${\%{$tokens}}{$token} . "\n";
|
||||
|
Loading…
Reference in New Issue
Block a user