[Libguestfs] [PATCH v3 1/4] docs: Allow enhanced comments for macros (ie. #define).

Richard W.M. Jones rjones at redhat.com
Fri Nov 2 15:05:01 UTC 2018


---
 docs/make-internal-documentation.pl | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/docs/make-internal-documentation.pl b/docs/make-internal-documentation.pl
index a6673c48f..e08adad70 100755
--- a/docs/make-internal-documentation.pl
+++ b/docs/make-internal-documentation.pl
@@ -245,13 +245,19 @@ foreach $dir (@dirs) {
                             }
                         }
                         else {
-                            # First line tells us if this is a struct
-                            # or function.
+                            # First line tells us if this is a struct,
+                            # define or function.
                             if (/^struct ([\w_]+) \{$/) {
                                 $thing = "Structure";
                                 $name = $1;
                                 $end = "};";
                             }
+                            elsif (/^#define ([\w_]+)/) {
+                                $thing = "Definition";
+                                $name = $1;
+                                $found_end = 1;
+                                last;
+                            }
                             else {
                                 $thing = "Function";
                                 $end = "{";
@@ -276,6 +282,10 @@ foreach $dir (@dirs) {
                         push @defn, "};"
                     }
 
+                    if ($thing eq "Definition") {
+                        @defn = ( "#define $name" )
+                    }
+
                     # Print the definition, followed by the comment.
                     print OUTPUT "=head4 $thing C<$input:$name>\n\n";
                     print OUTPUT " ", join ("\n ", @defn), "\n";
-- 
2.19.0.rc0




More information about the Libguestfs mailing list