extern-scan.pl 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #!/usr/bin/env perl
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) 2010 - 2022, 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. ###########################################################################
  23. #
  24. #
  25. use strict;
  26. use warnings;
  27. # we may get the dir root pointed out
  28. my $root=$ARGV[0] || ".";
  29. my @incs = (
  30. "$root/include/curl/curl.h",
  31. "$root/include/curl/easy.h",
  32. "$root/include/curl/mprintf.h",
  33. "$root/include/curl/multi.h",
  34. "$root/include/curl/urlapi.h",
  35. "$root/include/curl/options.h",
  36. "$root/include/curl/header.h",
  37. );
  38. my $verbose=0;
  39. my $summary=0;
  40. my $misses=0;
  41. my @syms;
  42. my %doc;
  43. my %rem;
  44. sub scanheader {
  45. my ($f)=@_;
  46. open H, "<$f" || die;
  47. my $first = "";
  48. while(<H>) {
  49. if (/^(^CURL_EXTERN .*)\(/) {
  50. my $decl = $1;
  51. $decl =~ s/\r$//;
  52. print "$decl\n";
  53. }
  54. elsif (/^(^CURL_EXTERN .*)/) {
  55. # handle two-line declarations
  56. my $decl = $1;
  57. $decl =~ s/\r$//;
  58. $first = $decl;
  59. }
  60. elsif($first) {
  61. if (/^(.*)\(/) {
  62. my $decl = $1;
  63. $decl =~ s/\r$//;
  64. $first .= $decl;
  65. print "$first\n";
  66. }
  67. $first = "";
  68. }
  69. }
  70. close H;
  71. }
  72. foreach my $i (@incs) {
  73. scanheader($i);
  74. }