From 21513e822f64a79dfc651da7e94408d97d985db6 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 20 May 2008 18:33:40 -0700 Subject: [PATCH] inslist.pl: deal with the new encoding format Make it possible for inslist.pl to understand the new encoding format; fix a few minor buglets. --- doc/inslist.pl | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/doc/inslist.pl b/doc/inslist.pl index 8cab04bf..7b560387 100644 --- a/doc/inslist.pl +++ b/doc/inslist.pl @@ -35,28 +35,31 @@ $line = 0; $insns = 0; while () { $line++; - if ( /^\s*;/ ) # comments + next if (/^\s*$/); # blank lines + if ( /^\s*;/ ) # comments { - if ( /^\s*;\#\s*(.+)/ ) # section subheader + if ( /^\s*;\#\s*(.+)/ ) # section subheader { print S "\n\\S{} $1\n\n"; } next; } chomp; - my @entry = split; - next if $#entry == -1; # blank lines - (warn "line $line does not contain four fields\n"), next if $#entry != 3; + unless (/^\s*(\S+)\s+(\S+)\s+(\S+|\[.*\])\s+(\S+)\s*$/) { + warn "line $line does not contain four fields\n"; + next; + } + my @entry = ($1, $2, $3, $4); - @entry[1] =~ s/ignore//; - @entry[1] =~ s/void//; - @entry[3] =~ s/ignore//; - @entry[3] =~ s/,SB//; - @entry[3] =~ s/,SM//; - @entry[3] =~ s/,SM2//; - @entry[3] =~ s/,SQ//; - @entry[3] =~ s/,AR2//; - printf S "\\c %-16s %-24s %s\n",@entry[0],@entry[1],@entry[3]; + $entry[1] =~ s/ignore//; + $entry[1] =~ s/void//; + $entry[3] =~ s/ignore//; + $entry[3] =~ s/,SB//; + $entry[3] =~ s/,SM//; + $entry[3] =~ s/,SM2//; + $entry[3] =~ s/,SQ//; + $entry[3] =~ s/,AR2//; + printf S "\\c %-16s %-24s %s\n",$entry[0],$entry[1],$entry[3]; $insns++; } print S "\n";