kernel-doc (5267dd354bcd267f76d0f97193fe8a93899f8986) kernel-doc (df31175bb4d372b99410034a8ac23ae5526f49d2)
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## Copyright (C) 2005-2012 Randy Dunlap ##

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

209my $warnings = 0;
210my $anon_struct_union = 0;
211
212# match expressions used to find embedded type information
213my $type_constant = '\%([-_\w]+)';
214my $type_func = '(\w+)\(\)';
215my $type_param = '\@(\w+(\.\.\.)?)';
216my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params
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## Copyright (C) 2005-2012 Randy Dunlap ##

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

209my $warnings = 0;
210my $anon_struct_union = 0;
211
212# match expressions used to find embedded type information
213my $type_constant = '\%([-_\w]+)';
214my $type_func = '(\w+)\(\)';
215my $type_param = '\@(\w+(\.\.\.)?)';
216my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params
217my $type_struct = '\&((struct\s*)*[_\w]+)';
218my $type_struct_xml = '\\&amp;((struct\s*)*[_\w]+)';
219my $type_env = '(\$\w+)';
217my $type_env = '(\$\w+)';
220my $type_enum_full = '\&(enum)\s*([_\w]+)';
221my $type_struct_full = '\&(struct)\s*([_\w]+)';
222my $type_typedef_full = '\&(typedef)\s*([_\w]+)';
223my $type_union_full = '\&(union)\s*([_\w]+)';
218my $type_enum = '\&(enum\s*([_\w]+))';
219my $type_struct = '\&(struct\s*([_\w]+))';
220my $type_typedef = '\&(typedef\s*([_\w]+))';
221my $type_union = '\&(union\s*([_\w]+))';
224my $type_member = '\&([_\w]+)(\.|->)([_\w]+)';
222my $type_member = '\&([_\w]+)(\.|->)([_\w]+)';
223my $type_fallback = '\&([_\w]+)';
224my $type_enum_xml = '\&amp;(enum\s*([_\w]+))';
225my $type_struct_xml = '\&amp;(struct\s*([_\w]+))';
226my $type_typedef_xml = '\&amp;(typedef\s*([_\w]+))';
227my $type_union_xml = '\&amp;(union\s*([_\w]+))';
225my $type_member_xml = '\&amp;([_\w]+)(\.|-\&gt;)([_\w]+)';
228my $type_member_xml = '\&amp;([_\w]+)(\.|-\&gt;)([_\w]+)';
229my $type_fallback_xml = '\&amp([_\w]+)';
226my $type_member_func = $type_member . '\(\)';
227
228# Output conversion substitutions.
229# One for each output format
230
231# these work fairly well
232my @highlights_html = (
233 [$type_constant, "<i>\$1</i>"],
234 [$type_func, "<b>\$1</b>"],
230my $type_member_func = $type_member . '\(\)';
231
232# Output conversion substitutions.
233# One for each output format
234
235# these work fairly well
236my @highlights_html = (
237 [$type_constant, "<i>\$1</i>"],
238 [$type_func, "<b>\$1</b>"],
239 [$type_enum_xml, "<i>\$1</i>"],
235 [$type_struct_xml, "<i>\$1</i>"],
240 [$type_struct_xml, "<i>\$1</i>"],
241 [$type_typedef_xml, "<i>\$1</i>"],
242 [$type_union_xml, "<i>\$1</i>"],
236 [$type_env, "<b><i>\$1</i></b>"],
237 [$type_param, "<tt><b>\$1</b></tt>"],
243 [$type_env, "<b><i>\$1</i></b>"],
244 [$type_param, "<tt><b>\$1</b></tt>"],
238 [$type_member_xml, "<tt><i>\$1</i>\$2\$3</tt>"]
245 [$type_member_xml, "<tt><i>\$1</i>\$2\$3</tt>"],
246 [$type_fallback_xml, "<i>\$1</i>"]
239 );
240my $local_lt = "\\\\\\\\lt:";
241my $local_gt = "\\\\\\\\gt:";
242my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>"
243
244# html version 5
245my @highlights_html5 = (
246 [$type_constant, "<span class=\"const\">\$1</span>"],
247 [$type_func, "<span class=\"func\">\$1</span>"],
247 );
248my $local_lt = "\\\\\\\\lt:";
249my $local_gt = "\\\\\\\\gt:";
250my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>"
251
252# html version 5
253my @highlights_html5 = (
254 [$type_constant, "<span class=\"const\">\$1</span>"],
255 [$type_func, "<span class=\"func\">\$1</span>"],
256 [$type_enum_xml, "<span class=\"enum\">\$1</span>"],
248 [$type_struct_xml, "<span class=\"struct\">\$1</span>"],
257 [$type_struct_xml, "<span class=\"struct\">\$1</span>"],
258 [$type_typedef_xml, "<span class=\"typedef\">\$1</span>"],
259 [$type_union_xml, "<span class=\"union\">\$1</span>"],
249 [$type_env, "<span class=\"env\">\$1</span>"],
250 [$type_param, "<span class=\"param\">\$1</span>]"],
260 [$type_env, "<span class=\"env\">\$1</span>"],
261 [$type_param, "<span class=\"param\">\$1</span>]"],
251 [$type_member_xml, "<span class=\"literal\"><span class=\"struct\">\$1</span>\$2<span class=\"member\">\$3</span></span>"]
262 [$type_member_xml, "<span class=\"literal\"><span class=\"struct\">\$1</span>\$2<span class=\"member\">\$3</span></span>"],
263 [$type_fallback_xml, "<span class=\"struct\">\$1</span>"]
252 );
253my $blankline_html5 = $local_lt . "br /" . $local_gt;
254
255# XML, docbook format
256my @highlights_xml = (
257 ["([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>"],
258 [$type_constant, "<constant>\$1</constant>"],
264 );
265my $blankline_html5 = $local_lt . "br /" . $local_gt;
266
267# XML, docbook format
268my @highlights_xml = (
269 ["([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>"],
270 [$type_constant, "<constant>\$1</constant>"],
271 [$type_enum_xml, "<type>\$1</type>"],
259 [$type_struct_xml, "<structname>\$1</structname>"],
272 [$type_struct_xml, "<structname>\$1</structname>"],
273 [$type_typedef_xml, "<type>\$1</type>"],
274 [$type_union_xml, "<structname>\$1</structname>"],
260 [$type_param, "<parameter>\$1</parameter>"],
261 [$type_func, "<function>\$1</function>"],
262 [$type_env, "<envar>\$1</envar>"],
275 [$type_param, "<parameter>\$1</parameter>"],
276 [$type_func, "<function>\$1</function>"],
277 [$type_env, "<envar>\$1</envar>"],
263 [$type_member_xml, "<literal><structname>\$1</structname>\$2<structfield>\$3</structfield></literal>"]
278 [$type_member_xml, "<literal><structname>\$1</structname>\$2<structfield>\$3</structfield></literal>"],
279 [$type_fallback_xml, "<structname>\$1</structname>"]
264 );
265my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $local_gt . "\n";
266
267# gnome, docbook format
268my @highlights_gnome = (
269 [$type_constant, "<replaceable class=\"option\">\$1</replaceable>"],
270 [$type_func, "<function>\$1</function>"],
280 );
281my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $local_gt . "\n";
282
283# gnome, docbook format
284my @highlights_gnome = (
285 [$type_constant, "<replaceable class=\"option\">\$1</replaceable>"],
286 [$type_func, "<function>\$1</function>"],
287 [$type_enum, "<type>\$1</type>"],
271 [$type_struct, "<structname>\$1</structname>"],
288 [$type_struct, "<structname>\$1</structname>"],
289 [$type_typedef, "<type>\$1</type>"],
290 [$type_union, "<structname>\$1</structname>"],
272 [$type_env, "<envar>\$1</envar>"],
273 [$type_param, "<parameter>\$1</parameter>" ],
291 [$type_env, "<envar>\$1</envar>"],
292 [$type_param, "<parameter>\$1</parameter>" ],
274 [$type_member, "<literal><structname>\$1</structname>\$2<structfield>\$3</structfield></literal>"]
293 [$type_member, "<literal><structname>\$1</structname>\$2<structfield>\$3</structfield></literal>"],
294 [$type_fallback, "<structname>\$1</structname>"]
275 );
276my $blankline_gnome = "</para><para>\n";
277
278# these are pretty rough
279my @highlights_man = (
280 [$type_constant, "\$1"],
281 [$type_func, "\\\\fB\$1\\\\fP"],
295 );
296my $blankline_gnome = "</para><para>\n";
297
298# these are pretty rough
299my @highlights_man = (
300 [$type_constant, "\$1"],
301 [$type_func, "\\\\fB\$1\\\\fP"],
302 [$type_enum, "\\\\fI\$1\\\\fP"],
282 [$type_struct, "\\\\fI\$1\\\\fP"],
303 [$type_struct, "\\\\fI\$1\\\\fP"],
304 [$type_typedef, "\\\\fI\$1\\\\fP"],
305 [$type_union, "\\\\fI\$1\\\\fP"],
283 [$type_param, "\\\\fI\$1\\\\fP"],
306 [$type_param, "\\\\fI\$1\\\\fP"],
284 [$type_member, "\\\\fI\$1\$2\$3\\\\fP"]
307 [$type_member, "\\\\fI\$1\$2\$3\\\\fP"],
308 [$type_fallback, "\\\\fI\$1\\\\fP"]
285 );
286my $blankline_man = "";
287
288# text-mode
289my @highlights_text = (
290 [$type_constant, "\$1"],
291 [$type_func, "\$1"],
309 );
310my $blankline_man = "";
311
312# text-mode
313my @highlights_text = (
314 [$type_constant, "\$1"],
315 [$type_func, "\$1"],
316 [$type_enum, "\$1"],
292 [$type_struct, "\$1"],
317 [$type_struct, "\$1"],
318 [$type_typedef, "\$1"],
319 [$type_union, "\$1"],
293 [$type_param, "\$1"],
320 [$type_param, "\$1"],
294 [$type_member, "\$1\$2\$3"]
321 [$type_member, "\$1\$2\$3"],
322 [$type_fallback, "\$1"]
295 );
296my $blankline_text = "";
297
298# rst-mode
299my @highlights_rst = (
300 [$type_constant, "``\$1``"],
301 # Note: need to escape () to avoid func matching later
302 [$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"],
303 [$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"],
304 [$type_fp_param, "**\$1\\\\(\\\\)**"],
305 [$type_func, "\\:c\\:func\\:`\$1()`"],
323 );
324my $blankline_text = "";
325
326# rst-mode
327my @highlights_rst = (
328 [$type_constant, "``\$1``"],
329 # Note: need to escape () to avoid func matching later
330 [$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"],
331 [$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"],
332 [$type_fp_param, "**\$1\\\\(\\\\)**"],
333 [$type_func, "\\:c\\:func\\:`\$1()`"],
306 [$type_struct_full, "\\:c\\:type\\:`\$1 \$2 <\$2>`"],
307 [$type_enum_full, "\\:c\\:type\\:`\$1 \$2 <\$2>`"],
308 [$type_typedef_full, "\\:c\\:type\\:`\$1 \$2 <\$2>`"],
309 [$type_union_full, "\\:c\\:type\\:`\$1 \$2 <\$2>`"],
334 [$type_enum, "\\:c\\:type\\:`\$1 <\$2>`"],
335 [$type_struct, "\\:c\\:type\\:`\$1 <\$2>`"],
336 [$type_typedef, "\\:c\\:type\\:`\$1 <\$2>`"],
337 [$type_union, "\\:c\\:type\\:`\$1 <\$2>`"],
310 # in rst this can refer to any type
338 # in rst this can refer to any type
311 [$type_struct, "\\:c\\:type\\:`\$1`"],
339 [$type_fallback, "\\:c\\:type\\:`\$1`"],
312 [$type_param, "**\$1**"]
313 );
314my $blankline_rst = "\n";
315
316# list mode
317my @highlights_list = (
318 [$type_constant, "\$1"],
319 [$type_func, "\$1"],
340 [$type_param, "**\$1**"]
341 );
342my $blankline_rst = "\n";
343
344# list mode
345my @highlights_list = (
346 [$type_constant, "\$1"],
347 [$type_func, "\$1"],
348 [$type_enum, "\$1"],
320 [$type_struct, "\$1"],
349 [$type_struct, "\$1"],
350 [$type_typedef, "\$1"],
351 [$type_union, "\$1"],
321 [$type_param, "\$1"],
352 [$type_param, "\$1"],
322 [$type_member, "\$1"]
353 [$type_member, "\$1"],
354 [$type_fallback, "\$1"]
323 );
324my $blankline_list = "";
325
326# read arguments
327if ($#ARGV == -1) {
328 usage();
329}
330

--- 2843 unchanged lines hidden ---
355 );
356my $blankline_list = "";
357
358# read arguments
359if ($#ARGV == -1) {
360 usage();
361}
362

--- 2843 unchanged lines hidden ---