Rev 15437 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
12573 | bpr | 1 | #!/usr/bin/perl |
2 | |||
3 | use warnings; |
||
4 | use strict; |
||
5 | my %ref; |
||
6 | my $ref=\%ref; |
||
12665 | bpr | 7 | my %strong; |
8 | my $strong=\%strong; |
||
12573 | bpr | 9 | my ($type, $add)=("",""); |
15437 | bpr | 10 | my $glist0=""; |
15361 | bpr | 11 | my $glist=""; |
15403 | bpr | 12 | my @list_sort=(); |
13 | my $list_to_sort=""; |
||
12573 | bpr | 14 | for my $file (glob("*/*/*/*")) { |
15 | open(IN, $file) ; |
||
15361 | bpr | 16 | $glist .= "$file\n" if !($file=~/_\d\b/) && !($file=~/\/macro\//); |
12573 | bpr | 17 | while (<IN>) { my $line = $_; |
12665 | bpr | 18 | if ($line=~ /<strong>([^<]+)<\/strong>/) { $strong{$1} .= " $file"}; |
19 | next if !($line =~ /gl_keywords=/ || $line =~ /gl_type=/) ; |
||
20 | $type=$1 if($line=~/gl_type=(.*)/); |
||
12573 | bpr | 21 | $add =$1 if($line=~/!set gl_keywords=(.*)/); |
22 | chomp $add; chomp $type; |
||
15452 | bpr | 23 | next if ($type=~ /dynamic/); |
15403 | bpr | 24 | @list_sort=split('/', $file); |
25 | $list_to_sort .= "$list_sort[0],$list_sort[1],$list_sort[3],$list_sort[2]\n"; |
||
12573 | bpr | 26 | } |
27 | $type='main' if !($type); |
||
28 | $ref{$add} .= "$file/$type " if ($add); |
||
15403 | bpr | 29 | $type=""; $add=""; |
12573 | bpr | 30 | }; |
15403 | bpr | 31 | |
32 | @list_sort=sortuniq(split("\n",join("\n", sortuniq(split("\n",$list_to_sort))))); |
||
15437 | bpr | 33 | $glist=""; |
15403 | bpr | 34 | for my $line (@list_sort){ |
35 | if($line) { |
||
36 | my @l=split(',', $line); |
||
37 | $glist .= "$l[0]/$l[1]/$l[3]/$l[2]\n"; |
||
38 | } |
||
39 | } |
||
40 | |||
12644 | bpr | 41 | my $Text="generated by mkindex.pl\n\n"; |
12573 | bpr | 42 | while (my ($key, $value) = each(%ref) ) { |
43 | my $s= join(",",sortuniq(split(' ', $value))); |
||
44 | $Text .= $key . ":" . $s . "\n" ; |
||
45 | } |
||
46 | out("connexe_domain",$Text); |
||
47 | |||
12665 | bpr | 48 | $Text=""; |
49 | while (my ($key, $value) = each(%strong) ) { |
||
50 | my $s= join(",",sortuniq(split(' ', $value))); |
||
51 | $Text .= $key . ":" . $s . "\n" ; |
||
52 | } |
||
53 | out("strong_index",join("\n",sortuniq(split("\n",$Text)))); |
||
15361 | bpr | 54 | out("glist",$glist); |
12665 | bpr | 55 | |
12573 | bpr | 56 | sub sortuniq { |
57 | my $prev = "not $_[0]"; |
||
58 | grep { $_ ne $prev && ($prev = $_, 1) } sort @_; |
||
59 | } |
||
60 | |||
61 | sub out { my ($bloc, $text) = @_; |
||
62 | open (OUT, ">$bloc") ; |
||
63 | print OUT $text ; close OUT; |
||
64 | } |