forked from FreeFem/FreeFem-sources
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmkff-html.pl
executable file
·149 lines (141 loc) · 3.96 KB
/
mkff-html.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/usr/bin/perl
sub FileInfo {
my $file = shift;
my $size = ( -s $file );
my $size= int(($file/1024)*10)/10;
my $date_str= localtime((stat($file))[9]);
return "$size Kb $date_str";
}
use File::Basename;
$imagedir="freefem/";
$dir=" il manque un parametre $#ARGV ";
if ( $#ARGV == 0 ) {
$dir=$ARGV[0];
}
( -d $dir ) || die " Erreur $dir n est pas un directory ! ";
open(file,"ls -1 $dir/[Ff]ree*++*|") || die " Erreur ouverture ";
$kk=0;
$k=0;
$VV = "00000 00000 00000";
FILE:
while (<file>) {
chop;
# next FILE if /^l/ ; # un lien on saut
# next FILE if /^d/ ; # un dir on saut
next if ( -d $_ );
next if ( -l $_ );
# ($mode,$nhdcopi,$name,$projet,$size,$mois,$jour,$an,$fichier)=split;
$fichier=$_;
$dir=dirname($fichier);
$file=basename($fichier);
$f=$file;
$p=$file;
$v=$file;
$s=$file;
# $v =~ s/.*\+\+[.v-]?//;
$v =~ s/^(.*\+\+[.v-]*)([1-9][-.0-9]*[0-9])(.*)$/\2/;
$p =~ s/^(.*\+\+[.v-]*)([1-9][-.0-9]*[0-9])(.*)$/\1/;
$s =~ s/^(.*\+\+[.v-]*)([1-9][-.0-9]*[0-9])(.*)$/\3/;
next FILE if $v !~ /^[1-9][-.0-9]*[0-9]$/;
($va,$vb,$vc) = split(/[-.]/,$v);
$clef="$p $s";
if ( $iclef{$clef} == "" ) { $iclef{$clef}=++$kk;}
$i=$iclef{$clef};
# print " -- $p , $v , $s , $clef ,, $i \n";
$pi[$i]=$p;
$si[$i]=$s;
$vi[$i] = sprintf("%05d %05d %05d;%s",$va,$vb,$vc,$vi[$i]);
$VI= sprintf("%05d %05d %05d",$va,$vb,$vc);
if($VV le $VI) { $VV=$VI;}
$fk[$k] = $_;
$ki[$i] = "$k;$ki[$i]";
$k++;
# @item=split(/-/);
}
#exit 1;
($vv1,$vv2,$vv3) = split(/ /,$VV);
$ver = sprintf("%d.%d-%d",$vv1,$vv2,$vv3);
print " last version: $ver \n";
for ($i=1;$i<=$kk;$i++)
{
# print " $i --- \n" ;
# print " $pi[$i]\n";
# print " $si[$i]\n";
# print " $vi[$i]\n";
@vvv=split(/;/,$vi[$i]);
@kkk=split(/;/,$ki[$i]);
$jj=0;
for ($j=0;$j<$#vvv;$j++)
{
if ( $vvv[$jj] le $vvv[$j])
{ $jj=$j;}
}
# print " $vvv[$jj] $kkk[$jj] ??? \n";
$fff=$fk[$kkk[$jj]];
# print "$fff \n";
$filei[$i] = $fff;
$tt[$i] = $si[$i] ;
}
# add munal file
for ("HISTORY","manual-full.pdf","manual.pdf","")
{
# print "$dir/$_ ", -f "$dir/$_", "\n";
next if !( -f "$dir/$_") ;
$filei[$kk]="$dir/$_";
$tt[$kk]="$_";
$kk++;
}
# clean the tt array
for (@tt)
{
s/^.exe$/Setup file for Window 95,98,NT,2000, XP/;
s/^_MacOsX.tgz$/MacOs 10.3 Cocoa OpenGL (tar+gzip)/;
s/^_MacOS.sit$/MacOS 9 Powerpc \(carbon StuffIt Archive\)/;
s/^.tar.gz$/All the sources (tar+gzip)/;
s/[.]tar[.]gz$/ (tar+ gzip file)/;
s/[.]tgz$/ (tar+ gzip file)/;
s/[.]zip$/ (zip file)/;
s/[.]pdf$/ (pdf file)/;
s/^manual-full/Full new manual /;
s/^manual /Old manual /;
s/_/ /g;
}
# ici generation de la liste des telechargements
# $tt[i] : file caracteristique
# $filei[i] : file path
$download = "";
for ($i=0;$i<=$#filei;$i++)
{
$file = $filei[$i];
# ($mode,$nhdcopi,$name,$projet,$size,$mois,$jour,$an,$fichier)=split;
$dir=dirname($file);
$bfile=basename($file);
$size = ( -s $file );
$size= int(($size/1024)*10)/10;
$date_str= localtime((stat($file))[9]);
# $now_string = strftime "%a %b %e %H:%M:%S %Y", localtime ;
# $date_str = strftime "%a %b %e %H:%M:%S %Y",
#$write_secs[0], $write_secs[1], $write_secs[2], $write_secs[4], $write_secs[5] ;
# print "\n @write_secs $date_str \n";
# $date_str = ctime((stat($file))[9]);
# $date_str =scalar localtime($write_secs);
$download .= "\n<li> $tt[$i] \n <a href=\"$file\"> $bfile </a>\n <font size=-1> $size Kb $date_str </font> </li> \n";
}
$manpdf=FileInfo($dir."/manual-full.pdf");
$omanpdf=FileInfo($dir."/manual.pdf");
$dateofday=localtime();
#print " $download " ;
open(fout,">freefem++.htm");
while (<STDIN>)
{
s/\@ver\@/$ver/;
s,\@imagedir\@,$imagedir,;
s/\@dateofday\@/$dateofday/;
s/\@download\@/$download/;
s/\@dir\@/$dir/;
s/\@manpdf\@/$manpdf/;
s/\@omanpdf\@/$omanpdf/;
print fout $_;
}
close(file);
close(fout);