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

Annotation of docbook2mdoc/tree.c, Revision 1.1

1.1     ! schwarze    1: /* $Id$ */
        !             2: /*
        !             3:  * Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
        !             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 AUTHORS DISCLAIM ALL WARRANTIES
        !            10:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
        !            11:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS 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: #include <stdio.h>
        !            18:
        !            19: #include "node.h"
        !            20: #include "format.h"
        !            21:
        !            22: /*
        !            23:  * The implementation of the parse tree dumper.
        !            24:  */
        !            25:
        !            26: void
        !            27: print_node(struct pnode *n, int indent)
        !            28: {
        !            29:        struct pnode    *nc;
        !            30:        struct pattr    *a;
        !            31:
        !            32:        printf("%*s%c%s", indent, "", n->spc ? ' ' : '-',
        !            33:            pnode_name(n->node));
        !            34:        if (pnode_class(n->node) == CLASS_TEXT) {
        !            35:                putchar(' ');
        !            36:                fputs(n->b, stdout);
        !            37:        }
        !            38:        TAILQ_FOREACH(a, &n->attrq, child)
        !            39:                printf(" %s='%s'", attrkey_name(a->key), attr_getval(a));
        !            40:        putchar('\n');
        !            41:        TAILQ_FOREACH(nc, &n->childq, child)
        !            42:                print_node(nc, indent + 2);
        !            43: }
        !            44:
        !            45: void
        !            46: ptree_print_tree(struct ptree *tree)
        !            47: {
        !            48:        print_node(tree->root, 0);
        !            49: }

CVSweb