File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 1
1
use std:: ffi;
2
2
use std:: sync:: atomic:: Ordering ;
3
3
4
+ use harp:: exec:: RFunction ;
5
+ use harp:: exec:: RFunctionExt ;
4
6
use harp:: utils:: r_str_to_owned_utf8_unchecked;
5
7
6
8
use crate :: interface:: RMain ;
@@ -15,10 +17,21 @@ pub extern "C" fn ark_print_rs(x: libr::SEXP) -> *const ffi::c_char {
15
17
} )
16
18
}
17
19
20
+ // Uses lobstr's `sxp()` function because libr can't find `R_inspect()`.
21
+ // It's an `attribute_hidden` function but since the symbol is visible
22
+ // on macOS (and you can call it in the debugger) I would have expected
23
+ // libr to be able to find it.
18
24
#[ no_mangle]
19
25
pub extern "C" fn ark_inspect_rs ( x : libr:: SEXP ) -> * const ffi:: c_char {
20
26
capture_console_output ( || {
21
- unsafe { libr:: R_inspect ( x) } ;
27
+ // FIXME: These options don't seem to work
28
+ let one = harp:: RObject :: try_from ( 1 ) . unwrap ( ) ;
29
+ harp:: raii:: RLocalOption :: new ( "cli.num_colors" , one. sexp ) ;
30
+
31
+ harp:: raii:: RLocalOptionBoolean :: new ( "cli.unicode" , false ) ;
32
+
33
+ let out = RFunction :: new ( "lobstr" , "sxp" ) . add ( x) . call ( ) . unwrap ( ) ;
34
+ unsafe { libr:: Rf_PrintValue ( out. sexp ) } ;
22
35
} )
23
36
}
24
37
Original file line number Diff line number Diff line change @@ -317,8 +317,6 @@ functions::generate! {
317
317
318
318
pub fn Rf_PrintValue ( x: SEXP ) ;
319
319
320
- pub fn R_inspect ( x: SEXP ) -> SEXP ;
321
-
322
320
pub fn R_PromiseExpr ( p: SEXP ) -> SEXP ;
323
321
324
322
pub fn R_BytecodeExpr ( e: SEXP ) -> SEXP ;
You can’t perform that action at this time.
0 commit comments