forked from qt-creator/qt-creator
add $$prompt() function
follow suit with qmake ... this doesn't use any of the fancy handler functions for printing the message, as it doesn't seem worth it: the read is done directly from stdin anyway, and everything else would be overengineered, given the purpose - this is probably the most useless qmake function ever. Change-Id: I4831bfc06ce2623c4090d13c04be286bc18f1b5d Reviewed-by: Daniel Teske <daniel.teske@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
@@ -118,7 +118,7 @@ void QMakeEvaluator::initFunctionStatics()
|
||||
{ "re_escape", E_RE_ESCAPE },
|
||||
{ "val_escape", E_VAL_ESCAPE },
|
||||
{ "files", E_FILES },
|
||||
{ "prompt", E_PROMPT }, // interactive, so cannot be implemented
|
||||
{ "prompt", E_PROMPT },
|
||||
{ "replace", E_REPLACE },
|
||||
{ "sort_depends", E_SORT_DEPENDS },
|
||||
{ "resolve_depends", E_RESOLVE_DEPENDS }
|
||||
@@ -751,6 +751,26 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
case E_PROMPT: {
|
||||
if (args.count() != 1) {
|
||||
evalError(fL1S("prompt(question) requires one argument."));
|
||||
// } else if (currentFileName() == QLatin1String("-")) {
|
||||
// evalError(fL1S("prompt(question) cannot be used when '-o -' is used"));
|
||||
} else {
|
||||
QString msg = m_option->expandEnvVars(args.at(0).toQString(m_tmp1));
|
||||
if (!msg.endsWith(QLatin1Char('?')))
|
||||
msg += QLatin1Char('?');
|
||||
fprintf(stderr, "Project PROMPT: %s ", qPrintable(msg));
|
||||
|
||||
QFile qfile;
|
||||
if (qfile.open(stdin, QIODevice::ReadOnly)) {
|
||||
QTextStream t(&qfile);
|
||||
ret = split_value_list(t.readLine());
|
||||
}
|
||||
}
|
||||
break; }
|
||||
#endif
|
||||
case E_REPLACE:
|
||||
if (args.count() != 3 ) {
|
||||
evalError(fL1S("replace(var, before, after) requires three arguments."));
|
||||
|
||||
Reference in New Issue
Block a user