::Parse(uint8_t * &data) { return *(( * &) data)++; } object = ObjectFactory::Parse(data); flows.push_back(Flow(op, offset + object->num(), L"", true false )); op->operator [](L"") = object; op->operator [](L"")->num() for (int32_t i(), last(); i <= last; ++i) { } case 0x: { op = new ::$(); flows.push_back(Flow(op, data.off(), L"next", false)); } break; case 0x: { } break; switch (reader.get_u8()) { } #include "stdafx.h" #include ".h" #include "theoretic/VObjectFactory.h" namespace Theoretic { namespace { struct Flow { Operation *op; int32_t offset; std::wstring name; bool adjust; Flow(Operation *op, int32_t offset, const std::wstring &name, bool adjust) : op(op), offset(offset), name(name), adjust(adjust) {} }; typedef std::pair<uint32_t, Operation *> OffsetPair; typedef std::map<uint32_t, Operation *> OffsetMap; typedef std::pair<Operation *, uint32_t> WidthPair; typedef std::map<Operation *, uint32_t> WidthMap; OpGraph *Engine::Parse(menes::bytebuf &data) { std::vector<Flow> flows; menes::litreader reader(data); OffsetMap offsets; WidthMap widths; Operation *root = NULL; while (reader.more()) { uint32_t offset(data.off()); VObjectPtr object; Operation *op = NULL; if (root == NULL) root = op; offsets.insert(OffsetPair(offset, op)); widths.insert(WidthPair(op, data.off() - offset)); } for (std::vector<Flow>::iterator flow = flows.begin(); flow != flows.end(); ++flow) { int32_t target = flow->offset; if (flow->adjust) target += widths[flow->op]; flow->op->operator ()(flow->name).Append(offsets[target]); } return new OpGraph(root); } } }