version 1.176, 2014/12/05 14:26:40 |
version 1.179, 2014/12/09 07:29:42 |
Line 165 static int parse_mdoc_head(struct mpage *, const stru |
|
Line 165 static int parse_mdoc_head(struct mpage *, const stru |
|
const struct mdoc_node *); |
const struct mdoc_node *); |
static int parse_mdoc_Fd(struct mpage *, const struct mdoc_meta *, |
static int parse_mdoc_Fd(struct mpage *, const struct mdoc_meta *, |
const struct mdoc_node *); |
const struct mdoc_node *); |
|
static void parse_mdoc_fname(struct mpage *, const struct mdoc_node *); |
static int parse_mdoc_Fn(struct mpage *, const struct mdoc_meta *, |
static int parse_mdoc_Fn(struct mpage *, const struct mdoc_meta *, |
const struct mdoc_node *); |
const struct mdoc_node *); |
static int parse_mdoc_Fo(struct mpage *, const struct mdoc_meta *, |
static int parse_mdoc_Fo(struct mpage *, const struct mdoc_meta *, |
Line 335 static const struct mdoc_handler mdocs[MDOC_MAX] = { |
|
Line 336 static const struct mdoc_handler mdocs[MDOC_MAX] = { |
|
|
|
|
|
int |
int |
main(int argc, char *argv[]) |
mandocdb(int argc, char *argv[]) |
{ |
{ |
int ch, i; |
int ch, i; |
size_t j, sz; |
size_t j, sz; |
Line 1640 parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_m |
|
Line 1641 parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_m |
|
return(0); |
return(0); |
} |
} |
|
|
static int |
static void |
parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_meta *meta, |
parse_mdoc_fname(struct mpage *mpage, const struct mdoc_node *n) |
const struct mdoc_node *n) |
|
{ |
{ |
char *cp; |
char *cp; |
|
size_t sz; |
|
|
if (NULL == (n = n->child) || MDOC_TEXT != n->type) |
if (n->type != MDOC_TEXT) |
return(0); |
return; |
|
|
/* |
/* Skip function pointer punctuation. */ |
* Parse: .Fn "struct type *name" "char *arg". |
|
* First strip away pointer symbol. |
|
* Then store the function name, then type. |
|
* Finally, store the arguments. |
|
*/ |
|
|
|
if (NULL == (cp = strrchr(n->string, ' '))) |
cp = n->string; |
cp = n->string; |
while (*cp == '(' || *cp == '*') |
|
|
while ('*' == *cp) |
|
cp++; |
cp++; |
|
sz = strcspn(cp, "()"); |
|
|
putkey(mpage, cp, TYPE_Fn); |
putkeys(mpage, cp, sz, TYPE_Fn); |
if (n->sec == SEC_SYNOPSIS) |
if (n->sec == SEC_SYNOPSIS) |
putkey(mpage, cp, NAME_SYN); |
putkeys(mpage, cp, sz, NAME_SYN); |
|
} |
|
|
if (n->string < cp) |
static int |
putkeys(mpage, n->string, cp - n->string, TYPE_Ft); |
parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_meta *meta, |
|
const struct mdoc_node *n) |
|
{ |
|
|
for (n = n->next; NULL != n; n = n->next) |
if (n->child == NULL) |
if (MDOC_TEXT == n->type) |
return(0); |
|
|
|
parse_mdoc_fname(mpage, n->child); |
|
|
|
for (n = n->child->next; n != NULL; n = n->next) |
|
if (n->type == MDOC_TEXT) |
putkey(mpage, n->string, TYPE_Fa); |
putkey(mpage, n->string, TYPE_Fa); |
|
|
return(0); |
return(0); |
Line 1681 parse_mdoc_Fo(struct mpage *mpage, const struct mdoc_m |
|
Line 1684 parse_mdoc_Fo(struct mpage *mpage, const struct mdoc_m |
|
const struct mdoc_node *n) |
const struct mdoc_node *n) |
{ |
{ |
|
|
putmdockey(mpage, n->child, TYPE_Fn); |
if (n->type != MDOC_HEAD) |
if (n->sec == SEC_SYNOPSIS) |
return(1); |
putmdockey(mpage, n->child, NAME_SYN); |
|
|
if (n->child != NULL) |
|
parse_mdoc_fname(mpage, n->child); |
|
|
return(0); |
return(0); |
} |
} |
|
|