From e38d2351b83fa65c66ccde443777647ef5cb6cff Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 1 Mar 2010 19:17:32 +0000 Subject: Added KDE3 version of Tellico git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1097620 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/translators/btparse/bibtex_ast.c | 63 ++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/translators/btparse/bibtex_ast.c (limited to 'src/translators/btparse/bibtex_ast.c') diff --git a/src/translators/btparse/bibtex_ast.c b/src/translators/btparse/bibtex_ast.c new file mode 100644 index 0000000..354cefb --- /dev/null +++ b/src/translators/btparse/bibtex_ast.c @@ -0,0 +1,63 @@ +/* ------------------------------------------------------------------------ +@NAME : bibtex_ast.c +@DESCRIPTION: Data and functions for internal display/manipulation of AST + nodes. (Stuff for external consumption, and for processing + whole trees, is to be found in traversal.c.) +@GLOBALS : +@CREATED : 1997/08/12, Greg Ward +@MODIFIED : +@VERSION : $Id: bibtex_ast.c,v 1.6 1999/11/29 01:13:10 greg Rel $ +@COPYRIGHT : Copyright (c) 1996-99 by Gregory P. Ward. All rights reserved. + + This file is part of the btparse library. This library is + free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. +-------------------------------------------------------------------------- */ + +/*#include "bt_config.h"*/ +#include "btparse.h" +#include "prototypes.h" +/*#include "my_dmalloc.h"*/ + + +const char *nodetype_names[] = +{ + "bogus", "entry", "key", "field", "string", "number", "macro" +}; + + +static void dump (AST *root, int depth) +{ + AST *cur; + + if (root == NULL) + { + printf ("[empty]\n"); + return; + } + + cur = root; + while (cur != NULL) + { + printf ("%*s[%s]: ", 2*depth, "", nodetype_names[cur->nodetype]); + if (cur->text != NULL) + printf ("(%s)\n", cur->text); + else + printf ("(null)\n"); + + if (cur->down != NULL) + dump (cur->down, depth+1); + cur = cur->right; + } +} + + +void dump_ast (char *msg, AST *root) +{ + if (msg != NULL) + printf (msg); + dump (root, 0); + printf ("\n"); +} -- cgit v1.2.1