Offer non-echoing process().

This commit is contained in:
Axel Naumann 2017-05-02 11:19:14 +02:00 committed by sftnight
parent 97ec4b8e8a
commit 675a67e57f
4 changed files with 18 additions and 9 deletions

View File

@ -447,11 +447,13 @@ namespace cling {
/// initialized to point to the return value's location if the
/// expression result is an aggregate.
///\param[out] T - The cling::Transaction of the compiled input.
///\param[in] disableValuePrinting - Whether to echo the expression result.
///
///\returns Whether the operation was fully successful.
///
CompilationResult process(const std::string& input, Value* V = 0,
Transaction** T = 0);
Transaction** T = 0,
bool disableValuePrinting = false);
///\brief Parses input line, which doesn't contain statements. No code
/// generation is done.

View File

@ -101,12 +101,14 @@ namespace cling {
return prev;
}
///\brief Process the input coming from the prompt and possibli returns
/// result of the execution of the last statement
///\brief Process the input coming from the prompt and possibly returns
/// result of the execution of the last statement.
/// @param[in] input_line - the user input
/// @param[out] compRes - whether compilation was successful
/// @param[out] result - the cling::Value as result of the
/// execution of the last statement
/// @param[out] compRes - whether compilation was successful
/// @param[in] disableValuePrinting - whether to suppress echoing of the
/// expression result
///
///\returns 0 on success or the indentation of the next input line should
/// have in case of multi input mode.
@ -114,7 +116,8 @@ namespace cling {
///
int process(const char* input_line,
Interpreter::CompilationResult& compRes,
cling::Value* result = nullptr);
cling::Value* result = nullptr,
bool disableValuePrinting = false);
///\brief When continuation is requested, this cancels and ignores previous
/// input, resetting the continuation to a new line.

View File

@ -596,7 +596,8 @@ namespace cling {
///
Interpreter::CompilationResult
Interpreter::process(const std::string& input, Value* V /* = 0 */,
Transaction** T /* = 0 */) {
Transaction** T /* = 0 */,
bool disableValuePrinting /* = false*/) {
std::string wrapReadySource = input;
size_t wrapPoint = std::string::npos;
if (!isRawInputEnabled())
@ -612,7 +613,8 @@ namespace cling {
CompilationOptions CO = makeDefaultCompilationOpts();
CO.DeclarationExtraction = 1;
CO.ValuePrinting = CompilationOptions::VPAuto;
CO.ValuePrinting = disableValuePrinting ? CompilationOptions::VPDisabled
: CompilationOptions::VPAuto;
CO.ResultEvaluation = (bool)V;
// CO.IgnorePromptDiags = 1; done by EvaluateInternal().
CO.CheckPointerValidity = 1;

View File

@ -293,7 +293,8 @@ namespace cling {
int MetaProcessor::process(const char* input_text,
Interpreter::CompilationResult& compRes,
Value* result) {
Value* result,
bool disableValuePrinting /* = false */) {
if (result)
*result = Value();
compRes = Interpreter::kSuccess;
@ -337,7 +338,8 @@ namespace cling {
// if (m_Options.RawInput)
// compResLocal = m_Interp.declare(input);
// else
compRes = m_Interp.process(input, result);
compRes = m_Interp.process(input, result, /*Transaction*/ nullptr,
disableValuePrinting);
return 0;
}