Commit 3739be33 authored by Nigel Stewart's avatar Nigel Stewart
Browse files

Sort the enums (tokens) in a stable manner for consistency in include files.

parent cf671533
......@@ -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";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment