extern-scan.pl 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. # we may get the dir root pointed out
  30. my $root=$ARGV[0] || ".";
  31. my @incs = (
  32. "$root/include/curl/curl.h",
  33. "$root/include/curl/easy.h",
  34. "$root/include/curl/mprintf.h",
  35. "$root/include/curl/multi.h",
  36. "$root/include/curl/urlapi.h",
  37. "$root/include/curl/options.h",
  38. "$root/include/curl/header.h",
  39. );
  40. my $verbose=0;
  41. my $summary=0;
  42. my $misses=0;
  43. my @syms;
  44. my %doc;
  45. my %rem;
  46. sub scanheader {
  47. my ($f)=@_;
  48. open H, "<$f" || die;
  49. my $first = "";
  50. while(<H>) {
  51. s/CURL_DEPRECATED\(.*"\)//;
  52. s/ */ /g;
  53. if (/^(^CURL_EXTERN .*)\(/) {
  54. my $decl = $1;
  55. $decl =~ s/\r$//;
  56. print "$decl\n";
  57. }
  58. elsif (/^(^CURL_EXTERN .*)/) {
  59. # handle two-line declarations
  60. my $decl = $1;
  61. $decl =~ s/\r$//;
  62. $first = $decl;
  63. }
  64. elsif($first) {
  65. if (/^ *(.*)\(/) {
  66. my $decl = $1;
  67. $decl =~ s/\r$//;
  68. $first .= $decl;
  69. print "$first\n";
  70. }
  71. $first = "";
  72. }
  73. }
  74. close H;
  75. }
  76. foreach my $i (@incs) {
  77. scanheader($i);
  78. }