version 1.29, 2014/04/02 10:59:07 |
version 1.32, 2014/04/30 09:04:40 |
Line 88 static const char *attrvals[ATTRVAL__MAX] = { |
|
Line 88 static const char *attrvals[ATTRVAL__MAX] = { |
|
static const struct node nodes[NODE__MAX] = { |
static const struct node nodes[NODE__MAX] = { |
{ NULL, 0 }, |
{ NULL, 0 }, |
{ "acronym", 0 }, |
{ "acronym", 0 }, |
|
{ "anchor", NODE_IGNTEXT }, |
{ "application", 0 }, |
{ "application", 0 }, |
{ "arg", 0 }, |
{ "arg", 0 }, |
{ "caution", NODE_IGNTEXT }, |
{ "caution", NODE_IGNTEXT }, |
Line 95 static const struct node nodes[NODE__MAX] = { |
|
Line 96 static const struct node nodes[NODE__MAX] = { |
|
{ "cmdsynopsis", NODE_IGNTEXT }, |
{ "cmdsynopsis", NODE_IGNTEXT }, |
{ "code", 0 }, |
{ "code", 0 }, |
{ "command", 0 }, |
{ "command", 0 }, |
|
{ "constant", 0 }, |
|
{ "copyright", NODE_IGNTEXT }, |
{ "date", 0 }, |
{ "date", 0 }, |
{ "emphasis", 0 }, |
{ "emphasis", 0 }, |
{ "entry", 0 }, |
{ "entry", 0 }, |
Line 105 static const struct node nodes[NODE__MAX] = { |
|
Line 108 static const struct node nodes[NODE__MAX] = { |
|
{ "funcsynopsis", NODE_IGNTEXT }, |
{ "funcsynopsis", NODE_IGNTEXT }, |
{ "funcsynopsisinfo", 0 }, |
{ "funcsynopsisinfo", 0 }, |
{ "function", 0 }, |
{ "function", 0 }, |
{ "itemizedlist", NODE_IGNTEXT }, |
|
{ "group", NODE_IGNTEXT }, |
{ "group", NODE_IGNTEXT }, |
|
{ "holder", NODE_IGNTEXT }, |
|
{ "info", NODE_IGNTEXT }, |
|
{ "itemizedlist", NODE_IGNTEXT }, |
{ "link", 0 }, |
{ "link", 0 }, |
{ "listitem", NODE_IGNTEXT }, |
{ "listitem", NODE_IGNTEXT }, |
{ "literal", 0 }, |
{ "literal", 0 }, |
Line 139 static const struct node nodes[NODE__MAX] = { |
|
Line 144 static const struct node nodes[NODE__MAX] = { |
|
{ "row", NODE_IGNTEXT }, |
{ "row", NODE_IGNTEXT }, |
{ "sbr", NODE_IGNTEXT }, |
{ "sbr", NODE_IGNTEXT }, |
{ "screen", NODE_IGNTEXT }, |
{ "screen", NODE_IGNTEXT }, |
|
{ "sgmltag", 0 }, |
{ "structname", 0 }, |
{ "structname", 0 }, |
{ "synopsis", 0 }, |
{ "synopsis", 0 }, |
{ "table", NODE_IGNTEXT }, |
{ "table", NODE_IGNTEXT }, |
Line 156 static const struct node nodes[NODE__MAX] = { |
|
Line 162 static const struct node nodes[NODE__MAX] = { |
|
{ "varlistentry", NODE_IGNTEXT }, |
{ "varlistentry", NODE_IGNTEXT }, |
{ "varname", 0 }, |
{ "varname", 0 }, |
{ "warning", NODE_IGNTEXT }, |
{ "warning", NODE_IGNTEXT }, |
|
{ "wordasword", 0 }, |
|
{ "year", NODE_IGNTEXT }, |
}; |
}; |
|
|
static void |
static void |
Line 332 xml_elem_start(void *arg, const XML_Char *name, const |
|
Line 340 xml_elem_start(void *arg, const XML_Char *name, const |
|
if (0 == strcmp(*att, attrkeys[key])) |
if (0 == strcmp(*att, attrkeys[key])) |
break; |
break; |
if (ATTRKEY__MAX == key) { |
if (ATTRKEY__MAX == key) { |
fprintf(stderr, "%s:%zu:%zu: unknown " |
fprintf(stderr, "%s:%zu:%zu: warning: " |
"attribute \"%s\"\n", ps->fname, |
"unknown attribute \"%s\"\n", |
|
ps->fname, |
XML_GetCurrentLineNumber(ps->xml), |
XML_GetCurrentLineNumber(ps->xml), |
XML_GetCurrentColumnNumber(ps->xml), |
XML_GetCurrentColumnNumber(ps->xml), |
*att); |
*att); |
continue; |
continue; |
} else if ( ! isattrkey(node, key)) { |
} else if ( ! isattrkey(node, key)) { |
fprintf(stderr, "%s:%zu:%zu: bad " |
fprintf(stderr, "%s:%zu:%zu: warning: " |
"attribute \"%s\"\n", ps->fname, |
"bad attribute \"%s\"\n", |
|
ps->fname, |
XML_GetCurrentLineNumber(ps->xml), |
XML_GetCurrentLineNumber(ps->xml), |
XML_GetCurrentColumnNumber(ps->xml), |
XML_GetCurrentColumnNumber(ps->xml), |
*att); |
*att); |
Line 350 xml_elem_start(void *arg, const XML_Char *name, const |
|
Line 360 xml_elem_start(void *arg, const XML_Char *name, const |
|
if (0 == strcmp(*(att + 1), attrvals[val])) |
if (0 == strcmp(*(att + 1), attrvals[val])) |
break; |
break; |
if (ATTRVAL__MAX != val && ! isattrval(key, val)) { |
if (ATTRVAL__MAX != val && ! isattrval(key, val)) { |
fprintf(stderr, "%s:%zu:%zu: bad " |
fprintf(stderr, "%s:%zu:%zu: warning: " |
"value \"%s\"\n", ps->fname, |
"bad attribute value \"%s\"\n", |
|
ps->fname, |
XML_GetCurrentLineNumber(ps->xml), |
XML_GetCurrentLineNumber(ps->xml), |
XML_GetCurrentColumnNumber(ps->xml), |
XML_GetCurrentColumnNumber(ps->xml), |
*(att + 1)); |
*(att + 1)); |
Line 515 pnode_findfirst(struct pnode *pn, enum nodeid node) |
|
Line 526 pnode_findfirst(struct pnode *pn, enum nodeid node) |
|
|
|
#define MACROLINE_NORM 0 |
#define MACROLINE_NORM 0 |
#define MACROLINE_UPPER 1 |
#define MACROLINE_UPPER 1 |
|
#define MACROLINE_NOWS 2 |
/* |
/* |
* Recursively print text presumably on a macro line. |
* Recursively print text presumably on a macro line. |
* Convert all whitespace to regular spaces. |
* Convert all whitespace to regular spaces. |
Line 524 pnode_printmacrolinetext(struct parse *p, struct pnode |
|
Line 536 pnode_printmacrolinetext(struct parse *p, struct pnode |
|
{ |
{ |
char *cp; |
char *cp; |
|
|
if (0 == p->newln) |
if (0 == p->newln && ! (MACROLINE_NOWS & fl)) |
putchar(' '); |
putchar(' '); |
|
|
bufclear(p); |
bufclear(p); |
Line 778 pnode_printparamdef(struct parse *p, struct pnode *pn) |
|
Line 790 pnode_printparamdef(struct parse *p, struct pnode *pn) |
|
fputs(".Fa \"", stdout); |
fputs(".Fa \"", stdout); |
p->newln = 0; |
p->newln = 0; |
if (NULL != ptype) { |
if (NULL != ptype) { |
pnode_printmacrolinepart(p, ptype); |
pnode_printmacrolinetext(p, ptype, MACROLINE_NOWS); |
putchar(' '); |
putchar(' '); |
} |
} |
|
|
Line 1065 pnode_print(struct parse *p, struct pnode *pn) |
|
Line 1077 pnode_print(struct parse *p, struct pnode *pn) |
|
pnode_printmopen(p); |
pnode_printmopen(p); |
fputs("Nm", stdout); |
fputs("Nm", stdout); |
break; |
break; |
|
case (NODE_ANCHOR): |
|
/* Don't print anything! */ |
|
return; |
case (NODE_ARG): |
case (NODE_ARG): |
pnode_printarg(p, pn); |
pnode_printarg(p, pn); |
pnode_unlinksub(pn); |
pnode_unlinksub(pn); |
Line 1140 pnode_print(struct parse *p, struct pnode *pn) |
|
Line 1155 pnode_print(struct parse *p, struct pnode *pn) |
|
/* Suppress non-text children... */ |
/* Suppress non-text children... */ |
pnode_printmopen(p); |
pnode_printmopen(p); |
fputs("Fa \"", stdout); |
fputs("Fa \"", stdout); |
pnode_printmacrolinepart(p, pn); |
pnode_printmacrolinetext(p, pn, MACROLINE_NOWS); |
puts("\""); |
fputs("\"", stdout); |
pnode_unlinksub(pn); |
pnode_unlinksub(pn); |
break; |
break; |
case (NODE_QUOTE): |
case (NODE_QUOTE): |
Line 1209 pnode_print(struct parse *p, struct pnode *pn) |
|
Line 1224 pnode_print(struct parse *p, struct pnode *pn) |
|
assert(p->newln); |
assert(p->newln); |
puts(".br"); |
puts(".br"); |
break; |
break; |
|
case (NODE_SGMLTAG): |
|
pnode_printmopen(p); |
|
fputs("Li", stdout); |
|
break; |
case (NODE_STRUCTNAME): |
case (NODE_STRUCTNAME): |
pnode_printmopen(p); |
pnode_printmopen(p); |
fputs("Vt", stdout); |
fputs("Vt", stdout); |
Line 1296 pnode_print(struct parse *p, struct pnode *pn) |
|
Line 1315 pnode_print(struct parse *p, struct pnode *pn) |
|
case (NODE_PARAMETER): |
case (NODE_PARAMETER): |
case (NODE_REPLACEABLE): |
case (NODE_REPLACEABLE): |
case (NODE_REFPURPOSE): |
case (NODE_REFPURPOSE): |
|
case (NODE_SGMLTAG): |
case (NODE_STRUCTNAME): |
case (NODE_STRUCTNAME): |
case (NODE_TEXT): |
case (NODE_TEXT): |
case (NODE_USERINPUT): |
case (NODE_USERINPUT): |
Line 1358 readfile(XML_Parser xp, int fd, |
|
Line 1378 readfile(XML_Parser xp, int fd, |
|
|
|
while ((ssz = read(fd, b, bsz)) >= 0) { |
while ((ssz = read(fd, b, bsz)) >= 0) { |
if (0 == (rc = XML_Parse(xp, b, ssz, 0 == ssz))) |
if (0 == (rc = XML_Parse(xp, b, ssz, 0 == ssz))) |
fprintf(stderr, "%s: %s\n", fn, |
fprintf(stderr, "%s:%zu:%zu: %s\n", fn, |
|
XML_GetCurrentLineNumber(xp), |
|
XML_GetCurrentColumnNumber(xp), |
XML_ErrorString |
XML_ErrorString |
(XML_GetErrorCode(xp))); |
(XML_GetErrorCode(xp))); |
else if ( ! p.stop && ssz > 0) |
else if ( ! p.stop && ssz > 0) |