*reinterpret_cast<void **>(iter)
= GetObject(fd.TypeId(), *j);
} else {
- Postpone(typeId, id, fd.Offset() + (iter - aggregate), *j, fd.TypeId(), false);
+ Postpone(iter, *j, fd.TypeId(), false);
}
}
}
}
}
} else {
- Postpone(typeId, id, fd.Offset(), i->second->GetIdentifier(), fd.TypeId(), !fd.IsReferenced());
+ Postpone(object, i->second->GetIdentifier(), fd.TypeId(), !fd.IsReferenced(), fd.IsAggregate());
}
}
td.Load(object);
return v.IsLiteral() || source.IsDefined(v.GetIdentifier());
}
-void Interpreter::Postpone(int type, int id, std::ptrdiff_t offset, const std::string &identifier, int linkedType, bool inlined) {
+void Interpreter::Postpone(
+ char *dest,
+ const std::string &identifier,
+ int type,
+ bool inlined,
+ bool aggregate) {
char *str(alloc.Alloc(identifier.size() + 1));
std::memcpy(str, identifier.c_str(), identifier.size());
str[identifier.size()] = '\0';
- postponedDefinitions.push_back(PostponedDefinition(type, id, offset, str, linkedType, inlined));
+ postponedDefinitions.push_back(
+ PostponedDefinition(dest, str, type, inlined, aggregate));
}
int id;
};
struct PostponedDefinition {
- PostponedDefinition(int type, int id, std::ptrdiff_t offset, const char *identifier, int linkedType, bool inlined)
- : type(type), id(id), offset(offset), identifier(identifier), linkedType(linkedType), inlined(inlined) { }
- int type;
- int id;
- std::ptrdiff_t offset;
+ PostponedDefinition(
+ char *dest,
+ const char *identifier,
+ int type,
+ bool inlined,
+ bool aggregate)
+ : dest(dest)
+ , identifier(identifier)
+ , type(type)
+ , inlined(inlined)
+ , aggregate(aggregate) { }
+ char *dest;
const char *identifier;
- int linkedType;
+ int type;
bool inlined;
+ bool aggregate;
};
const std::set<std::string> &ExportedIdentifiers() const { return source.Exports(); }
SDL_Surface *GetImage(const std::string &);
bool CanLink(const Value &) const;
- void Postpone(int type, int id, std::ptrdiff_t offset, const std::string &identifier, int linkedType, bool inlined);
+ void Postpone(
+ char *dest,
+ const std::string &identifier,
+ int type,
+ bool inlined = true,
+ bool aggregate = false);
private:
const ParsedSource &source;
if (intp.PostponedDefinitions().size() > 0) {
for (vector<Interpreter::PostponedDefinition>::const_iterator i(intp.PostponedDefinitions().begin()), end(intp.PostponedDefinitions().end()); i != end; ++i) {
- std::cerr << "missing definition of " << TypeDescription::Get(i->linkedType).TypeName() << " " << i->identifier << std::endl;
+ std::cerr << "missing definition of " << TypeDescription::Get(i->type).TypeName() << " " << i->identifier << std::endl;
}
return 3;
}