From 8ec6f66bf07c6f0a86465cee3d02de68ca7fc8e0 Mon Sep 17 00:00:00 2001 From: uz Date: Sun, 31 Jul 2011 14:01:27 +0000 Subject: [PATCH] Output the scope type in readable format. git-svn-id: svn://svn.cc65.org/cc65/trunk@5096 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/od65/dump.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/od65/dump.c b/src/od65/dump.c index e08818cb8..1ce183474 100644 --- a/src/od65/dump.c +++ b/src/od65/dump.c @@ -45,6 +45,7 @@ #include "lidefs.h" #include "objdefs.h" #include "optdefs.h" +#include "scopedefs.h" #include "segdefs.h" #include "symdefs.h" #include "xmalloc.h" @@ -233,6 +234,23 @@ static const char* GetExportFlags (unsigned Flags, const unsigned char* ConDes) +static const char* GetScopeType (unsigned Type) +/* Return the name of a scope type */ +{ + switch (Type) { + case SCOPETYPE_GLOBAL: return "Global scope"; + case SCOPETYPE_FILE: return "File scope"; + case SCOPETYPE_PROC: return ".PROC"; + case SCOPETYPE_SCOPE: return ".SCOPE"; + case SCOPETYPE_STRUCT: return ".STRUCT"; + case SCOPETYPE_ENUM: return ".ENUM"; + case SCOPETYPE_UNDEF: return "Undefined"; + default: return "Unknown scope type"; + } +} + + + void DumpObjHeader (FILE* F, unsigned long Offset) /* Dump the header of the given object file */ { @@ -806,12 +824,12 @@ void DumpObjScopes (FILE* F, unsigned long Offset) /* Print the header */ printf (" Index:%27u\n", I); - /* Print the data */ + /* Print the data */ printf (" Id:%28lu\n", ReadVar (F)); printf (" Parent id:%21lu\n", ReadVar (F)); printf (" Lexical level:%17lu\n", ReadVar (F)); printf (" Flags:%25lu\n", ReadVar (F)); - printf (" Type:%26lu\n", ReadVar (F)); + printf (" Type:%26s\n", GetScopeType (ReadVar (F))); /* Resolve and print the name */ Name = GetString (&StrPool, ReadVar (F)); -- 2.39.5