/[webpac]/branches/cpi/parse_format.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /branches/cpi/parse_format.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 57 by dpavlin, Fri Jul 4 15:05:23 2003 UTC revision 62 by dpavlin, Fri Jul 4 20:11:48 2003 UTC
# Line 11  sub parse_format { Line 11  sub parse_format {
11          my $i = shift || 0;     # isis repeatable number          my $i = shift || 0;     # isis repeatable number
12          my $codepage = shift || die "parse_format must be called with codepage!";          my $codepage = shift || die "parse_format must be called with codepage!";
13          if ($type eq "isis") {          if ($type eq "isis") {
14                  return parse_isis_format($format,$row,$i,$codepage);                  return parse_iso_format($format,$row,$i,$codepage,'isis_sf');
15          } elsif ($type eq "excel") {          } elsif ($type eq "excel") {
16                  return parse_excel_format($format,$row,$i,$codepage);                  return parse_excel_format($format,$row,$i,$codepage);
17            } elsif ($type eq "marc") {
18                    return parse_iso_format($format,$row,$i,$codepage,'marc_sf');
19          }          }
20  }  }
21    
22  #-------------------------------------------------------------  #-------------------------------------------------------------
23    
24  sub parse_isis_format {  sub parse_iso_format {
         use isis_sf;  
25    
26          my $format = shift;          my $format = shift;
27          my $row = shift;          my $row = shift;
28          my $i = shift;          my $i = shift;
29          my $codepage = shift;          my $codepage = shift;
30    
31            my $func = shift || die "need to know which sub-field function to use";
32    
33            require $func.".pm";
34    
35          my $out;          my $out;
36          my $out_swish;          my $out_swish;
37    
# Line 38  sub parse_isis_format { Line 43  sub parse_isis_format {
43          my $display;          my $display;
44          my $swish;          my $swish;
45    
46            sub cnv_cp {
47                    my $tmp = shift;
48                    if ($codepage) {
49                            $tmp = $codepage->convert($tmp) || print STDERR "$1$2 = '$tmp' can't convert";
50                    }
51                    return $tmp;
52            }
53    
54          while ($format) {          while ($format) {
55  #print STDERR "\n#### $format";  #print STDERR "\n#### $format";
56                  if ($format =~ s/^(\d\d\d)(\w?)//) {                  # this is EBSCO special to support numeric subfield in
57                          my $tmp = isis_sf($row,$1,$2,$i);                  # form of 856#3
58                    if ($format =~ s/^(\d\d\d)#*(\w?)//) {
59                            my $tmp = get_sf($row,$1,$2,$i);
60                          if ($tmp) {                          if ($tmp) {
61                                  if ($codepage) {                                  $display .= $prefix.cnv_cp($tmp);
                                         $tmp = $codepage->convert($tmp) || warn "row: ",$row->{mfn},", $1$2 '$tmp' can't convert";  
                                 }  
                                 $display .= $prefix . $tmp;  
62                                  $swish .= $tmp." ";                                  $swish .= $tmp." ";
63  #print STDERR " == $tmp";  #print STDERR " == $tmp";
64                          }                          }
# Line 55  sub parse_isis_format { Line 67  sub parse_isis_format {
67                  # (as opposed to 010 and 011) so they are strictly listed                  # (as opposed to 010 and 011) so they are strictly listed
68                  # here                  # here
69                  } elsif ($format =~ s/^(1[01])//) {                  } elsif ($format =~ s/^(1[01])//) {
70                          my $tmp = isis_sf($row,$1,undef,$i);                          my $tmp = get_sf($row,$1,undef,$i);
71                          if ($tmp) {                          if ($tmp) {
72                                  if ($codepage) {                                  $display .= $prefix.cnv_cp($tmp);
                                         $tmp = $codepage->convert($tmp) || warn "row: ",$row->{mfn},", $1$2 '$tmp' can't convert";  
                                 }  
                                 $display .= $prefix . $tmp;  
73                                  $swish .= $tmp." ";                                  $swish .= $tmp." ";
74                          }                          }
75                          $prefix = "";                          $prefix = "";

Legend:
Removed from v.57  
changed lines
  Added in v.62

  ViewVC Help
Powered by ViewVC 1.1.26