On Wed, 18 Sep 2002, Taco Hoekwater wrote:
> Surely that's the file date of the format file?
>
> stat (`kpsewhich cont-en.efmt`)
No, you can create a very new format file from a very old context version
> perl doesnt care about that binary stuff :)
>
> /\(format=cont-.. (\d+).(\d+).(\d+)\)/;
I tried that one already, but what you get is the file date, not the
context version. The latter isn't in the format, unless in binary maybe.
I think I need the following routine (yes, it's much more than 4 lines):
#!/usr/bin/perl -w
sub test_context_version {
my $required=shift;
chomp (my $fmt=`kpsewhich cont-en.efmt`);
chomp (my $tex=`kpsewhich context.tex`);
(stat $fmt)[10] < (stat $tex)[10] and
die "Your context formats need (re)generation:\n";
open(IN,$tex) or do {
warn "can't find context.tex";
return 1;
};
while(<IN>) {
if ( /contextversion\{(\d+)\.(\d+)\.(\d+)\}/ ) {
my $have;
$have=sprintf('%4d%02d%02d',$1,$2,$3);
$have < $required and
warn "Your ConTeXt is too old ($have); you need $required\n";
return 1;
last;
}
}
return 0;
}
for $v (20020701,20020901) {
warn "testing $v:\n";
test_context_version($v);
}
--
Wybo