version 1.111, 2014/01/19 00:09:38 |
version 1.114, 2014/01/22 20:58:39 |
Line 157 static int parse_mdoc_Nd(struct mpage *, const struct |
|
Line 157 static int parse_mdoc_Nd(struct mpage *, const struct |
|
static int parse_mdoc_Nm(struct mpage *, const struct mdoc_node *); |
static int parse_mdoc_Nm(struct mpage *, const struct mdoc_node *); |
static int parse_mdoc_Sh(struct mpage *, const struct mdoc_node *); |
static int parse_mdoc_Sh(struct mpage *, const struct mdoc_node *); |
static int parse_mdoc_Xr(struct mpage *, const struct mdoc_node *); |
static int parse_mdoc_Xr(struct mpage *, const struct mdoc_node *); |
static void putkey(const struct mpage *, |
static void putkey(const struct mpage *, char *, uint64_t); |
const char *, uint64_t); |
|
static void putkeys(const struct mpage *, |
static void putkeys(const struct mpage *, |
const char *, size_t, uint64_t); |
const char *, size_t, uint64_t); |
static void putmdockey(const struct mpage *, |
static void putmdockey(const struct mpage *, |
Line 957 mlink_check(struct mpage *mpage, struct mlink *mlink) |
|
Line 956 mlink_check(struct mpage *mpage, struct mlink *mlink) |
|
static void |
static void |
mpages_merge(struct mchars *mc, struct mparse *mp) |
mpages_merge(struct mchars *mc, struct mparse *mp) |
{ |
{ |
|
char any[] = "any"; |
struct ohash_info str_info; |
struct ohash_info str_info; |
struct mpage *mpage; |
struct mpage *mpage; |
struct mlink *mlink; |
struct mlink *mlink; |
struct mdoc *mdoc; |
struct mdoc *mdoc; |
struct man *man; |
struct man *man; |
const char *cp; |
char *cp; |
int match; |
int match; |
unsigned int pslot; |
unsigned int pslot; |
enum mandoclevel lvl; |
enum mandoclevel lvl; |
Line 1028 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
Line 1028 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
} |
} |
putkey(mpage, mpage->sec, TYPE_sec); |
putkey(mpage, mpage->sec, TYPE_sec); |
putkey(mpage, '\0' == *mpage->arch ? |
putkey(mpage, '\0' == *mpage->arch ? |
"any" : mpage->arch, TYPE_arch); |
any : mpage->arch, TYPE_arch); |
|
|
for (mlink = mpage->mlinks; mlink; mlink = mlink->next) { |
for (mlink = mpage->mlinks; mlink; mlink = mlink->next) { |
if ('\0' != *mlink->dsec) |
if ('\0' != *mlink->dsec) |
Line 1036 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
Line 1036 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
if ('\0' != *mlink->fsec) |
if ('\0' != *mlink->fsec) |
putkey(mpage, mlink->fsec, TYPE_sec); |
putkey(mpage, mlink->fsec, TYPE_sec); |
putkey(mpage, '\0' == *mlink->arch ? |
putkey(mpage, '\0' == *mlink->arch ? |
"any" : mlink->arch, TYPE_arch); |
any : mlink->arch, TYPE_arch); |
putkey(mpage, mlink->name, TYPE_Nm); |
putkey(mpage, mlink->name, TYPE_Nm); |
} |
} |
|
|
Line 1186 parse_cat(struct mpage *mpage) |
|
Line 1186 parse_cat(struct mpage *mpage) |
|
* Put a type/word pair into the word database for this particular file. |
* Put a type/word pair into the word database for this particular file. |
*/ |
*/ |
static void |
static void |
putkey(const struct mpage *mpage, const char *value, uint64_t type) |
putkey(const struct mpage *mpage, char *value, uint64_t type) |
{ |
{ |
|
char *cp; |
|
|
assert(NULL != value); |
assert(NULL != value); |
|
if (TYPE_arch == type) |
|
for (cp = value; *cp; cp++) |
|
if (isupper((unsigned char)*cp)) |
|
*cp = _tolower((unsigned char)*cp); |
putkeys(mpage, value, strlen(value), type); |
putkeys(mpage, value, strlen(value), type); |
} |
} |
|
|
Line 1443 parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_n |
|
Line 1448 parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_n |
|
static int |
static int |
parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_node *n) |
parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_node *n) |
{ |
{ |
const char *cp; |
char *cp; |
|
|
if (NULL == (n = n->child) || MDOC_TEXT != n->type) |
if (NULL == (n = n->child) || MDOC_TEXT != n->type) |
return(0); |
return(0); |
|
|
render_key(struct mchars *mc, struct str *key) |
render_key(struct mchars *mc, struct str *key) |
{ |
{ |
size_t sz, bsz, pos; |
size_t sz, bsz, pos; |
char utfbuf[7], res[5]; |
char utfbuf[7], res[6]; |
char *buf; |
char *buf; |
const char *seq, *cpp, *val; |
const char *seq, *cpp, *val; |
int len, u; |
int len, u; |
Line 1671 render_key(struct mchars *mc, struct str *key) |
|
Line 1676 render_key(struct mchars *mc, struct str *key) |
|
res[1] = '\t'; |
res[1] = '\t'; |
res[2] = ASCII_NBRSP; |
res[2] = ASCII_NBRSP; |
res[3] = ASCII_HYPH; |
res[3] = ASCII_HYPH; |
res[4] = '\0'; |
res[4] = ASCII_BREAK; |
|
res[5] = '\0'; |
|
|
val = key->key; |
val = key->key; |
bsz = strlen(val); |
bsz = strlen(val); |
Line 1702 render_key(struct mchars *mc, struct str *key) |
|
Line 1708 render_key(struct mchars *mc, struct str *key) |
|
val += sz; |
val += sz; |
} |
} |
|
|
if (ASCII_HYPH == *val) { |
switch (*val) { |
|
case (ASCII_HYPH): |
buf[pos++] = '-'; |
buf[pos++] = '-'; |
val++; |
val++; |
continue; |
continue; |
} else if ('\t' == *val || ASCII_NBRSP == *val) { |
case ('\t'): |
|
/* FALLTHROUGH */ |
|
case (ASCII_NBRSP): |
buf[pos++] = ' '; |
buf[pos++] = ' '; |
val++; |
val++; |
|
/* FALLTHROUGH */ |
|
case (ASCII_BREAK): |
continue; |
continue; |
} else if ('\\' != *val) |
default: |
|
break; |
|
} |
|
if ('\\' != *val) |
break; |
break; |
|
|
/* Read past the slash. */ |
/* Read past the slash. */ |