X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=doxygen%2Ffilter_c.py;h=897f9f6d0b33dd80d4fee48e84839130bc94aa67;hb=61717cc38;hp=733fdefb3d47e982c6916e354be81621f11ef5c4;hpb=54ccf2261cb1f4afd966b7b1e92689183cb17836;p=vpp.git diff --git a/doxygen/filter_c.py b/doxygen/filter_c.py index 733fdefb3d4..897f9f6d0b3 100755 --- a/doxygen/filter_c.py +++ b/doxygen/filter_c.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright (c) 2016 Comcast Cable Communications Management, LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,26 +22,45 @@ if len(sys.argv) < 2: sys.exit(1) replace_patterns = [ - # Search for VLIB_CLI_COMMAND, extract its parameter and add a docblock for it - ( re.compile("(?PVLIB_CLI_COMMAND)\s*[(](?P[a-zA-Z0-9_]+)(,[^)]*)?[)]"), r"/** @brief (@em constructor) \g (\g) */ vlib_cli_command_t \g"), - - # Search for VLIB_REGISTER_NODE, extract its parameter and add a docblock for it - ( re.compile("(?PVLIB_REGISTER_NODE)\s*[(](?P[a-zA-Z0-9_]+)(,[^)]*)?[)]"), r"/** @brief (@em constructor) \g (\g) */ vlib_node_registration_t \g"), + # Search for VLIB_CLI_COMMAND, extract its parameters and add a docblock for it + ( re.compile("(?PVLIB_CLI_COMMAND)\s*[(](?P[a-zA-Z0-9_]+)[)]"), + r"/** @brief (@em constructor) \g (\g) */ vlib_cli_command_t \g"), + ( re.compile("(?PVLIB_CLI_COMMAND)\s*[(](?P[a-zA-Z0-9_]+),\s*(?P[^)]*)[)]"), + r"/** @brief (@em constructor) \g (\g) */ \g vlib_cli_command_t \g"), + + # Search for VLIB_REGISTER_NODE, extract its parameters and add a docblock for it + ( re.compile("(?PVLIB_REGISTER_NODE)\s*[(](?P[a-zA-Z0-9_]+)[)]"), + r"/** @brief (@em constructor) \g (\g) */ vlib_node_registration_t \g"), + ( re.compile("(?PVLIB_REGISTER_NODE)\s*[(](?P[a-zA-Z0-9_]+),\s*(?P[^)]*)[)]"), + r"/** @brief (@em constructor) \g (\g) */ \g vlib_node_registration_t \g"), # Search for VLIB_INIT_FUNCTION, extract its parameter and add a docblock for it - ( re.compile("(?PVLIB_INIT_FUNCTION)\s*[(](?P[a-zA-Z0-9_]+)[)]"), r"/** @brief (@em constructor) \g (@ref \g) */ vlib_init_function_t * _vlib_init_function_\g"), - ( re.compile("(?PVLIB_DECLARE_INIT_FUNCTION)\s*[(](?P[a-zA-Z0-9_]+)[)]"), r"/** @brief (@em constructor) \g (@ref \g) */ vlib_init_function_t * _vlib_init_function_\g"), + ( re.compile("(?PVLIB_INIT_FUNCTION)\s*[(](?P[a-zA-Z0-9_]+)[)]"), + r"/** @brief (@em constructor) \g (@ref \g) */ vlib_init_function_t * _vlib_init_function_\g"), + ( re.compile("(?PVLIB_DECLARE_INIT_FUNCTION)\s*[(](?P[a-zA-Z0-9_]+)[)]"), + r"/** @brief (@em constructor) \g (@ref \g) */ vlib_init_function_t * _vlib_init_function_\g"), + + # Search for VLIB_LOOP_ENTER_FUNCTION, extract the parameters and add a docblock for it + ( re.compile("(?PVLIB_MAIN_LOOP_ENTER_FUNCTION)\s*[(](?P[a-zA-Z0-9_]+)(,[^)]*)?[)]"), + r"/** @brief (@em constructor) \g (@ref \g) */ _vlib_main_loop_enter_\g"), + ( re.compile("(?PVLIB_MAIN_LOOP_EXIT_FUNCTION)\s*[(](?P[a-zA-Z0-9_]+)(,[^)]*)?[)]"), + r"/** @brief (@em constructor) \g (@ref \g) */ _vlib_main_loop_exit_\g"), + + # Search for VLIB_CONFIG_FUNCTION, extract the parameters and add a docblock for it + ( re.compile("(?PVLIB_CONFIG_FUNCTION)\s*[(](?P[a-zA-Z0-9_]+),\s*(?P\"[^\"]+\")(,[^)]*)?[)]"), + r"/** @brief (@em constructor) \g (\g, \g) */ vlib_config_function_runtime_t _vlib_config_function_\g"), + ( re.compile("(?PVLIB_EARLY_CONFIG_FUNCTION)\s*[(](?P[a-zA-Z0-9_]+),\s*(?P\"[^\"]+\")(,[^)]*)?[)]"), + r"/** @brief (@em constructor) \g (\g, \g) */ vlib_config_function_runtime_t _vlib_config_function_\g"), - # Search for VLIB_LOOP_ENTER_FUNCTION, extract the 1st parameter (ignore any others) and add a docblock for it - ( re.compile("(?PVLIB_MAIN_LOOP_ENTER_FUNCTION)\s*[(](?P[a-zA-Z0-9_]+)(,[^)]*)?[)]"), r"/** @brief (@em constructor) \g (@ref \g) */ _vlib_main_loop_enter_\g"), - ( re.compile("(?PVLIB_MAIN_LOOP_EXIT_FUNCTION)\s*[(](?P[a-zA-Z0-9_]+)(,[^)]*)?[)]"), r"/** @brief (@em constructor) \g (@ref \g) */ _vlib_main_loop_exit_\g"), + # Search for "format_thing" and "unformat_thing" when used as a function pointer and add parens + ( re.compile("(?P
(^|,)\s*)(?P(un)?format_[a-zA-Z0-9_]+)(?P\s*(,|$))"),
+        r"\g
\g()\g" ),
 
-    # Search for VLIB_CONFIG_FUNCTION, extract the 1st parameter (ignore any others) and add a docblock for it
-    ( re.compile("(?PVLIB_CONFIG_FUNCTION)\s*[(](?P[a-zA-Z0-9_]+),\s*(?P\"[^\"]+\")(,[^)]*)?[)]"), r"/** @brief (@em constructor) \g (\g, \g) */ vlib_config_function_runtime_t _vlib_config_function_\g"),
-    ( re.compile("(?PVLIB_EARLY_CONFIG_FUNCTION)\s*[(](?P[a-zA-Z0-9_]+),\s*(?P\"[^\"]+\")(,[^)]*)?[)]"), r"/** @brief (@em constructor) \g (\g, \g) */ vlib_config_function_runtime_t _vlib_config_function_\g"),
+    # Search for CLIB_PAD_FROM_TO(...); and replace with padding
+    # #define CLIB_PAD_FROM_TO(from,to) u8 pad_##from[(to) - (from)]
+    ( re.compile("(?PCLIB_PAD_FROM_TO)\s*[(](?P[^,]+),\s*(?P[^)]+)[)]"),
+        r"/** Padding. */ u8 pad_\g[(\g) - (\g)]" ),
 
-    # Search for "format_thing" and "unformat_thing" when used as a function pointer and add parens
-    ( re.compile("(?P
(^|,)\s*)(?P(un)?format_[a-zA-Z0-9_]+)(?P\s*(,|$))") , r"\g
\g()\g" ),
 ]