Skip to content

Commit 100c80e

Browse files
committed
Making tag information better available
Making the tag info available by means of a debug switch. (also to overcome some problems due to change in structures)
1 parent 1dcf3e2 commit 100c80e

File tree

3 files changed

+87
-77
lines changed

3 files changed

+87
-77
lines changed

src/debug.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ static std::map< std::string, Debug::DebugMask > s_labels =
4848
{ "cite", Debug::Cite },
4949
{ "rtf", Debug::Rtf },
5050
{ "qhp", Debug::Qhp },
51+
{ "tag", Debug::Tag },
5152
};
5253

5354
//------------------------------------------------------------------------
@@ -66,6 +67,14 @@ void Debug::print(DebugMask mask,int prio,const char *fmt,...)
6667
}
6768
}
6869

70+
void Debug::print(const char *fmt,...)
71+
{
72+
va_list args;
73+
va_start(args,fmt);
74+
vfprintf(stdout, fmt, args);
75+
va_end(args);
76+
}
77+
6978
static char asciiToLower(char in) {
7079
if (in <= 'Z' && in >= 'A')
7180
return in - ('Z' - 'z');

src/debug.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ class Debug
4343
NoLineNo = 0x00020000,
4444
Rtf = 0x00040000,
4545
Qhp = 0x00080000,
46+
Tag = 0x00100000,
4647
};
4748
static void print(DebugMask mask,int prio,const char *fmt,...);
49+
static void Debug::print(const char *fmt,...);
4850

4951
static int setFlag(const QCString &label);
5052
static void clearFlag(const QCString &label);

src/tagreader.cpp

Lines changed: 76 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
#include "containers.h"
4242
#include "debug.h"
4343

44-
// set to 1 for debugging
45-
#define DUMP_OUTPUT 0
46-
4744
// ----------------- private part -----------------------------------------------
4845

4946
namespace {
@@ -296,6 +293,10 @@ class TagCompoundVariant
296293
}
297294
return 0;
298295
}
296+
Type type()
297+
{
298+
return(static_cast<Type>(m_variant.index()));
299+
}
299300

300301
private:
301302
VariantT m_variant;
@@ -1110,179 +1111,179 @@ void TagFileParser::startCompound( const XMLHandlers::Attributes& attrib )
11101111
}
11111112
}
11121113

1113-
#if DUMP_OUTPUT
11141114
/*! Dumps the internal structures. For debugging only! */
11151115
void TagFileParser::dump()
11161116
{
1117-
msg("Result:\n");
1117+
if (!Debug::isFlagSet(Debug::Tag)) return;
1118+
1119+
Debug::print("Result:\n");
11181120
//============== CLASSES
1119-
for (const auto &comp : m_tagFileCompounds)
1121+
for (auto &comp : m_tagFileCompounds)
11201122
{
1121-
if (comp->compoundType()==TagCompoundInfo::CompoundType::Class)
1123+
if (comp.type()==TagCompoundVariant::Type::Class)
11221124
{
1123-
const TagClassInfo *cd = TagClassInfo::get(comp);
1124-
msg("class '%s'\n",qPrint(cd->name));
1125-
msg(" filename '%s'\n",qPrint(cd->filename));
1125+
const TagClassInfo *cd = comp.getClassInfo();
1126+
Debug::print("class '%s'\n",qPrint(cd->name));
1127+
Debug::print(" filename '%s'\n",qPrint(cd->filename));
11261128
for (const BaseInfo &bi : cd->bases)
11271129
{
1128-
msg( " base: %s \n", bi.name.isEmpty() ? "" : qPrint(bi.name) );
1130+
Debug::print( " base: %s \n", bi.name.isEmpty() ? "" : qPrint(bi.name) );
11291131
}
11301132

11311133
for (const auto &md : cd->members)
11321134
{
1133-
msg(" member:\n");
1134-
msg(" kind: '%s'\n",qPrint(md.kind));
1135-
msg(" name: '%s'\n",qPrint(md.name));
1136-
msg(" anchor: '%s'\n",qPrint(md.anchor));
1137-
msg(" arglist: '%s'\n",qPrint(md.arglist));
1135+
Debug::print(" member:\n");
1136+
Debug::print(" kind: '%s'\n",qPrint(md.kind));
1137+
Debug::print(" name: '%s'\n",qPrint(md.name));
1138+
Debug::print(" anchor: '%s'\n",qPrint(md.anchor));
1139+
Debug::print(" arglist: '%s'\n",qPrint(md.arglist));
11381140
}
11391141
}
11401142
}
11411143
//============== CONCEPTS
1142-
for (const auto &comp : m_tagFileCompounds)
1144+
for (auto &comp : m_tagFileCompounds)
11431145
{
1144-
if (comp->compoundType()==TagCompoundInfo::CompoundType::Concept)
1146+
if (comp.type()==TagCompoundVariant::Type::Concept)
11451147
{
1146-
const TagConceptInfo *cd = TagConceptInfo::get(comp);
1148+
const TagConceptInfo *cd = comp.getConceptInfo();
11471149

1148-
msg("concept '%s'\n",qPrint(cd->name));
1149-
msg(" filename '%s'\n",qPrint(cd->filename));
1150+
Debug::print("concept '%s'\n",qPrint(cd->name));
1151+
Debug::print(" filename '%s'\n",qPrint(cd->filename));
11501152
}
11511153
}
11521154
//============== NAMESPACES
1153-
for (const auto &comp : m_tagFileCompounds)
1155+
for (auto &comp : m_tagFileCompounds)
11541156
{
1155-
if (comp->compoundType()==TagCompoundInfo::CompoundType::Namespace)
1157+
if (comp.type()==TagCompoundVariant::Type::Namespace)
11561158
{
1157-
const TagNamespaceInfo *nd = TagNamespaceInfo::get(comp);
1159+
const TagNamespaceInfo *nd = comp.getNamespaceInfo();
11581160

1159-
msg("namespace '%s'\n",qPrint(nd->name));
1160-
msg(" filename '%s'\n",qPrint(nd->filename));
1161+
Debug::print("namespace '%s'\n",qPrint(nd->name));
1162+
Debug::print(" filename '%s'\n",qPrint(nd->filename));
11611163
for (const auto &cls : nd->classList)
11621164
{
1163-
msg( " class: %s \n", cls.c_str() );
1165+
Debug::print( " class: %s \n", cls.c_str() );
11641166
}
11651167

11661168
for (const auto &md : nd->members)
11671169
{
1168-
msg(" member:\n");
1169-
msg(" kind: '%s'\n",qPrint(md.kind));
1170-
msg(" name: '%s'\n",qPrint(md.name));
1171-
msg(" anchor: '%s'\n",qPrint(md.anchor));
1172-
msg(" arglist: '%s'\n",qPrint(md.arglist));
1170+
Debug::print(" member:\n");
1171+
Debug::print(" kind: '%s'\n",qPrint(md.kind));
1172+
Debug::print(" name: '%s'\n",qPrint(md.name));
1173+
Debug::print(" anchor: '%s'\n",qPrint(md.anchor));
1174+
Debug::print(" arglist: '%s'\n",qPrint(md.arglist));
11731175
}
11741176
}
11751177
}
11761178

11771179
//============== FILES
1178-
for (const auto &comp : m_tagFileCompounds)
1180+
for (auto &comp : m_tagFileCompounds)
11791181
{
1180-
if (comp->compoundType()==TagCompoundInfo::CompoundType::File)
1182+
if (comp.type()==TagCompoundVariant::Type::File)
11811183
{
1182-
const TagFileInfo *fd = TagFileInfo::get(comp);
1184+
const TagFileInfo *fd = comp.getFileInfo();
11831185

1184-
msg("file '%s'\n",qPrint(fd->name));
1185-
msg(" filename '%s'\n",qPrint(fd->filename));
1186+
Debug::print("file '%s'\n",qPrint(fd->name));
1187+
Debug::print(" filename '%s'\n",qPrint(fd->filename));
11861188
for (const auto &ns : fd->namespaceList)
11871189
{
1188-
msg( " namespace: %s \n", ns.c_str() );
1190+
Debug::print( " namespace: %s \n", ns.c_str() );
11891191
}
11901192
for (const auto &cs : fd->classList)
11911193
{
1192-
msg( " class: %s \n", cs.c_str() );
1194+
Debug::print( " class: %s \n", cs.c_str() );
11931195
}
11941196

11951197
for (const auto &md : fd->members)
11961198
{
1197-
msg(" member:\n");
1198-
msg(" kind: '%s'\n",qPrint(md.kind));
1199-
msg(" name: '%s'\n",qPrint(md.name));
1200-
msg(" anchor: '%s'\n",qPrint(md.anchor));
1201-
msg(" arglist: '%s'\n",qPrint(md.arglist));
1199+
Debug::print(" member:\n");
1200+
Debug::print(" kind: '%s'\n",qPrint(md.kind));
1201+
Debug::print(" name: '%s'\n",qPrint(md.name));
1202+
Debug::print(" anchor: '%s'\n",qPrint(md.anchor));
1203+
Debug::print(" arglist: '%s'\n",qPrint(md.arglist));
12021204
}
12031205

12041206
for (const auto &ii : fd->includes)
12051207
{
1206-
msg(" includes id: %s name: %s\n",qPrint(ii.id),qPrint(ii.name));
1208+
Debug::print(" includes id: %s name: %s\n",qPrint(ii.id),qPrint(ii.name));
12071209
}
12081210
}
12091211
}
12101212

12111213
//============== GROUPS
1212-
for (const auto &comp : m_tagFileCompounds)
1214+
for (auto &comp : m_tagFileCompounds)
12131215
{
1214-
if (comp->compoundType()==TagCompoundInfo::CompoundType::Group)
1216+
if (comp.type()==TagCompoundVariant::Type::Group)
12151217
{
1216-
const TagGroupInfo *gd = TagGroupInfo::get(comp);
1217-
msg("group '%s'\n",qPrint(gd->name));
1218-
msg(" filename '%s'\n",qPrint(gd->filename));
1218+
const TagGroupInfo *gd = comp.getGroupInfo();
1219+
Debug::print("group '%s'\n",qPrint(gd->name));
1220+
Debug::print(" filename '%s'\n",qPrint(gd->filename));
12191221

12201222
for (const auto &ns : gd->namespaceList)
12211223
{
1222-
msg( " namespace: %s \n", ns.c_str() );
1224+
Debug::print( " namespace: %s \n", ns.c_str() );
12231225
}
12241226
for (const auto &cs : gd->classList)
12251227
{
1226-
msg( " class: %s \n", cs.c_str() );
1228+
Debug::print( " class: %s \n", cs.c_str() );
12271229
}
12281230
for (const auto &fi : gd->fileList)
12291231
{
1230-
msg( " file: %s \n", fi.c_str() );
1232+
Debug::print( " file: %s \n", fi.c_str() );
12311233
}
12321234
for (const auto &sg : gd->subgroupList)
12331235
{
1234-
msg( " subgroup: %s \n", sg.c_str() );
1236+
Debug::print( " subgroup: %s \n", sg.c_str() );
12351237
}
12361238
for (const auto &pg : gd->pageList)
12371239
{
1238-
msg( " page: %s \n", pg.c_str() );
1240+
Debug::print( " page: %s \n", pg.c_str() );
12391241
}
12401242

12411243
for (const auto &md : gd->members)
12421244
{
1243-
msg(" member:\n");
1244-
msg(" kind: '%s'\n",qPrint(md.kind));
1245-
msg(" name: '%s'\n",qPrint(md.name));
1246-
msg(" anchor: '%s'\n",qPrint(md.anchor));
1247-
msg(" arglist: '%s'\n",qPrint(md.arglist));
1245+
Debug::print(" member:\n");
1246+
Debug::print(" kind: '%s'\n",qPrint(md.kind));
1247+
Debug::print(" name: '%s'\n",qPrint(md.name));
1248+
Debug::print(" anchor: '%s'\n",qPrint(md.anchor));
1249+
Debug::print(" arglist: '%s'\n",qPrint(md.arglist));
12481250
}
12491251
}
12501252
}
12511253

12521254
//============== PAGES
1253-
for (const auto &comp : m_tagFileCompounds)
1255+
for (auto &comp : m_tagFileCompounds)
12541256
{
1255-
if (comp->compoundType()==TagCompoundInfo::CompoundType::Page)
1257+
if (comp.type()==TagCompoundVariant::Type::Page)
12561258
{
1257-
const TagPageInfo *pd = TagPageInfo::get(comp);
1258-
msg("page '%s'\n",qPrint(pd->name));
1259-
msg(" title '%s'\n",qPrint(pd->title));
1260-
msg(" filename '%s'\n",qPrint(pd->filename));
1259+
const TagPageInfo *pd = comp.getPageInfo();
1260+
Debug::print("page '%s'\n",qPrint(pd->name));
1261+
Debug::print(" title '%s'\n",qPrint(pd->title));
1262+
Debug::print(" filename '%s'\n",qPrint(pd->filename));
12611263
}
12621264
}
12631265

12641266
//============== DIRS
1265-
for (const auto &comp : m_tagFileCompounds)
1267+
for (auto &comp : m_tagFileCompounds)
12661268
{
1267-
if (comp->compoundType()==TagCompoundInfo::CompoundType::Dir)
1269+
if (comp.type()==TagCompoundVariant::Type::Dir)
12681270
{
1269-
const TagDirInfo *dd = TagDirInfo::get(comp);
1271+
const TagDirInfo *dd = comp.getDirInfo();
12701272
{
1271-
msg("dir '%s'\n",qPrint(dd->name));
1272-
msg(" path '%s'\n",qPrint(dd->path));
1273+
Debug::print("dir '%s'\n",qPrint(dd->name));
1274+
Debug::print(" path '%s'\n",qPrint(dd->path));
12731275
for (const auto &fi : dd->fileList)
12741276
{
1275-
msg( " file: %s \n", fi.c_str() );
1277+
Debug::print( " file: %s \n", fi.c_str() );
12761278
}
12771279
for (const auto &sd : dd->subdirList)
12781280
{
1279-
msg( " subdir: %s \n", sd.c_str() );
1281+
Debug::print( " subdir: %s \n", sd.c_str() );
12801282
}
12811283
}
12821284
}
12831285
}
12841286
}
1285-
#endif
12861287

12871288
void TagFileParser::addDocAnchors(const std::shared_ptr<Entry> &e,const std::vector<TagAnchorInfo> &l)
12881289
{
@@ -1703,7 +1704,5 @@ void parseTagFile(const std::shared_ptr<Entry> &root,const char *fullName)
17031704
parser.parse(fullName,inputStr.data(),Debug::isFlagSet(Debug::Lex));
17041705
tagFileParser.buildLists(root);
17051706
tagFileParser.addIncludes();
1706-
#if DUMP_OUTPUT
1707-
tagFileParser.dump();
1708-
#endif
1707+
if (Debug::isFlagSet(Debug::Tag)) tagFileParser.dump();
17091708
}

0 commit comments

Comments
 (0)