void GFF3Dumper::dump(Common::WriteStream &output, Common::SeekableReadStream *input, Common::Encoding UNUSED(encoding), bool allowNWNPremium) { try { _gff3 = new Aurora::GFF3File(input, 0xFFFFFFFF, allowNWNPremium); _xml = new XMLWriter(output); _xml->openTag("gff3"); _xml->addProperty("type", Common::tagToString(_gff3->getType(), true)); _xml->breakLine(); dumpStruct(_gff3->getTopLevel()); _xml->closeTag(); _xml->breakLine(); _xml->flush(); } catch (...) { clear(); throw; } clear(); }
void GFF3Dumper::dumpList(const Aurora::GFF3List &list) { if (!list.empty()) _xml->breakLine(); for (Aurora::GFF3List::const_iterator e = list.begin(); e != list.end(); ++e) dumpStruct(**e); }
void makeOil(astree* root){ dumpStruct(root); dumpStrincons(); dumpGlobalVars(root); dumpFunction(root); fprintf(file_oil, "void __ocmain (void)\n{\n"); dumpExpressions(root, 0); fprintf(file_oil, "}"); }
static void dumpBase( // DUMP BASE BASE_CLASS* base, // - base information DUMP_INFO* di, // - dump information char* title ) // - title { di->offset += base->delta; di = dumpStruct( base->type, di, title, DS_BASE ); di->offset -= base->delta; }
int main(int argc, char const *argv[]) { struct employee emp={"john"};//structs are initialized with single name parameter here emp.salary = 10000; //initializing the another member of the structure here struct employee kiran={ "kiran", 20000, "Ananthapur", "Naik Nagar" }; printf("%s",emp.name); dumpStruct(kiran); // printf("%s has salary %i and he lives in %s,%s\n",); return 0; }
void DumpObjectModelClass( // DUMP OBJECT MODEL: CLASS TYPE type ) // - structure type { DUMP_INFO di; // - dump information if( ! type->u.c.info->corrupted ) { CompFlags.log_note_msgs = TRUE; di.original = type; di.offset = 0; VbufInit( &di.buffer ); VstkOpen( &di.stack, sizeof( char* ), 16 ); dumpStruct( type, &di, "Object Model for:", DS_NULL ); VbufFree( &di.buffer ); VstkClose( &di.stack ); CompFlags.log_note_msgs = FALSE; } }
void Type_DumpType(const Type *tp, int descend) { switch (tp->tpTopType) { case T_STRUCT: if (descend) dumpStruct(tp, descend); else printf("%s", tp->tpName->idenSpelling); break; case T_PTR: printf("ptr to "); Type_DumpType(tp->t.p.tpPtrType, 0); break; default: printf("%s", topTypeNames[tp->tpTopType]); break; } }
void GFF3Dumper::dumpField(const Aurora::GFF3Struct &strct, const Common::UString &field) { Aurora::GFF3Struct::FieldType type = strct.getType(field); Common::UString typeName; if (((size_t) type) < ARRAYSIZE(kGFF3FieldTypeNames)) typeName = kGFF3FieldTypeNames[(int)type]; else typeName = "filetype" + Common::composeString((uint64) type); Common::UString label = field; // Structs already open their own tag if (type != Aurora::GFF3Struct::kFieldTypeStruct) { _xml->openTag(typeName); _xml->addProperty("label", label); } switch (type) { case Aurora::GFF3Struct::kFieldTypeChar: _xml->setContents(Common::composeString(strct.getUint(field))); break; case Aurora::GFF3Struct::kFieldTypeByte: case Aurora::GFF3Struct::kFieldTypeUint16: case Aurora::GFF3Struct::kFieldTypeUint32: case Aurora::GFF3Struct::kFieldTypeUint64: _xml->setContents(Common::composeString(strct.getUint(field))); break; case Aurora::GFF3Struct::kFieldTypeSint16: case Aurora::GFF3Struct::kFieldTypeSint32: case Aurora::GFF3Struct::kFieldTypeSint64: _xml->setContents(Common::composeString(strct.getSint(field))); break; case Aurora::GFF3Struct::kFieldTypeFloat: case Aurora::GFF3Struct::kFieldTypeDouble: _xml->setContents(Common::UString::format("%.6f", strct.getDouble(field))); break; case Aurora::GFF3Struct::kFieldTypeStrRef: _xml->setContents(strct.getString(field)); break; case Aurora::GFF3Struct::kFieldTypeExoString: case Aurora::GFF3Struct::kFieldTypeResRef: try { _xml->setContents(strct.getString(field)); } catch (...) { _xml->addProperty("base64", "true"); Common::SeekableReadStream *data = strct.getData(field); _xml->setContents(*data); delete data; } break; case Aurora::GFF3Struct::kFieldTypeLocString: { Aurora::LocString locString; strct.getLocString(field, locString); _xml->addProperty("strref", Common::composeString(locString.getID())); dumpLocString(locString); } break; case Aurora::GFF3Struct::kFieldTypeVoid: _xml->setContents(*strct.getData(field)); break; case Aurora::GFF3Struct::kFieldTypeStruct: dumpStruct(strct.getStruct(field), label); break; case Aurora::GFF3Struct::kFieldTypeList: dumpList(strct.getList(field)); break; case Aurora::GFF3Struct::kFieldTypeOrientation: { double a = 0.0, b = 0.0, c = 0.0, d = 0.0; strct.getOrientation(field, a, b, c, d); _xml->breakLine(); _xml->openTag("double"); _xml->setContents(Common::UString::format("%.6f", a)); _xml->closeTag(); _xml->breakLine(); _xml->openTag("double"); _xml->setContents(Common::UString::format("%.6f", b)); _xml->closeTag(); _xml->breakLine(); _xml->openTag("double"); _xml->setContents(Common::UString::format("%.6f", c)); _xml->closeTag(); _xml->breakLine(); _xml->openTag("double"); _xml->setContents(Common::UString::format("%.6f", d)); _xml->closeTag(); _xml->breakLine(); } break; case Aurora::GFF3Struct::kFieldTypeVector: { double x = 0.0, y = 0.0, z = 0.0; strct.getVector(field, x, y, z); _xml->breakLine(); _xml->openTag("double"); _xml->setContents(Common::UString::format("%.6f", x)); _xml->closeTag(); _xml->breakLine(); _xml->openTag("double"); _xml->setContents(Common::UString::format("%.6f", y)); _xml->closeTag(); _xml->breakLine(); _xml->openTag("double"); _xml->setContents(Common::UString::format("%.6f", z)); _xml->closeTag(); _xml->breakLine(); } break; default: break; } // Structs already close their own tag if (type != Aurora::GFF3Struct::kFieldTypeStruct) { _xml->closeTag(); _xml->breakLine(); } }