Exemple #1
0
ArgumentList *unmarshalArgumentList(StorageIntf *s)
{
  uint i;
  uint count = unmarshalUInt(s);
  if (count==NULL_LIST) return 0; // null list
  ArgumentList *result = new ArgumentList;
  assert(count<1000000);
  //printf("unmarshalArgumentList: %d\n",count);
  for (i=0;i<count;i++)
  {
    Argument *a = new Argument;
    a->attrib  = unmarshalQCString(s);
    a->type    = unmarshalQCString(s);
    a->canType = unmarshalQCString(s);
    a->name    = unmarshalQCString(s);
    a->array   = unmarshalQCString(s);
    a->defval  = unmarshalQCString(s);
    a->docs    = unmarshalQCString(s);
    result->append(a);
  }
  result->constSpecifier    = unmarshalBool(s);
  result->volatileSpecifier = unmarshalBool(s);
  result->pureSpecifier     = unmarshalBool(s);
  return result;
}
Exemple #2
0
QString makeFunction(FunctionModelItem function, const QString preFix = QString()) {
    QString fullName;
    fullName += function->type().toString();
    fullName += " ";
    fullName += preFix;
    fullName += function->name();
    ArgumentList arguments = function->arguments();
    QStringList args;
    for (int i = 0; i < arguments.count(); ++i) {
        QString arg = arguments[i]->name();
        if (arg.isEmpty())
            arg = QString("arg%1").arg(i);
        QString theargs = arguments[i]->type().toString() + " " + arg;
        if (arguments[i]->defaultValue())
            theargs += " = " + arguments[i]->defaultValueExpression();
        args += theargs;
    }
    fullName += "(" + args.join(", ") + ")";
    if (function->isConstant())
        fullName +=  " const";

    if (function->isStatic())
        fullName =  "static " + fullName;

    return fullName;
}
Exemple #3
0
ClassDef *GenericsSDict::find(const QCString &key)
{
  int i=key.find('<');
  if (i==-1)
  {
    GenericsCollection *collection = m_dict.find(key);
    if (collection && collection->count()==1)
    {
      QIntDictIterator<ClassDef> it(*collection);
      return it.current();
    }
  }
  else
  {
    GenericsCollection *collection = m_dict.find(key.left(i));
    if (collection)
    {
      ArgumentList argList;
      stringToArgumentList(key.mid(i),&argList);
      int c = argList.count();
      return collection->find(c);
    }
  }
  return 0;
}
Exemple #4
0
void UDPEchoClient::onReadyRead () {
	{
		LockGuard guard (mMutex);
		if (mState != WAIT) return; // ignoring; timeout.
		// Check protocol
		String from;
		int fromPort;
		ByteArrayPtr data = mSocket.recvFrom(&from,&fromPort);
		if (!data) {
			Log (LogWarning) << LOGID << "Could not read any data tough readyRead() signal" << std::endl;
			return; // ?
		}
		String toParse (data->const_c_array(), data->size());
		ArgumentList list;
		sf::argSplit (toParse, &list);
		// Format: TOKEN IP-Address Port
		if (list.size() != 4 || list[0] != "condataReply") {
			Log (LogInfo) << LOGID << "Invalid protocol in answer " << *data << ", token=" << list.size() <<  std::endl;
			return;   // invalid protocol
		}
		if (list[1] != mToken){
			Log (LogInfo) << LOGID << "Token mismatch in answer " << *data << std::endl;
			return; // invalid token
		}
		mState = READY;
		mAddress = list[2];
		mPort = atoi (list[3].c_str());
		Log (LogInfo) << LOGID << "Successfully decoded echo answer: " << mAddress << ":" << mPort << " coming from " << from << ":" << fromPort << std::endl;
		sf::cancelTimer(mTimeoutHandle);
	}
	mResultDelegate (NoError);
}
Exemple #5
0
int main(int argc, const char **argv)
{
	unitTests();

	Settings settings;
	ArgumentList args = gatherArguments(argc, argv, settings);	

	// TODO: Probably don't want to share them between files
	Bindings bindings = bindStandardLibrary();
	Interpreter interpreter(bindings, settings);

	if (args.empty())
	{
		repl(interpreter, settings);
	}
	else
	{
		for (ArgumentList::const_iterator it = args.begin() ; it != args.end() ; ++it) 
		{
			execute(interpreter, *it, settings);
		}
	}
	// If you use CTRL-D, nice to output a newline...
	std::cout << '\n';
}
Exemple #6
0
QSharedPointer<ClassDef> GenericsSDict::find(const QString &key)
{
   int i = key.indexOf('<');

   if (i == -1) {
       QSharedPointer<QHash<long, QSharedPointer<ClassDef>>> collection = m_dict.find(key);

      if (collection && collection->count() == 1) {        
         return collection->begin().value();
      }

   } else {
      QSharedPointer<QHash<long, QSharedPointer<ClassDef>>> collection = m_dict.find(key.left(i));

      if (collection) {
         ArgumentList argList;
         stringToArgumentList(key.mid(i), &argList);

         int c = argList.count();
         return collection->value(c);
      }
   }

   return QSharedPointer<ClassDef>();
}
Exemple #7
0
void GenericsSDict::insert(const QString &key, QSharedPointer<ClassDef> cd)
{
   int i = key.indexOf('<');

   if (i == -1) {
      return;
   }

   ArgumentList argList;
   stringToArgumentList(key.mid(i), &argList);

   int c = argList.count();

   if (c == 0) {
      return;
   }

   QSharedPointer<QHash<long, QSharedPointer<ClassDef>>> collection = m_dict.find(key.left(i));

   if (collection == 0) {
      // new hash
      collection = QMakeShared<QHash<long, QSharedPointer<ClassDef>>>();       

      // add new hash to m_dict
      m_dict.insert(key.left(i), collection);
   }

   if (! collection->contains(c)) {
      // add the collection
      collection->insert(c, cd);
   }
}
Exemple #8
0
Parser::ArgumentList Parser::arguments(istream* input)
{
    ArgumentList list;
    get_token(input);
    for(;;)
    {
        if(curr_sym.curr_tok == Lexer::RP)
        {
            return list;
        }
        else if (curr_sym.curr_tok == Lexer::SEP)
        {
            get_token(input);
            continue;
        }
        else if (curr_sym.curr_tok == Lexer::PRINT || curr_sym.curr_tok == Lexer::END)
        {
            throw Error::SyntaxError(") expected");
        }
        else
        {
            list.push_back(expr(input, false));
        }
    }
}
ArgumentList ArgumentParser::findArguments(const Option& option) const
{
    ArgumentList args;
    foreach (auto& arg, m_arguments)
        if (&option == arg.option)
            args.push_back(arg);
    return args;
}
Exemple #10
0
ArgumentList ArgumentParser::findUnknownArguments() const
{
    ArgumentList args;
    foreach (auto& arg, m_arguments)
        if (!arg.isKnown())
            args.push_back(arg);
    return args;
}
Exemple #11
0
void Action::clearOutputAgumentValues() {
  ArgumentList *outArgList = getOutputArgumentList();
  int nArgs = outArgList->size();
  for (int n = 0; n < nArgs; n++) {
    Argument *arg = outArgList->getArgument(n);
    arg->setValue("");
  }
}
Exemple #12
0
int main(int argc, char** argv)
{
   QGL::setPreferredPaintEngine(QPaintEngine::OpenGL);

   // The QApplication will strip its args from argc/argv, so we want to do 
   // this before putting the command-line args into our ArgumentList, or we
   // will try to open the Qt args as data files.
   QApplication app(argc, argv);
   SystemServicesImp::instance()->WriteLogInfo(QString("%1 Startup").arg(APP_NAME).toStdString());

   // Register the command line options
   ArgumentList* pArgumentList = ArgumentList::instance();
   if (pArgumentList == NULL)
   {
      SystemServicesImp::instance()->WriteLogInfo(QString("%1 Shutdown").arg(APP_NAME).toStdString());
      return -1;
   }

   pArgumentList->registerOption("input");
   pArgumentList->registerOption("deployment");
   pArgumentList->registerOption("debugDeployment");
   pArgumentList->registerOption("exitAfterWizards");
   pArgumentList->registerOption("generate");
   pArgumentList->registerOption("processors");
   pArgumentList->registerOption("");
   pArgumentList->set(argc, argv);

   // Run the application
   InteractiveApplication interactiveApp(app);
   int success = interactiveApp.run(argc, argv);

   SystemServicesImp::instance()->WriteLogInfo(QString("%1 Shutdown").arg(APP_NAME).toStdString());
   return success;
}
Exemple #13
0
int FITSHeaderProcess::ProcessCommandLine( const StringList& argv ) const
{
   ArgumentList arguments =
   ExtractArguments( argv, ArgumentItemMode::AsViews,
                     ArgumentOption::AllowWildcards|ArgumentOption::NoPreviews );

   FITSHeaderInstance instance( this );

   bool launchInterface = false;
   int count = 0;

   for ( ArgumentList::const_iterator i = arguments.Begin(); i != arguments.End(); ++i )
   {
      const Argument& arg = *i;

      if ( arg.IsNumeric() )
         throw Error( "Unknown numeric argument: " + arg.Token() );
      else if ( arg.IsString() )
         throw Error( "Unknown string argument: " + arg.Token() );
      else if ( arg.IsSwitch() )
         throw Error( "Unknown switch argument: " + arg.Token() );
      else if ( arg.IsLiteral() )
         throw Error( "Unknown argument: " + arg.Token() );
      else if ( arg.IsItemList() )
      {
         ++count;

         if ( arg.Items().IsEmpty() )
         {
            Console().WriteLn( "No view(s) found: " + arg.Token() );
            continue;
         }

         for ( StringList::const_iterator j = arg.Items().Begin(); j != arg.Items().End(); ++j )
         {
            View v = View::ViewById( *j );
            if ( v.IsNull() )
               throw Error( "No such view: " + *j );
            instance.LaunchOn( v );
         }
      }
   }

   if ( launchInterface )
      instance.LaunchInterface();
   else if ( count == 0 )
   {
      if ( ImageWindow::ActiveWindow().IsNull() )
         throw Error( "There is no active image window." );
      instance.LaunchOnCurrentWindow();
   }

   return 0;
}
Exemple #14
0
std::string PageTemplate::get_variable(const ArgumentList& arguments, const ArrayArgument::Item* arrayItem, const std::string& var) const
{
	if (arrayItem != 0)
	{
		ArrayArgument::Item::const_iterator i = arrayItem->find(var);
		if (i != arrayItem->end())
			return i->second;
	}
	ArgumentList::const_iterator i = arguments.find(var);
	return i == arguments.end() ? std::string() : i->second->to_string();
}
Exemple #15
0
void InsertMacro(CMacro* Macro, std::wstring& Args)
{
	tTextData Text;
	ArgumentList Arguments;

	splitArguments(Arguments,Args);

	if ((int)Arguments.size() != Macro->getArgumentCount())
	{
		Logger::printError(Logger::Error,L"%s macro arguments (%d vs %d)",
			(int)Arguments.size() > Macro->getArgumentCount() ? L"Too many" : L"Not enough",
			Arguments.size(),Macro->getArgumentCount());
		return;
	}

	Global.MacroNestingLevel++;
	if (Global.MacroNestingLevel == ASSEMBLER_MACRO_NESTING_LEVEL)
	{
		Logger::printError(Logger::Error,L"Maximum macro nesting level reached");
		return;
	}

	int MacroCounter = Macro->getIncreaseCounter();

	for (int i = 0; i < Macro->getLineCount(); i++)
	{
		Text.buffer = Macro->getLine(i,Arguments,MacroCounter);
		Text.buffer = Global.symbolTable.insertEquations(Text.buffer,Global.FileInfo.FileNum,Global.Section);

		if (CheckEquLabel(Text.buffer) == false)
		{
			Text.buffer = checkLabel(Text.buffer,false);
			splitLine(Text.buffer,Text.name,Text.params);
			if (Text.name.size() == 0) continue;

			bool macro = false;
			for (size_t i = 0; i < Global.Macros.size(); i++)
			{
				if (Text.name.compare(Global.Macros[i]->getName()) == 0)
				{
					InsertMacro(Global.Macros[i],Text.params);
					macro = true;
				}
			}
			if (macro == true) continue;

			if (Arch->AssembleDirective(Text.name,Text.params) == false)
			{
				Arch->AssembleOpcode(Text.name,Text.params);
			}
		}
	}
	Global.MacroNestingLevel--;
}
            Variant Invoke(Variant &obj, const ArgumentList &arguments) override
            {
                UAssert( arguments.size( ) == THIS_ARG_COUNT,
                    "Invalid method arguments.\nExpected %i args but got %i.",
                    THIS_ARG_COUNT,
                    arguments.size( )
                );

                invoke<void, ArgTypes...>( obj, arguments );

                return { };
            }
bool ParserThread::ParseArgumentList(ArgumentList &argumentList)
{
    // do nothing on the argumentList, just do the loop
    if(PeekToken()->type_id() != TKN_LESS)
       return true;

    // shoud be a (xxxx) or <xxxxx>
    Token * tk = ConsumeToken();

    TRACE("ParserThread::ParseArgumentList() Enter...");
    int level = 1;
    argumentList.clear();
    argumentList.push_back(*tk); // push <while(true)


    while(true)
    {

        tk = PeekToken();//

        if(tk->type_id() == TKN_LESS)
        {
            ConsumeToken();
            argumentList.push_back(*tk);
            level++;

        }
        else if (tk->type_id() == TKN_GREATER)
        {
            level--;
            ConsumeToken();
            argumentList.push_back(*tk);
            if(level <= 0)
                break;
        }
        else if(tk->type_id()==TKN_SEMICOLON || tk->type_id()==TKN_R_BRACE)
        {
            m_Context.EndStatement();
            return false;
        }
        else
        {
            //std::cout<<*tk<<std::endl;
            argumentList.push_back(*tk);
            ConsumeToken();
        }
    }

    //cout<<"currentToken"<<*(CurrentToken())<<endl;
    TRACE("ParserThread::ParseArgumentList() Leave...");
    return true;
}
Exemple #18
0
void
Protocol::_ParseCapabilities(const ArgumentList& arguments)
{
	fCapabilities.MakeEmpty();

	for (int32 i = 0; i < arguments.CountItems(); i++) {
		if (StringArgument* argument
				= dynamic_cast<StringArgument*>(arguments.ItemAt(i)))
			fCapabilities.AddItem(new StringArgument(*argument));
	}

	TRACE("capabilities: %s\n", fCapabilities.ToString().String());
}
int main(int argc, char *argv[]) {
	bool verbose = false;
	/* Argomenti passati all'eseguibile */
	ArgumentList args = ArgumentList(argc, argv);

	if ( argc < 2 || argc > 3 ) {
		cerr << "Utilizzo: " << args.getFirst() << " [-v] <file_istanza_tsp>" << endl;
		cerr << "\t-v : verboso." << endl << endl;
		return -1;
	}
	else {
		cout << args.getFirst() << endl;
	}

	/* Istanza del problema */
	TSPInstance< w_type > *problema = new TSPInstance< w_type >;
	/* Loader dell'istanza */
	TSPReader< w_type > *reader = new TSPReader< w_type >(problema);
	/* Nome del file da cui caricare l'istanza */
	string filename = "";
	/* Soluzione del problema */
	vector< vertice * > *soluzione;

	verbose = args.getSwitch("-v");
	filename = args.getFirst();

	reader->setInputFile(filename);

	if ( ! reader->read() ) {
		cerr << "Impossibile leggere l'istanza." << endl;
		delete problema;
		delete reader;
		return -1;
	}

	if ( verbose ) {
		cout << "Istanza caricata, sta per essere eseguito l'algoritmo di risoluzione." << endl;
	}

	soluzione = new vector< vertice * >;

	christofides(problema->getGrafo(), soluzione);
	stampaDimensioneCircuito(*soluzione);
	cout << endl;
	stampaCostoCircuito(*soluzione, *(problema->getGrafo()));

	delete soluzione;
	delete problema;
	delete reader;
	return 0;
}
Exemple #20
0
CDirectiveIncbin::CDirectiveIncbin(ArgumentList& args)
{
	fileName = getFullPathName(args[0].text);

	if (fileExists(fileName) == false)
	{
		Logger::printError(Logger::FatalError,L"File %s not found",fileName);
		return;
	}

	int inputFileSize = fileSize(fileName);
	if (args.size() >= 2)
	{
		// load start address
		if (ConvertExpression(args[1].text,startAddress) == false)
		{
			Logger::printError(Logger::FatalError,L"Invalid start address %s",args[1].text);
			return;
		}

		if (startAddress >= inputFileSize)
		{
			Logger::printError(Logger::Error,L"Start address 0x%08X after end of file",startAddress);
			return;
		}

		if (args.size() >= 3)
		{
			// load size too
			if (ConvertExpression(args[2].text,loadSize) == false)
			{
				Logger::printError(Logger::FatalError,L"Invalid size %s",args[1].text);
				return;
			}

			if (startAddress+loadSize > inputFileSize)
			{
				Logger::printError(Logger::Warning,L"Loading beyond file end, truncating");
				loadSize =  inputFileSize-startAddress;
			}
		} else {
			loadSize =  inputFileSize-startAddress;
		}
	} else {
		startAddress = 0;
		loadSize = inputFileSize;
	}

	g_fileManager->advanceMemory(loadSize);
}
Exemple #21
0
void PageTemplate::yield_foreach(const ArgumentList& arguments, const TokenPtr& token, std::string& result) const
{
	const ForeachToken* ftoken = static_cast<const ForeachToken*>(token.get());
	ArgumentList::const_iterator i = arguments.find(ftoken->data);
	if (i == arguments.end() || !i->second->is_array())
		return;
	const ArrayArgument* array = static_cast<const ArrayArgument*>(i->second.get());
	for (std::size_t i = 0, n = array->size(); i < n; i++)
	{
		if (i > 0)
			yield_tokens(arguments, 0, ftoken->sep, result);
		yield_tokens(arguments, &array->get(i), ftoken->body, result);
	}
}
Exemple #22
0
Argument *Action::getArgument(const std::string &name) {
  ArgumentList *argList = getArgumentList();
  int nArgs = argList->size();
  for (int n = 0; n < nArgs; n++) {
    Argument *arg = argList->getArgument(n);
    const char *argName = arg->getName();
    if (argName == NULL)
      continue;
    string argNameStr = argName;
    if (argNameStr.compare(name) == 0)
      return arg;
  }
  return NULL;
}
void PrintDeviceInfo(Device *dev, int indent)
{
	string indentStr;
	GetIndentString(indent, indentStr);
	const char *devName = dev->getFriendlyName();
	cout << indentStr << devName << endl;

	int i, n, j;
	ServiceList *serviceList = dev->getServiceList();
	int serviceCnt = serviceList->size();
	for (n=0; n<serviceCnt; n++) {
		Service *service = serviceList->getService(n);
		cout << indentStr << " service[" << n << "] = "<< service->getServiceType() << endl;
		ActionList *actionList = service->getActionList();
		int actionCnt = actionList->size();
		for (i=0; i<actionCnt; i++) {
			Action *action = actionList->getAction(i);
			cout << indentStr << "  action[" << i << "] = "<< action->getName() << endl;
			ArgumentList *argList = action->getArgumentList();
			int argCnt = argList->size();
			for (j=0; j<argCnt; j++) {
					Argument *arg = argList->getArgument(j);
					cout << indentStr << "    arg[" << j << "] = " << arg->getName() << "("  << arg->getDirection() << ")";
					StateVariable *stateVar = arg->getRelatedStateVariable();
					if (stateVar != NULL)
						cout << " - " << stateVar->getName();
					cout << endl;
			}
		}
		ServiceStateTable *stateTable = service->getServiceStateTable();
		int varCnt = stateTable->size();
		for (i=0; i<varCnt; i++) {
			StateVariable *stateVar = stateTable->getStateVariable(i);
			cout << indentStr << "  stateVar[" << i << "] = " << stateVar->getName() << endl;
			AllowedValueList *valueList = stateVar->getAllowedValueList();
			int valueListCnt = valueList->size();
			if (0 < valueListCnt) {
				for (j=0; j<valueListCnt; j++)
					cout << indentStr << "    AllowedValueList[" << j << "] = " << valueList->getAllowedValue(j) << endl;
			}
			AllowedValueRange *valueRange = stateVar->getAllowedValueRange();
			if (valueRange != NULL) {
					cout << indentStr << "    AllowedRange[minimum] = " << valueRange->getMinimum() << endl;
					cout << indentStr << "    AllowedRange[maximum] = " << valueRange->getMaximum() << endl;
					cout << indentStr << "    AllowedRange[step] = " << valueRange->getStep() << endl;
			}
		}
	}
}
Exemple #24
0
bool DirectiveString(ArgumentList& List, int flags)
{
	ArgumentList NewList;

	if (Global.Table.isLoaded() == false)
	{
		Logger::printError(Logger::Error,L"No table opened");
		return false;
	}

	for (size_t i = 0; i < List.size(); i++)
	{
		if (List[i].isString)
		{
			ByteArray data = Global.Table.encodeString(List[i].text,false);

			if (data.size() == 0 && List[i].text.size() != 0)
			{
				Logger::printError(Logger::Error,L"Failed to encode string");
				return false;
			}

			for (int i = 0; i < data.size(); i++)
			{
				wchar_t str[32];
				swprintf(str,32,L"0x%02X",data[i]);
				NewList.add(str,false);
			}
		} else {
			NewList.add(List[i].text,false);
		}
	}

	if ((flags & DIRECTIVE_STR_NOTERMINATION) == 0)
	{
		ByteArray data = Global.Table.encodeTermination();
		for (int i = 0; i < data.size(); i++)
		{
			wchar_t str[32];
			swprintf(str,32,L"0x%02X",data[i]);
			NewList.add(str,false);
		}
	}

	CDirectiveData* Data = new CDirectiveData(NewList,1,false);
	AddAssemblerCommand(Data);
	return true;
}
bool measured_response_time(
  const char* name,
  ArgumentList const& arguments,
  EvalState &state,
  Value& result)
{

  result.SetErrorValue();
  std::string queue_id;
  int mode = 0, seconds = 0;
  // we check to make sure that we are passed at least one argument
  if (arguments.size() <= 1) {
    return false;
  } else {
    Value arg[3];
    if (!(arguments[0]->Evaluate(state, arg[0]) && arg[0].IsStringValue(queue_id))) {
      return false;
    }
    if (!(arguments[1]->Evaluate(state, arg[1]) && arg[1].IsIntegerValue(mode))) {
      return false;
    }
    if (!(arguments[2]->Evaluate(state, arg[2]) && arg[2].IsIntegerValue(seconds))) {
      return false;
    }
  }

  if (mode) {
    result.SetRealValue(lb_statistics(queue_id, avg, seconds));
  } else {
    result.SetRealValue(lb_statistics(queue_id, std_dev, seconds));
  }

  return true;
}
Exemple #26
0
bool DirectiveData(ArgumentList& List, int flags)
{
	bool ascii = false;

	if (flags & DIRECTIVE_DATA_ASCII)
	{
		ascii = true;
		flags &= ~DIRECTIVE_DATA_ASCII;
	}

	bool hasNonAscii = false;
	for (size_t i = 0; i < List.size(); i++)
	{
		if (List[i].isString)
		{
			for (size_t k = 0; k < List[i].text.size(); k++)
			{
				if (List[i].text[k] >= 0x80)
					hasNonAscii = true;
			}
		}
	}

	if (hasNonAscii)
		Logger::printError(Logger::Warning,L"Non-ASCII character in data directive. Use .string instead");

	CDirectiveData* Data = new CDirectiveData(List,flags,ascii);
	AddAssemblerCommand(Data);
	return true;
}
Exemple #27
0
double Calculator::call(Lexer& lexer, string name)
{
    SymEntry* sym = symbols.Get(name);
    if(!sym)
    {
        throw Error::SyntaxError("undefined function "+name);
    }

    ArgumentList args = arguments(lexer);

    switch(sym->type)
    {
    case SymEntry::SYS_FUNC:
    {
        SymSysFunc* sFunc = static_cast<SymSysFunc*>(sym);
        if(args.size() != 1)
            throw Error::SyntaxError("incorrect number of arguments");
        return sFunc->func(args[0]);
    }
    case SymEntry::USR_FUNC:
    {
        SymUsrFunc* uFunc = static_cast<SymUsrFunc*>(sym);
        if(args.size() != uFunc->params.size())
            throw Error::SyntaxError("incorrect number of arguments");
        map<string,double> argMap;
        for(unsigned int i = 0; i < uFunc->params.size(); i++)
        {
            argMap[uFunc->params[i]] = args[i];
        }
        for(TokenList::const_iterator i = uFunc->func.begin(); i != uFunc->func.end(); i++)
        {
            Token tok = *i;
            if(tok.Type == Token::NAME && argMap.count(tok.StringValue) > 0)
            {
                Token val(Token::NUMBER, argMap[tok.StringValue]);
                lexer.push(val);
            }
            else
                lexer.push(*i);
        }
        return expr(lexer);
    }
    default:
        throw Error::SyntaxError("not a function: "+name);
    }
}
int PreferencesProcess::ProcessCommandLine( const StringList& argv ) const
{
   ArgumentList arguments = ExtractArguments( argv, ArgumentItemMode::NoItems );

   PreferencesInstance instance( this );
   bool launchInterface = false;

   for ( ArgumentList::const_iterator i = arguments.Begin(); i != arguments.End(); ++i )
   {
      const Argument& arg = *i;

      if ( arg.IsNumeric() )
      {
         throw Error( "Unknown numeric argument: " + arg.Token() );
      }
      else if ( arg.IsString() )
      {
         throw Error( "Unknown string argument: " + arg.Token() );
      }
      else if ( arg.IsSwitch() )
      {
         throw Error( "Unknown switch argument: " + arg.Token() );
      }
      else if ( arg.IsLiteral() )
      {
         if ( arg.Id() == "-interface" )
            launchInterface = true;
         else if ( arg.Id() == "-help" )
         {
            ShowHelp();
            return 0;
         }
         else
            throw Error( "Unknown argument: " + arg.Token() );
      }
      else if ( arg.IsItemList() )
         throw Error( "Invalid non-parametric argument: " + arg.Token() );
   }

   if ( launchInterface || arguments.IsEmpty() )
      instance.LaunchInterface();
   else
      instance.LaunchGlobal();

   return 0;
}
Exemple #29
0
bool Application::executeStartupBatchWizards()
{
   vector<string> wizardFiles;

   ArgumentList* pArgumentList = ArgumentList::instance();
   if (pArgumentList != NULL)
   {
      wizardFiles = pArgumentList->getOptions("input");
   }

   if (wizardFiles.empty() == true)
   {
      return true;
   }

   return WizardUtilities::runBatchFiles(wizardFiles, mpProgress);
}
Exemple #30
0
void CMacro::loadArguments(ArgumentList& argumentList)
{
	name = argumentList[0].text;

	for (size_t i = 1; i < argumentList.size(); i++)
	{
		arguments.push_back(argumentList[i].text);
	}
}