mm/vmalloc: provide fallback arch huge vmap support functions
[linux-2.6-microblaze.git] / scripts / get_abi.pl
index e870282..d7aa820 100755 (executable)
@@ -285,7 +285,7 @@ sub create_labels {
 # Boundaries are punct characters, spaces and end-of-line
 my $start = qr {(^|\s|\() }x;
 my $bondary = qr { ([,.:;\)\s]|\z) }x;
-my $xref_match = qr { $start(\/sys\/[^,.:;\)\s]+)$bondary }x;
+my $xref_match = qr { $start(\/(sys|config|proc|dev|kvd)\/[^,.:;\)\s]+)$bondary }x;
 my $symbols = qr { ([\x01-\x08\x0e-\x1f\x21-\x2f\x3a-\x40\x7b-\xff]) }x;
 
 sub output_rest {
@@ -381,34 +381,60 @@ sub output_rest {
 
                                # Enrich text by creating cross-references
 
-                               $desc =~ s,Documentation/(?!devicetree)(\S+)\.rst,:doc:`/$1`,g;
+                               my $new_desc = "";
+                               my $init_indent = -1;
+                               my $literal_indent = -1;
+
+                               open(my $fh, "+<", \$desc);
+                               while (my $d = <$fh>) {
+                                       my $indent = $d =~ m/^(\s+)/;
+                                       my $spaces = length($indent);
+                                       $init_indent = $indent if ($init_indent < 0);
+                                       if ($literal_indent >= 0) {
+                                               if ($spaces > $literal_indent) {
+                                                       $new_desc .= $d;
+                                                       next;
+                                               } else {
+                                                       $literal_indent = -1;
+                                               }
+                                       } else {
+                                               if ($d =~ /()::$/ && !($d =~ /^\s*\.\./)) {
+                                                       $literal_indent = $spaces;
+                                               }
+                                       }
 
-                               my @matches = $desc =~ m,Documentation/ABI/([\w\/\-]+),g;
-                               foreach my $f (@matches) {
-                                       my $xref = $f;
-                                       my $path = $f;
-                                       $path =~ s,.*/(.*/.*),$1,;;
-                                       $path =~ s,[/\-],_,g;;
-                                       $xref .= " <abi_file_" . $path . ">";
-                                       $desc =~ s,\bDocumentation/ABI/$f\b,:ref:`$xref`,g;
-                               }
+                                       $d =~ s,Documentation/(?!devicetree)(\S+)\.rst,:doc:`/$1`,g;
 
-                               # Seek for cross reference symbols like /sys/...
-                               @matches = $desc =~ m/$xref_match/g;
+                                       my @matches = $d =~ m,Documentation/ABI/([\w\/\-]+),g;
+                                       foreach my $f (@matches) {
+                                               my $xref = $f;
+                                               my $path = $f;
+                                               $path =~ s,.*/(.*/.*),$1,;;
+                                               $path =~ s,[/\-],_,g;;
+                                               $xref .= " <abi_file_" . $path . ">";
+                                               $d =~ s,\bDocumentation/ABI/$f\b,:ref:`$xref`,g;
+                                       }
+
+                                       # Seek for cross reference symbols like /sys/...
+                                       @matches = $d =~ m/$xref_match/g;
 
-                               foreach my $s (@matches) {
-                                       next if (!($s =~ m,/,));
-                                       if (defined($data{$s}) && defined($data{$s}->{label})) {
-                                               my $xref = $s;
+                                       foreach my $s (@matches) {
+                                               next if (!($s =~ m,/,));
+                                               if (defined($data{$s}) && defined($data{$s}->{label})) {
+                                                       my $xref = $s;
 
-                                               $xref =~ s/$symbols/\\$1/g;
-                                               $xref = ":ref:`$xref <" . $data{$s}->{label} . ">`";
+                                                       $xref =~ s/$symbols/\\$1/g;
+                                                       $xref = ":ref:`$xref <" . $data{$s}->{label} . ">`";
 
-                                               $desc =~ s,$start$s$bondary,$1$xref$2,g;
+                                                       $d =~ s,$start$s$bondary,$1$xref$2,g;
+                                               }
                                        }
+                                       $new_desc .= $d;
                                }
+                               close $fh;
+
 
-                               print "$desc\n\n";
+                               print "$new_desc\n\n";
                        } else {
                                $desc =~ s/^\s+//;