kernel-doc (b70366e5d31788650b2a5cec5cd13ea80ac7e44a) | kernel-doc (b97f193abf83e30ef43317ba4883ce3a82f8e8b2) |
---|---|
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 ## --- 188 unchanged lines hidden (view full) --- 197# patterns, which are highlighted appropriately. 198# 199# 'funcname()' - function 200# '$ENVVAR' - environmental variable 201# '&struct_name' - name of a structure (up to two words including 'struct') 202# '&struct_name.member' - name of a structure member 203# '@parameter' - name of a parameter 204# '%CONST' - name of a constant. | 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 ## --- 188 unchanged lines hidden (view full) --- 197# patterns, which are highlighted appropriately. 198# 199# 'funcname()' - function 200# '$ENVVAR' - environmental variable 201# '&struct_name' - name of a structure (up to two words including 'struct') 202# '&struct_name.member' - name of a structure member 203# '@parameter' - name of a parameter 204# '%CONST' - name of a constant. |
205# '``LITERAL``' - literal string without any spaces on it. |
|
205 206## init lots of data 207 208my $errors = 0; 209my $warnings = 0; 210my $anon_struct_union = 0; 211 212# match expressions used to find embedded type information | 206 207## init lots of data 208 209my $errors = 0; 210my $warnings = 0; 211my $anon_struct_union = 0; 212 213# match expressions used to find embedded type information |
213my $type_constant = '\%([-_\w]+)'; | 214my $type_constant = '\b``([^\`]+)``\b'; 215my $type_constant2 = '\%([-_\w]+)'; |
214my $type_func = '(\w+)\(\)'; 215my $type_param = '\@(\w+(\.\.\.)?)'; 216my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params 217my $type_env = '(\$\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]+))'; --- 8 unchanged lines hidden (view full) --- 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>"], | 216my $type_func = '(\w+)\(\)'; 217my $type_param = '\@(\w+(\.\.\.)?)'; 218my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params 219my $type_env = '(\$\w+)'; 220my $type_enum = '\&(enum\s*([_\w]+))'; 221my $type_struct = '\&(struct\s*([_\w]+))'; 222my $type_typedef = '\&(typedef\s*([_\w]+))'; 223my $type_union = '\&(union\s*([_\w]+))'; --- 8 unchanged lines hidden (view full) --- 232my $type_member_func = $type_member . '\(\)'; 233 234# Output conversion substitutions. 235# One for each output format 236 237# these work fairly well 238my @highlights_html = ( 239 [$type_constant, "<i>\$1</i>"], |
240 [$type_constant2, "<i>\$1</i>"], |
|
238 [$type_func, "<b>\$1</b>"], 239 [$type_enum_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>"], 243 [$type_env, "<b><i>\$1</i></b>"], 244 [$type_param, "<tt><b>\$1</b></tt>"], 245 [$type_member_xml, "<tt><i>\$1</i>\$2\$3</tt>"], 246 [$type_fallback_xml, "<i>\$1</i>"] 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>"], | 241 [$type_func, "<b>\$1</b>"], 242 [$type_enum_xml, "<i>\$1</i>"], 243 [$type_struct_xml, "<i>\$1</i>"], 244 [$type_typedef_xml, "<i>\$1</i>"], 245 [$type_union_xml, "<i>\$1</i>"], 246 [$type_env, "<b><i>\$1</i></b>"], 247 [$type_param, "<tt><b>\$1</b></tt>"], 248 [$type_member_xml, "<tt><i>\$1</i>\$2\$3</tt>"], 249 [$type_fallback_xml, "<i>\$1</i>"] 250 ); 251my $local_lt = "\\\\\\\\lt:"; 252my $local_gt = "\\\\\\\\gt:"; 253my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>" 254 255# html version 5 256my @highlights_html5 = ( 257 [$type_constant, "<span class=\"const\">\$1</span>"], |
258 [$type_constant2, "<span class=\"const\">\$1</span>"], |
|
255 [$type_func, "<span class=\"func\">\$1</span>"], 256 [$type_enum_xml, "<span class=\"enum\">\$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>"], 260 [$type_env, "<span class=\"env\">\$1</span>"], 261 [$type_param, "<span class=\"param\">\$1</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>"] 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>"], | 259 [$type_func, "<span class=\"func\">\$1</span>"], 260 [$type_enum_xml, "<span class=\"enum\">\$1</span>"], 261 [$type_struct_xml, "<span class=\"struct\">\$1</span>"], 262 [$type_typedef_xml, "<span class=\"typedef\">\$1</span>"], 263 [$type_union_xml, "<span class=\"union\">\$1</span>"], 264 [$type_env, "<span class=\"env\">\$1</span>"], 265 [$type_param, "<span class=\"param\">\$1</span>]"], 266 [$type_member_xml, "<span class=\"literal\"><span class=\"struct\">\$1</span>\$2<span class=\"member\">\$3</span></span>"], 267 [$type_fallback_xml, "<span class=\"struct\">\$1</span>"] 268 ); 269my $blankline_html5 = $local_lt . "br /" . $local_gt; 270 271# XML, docbook format 272my @highlights_xml = ( 273 ["([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>"], 274 [$type_constant, "<constant>\$1</constant>"], |
275 [$type_constant2, "<constant>\$1</constant>"], |
|
271 [$type_enum_xml, "<type>\$1</type>"], 272 [$type_struct_xml, "<structname>\$1</structname>"], 273 [$type_typedef_xml, "<type>\$1</type>"], 274 [$type_union_xml, "<structname>\$1</structname>"], 275 [$type_param, "<parameter>\$1</parameter>"], 276 [$type_func, "<function>\$1</function>"], 277 [$type_env, "<envar>\$1</envar>"], 278 [$type_member_xml, "<literal><structname>\$1</structname>\$2<structfield>\$3</structfield></literal>"], 279 [$type_fallback_xml, "<structname>\$1</structname>"] 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>"], | 276 [$type_enum_xml, "<type>\$1</type>"], 277 [$type_struct_xml, "<structname>\$1</structname>"], 278 [$type_typedef_xml, "<type>\$1</type>"], 279 [$type_union_xml, "<structname>\$1</structname>"], 280 [$type_param, "<parameter>\$1</parameter>"], 281 [$type_func, "<function>\$1</function>"], 282 [$type_env, "<envar>\$1</envar>"], 283 [$type_member_xml, "<literal><structname>\$1</structname>\$2<structfield>\$3</structfield></literal>"], 284 [$type_fallback_xml, "<structname>\$1</structname>"] 285 ); 286my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $local_gt . "\n"; 287 288# gnome, docbook format 289my @highlights_gnome = ( 290 [$type_constant, "<replaceable class=\"option\">\$1</replaceable>"], |
291 [$type_constant2, "<replaceable class=\"option\">\$1</replaceable>"], |
|
286 [$type_func, "<function>\$1</function>"], 287 [$type_enum, "<type>\$1</type>"], 288 [$type_struct, "<structname>\$1</structname>"], 289 [$type_typedef, "<type>\$1</type>"], 290 [$type_union, "<structname>\$1</structname>"], 291 [$type_env, "<envar>\$1</envar>"], 292 [$type_param, "<parameter>\$1</parameter>" ], 293 [$type_member, "<literal><structname>\$1</structname>\$2<structfield>\$3</structfield></literal>"], 294 [$type_fallback, "<structname>\$1</structname>"] 295 ); 296my $blankline_gnome = "</para><para>\n"; 297 298# these are pretty rough 299my @highlights_man = ( 300 [$type_constant, "\$1"], | 292 [$type_func, "<function>\$1</function>"], 293 [$type_enum, "<type>\$1</type>"], 294 [$type_struct, "<structname>\$1</structname>"], 295 [$type_typedef, "<type>\$1</type>"], 296 [$type_union, "<structname>\$1</structname>"], 297 [$type_env, "<envar>\$1</envar>"], 298 [$type_param, "<parameter>\$1</parameter>" ], 299 [$type_member, "<literal><structname>\$1</structname>\$2<structfield>\$3</structfield></literal>"], 300 [$type_fallback, "<structname>\$1</structname>"] 301 ); 302my $blankline_gnome = "</para><para>\n"; 303 304# these are pretty rough 305my @highlights_man = ( 306 [$type_constant, "\$1"], |
307 [$type_constant2, "\$1"], |
|
301 [$type_func, "\\\\fB\$1\\\\fP"], 302 [$type_enum, "\\\\fI\$1\\\\fP"], 303 [$type_struct, "\\\\fI\$1\\\\fP"], 304 [$type_typedef, "\\\\fI\$1\\\\fP"], 305 [$type_union, "\\\\fI\$1\\\\fP"], 306 [$type_param, "\\\\fI\$1\\\\fP"], 307 [$type_member, "\\\\fI\$1\$2\$3\\\\fP"], 308 [$type_fallback, "\\\\fI\$1\\\\fP"] 309 ); 310my $blankline_man = ""; 311 312# text-mode 313my @highlights_text = ( 314 [$type_constant, "\$1"], | 308 [$type_func, "\\\\fB\$1\\\\fP"], 309 [$type_enum, "\\\\fI\$1\\\\fP"], 310 [$type_struct, "\\\\fI\$1\\\\fP"], 311 [$type_typedef, "\\\\fI\$1\\\\fP"], 312 [$type_union, "\\\\fI\$1\\\\fP"], 313 [$type_param, "\\\\fI\$1\\\\fP"], 314 [$type_member, "\\\\fI\$1\$2\$3\\\\fP"], 315 [$type_fallback, "\\\\fI\$1\\\\fP"] 316 ); 317my $blankline_man = ""; 318 319# text-mode 320my @highlights_text = ( 321 [$type_constant, "\$1"], |
322 [$type_constant2, "\$1"], |
|
315 [$type_func, "\$1"], 316 [$type_enum, "\$1"], 317 [$type_struct, "\$1"], 318 [$type_typedef, "\$1"], 319 [$type_union, "\$1"], 320 [$type_param, "\$1"], 321 [$type_member, "\$1\$2\$3"], 322 [$type_fallback, "\$1"] 323 ); 324my $blankline_text = ""; 325 326# rst-mode 327my @highlights_rst = ( 328 [$type_constant, "``\$1``"], | 323 [$type_func, "\$1"], 324 [$type_enum, "\$1"], 325 [$type_struct, "\$1"], 326 [$type_typedef, "\$1"], 327 [$type_union, "\$1"], 328 [$type_param, "\$1"], 329 [$type_member, "\$1\$2\$3"], 330 [$type_fallback, "\$1"] 331 ); 332my $blankline_text = ""; 333 334# rst-mode 335my @highlights_rst = ( 336 [$type_constant, "``\$1``"], |
337 [$type_constant2, "``\$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()`"], 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>`"], 338 # in rst this can refer to any type 339 [$type_fallback, "\\:c\\:type\\:`\$1`"], 340 [$type_param, "**\$1**"] 341 ); 342my $blankline_rst = "\n"; 343 344# list mode 345my @highlights_list = ( 346 [$type_constant, "\$1"], | 338 # Note: need to escape () to avoid func matching later 339 [$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"], 340 [$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"], 341 [$type_fp_param, "**\$1\\\\(\\\\)**"], 342 [$type_func, "\\:c\\:func\\:`\$1()`"], 343 [$type_enum, "\\:c\\:type\\:`\$1 <\$2>`"], 344 [$type_struct, "\\:c\\:type\\:`\$1 <\$2>`"], 345 [$type_typedef, "\\:c\\:type\\:`\$1 <\$2>`"], 346 [$type_union, "\\:c\\:type\\:`\$1 <\$2>`"], 347 # in rst this can refer to any type 348 [$type_fallback, "\\:c\\:type\\:`\$1`"], 349 [$type_param, "**\$1**"] 350 ); 351my $blankline_rst = "\n"; 352 353# list mode 354my @highlights_list = ( 355 [$type_constant, "\$1"], |
356 [$type_constant2, "\$1"], |
|
347 [$type_func, "\$1"], 348 [$type_enum, "\$1"], 349 [$type_struct, "\$1"], 350 [$type_typedef, "\$1"], 351 [$type_union, "\$1"], 352 [$type_param, "\$1"], 353 [$type_member, "\$1"], 354 [$type_fallback, "\$1"] --- 2851 unchanged lines hidden --- | 357 [$type_func, "\$1"], 358 [$type_enum, "\$1"], 359 [$type_struct, "\$1"], 360 [$type_typedef, "\$1"], 361 [$type_union, "\$1"], 362 [$type_param, "\$1"], 363 [$type_member, "\$1"], 364 [$type_fallback, "\$1"] --- 2851 unchanged lines hidden --- |