diff options
author | dfr <dfr@FreeBSD.org> | 2004-07-11 16:14:24 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 2004-07-11 16:14:24 +0000 |
commit | aea0fb6e054d669b7448bdbc5427ef05a979a9eb (patch) | |
tree | f8f7c51e0684dec418162035c41a923d3f37cc6d /sys/tools | |
parent | 4502cba2fdc8a85276b21a8fc2ccbcbfcb529c4e (diff) | |
download | FreeBSD-src-aea0fb6e054d669b7448bdbc5427ef05a979a9eb.zip FreeBSD-src-aea0fb6e054d669b7448bdbc5427ef05a979a9eb.tar.gz |
Pass doxygen doc comments through to the output.
Diffstat (limited to 'sys/tools')
-rw-r--r-- | sys/tools/makeobjops.awk | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/sys/tools/makeobjops.awk b/sys/tools/makeobjops.awk index 8d5e966..038fdd5 100644 --- a/sys/tools/makeobjops.awk +++ b/sys/tools/makeobjops.awk @@ -153,6 +153,21 @@ function handle_interface () } # +# Pass doc comments through to the C file +# +function handle_doc () +{ + doc = "" + while (!/\*\//) { + doc = doc $0 "\n"; + getline < src; + lineno++; + } + doc = doc $0 "\n"; + return doc; +} + +# # Handle "CODE" and "HEADER" sections. # Returns the code as-is. # @@ -176,7 +191,7 @@ function handle_code () # Handle "METHOD" and "STATICMETHOD" sections. # -function handle_method (static) +function handle_method (static, doc) { # # Get the return type and function name and delete that from @@ -282,8 +297,10 @@ function handle_method (static) default = "kobj_error_method"; # the method description + printh("/** @brief Unique descriptor for the " umname "() method */"); printh("extern struct kobjop_desc " mname "_desc;"); # the method typedef + printh("/** @brief A function implementing the " umname "() method */"); prototype = "typedef " ret " " mname "_t("; printh(format_line(prototype argument_list ");", line_width, length(prototype))); @@ -298,6 +315,7 @@ function handle_method (static) printc("};\n"); # Print out the method itself + printh(doc); if (0) { # haven't chosen the format yet printh("static __inline " ret " " umname "(" varname_list ")"); printh("\t" join(";\n\t", arguments, num_arguments) ";"); @@ -422,6 +440,7 @@ for (file_i = 0; file_i < num_files; file_i++) { intname = ""; lineno = 0; error = 0; # to signal clean up and gerror setting + lastdoc = ""; while (!error && (getline < src) > 0) { lineno++; @@ -442,17 +461,23 @@ for (file_i = 0; file_i < num_files; file_i++) { if (/^$/) { # skip empty lines } - else if (/^INTERFACE[ ]+[^ ;]*[ ]*;?[ ]*$/) + else if (/^\/\*\*/) + lastdoc = handle_doc(); + else if (/^INTERFACE[ ]+[^ ;]*[ ]*;?[ ]*$/) { + printh(lastdoc); + lastdoc = ""; handle_interface(); - else if (/^CODE[ ]*{$/) + } else if (/^CODE[ ]*{$/) printc(handle_code()); else if (/^HEADER[ ]*{$/) printh(handle_code()); - else if (/^METHOD/) - handle_method(0); - else if (/^STATICMETHOD/) - handle_method(1); - else { + else if (/^METHOD/) { + handle_method(0, lastdoc); + lastdoc = ""; + } else if (/^STATICMETHOD/) { + handle_method(1, lastdoc); + lastdoc = ""; + } else { debug($0); warnsrc("Invalid line encountered"); error = 1; |