quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

test1135.pl (2574B)


      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 use strict;
     27 use warnings;
     28 
     29 my $sort = 0;
     30 
     31 # we may get the dir root pointed out
     32 my $root = shift @ARGV;
     33 while(defined $root) {
     34 
     35     if($root =~ /--heading=(.*)/) {
     36         print "$1\n";
     37         $root = shift @ARGV;
     38         next;
     39     }
     40     elsif($root =~ /--sort/) {
     41         $sort = 1;
     42         $root = shift @ARGV;
     43         next;
     44     }
     45 
     46     last;
     47 }
     48 
     49 if(!defined $root) {
     50     $root = ".";
     51 }
     52 
     53 $root = "$root/include/curl";
     54 opendir(D, "$root") || die "Cannot open directory $root: $!\n";
     55 my @dir = readdir(D);
     56 closedir(D);
     57 
     58 my @incs;
     59 foreach (sort(@dir)) {
     60     if($_ =~ /\.h$/) {
     61         push(@incs, "$root/$_");
     62     }
     63 }
     64 
     65 my $verbose=0;
     66 my $summary=0;
     67 my $misses=0;
     68 
     69 my @out;
     70 foreach my $f (@incs) {
     71     open H, "<$f" || die;
     72     my $first = "";
     73     while(<H>) {
     74         s/CURL_DEPRECATED\(.*"\)//;
     75         s/  */ /g;
     76         if(/^(^CURL_EXTERN .*?)\(/) {
     77             my $decl = $1;
     78             $decl =~ s/\r$//;
     79             $decl =~ /([a-z_]+)$/;
     80             push(@out, "$1");
     81         }
     82         elsif(/^(^CURL_EXTERN .*)/) {
     83             # handle two-line declarations
     84             my $decl = $1;
     85             $decl =~ s/\r$//;
     86             $first = $decl;
     87         }
     88         elsif($first) {
     89             if(/^ *(.*)\(/) {
     90                 my $decl = $1;
     91                 $decl =~ s/\r$//;
     92                 $first .= $decl;
     93                 $first =~ /([a-z_]+)$/;
     94                 push(@out, "$1");
     95             }
     96             $first = "";
     97         }
     98     }
     99     close H;
    100 }
    101 
    102 if($sort) {
    103     @out = sort(@out);
    104 }
    105 
    106 foreach (@out) {
    107     print("$_\n");
    108 }