2 #***************************************************************************
4 # Project ___| | | | _ \| |
6 # | (__| |_| | _ <| |___
7 # \___|\___/|_| \_\_____|
9 # Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
11 # This software is licensed as described in the file COPYING, which
12 # you should have received as part of this distribution. The terms
13 # are also available at http://curl.haxx.se/docs/copyright.html.
15 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
16 # copies of the Software, and permit persons to whom the Software is
17 # furnished to do so, under the terms of the COPYING file.
19 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 # KIND, either express or implied.
22 ###########################################################################
24 # This script accepts a source file as input on the command line.
26 # It first loads the 'symbols-in-versions' document and stores a lookup
27 # table for all known symbols for which version they were introduced.
29 # It then scans the given source file to dig up all symbols starting with CURL.
30 # Finally, it sorts the internal list of found symbols (using the version
31 # number as sort key) and then it outputs the most recent version number and
32 # the symbols from that version that are used.
36 # version-check.pl [source file]
39 open(S, "<../libcurl/symbols-in-versions") || die;
44 if(/(^CURL[^ \n]*) *(.*)/) {
45 my ($sym, $rest)=($1, $2);
46 my @a=split(/ +/, $rest);
48 $doc{$sym}=$a[0]; # when it was introduced
51 # this symbol is documented to have been present the last time
64 my @s=split(/\./, $ver);
65 return $s[0]*10000+$s[1]*100+$s[2];
69 open(C, "<$ARGV[0]") || die;
72 if(/\W(CURL[_A-Z0-9v]+)\W/) {
81 my $r = age($doc{$a}) <=> age($doc{$b});
88 my @recent = reverse sort sortversions keys %used;
90 # the most recent symbol
91 my $newsym = $recent[0];
92 # the most recent version
93 my $newver = $doc{$newsym};
95 print "The scanned source uses these symbols introduced in $newver:\n";
98 if($doc{$w} eq $newver) {