@@ -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:: {
@@ -476,6 +477,42 @@ impl Function {
476477 }
477478 }
478479
480+ /// Get the language representation of the function.
481+ ///
482+ /// * `language` - The language representation, ex. "Pseudo C".
483+ pub fn language_representation < S : BnStrCompatible > (
484+ & self ,
485+ language : S ,
486+ ) -> Option < Ref < CoreLanguageRepresentationFunction > > {
487+ let lang_name = language. into_bytes_with_nul ( ) ;
488+ let repr = unsafe {
489+ BNGetFunctionLanguageRepresentation (
490+ self . handle ,
491+ lang_name. as_ref ( ) . as_ptr ( ) as * const c_char ,
492+ )
493+ } ;
494+ NonNull :: new ( repr)
495+ . map ( |handle| unsafe { CoreLanguageRepresentationFunction :: ref_from_raw ( handle) } )
496+ }
497+
498+ /// Get the language representation of the function, if available.
499+ ///
500+ /// * `language` - The language representation, ex. "Pseudo C".
501+ pub fn language_representation_if_available < S : BnStrCompatible > (
502+ & self ,
503+ language : S ,
504+ ) -> Option < Ref < CoreLanguageRepresentationFunction > > {
505+ let lang_name = language. into_bytes_with_nul ( ) ;
506+ let repr = unsafe {
507+ BNGetFunctionLanguageRepresentationIfAvailable (
508+ self . handle ,
509+ lang_name. as_ref ( ) . as_ptr ( ) as * const c_char ,
510+ )
511+ } ;
512+ NonNull :: new ( repr)
513+ . map ( |handle| unsafe { CoreLanguageRepresentationFunction :: ref_from_raw ( handle) } )
514+ }
515+
479516 pub fn high_level_il ( & self , full_ast : bool ) -> Result < Ref < HighLevelILFunction > , ( ) > {
480517 unsafe {
481518 let hlil_ptr = BNGetFunctionHighLevelIL ( self . handle ) ;
0 commit comments