Added Brq, Bro and Brc macros.
Added lbrace and rbrace to special characters.
Fixed spacing in braces.
-/* $Id: action.c,v 1.39 2009/03/09 14:19:59 kristaps Exp $ */
+/* $Id: action.c,v 1.40 2009/03/11 00:39:58 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
{ NULL }, /* Lp */
{ NULL }, /* Lk */
{ NULL }, /* Mt */
+ { NULL }, /* Brq */
+ { NULL }, /* Bro */
+ { NULL }, /* Brc */
};
-/* $Id: argv.c,v 1.47 2009/03/10 21:27:39 kristaps Exp $ */
+/* $Id: argv.c,v 1.48 2009/03/11 00:39:58 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
ARGS_DELIM, /* Lp */
ARGS_DELIM | ARGS_QUOTED, /* Lk */
ARGS_DELIM | ARGS_QUOTED, /* Mt */
+ ARGS_DELIM, /* Brq */
+ 0, /* Bro */
+ ARGS_DELIM, /* Brc */
};
-/* $Id: hash.c,v 1.9 2009/03/10 10:20:03 kristaps Exp $ */
+/* $Id: hash.c,v 1.10 2009/03/11 00:39:58 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
int i, major, minor, ind;
const void **htab;
- htab = calloc(27 * 26, sizeof(struct mdoc_macro *));
+ htab = calloc(27 * 26 * 3, sizeof(struct mdoc_macro *));
if (NULL == htab)
err(1, "calloc");
assert(major >= 0 && major < 27);
assert(minor >= 0 && minor < 26);
- ind = (major * 27) + minor;
+ ind = (major * 27 * 3) + (minor * 3);
- assert(NULL == htab[ind]);
+ if (NULL == htab[ind]) {
+ htab[ind] = &mdoc_macros[i];
+ continue;
+ }
+
+ if (NULL == htab[++ind]) {
+ htab[ind] = &mdoc_macros[i];
+ continue;
+ }
+
+ assert(NULL == htab[++ind]);
htab[ind] = &mdoc_macros[i];
}
else
minor = tmp[1] - 97;
- ind = (major * 27) + minor;
- if (ind < 0 || ind >= (27 * 26))
+ ind = (major * 27 * 3) + (minor * 3);
+ if (ind < 0 || ind >= (27 * 26 * 3))
return(MDOC_MAX);
- if (NULL == htab[ind])
- return(MDOC_MAX);
+ if (htab[ind]) {
+ slot = htab[ind] - /* LINTED */
+ (void *)mdoc_macros;
+ assert(0 == (size_t)slot % sizeof(struct mdoc_macro));
+ slot /= sizeof(struct mdoc_macro);
+ if (mdoc_macronames[slot][0] == tmp[0] &&
+ mdoc_macronames[slot][1] == tmp[1] &&
+ (0 == tmp[2] ||
+ mdoc_macronames[slot][2] == tmp[2]))
+ return(slot);
+ ind++;
+ }
+
+ if (htab[ind]) {
+ slot = htab[ind] - /* LINTED */
+ (void *)mdoc_macros;
+ assert(0 == (size_t)slot % sizeof(struct mdoc_macro));
+ slot /= sizeof(struct mdoc_macro);
+ if (mdoc_macronames[slot][0] == tmp[0] &&
+ mdoc_macronames[slot][1] == tmp[1] &&
+ (0 == tmp[2] ||
+ mdoc_macronames[slot][2] == tmp[2]))
+ return(slot);
+ ind++;
+ }
+ if (NULL == htab[ind])
+ return(MDOC_MAX);
slot = htab[ind] - /* LINTED */
(void *)mdoc_macros;
assert(0 == (size_t)slot % sizeof(struct mdoc_macro));
slot /= sizeof(struct mdoc_macro);
+ if (mdoc_macronames[slot][0] == tmp[0] &&
+ mdoc_macronames[slot][1] == tmp[1] &&
+ (0 == tmp[2] ||
+ mdoc_macronames[slot][2] == tmp[2]))
+ return(slot);
- if (mdoc_macronames[slot][0] != tmp[0])
- return(MDOC_MAX);
- if (mdoc_macronames[slot][1] != tmp[1])
- return(MDOC_MAX);
- if (tmp[2] && mdoc_macronames[slot][2] != tmp[2])
- return(MDOC_MAX);
-
- return(slot);
+ return(MDOC_MAX);
}
-/* $Id: macro.c,v 1.65 2009/03/10 15:01:54 kristaps Exp $ */
+/* $Id: macro.c,v 1.66 2009/03/11 00:39:58 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
{ macro_text, 0 }, /* Lp */
{ macro_text, MDOC_PARSED }, /* Lk */
{ macro_text, MDOC_PARSED }, /* Mt */
+ { macro_scoped_line, MDOC_CALLABLE | MDOC_PARSED }, /* Brq */
+ { macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Bro */
+ { macro_scoped_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Brc */
};
const struct mdoc_macro * const mdoc_macros = __mdoc_macros;
return(MDOC_Ao);
case (MDOC_Bc):
return(MDOC_Bo);
+ case (MDOC_Brc):
+ return(MDOC_Bro);
case (MDOC_Dc):
return(MDOC_Do);
case (MDOC_Ec):
/* FALLTHROUGH */
case (MDOC_Bq):
/* FALLTHROUGH */
+ case (MDOC_Brq):
+ /* FALLTHROUGH */
case (MDOC_D1):
/* FALLTHROUGH */
case (MDOC_Dl):
/* FALLTHROUGH */
case (MDOC_Bo):
/* FALLTHROUGH */
+ case (MDOC_Bro):
+ /* FALLTHROUGH */
case (MDOC_Do):
/* FALLTHROUGH */
case (MDOC_Eo):
/* FALLTHROUGH */
case (MDOC_Bc):
/* FALLTHROUGH */
+ case (MDOC_Brc):
+ /* FALLTHROUGH */
case (MDOC_Dc):
/* FALLTHROUGH */
case (MDOC_Ec):
-/* $Id: mdoc.c,v 1.60 2009/03/09 14:19:59 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.61 2009/03/11 00:39:58 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
"Fo", "Fc", "Oo", "Oc",
"Bk", "Ek", "Bt", "Hf",
"Fr", "Ud", "Lb", "Ap",
- "Lp", "Lk", "Mt"
+ "Lp", "Lk", "Mt", "Brq",
+ "Bro", "Brc"
};
const char *const __mdoc_argnames[MDOC_ARG_MAX] = {
-/* $Id: mdoc.h,v 1.45 2009/03/09 14:19:59 kristaps Exp $ */
+/* $Id: mdoc.h,v 1.46 2009/03/11 00:39:58 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
#define MDOC_Lp 108
#define MDOC_Lk 109
#define MDOC_Mt 110
-#define MDOC_MAX 111
+#define MDOC_Brq 111
+#define MDOC_Bro 112
+#define MDOC_Brc 113
+#define MDOC_MAX 114
/* What follows is a list of ALL possible macro arguments. */
-.\" $Id: mdocterm.1,v 1.16 2009/03/09 13:04:01 kristaps Exp $
+.\" $Id: mdocterm.1,v 1.17 2009/03/11 00:39:58 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
.\"
.\" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
.\" PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: March 9 2009 $
+.Dd $Mdocdate: March 11 2009 $
.Dt mdocterm 1
.Os
.\" SECTION
.Bl -tag -width "OutputXXXX" -offset "XXXX" -compact
.It Em Output
.Em Input (Name)
+.It \(rC
+\\(rC (right brace)
+.It \(lC
+\\(lC (left brace)
.It \(ra
\\(ra (right angle)
.It \(la
-/* $Id: mdocterm.c,v 1.38 2009/03/10 11:16:43 kristaps Exp $ */
+/* $Id: mdocterm.c,v 1.39 2009/03/11 00:39:58 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
};
static struct termenc termenc2[] = {
+ { "rC", TERMSYM_RBRACE },
+ { "lC", TERMSYM_LBRACE },
{ "rB", TERMSYM_RBRACK },
{ "lB", TERMSYM_LBRACK },
{ "ra", TERMSYM_RANGLE },
{ "", 0 }, /* TERMSYM_BREAK */
{ "<", 1 }, /* TERMSYM_LANGLE */
{ ">", 1 }, /* TERMSYM_RANGLE */
+ { "{", 1 }, /* TERMSYM_LBRACE */
+ { "}", 1 }, /* TERMSYM_RBRACE */
};
static const char ansi_clear[] = { 27, '[', '0', 'm' };
-/* $Id: term.c,v 1.52 2009/03/10 11:16:43 kristaps Exp $ */
+/* $Id: term.c,v 1.53 2009/03/11 00:39:58 kristaps Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
*
DECL_PREPOST(termp_aq);
DECL_PREPOST(termp_bd);
DECL_PREPOST(termp_bq);
+DECL_PREPOST(termp_brq);
DECL_PREPOST(termp_d1);
DECL_PREPOST(termp_dq);
DECL_PREPOST(termp_fd);
{ termp_pp_pre, NULL }, /* Pp */
{ termp_lk_pre, NULL }, /* Lk */
{ termp_mt_pre, NULL }, /* Mt */
+ { termp_brq_pre, termp_brq_post }, /* Brq */
+ { termp_brq_pre, termp_brq_post }, /* Bro */
+ { NULL, NULL }, /* Brc */
};
const struct termact *termacts = __termacts;
}
+/* ARGSUSED */
+static int
+termp_brq_pre(DECL_ARGS)
+{
+
+ if (MDOC_BODY != node->type)
+ return(1);
+ word(p, "\\(lC");
+ p->flags |= TERMP_NOSPACE;
+ return(1);
+}
+
+
+/* ARGSUSED */
+static void
+termp_brq_post(DECL_ARGS)
+{
+
+ if (MDOC_BODY != node->type)
+ return;
+ p->flags |= TERMP_NOSPACE;
+ word(p, "\\(rC");
+}
+
+
/* ARGSUSED */
static int
termp_bq_pre(DECL_ARGS)
if (MDOC_BODY != node->type)
return(1);
- word(p, "[");
+ word(p, "\\(lB");
p->flags |= TERMP_NOSPACE;
return(1);
}
if (MDOC_BODY != node->type)
return;
- word(p, "]");
+ p->flags |= TERMP_NOSPACE;
+ word(p, "\\(rB");
}
if (MDOC_BODY != node->type)
return;
+ p->flags |= TERMP_NOSPACE;
word(p, ")");
+ p->flags |= TERMP_NOSPACE;
word(p, ";");
newln(p);
}
-/* $Id: term.h,v 1.19 2009/03/04 14:41:40 kristaps Exp $ */
+/* $Id: term.h,v 1.20 2009/03/11 00:39:58 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
TERMSYM_PERIOD = 35,
TERMSYM_BREAK = 36,
TERMSYM_LANGLE = 37,
- TERMSYM_RANGLE = 38
+ TERMSYM_RANGLE = 38,
+ TERMSYM_LBRACE = 39,
+ TERMSYM_RBRACE = 40
};
-/* $Id: validate.c,v 1.78 2009/03/09 14:19:59 kristaps Exp $ */
+/* $Id: validate.c,v 1.79 2009/03/11 00:39:58 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
{ NULL, posts_pp }, /* Pp */
{ NULL, posts_lk }, /* Lk */
{ NULL, posts_mt }, /* Mt */
+ { NULL, posts_wline }, /* Brq */
+ { NULL, NULL }, /* Bro */
+ { NULL, NULL }, /* Brc */
};