From d8e3001e535fad178c621ff07418f81f25123dc4 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Thu, 22 Aug 2024 12:55:49 -0600 Subject: Allow multiple high level representations for display, add Pseudo Rust and a Pseudo Python example plugin --- lang/rust/rusttypes.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 lang/rust/rusttypes.h (limited to 'lang/rust/rusttypes.h') diff --git a/lang/rust/rusttypes.h b/lang/rust/rusttypes.h new file mode 100644 index 00000000..419e5253 --- /dev/null +++ b/lang/rust/rusttypes.h @@ -0,0 +1,32 @@ +#pragma once + +#include "binaryninjaapi.h" + +class RustTypePrinter: public BinaryNinja::TypePrinter +{ + void AppendCallingConventionTokens(BinaryNinja::Type* type, BinaryNinja::Platform* platform, uint8_t baseConfidence, + std::vector& tokens); + void GetStructureMemberTokens(BinaryNinja::Platform* platform, BinaryNinja::Type* type, uint8_t baseConfidence, + BNTokenEscapingType escaping, std::vector& out); + +public: + RustTypePrinter(); + + std::vector GetTypeTokensBeforeName( + BinaryNinja::Ref type, BinaryNinja::Ref platform, + uint8_t baseConfidence = BN_FULL_CONFIDENCE, BinaryNinja::Ref parentType = nullptr, + BNTokenEscapingType escaping = NoTokenEscapingType) override; + std::vector GetTypeTokensAfterName( + BinaryNinja::Ref type, BinaryNinja::Ref platform, + uint8_t baseConfidence = BN_FULL_CONFIDENCE, BinaryNinja::Ref parentType = nullptr, + BNTokenEscapingType escaping = NoTokenEscapingType) override; + std::vector GetTypeLines( + BinaryNinja::Ref type, const BinaryNinja::TypeContainer& types, + const BinaryNinja::QualifiedName& name, int paddingCols = 64, bool collapsed = false, + BNTokenEscapingType escaping = NoTokenEscapingType) override; + + std::vector GetTypeTokensAfterNameInternal( + BinaryNinja::Ref type, BinaryNinja::Ref platform, + uint8_t baseConfidence = BN_FULL_CONFIDENCE, BinaryNinja::Ref parentType = nullptr, + BNTokenEscapingType escaping = NoTokenEscapingType, bool functionHeader = false); +}; -- cgit v1.3.1