extern-scan.pl 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. # 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. if (/^(^CURL_EXTERN .*)\(/) {
  52. my $decl = $1;
  53. $decl =~ s/\r$//;
  54. print "$decl\n";
  55. }
  56. elsif (/^(^CURL_EXTERN .*)/) {
  57. # handle two-line declarations
  58. my $decl = $1;
  59. $decl =~ s/\r$//;
  60. $first = $decl;
  61. }
  62. elsif($first) {
  63. if (/^(.*)\(/) {
  64. my $decl = $1;
  65. $decl =~ s/\r$//;
  66. $first .= $decl;
  67. print "$first\n";
  68. }
  69. $first = "";
  70. }
  71. }
  72. close H;
  73. }
  74. foreach my $i (@incs) {
  75. scanheader($i);
  76. }