Pass doxygen doc comments through to the output.

This commit is contained in:
dfr 2004-07-11 16:14:24 +00:00
parent 9c985ec7bb
commit 7032e7197f

View File

@ -152,6 +152,21 @@ function handle_interface ()
printc("#include \"" intname "_if.h\"\n");
}
#
# 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;