test1135.pl 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #!/usr/bin/env perl
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  10. #
  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 https://curl.se/docs/copyright.html.
  14. #
  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.
  18. #
  19. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  20. # KIND, either express or implied.
  21. #
  22. # SPDX-License-Identifier: curl
  23. #
  24. ###########################################################################
  25. #
  26. #
  27. use strict;
  28. use warnings;
  29. my $sort = 0;
  30. # we may get the dir root pointed out
  31. my $root = shift @ARGV;
  32. while(defined $root) {
  33. if($root =~ /--heading=(.*)/) {
  34. print "$1\n";
  35. $root = shift @ARGV;
  36. next;
  37. }
  38. elsif($root =~ /--sort/) {
  39. $sort = 1;
  40. $root = shift @ARGV;
  41. next;
  42. }
  43. last;
  44. }
  45. if(!defined $root) {
  46. $root = ".";
  47. }
  48. $root = "$root/include/curl";
  49. opendir(D, "$root") || die "Cannot open directory $root: $!\n";
  50. my @dir = readdir(D);
  51. closedir(D);
  52. my @incs;
  53. foreach (sort(@dir)) {
  54. if($_ =~ /\.h$/) {
  55. push(@incs, "$root/$_");
  56. }
  57. }
  58. my $verbose=0;
  59. my $summary=0;
  60. my $misses=0;
  61. my @syms;
  62. my %doc;
  63. my %rem;
  64. my @out;
  65. foreach my $f (@incs) {
  66. open H, "<$f" || die;
  67. my $first = "";
  68. while(<H>) {
  69. s/CURL_DEPRECATED\(.*"\)//;
  70. s/ */ /g;
  71. if (/^(^CURL_EXTERN .*?)\(/) {
  72. my $decl = $1;
  73. $decl =~ s/\r$//;
  74. $decl =~ /([a-z_]+)$/;
  75. push(@out, "$1");
  76. }
  77. elsif (/^(^CURL_EXTERN .*)/) {
  78. # handle two-line declarations
  79. my $decl = $1;
  80. $decl =~ s/\r$//;
  81. $first = $decl;
  82. }
  83. elsif($first) {
  84. if (/^ *(.*)\(/) {
  85. my $decl = $1;
  86. $decl =~ s/\r$//;
  87. $first .= $decl;
  88. $first =~ /([a-z_]+)$/;
  89. push(@out, "$1");
  90. }
  91. $first = "";
  92. }
  93. }
  94. close H;
  95. }
  96. if($sort) {
  97. @out = sort(@out);
  98. }
  99. foreach (@out) {
  100. print("$_\n");
  101. }