- QString text = line->text();
- line->clear();
- LOG4CXX_INFO(logger, "Evaluating String \"" << text.toStdString() << "\"");
- browser->append(QString("> ") + text);
-
- SCM result_obj = scm_internal_catch(SCM_BOOL_T,
- (SCM (*)(void *))scm_c_eval_string,
- (void*)text.toStdString().c_str(),
- handler, NULL);
- SCM result_str = scm_object_to_string(result_obj, SCM_UNDEFINED);
-
- SCM output = scm_get_output_string(guile_output_port);
- QString output_q = scm_to_locale_string(output);
- if (output_q.endsWith("\n")) output_q.chop(1);
- if (output_q != "") browser->append(output_q);
-
- output = scm_get_output_string(guile_error_port);
- output_q = scm_to_locale_string(output);
- if (output_q.endsWith("\n")) output_q.chop(1);
- if (output_q != "") browser->append(output_q);
-
- scm_truncate_file(guile_output_port, scm_from_uint16(0));
- scm_truncate_file(guile_error_port, scm_from_uint16(0));
-
- browser->append(scm_to_locale_string(result_str));
+ std::stringstream stdout, stderr;
+ std::string result;
+ QString output;
+ QString text = line->text();
+
+ line->clear();
+ LOG4CXX_INFO(logger, "Evaluating String \"" << text.toStdString() << "\"");
+ browser->append(QString("> ") + text);
+
+ interpreter->evaluate(text.toStdString(), stdout, stderr, result);
+
+ output = stdout.str().c_str();
+ if (output.endsWith("\n")) output.chop(1);
+ if (output != "") browser->append(output);
+
+ output = stderr.str().c_str();
+ if (output.endsWith("\n")) output.chop(1);
+ if (output != "") browser->append(output);
+
+ browser->append(result.c_str());