fake_change_log.pl 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/usr/bin/perl
  2. $file1 = shift;
  3. $file2 = shift;
  4. open file1,"<$file1" or die;
  5. while (<file1>) {
  6. if (m/^\s*\((defun|defsubst|defmacro|defcustom|defgroup|defface|defvar|defconst)\s+([-a-zA-Z0-9]+)/) {
  7. if ($1 eq "defun") {
  8. $fun1{$2}++;
  9. } elsif ($1 eq "defsubst") {
  10. $subst1{$2}++;
  11. } elsif ($1 eq "defmacro") {
  12. $macro1{$2}++;
  13. } elsif ($1 eq "defgroup") {
  14. $group1{$2}++;
  15. } elsif ($1 eq "defcustom") {
  16. $custom1{$2}++;
  17. } elsif ($1 eq "defface") {
  18. $face1{$2}++;
  19. } elsif ($1 eq "defvar") {
  20. $var1{$2}++;
  21. } elsif ($1 eq "defconst") {
  22. $const1{$2}++;
  23. }
  24. }
  25. }
  26. close file1;
  27. open file2,"<$file2" or die;
  28. while (<file2>) {
  29. if (m/^\s*\((defun|defsubst|defmacro|defcustom|defgroup|defface|defvar|defconst)\s+([-a-zA-Z0-9]+)/) {
  30. if ($1 eq "defun") {
  31. $fun2{$2}++;
  32. } elsif ($1 eq "defsubst") {
  33. $subst2{$2}++;
  34. } elsif ($1 eq "defmacro") {
  35. $macro2{$2}++;
  36. } elsif ($1 eq "defgroup") {
  37. $group2{$2}++;
  38. } elsif ($1 eq "defcustom") {
  39. $custom2{$2}++;
  40. } elsif ($1 eq "defface") {
  41. $face2{$2}++;
  42. } elsif ($1 eq "defvar") {
  43. $var2{$2}++;
  44. } elsif ($1 eq "defconst") {
  45. $const2{$2}++;
  46. }
  47. }
  48. }
  49. close file2;
  50. foreach $type ("fun","subst","macro","group","custom","face","var","const") {
  51. $cmd1 = '%n1 = %' . $type . "1;";
  52. $cmd2 = '%n2 = %' . $type . "2;";
  53. eval $cmd1;
  54. eval $cmd2;
  55. print "$type added:\n";
  56. foreach (keys %n2) {
  57. unless (defined $n1{$_}) {
  58. print " $_\n";
  59. }
  60. }
  61. print "$type removed:\n";
  62. foreach (keys %n1) {
  63. unless (defined $n2{$_}) {
  64. print " $_\n";
  65. }
  66. }
  67. }