/[webpac-proto]/isis2stream.pl
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 /isis2stream.pl

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

revision 1.9 by dpavlin, Sun Jun 16 19:55:19 2002 UTC revision 1.14 by dpavlin, Mon Jun 24 17:08:20 2002 UTC
# Line 8  use common; Line 8  use common;
8    
9  my %opts;  my %opts;
10    
11  getopt('dm', \%opts);  getopts('d:m:q', \%opts);
12    
13  die "usage: $0 -d [database_dir] -m [database1,database2] " if (! %opts);  die "usage: $0 -d [database_dir] -m [database1,database2] " if (! %opts);
14    
# Line 41  foreach (split(/\n/,$common::mps_header) Line 41  foreach (split(/\n/,$common::mps_header)
41  require "./search/config.pm";  require "./search/config.pm";
42    
43  #--------------------------------------------------------------------  #--------------------------------------------------------------------
44    # read database configuration, store database names
45    open(CF,$common::database_cf) || die "$common::database_cf: $!";
46    my %DatabaseDescriptions;
47    while(<CF>) {
48            chomp;
49            if (/^database-name:([^=]+)=(.*)$/) {
50                    my ($db_name,$db_desc) = ($1,$2);
51                    $db_desc=~s/^##\w+##//g;
52                    $DatabaseDescriptions{$db_name}=$db_desc;
53            }
54    }
55    close(CF);
56    
57    #--------------------------------------------------------------------
58  #  #
59  # expand(nr,"space separated string");  # expand(nr,"space separated string");
60  #  #
# Line 70  sub c_852_iso { Line 84  sub c_852_iso {
84          return $tmp;          return $tmp;
85  }  }
86    
87    sub c_iso_852 {
88            my $tmp = $_[0];
89            $tmp =~ tr/ܫꔼȺ̪㍐슂ٝ// if ($tmp);
90            return $tmp;
91    }
92    
93  sub c_852_czs {  sub c_852_czs {
94          my $tmp = $_[0];          my $tmp = $_[0];
95          $tmp =~ tr//ܫꔼȺ̪㍐슂ٝ/;          $tmp =~ tr//ܫꔼȺ̪㍐슂ٝ/;
# Line 310  foreach my $isis_db (@isis_dbs) { Line 330  foreach my $isis_db (@isis_dbs) {
330    
331                  my $pcnt = int($row->{mfn} * 100 / $max_rowid);                  my $pcnt = int($row->{mfn} * 100 / $max_rowid);
332                  if ($pcnt != $last_pcnt) {                  if ($pcnt != $last_pcnt) {
333                          printf MPS ("M %5d / %5d -- %-2d %%\n",$row->{mfn},$max_rowid,$pcnt);                          printf MPS ("M %5d / %5d -- %-2d %%\n",$row->{mfn},$max_rowid,$pcnt) if (! $opts{q});
334                          $last_pcnt = $pcnt;                          $last_pcnt = $pcnt;
335                  }                  }
336    
337                  my $headline;                  my $headline;
338                  $headline .= isis_sf($row,'200','a',"'");                  $headline .= isis_sf($row,'200','a');
339                  $headline .= isis_sf($row,'200','e'," : ","'");                  $headline .= isis_sf($row,'200','e'," : ");
340                    $headline .= isis_sf($row,'200','f'," / ");
341                    $headline .= isis_sf($row,'210','d'," , ");
342    
343                    # remove newlines, compress spaces
344                    $headline =~ s/[\n\r]//g;
345                    $headline =~ s/^\s+//g;
346                    $headline =~ s/\s+$//g;
347    
348                  # author                  # author
349                  $bib .= isis_to_bib($row,'700','%700+','*',2,'<');                  $bib .= isis_to_bib($row,'700','%700+','ab',undef,'>',', ');
350                  $bib .= isis_to_bib($row,'701','%700+','*',2,'<');                  $bib .= isis_to_bib($row,'701','%700+','ab',undef,'>',', ');
351                  $bib .= isis_to_bib($row,'710','%700+','*',2,'<');                  $bib .= isis_to_bib($row,'701','%700+','cd',undef,'>',', ');
352                  $bib .= isis_to_bib($row,'711','%700+','*',2,'<');  
353                  $bib .= isis_to_bib($row,'503','%700+','*',2,'<');                  my $tmp = isis_sf($row,'710','abc', '', '', (' : ',', '));
354                    $tmp .= isis_sf($row,'710','dfe', ' (', ')', ('', ' ; ',' ; '));
355                    $bib .= "%700+ $tmp\n" if ($tmp);
356    
357                    my $tmp = isis_sf($row,'711','abc', '', '', (' : ',', '));
358                    $tmp .= isis_sf($row,'711','dfe', ' (', ')', ('', ' ; ',' ; '));
359                    $bib .= "%700+ $tmp\n" if ($tmp);
360    
361                    $bib .= isis_to_bib($row,'503','%700+','ab',undef,'>',', ');
362    
363                  $mps .= isis_to_mps($row,'700',1);                  $mps .= isis_to_mps($row,'700',1);
364                  $mps .= isis_to_mps($row,'701',1);                  $mps .= isis_to_mps($row,'701',1);
# Line 392  foreach my $isis_db (@isis_dbs) { Line 427  foreach my $isis_db (@isis_dbs) {
427                  $mps .= isis_to_mps($row,'272',2);                  $mps .= isis_to_mps($row,'272',2);
428                  $mps .= isis_to_mps($row,'273',2);                  $mps .= isis_to_mps($row,'273',2);
429    
                 $headline .= isis_sf($row,'700','b'," ");  
                 $headline .= isis_sf($row,'700','a'," ");  
   
430                  # izdavac                  # izdavac
431                  $mps .= isis_to_mps($row,'210',3);                  $mps .= isis_to_mps($row,'210',3);
432                  $mps .= isis_to_mps($row,'250',3);                  $mps .= isis_to_mps($row,'250',3);
# Line 413  foreach my $isis_db (@isis_dbs) { Line 445  foreach my $isis_db (@isis_dbs) {
445                  if (my $year = isis_sf($row,'210','d')) {                  if (my $year = isis_sf($row,'210','d')) {
446                          $year =~ s/^\s*cop\.*\s*//i;                          $year =~ s/^\s*cop\.*\s*//i;
447                          $year =~ s/[\[\]]*//g;                          $year =~ s/[\[\]]*//g;
448                            $year =~ s/[\n\r]//g;   # remove cr
449                          $mps .= "D ${year}\n" if ($year !~ m/\?/ && $year =~ /\d{4}/);                          $mps .= "D ${year}\n" if ($year !~ m/\?/ && $year =~ /\d{4}/);
                         $headline .= " ($year)";  
450                  }                  }
451    
452                  $mps .= isis_to_mps($row,'215',15);                  $mps .= isis_to_mps($row,'215',15);
# Line 467  foreach my $isis_db (@isis_dbs) { Line 499  foreach my $isis_db (@isis_dbs) {
499                          my $mps='';                          my $mps='';
500                          while (my $isn=$row->{$isis_id}->[$i]) {                          while (my $isn=$row->{$isis_id}->[$i]) {
501                                  $isn =~ s/ +//g;        # remove spaces                                  $isn =~ s/ +//g;        # remove spaces
502                                    $isn =~ s/[\n\r]//g;    # remove cr
503                                  $mps .= "W $isn $nr\n";                                  $mps .= "W $isn $nr\n";
504                                  if ($isn =~ s/-//g) {                                  if ($isn =~ s/-//g) {
505                                          $mps .= "W $isn $nr\n";                                          $mps .= "W $isn $nr\n";
# Line 493  foreach my $isis_db (@isis_dbs) { Line 526  foreach my $isis_db (@isis_dbs) {
526    
527                  # headline                  # headline
528                  if ($headline) {                  if ($headline) {
529                          $headline .= " [".$row->{mfn}."]";      ## debug MFN!                          $headline .= " <i>(".$DatabaseDescriptions{$db_dir}.", ".$row->{mfn}.")</i>";   ## debug MFN!
530                          $headline =~ s/&/&and;/g;                          $headline =~ s/&/&and;/g;
531                          $headline =~ s/</&lt;/g;                          $headline =~ s/</&lt;/g;
532                          $headline =~ s/>/&gt;/g;                          $headline =~ s/>/&gt;/g;

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.26