kernel-doc (5f8f8574c7f5585b09a9623f0f13462e4eb67b4d) | kernel-doc (eaf710ceb5ae284778a87c0d0f2348c19e3e4751) |
---|---|
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> ## --- 852 unchanged lines hidden (view full) --- 861 } 862 if (!$args{'typedef'}) { 863 print_lineno($declaration_start_line); 864 $lineprefix = " "; 865 output_highlight_rst($args{'purpose'}); 866 print "\n"; 867 } 868 | 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> ## --- 852 unchanged lines hidden (view full) --- 861 } 862 if (!$args{'typedef'}) { 863 print_lineno($declaration_start_line); 864 $lineprefix = " "; 865 output_highlight_rst($args{'purpose'}); 866 print "\n"; 867 } 868 |
869 print "**Parameters**\n\n"; | 869 # 870 # Put our descriptive text into a container (thus an HTML <div>) to help 871 # set the function prototypes apart. 872 # 873 print ".. container:: kernelindent\n\n"; |
870 $lineprefix = " "; | 874 $lineprefix = " "; |
875 print $lineprefix . "**Parameters**\n\n"; |
|
871 foreach $parameter (@{$args{'parameterlist'}}) { 872 my $parameter_name = $parameter; 873 $parameter_name =~ s/\[.*//; 874 $type = $args{'parametertypes'}{$parameter}; 875 876 if ($type ne "") { | 876 foreach $parameter (@{$args{'parameterlist'}}) { 877 my $parameter_name = $parameter; 878 $parameter_name =~ s/\[.*//; 879 $type = $args{'parametertypes'}{$parameter}; 880 881 if ($type ne "") { |
877 print "``$type``\n"; | 882 print $lineprefix . "``$type``\n"; |
878 } else { | 883 } else { |
879 print "``$parameter``\n"; | 884 print $lineprefix . "``$parameter``\n"; |
880 } 881 882 print_lineno($parameterdesc_start_lines{$parameter_name}); 883 | 885 } 886 887 print_lineno($parameterdesc_start_lines{$parameter_name}); 888 |
889 $lineprefix = " "; |
|
884 if (defined($args{'parameterdescs'}{$parameter_name}) && 885 $args{'parameterdescs'}{$parameter_name} ne $undescribed) { 886 output_highlight_rst($args{'parameterdescs'}{$parameter_name}); 887 } else { | 890 if (defined($args{'parameterdescs'}{$parameter_name}) && 891 $args{'parameterdescs'}{$parameter_name} ne $undescribed) { 892 output_highlight_rst($args{'parameterdescs'}{$parameter_name}); 893 } else { |
888 print " *undescribed*\n"; | 894 print $lineprefix . "*undescribed*\n"; |
889 } | 895 } |
896 $lineprefix = " "; |
|
890 print "\n"; 891 } 892 | 897 print "\n"; 898 } 899 |
893 $lineprefix = $oldprefix; | |
894 output_section_rst(@_); | 900 output_section_rst(@_); |
901 $lineprefix = $oldprefix; |
|
895} 896 897sub output_section_rst(%) { 898 my %args = %{$_[0]}; 899 my $section; 900 my $oldprefix = $lineprefix; | 902} 903 904sub output_section_rst(%) { 905 my %args = %{$_[0]}; 906 my $section; 907 my $oldprefix = $lineprefix; |
901 $lineprefix = ""; | |
902 903 foreach $section (@{$args{'sectionlist'}}) { | 908 909 foreach $section (@{$args{'sectionlist'}}) { |
904 print "**$section**\n\n"; | 910 print $lineprefix . "**$section**\n\n"; |
905 print_lineno($section_start_lines{$section}); 906 output_highlight_rst($args{'sections'}{$section}); 907 print "\n"; 908 } 909 print "\n"; | 911 print_lineno($section_start_lines{$section}); 912 output_highlight_rst($args{'sections'}{$section}); 913 print "\n"; 914 } 915 print "\n"; |
910 $lineprefix = $oldprefix; | |
911} 912 913sub output_enum_rst(%) { 914 my %args = %{$_[0]}; 915 my ($parameter); 916 my $oldprefix = $lineprefix; 917 my $count; | 916} 917 918sub output_enum_rst(%) { 919 my %args = %{$_[0]}; 920 my ($parameter); 921 my $oldprefix = $lineprefix; 922 my $count; |
923 my $outer; |
|
918 919 if ($sphinx_major < 3) { 920 my $name = "enum " . $args{'enum'}; 921 print "\n\n.. c:type:: " . $name . "\n\n"; 922 } else { 923 my $name = $args{'enum'}; 924 print "\n\n.. c:enum:: " . $name . "\n\n"; 925 } 926 print_lineno($declaration_start_line); | 924 925 if ($sphinx_major < 3) { 926 my $name = "enum " . $args{'enum'}; 927 print "\n\n.. c:type:: " . $name . "\n\n"; 928 } else { 929 my $name = $args{'enum'}; 930 print "\n\n.. c:enum:: " . $name . "\n\n"; 931 } 932 print_lineno($declaration_start_line); |
927 $lineprefix = " "; | 933 $lineprefix = " "; |
928 output_highlight_rst($args{'purpose'}); 929 print "\n"; 930 | 934 output_highlight_rst($args{'purpose'}); 935 print "\n"; 936 |
931 print "**Constants**\n\n"; 932 $lineprefix = " "; | 937 print ".. container:: kernelindent\n\n"; 938 $outer = $lineprefix . " "; 939 $lineprefix = $outer . " "; 940 print $outer . "**Constants**\n\n"; |
933 foreach $parameter (@{$args{'parameterlist'}}) { | 941 foreach $parameter (@{$args{'parameterlist'}}) { |
934 print "``$parameter``\n"; | 942 print $outer . "``$parameter``\n"; 943 |
935 if ($args{'parameterdescs'}{$parameter} ne $undescribed) { 936 output_highlight_rst($args{'parameterdescs'}{$parameter}); 937 } else { | 944 if ($args{'parameterdescs'}{$parameter} ne $undescribed) { 945 output_highlight_rst($args{'parameterdescs'}{$parameter}); 946 } else { |
938 print " *undescribed*\n"; | 947 print $lineprefix . "*undescribed*\n"; |
939 } 940 print "\n"; 941 } | 948 } 949 print "\n"; 950 } |
942 | 951 print "\n"; |
943 $lineprefix = $oldprefix; 944 output_section_rst(@_); 945} 946 947sub output_typedef_rst(%) { 948 my %args = %{$_[0]}; 949 my ($parameter); 950 my $oldprefix = $lineprefix; --- 26 unchanged lines hidden (view full) --- 977 my $name = $args{'struct'}; 978 if ($args{'type'} eq 'union') { 979 print "\n\n.. c:union:: " . $name . "\n\n"; 980 } else { 981 print "\n\n.. c:struct:: " . $name . "\n\n"; 982 } 983 } 984 print_lineno($declaration_start_line); | 952 $lineprefix = $oldprefix; 953 output_section_rst(@_); 954} 955 956sub output_typedef_rst(%) { 957 my %args = %{$_[0]}; 958 my ($parameter); 959 my $oldprefix = $lineprefix; --- 26 unchanged lines hidden (view full) --- 986 my $name = $args{'struct'}; 987 if ($args{'type'} eq 'union') { 988 print "\n\n.. c:union:: " . $name . "\n\n"; 989 } else { 990 print "\n\n.. c:struct:: " . $name . "\n\n"; 991 } 992 } 993 print_lineno($declaration_start_line); |
985 $lineprefix = " "; | 994 $lineprefix = " "; |
986 output_highlight_rst($args{'purpose'}); 987 print "\n"; 988 | 995 output_highlight_rst($args{'purpose'}); 996 print "\n"; 997 |
989 print "**Definition**\n\n"; 990 print "::\n\n"; | 998 print ".. container:: kernelindent\n\n"; 999 print $lineprefix . "**Definition**::\n\n"; |
991 my $declaration = $args{'definition'}; | 1000 my $declaration = $args{'definition'}; |
992 $declaration =~ s/\t/ /g; 993 print " " . $args{'type'} . " " . $args{'struct'} . " {\n$declaration };\n\n"; | 1001 $lineprefix = $lineprefix . " "; 1002 $declaration =~ s/\t/$lineprefix/g; 1003 print $lineprefix . $args{'type'} . " " . $args{'struct'} . " {\n$declaration" . $lineprefix . "};\n\n"; |
994 | 1004 |
995 print "**Members**\n\n"; | |
996 $lineprefix = " "; | 1005 $lineprefix = " "; |
1006 print $lineprefix . "**Members**\n\n"; |
|
997 foreach $parameter (@{$args{'parameterlist'}}) { 998 ($parameter =~ /^#/) && next; 999 1000 my $parameter_name = $parameter; 1001 $parameter_name =~ s/\[.*//; 1002 1003 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; 1004 $type = $args{'parametertypes'}{$parameter}; 1005 print_lineno($parameterdesc_start_lines{$parameter_name}); | 1007 foreach $parameter (@{$args{'parameterlist'}}) { 1008 ($parameter =~ /^#/) && next; 1009 1010 my $parameter_name = $parameter; 1011 $parameter_name =~ s/\[.*//; 1012 1013 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; 1014 $type = $args{'parametertypes'}{$parameter}; 1015 print_lineno($parameterdesc_start_lines{$parameter_name}); |
1006 print "``" . $parameter . "``\n"; | 1016 print $lineprefix . "``" . $parameter . "``\n"; 1017 $lineprefix = " "; |
1007 output_highlight_rst($args{'parameterdescs'}{$parameter_name}); | 1018 output_highlight_rst($args{'parameterdescs'}{$parameter_name}); |
1019 $lineprefix = " "; |
|
1008 print "\n"; 1009 } 1010 print "\n"; 1011 1012 $lineprefix = $oldprefix; 1013 output_section_rst(@_); 1014} 1015 --- 1476 unchanged lines hidden --- | 1020 print "\n"; 1021 } 1022 print "\n"; 1023 1024 $lineprefix = $oldprefix; 1025 output_section_rst(@_); 1026} 1027 --- 1476 unchanged lines hidden --- |