version 1.15, 2019/04/14 18:07:35 |
version 1.27, 2019/05/01 11:34:20 |
|
|
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
|
|
|
#include "xmalloc.h" |
#include "node.h" |
#include "node.h" |
|
|
/* |
/* |
Line 31 struct nodeprop { |
|
Line 32 struct nodeprop { |
|
}; |
}; |
|
|
static const struct nodeprop properties[] = { |
static const struct nodeprop properties[] = { |
|
{ "abstract", CLASS_BLOCK }, |
{ "appendix", CLASS_BLOCK }, |
{ "appendix", CLASS_BLOCK }, |
{ "arg", CLASS_ENCL }, |
{ "arg", CLASS_ENCL }, |
{ "author", CLASS_LINE }, |
{ "author", CLASS_LINE }, |
Line 58 static const struct nodeprop properties[] = { |
|
Line 60 static const struct nodeprop properties[] = { |
|
{ "fieldsynopsis", CLASS_TRANS }, |
{ "fieldsynopsis", CLASS_TRANS }, |
{ "filename", CLASS_LINE }, |
{ "filename", CLASS_LINE }, |
{ "firstterm", CLASS_LINE }, |
{ "firstterm", CLASS_LINE }, |
{ "footnote", CLASS_TRANS }, |
{ "footnote", CLASS_BLOCK }, |
{ "funcdef", CLASS_BLOCK }, |
{ "funcdef", CLASS_BLOCK }, |
{ "funcprototype", CLASS_BLOCK }, |
{ "funcprototype", CLASS_BLOCK }, |
{ "funcsynopsis", CLASS_TRANS }, |
{ "funcsynopsis", CLASS_TRANS }, |
Line 66 static const struct nodeprop properties[] = { |
|
Line 68 static const struct nodeprop properties[] = { |
|
{ "function", CLASS_LINE }, |
{ "function", CLASS_LINE }, |
{ "glossterm", CLASS_LINE }, |
{ "glossterm", CLASS_LINE }, |
{ "group", CLASS_ENCL }, |
{ "group", CLASS_ENCL }, |
|
{ "imagedata", CLASS_TEXT }, |
{ "xi:include", CLASS_VOID }, |
{ "xi:include", CLASS_VOID }, |
{ "index", CLASS_TRANS }, |
{ "index", CLASS_TRANS }, |
{ "info", CLASS_TRANS }, |
{ "info", CLASS_TRANS }, |
Line 77 static const struct nodeprop properties[] = { |
|
Line 80 static const struct nodeprop properties[] = { |
|
{ "link", CLASS_ENCL }, |
{ "link", CLASS_ENCL }, |
{ "listitem", CLASS_TRANS }, |
{ "listitem", CLASS_TRANS }, |
{ "literal", CLASS_ENCL }, |
{ "literal", CLASS_ENCL }, |
{ "literallayout", CLASS_BLOCK }, |
{ "literallayout", CLASS_NOFILL }, |
{ "manvolnum", CLASS_TRANS }, |
{ "manvolnum", CLASS_TRANS }, |
{ "markup", CLASS_LINE }, |
{ "markup", CLASS_LINE }, |
{ "member", CLASS_LINE }, |
{ "member", CLASS_LINE }, |
Line 92 static const struct nodeprop properties[] = { |
|
Line 95 static const struct nodeprop properties[] = { |
|
{ "mml:msup", CLASS_LINE }, |
{ "mml:msup", CLASS_LINE }, |
{ "modifier", CLASS_LINE }, |
{ "modifier", CLASS_LINE }, |
{ "note", CLASS_BLOCK }, |
{ "note", CLASS_BLOCK }, |
|
{ "olink", CLASS_ENCL }, |
{ "option", CLASS_LINE }, |
{ "option", CLASS_LINE }, |
{ "orderedlist", CLASS_BLOCK }, |
{ "orderedlist", CLASS_BLOCK }, |
{ "para", CLASS_BLOCK }, |
{ "para", CLASS_BLOCK }, |
Line 99 static const struct nodeprop properties[] = { |
|
Line 103 static const struct nodeprop properties[] = { |
|
{ "parameter", CLASS_LINE }, |
{ "parameter", CLASS_LINE }, |
{ "personname", CLASS_TRANS }, |
{ "personname", CLASS_TRANS }, |
{ "preface", CLASS_BLOCK }, |
{ "preface", CLASS_BLOCK }, |
{ "programlisting", CLASS_BLOCK }, |
{ "productname", CLASS_LINE }, |
|
{ "programlisting", CLASS_NOFILL }, |
{ "prompt", CLASS_TRANS }, |
{ "prompt", CLASS_TRANS }, |
{ "pubdate", CLASS_TRANS }, |
{ "pubdate", CLASS_TRANS }, |
{ "quote", CLASS_ENCL }, |
{ "quote", CLASS_ENCL }, |
Line 118 static const struct nodeprop properties[] = { |
|
Line 123 static const struct nodeprop properties[] = { |
|
{ "replaceable", CLASS_LINE }, |
{ "replaceable", CLASS_LINE }, |
{ "row", CLASS_BLOCK }, |
{ "row", CLASS_BLOCK }, |
{ "sbr", CLASS_BLOCK }, |
{ "sbr", CLASS_BLOCK }, |
{ "screen", CLASS_BLOCK }, |
{ "screen", CLASS_NOFILL }, |
{ "section", CLASS_BLOCK }, |
{ "section", CLASS_BLOCK }, |
{ "simplelist", CLASS_TRANS }, |
{ "simplelist", CLASS_TRANS }, |
{ "simplesect", CLASS_BLOCK }, |
{ "simplesect", CLASS_BLOCK }, |
{ "spanspec", CLASS_TRANS }, |
{ "spanspec", CLASS_TRANS }, |
|
{ "subscript", CLASS_TEXT }, |
{ "subtitle", CLASS_BLOCK }, |
{ "subtitle", CLASS_BLOCK }, |
{ "synopsis", CLASS_BLOCK }, |
{ "superscript", CLASS_TEXT }, |
|
{ "synopsis", CLASS_NOFILL }, |
{ "systemitem", CLASS_LINE }, |
{ "systemitem", CLASS_LINE }, |
{ "table", CLASS_TRANS }, |
{ "table", CLASS_TRANS }, |
{ "tbody", CLASS_TRANS }, |
{ "tbody", CLASS_TRANS }, |
Line 138 static const struct nodeprop properties[] = { |
|
Line 145 static const struct nodeprop properties[] = { |
|
{ "variablelist", CLASS_BLOCK }, |
{ "variablelist", CLASS_BLOCK }, |
{ "varlistentry", CLASS_BLOCK }, |
{ "varlistentry", CLASS_BLOCK }, |
{ "varname", CLASS_LINE }, |
{ "varname", CLASS_LINE }, |
|
{ "void", CLASS_TEXT }, |
{ "warning", CLASS_BLOCK }, |
{ "warning", CLASS_BLOCK }, |
{ "wordasword", CLASS_TRANS }, |
{ "wordasword", CLASS_TRANS }, |
|
{ "xref", CLASS_LINE }, |
|
{ "year", CLASS_TRANS }, |
{ "[UNKNOWN]", CLASS_VOID }, |
{ "[UNKNOWN]", CLASS_VOID }, |
{ "(t)", CLASS_TEXT }, |
{ "(t)", CLASS_TEXT }, |
{ "(e)", CLASS_TEXT } |
{ "(e)", CLASS_TEXT } |
Line 152 static const char *const attrkeys[ATTRKEY__MAX] = { |
|
Line 162 static const char *const attrkeys[ATTRKEY__MAX] = { |
|
"cols", |
"cols", |
"DEFINITION", |
"DEFINITION", |
"endterm", |
"endterm", |
|
"entityref", |
|
"fileref", |
"href", |
"href", |
"id", |
"id", |
"linkend", |
"linkend", |
|
"localinfo", |
"NAME", |
"NAME", |
"open", |
"open", |
"PUBLIC", |
"PUBLIC", |
"rep", |
"rep", |
"SYSTEM", |
"SYSTEM", |
|
"targetdoc", |
|
"targetptr", |
"url", |
"url", |
"xlink:href" |
"xlink:href" |
}; |
}; |
Line 240 pnode_alloc(struct pnode *np) |
|
Line 255 pnode_alloc(struct pnode *np) |
|
{ |
{ |
struct pnode *n; |
struct pnode *n; |
|
|
if ((n = calloc(1, sizeof(*n))) != NULL) { |
n = xcalloc(1, sizeof(*n)); |
TAILQ_INIT(&n->childq); |
TAILQ_INIT(&n->childq); |
TAILQ_INIT(&n->attrq); |
TAILQ_INIT(&n->attrq); |
if ((n->parent = np) != NULL) |
if ((n->parent = np) != NULL) |
TAILQ_INSERT_TAIL(&np->childq, n, child); |
TAILQ_INSERT_TAIL(&np->childq, n, child); |
} |
return n; |
|
} |
|
|
|
struct pnode * |
|
pnode_alloc_text(struct pnode *np, const char *text) |
|
{ |
|
struct pnode *n; |
|
|
|
n = pnode_alloc(np); |
|
n->node = NODE_TEXT; |
|
n->b = xstrdup(text); |
return n; |
return n; |
} |
} |
|
|