/[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

Contents of /isis2stream.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (show annotations)
Mon Jun 24 17:08:20 2002 UTC (17 years ago) by dpavlin
Branch: MAIN
Changes since 1.13: +13 -5 lines
File MIME type: text/plain
new format

1 #!/usr/bin/perl -w
2
3 use strict;
4 use OpenIsis;
5 use Getopt::Std;
6 use Data::Dumper;
7 use common;
8
9 my %opts;
10
11 getopts('d:m:q', \%opts);
12
13 die "usage: $0 -d [database_dir] -m [database1,database2] " if (! %opts);
14
15 my $db_dir = $opts{d};
16
17 mkdir "$common::install_dir/$db_dir" if (!-e "$common::install_dir/$db_dir");
18 mkdir "$common::install_dir/$db_dir/data" if (!-e "$common::install_dir/$db_dir/data");
19
20 my $dir="$common::install_dir/$db_dir/data";
21
22
23 open(S,"> $dir/stream") || die "can't open output $dir/stream: $!";
24 open(R,"> $dir/bib") || die "can't open output $dir/bib: $!";
25 open(MPS,"| $common::mpsindex -d $common::install_dir/$db_dir -autokey") || die "can't start MPS indexer $common::mpsindex: $!";
26 #open(MPS,"> /tmp/mpsindex") || die "mps: $!";
27
28 print S $common::mps_header;
29 print MPS $common::mps_header;
30
31 #--------------------------------------------------------------------
32 # init array in_mps_header for config checks later
33
34 my %in_mps_header;
35 foreach (split(/\n/,$common::mps_header)) {
36 if (/^F /) {
37 my (undef,$isis,$mps,undef) = split(/ /,$_,4);
38 $in_mps_header{$mps}=$isis;
39 }
40 }
41 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");
60 #
61
62 sub expand {
63 my $nr = shift @_;
64 die "$nr is not in mps_header" if (!$in_mps_header{$nr});
65 my $out = "";
66 while (my $fld = c_852_iso(shift @_)) {
67 my @words=split(/\s+/,$fld);
68 foreach my $w (@words) {
69 # FIX: this should be replaced by stemmer!
70 #$w =~ tr/¹©ðÐèÈæƾ®/sSdDcCcCzZ/;
71 $w =~ tr/Çüéâäùæç³ëÕõî¬ÄÆÉÅåôö¥µ¦¶ÖÜ«»£èáíóú¡±®¾Êê¼ÈºÁÂ̪¯¿ÃãðÐÏËïÒÍÎìÞÙÓÔÑñò©¹ÀÚàÛýÝþ´­½²·¢¸¨ÿØø/CueaauccleOoiZACELlooLlSsOUTtLcaiouAaZzEezCsAAESZzAadDDEdNIIeTUOoNnnSsRUrUyYt'-".'',"'Rr/;
72 $w =~ s/ß/ss/g;
73 $out .= "W $w $nr\n";
74 }
75 }
76 return $out;
77 }
78
79 #--------------------------------------------------------------------
80
81 sub c_852_iso {
82 my $tmp = $_[0];
83 $tmp =~ tr/€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúüýþÿ/Çüéâäùæç³ëÕõî¬ÄÆÉÅåôö¥µ¦¶ÖÜ«»£×èáíóú¡±®¾ÊꔼȺ—„•’ˆƒÁÂ̪‡€œ›¯¿‹Ÿ–˜Ž‘Ã㍐…†“™ž¤ðÐÏËïÒÍÎ슂‰šÞٝÓßÔÑñò©¹ÀÚàÛýÝþ´­½²·¢§÷¸°¨ÿØøŒ / if ($tmp);
84 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 {
94 my $tmp = $_[0];
95 $tmp =~ tr/€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúüýþÿ/Çüéâäùæç³ëÕõî¬ÄÆÉÅåôö¥µ¦¶ÖÜ«»£×èáíóú¡±®¾ÊꔼȺ—„•’ˆƒÁÂ̪‡€œ›¯¿‹Ÿ–˜Ž‘Ã㍐…†“™ž¤ðÐÏËïÒÍÎ슂‰šÞٝÓßÔÑñò©¹ÀÚàÛýÝþ´­½²·¢§÷¸°¨ÿØøŒ /;
96 $tmp =~ tr/Çüéâäùæç³ëÕõî¬ÄÆÉÅåôö¥µ¦¶ÖÜ«»£èáíóú¡±®¾Êê¼ÈºÁÂ̪¯¿ÃãðÐÏËïÒÍÎìÞÙÓÔÑñò©¹ÀÚàÛýÝþ´­½²·¢¸¨ÿØø/CueaauccleOoiZACELlooLlSsOUTtLcaiouAaZzEezCsAAESZzAadDDEdNIIeTUOoNnnSsRUrUyYt'-".'',"'Rr/;
97 $tmp =~ s/ß/ss/g;
98 return $tmp;
99 }
100
101 #--------------------------------------------------------------------
102
103 # $mps .= sf_to_mps("subfields",$subfiled_hash)
104 #
105 # subfields options:
106 # * - all (no sort)
107 # > - all, sort ascending
108 # < - all, sort descending
109
110 sub subfields_str_2_arr {
111 my $subfields = shift @_ || return;
112 my $sf_hash = shift @_;
113 my @sf_arr;
114
115 if ($subfields eq "*") {
116 @sf_arr = keys %{$sf_hash};
117 } elsif ($subfields eq ">") {
118 @sf_arr = sort keys %{$sf_hash};
119 } elsif ($subfields eq "<") {
120 @sf_arr = sort {$b cmp $a} keys %{$sf_hash};
121 } elsif ($subfields =~ s/>//) {
122 @sf_arr = sort split(//,$subfields);
123 } elsif ($subfields =~ s/<//) {
124 @sf_arr = sort {$b cmp $a} split(//,$subfields);
125 } else {
126 @sf_arr = split(//,$subfields);
127 }
128 return @sf_arr;
129 }
130
131
132 sub sf_to_mps {
133 my ($sf_hash,$subfields,$mps_id) = @_;
134 die "$mps_id is not in mps_header" if (!$in_mps_header{$mps_id});
135 my $out="";
136 my @sf_arr = subfields_str_2_arr($subfields,$sf_hash);
137
138 foreach (@sf_arr) {
139 $out.=mps_expand($mps_id,$sf_hash->{$_});
140 }
141 return $out;
142 }
143
144 #--------------------------------------------------------------------
145
146 # $mps .= isis_to_mps ($row,isis_id,mps_id[,"subfields"])
147
148 sub isis_to_mps {
149 my $row = shift @_ || die;
150 my $isis_id = shift @_ || die;
151 my $mps_id = shift @_ || die;
152 my $subfields = shift @_;
153
154 die "$mps_id is not in mps_header" if (!$in_mps_header{$mps_id});
155
156 my $i=0;
157 my $out = "";
158
159 while ($row->{$isis_id}->[$i]) {
160 my $sf_hash = OpenIsis::subfields($row->{$isis_id}->[$i]);
161
162 if (scalar keys %{$sf_hash} > 0) {
163 if ($subfields) {
164 foreach (split(//,$subfields)) {
165 $out.=mps_expand($mps_id,$sf_hash->{$_});
166 }
167 } else {
168 foreach (keys %{$sf_hash}) {
169 $out.=mps_expand($mps_id,$sf_hash->{$_});
170 }
171 }
172 } else {
173 $out.=mps_expand($mps_id,$row->{$isis_id}->[$i]);
174 }
175 $i++;
176 }
177 return $out;
178 }
179
180 #--------------------------------------------------------------------
181
182 # $bib .= isis_to_bib ($row,isis_id,bib_id,"subfields",[,group size][,"group sort"][,"separator"])
183 #
184 # fields:
185 # * - all (no sort)
186 # > - all, sort ascending
187 # < - all, sort descending
188 #
189
190 sub isis_to_bib {
191 my $row = shift @_ || die;
192 my $isis_id = shift @_ || die;
193 my $bib_id = shift @_ || die;
194 my $subfields = shift @_ || '*';
195 my $group_size = shift @_ || 0;
196 my $group_sort = shift @_ || '';
197 my $sep = shift @_ || ' ';
198
199 my $fld = $bib_id; $fld =~ s/^%//;
200 die "$fld is not in FieldNames" if (!$default::FieldNames{$fld});
201
202 my $i=0;
203
204 my $bib="";
205
206 my $sf_hash;
207
208 # bib_grp(('a','b','c'))
209 sub bib_grp {
210 my $bib_grp;
211 my $sf_hash = shift @_ || return "";
212 my $bib_id = shift @_;
213 my $sep = shift @_;
214 foreach (@_) {
215 next if (! defined $sf_hash->{$_});
216 if ($bib_grp) {
217 $bib_grp.= $sep . $sf_hash->{$_};
218 } else {
219 $bib_grp = $sf_hash->{$_};
220 }
221 }
222 if ($bib_grp) {
223 return "$bib_id $bib_grp\n"
224 } else {
225 return "";
226 }
227 }
228
229 while ($row->{$isis_id}->[$i]) {
230 my $sf_hash = OpenIsis::subfields($row->{$isis_id}->[$i]);
231
232 if (scalar keys %{$sf_hash} > 0) {
233 if ($group_size) {
234 my $tmp_flds = join("",subfields_str_2_arr($subfields,$sf_hash));
235 while ($tmp_flds) {
236 my $tmp_fld_grp = substr($tmp_flds,0,$group_size);
237 $bib .= bib_grp( $sf_hash, $bib_id, $sep, subfields_str_2_arr($tmp_fld_grp.$group_sort) );
238 last if (length($tmp_flds) <= $group_size);
239 $tmp_flds=substr($tmp_flds,$group_size,length($tmp_flds)-$group_size);
240 }
241
242 } else {
243 $bib .= bib_grp( $sf_hash, $bib_id, $sep, subfields_str_2_arr($subfields,$sf_hash) );
244 }
245 } else {
246 # no subfields, use just value!
247 $bib .= "$bib_id ".$row->{$isis_id}->[$i]."\n";
248 }
249 $i++;
250 }
251 return $bib;
252 }
253
254 #--------------------------------------------------------------------
255
256 sub isis_sf {
257 my $row = shift @_;
258 my $isis_id = shift @_;
259 my $subfield = shift @_;
260 my $prefix = shift @_ || '';
261 my $postfix = shift @_ || '';
262
263 my @sep = @_; # rest are separators
264
265 if ($row->{$isis_id}->[0]) {
266 my $sf = OpenIsis::subfields($row->{$isis_id}->[0]);
267 if (! defined $subfield || length($subfield) == 0) {
268 # subfield list undef, empty or no defined subfields for this record
269 return $prefix . $row->{$isis_id}->[0] . $postfix;
270 } elsif (length($subfield) == 1) {
271 if ($sf->{$subfield}) {
272 return $prefix . $sf->{$subfield} . $postfix;
273 } else {
274 return '';
275 }
276 } elsif (length($subfield) > 1) {
277 my @s = split(//,$subfield);
278 my $out;
279 foreach (@s) {
280 my $sep = shift @sep || ' ';
281 if ($out) {
282 $out .= $sep . $sf->{$_} if ($sf->{$_});
283 } else {
284 $out = $sf->{$_} if ($sf->{$_});
285 }
286 }
287 return $prefix . $out . $postfix if ($out);
288 }
289 }
290 return '';
291 }
292
293 #--------------------------------------------------------------------
294
295 my $last_tell=0;
296
297 my @isis_dirs = ( '.' ); # use dirname as database name
298
299 if ($opts{m}) {
300 @isis_dirs = split(/,/,$opts{m});
301 }
302
303 my @isis_dbs;
304
305 foreach (@isis_dirs) {
306 if (-e "$common::isis_data/$db_dir/$_/LIBRI") {
307 push @isis_dbs,"$common::isis_data/$db_dir/$_/LIBRI/LIBRI";
308 }
309 if (-e "$common::isis_data/$db_dir/$_/PERI") {
310 push @isis_dbs,"$common::isis_data/$db_dir/$_/PERI/PERI";
311 }
312 }
313
314 foreach my $isis_db (@isis_dbs) {
315
316 print MPS "M reading ISIS from '$isis_db'...\n";
317
318 my $db = OpenIsis::open( "$isis_db" );
319
320 my $max_rowid = OpenIsis::maxRowid( $db );
321
322 my $last_pcnt = 0;
323
324 for (my $row_id = 1; $row_id <= $max_rowid; $row_id++ ) {
325 my $row = OpenIsis::read( $db, $row_id );
326 if (my $tmp = $row->{'200'}->[0]) {
327
328 my $bib = "%MFN $row->{mfn}\n";
329 my $mps = "W $row->{mfn} 14\n";
330
331 my $pcnt = int($row->{mfn} * 100 / $max_rowid);
332 if ($pcnt != $last_pcnt) {
333 printf MPS ("M %5d / %5d -- %-2d %%\n",$row->{mfn},$max_rowid,$pcnt) if (! $opts{q});
334 $last_pcnt = $pcnt;
335 }
336
337 my $headline;
338 $headline .= isis_sf($row,'200','a');
339 $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
349 $bib .= isis_to_bib($row,'700','%700+','ab',undef,'>',', ');
350 $bib .= isis_to_bib($row,'701','%700+','ab',undef,'>',', ');
351 $bib .= isis_to_bib($row,'701','%700+','cd',undef,'>',', ');
352
353 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);
364 $mps .= isis_to_mps($row,'701',1);
365 $mps .= isis_to_mps($row,'710',1);
366 $mps .= isis_to_mps($row,'711',1);
367 $mps .= isis_to_mps($row,'503',1);
368 $mps .= isis_to_mps($row,'702',1);
369 $mps .= isis_to_mps($row,'200',1,"fg");
370
371 $bib .= isis_to_bib($row,'205','%205');
372
373 # naslov
374 my $sf = OpenIsis::subfields($row->{'200'}->[0]);
375 my $book;
376 $book .= $sf->{a} if ($sf->{a});
377 $book .= " ; ".$sf->{k} if ($sf->{k});
378 $book .= " = ".$sf->{d} if ($sf->{d});
379 $book .= " : ".$sf->{e} if ($sf->{e});
380 $book .= " / ".$sf->{f} if ($sf->{f});
381 $book .= " ; ".$sf->{g} if ($sf->{g});
382 $book .= ". ".$sf->{c} if ($sf->{c});
383 $book .= " / ".$sf->{x} if ($sf->{x});
384 $book .= " ; ".$sf->{y} if ($sf->{y});
385 $bib .= "%200+ $book\n" if ($book);
386
387 $mps .= isis_to_mps($row,'200',2,"akcde");
388 $mps .= isis_to_mps($row,'532',2);
389 $mps .= isis_to_mps($row,'424',2);
390
391 $mps .= isis_to_mps($row,'230',2,"ae");
392 $mps .= isis_to_mps($row,'231',2,"ae");
393 $mps .= isis_to_mps($row,'232',2,"ae");
394 $mps .= isis_to_mps($row,'233',2,"ae");
395
396
397 my $tmp;
398 $tmp = isis_sf($row,'230','v').
399 isis_sf($row,'230','a',' : ').
400 isis_sf($row,'250',undef,'. - ').
401 isis_sf($row,'260',undef,'. - ').
402 isis_sf($row,'290',undef,'<br>ISBN ');
403 $bib .= "%sv $tmp\n" if ($tmp);
404
405 $tmp = isis_sf($row,'231','v','<br>').
406 isis_sf($row,'231','a',' : ').
407 isis_sf($row,'251',undef,'. - ').
408 isis_sf($row,'261',undef,'. - ').
409 isis_sf($row,'291',undef,'<br>ISBN ');
410 $bib .= "%sv $tmp\n" if ($tmp);
411
412 $tmp = isis_sf($row,'232','v','<br>').
413 isis_sf($row,'232','a',' : ').
414 isis_sf($row,'252',undef,'. - ').
415 isis_sf($row,'262',undef,'. - ').
416 isis_sf($row,'292',undef,'<br>ISBN ');
417 $bib .= "%sv $tmp\n" if ($tmp);
418
419 $tmp = isis_sf($row,'233','v','<br>').
420 isis_sf($row,'233','a',' : ').
421 isis_sf($row,'253',undef,'. - ').
422 isis_sf($row,'263',undef,'. - ').
423 isis_sf($row,'293',undef,'<br>ISBN ');
424
425 $mps .= isis_to_mps($row,'270',2);
426 $mps .= isis_to_mps($row,'271',2);
427 $mps .= isis_to_mps($row,'272',2);
428 $mps .= isis_to_mps($row,'273',2);
429
430 # izdavac
431 $mps .= isis_to_mps($row,'210',3);
432 $mps .= isis_to_mps($row,'250',3);
433 $mps .= isis_to_mps($row,'251',3);
434 $mps .= isis_to_mps($row,'252',3);
435 $mps .= isis_to_mps($row,'253',3);
436 # if (my $sf = OpenIsis::subfields($row->{'210'}->[0])) {
437 # my $tmp;
438 # $tmp .= $sf->{a} if ($sf->{a});
439 # $tmp .= " : ".$sf->{c} if ($sf->{c});
440 # $tmp .= ", ".$sf->{d} if ($sf->{d});
441 # $bib .= "%210 $tmp\n" if ($tmp);
442 # }
443 $bib .= "%210+ ".isis_sf($row,'210','acd', '','', ('',' : ',', ') )."\n";
444
445 if (my $year = isis_sf($row,'210','d')) {
446 $year =~ s/^\s*cop\.*\s*//i;
447 $year =~ s/[\[\]]*//g;
448 $year =~ s/[\n\r]//g; # remove cr
449 $mps .= "D ${year}\n" if ($year !~ m/\?/ && $year =~ /\d{4}/);
450 }
451
452 $mps .= isis_to_mps($row,'215',15);
453 $mps .= isis_to_mps($row,'260',15);
454 $mps .= isis_to_mps($row,'261',15);
455 $mps .= isis_to_mps($row,'262',15);
456 $mps .= isis_to_mps($row,'263',15);
457 $bib .= isis_to_bib($row,'215','%215+', '*', undef, undef, ', ');
458
459 # $bib .= isis_to_bib($row,'225','%225', 'aehivw');
460 $bib .= "%225 ".isis_sf($row,'225','aevhiw', '(',')', ('',' : ',' ; ','. ',', ',' ; '))."\n";
461 $mps .= isis_to_mps($row,'225',4);
462
463 $bib .= isis_to_bib($row,'300','%300+');
464 $bib .= isis_to_bib($row,'320','%300+');
465 $bib .= isis_to_bib($row,'327','%300+');
466 $mps .= isis_to_mps($row,'300',5);
467 $mps .= isis_to_mps($row,'320',5);
468 $mps .= isis_to_mps($row,'327',5);
469 $mps .= isis_to_mps($row,'280',5);
470 $mps .= isis_to_mps($row,'281',5);
471 $mps .= isis_to_mps($row,'282',5);
472 $mps .= isis_to_mps($row,'283',5);
473
474 $bib .= isis_to_bib($row,'330','%330');
475 $mps .= isis_to_mps($row,'330',6);
476
477 $bib .= isis_to_bib($row,'423','%423');
478 $bib .= isis_to_bib($row,'464','%464');
479 $mps .= isis_to_mps($row,'464',7);
480 $bib .= isis_to_bib($row,'610','%610');
481 $mps .= isis_to_mps($row,'610',8);
482
483 $bib .= isis_to_bib($row,'675','%675+');
484 $mps .= isis_to_mps($row,'675',9);
485 $bib .= isis_to_bib($row,'686','%675+');
486 $mps .= isis_to_mps($row,'686',10);
487
488 $bib .= isis_to_bib($row,'990','%990');
489 $mps .= isis_to_mps($row,'990',11);
490
491 $bib .= isis_to_bib($row,'991','%991');
492 $mps .= isis_to_mps($row,'991',12);
493
494 sub isis_isn_to_mps {
495 my $row = shift @_ || die;
496 my $isis_id = shift @_ || die;
497 my $nr = shift @_ || die;
498 my $i=0;
499 my $mps='';
500 while (my $isn=$row->{$isis_id}->[$i]) {
501 $isn =~ s/ +//g; # remove spaces
502 $isn =~ s/[\n\r]//g; # remove cr
503 $mps .= "W $isn $nr\n";
504 if ($isn =~ s/-//g) {
505 $mps .= "W $isn $nr\n";
506 }
507 $i++;
508 }
509 return $mps;
510 }
511
512 # ISBN
513 $bib .= isis_to_bib($row,'10','%ISBN');
514 $mps .= isis_isn_to_mps($row,'10',13);
515 $mps .= isis_isn_to_mps($row,'290',13);
516 $mps .= isis_isn_to_mps($row,'291',13);
517 $mps .= isis_isn_to_mps($row,'292',13);
518 $mps .= isis_isn_to_mps($row,'293',13);
519
520 # ISSN
521 #store_isn($row->{11}->[0],14,'%ISSN');
522
523 $mps .= isis_to_mps($row,'532',1);
524
525 $bib .= isis_to_bib($row,'994','%994a','a');
526
527 # headline
528 if ($headline) {
529 $headline .= " <i>(".$DatabaseDescriptions{$db_dir}.", ".$row->{mfn}.")</i>"; ## debug MFN!
530 $headline =~ s/&/&and;/g;
531 $headline =~ s/</&lt;/g;
532 $headline =~ s/>/&gt;/g;
533 $mps .= "H ".c_852_iso($headline)."\n";
534 } else {
535 $mps .= "H nepoznato\n";
536 }
537
538
539 #if ($db_dir eq "sf") {
540 # print "MFN: $row->{mfn} ROW ID: $row_id\n";
541 # if ($row->{mfn} >= 146) {
542 # print Dumper($row);
543 # }
544 #}
545
546 print R c_852_iso($bib);
547
548 # check if all fields are defined
549 foreach (split(/\n/,$bib)) {
550 if (/^%(\w+)\s/ && !$default::FieldNames{$1}) {
551 die "field $1 used but not in FieldNames";
552 }
553 }
554
555 # print R "%perl ".Dumper($row)."\n";
556
557 $mps .= "T document text/plain ".(tell(R) - $last_tell)." $dir/bib $last_tell ".tell(R)."\n";
558 $last_tell=tell(R);
559
560 print R "\n";
561
562 $mps .= "E\n";
563
564
565 print S $mps;
566 print MPS $mps;
567 }
568 }
569 }
570 print S "M over and out\nX\n";
571 print MPS "M over and out\nX\n";
572 close(MPS);

  ViewVC Help
Powered by ViewVC 1.1.26