From: cuz Date: Tue, 11 Nov 2003 13:58:00 +0000 (+0000) Subject: Allow dumping of symbol expressions X-Git-Tag: V2.12.0~1161 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e87bec47d7ada147eddce6031f7eac86d94f1f64;p=cc65 Allow dumping of symbol expressions git-svn-id: svn://svn.cc65.org/cc65/trunk@2639 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/common/exprdefs.c b/src/common/exprdefs.c index 754c45c76..48258be49 100644 --- a/src/common/exprdefs.c +++ b/src/common/exprdefs.c @@ -46,14 +46,14 @@ -static void InternalDumpExpr (const ExprNode* Expr) +static void InternalDumpExpr (const ExprNode* Expr, const ExprNode* (*ResolveSym) (const struct SymEntry*)) /* Dump an expression in RPN to stdout */ { if (Expr == 0) { return; } - InternalDumpExpr (Expr->Left); - InternalDumpExpr (Expr->Right); + InternalDumpExpr (Expr->Left, ResolveSym); + InternalDumpExpr (Expr->Right, ResolveSym); switch (Expr->Op) { @@ -63,7 +63,13 @@ static void InternalDumpExpr (const ExprNode* Expr) break; case EXPR_SYMBOL: - printf (" SYM"); + if (ResolveSym && (Expr = ResolveSym (Expr->V.Sym)) != 0) { + printf (" SYM ("); + InternalDumpExpr (Expr, ResolveSym); + printf (") "); + } else { + printf ("SYM "); + } break; case EXPR_SECTION: @@ -206,10 +212,10 @@ static void InternalDumpExpr (const ExprNode* Expr) -void DumpExpr (const ExprNode* Expr) +void DumpExpr (const ExprNode* Expr, const ExprNode* (*ResolveSym) (const struct SymEntry*)) /* Dump an expression tree to stdout */ { - InternalDumpExpr (Expr); + InternalDumpExpr (Expr, ResolveSym); printf ("\n"); } diff --git a/src/common/exprdefs.h b/src/common/exprdefs.h index 1e911a874..8f9bc56f2 100644 --- a/src/common/exprdefs.h +++ b/src/common/exprdefs.h @@ -132,7 +132,7 @@ struct ExprNode { -void DumpExpr (const ExprNode* Expr); +void DumpExpr (const ExprNode* Expr, const ExprNode* (*ResolveSym) (const struct SymEntry*)); /* Dump an expression tree to stdout */