summaryrefslogtreecommitdiffstats
path: root/contrib/gen_manual
diff options
context:
space:
mode:
authorPrzemyslaw Skibinski <inikep@gmail.com>2017-01-23 14:42:58 (GMT)
committerPrzemyslaw Skibinski <inikep@gmail.com>2017-01-23 14:42:58 (GMT)
commit128244371bb54e0ff9559b7109331a8f2868631d (patch)
tree8458e67caebabf6fa76493f71c01852cba9b9311 /contrib/gen_manual
parent489d1618c98903817d516445c18f7c239d07ddbf (diff)
downloadlz4-128244371bb54e0ff9559b7109331a8f2868631d.zip
lz4-128244371bb54e0ff9559b7109331a8f2868631d.tar.gz
lz4-128244371bb54e0ff9559b7109331a8f2868631d.tar.bz2
improved gen_manual
Diffstat (limited to 'contrib/gen_manual')
-rw-r--r--contrib/gen_manual/gen_manual.cpp50
1 files changed, 27 insertions, 23 deletions
diff --git a/contrib/gen_manual/gen_manual.cpp b/contrib/gen_manual/gen_manual.cpp
index 2df081d..9aece63 100644
--- a/contrib/gen_manual/gen_manual.cpp
+++ b/contrib/gen_manual/gen_manual.cpp
@@ -158,36 +158,28 @@ int main(int argc, char *argv[]) {
continue;
}
- /* comments of type /*= and /**= mean: use a <H3> header and show also all functions until first empty line */
- if ((line.substr(0,3) == "/*=" || line.substr(0,4) == "/**=") && line.find("*/")!=string::npos) {
- trim_comments(line);
- trim(line, "= ");
- sout << "<h3>" << line << "</h3><pre><b>";
- lines = get_lines(input, ++linenum, "");
- for (l=0; l<lines.size(); l++) {
- print_line(sout, lines[l]);
- }
- sout << "</b></pre><BR>" << endl;
- continue;
+ spos = line.find("/**=");
+ if (spos==string::npos) {
+ spos = line.find("/*!");
+ if (spos==string::npos)
+ spos = line.find("/**");
+ if (spos==string::npos)
+ spos = line.find("/*-");
+ if (spos==string::npos)
+ spos = line.find("/*=");
+ if (spos==string::npos)
+ continue;
+ exclam = line[spos+2];
}
+ else exclam = '=';
- spos = line.find("/*!");
- if (spos==string::npos)
- spos = line.find("/**");
- if (spos==string::npos)
- spos = line.find("/*-");
-
- if (spos==string::npos)
- continue;
-
- exclam = line[spos+2];
comments = get_lines(input, linenum, "*/");
if (!comments.empty()) comments[0] = line.substr(spos+3);
if (!comments.empty()) comments[comments.size()-1] = comments[comments.size()-1].substr(0, comments[comments.size()-1].find("*/"));
for (l=0; l<comments.size(); l++) {
if (comments[l].find(" *")==0) comments[l] = comments[l].substr(2);
else if (comments[l].find(" *")==0) comments[l] = comments[l].substr(3);
- trim(comments[l], "*-");
+ trim(comments[l], "*-=");
}
while (!comments.empty() && comments[comments.size()-1].empty()) comments.pop_back(); // remove empty line at the end
while (!comments.empty() && comments[0].empty()) comments.erase(comments.begin()); // remove empty line at the start
@@ -208,6 +200,18 @@ int main(int argc, char *argv[]) {
print_line(sout, comments[l]);
}
sout << "</p></pre><BR>" << endl << endl;
+ } else if (exclam == '=') { /* comments of type /*= and /**= mean: use a <H3> header and show also all functions until first empty line */
+ trim(comments[0], " ");
+ sout << "<h3>" << comments[0] << "</h3><pre>";
+ for (l=1; l<comments.size(); l++) {
+ print_line(sout, comments[l]);
+ }
+ sout << "</pre><b><pre>";
+ lines = get_lines(input, ++linenum, "");
+ for (l=0; l<lines.size(); l++) {
+ print_line(sout, lines[l]);
+ }
+ sout << "</pre></b><BR>" << endl;
} else { /* comments of type /** and /*- mean: this is a comment; use a <H2> header for the first line */
if (comments.empty()) continue;
@@ -238,4 +242,4 @@ int main(int argc, char *argv[]) {
ostream << "</html>" << endl << "</body>" << endl;
return 0;
-}
+} \ No newline at end of file