kernel-doc (47bcacfd2b00e3795eac3faf47eb854eb9675a4f) kernel-doc (ed8348e23abce79780f3b679c74a48bcdc47c947)
1#!/usr/bin/env perl
2# SPDX-License-Identifier: GPL-2.0
3
4use warnings;
5use strict;
6
7## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ##
8## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ##

--- 641 unchanged lines hidden (view full) ---

650 my $post = ",";
651 foreach my $parameter (@{$args{'parameterlist'}}) {
652 if ($count == $#{$args{'parameterlist'}}) {
653 $post = ");";
654 }
655 $type = $args{'parametertypes'}{$parameter};
656 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
657 # pointer-to-function
1#!/usr/bin/env perl
2# SPDX-License-Identifier: GPL-2.0
3
4use warnings;
5use strict;
6
7## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ##
8## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ##

--- 641 unchanged lines hidden (view full) ---

650 my $post = ",";
651 foreach my $parameter (@{$args{'parameterlist'}}) {
652 if ($count == $#{$args{'parameterlist'}}) {
653 $post = ");";
654 }
655 $type = $args{'parametertypes'}{$parameter};
656 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
657 # pointer-to-function
658 print ".BI \"" . $parenth . $1 . "\" " . $parameter . " \") (" . $2 . ")" . $post . "\"\n";
658 print ".BI \"" . $parenth . $1 . "\" " . " \") (" . $2 . ")" . $post . "\"\n";
659 } else {
660 $type =~ s/([^\*])$/$1 /;
659 } else {
660 $type =~ s/([^\*])$/$1 /;
661 print ".BI \"" . $parenth . $type . "\" " . $parameter . " \"" . $post . "\"\n";
661 print ".BI \"" . $parenth . $type . "\" " . " \"" . $post . "\"\n";
662 }
663 $count++;
664 $parenth = "";
665 }
666
667 print ".SH ARGUMENTS\n";
668 foreach $parameter (@{$args{'parameterlist'}}) {
669 my $parameter_name = $parameter;

--- 254 unchanged lines hidden (view full) ---

924 }
925 $count++;
926 $type = $args{'parametertypes'}{$parameter};
927
928 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
929 # pointer-to-function
930 print $1 . $parameter . ") (" . $2 . ")";
931 } else {
662 }
663 $count++;
664 $parenth = "";
665 }
666
667 print ".SH ARGUMENTS\n";
668 foreach $parameter (@{$args{'parameterlist'}}) {
669 my $parameter_name = $parameter;

--- 254 unchanged lines hidden (view full) ---

924 }
925 $count++;
926 $type = $args{'parametertypes'}{$parameter};
927
928 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
929 # pointer-to-function
930 print $1 . $parameter . ") (" . $2 . ")";
931 } else {
932 print $type . " " . $parameter;
932 print $type;
933 }
934 }
935 if ($args{'typedef'}) {
936 print ");``\n\n";
937 } else {
938 if ($sphinx_major < 3) {
939 print ")\n\n";
940 } else {

--- 8 unchanged lines hidden (view full) ---

949 print "**Parameters**\n\n";
950 $lineprefix = " ";
951 foreach $parameter (@{$args{'parameterlist'}}) {
952 my $parameter_name = $parameter;
953 $parameter_name =~ s/\[.*//;
954 $type = $args{'parametertypes'}{$parameter};
955
956 if ($type ne "") {
933 }
934 }
935 if ($args{'typedef'}) {
936 print ");``\n\n";
937 } else {
938 if ($sphinx_major < 3) {
939 print ")\n\n";
940 } else {

--- 8 unchanged lines hidden (view full) ---

949 print "**Parameters**\n\n";
950 $lineprefix = " ";
951 foreach $parameter (@{$args{'parameterlist'}}) {
952 my $parameter_name = $parameter;
953 $parameter_name =~ s/\[.*//;
954 $type = $args{'parametertypes'}{$parameter};
955
956 if ($type ne "") {
957 print "``$type $parameter``\n";
957 print "``$type``\n";
958 } else {
959 print "``$parameter``\n";
960 }
961
962 print_lineno($parameterdesc_start_lines{$parameter_name});
963
964 if (defined($args{'parameterdescs'}{$parameter_name}) &&
965 $args{'parameterdescs'}{$parameter_name} ne $undescribed) {

--- 508 unchanged lines hidden (view full) ---

1474 $arg =~ s/^\s*//;
1475 $arg =~ s/\s*$//;
1476 $arg =~ s/\s+/ /;
1477
1478 if ($arg =~ /^#/) {
1479 # Treat preprocessor directive as a typeless variable just to fill
1480 # corresponding data structures "correctly". Catch it later in
1481 # output_* subs.
958 } else {
959 print "``$parameter``\n";
960 }
961
962 print_lineno($parameterdesc_start_lines{$parameter_name});
963
964 if (defined($args{'parameterdescs'}{$parameter_name}) &&
965 $args{'parameterdescs'}{$parameter_name} ne $undescribed) {

--- 508 unchanged lines hidden (view full) ---

1474 $arg =~ s/^\s*//;
1475 $arg =~ s/\s*$//;
1476 $arg =~ s/\s+/ /;
1477
1478 if ($arg =~ /^#/) {
1479 # Treat preprocessor directive as a typeless variable just to fill
1480 # corresponding data structures "correctly". Catch it later in
1481 # output_* subs.
1482 push_parameter($arg, "", $file);
1482 push_parameter($arg, "", "", $file);
1483 } elsif ($arg =~ m/\(.+\)\s*\(/) {
1484 # pointer-to-function
1485 $arg =~ tr/#/,/;
1486 $arg =~ m/[^\(]+\(\*?\s*([\w\.]*)\s*\)/;
1487 $param = $1;
1488 $type = $arg;
1489 $type =~ s/([^\(]+\(\*?)\s*$param/$1/;
1490 save_struct_actual($param);
1483 } elsif ($arg =~ m/\(.+\)\s*\(/) {
1484 # pointer-to-function
1485 $arg =~ tr/#/,/;
1486 $arg =~ m/[^\(]+\(\*?\s*([\w\.]*)\s*\)/;
1487 $param = $1;
1488 $type = $arg;
1489 $type =~ s/([^\(]+\(\*?)\s*$param/$1/;
1490 save_struct_actual($param);
1491 push_parameter($param, $type, $file, $declaration_name);
1491 push_parameter($param, $type, $arg, $file, $declaration_name);
1492 } elsif ($arg) {
1493 $arg =~ s/\s*:\s*/:/g;
1494 $arg =~ s/\s*\[/\[/g;
1495
1496 my @args = split('\s*,\s*', $arg);
1497 if ($args[0] =~ m/\*/) {
1498 $args[0] =~ s/(\*+)\s*/ $1/;
1499 }

--- 8 unchanged lines hidden (view full) ---

1508 }
1509
1510 unshift(@args, pop @first_arg);
1511 $type = join " ", @first_arg;
1512
1513 foreach $param (@args) {
1514 if ($param =~ m/^(\*+)\s*(.*)/) {
1515 save_struct_actual($2);
1492 } elsif ($arg) {
1493 $arg =~ s/\s*:\s*/:/g;
1494 $arg =~ s/\s*\[/\[/g;
1495
1496 my @args = split('\s*,\s*', $arg);
1497 if ($args[0] =~ m/\*/) {
1498 $args[0] =~ s/(\*+)\s*/ $1/;
1499 }

--- 8 unchanged lines hidden (view full) ---

1508 }
1509
1510 unshift(@args, pop @first_arg);
1511 $type = join " ", @first_arg;
1512
1513 foreach $param (@args) {
1514 if ($param =~ m/^(\*+)\s*(.*)/) {
1515 save_struct_actual($2);
1516 push_parameter($2, "$type $1", $file, $declaration_name);
1516
1517 push_parameter($2, "$type $1", $arg, $file, $declaration_name);
1517 }
1518 elsif ($param =~ m/(.*?):(\d+)/) {
1519 if ($type ne "") { # skip unnamed bit-fields
1520 save_struct_actual($1);
1518 }
1519 elsif ($param =~ m/(.*?):(\d+)/) {
1520 if ($type ne "") { # skip unnamed bit-fields
1521 save_struct_actual($1);
1521 push_parameter($1, "$type:$2", $file, $declaration_name)
1522 push_parameter($1, "$type:$2", $arg, $file, $declaration_name)
1522 }
1523 }
1524 else {
1525 save_struct_actual($param);
1523 }
1524 }
1525 else {
1526 save_struct_actual($param);
1526 push_parameter($param, $type, $file, $declaration_name);
1527 push_parameter($param, $type, $arg, $file, $declaration_name);
1527 }
1528 }
1529 }
1530 }
1531}
1532
1528 }
1529 }
1530 }
1531 }
1532}
1533
1533sub push_parameter($$$$) {
1534sub push_parameter($$$$$) {
1534 my $param = shift;
1535 my $type = shift;
1535 my $param = shift;
1536 my $type = shift;
1537 my $org_arg = shift;
1536 my $file = shift;
1537 my $declaration_name = shift;
1538
1539 if (($anon_struct_union == 1) && ($type eq "") &&
1540 ($param eq "}")) {
1541 return; # ignore the ending }; from anon. struct/union
1542 }
1543

--- 47 unchanged lines hidden (view full) ---

1591 # this fixes a problem where check_sections() cannot find
1592 # a parameter like "addr[6 + 2]" because it actually appears
1593 # as "addr[6", "+", "2]" on the parameter list;
1594 # but it's better to maintain the param string unchanged for output,
1595 # so just weaken the string compare in check_sections() to ignore
1596 # "[blah" in a parameter string;
1597 ###$param =~ s/\s*//g;
1598 push @parameterlist, $param;
1538 my $file = shift;
1539 my $declaration_name = shift;
1540
1541 if (($anon_struct_union == 1) && ($type eq "") &&
1542 ($param eq "}")) {
1543 return; # ignore the ending }; from anon. struct/union
1544 }
1545

--- 47 unchanged lines hidden (view full) ---

1593 # this fixes a problem where check_sections() cannot find
1594 # a parameter like "addr[6 + 2]" because it actually appears
1595 # as "addr[6", "+", "2]" on the parameter list;
1596 # but it's better to maintain the param string unchanged for output,
1597 # so just weaken the string compare in check_sections() to ignore
1598 # "[blah" in a parameter string;
1599 ###$param =~ s/\s*//g;
1600 push @parameterlist, $param;
1599 $type =~ s/\s\s+/ /g;
1600 $parametertypes{$param} = $type;
1601 $org_arg =~ s/\s\s+/ /g;
1602 $parametertypes{$param} = $org_arg;
1601}
1602
1603sub check_sections($$$$$) {
1604 my ($file, $decl_name, $decl_type, $sectcheck, $prmscheck) = @_;
1605 my @sects = split ' ', $sectcheck;
1606 my @prms = split ' ', $prmscheck;
1607 my $err;
1608 my ($px, $sx);

--- 778 unchanged lines hidden ---
1603}
1604
1605sub check_sections($$$$$) {
1606 my ($file, $decl_name, $decl_type, $sectcheck, $prmscheck) = @_;
1607 my @sects = split ' ', $sectcheck;
1608 my @prms = split ' ', $prmscheck;
1609 my $err;
1610 my ($px, $sx);

--- 778 unchanged lines hidden ---