From 54fddf1f8cc02e8fa1f3c9e094b88a226bcb0ac5 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Fri, 10 Oct 2014 14:27:46 +0000 Subject: Drop trailing whitespace, adjust a few indentations, and update Copyright year while here; no code change. --- eqn.c | 43 +++++++++++++++++++++---------------------- eqn_html.c | 20 ++++++++++---------- 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/eqn.c b/eqn.c index fbbef811..5a0f25e0 100644 --- a/eqn.c +++ b/eqn.c @@ -1,6 +1,6 @@ -/* $Id: eqn.c,v 1.50 2014/10/10 14:02:02 schwarze Exp $ */ +/* $Id: eqn.c,v 1.51 2014/10/10 14:27:46 schwarze Exp $ */ /* - * Copyright (c) 2011 Kristaps Dzonsons + * Copyright (c) 2011, 2014 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -554,7 +554,7 @@ eqn_box_alloc(struct eqn_node *ep, struct eqn_box *parent) * The new EQN_SUBEXPR will have a two-child limit. */ static struct eqn_box * -eqn_box_makebinary(struct eqn_node *ep, +eqn_box_makebinary(struct eqn_node *ep, enum eqn_post pos, struct eqn_box *parent) { struct eqn_box *b, *newb; @@ -666,7 +666,7 @@ eqn_parse(struct eqn_node *ep, struct eqn_box *parent) assert(NULL != parent); again: - + switch ((tok = eqn_tok_parse(ep, &p))) { case (EQN_TOK_UNDEF): if ((rc = eqn_undef(ep)) <= 0) @@ -680,7 +680,7 @@ again: case (EQN_TOK_TDEFINE): if (NULL == eqn_nextrawtok(ep, NULL)) EQN_MSG(MANDOCERR_EQNEOF, ep); - else if (NULL == eqn_next(ep, + else if (NULL == eqn_next(ep, ep->data[(int)ep->cur], NULL, 0)) EQN_MSG(MANDOCERR_EQNEOF, ep); break; @@ -707,8 +707,7 @@ again: EQN_MSG(MANDOCERR_EQNSYNT, ep); return(-1); } - parent = eqn_box_makebinary - (ep, EQNPOS_NONE, parent); + parent = eqn_box_makebinary(ep, EQNPOS_NONE, parent); parent->type = EQN_LISTONE; parent->expectargs = 1; switch (tok) { @@ -762,7 +761,7 @@ again: case (EQN_TOK_BACK): case (EQN_TOK_DOWN): case (EQN_TOK_UP): - tok = eqn_tok_parse(ep, NULL); + tok = eqn_tok_parse(ep, NULL); if (EQN_TOK__MAX != tok) { EQN_MSG(MANDOCERR_EQNSYNT, ep); return(-1); @@ -871,7 +870,7 @@ again: EQN_MSG(MANDOCERR_EQNSYNT, ep); return(-1); } - /* + /* * Accept a left-right-associative set of arguments just * like sub and sup and friends but without rebalancing * under a pivot. @@ -905,7 +904,7 @@ again: * FIXME: this is a shitty sentinel: we should really * have a native EQN_BRACE type or whatnot. */ - while (parent->type != EQN_LIST) + while (parent->type != EQN_LIST) if (NULL == (parent = parent->parent)) { EQN_MSG(MANDOCERR_EQNSYNT, ep); return(-1); @@ -926,20 +925,20 @@ again: } else if (STRNEQ(start, sz, "floor", 5)) { strlcpy(sym, "\\[rf]", sizeof(sym)); parent->right = mandoc_strdup(sym); - } else + } else parent->right = mandoc_strndup(start, sz); } if (NULL == (parent = parent->parent)) { EQN_MSG(MANDOCERR_EQNSYNT, ep); return(-1); } - if (EQN_TOK_BRACE_CLOSE == tok && parent && - (parent->type == EQN_PILE || - parent->type == EQN_MATRIX)) + if (EQN_TOK_BRACE_CLOSE == tok && parent && + (parent->type == EQN_PILE || + parent->type == EQN_MATRIX)) parent = parent->parent; /* Close out any "singleton" lists. */ - while (parent->type == EQN_LISTONE && - parent->args == parent->expectargs) + while (parent->type == EQN_LISTONE && + parent->args == parent->expectargs) if (NULL == (parent = parent->parent)) { EQN_MSG(MANDOCERR_EQNSYNT, ep); return(-1); @@ -971,7 +970,7 @@ again: } else if (STRNEQ(start, sz, "floor", 5)) { strlcpy(sym, "\\[lf]", sizeof(sym)); parent->left = mandoc_strdup(sym); - } else + } else parent->left = mandoc_strndup(start, sz); } break; @@ -997,7 +996,7 @@ again: parent->type = EQN_LIST; break; case (EQN_TOK_ABOVE): - while (parent->type != EQN_PILE) + while (parent->type != EQN_PILE) if (NULL == (parent = parent->parent)) { EQN_MSG(MANDOCERR_EQNSYNT, ep); return(-1); @@ -1022,7 +1021,7 @@ again: break; case (EQN_TOK_EOF): /* - * End of file! + * End of file! * TODO: make sure we're not in an open subexpression. */ return(0); @@ -1043,7 +1042,7 @@ again: cur->type = EQN_TEXT; for (i = 0; i < EQNSYM__MAX; i++) if (0 == strcmp(eqnsyms[i].str, p)) { - (void)snprintf(sym, sizeof(sym), + (void)snprintf(sym, sizeof(sym), "\\[%s]", eqnsyms[i].sym); cur->text = mandoc_strdup(sym); free(p); @@ -1055,7 +1054,7 @@ again: /* * Post-process list status. */ - while (parent->type == EQN_LISTONE && + while (parent->type == EQN_LISTONE && parent->args == parent->expectargs) if (NULL == (parent = parent->parent)) { EQN_MSG(MANDOCERR_EQNSYNT, ep); @@ -1067,7 +1066,7 @@ again: } enum rofferr -eqn_end(struct eqn_node **epp) +eqn_end(struct eqn_node **epp) { struct eqn_node *ep; diff --git a/eqn_html.c b/eqn_html.c index 73828684..3f3fe8f6 100644 --- a/eqn_html.c +++ b/eqn_html.c @@ -1,6 +1,6 @@ -/* $Id: eqn_html.c,v 1.8 2014/10/10 08:44:24 kristaps Exp $ */ +/* $Id: eqn_html.c,v 1.9 2014/10/10 14:27:46 schwarze Exp $ */ /* - * Copyright (c) 2011 Kristaps Dzonsons + * Copyright (c) 2011, 2014 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -54,7 +54,7 @@ eqn_box(struct html *p, const struct eqn_box *bp) /* Estimate the number of rows, first. */ if (NULL == (child = parent->first)) goto out; - for (rows = 0; NULL != child; rows++) + for (rows = 0; NULL != child; rows++) child = child->next; /* Print row-by-row. */ post = print_otag(p, TAG_MTABLE, 0, NULL); @@ -70,12 +70,12 @@ eqn_box(struct html *p, const struct eqn_box *bp) } cell = print_otag (p, TAG_MTD, 0, NULL); - /* + /* * If we have no data for this * particular cell, then print a * placeholder and continue--don't puke. */ - if (NULL != child) + if (NULL != child) eqn_box(p, child->first); print_tagq(p, cell); parent = parent->next; @@ -137,14 +137,14 @@ eqn_box(struct html *p, const struct eqn_box *bp) assert(NULL == post); post = print_otag(p, TAG_MI, 0, NULL); print_text(p, bp->text); - } else if (NULL == post) { + } else if (NULL == post) { if (NULL != bp->left || NULL != bp->right) { PAIR_INIT(&tag[0], ATTR_OPEN, - NULL == bp->left ? "" : bp->left); + NULL == bp->left ? "" : bp->left); PAIR_INIT(&tag[1], ATTR_CLOSE, - NULL == bp->right ? "" : bp->right); + NULL == bp->right ? "" : bp->right); post = print_otag(p, TAG_MFENCED, 2, tag); - } + } if (NULL == post) post = print_otag(p, TAG_MROW, 0, NULL); else @@ -158,7 +158,7 @@ out: t = print_otag(p, TAG_MO, 0, NULL); print_text(p, bp->bottom); print_tagq(p, t); - } + } if (NULL != bp->top) { t = print_otag(p, TAG_MO, 0, NULL); print_text(p, bp->top); -- cgit v1.2.3-56-ge451