source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: docbook2mdoc: handle <funcparams> inside <paramdef> inside
Date: Wed, 1 May 2019 07:52:36 -0500 (EST)	[thread overview]
Message-ID: <e3fed9e8deac493e@fantadrom.bsd.lv> (raw)

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

                 reply	other threads:[~2019-05-01 12:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e3fed9e8deac493e@fantadrom.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).