[BACK]Return to rules.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / docbook2mdoc

File: [cvsweb.bsd.lv] / docbook2mdoc / Attic / rules.c (download)

Revision 1.17, Wed Apr 2 12:12:41 2014 UTC (8 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_0_0_7
Changes since 1.16: +60 -1 lines

Add <sgmltag> and (ignore) <anchor>.
Also give more error-reporting for internal XML errors.

#include <stdlib.h>

#include "extern.h"

int
isattrkey(enum nodeid node, enum attrkey key)
{

	switch (key) {
	case (ATTRKEY_CHOICE):
		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):
		switch (node) {
		case (NODE_ARG):
		case (NODE_GROUP):
			return(1);
		default:
			break;
		}
		return(0);
	default:
		break;
	}
	abort();
	return(0);
}

int
isattrval(enum attrkey key, enum attrval val)
{

	switch (val) {
	case (ATTRVAL_OPT):
	case (ATTRVAL_PLAIN):
	case (ATTRVAL_REQ):
		return(key == ATTRKEY_CHOICE);
	case (ATTRVAL_REPEAT):
	case (ATTRVAL_NOREPEAT):
		return(key == ATTRKEY_REP);
	default:
		break;
	}
	abort();
	return(0);
}

/*
 * Look up whether "parent" is a valid parent for "node".
 * This is sucked directly from the DocBook specification: look at the
 * "children" and "parent" sections of each node.
 */
int
isparent(enum nodeid node, enum nodeid parent)
{

	switch (node) {
	case (NODE_ROOT):
		return(0);
	case (NODE_ACRONYM):
		switch (parent) {
		case (NODE_EMPHASIS):
		case (NODE_ENTRY):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_PARA):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		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_ANCHOR):
		/* We'll ignore this. */
		return(1);
	case (NODE_APPLICATION):
		switch (parent) {
		case (NODE_EMPHASIS):
		case (NODE_ENTRY):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_LINK):
		case (NODE_PARA):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		case (NODE_REFCLASS):
		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):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_ARG):
		switch (parent) {
		case (NODE_ARG):
		case (NODE_CMDSYNOPSIS):
		case (NODE_GROUP):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_CAUTION):
		switch (parent) {
		case (NODE_CAUTION):
		case (NODE_ENTRY):
		case (NODE_ITEMIZEDLIST):
		case (NODE_LISTITEM):
		case (NODE_NOTE):
		case (NODE_ORDEREDLIST):
		case (NODE_PARA):
		case (NODE_REFSECT1):
		case (NODE_REFSECT2):
		case (NODE_REFSECT3):
		case (NODE_REFSECTION):
		case (NODE_REFSYNOPSISDIV):
		case (NODE_TIP):
		case (NODE_VARIABLELIST):
		case (NODE_WARNING):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_CITEREFENTRY):
		switch (parent) {
		case (NODE_EMPHASIS):
		case (NODE_ENTRY):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_LINK):
		case (NODE_PARA):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		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):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_CMDSYNOPSIS):
		switch (parent) {
		case (NODE_CAUTION):
		case (NODE_ENTRY):
		case (NODE_ITEMIZEDLIST):
		case (NODE_LISTITEM):
		case (NODE_ORDEREDLIST):
		case (NODE_NOTE):
		case (NODE_PARA):
		case (NODE_REFSECT1):
		case (NODE_REFSECT2):
		case (NODE_REFSECT3):
		case (NODE_REFSECTION):
		case (NODE_REFSYNOPSISDIV):
		case (NODE_TIP):
		case (NODE_VARIABLELIST):
		case (NODE_WARNING):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_CODE):
		switch (parent) {
		case (NODE_EMPHASIS):
		case (NODE_ENTRY):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_LINK):
		case (NODE_PARA):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		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_COMMAND):
		switch (parent) {
		case (NODE_CMDSYNOPSIS):
		case (NODE_EMPHASIS):
		case (NODE_ENTRY):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_LINK):
		case (NODE_PARA):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		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_DATE):
		switch (parent) {
		case (NODE_EMPHASIS):
		case (NODE_ENTRY):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_LINK):
		case (NODE_PARA):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		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):
		case (NODE_ENTRY):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_LINK):
		case (NODE_PARA):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		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):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_ENTRY):
		return(NODE_ROW == parent);
	case (NODE_ENVAR):
		switch (parent) {
		case (NODE_EMPHASIS):
		case (NODE_ENTRY):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_LINK):
		case (NODE_PARA):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		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_ENTRY):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_LINK):
		case (NODE_PARA):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		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_CAUTION):
		case (NODE_ENTRY):
		case (NODE_ITEMIZEDLIST):
		case (NODE_LISTITEM):
		case (NODE_ORDEREDLIST):
		case (NODE_NOTE):
		case (NODE_PARA):
		case (NODE_REFSECT1):
		case (NODE_REFSECT2):
		case (NODE_REFSECT3):
		case (NODE_REFSECTION):
		case (NODE_REFSYNOPSISDIV):
		case (NODE_TIP):
		case (NODE_VARIABLELIST):
		case (NODE_WARNING):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_FUNCSYNOPSISINFO):
		return(NODE_FUNCSYNOPSIS == parent);
	case (NODE_FUNCTION):
		switch (parent) {
		case (NODE_CODE):
		case (NODE_EMPHASIS):
		case (NODE_ENTRY):
		case (NODE_FUNCDEF):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_LINK):
		case (NODE_PARA):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		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):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_ITEMIZEDLIST):
		switch (parent) {
		case (NODE_CAUTION):
		case (NODE_ENTRY):
		case (NODE_ITEMIZEDLIST):
		case (NODE_LISTITEM):
		case (NODE_NOTE):
		case (NODE_ORDEREDLIST):
		case (NODE_PARA):
		case (NODE_REFSECT1):
		case (NODE_REFSECT2):
		case (NODE_REFSECT3):
		case (NODE_REFSECTION):
		case (NODE_REFSYNOPSISDIV):
		case (NODE_TIP):
		case (NODE_VARIABLELIST):
		case (NODE_WARNING):
			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. */
		switch (parent) {
		case (NODE_ACRONYM):
		case (NODE_APPLICATION):
		case (NODE_ARG):
		case (NODE_CODE):
		case (NODE_COMMAND):
		case (NODE_EMPHASIS):
		case (NODE_ENTRY):
		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_QUOTE):
		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):
		case (NODE_VARNAME):
		case (NODE_WORDASWORD):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_LISTITEM):
		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_ENTRY):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_LINK):
		case (NODE_PARA):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		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):
		case (NODE_REFMETA):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_NOTE):
		switch (parent) {
		case (NODE_CAUTION):
		case (NODE_ENTRY):
		case (NODE_ITEMIZEDLIST):
		case (NODE_LISTITEM):
		case (NODE_NOTE):
		case (NODE_ORDEREDLIST):
		case (NODE_PARA):
		case (NODE_REFSECT1):
		case (NODE_REFSECT2):
		case (NODE_REFSECT3):
		case (NODE_REFSECTION):
		case (NODE_REFSYNOPSISDIV):
		case (NODE_TIP):
		case (NODE_VARIABLELIST):
		case (NODE_WARNING):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_OPTION):
		switch (parent) {
		case (NODE_ARG):
		case (NODE_EMPHASIS):
		case (NODE_ENTRY):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_GROUP):
		case (NODE_LINK):
		case (NODE_PARA):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		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_ORDEREDLIST):
		switch (parent) {
		case (NODE_CAUTION):
		case (NODE_ENTRY):
		case (NODE_ITEMIZEDLIST):
		case (NODE_LISTITEM):
		case (NODE_ORDEREDLIST):
		case (NODE_NOTE):
		case (NODE_PARA):
		case (NODE_REFSECT1):
		case (NODE_REFSECT2):
		case (NODE_REFSECT3):
		case (NODE_REFSECTION):
		case (NODE_REFSYNOPSISDIV):
		case (NODE_TIP):
		case (NODE_VARIABLELIST):
		case (NODE_WARNING):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_PARA):
		switch (parent) {
		case (NODE_CAUTION):
		case (NODE_ENTRY):
		case (NODE_ITEMIZEDLIST):
		case (NODE_LISTITEM):
		case (NODE_NOTE):
		case (NODE_ORDEREDLIST):
		case (NODE_REFSECT1):
		case (NODE_REFSECT2):
		case (NODE_REFSECT3):
		case (NODE_REFSECTION):
		case (NODE_REFSYNOPSISDIV):
		case (NODE_TIP):
		case (NODE_VARIABLELIST):
		case (NODE_WARNING):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_PARAMDEF):
		return(NODE_FUNCPROTOTYPE == parent);
	case (NODE_PARAMETER):
		switch (parent) {
		case (NODE_CODE):
		case (NODE_ENTRY):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_LINK):
		case (NODE_PARA):
		case (NODE_PARAMDEF):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		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_PROGRAMLISTING):
		switch (parent) {
		case (NODE_CAUTION):
		case (NODE_ENTRY):
		case (NODE_ITEMIZEDLIST):
		case (NODE_LISTITEM):
		case (NODE_ORDEREDLIST):
		case (NODE_NOTE):
		case (NODE_PARA):
		case (NODE_REFSECT1):
		case (NODE_REFSECT2):
		case (NODE_REFSECT3):
		case (NODE_REFSECTION):
		case (NODE_REFSYNOPSISDIV):
		case (NODE_TIP):
		case (NODE_VARIABLELIST):
		case (NODE_WARNING):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_PROMPT):
		switch (parent) {
		case (NODE_EMPHASIS):
		case (NODE_ENTRY):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_LINK):
		case (NODE_PARA):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		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_QUOTE):
		switch (parent) {
		case (NODE_EMPHASIS):
		case (NODE_ENTRY):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_LINK):
		case (NODE_PARA):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		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):
			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):
		case (NODE_REFMETA):
			return(1);
		default:
			break;
		}
	case (NODE_REFMETA):
		return(parent == NODE_REFENTRY);
	case (NODE_REFMISCINFO):
		return(parent == NODE_REFMETA);
	case (NODE_REFNAME):
		return(parent == NODE_REFNAMEDIV);
	case (NODE_REFNAMEDIV):
		return(parent == NODE_REFENTRY);
	case (NODE_REFPURPOSE):
		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_REFSECT3):
		return(parent == NODE_REFSECT2);
	case (NODE_REFSECTION):
		switch (parent) {
		case (NODE_REFENTRY):
		case (NODE_REFSECTION):
		case (NODE_REFSYNOPSISDIV):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_REFSYNOPSISDIV):
		return(parent == NODE_REFENTRY);
	case (NODE_REPLACEABLE):
		switch (parent) {
		case (NODE_ACRONYM):
		case (NODE_APPLICATION):
		case (NODE_ARG):
		case (NODE_CODE):
		case (NODE_COMMAND):
		case (NODE_EMPHASIS):
		case (NODE_ENTRY):
		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_QUOTE):
		case (NODE_REFDESCRIPTOR):
		case (NODE_REFENTRYTITLE):
		case (NODE_REFMISCINFO):
		case (NODE_REFNAME):
		case (NODE_REFPURPOSE):
		case (NODE_REPLACEABLE):
		case (NODE_SCREEN):
		case (NODE_SGMLTAG):
		case (NODE_SYNOPSIS):
		case (NODE_TERM):
		case (NODE_TITLE):
		case (NODE_ULINK):
		case (NODE_USERINPUT):
		case (NODE_VARNAME):
		case (NODE_WORDASWORD):
		default:
			return(1);
		}
		return(0);
	case (NODE_ROW):
		switch (parent) {
		case (NODE_TBODY):
		case (NODE_TFOOT):
		case (NODE_THEAD):
			return(1);
		default:
			break;
		}
		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_CAUTION):
		case (NODE_ENTRY):
		case (NODE_ITEMIZEDLIST):
		case (NODE_LISTITEM):
		case (NODE_ORDEREDLIST):
		case (NODE_NOTE):
		case (NODE_PARA):
		case (NODE_REFSECT1):
		case (NODE_REFSECT2):
		case (NODE_REFSECT3):
		case (NODE_REFSECTION):
		case (NODE_REFSYNOPSISDIV):
		case (NODE_TIP):
		case (NODE_VARIABLELIST):
		case (NODE_WARNING):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_SGMLTAG):
		switch (parent) {
		case (NODE_APPLICATION):
		case (NODE_CODE):
		case (NODE_COMMAND):
		case (NODE_EMPHASIS):
		case (NODE_ENTRY):
		case (NODE_FILENAME):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_FUNCTION):
		case (NODE_LINK):
		case (NODE_LITERAL):
		case (NODE_OPTION):
		case (NODE_PARA):
		case (NODE_PARAMETER):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		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_USERINPUT):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_STRUCTNAME):
		switch (parent) {
		case (NODE_CODE):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_FUNCTION):
		case (NODE_OPTION):
		case (NODE_PARA):
		case (NODE_PARAMETER):
		case (NODE_PROGRAMLISTING):
		case (NODE_REFDESCRIPTOR):
		case (NODE_REFENTRYTITLE):
		case (NODE_REFNAME):
		case (NODE_REFPURPOSE):
		case (NODE_SYNOPSIS):
		case (NODE_TITLE):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_SYNOPSIS):
		switch (parent) {
		case (NODE_CAUTION):
		case (NODE_ENTRY):
		case (NODE_ITEMIZEDLIST):
		case (NODE_LISTITEM):
		case (NODE_ORDEREDLIST):
		case (NODE_NOTE):
		case (NODE_PARA):
		case (NODE_REFSYNOPSISDIV):
		case (NODE_REFSECT1):
		case (NODE_REFSECT2):
		case (NODE_REFSECT3):
		case (NODE_REFSECTION):
		case (NODE_TIP):
		case (NODE_WARNING):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_TABLE):
		switch (parent) {
		case (NODE_CAUTION):
		case (NODE_ENTRY):
		case (NODE_ITEMIZEDLIST):
		case (NODE_LISTITEM):
		case (NODE_ORDEREDLIST):
		case (NODE_NOTE):
		case (NODE_PARA):
		case (NODE_REFSECT1):
		case (NODE_REFSECT2):
		case (NODE_REFSECT3):
		case (NODE_REFSECTION):
		case (NODE_REFSYNOPSISDIV):
		case (NODE_TIP):
		case (NODE_VARIABLELIST):
		case (NODE_WARNING):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_TBODY):
		return(NODE_TGROUP == parent);
	case (NODE_TFOOT):
		return(NODE_TGROUP == parent);
	case (NODE_TGROUP):
		return(NODE_TABLE == parent);
	case (NODE_THEAD):
		return(NODE_TGROUP == parent);
	case (NODE_TITLE):
		switch (parent) {
		case (NODE_ITEMIZEDLIST):
		case (NODE_ORDEREDLIST):
		case (NODE_REFENTRYINFO):
		case (NODE_REFSECT1):
		case (NODE_REFSECT2):
		case (NODE_REFSECT3):
		case (NODE_REFSECTION):
		case (NODE_REFSYNOPSISDIV):
		case (NODE_TABLE):
		case (NODE_VARIABLELIST):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_TERM):
		return(NODE_VARLISTENTRY == parent);
	case (NODE_TEXT):
		return(1);
	case (NODE_TIP):
		switch (parent) {
		case (NODE_CAUTION):
		case (NODE_ENTRY):
		case (NODE_ITEMIZEDLIST):
		case (NODE_LISTITEM):
		case (NODE_NOTE):
		case (NODE_ORDEREDLIST):
		case (NODE_PARA):
		case (NODE_REFSECT1):
		case (NODE_REFSECT2):
		case (NODE_REFSECT3):
		case (NODE_REFSECTION):
		case (NODE_REFSYNOPSISDIV):
		case (NODE_TIP):
		case (NODE_VARIABLELIST):
		case (NODE_WARNING):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_USERINPUT):
		switch (parent) {
		case (NODE_EMPHASIS):
		case (NODE_ENTRY):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_LINK):
		case (NODE_PARA):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		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_CAUTION):
		case (NODE_ENTRY):
		case (NODE_ITEMIZEDLIST):
		case (NODE_ORDEREDLIST):
		case (NODE_NOTE):
		case (NODE_PARA):
		case (NODE_REFSECT1):
		case (NODE_REFSECT2):
		case (NODE_REFSECT3):
		case (NODE_REFSECTION):
		case (NODE_REFSYNOPSISDIV):
		case (NODE_TIP):
		case (NODE_VARIABLELIST):
		case (NODE_WARNING):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_VARNAME):
		switch (parent) {
		case (NODE_CODE):
		case (NODE_EMPHASIS):
		case (NODE_ENTRY):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_LINK):
		case (NODE_PARA):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		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):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_VARLISTENTRY):
		return (NODE_VARIABLELIST == parent);
	case (NODE_WARNING):
		switch (parent) {
		case (NODE_CAUTION):
		case (NODE_ENTRY):
		case (NODE_ITEMIZEDLIST):
		case (NODE_LISTITEM):
		case (NODE_NOTE):
		case (NODE_ORDEREDLIST):
		case (NODE_PARA):
		case (NODE_REFSECT1):
		case (NODE_REFSECT2):
		case (NODE_REFSECT3):
		case (NODE_REFSECTION):
		case (NODE_REFSYNOPSISDIV):
		case (NODE_TIP):
		case (NODE_VARIABLELIST):
		case (NODE_WARNING):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE_WORDASWORD):
		switch (parent) {
		case (NODE_EMPHASIS):
		case (NODE_ENTRY):
		case (NODE_FUNCSYNOPSISINFO):
		case (NODE_LINK):
		case (NODE_PARA):
		case (NODE_PROGRAMLISTING):
		case (NODE_QUOTE):
		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):
			return(1);
		default:
			break;
		}
		return(0);
	case (NODE__MAX):
		break;
	}

	abort();
	return(0);
}