[BACK]Return to eqn_term.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Annotation of mandoc/eqn_term.c, Revision 1.1

1.1     ! kristaps    1: /*     $Id: tbl_term.c,v 1.19 2011/01/25 12:07:30 schwarze Exp $ */
        !             2: /*
        !             3:  * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
        !             4:  *
        !             5:  * Permission to use, copy, modify, and distribute this software for any
        !             6:  * purpose with or without fee is hereby granted, provided that the above
        !             7:  * copyright notice and this permission notice appear in all copies.
        !             8:  *
        !             9:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
        !            10:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
        !            11:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
        !            12:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
        !            13:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
        !            14:  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
        !            15:  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
        !            16:  */
        !            17: #ifdef HAVE_CONFIG_H
        !            18: #include "config.h"
        !            19: #endif
        !            20:
        !            21: #include <assert.h>
        !            22: #include <stdio.h>
        !            23: #include <stdlib.h>
        !            24: #include <string.h>
        !            25:
        !            26: #include "mandoc.h"
        !            27: #include "out.h"
        !            28: #include "term.h"
        !            29:
        !            30: static void    eqn_box(struct termp *p, const struct eqn_box *);
        !            31: static void    eqn_box_post(struct termp *p, const struct eqn_box *);
        !            32: static void    eqn_box_pre(struct termp *p, const struct eqn_box *);
        !            33: static void    eqn_text(struct termp *p, const struct eqn_box *);
        !            34:
        !            35: void
        !            36: term_eqn(struct termp *p, const struct eqn *ep)
        !            37: {
        !            38:
        !            39:        p->flags |= TERMP_NONOSPACE;
        !            40:        eqn_box(p, ep->root);
        !            41:        p->flags &= ~TERMP_NONOSPACE;
        !            42: }
        !            43:
        !            44: static void
        !            45: eqn_box(struct termp *p, const struct eqn_box *bp)
        !            46: {
        !            47:
        !            48:        eqn_box_pre(p, bp);
        !            49:        eqn_text(p, bp);
        !            50:
        !            51:        if (bp->first)
        !            52:                eqn_box(p, bp->first);
        !            53:
        !            54:        eqn_box_post(p, bp);
        !            55:
        !            56:        if (bp->next)
        !            57:                eqn_box(p, bp->next);
        !            58: }
        !            59:
        !            60: static void
        !            61: eqn_box_pre(struct termp *p, const struct eqn_box *bp)
        !            62: {
        !            63:
        !            64:        if (EQN_LIST == bp->type)
        !            65:                term_word(p, "{");
        !            66:        if (bp->left)
        !            67:                term_word(p, bp->left);
        !            68: }
        !            69:
        !            70: static void
        !            71: eqn_box_post(struct termp *p, const struct eqn_box *bp)
        !            72: {
        !            73:
        !            74:        if (EQN_LIST == bp->type)
        !            75:                term_word(p, "}");
        !            76:        if (bp->right)
        !            77:                term_word(p, bp->right);
        !            78:        if (bp->above)
        !            79:                term_word(p, "|");
        !            80: }
        !            81:
        !            82: static void
        !            83: eqn_text(struct termp *p, const struct eqn_box *bp)
        !            84: {
        !            85:
        !            86:        if (bp->text)
        !            87:                term_word(p, bp->text);
        !            88: }

CVSweb