]>
git.siccegge.de Git - frida/frida.git/blob - src/bindings/Guile.cxx
4 SCM
handler (void*, SCM tag
, SCM throw_args
) {
5 scm_handle_by_message_noexit ((void*)"foo", tag
, throw_args
);
10 GuileInterpreter::GuileInterpreter() {
13 scm_internal_catch(SCM_BOOL_T
,
14 (SCM (*)(void *))scm_c_eval_string
,
15 (void*)"(use-modules (system repl server))",
17 scm_internal_catch(SCM_BOOL_T
,
18 (SCM (*)(void *))scm_c_eval_string
,
19 (void*)"(spawn-server)",
22 guile_output_port
= scm_open_output_string();
23 guile_error_port
= scm_open_output_string();
24 scm_set_current_output_port(guile_output_port
);
25 scm_set_current_error_port(guile_error_port
);
28 int GuileInterpreter::evaluate(const std::string
& command
,
31 std::string
& result
) {
33 SCM result_obj
= scm_internal_catch(SCM_BOOL_T
,
34 (SCM (*)(void *))scm_c_eval_string
,
35 (void*)command
.c_str(),
38 SCM result_str
= scm_object_to_string(result_obj
, SCM_UNDEFINED
);
40 SCM output
= scm_get_output_string(guile_output_port
);
41 stdout
<< scm_to_locale_string(output
);
43 output
= scm_get_output_string(guile_error_port
);
44 stderr
<< scm_to_locale_string(output
);
46 result
= scm_to_locale_string(result_str
);
48 scm_truncate_file(guile_output_port
, scm_from_uint16(0));
49 scm_truncate_file(guile_error_port
, scm_from_uint16(0));