// // printObject // void wb_print_wbl::printObject(wb_volume& v, wb_object& o, bool recursive) { wb_object to = o; wb_object templ; cdh_uObjid uid; unsigned int idx; wb_cdef cdef = v.cdef(o); if ( !cdef) { m_os << "! %WBDUMP-E-Error Failed to get object class" << endl; m_errCnt++; // return; cdef = v.cdef( pwr_eClass_ClassLost); } const char* cname = cdef.name(); char *block; int size; if ( o.docBlock( &block, &size) && strcmp( block, "") != 0) { indent(0) << "!/**" << endl; indent(0) << "! "; for ( char *s = block; *s; s++) { if ( *s == '\n') { m_os << *s; indent(0) << "! "; continue; } m_os << *s; } m_os << endl; indent(0) << "!*/" << endl; } indent(1) << "Object " << o.name() << " " << cname; if (m_idxFlag) { switch (cdef.cid()) { case pwr_eClass_ClassDef: uid.pwr = o.oid(); idx = uid.c.cix; break; case pwr_eClass_TypeDef: uid.pwr = o.oid(); idx = uid.t.tix; break; case pwr_eClass_ObjBodyDef: uid.pwr = o.oid(); idx = uid.c.bix; break; case pwr_eClass_Param: case pwr_eClass_Input: case pwr_eClass_Output: case pwr_eClass_Intern: case pwr_eClass_Buffer: case pwr_eClass_ObjXRef: uid.pwr = o.oid(); idx = uid.c.aix; break; default: idx = (unsigned long) o.oix(); } m_os << " " << idx; } if ( m_timeFlag) { // Get oh time char timestr[40]; pwr_tTime ohtime = o.ohTime(); time_AtoAscii( &ohtime, time_eFormat_DateAndTime, timestr, sizeof(timestr)); m_os << " " << timestr; } m_os << endl; wb_object co = v.object(cdh_ClassIdToObjid(cdef.cid())); wb_name t("Template"); templ = co.child(t); if (!templ) { m_errCnt++; m_os << "Template not found for class " << cdef.name() << endl; return; } if ( v.cid() == pwr_eClass_ClassVolume && strcmp( o.name(), "Template") == 0) m_isTemplateObject = true; else m_isTemplateObject = false; printBody(v, o, templ, cdef, pwr_eBix_rt); printBody(v, o, templ, cdef, pwr_eBix_dev); if (recursive) { if ( !(m_noFoCodeFlag && isFoCodeObject( v, o))) { for (to = o.first(); to; to = to.after()) printObject(v, to); } } indent(-1) << "EndObject" << endl; }
// // printBody // void wb_print_wbl::printBody(wb_volume& v, wb_object& o, wb_object& templ, wb_cdef& cdef, pwr_eBix bix) { wb_adef adef; wb_attribute attr; wb_attribute tattr; const char* bname; char timestr[40] = " "; int force = 0; wb_bdef bdef = cdef.bdef(bix); if (!bdef) return; bname = bdef.name(); wb_bdef tbdef = templ.bdef(bix); if (!tbdef) { m_errCnt++; m_os << "Couldn't find template body def for object " << o.name() << endl; return; } if ( m_timeFlag) { // Get body time pwr_tTime btime; switch ( bix) { case pwr_eBix_rt: btime = o.rbTime(); // Bugcheck in 4.2 btime can be corrupt if ( btime.tv_nsec < 0 || btime.tv_nsec >= 1000000000) break; strcpy( timestr, " "); time_AtoAscii( &btime, time_eFormat_DateAndTime, ×tr[1], sizeof(timestr)-1); break; case pwr_eBix_dev: btime = o.dbTime(); strcpy( timestr, " "); time_AtoAscii( &btime, time_eFormat_DateAndTime, ×tr[1], sizeof(timestr)-1); break; default: ; } } indent(1) << "Body " << bdef.name() << timestr << endl; for (adef = bdef.adef(); adef; adef = adef.next()) { if ( cdef.cid() == pwr_eClass_Param && strcmp( adef.name(), "Size") == 0) { // Print Size for Pointers that is not private wb_attribute flags_attr = o.attribute(bname, "Flags"); pwr_tMask *flagsp = (pwr_tMask *)flags_attr.value(); if (*flagsp & PWR_MASK_POINTER && !(*flagsp & PWR_MASK_PRIVATE)) force = 1; } attr = o.attribute(bname, adef.name()); tattr = templ.attribute(bname, adef.name()); // if (tattr == attr) // continue; printAttribute(v, attr, tattr, adef, force); } indent(-1) << "EndBody" << endl; return; }