#!/usr/bin/perl # Parse JIS0213-X.TXT # Gaspar Sinai # Tokyo 2002-04-09 if ($#ARGV <1) { die "usage: $0 {1,2} name [input-file like:JIS0213-1.TXT]"; } $FIELD=shift; $NAME=shift; print < 80000001 2B61 -> 80000002 2B62 -> 80000003 2B63 -> 80000004 2B64 -> 80000005 2B65 -> 80000010 2B66 -> 80000011 EOD } # # SJIS # if ($FIELD == 1) { print < 80000001 8681 -> 80000002 8682 -> 80000003 8683 -> 80000004 8684 -> 80000005 8685 -> 80000010 8686 -> 80000011 EOD } while (<>) { if (/^0x([0-9A-F]+)[ \t]+0x([0-9A-F]+)[ \t]+0x([0-9A-F]+)[ \t]+0x([0-9A-F]+)[ \t]+0x([0-9A-F]+)[ \t]+(.*)/) { $first = $1 if ($FIELD == 1); $first = $2 if ($FIELD == 2); printf ("%04X -> %08X %08X %08X %s\n", hex ($first), hex ($3), hex ($4), hex($5), $6); next; } if (/^0x([0-9A-F]+)[ \t]+0x([0-9A-F]+)[ \t]+0x([0-9A-F]+)[ \t]+0x([0-9A-F]+)[ \t]+(.*)/) { $first = $1 if ($FIELD == 1); $first = $2 if ($FIELD == 2); printf ("%04X -> %08X %08X %s\n", hex ($first), hex ($3), hex ($4), $5); next; } if (/^0x([0-9A-F]+)[ \t]+0x([0-9A-F]+)[ \t]+0x([0-9A-F]+)[ \t]+(.*)/) { $first = $1 if ($FIELD == 1); $first = $2 if ($FIELD == 2); printf ("%04X -> %08X %s\n", hex ($first), hex ($3), $4); next; } } exit (0);