version 1.40, 2009/01/20 13:05:28 |
version 1.42, 2009/01/20 13:49:36 |
|
|
|
|
#include "private.h" |
#include "private.h" |
|
|
|
/* |
|
* Main caller in the libmdoc library. This begins the parsing routine, |
|
* handles allocation of data, and so forth. Most of the "work" is done |
|
* in macro.c, but this orchestrates who does what, when. |
|
*/ |
|
|
const char *const __mdoc_macronames[MDOC_MAX] = { |
const char *const __mdoc_macronames[MDOC_MAX] = { |
"\\\"", "Dd", "Dt", "Os", |
"\\\"", "Dd", "Dt", "Os", |
"Sh", "Ss", "Pp", "D1", |
"Sh", "Ss", "Pp", "D1", |
Line 83 const char *const __mdoc_argnames[MDOC_ARG_MAX] = { |
|
Line 89 const char *const __mdoc_argnames[MDOC_ARG_MAX] = { |
|
"emphasis", "symbolic", |
"emphasis", "symbolic", |
}; |
}; |
|
|
|
/* Central table of library: who gets parsed how. */ |
|
|
const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { |
const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { |
{ NULL, 0 }, /* \" */ |
{ NULL, 0 }, /* \" */ |
{ macro_constant, MDOC_PROLOGUE }, /* Dd */ |
{ macro_constant, MDOC_PROLOGUE }, /* Dd */ |
Line 199 const char * const *mdoc_macronames = __mdoc_macroname |
|
Line 207 const char * const *mdoc_macronames = __mdoc_macroname |
|
const char * const *mdoc_argnames = __mdoc_argnames; |
const char * const *mdoc_argnames = __mdoc_argnames; |
const struct mdoc_macro * const mdoc_macros = __mdoc_macros; |
const struct mdoc_macro * const mdoc_macros = __mdoc_macros; |
|
|
|
|
static struct mdoc_arg *argdup(size_t, const struct mdoc_arg *); |
static struct mdoc_arg *argdup(size_t, const struct mdoc_arg *); |
static void argfree(size_t, struct mdoc_arg *); |
static void argfree(size_t, struct mdoc_arg *); |
static void argcpy(struct mdoc_arg *, |
static void argcpy(struct mdoc_arg *, |
Line 311 mdoc_parseln(struct mdoc *mdoc, int line, char *buf) |
|
Line 318 mdoc_parseln(struct mdoc *mdoc, int line, char *buf) |
|
return(1); |
return(1); |
|
|
i = 1; |
i = 1; |
while (buf[i] && ! isspace(buf[i]) && i < (int)sizeof(tmp)) |
while (buf[i] && ! isspace((int)buf[i]) && i < (int)sizeof(tmp)) |
i++; |
i++; |
|
|
if (i == (int)sizeof(tmp)) { |
if (i == (int)sizeof(tmp)) { |
Line 332 mdoc_parseln(struct mdoc *mdoc, int line, char *buf) |
|
Line 339 mdoc_parseln(struct mdoc *mdoc, int line, char *buf) |
|
return(mdoc_perr(mdoc, line, 1, "unknown macro")); |
return(mdoc_perr(mdoc, line, 1, "unknown macro")); |
} |
} |
|
|
while (buf[i] && isspace(buf[i])) |
while (buf[i] && isspace((int)buf[i])) |
i++; |
i++; |
|
|
if ( ! mdoc_macro(mdoc, c, line, 1, &i, buf)) { |
if ( ! mdoc_macro(mdoc, c, line, 1, &i, buf)) { |