Adapted to the interface/implementation separation.
[wine] / tools / make_authors
1 #! /usr/bin/perl
2 #
3 # Generate AUTHORS and include/authors.h
4 #
5 open(AUTHORS,"<AUTHORS") or die "Can't open AUTHORS";
6 open(NEWAUTHORS,">AUTHORS.new");
7 while(<AUTHORS>)
8   {
9     print NEWAUTHORS;
10     last if /^Wine is/;
11   }
12 while(<AUTHORS>)
13   {
14     chop;
15     s/^and //;
16     s/[,.]$//;
17     push @authors, $_;
18   }
19
20 # Sort them
21 sub cmpnames
22   {
23     @anames = split(" ",$a);
24     @bnames = split(" ",$b);
25     $ret = $anames[-1] cmp $bnames[-1];
26     $ret = $anames[0] cmp $bnames[0] unless $ret;
27     return $ret;
28   }
29 @authors = sort cmpnames @authors;
30
31 # Print authors
32 for ($i = 0; $i < $#authors; $i++)
33   {
34     print NEWAUTHORS "$authors[$i],\n";
35   }
36 print NEWAUTHORS "and $authors[$#authors].\n";
37 print "Created AUTHORS.new\n";
38
39 # Build authors.h file
40 open(NEWAUTHORS_H,">include/authors.h");
41
42 print NEWAUTHORS_H <<EOF;
43 #ifndef __WINE_AUTHORS_H
44 #define __WINE_AUTHORS_H
45
46 static const char * const SHELL_People[] =
47 {
48 EOF
49
50 # Print authors
51 for ($i = 0; $i <= $#authors; $i++)
52   {
53     print NEWAUTHORS_H "    \"$authors[$i]\",\n";
54   }
55 print NEWAUTHORS_H "    NULL\n};\n";
56 print NEWAUTHORS_H "\n#endif  /* __WINE_AUTHORS_H */\n";
57
58 print "Created include/authors.h\n";