1 #-------------------------------------------------------------
3 # parse_format('format',$isis_row);
9 my $format = shift || die "parse_format must be called with format!";
10 my $row = shift || die "parse_format must be called with row!";
11 my $i = shift || 0; # isis repeatable number
12 my $codepage = shift || die "parse_format must be called with codepage!";
18 if ($format =~ s/^([^\d]+)//) {
26 #print STDERR "\n#### $format";
27 if ($format =~ s/^(\d\d\d)(\w?)//) {
28 my $isis_tmp = isis_sf($row,$1,$2,$i);
30 $isis_tmp = $codepage->convert($isis_tmp) if ($codepage);
31 $display .= $prefix . $isis_tmp;
32 $swish .= $isis_tmp." ";
33 #print STDERR " == $isis_tmp";
36 # this might be our local scpeciality -- fields 10 and 11
37 # (as opposed to 010 and 011) so they are strictly listed
39 } elsif ($format =~ s/^(1[01])//) {
40 my $isis_tmp = isis_sf($row,$1,undef,$i);
42 $isis_tmp = $codepage->convert($isis_tmp) if ($codepage);
43 $display .= $prefix . $isis_tmp;
44 $swish .= $isis_tmp." ";
47 } elsif ($format =~ s/^mfn//i) {
48 $display .= $prefix . $row->{mfn};
50 } elsif ($format =~ s/^([^\d]+)(\d{0,3})/$2/) {
51 $prefix .= $1 if ($display);
52 } elsif ($format =~ s/^([^\d]+\d{0,2})//) {
53 $prefix .= $1 if ($display);
54 } elsif ($format =~ s/^(\d{1,2})//) {
55 $prefix .= $1 if ($display);
57 print STDERR "unparsed format: $format\n";
63 $display .= $prefix if ($display);
65 return ($swish,$display);
68 #-------------------------------------------------------------