/[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.18 - (show annotations)
Wed Jul 17 16:55:24 2002 UTC (17 years, 4 months ago) by dpavlin
Branch: MAIN
Changes since 1.17: +3 -1 lines
File MIME type: text/plain
correct code page

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

  ViewVC Help
Powered by ViewVC 1.1.26