[keel] Add convert function to bare metal build so that the symbol is available
This commit is contained in:
		@@ -10,12 +10,13 @@
 | 
			
		||||
namespace keel {
 | 
			
		||||
 | 
			
		||||
#ifndef OX_BARE_METAL
 | 
			
		||||
 | 
			
		||||
[[nodiscard]]
 | 
			
		||||
static ox::Result<const BaseConverter*> findConverter(
 | 
			
		||||
		keel::Context *ctx,
 | 
			
		||||
		ox::CRStringView srcTypeName, int srcTypeVersion,
 | 
			
		||||
		ox::CRStringView dstTypeName, int dstTypeVersion) noexcept {
 | 
			
		||||
		ox::CRStringView srcTypeName,
 | 
			
		||||
		int srcTypeVersion,
 | 
			
		||||
		ox::CRStringView dstTypeName,
 | 
			
		||||
		int dstTypeVersion) noexcept {
 | 
			
		||||
	for (auto &c : ctx->converters) {
 | 
			
		||||
		if (c->matches(srcTypeName, srcTypeVersion, dstTypeName, dstTypeVersion)) {
 | 
			
		||||
			return c;
 | 
			
		||||
@@ -25,9 +26,12 @@ static ox::Result<const BaseConverter*> findConverter(
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static ox::Result<ox::UniquePtr<Wrap>> convert(
 | 
			
		||||
		keel::Context *ctx, const ox::Buffer &srcBuffer,
 | 
			
		||||
		ox::CRStringView srcTypeName, int srcTypeVersion,
 | 
			
		||||
		ox::CRStringView dstTypeName, int dstTypeVersion) noexcept {
 | 
			
		||||
		[[maybe_unused]] keel::Context *ctx,
 | 
			
		||||
		[[maybe_unused]] const ox::Buffer &srcBuffer,
 | 
			
		||||
		[[maybe_unused]] ox::CRStringView srcTypeName,
 | 
			
		||||
		[[maybe_unused]] int srcTypeVersion,
 | 
			
		||||
		[[maybe_unused]] ox::CRStringView dstTypeName,
 | 
			
		||||
		[[maybe_unused]] int dstTypeVersion) noexcept {
 | 
			
		||||
	// look for direct converter
 | 
			
		||||
	auto [c, err] = findConverter(ctx, srcTypeName, srcTypeVersion, dstTypeName, dstTypeVersion);
 | 
			
		||||
	if (!err) {
 | 
			
		||||
@@ -47,16 +51,19 @@ static ox::Result<ox::UniquePtr<Wrap>> convert(
 | 
			
		||||
	}
 | 
			
		||||
	return OxError(1, "Could not convert between types");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ox::Result<ox::UniquePtr<Wrap>> convert(
 | 
			
		||||
		keel::Context *ctx,
 | 
			
		||||
		const ox::Buffer &srcBuffer,
 | 
			
		||||
		ox::CRStringView dstTypeName,
 | 
			
		||||
		int dstTypeVersion) noexcept {
 | 
			
		||||
	oxRequire(hdr, readAssetHeader(srcBuffer));
 | 
			
		||||
	return convert(ctx, srcBuffer, hdr.clawHdr.typeName, hdr.clawHdr.typeVersion, dstTypeName, dstTypeVersion);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
ox::Result<ox::UniquePtr<Wrap>> convert(
 | 
			
		||||
		[[maybe_unused]] keel::Context *ctx,
 | 
			
		||||
		[[maybe_unused]] const ox::Buffer &srcBuffer,
 | 
			
		||||
		[[maybe_unused]] ox::CRStringView dstTypeName,
 | 
			
		||||
		[[maybe_unused]] int dstTypeVersion) noexcept {
 | 
			
		||||
#ifndef OX_BARE_METAL
 | 
			
		||||
	oxRequire(hdr, readAssetHeader(srcBuffer));
 | 
			
		||||
	return convert(ctx, srcBuffer, hdr.clawHdr.typeName, hdr.clawHdr.typeVersion, dstTypeName, dstTypeVersion);
 | 
			
		||||
#else
 | 
			
		||||
	return OxError(1, "Operation not supported on this platform");
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user