kernel-doc (2fc2991175bf77395e6b15fe6b2304d3bf72da40) kernel-doc (aeec46b97a7975fd983219177980c58ed4fd607c)
1#!/usr/bin/perl -w
2
3use strict;
4
5## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ##
6## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ##
7## Copyright (C) 2001 Simon Huggins ##
8## ##

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

112# * @a: first member
113# * @b: second member
114# *
115# * Longer description
116# */
117# struct my_struct {
118# int a;
119# int b;
1#!/usr/bin/perl -w
2
3use strict;
4
5## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ##
6## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ##
7## Copyright (C) 2001 Simon Huggins ##
8## ##

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

112# * @a: first member
113# * @b: second member
114# *
115# * Longer description
116# */
117# struct my_struct {
118# int a;
119# int b;
120# /* private: */
121# int c;
120# };
121#
122# All descriptions can be multiline, except the short function description.
123#
124# You can also add additional sections. When documenting kernel functions you
125# should document the "Context:" of the function, e.g. whether the functions
126# can be called form interrupts. Unlike other sections you can end it with an
127# empty line.

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

1299
1300 if ($x =~/(struct|union)\s+(\w+)\s*{(.*)}/) {
1301 $declaration_name = $2;
1302 my $members = $3;
1303
1304 # ignore embedded structs or unions
1305 $members =~ s/{.*?}//g;
1306
122# };
123#
124# All descriptions can be multiline, except the short function description.
125#
126# You can also add additional sections. When documenting kernel functions you
127# should document the "Context:" of the function, e.g. whether the functions
128# can be called form interrupts. Unlike other sections you can end it with an
129# empty line.

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

1301
1302 if ($x =~/(struct|union)\s+(\w+)\s*{(.*)}/) {
1303 $declaration_name = $2;
1304 my $members = $3;
1305
1306 # ignore embedded structs or unions
1307 $members =~ s/{.*?}//g;
1308
1309 # ignore members marked private:
1310 $members =~ s/\/\*.*?private:.*?public:.*?\*\///gos;
1311 $members =~ s/\/\*.*?private:.*//gos;
1312 # strip comments:
1313 $members =~ s/\/\*.*?\*\///gos;
1314
1307 create_parameterlist($members, ';', $file);
1308
1309 output_declaration($declaration_name,
1310 'struct',
1311 {'struct' => $declaration_name,
1312 'module' => $modulename,
1313 'parameterlist' => \@parameterlist,
1314 'parameterdescs' => \%parameterdescs,

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

1324 ++$errors;
1325 }
1326}
1327
1328sub dump_enum($$) {
1329 my $x = shift;
1330 my $file = shift;
1331
1315 create_parameterlist($members, ';', $file);
1316
1317 output_declaration($declaration_name,
1318 'struct',
1319 {'struct' => $declaration_name,
1320 'module' => $modulename,
1321 'parameterlist' => \@parameterlist,
1322 'parameterdescs' => \%parameterdescs,

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

1332 ++$errors;
1333 }
1334}
1335
1336sub dump_enum($$) {
1337 my $x = shift;
1338 my $file = shift;
1339
1340 $x =~ s@/\*.*?\*/@@gos; # strip comments.
1332 if ($x =~ /enum\s+(\w+)\s*{(.*)}/) {
1333 $declaration_name = $1;
1334 my $members = $2;
1335
1336 foreach my $arg (split ',', $members) {
1337 $arg =~ s/^\s*(\w+).*/$1/;
1338 push @parameterlist, $arg;
1339 if (!$parameterdescs{$arg}) {

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

1360 ++$errors;
1361 }
1362}
1363
1364sub dump_typedef($$) {
1365 my $x = shift;
1366 my $file = shift;
1367
1341 if ($x =~ /enum\s+(\w+)\s*{(.*)}/) {
1342 $declaration_name = $1;
1343 my $members = $2;
1344
1345 foreach my $arg (split ',', $members) {
1346 $arg =~ s/^\s*(\w+).*/$1/;
1347 push @parameterlist, $arg;
1348 if (!$parameterdescs{$arg}) {

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

1369 ++$errors;
1370 }
1371}
1372
1373sub dump_typedef($$) {
1374 my $x = shift;
1375 my $file = shift;
1376
1377 $x =~ s@/\*.*?\*/@@gos; # strip comments.
1368 while (($x =~ /\(*.\)\s*;$/) || ($x =~ /\[*.\]\s*;$/)) {
1369 $x =~ s/\(*.\)\s*;$/;/;
1370 $x =~ s/\[*.\]\s*;$/;/;
1371 }
1372
1373 if ($x =~ /typedef.*\s+(\w+)\s*;/) {
1374 $declaration_name = $1;
1375

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

1415 } elsif ($arg =~ m/\(/) {
1416 # pointer-to-function
1417 $arg =~ tr/#/,/;
1418 $arg =~ m/[^\(]+\(\*([^\)]+)\)/;
1419 $param = $1;
1420 $type = $arg;
1421 $type =~ s/([^\(]+\(\*)$param/$1/;
1422 push_parameter($param, $type, $file);
1378 while (($x =~ /\(*.\)\s*;$/) || ($x =~ /\[*.\]\s*;$/)) {
1379 $x =~ s/\(*.\)\s*;$/;/;
1380 $x =~ s/\[*.\]\s*;$/;/;
1381 }
1382
1383 if ($x =~ /typedef.*\s+(\w+)\s*;/) {
1384 $declaration_name = $1;
1385

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

1425 } elsif ($arg =~ m/\(/) {
1426 # pointer-to-function
1427 $arg =~ tr/#/,/;
1428 $arg =~ m/[^\(]+\(\*([^\)]+)\)/;
1429 $param = $1;
1430 $type = $arg;
1431 $type =~ s/([^\(]+\(\*)$param/$1/;
1432 push_parameter($param, $type, $file);
1423 } else {
1433 } elsif ($arg) {
1424 $arg =~ s/\s*:\s*/:/g;
1425 $arg =~ s/\s*\[/\[/g;
1426
1427 my @args = split('\s*,\s*', $arg);
1428 if ($args[0] =~ m/\*/) {
1429 $args[0] =~ s/(\*+)\s*/ $1/;
1430 }
1431 my @first_arg = split('\s+', shift @args);

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

1623 reset_state();
1624 }
1625}
1626
1627sub process_state3_type($$) {
1628 my $x = shift;
1629 my $file = shift;
1630
1434 $arg =~ s/\s*:\s*/:/g;
1435 $arg =~ s/\s*\[/\[/g;
1436
1437 my @args = split('\s*,\s*', $arg);
1438 if ($args[0] =~ m/\*/) {
1439 $args[0] =~ s/(\*+)\s*/ $1/;
1440 }
1441 my @first_arg = split('\s+', shift @args);

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

1633 reset_state();
1634 }
1635}
1636
1637sub process_state3_type($$) {
1638 my $x = shift;
1639 my $file = shift;
1640
1631 $x =~ s@/\*.*?\*/@@gos; # strip comments.
1632 $x =~ s@[\r\n]+@ @gos; # strip newlines/cr's.
1633 $x =~ s@^\s+@@gos; # strip leading spaces
1634 $x =~ s@\s+$@@gos; # strip trailing spaces
1635 if ($x =~ /^#/) {
1636 # To distinguish preprocessor directive from regular declaration later.
1637 $x .= ";";
1638 }
1639

--- 229 unchanged lines hidden ---
1641 $x =~ s@[\r\n]+@ @gos; # strip newlines/cr's.
1642 $x =~ s@^\s+@@gos; # strip leading spaces
1643 $x =~ s@\s+$@@gos; # strip trailing spaces
1644 if ($x =~ /^#/) {
1645 # To distinguish preprocessor directive from regular declaration later.
1646 $x .= ";";
1647 }
1648

--- 229 unchanged lines hidden ---