=================================================================== RCS file: /cvs/docbook2mdoc/Attic/rules.c,v retrieving revision 1.2 retrieving revision 1.11 diff -u -p -r1.2 -r1.11 --- docbook2mdoc/Attic/rules.c 2014/03/30 13:18:49 1.2 +++ docbook2mdoc/Attic/rules.c 2014/03/30 18:15:55 1.11 @@ -8,12 +8,26 @@ isattrkey(enum nodeid node, enum attrkey key) switch (key) { case (ATTRKEY_CHOICE): - return(node == NODE_ARG); + switch (node) { + case (NODE_ARG): + case (NODE_GROUP): + return(1); + default: + break; + } + return(0); case (ATTRKEY_ID): /* Common to all. */ return(1); case (ATTRKEY_REP): - return(node == NODE_ARG); + switch (node) { + case (NODE_ARG): + case (NODE_GROUP): + return(1); + default: + break; + } + return(0); default: break; } @@ -52,10 +66,29 @@ isparent(enum nodeid node, enum nodeid parent) switch (node) { case (NODE_ROOT): return(0); + case (NODE_ACRONYM): + switch (parent) { + case (NODE_EMPHASIS): + case (NODE_FUNCSYNOPSISINFO): + case (NODE_PROGRAMLISTING): + case (NODE_REFDESCRIPTOR): + case (NODE_REFENTRYTITLE): + case (NODE_REFNAME): + case (NODE_REFPURPOSE): + case (NODE_SCREEN): + case (NODE_SYNOPSIS): + case (NODE_TERM): + case (NODE_TITLE): + return(1); + default: + break; + } + return(0); case (NODE_ARG): switch (parent) { case (NODE_ARG): case (NODE_CMDSYNOPSIS): + case (NODE_GROUP): return(1); default: break; @@ -72,6 +105,7 @@ isparent(enum nodeid node, enum nodeid parent) case (NODE_REFENTRYTITLE): case (NODE_REFNAME): case (NODE_REFPURPOSE): + case (NODE_SCREEN): case (NODE_SYNOPSIS): case (NODE_TERM): case (NODE_TITLE): @@ -83,9 +117,12 @@ isparent(enum nodeid node, enum nodeid parent) return(0); case (NODE_CMDSYNOPSIS): switch (parent) { + case (NODE_ITEMIZEDLIST): case (NODE_LISTITEM): + case (NODE_ORDEREDLIST): case (NODE_PARA): case (NODE_REFSECT1): + case (NODE_REFSECT2): case (NODE_REFSYNOPSISDIV): case (NODE_VARIABLELIST): return(1); @@ -104,10 +141,12 @@ isparent(enum nodeid node, enum nodeid parent) case (NODE_REFENTRYTITLE): case (NODE_REFNAME): case (NODE_REFPURPOSE): + case (NODE_SCREEN): case (NODE_SYNOPSIS): case (NODE_TERM): case (NODE_TITLE): case (NODE_ULINK): + case (NODE_USERINPUT): return(1); default: break; @@ -125,15 +164,38 @@ isparent(enum nodeid node, enum nodeid parent) case (NODE_REFENTRYTITLE): case (NODE_REFNAME): case (NODE_REFPURPOSE): + case (NODE_SCREEN): case (NODE_SYNOPSIS): case (NODE_TERM): case (NODE_TITLE): case (NODE_ULINK): + case (NODE_USERINPUT): return(1); default: break; } return(0); + case (NODE_DATE): + switch (parent) { + case (NODE_EMPHASIS): + case (NODE_FUNCSYNOPSISINFO): + case (NODE_LINK): + case (NODE_PARA): + case (NODE_PROGRAMLISTING): + case (NODE_REFDESCRIPTOR): + case (NODE_REFENTRYINFO): + case (NODE_REFENTRYTITLE): + case (NODE_REFNAME): + case (NODE_REFPURPOSE): + case (NODE_SCREEN): + case (NODE_SYNOPSIS): + case (NODE_TITLE): + case (NODE_ULINK): + return(1); + default: + break; + } + return(0); case (NODE_EMPHASIS): switch (parent) { case (NODE_EMPHASIS): @@ -145,6 +207,7 @@ isparent(enum nodeid node, enum nodeid parent) case (NODE_REFENTRYTITLE): case (NODE_REFNAME): case (NODE_REFPURPOSE): + case (NODE_SCREEN): case (NODE_SYNOPSIS): case (NODE_TERM): case (NODE_TITLE): @@ -154,15 +217,62 @@ isparent(enum nodeid node, enum nodeid parent) break; } return(0); + case (NODE_ENVAR): + switch (parent) { + case (NODE_EMPHASIS): + case (NODE_FUNCSYNOPSISINFO): + case (NODE_LINK): + case (NODE_PARA): + case (NODE_PROGRAMLISTING): + case (NODE_REFDESCRIPTOR): + case (NODE_REFENTRYTITLE): + case (NODE_REFNAME): + case (NODE_REFPURPOSE): + case (NODE_SCREEN): + case (NODE_SYNOPSIS): + case (NODE_TERM): + case (NODE_TITLE): + case (NODE_ULINK): + case (NODE_USERINPUT): + return(1); + default: + break; + } + return(0); + case (NODE_FILENAME): + switch (parent) { + case (NODE_EMPHASIS): + case (NODE_FUNCSYNOPSISINFO): + case (NODE_LINK): + case (NODE_PARA): + case (NODE_PROGRAMLISTING): + case (NODE_REFDESCRIPTOR): + case (NODE_REFENTRYTITLE): + case (NODE_REFNAME): + case (NODE_REFPURPOSE): + case (NODE_SCREEN): + case (NODE_SYNOPSIS): + case (NODE_TERM): + case (NODE_TITLE): + case (NODE_ULINK): + case (NODE_USERINPUT): + return(1); + default: + break; + } + return(0); case (NODE_FUNCDEF): return(NODE_FUNCPROTOTYPE == parent); case (NODE_FUNCPROTOTYPE): return(NODE_FUNCSYNOPSIS == parent); case (NODE_FUNCSYNOPSIS): switch (parent) { + case (NODE_ITEMIZEDLIST): case (NODE_LISTITEM): + case (NODE_ORDEREDLIST): case (NODE_PARA): case (NODE_REFSECT1): + case (NODE_REFSECT2): case (NODE_REFSYNOPSISDIV): case (NODE_VARIABLELIST): return(1); @@ -185,6 +295,7 @@ isparent(enum nodeid node, enum nodeid parent) case (NODE_REFENTRYTITLE): case (NODE_REFNAME): case (NODE_REFPURPOSE): + case (NODE_SCREEN): case (NODE_SYNOPSIS): case (NODE_TERM): case (NODE_TITLE): @@ -194,38 +305,99 @@ isparent(enum nodeid node, enum nodeid parent) break; } return(0); + case (NODE_ITEMIZEDLIST): + switch (parent) { + case (NODE_ITEMIZEDLIST): + case (NODE_LISTITEM): + case (NODE_ORDEREDLIST): + case (NODE_REFSECT1): + case (NODE_REFSECT2): + case (NODE_REFSYNOPSISDIV): + case (NODE_VARIABLELIST): + return(1); + default: + break; + } + return(0); + case (NODE_GROUP): + switch (parent) { + case (NODE_ARG): + case (NODE_CMDSYNOPSIS): + case (NODE_GROUP): + return(1); + default: + break; + } + return(0); case (NODE_LINK): - case (NODE_ULINK): /* Synonyms? */ + case (NODE_ULINK): /* Synonyms. */ switch (parent) { + case (NODE_ACRONYM): case (NODE_ARG): case (NODE_CODE): case (NODE_COMMAND): case (NODE_EMPHASIS): + case (NODE_ENVAR): + case (NODE_FILENAME): case (NODE_FUNCDEF): case (NODE_FUNCSYNOPSISINFO): case (NODE_FUNCTION): case (NODE_LINK): + case (NODE_LITERAL): case (NODE_MANVOLNUM): case (NODE_OPTION): case (NODE_PARA): case (NODE_PARAMDEF): case (NODE_PARAMETER): case (NODE_PROGRAMLISTING): + case (NODE_PROMPT): case (NODE_REFDESCRIPTOR): case (NODE_REFENTRYTITLE): case (NODE_REFMISCINFO): case (NODE_REFNAME): case (NODE_REPLACEABLE): + case (NODE_SCREEN): case (NODE_SYNOPSIS): case (NODE_TERM): case (NODE_ULINK): + case (NODE_USERINPUT): return(1); default: break; } return(0); case (NODE_LISTITEM): - return(NODE_VARLISTENTRY == parent); + switch (parent) { + case (NODE_ITEMIZEDLIST): + case (NODE_ORDEREDLIST): + case (NODE_VARLISTENTRY): + return(1); + default: + break; + } + return(0); + case (NODE_LITERAL): + switch (parent) { + case (NODE_EMPHASIS): + case (NODE_FUNCSYNOPSISINFO): + case (NODE_LINK): + case (NODE_PARA): + case (NODE_PROGRAMLISTING): + case (NODE_REFDESCRIPTOR): + case (NODE_REFENTRYTITLE): + case (NODE_REFNAME): + case (NODE_REFPURPOSE): + case (NODE_SCREEN): + case (NODE_SYNOPSIS): + case (NODE_TERM): + case (NODE_TITLE): + case (NODE_ULINK): + case (NODE_USERINPUT): + return(1); + default: + break; + } + return(0); case (NODE_MANVOLNUM): switch (parent) { case (NODE_CITEREFENTRY): @@ -240,6 +412,7 @@ isparent(enum nodeid node, enum nodeid parent) case (NODE_ARG): case (NODE_EMPHASIS): case (NODE_FUNCSYNOPSISINFO): + case (NODE_GROUP): case (NODE_LINK): case (NODE_PARA): case (NODE_PROGRAMLISTING): @@ -247,19 +420,39 @@ isparent(enum nodeid node, enum nodeid parent) case (NODE_REFENTRYTITLE): case (NODE_REFNAME): case (NODE_REFPURPOSE): + case (NODE_SCREEN): case (NODE_SYNOPSIS): case (NODE_TERM): case (NODE_TITLE): case (NODE_ULINK): + case (NODE_USERINPUT): return(1); default: break; } return(0); + case (NODE_ORDEREDLIST): + switch (parent) { + case (NODE_ITEMIZEDLIST): + case (NODE_LISTITEM): + case (NODE_ORDEREDLIST): + case (NODE_PARA): + case (NODE_REFSECT1): + case (NODE_REFSECT2): + case (NODE_REFSYNOPSISDIV): + case (NODE_VARIABLELIST): + return(1); + default: + break; + } + return(0); case (NODE_PARA): switch (parent) { + case (NODE_ITEMIZEDLIST): case (NODE_LISTITEM): + case (NODE_ORDEREDLIST): case (NODE_REFSECT1): + case (NODE_REFSECT2): case (NODE_REFSYNOPSISDIV): case (NODE_VARIABLELIST): return(1); @@ -281,10 +474,12 @@ isparent(enum nodeid node, enum nodeid parent) case (NODE_REFENTRYTITLE): case (NODE_REFNAME): case (NODE_REFPURPOSE): + case (NODE_SCREEN): case (NODE_SYNOPSIS): case (NODE_TERM): case (NODE_TITLE): case (NODE_ULINK): + case (NODE_USERINPUT): return(1); default: break; @@ -292,21 +487,49 @@ isparent(enum nodeid node, enum nodeid parent) return(0); case (NODE_PROGRAMLISTING): switch (parent) { + case (NODE_ITEMIZEDLIST): case (NODE_LISTITEM): + case (NODE_ORDEREDLIST): case (NODE_PARA): case (NODE_REFSECT1): + case (NODE_REFSECT2): case (NODE_REFSYNOPSISDIV): + case (NODE_VARIABLELIST): return(1); default: break; } return(0); + case (NODE_PROMPT): + switch (parent) { + case (NODE_EMPHASIS): + case (NODE_FUNCSYNOPSISINFO): + case (NODE_LINK): + case (NODE_PARA): + case (NODE_PROGRAMLISTING): + case (NODE_REFDESCRIPTOR): + case (NODE_REFENTRYTITLE): + case (NODE_REFNAME): + case (NODE_REFPURPOSE): + case (NODE_SCREEN): + case (NODE_SYNOPSIS): + case (NODE_TERM): + case (NODE_TITLE): + case (NODE_ULINK): + case (NODE_USERINPUT): + return(1); + default: + break; + } + return(0); case (NODE_REFCLASS): return(parent == NODE_REFNAMEDIV); case (NODE_REFDESCRIPTOR): return(parent == NODE_REFNAMEDIV); case (NODE_REFENTRY): return(parent == NODE_ROOT); + case (NODE_REFENTRYINFO): + return(parent == NODE_REFENTRY); case (NODE_REFENTRYTITLE): switch (parent) { case (NODE_CITEREFENTRY): @@ -327,38 +550,80 @@ isparent(enum nodeid node, enum nodeid parent) return(parent == NODE_REFNAMEDIV); case (NODE_REFSECT1): return(parent == NODE_REFENTRY); + case (NODE_REFSECT2): + switch (parent) { + case (NODE_REFSYNOPSISDIV): + case (NODE_REFSECT1): + return(1); + default: + break; + } + return(0); case (NODE_REFSYNOPSISDIV): return(parent == NODE_REFENTRY); case (NODE_REPLACEABLE): switch (parent) { + case (NODE_ACRONYM): case (NODE_ARG): case (NODE_CODE): case (NODE_COMMAND): case (NODE_EMPHASIS): + case (NODE_ENVAR): + case (NODE_FILENAME): case (NODE_FUNCDEF): case (NODE_FUNCSYNOPSISINFO): case (NODE_FUNCTION): + case (NODE_GROUP): case (NODE_LINK): + case (NODE_LITERAL): case (NODE_MANVOLNUM): case (NODE_OPTION): case (NODE_PARA): case (NODE_PARAMDEF): case (NODE_PARAMETER): case (NODE_PROGRAMLISTING): + case (NODE_PROMPT): case (NODE_REFDESCRIPTOR): case (NODE_REFENTRYTITLE): case (NODE_REFMISCINFO): case (NODE_REFNAME): case (NODE_REFPURPOSE): case (NODE_REPLACEABLE): + case (NODE_SCREEN): case (NODE_SYNOPSIS): case (NODE_TERM): case (NODE_TITLE): case (NODE_ULINK): + case (NODE_USERINPUT): default: return(1); } return(0); + case (NODE_SBR): + switch (parent) { + case (NODE_ARG): + case (NODE_CMDSYNOPSIS): + case (NODE_GROUP): + return(1); + default: + break; + } + return(0); + case (NODE_SCREEN): + switch (parent) { + case (NODE_ITEMIZEDLIST): + case (NODE_LISTITEM): + case (NODE_ORDEREDLIST): + case (NODE_PARA): + case (NODE_REFSECT1): + case (NODE_REFSECT2): + case (NODE_REFSYNOPSISDIV): + case (NODE_VARIABLELIST): + return(1); + default: + break; + } + return(0); case (NODE_STRUCTNAME): switch (parent) { case (NODE_CODE): @@ -381,9 +646,12 @@ isparent(enum nodeid node, enum nodeid parent) return(0); case (NODE_SYNOPSIS): switch (parent) { + case (NODE_ITEMIZEDLIST): case (NODE_LISTITEM): + case (NODE_ORDEREDLIST): case (NODE_REFSYNOPSISDIV): case (NODE_REFSECT1): + case (NODE_REFSECT2): return(1); default: break; @@ -391,7 +659,11 @@ isparent(enum nodeid node, enum nodeid parent) return(0); case (NODE_TITLE): switch (parent) { + case (NODE_ITEMIZEDLIST): + case (NODE_ORDEREDLIST): + case (NODE_REFENTRYINFO): case (NODE_REFSECT1): + case (NODE_REFSECT2): case (NODE_REFSYNOPSISDIV): case (NODE_VARIABLELIST): return(1); @@ -403,10 +675,35 @@ isparent(enum nodeid node, enum nodeid parent) return(NODE_VARLISTENTRY == parent); case (NODE_TEXT): return(1); + case (NODE_USERINPUT): + switch (parent) { + case (NODE_EMPHASIS): + case (NODE_FUNCSYNOPSISINFO): + case (NODE_LINK): + case (NODE_PARA): + case (NODE_PROGRAMLISTING): + case (NODE_REFDESCRIPTOR): + case (NODE_REFENTRYTITLE): + case (NODE_REFNAME): + case (NODE_REFPURPOSE): + case (NODE_SCREEN): + case (NODE_SYNOPSIS): + case (NODE_TERM): + case (NODE_TITLE): + case (NODE_ULINK): + case (NODE_USERINPUT): + return(1); + default: + break; + } + return(0); case (NODE_VARIABLELIST): switch (parent) { + case (NODE_ITEMIZEDLIST): + case (NODE_ORDEREDLIST): case (NODE_PARA): case (NODE_REFSECT1): + case (NODE_REFSECT2): case (NODE_REFSYNOPSISDIV): case (NODE_VARIABLELIST): return(1);