--- common.pm 2002/06/24 13:47:04 1.5 +++ common.pm 2002/10/24 16:32:00 1.11 @@ -6,7 +6,8 @@ $common::install_dir="/local/index"; $common::mpsindex="/local/mps-5.3/bin/mpsindex -l 9 -b"; -$common::isis_data="/var/autofs/misc/isis_data/"; +#$common::isis_data="/var/autofs/misc/isis_data/"; +$common::isis_data="/data/isis_data/"; #$common::isis_data="/mnt/20020606/Isis/Data/"; # doma $common::mps_header="V 5 3 @@ -23,15 +24,43 @@ F 686 10 CC F 990 11 Signatura F 991 12 Inventarni broj -F ISBN 13 ISBN +F ISN 13 ISBN, ISSN F MFN 14 MFN F 215+ 15 Materijalni opis +F 101 16 Jezik +F tip 17 Tip graðe "; $common::database_cf="/local/search/databases.cf"; #-------------------------------------------------------------------- # +# open_data_files($db_dir) +# +# input: $db_dir - database directory name (e.g. 'ps') +# return: path on filesystem to data dir + +sub open_data_files { + my ($db_dir) = @_; + + mkdir "$common::install_dir/$db_dir" if (!-e "$common::install_dir/$db_dir"); + mkdir "$common::install_dir/$db_dir/data" if (!-e "$common::install_dir/$db_dir/data"); + + my $dir="$common::install_dir/$db_dir/data"; + + open(S,"> $dir/stream") || die "can't open output $dir/stream: $!"; + open(R,"> $dir/bib") || die "can't open output $dir/bib: $!"; + open(MPS,"| $common::mpsindex -d $common::install_dir/$db_dir -autokey") || die "can't start MPS indexer $common::mpsindex: $!"; +# open(MPS,"> /tmp/mpsindex") || die "mps: $!"; + + print S $common::mps_header; + print MPS $common::mps_header; + + return $dir; +} + +#-------------------------------------------------------------------- +# # mps_expand(nr,"space separated string"); # @@ -40,15 +69,33 @@ my $out = ""; while (my $fld = shift @_) { if ($fld =~ s/\s*[,;\.!?'"<>\[\]]*\s+/ /g) { + $fld =~ s/>)\]]$//g; + # preglasi öÖäÄüÜ + if ($w =~ m/[öÖäÄüÜ]/) { + $out .= "W $w $nr\n"; + $w =~ s/[öÖ]/oe/g; + $w =~ s/[äÄ]/ae/g; + $w =~ s/[üÜ]/ue/g; + $out .= "W $w $nr\n"; + # Irish Last names + } elsif (($nr == 1 || $nr == 2 || $nr == 3 || $nr == 6 || $nr == 7 || $nr == 8) && $w =~ m/^Ma?c([A-Z].+)/) { + $out .= "W Mc$1 $nr\n"; + $out .= "W Mac$1 $nr\n"; + } else { + $out .= "W $w $nr\n"; + } } } else { $out .= "W $fld $nr\n"; } } - return c_852_czs($out); + return $out; } 1;