--- common.pm 2002/09/23 18:46:21 1.10 +++ common.pm 2002/10/24 16:32:00 1.11 @@ -35,6 +35,32 @@ #-------------------------------------------------------------------- # +# 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"); # @@ -50,12 +76,12 @@ $w =~ s/^['"<(\[]//g; # remove chars from end of word $w =~ s/[,;\.!?'">)\]]$//g; - # preglasi -> - if ($w =~ m/[]/) { + # preglasi + if ($w =~ m/[]/) { $out .= "W $w $nr\n"; - $w =~ s/[]/oe/g; - $w =~ s/[]/ae/g; - $w =~ s/[]/ue/g; + $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].+)/) { @@ -69,7 +95,7 @@ $out .= "W $fld $nr\n"; } } - return c_852_czs($out); + return $out; } 1;