/[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.15 - (show annotations)
Mon Jun 24 17:52:25 2002 UTC (16 years, 11 months ago) by dpavlin
Branch: MAIN
Changes since 1.14: +1 -3 lines
File MIME type: text/plain
syntetic filed 'knjiz' == database description + mfn

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 $mps = "W $row->{mfn} 14\n";
329
330 my $pcnt = int($row->{mfn} * 100 / $max_rowid);
331 if ($pcnt != $last_pcnt) {
332 printf MPS ("M %5d / %5d -- %-2d %%\n",$row->{mfn},$max_rowid,$pcnt) if (! $opts{q});
333 $last_pcnt = $pcnt;
334 }
335
336 my $headline;
337 $headline .= isis_sf($row,'200','a');
338 $headline .= isis_sf($row,'200','e'," : ");
339 $headline .= isis_sf($row,'200','f'," / ");
340 $headline .= isis_sf($row,'210','d'," , ");
341
342 # remove newlines, compress spaces
343 $headline =~ s/[\n\r]//g;
344 $headline =~ s/^\s+//g;
345 $headline =~ s/\s+$//g;
346
347 # author
348 $bib .= isis_to_bib($row,'700','%700+','ab',undef,'>',', ');
349 $bib .= isis_to_bib($row,'701','%700+','ab',undef,'>',', ');
350 $bib .= isis_to_bib($row,'701','%700+','cd',undef,'>',', ');
351
352 my $tmp = isis_sf($row,'710','abc', '', '', (' : ',', '));
353 $tmp .= isis_sf($row,'710','dfe', ' (', ')', ('', ' ; ',' ; '));
354 $bib .= "%700+ $tmp\n" if ($tmp);
355
356 my $tmp = isis_sf($row,'711','abc', '', '', (' : ',', '));
357 $tmp .= isis_sf($row,'711','dfe', ' (', ')', ('', ' ; ',' ; '));
358 $bib .= "%700+ $tmp\n" if ($tmp);
359
360 $bib .= isis_to_bib($row,'503','%700+','ab',undef,'>',', ');
361
362 $mps .= isis_to_mps($row,'700',1);
363 $mps .= isis_to_mps($row,'701',1);
364 $mps .= isis_to_mps($row,'710',1);
365 $mps .= isis_to_mps($row,'711',1);
366 $mps .= isis_to_mps($row,'503',1);
367 $mps .= isis_to_mps($row,'702',1);
368 $mps .= isis_to_mps($row,'200',1,"fg");
369
370 $bib .= isis_to_bib($row,'205','%205');
371
372 # naslov
373 my $sf = OpenIsis::subfields($row->{'200'}->[0]);
374 my $book;
375 $book .= $sf->{a} if ($sf->{a});
376 $book .= " ; ".$sf->{k} if ($sf->{k});
377 $book .= " = ".$sf->{d} if ($sf->{d});
378 $book .= " : ".$sf->{e} if ($sf->{e});
379 $book .= " / ".$sf->{f} if ($sf->{f});
380 $book .= " ; ".$sf->{g} if ($sf->{g});
381 $book .= ". ".$sf->{c} if ($sf->{c});
382 $book .= " / ".$sf->{x} if ($sf->{x});
383 $book .= " ; ".$sf->{y} if ($sf->{y});
384 $bib .= "%200+ $book\n" if ($book);
385
386 $mps .= isis_to_mps($row,'200',2,"akcde");
387 $mps .= isis_to_mps($row,'532',2);
388 $mps .= isis_to_mps($row,'424',2);
389
390 $mps .= isis_to_mps($row,'230',2,"ae");
391 $mps .= isis_to_mps($row,'231',2,"ae");
392 $mps .= isis_to_mps($row,'232',2,"ae");
393 $mps .= isis_to_mps($row,'233',2,"ae");
394
395
396 my $tmp;
397 $tmp = isis_sf($row,'230','v').
398 isis_sf($row,'230','a',' : ').
399 isis_sf($row,'250',undef,'. - ').
400 isis_sf($row,'260',undef,'. - ').
401 isis_sf($row,'290',undef,'<br>ISBN ');
402 $bib .= "%sv $tmp\n" if ($tmp);
403
404 $tmp = isis_sf($row,'231','v','<br>').
405 isis_sf($row,'231','a',' : ').
406 isis_sf($row,'251',undef,'. - ').
407 isis_sf($row,'261',undef,'. - ').
408 isis_sf($row,'291',undef,'<br>ISBN ');
409 $bib .= "%sv $tmp\n" if ($tmp);
410
411 $tmp = isis_sf($row,'232','v','<br>').
412 isis_sf($row,'232','a',' : ').
413 isis_sf($row,'252',undef,'. - ').
414 isis_sf($row,'262',undef,'. - ').
415 isis_sf($row,'292',undef,'<br>ISBN ');
416 $bib .= "%sv $tmp\n" if ($tmp);
417
418 $tmp = isis_sf($row,'233','v','<br>').
419 isis_sf($row,'233','a',' : ').
420 isis_sf($row,'253',undef,'. - ').
421 isis_sf($row,'263',undef,'. - ').
422 isis_sf($row,'293',undef,'<br>ISBN ');
423
424 $mps .= isis_to_mps($row,'270',2);
425 $mps .= isis_to_mps($row,'271',2);
426 $mps .= isis_to_mps($row,'272',2);
427 $mps .= isis_to_mps($row,'273',2);
428
429 # izdavac
430 $mps .= isis_to_mps($row,'210',3);
431 $mps .= isis_to_mps($row,'250',3);
432 $mps .= isis_to_mps($row,'251',3);
433 $mps .= isis_to_mps($row,'252',3);
434 $mps .= isis_to_mps($row,'253',3);
435 # if (my $sf = OpenIsis::subfields($row->{'210'}->[0])) {
436 # my $tmp;
437 # $tmp .= $sf->{a} if ($sf->{a});
438 # $tmp .= " : ".$sf->{c} if ($sf->{c});
439 # $tmp .= ", ".$sf->{d} if ($sf->{d});
440 # $bib .= "%210 $tmp\n" if ($tmp);
441 # }
442 $bib .= "%210+ ".isis_sf($row,'210','acd', '','', ('',' : ',', ') )."\n";
443
444 if (my $year = isis_sf($row,'210','d')) {
445 $year =~ s/^\s*cop\.*\s*//i;
446 $year =~ s/[\[\]]*//g;
447 $year =~ s/[\n\r]//g; # remove cr
448 $mps .= "D ${year}\n" if ($year !~ m/\?/ && $year =~ /\d{4}/);
449 }
450
451 $mps .= isis_to_mps($row,'215',15);
452 $mps .= isis_to_mps($row,'260',15);
453 $mps .= isis_to_mps($row,'261',15);
454 $mps .= isis_to_mps($row,'262',15);
455 $mps .= isis_to_mps($row,'263',15);
456 $bib .= isis_to_bib($row,'215','%215+', '*', undef, undef, ', ');
457
458 # $bib .= isis_to_bib($row,'225','%225', 'aehivw');
459 $bib .= "%225 ".isis_sf($row,'225','aevhiw', '(',')', ('',' : ',' ; ','. ',', ',' ; '))."\n";
460 $mps .= isis_to_mps($row,'225',4);
461
462 $bib .= isis_to_bib($row,'300','%300+');
463 $bib .= isis_to_bib($row,'320','%300+');
464 $bib .= isis_to_bib($row,'327','%300+');
465 $mps .= isis_to_mps($row,'300',5);
466 $mps .= isis_to_mps($row,'320',5);
467 $mps .= isis_to_mps($row,'327',5);
468 $mps .= isis_to_mps($row,'280',5);
469 $mps .= isis_to_mps($row,'281',5);
470 $mps .= isis_to_mps($row,'282',5);
471 $mps .= isis_to_mps($row,'283',5);
472
473 $bib .= isis_to_bib($row,'330','%330');
474 $mps .= isis_to_mps($row,'330',6);
475
476 $bib .= isis_to_bib($row,'423','%423');
477 $bib .= isis_to_bib($row,'464','%464');
478 $mps .= isis_to_mps($row,'464',7);
479 $bib .= isis_to_bib($row,'610','%610');
480 $mps .= isis_to_mps($row,'610',8);
481
482 $bib .= isis_to_bib($row,'675','%675+');
483 $mps .= isis_to_mps($row,'675',9);
484 $bib .= isis_to_bib($row,'686','%675+');
485 $mps .= isis_to_mps($row,'686',10);
486
487 $bib .= isis_to_bib($row,'990','%990');
488 $mps .= isis_to_mps($row,'990',11);
489
490 $bib .= isis_to_bib($row,'991','%991');
491 $mps .= isis_to_mps($row,'991',12);
492
493 sub isis_isn_to_mps {
494 my $row = shift @_ || die;
495 my $isis_id = shift @_ || die;
496 my $nr = shift @_ || die;
497 my $i=0;
498 my $mps='';
499 while (my $isn=$row->{$isis_id}->[$i]) {
500 $isn =~ s/ +//g; # remove spaces
501 $isn =~ s/[\n\r]//g; # remove cr
502 $mps .= "W $isn $nr\n";
503 if ($isn =~ s/-//g) {
504 $mps .= "W $isn $nr\n";
505 }
506 $i++;
507 }
508 return $mps;
509 }
510
511 # ISBN
512 $bib .= isis_to_bib($row,'10','%ISBN');
513 $mps .= isis_isn_to_mps($row,'10',13);
514 $mps .= isis_isn_to_mps($row,'290',13);
515 $mps .= isis_isn_to_mps($row,'291',13);
516 $mps .= isis_isn_to_mps($row,'292',13);
517 $mps .= isis_isn_to_mps($row,'293',13);
518
519 # ISSN
520 #store_isn($row->{11}->[0],14,'%ISSN');
521
522 $mps .= isis_to_mps($row,'532',1);
523
524 $bib .= '%knjiz '.$DatabaseDescriptions{$db_dir}.", ".$row->{mfn}."\n";
525 # headline
526 if ($headline) {
527 $headline .= " <i>(".$DatabaseDescriptions{$db_dir}.", ".$row->{mfn}.")</i>"; ## debug MFN!
528 $headline =~ s/&/&and;/g;
529 $headline =~ s/</&lt;/g;
530 $headline =~ s/>/&gt;/g;
531 $mps .= "H ".c_852_iso($headline)."\n";
532 } else {
533 $mps .= "H nepoznato\n";
534 }
535
536
537 #if ($db_dir eq "sf") {
538 # print "MFN: $row->{mfn} ROW ID: $row_id\n";
539 # if ($row->{mfn} >= 146) {
540 # print Dumper($row);
541 # }
542 #}
543
544 print R c_852_iso($bib);
545
546 # check if all fields are defined
547 foreach (split(/\n/,$bib)) {
548 if (/^%(\w+)\s/ && !$default::FieldNames{$1}) {
549 die "field $1 used but not in FieldNames";
550 }
551 }
552
553 # print R "%perl ".Dumper($row)."\n";
554
555 $mps .= "T document text/plain ".(tell(R) - $last_tell)." $dir/bib $last_tell ".tell(R)."\n";
556 $last_tell=tell(R);
557
558 print R "\n";
559
560 $mps .= "E\n";
561
562
563 print S $mps;
564 print MPS $mps;
565 }
566 }
567 }
568 print S "M over and out\nX\n";
569 print MPS "M over and out\nX\n";
570 close(MPS);

  ViewVC Help
Powered by ViewVC 1.1.26