-/* $Id: argv.c,v 1.5 2009/01/01 20:40:16 kristaps Exp $ */
+/* $Id: argv.c,v 1.6 2009/01/02 14:06:16 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
{
switch (tok) {
+ case (MDOC_Bf):
+ if (xstrcmp(argv, "emphasis"))
+ return(MDOC_Emphasis);
+ else if (xstrcmp(argv, "literal"))
+ return(MDOC_Literal);
+ else if (xstrcmp(argv, "symbolic"))
+ return(MDOC_Symbolic);
+ break;
+
+ case (MDOC_An):
+ if (xstrcmp(argv, "split"))
+ return(MDOC_Split);
+ else if (xstrcmp(argv, "nosplit"))
+ return(MDOC_Nosplit);
+ break;
+
case (MDOC_Bd):
if (xstrcmp(argv, "ragged"))
return(MDOC_Ragged);
ppos = *pos;
switch (v->arg) {
- case(MDOC_Compact):
- /* FALLTHROUGH */
- case(MDOC_Ragged):
- /* FALLTHROUGH */
- case(MDOC_Unfilled):
- /* FALLTHROUGH */
- case(MDOC_Literal):
- /* FALLTHROUGH */
- case(MDOC_File):
- /* FALLTHROUGH */
- case(MDOC_Bullet):
- /* FALLTHROUGH */
- case(MDOC_Dash):
- /* FALLTHROUGH */
- case(MDOC_Hyphen):
- /* FALLTHROUGH */
- case(MDOC_Item):
- /* FALLTHROUGH */
- case(MDOC_Enum):
- /* FALLTHROUGH */
- case(MDOC_Tag):
- /* FALLTHROUGH */
- case(MDOC_Diag):
- /* FALLTHROUGH */
- case(MDOC_Hang):
- /* FALLTHROUGH */
- case(MDOC_Ohang):
- /* FALLTHROUGH */
- case(MDOC_Inset):
- v->sz = 0;
- v->value = NULL;
- break;
-
case(MDOC_Std):
/* FALLTHROUGH */
case(MDOC_Width):
v->sz = i;
break;
+
default:
- abort();
- /* NOTREACHED */
+ v->sz = 0;
+ v->value = NULL;
+ break;
}
return(1);
-/* $Id: macro.c,v 1.16 2009/01/01 20:40:16 kristaps Exp $ */
+/* $Id: macro.c,v 1.17 2009/01/02 14:06:16 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
if ( ! mdoc_valid_pre(mdoc, tok, pos, 0, NULL, argc, argv))
return(0);
+
+ switch (tok) {
+ case (MDOC_Pf):
+ /* TODO: only use first two arguments in element. */
+ break;
+ default:
+ break;
+ }
+
mdoc_elem_alloc(mdoc, pos, tok, (size_t)argc,
argv, (size_t)sz, _CC(args));
mdoc->next = MDOC_NEXT_SIBLING;
case (MDOC_Re):
tt = MDOC_Rs;
break;
+ case (MDOC_Ef):
+ tt = MDOC_Bf;
+ break;
default:
abort();
/* NOTREACHED */
}
+/*
+ * FIXME: like in with macro_constant, have the append_ routine chop the
+ * number of requisite arguments (this is ugly when done in-line).
+ */
int
macro_constant_delimited(MACRO_PROT_ARGS)
{
-/* $Id: mdoc.c,v 1.13 2009/01/01 20:40:16 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.14 2009/01/02 14:06:16 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
"xsh5", "xns5", "xns5.2d2.0",
"xcurses4.2", "susv2", "susv3",
"svid4", "filled", "words",
+ "emphasis", "symbolic",
};
const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
{ macro_close_explicit, 0 }, /* El */
{ NULL, 0 }, /* It */
{ macro_text, MDOC_CALLABLE }, /* Ad */
- { NULL, 0 }, /* An */
+ { macro_constant, 0 }, /* An */
{ macro_text, MDOC_CALLABLE }, /* Ar */
{ macro_constant, MDOC_QUOTABLE }, /* Cd */
{ macro_text, MDOC_CALLABLE }, /* Cm */
{ macro_scoped_line, MDOC_CALLABLE }, /* Aq */
{ macro_constant, 0 }, /* At */
{ NULL, 0 }, /* Bc */
- { NULL, 0 }, /* Bf */
+ { macro_scoped, 0 }, /* Bf */
{ NULL, 0 }, /* Bo */
{ macro_scoped_line, MDOC_CALLABLE }, /* Bq */
{ macro_constant_delimited, 0 }, /* Bsx */
{ NULL, 0 }, /* Do */
{ macro_scoped_line, MDOC_CALLABLE }, /* Dq */
{ NULL, 0 }, /* Ec */
- { NULL, 0 }, /* Ef */
+ { macro_close_explicit, 0 }, /* Ef */
{ macro_text, MDOC_CALLABLE }, /* Em */
{ NULL, 0 }, /* Eo */
{ macro_constant_delimited, 0 }, /* Fx */
{ macro_constant_delimited, 0 }, /* Nx */
{ macro_constant_delimited, 0 }, /* Ox */
{ NULL, 0 }, /* Pc */
- { NULL, 0 }, /* Pf */
+ { macro_constant, 0 }, /* Pf */
{ NULL, 0 }, /* Po */
{ macro_scoped_line, MDOC_CALLABLE }, /* Pq */
{ NULL, 0 }, /* Qc */
-/* $Id: mdoc.h,v 1.11 2009/01/01 20:40:16 kristaps Exp $ */
+/* $Id: mdoc.h,v 1.12 2009/01/02 14:06:16 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
#define MDOC_svid4 57
#define MDOC_Filled 58
#define MDOC_Words 59
-#define MDOC_ARG_MAX 60
+#define MDOC_Emphasis 60
+#define MDOC_Symbolic 61
+#define MDOC_ARG_MAX 62
enum mdoc_err {
ERR_SYNTAX_QUOTE, /* NOTUSED */
-/* $Id: prologue.c,v 1.1 2009/01/01 20:40:16 kristaps Exp $ */
+/* $Id: prologue.c,v 1.2 2009/01/02 14:06:16 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
*/
#include <assert.h>
#include <stdlib.h>
+#ifdef __linux__
+#include <time.h>
+#endif
#include "private.h"
return(0);
if (0 == j) {
- if (xstrcmp("$Mdocdate: January 1 2009 $", args[j])) {
+ if (xstrcmp("$Mdocdate: January 2 2009 $", args[j])) {
mdoc->meta.date = time(NULL);
goto again;
} else if (xstrcmp("$Mdocdate:", args[j]))
-/* $Id: validate.c,v 1.12 2009/01/02 09:29:06 kristaps Exp $ */
+/* $Id: validate.c,v 1.13 2009/01/02 14:06:16 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
{ NULL, NULL, no_head_child }, /* El */
{ NULL, NULL, NULL }, /* It */
{ need_ge1, NULL, NULL }, /* Ad */
- { NULL, NULL, NULL }, /* An */
+ { NULL, NULL, NULL }, /* An */ /* FIXME: no args & argv. */
{ NULL, NULL, NULL }, /* Ar */
{ need_ge1, NULL, NULL }, /* Cd */
{ NULL, NULL, NULL }, /* Cm */
{ NULL, NULL, NULL }, /* Do */
{ NULL, NULL, NULL }, /* Dq */
{ NULL, NULL, NULL }, /* Ec */
- { NULL, NULL, NULL }, /* Ef */
+ { NULL, NULL, NULL }, /* Ef */ /* -symbolic, etc. */
{ need_ge1, NULL, NULL }, /* Em */
{ NULL, NULL, NULL }, /* Eo */
{ assert_le1, NULL, NULL }, /* Fx */
{ assert_le1, NULL, NULL }, /* Nx */
{ assert_le1, NULL, NULL }, /* Ox */
{ NULL, NULL, NULL }, /* Pc */
- { NULL, NULL, NULL }, /* Pf */
+ { NULL, NULL, NULL }, /* Pf */ /* 2 or more arguments */
{ NULL, NULL, NULL }, /* Po */
{ NULL, NULL, NULL }, /* Pq */
{ NULL, NULL, NULL }, /* Qc */