diff --git a/pdbApp/pdb.cpp b/pdbApp/pdb.cpp index 7956438..7b04cfd 100644 --- a/pdbApp/pdb.cpp +++ b/pdbApp/pdb.cpp @@ -274,28 +274,34 @@ struct PDBProcessor */ for(pdbRecordIterator rec; !rec.done(); rec.next()) { - try { - const char *value; - recbase = rec.record()->name; - recbase += "."; - value = rec.info("pdbGroup"); - if(value) { - setupGroup(&value); - addMappings(value); + bool firsttag = true; + for(pdbInfoIterator info(rec); !info.done(); info.next()) { + if(firsttag) { + recbase = rec.record()->name; + recbase += "."; + firsttag = false; } - value = rec.info("pdbTrigger"); - if(value) { - setupGroup(&value); - addTriggers(value); + + const char *value = info.value(); + const char *tagname = info.name(); + + try { + if(strncmp(tagname, "pdbGroup", 8)==0) { + setupGroup(&value); + addMappings(value); + + } else if(strncmp(tagname, "pdbTrigger", 10)==0) { + setupGroup(&value); + addTriggers(value); + + } else if(strncmp(tagname, "pdbAtomic", 9)==0) { + setupGroup(&value); + setAtomic(value); + } + }catch(std::exception& e){ + fprintf(stderr, "Error processing PDB info(%s, \"%s\") for record \"%s\": %s\n", + tagname, value, rec.record()->name, e.what()); } - value = rec.info("pdbAtomic"); - if(value) { - setupGroup(&value); - setAtomic(value); - } - }catch(std::exception& e){ - fprintf(stderr, "Error processing PDB info() for record \"%s\": %s\n", - rec.record()->name, e.what()); } } resolveTriggers(); diff --git a/pdbApp/pvif.h b/pdbApp/pvif.h index 95be9a5..4fbebe0 100644 --- a/pdbApp/pvif.h +++ b/pdbApp/pvif.h @@ -119,6 +119,27 @@ struct pdbRecordIterator { } }; +struct pdbInfoIterator { + DBENTRY ent; + bool m_done; + pdbInfoIterator(const pdbRecordIterator& I) + { + dbCopyEntryContents(&const_cast(I).ent, &ent); + m_done = dbFirstInfo(&ent)!=0; + } + ~pdbInfoIterator() + { + dbFinishEntry(&ent); + } + bool done() const { return m_done; } + bool next() { + m_done = dbNextInfo(&ent)!=0; + return m_done; + } + const char *name() { return dbGetInfoName(&ent); } + const char *value() { return dbGetInfoString(&ent); } +}; + struct DBEvent { dbEventSubscription subscript;