program_ptr Parser::parse_program() { int start_line = current_lexeme().line(); instructions program_body; instructions functions; instruction_ptr instruction = instruction_ptr(); while (match_current_lexeme(kEndofLine)) next_line(); while (!finished() && ErrorHandler::is_ok()) { instruction = instruction_ptr(); instruction = parse_function_definition(); if (instruction) { functions.push_back(instruction); continue; } instruction = parse_instruction(); if (!instruction) { report_current_syntax_error(); return program_ptr(); } program_body.push_back(instruction); } return program_ptr(new Program(start_line, program_body, functions)); }
static TInt qt_create_symbian_process(RProcess **proc, const QString &programName, const QStringList &arguments, const QString &nativeArguments) { RProcess *newProc = NULL; newProc = new RProcess(); if (!newProc) return KErrNoMemory; QString commandLine; qt_create_symbian_commandline(arguments, nativeArguments, commandLine); TPtrC program_ptr(reinterpret_cast<const TText*>(programName.constData())); TPtrC cmdline_ptr(reinterpret_cast<const TText*>(commandLine.constData())); TInt err = newProc->Create(program_ptr, cmdline_ptr); if (err == KErrNotFound) { // Strip path from program name and try again (i.e. try from default location "\sys\bin") int index = programName.lastIndexOf(QDir::separator()); int index2 = programName.lastIndexOf(QChar(QLatin1Char('/'))); index = qMax(index, index2); if (index != -1 && programName.length() >= index) { QString strippedName; strippedName = programName.mid(index + 1); QPROCESS_DEBUG_PRINT("qt_create_symbian_process() Executable '%s' not found, trying stripped version '%s'", qPrintable(programName), qPrintable(strippedName)); TPtrC stripped_ptr(reinterpret_cast<const TText*>(strippedName.constData())); err = newProc->Create(stripped_ptr, cmdline_ptr); if (err != KErrNone) { QPROCESS_DEBUG_PRINT("qt_create_symbian_process() Unable to create process '%s': %d", qPrintable(strippedName), err); } } } if (err == KErrNone) *proc = newProc; else delete newProc; return err; }