source@mandoc.bsd.lv
 help / color / Atom feed
* 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, back to index

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

source@mandoc.bsd.lv

Archives are clonable: git clone --mirror http://inbox.vuxu.org/mandoc-source

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.mandoc.source


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git