* docbook2mdoc: handle <funcparams> inside <paramdef> inside
@ 2019-05-01 12:52 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-05-01 12:52 UTC (permalink / raw)
To: source
Log Message:
-----------
handle <funcparams> inside <paramdef> inside <funcprototype>
(used for giving full function prototypes inside parameter lists
of functions taking function pointer arguments)
by enclosing them in parentheses inside the .Fa macro
Modified Files:
--------------
docbook2mdoc:
docbook2mdoc.c
node.c
node.h
statistics.c
Revision Data
-------------
Index: node.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/node.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -Lnode.c -Lnode.c -u -p -r1.27 -r1.28
--- node.c
+++ node.c
@@ -62,6 +62,7 @@ static const struct nodeprop properties[
{ "firstterm", CLASS_LINE },
{ "footnote", CLASS_BLOCK },
{ "funcdef", CLASS_BLOCK },
+ { "funcparams", CLASS_LINE },
{ "funcprototype", CLASS_BLOCK },
{ "funcsynopsis", CLASS_TRANS },
{ "funcsynopsisinfo", CLASS_LINE },
Index: node.h
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/node.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -Lnode.h -Lnode.h -u -p -r1.36 -r1.37
--- node.h
+++ node.h
@@ -70,6 +70,7 @@ enum nodeid {
NODE_FIRSTTERM,
NODE_FOOTNOTE,
NODE_FUNCDEF,
+ NODE_FUNCPARAMS,
NODE_FUNCPROTOTYPE,
NODE_FUNCSYNOPSIS,
NODE_FUNCSYNOPSISINFO,
Index: docbook2mdoc.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.144
retrieving revision 1.145
diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.144 -r1.145
--- docbook2mdoc.c
+++ docbook2mdoc.c
@@ -345,7 +345,7 @@ pnode_printmath(struct format *f, struct
static void
pnode_printfuncprototype(struct format *f, struct pnode *n)
{
- struct pnode *fdef, *ftype, *nc, *nn;
+ struct pnode *fdef, *fps, *ftype, *nc, *nn;
/*
* Extract <funcdef> child and ignore <void> child.
@@ -399,7 +399,16 @@ pnode_printfuncprototype(struct format *
return;
while (nc != NULL) {
- macro_nodeline(f, "Fa", nc, ARG_SINGLE);
+ if ((fps = pnode_takefirst(nc, NODE_FUNCPARAMS)) != NULL) {
+ macro_open(f, "Fa \"");
+ macro_addnode(f, nc, ARG_QUOTED);
+ macro_addarg(f, "(", ARG_QUOTED);
+ macro_addnode(f, fps, ARG_QUOTED);
+ macro_addarg(f, ")", ARG_QUOTED);
+ putchar('"');
+ macro_close(f);
+ } else
+ macro_nodeline(f, "Fa", nc, ARG_SINGLE);
pnode_unlink(nc);
nc = TAILQ_FIRST(&n->childq);
}
Index: statistics.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/statistics.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -Lstatistics.c -Lstatistics.c -u -p -r1.39 -r1.40
--- statistics.c
+++ statistics.c
@@ -438,8 +438,10 @@ main(int argc, char *argv[])
table_add("footnote", "para");
table_add("funcdef", "function");
table_add("funcdef", "TEXT");
+ table_add("funcparams", "TEXT");
table_add("funcprototype", "funcdef");
table_add("funcprototype", "paramdef");
+ table_add("funcprototype", "void");
table_add("funcsynopsis", "funcprototype");
table_add("funcsynopsis", "funcsynopsisinfo");
table_add("funcsynopsisinfo", "TEXT");
@@ -499,6 +501,7 @@ main(int argc, char *argv[])
table_add("othercredit", "surname");
table_add("othername", "TEXT");
table_add("para", NULL);
+ table_add("paramdef", "funcparams");
table_add("paramdef", "parameter");
table_add("paramdef", "TEXT");
table_add("parameter", "TEXT");
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-05-01 12:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-01 12:52 docbook2mdoc: handle <funcparams> inside <paramdef> inside schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).