@@ -40,6 +40,7 @@ pub use binaryninjacore_sys::BNHighlightStandardColor as HighlightStandardColor;
4040use crate :: architecture:: RegisterId ;
4141use crate :: confidence:: Conf ;
4242use crate :: high_level_il:: HighLevelILFunction ;
43+ use crate :: language_representation:: CoreLanguageRepresentationFunction ;
4344use crate :: low_level_il:: { LiftedILFunction , RegularLowLevelILFunction } ;
4445use crate :: medium_level_il:: MediumLevelILFunction ;
4546use crate :: variable:: {
@@ -467,6 +468,42 @@ impl Function {
467468 }
468469 }
469470
471+ /// Get the language representation of the function.
472+ ///
473+ /// * `language` - The language representation, ex. "Pseudo C".
474+ pub fn language_representation < S : BnStrCompatible > (
475+ & self ,
476+ language : S ,
477+ ) -> Option < Ref < CoreLanguageRepresentationFunction > > {
478+ let lang_name = language. into_bytes_with_nul ( ) ;
479+ let repr = unsafe {
480+ BNGetFunctionLanguageRepresentation (
481+ self . handle ,
482+ lang_name. as_ref ( ) . as_ptr ( ) as * const c_char ,
483+ )
484+ } ;
485+ NonNull :: new ( repr)
486+ . map ( |handle| unsafe { CoreLanguageRepresentationFunction :: ref_from_raw ( handle) } )
487+ }
488+
489+ /// Get the language representation of the function, if available.
490+ ///
491+ /// * `language` - The language representation, ex. "Pseudo C".
492+ pub fn language_representation_if_available < S : BnStrCompatible > (
493+ & self ,
494+ language : S ,
495+ ) -> Option < Ref < CoreLanguageRepresentationFunction > > {
496+ let lang_name = language. into_bytes_with_nul ( ) ;
497+ let repr = unsafe {
498+ BNGetFunctionLanguageRepresentationIfAvailable (
499+ self . handle ,
500+ lang_name. as_ref ( ) . as_ptr ( ) as * const c_char ,
501+ )
502+ } ;
503+ NonNull :: new ( repr)
504+ . map ( |handle| unsafe { CoreLanguageRepresentationFunction :: ref_from_raw ( handle) } )
505+ }
506+
470507 pub fn high_level_il ( & self , full_ast : bool ) -> Result < Ref < HighLevelILFunction > , ( ) > {
471508 unsafe {
472509 let hlil_ptr = BNGetFunctionHighLevelIL ( self . handle ) ;
0 commit comments