Пример #1
0
wstring CFileParser::GetString()
{
	if( GetTokenType() == STRING )
	{
		wchar_t* pPos = ++m_wszBuff;

		while( *pPos != L'"' && *pPos != L'\r' && *pPos )
		{
			if( ( m_wszBuff - pPos ) > 255 )
				throw new exception( "String too long!" );

			pPos++;
		}

		m_wszToken = wstring( m_wszBuff, pPos - m_wszBuff);
		m_wszBuff = pPos;
	}
	else
	{
		wchar_t* pPos = m_wszBuff;

		while( *pPos != L'\r' && *pPos && !IsWhiteSpace( *pPos ) )
		{
			if( ( m_wszBuff - pPos ) > 255 )
				throw new exception( "String too long!" );

			pPos++;
		}

		m_wszToken = wstring( m_wszBuff, pPos - m_wszBuff);
		m_wszBuff = pPos;
	}

	return m_wszToken;
}
Пример #2
0
int CFileParser::GetInt()
{
	GetToken();

	if( GetTokenType() == HEX )	
	{ 
		m_wszBuff += 2; 
		wchar_t* pPos = m_wszBuff; 
		
		while(!IsWhiteSpace(*pPos) && *pPos ) 
			pPos++; 
		
			m_wszToken = wstring( m_wszBuff, pPos - m_wszBuff); 
			m_wszBuff = pPos; 
			return (int)GetHex(); 
	} 
	else 
	{
		wchar_t* pPos = m_wszBuff;

		while(!IsWhiteSpace(*pPos) && *pPos )
			pPos++;



		m_wszToken = wstring( m_wszBuff, pPos - m_wszBuff );

		m_wszBuff = pPos;

		if( m_wszToken[0] ) 
			READ_TABLE( _wtoi ); 
	}

	return 0;
}
Пример #3
0
	bool Context::findNextParameter(IOption* option, int argc, char* argv[])
	{
		assert(option != NULL);

		if (not option->requireAdditionalParameter())
		{
			option->enableFlag();
			return true;
		}

		while ((++pParameterIndex) < argc)
		{
			// We only want parameters
			if (ttParameter == GetTokenType(argv[pParameterIndex]))
			{
				// Adding the argument to the list of value of the option
				option->addValue(argv[pParameterIndex], static_cast<String::size_type>(::strlen(argv[pParameterIndex])));
				// This argument must not be used again as a parameter
				++pParameterIndex;
				return true;
			}
		}

		// If not found, it is an error
		++pParser.pErrors;
		return false;
	}
Пример #4
0
bool CBotPostIncExpr::Execute(CBotStack* &pj)
{
    CBotStack*    pile1 = pj->AddStack(this);
    CBotStack*    pile2 = pile1;

    CBotVar*    var1 = nullptr;

    // retrieves the variable fields and indexes according
    if (!(static_cast<CBotExprVar*>(m_instr))->ExecuteVar(var1, pile2, nullptr, true)) return false;

    pile1->SetState(1);
    pile1->SetCopyVar(var1);                                // places the result (before incrementation);

    CBotStack* pile3 = pile2->AddStack(this);
    if (pile3->IfStep()) return false;

    if (var1->IsNAN())
    {
        pile1->SetError(CBotErrNan, &m_token);
    }

    if (!var1->IsDefined())
    {
        pile1->SetError(CBotErrNotInit, &m_token);
    }

    if (GetTokenType() == ID_INC) var1->Inc();
    else                          var1->Dec();

    return pj->Return(pile1);                        // operation done, result on pile2
}
Пример #5
0
double CFileParser::GetDouble()
{
	if(GetTokenType() != NUMBER)
		return 0.0f;

	if( m_wszToken[0] )
	{
		READ_TABLE( _wtof );
	}

	return 0.0f;
}
Пример #6
0
void DumpStatistics(TOKEN_STATISTICS& stats)
{
	CIndent scope;

	Log(_T("TokenId: 0x%.8x%.8x"), stats.TokenId.HighPart, stats.TokenId.LowPart);
	Log(_T("AuthenticationId: 0x%.8x%.8x"), stats.AuthenticationId.HighPart, stats.AuthenticationId.LowPart);
	Log(_T("ExpirationTime: (not supported in this release of Windows NT)"));
	Log(_T("TokenType: %s"), (LPCTSTR)GetTokenType(stats.TokenType));
	Log(_T("ImpersonationLevel: %s"), (LPCTSTR)GetImpersonationLevel(stats.ImpersonationLevel));
	Log(_T("DynamicCharged: %ld"), stats.DynamicCharged);
	Log(_T("DynamicAvailable: %ld"), stats.DynamicAvailable);
	Log(_T("GroupCount: %d"), stats.GroupCount);
	Log(_T("PrivilegeCount: %d"), stats.PrivilegeCount);
	Log(_T("ModifiedId: 0x%.8x%.8x"), stats.ModifiedId.HighPart, stats.ModifiedId.LowPart);
}
Пример #7
0
bool CBotCompExpr::Execute(CBotStack* &pStack)
{
    CBotStack* pStk1 = pStack->AddStack(this);
//  if ( pStk1 == EOX ) return TRUE;

    if ( pStk1->GetState() == 0 && !m_leftop->Execute(pStk1) ) return FALSE; // interrupted here ?

    pStk1->SetState(1);     // finished

    // requires a little more stack to not touch the result of the left
    CBotStack* pStk2 = pStk1->AddStack();

    if ( !m_rightop->Execute(pStk2) ) return FALSE; // interrupted here ?

    int     type1 = pStk1->GetType();
    int     type2 = pStk2->GetType();

    CBotVar*    result = new CBotVar( NULL, CBotTypBoolean );

    switch (GetTokenType())
    {
    case ID_LO:
        result->Lo(pStk1->GetVar(), pStk2->GetVar());       // lower
        break;
    case ID_HI:
        result->Hi(pStk1->GetVar(), pStk2->GetVar());       // higher
        break;
    case ID_LS:
        result->Ls(pStk1->GetVar(), pStk2->GetVar());       // lower or equal
        break;
    case ID_HS:
        result->Hs(pStk1->GetVar(), pStk2->GetVar());       // higher of equal
        break;
    case ID_EQ:
        result->Eq(pStk1->GetVar(), pStk2->GetVar());       // equal
        break;
    case ID_NE:
        result->Ne(pStk1->GetVar(), pStk2->GetVar());       // not equal
        break;
    }
    pStk2->SetVar(result);              // puts the result on the stack

    pStk1->Return(pStk2);               // frees the stack
    return pStack->Return(pStk1);       // transmit the result
}
Пример #8
0
BOOL CBotAddExpr::Execute(CBotStack* &pStack)
{
    CBotStack* pStk1 = pStack->AddStack(this);  // ajoute un élément à la pile
                                                // ou le retrouve en cas de reprise
//  if ( pSk1 == EOX ) return TRUE;


    // selon la reprise, on peut être dans l'un des 2 états

    if ( pStk1->GetState() == 0 &&              // 1er état, évalue l'opérande de gauche
        !m_leftop->Execute(pStk1) ) return FALSE; // interrompu ici ?

    // passe à l'étape suivante
    pStk1->SetState(1);                         // prêt pour la suite

    // demande un peu plus de stack pour ne pas toucher le résultat de gauche
    // qui se trouve sur la pile, justement.

    CBotStack* pStk2 = pStk1->AddStack();       // ajoute un élément à la pile
                                                // ou le retrouve en cas de reprise

    // 2e état, évalue l'opérande de droite
    if ( !m_rightop->Execute(pStk2) ) return FALSE; // interrompu ici ?

    int     type1 = pStk1->GetType();           // de quels types les résultats ?
    int     type2 = pStk2->GetType();

    // crée une variable temporaire pour y mettre le résultat
    CBotVar*    result = new CBotVar( NULL, MAX(type1, type2));

    // fait l'opération selon la demande
    switch (GetTokenType())
    {
    case ID_ADD:
        result->Add(pStk1->GetVar(), pStk2->GetVar());      // additionne
        break;
    case ID_SUB:
        result->Sub(pStk1->GetVar(), pStk2->GetVar());      // soustrait
        break;
    }
    pStk2->SetVar(result);                      // met le résultat sur la pile

    pStk1->Return(pStk2);                       // libère la pile
    return pStack->Return(pStk1);               // transmet le résultat
}
Пример #9
0
bool CBotAddExpr::Execute(CBotStack* &pStack)
{
    CBotStack* pStk1 = pStack->AddStack(this);  // adds an item to the stack
                                                // or is found in case of recovery
//  if ( pSk1 == EOX ) return TRUE;


    // according to recovery, it may be in one of two states

    if ( pStk1->GetState() == 0 &&              // first state, evaluates the left operand
        !m_leftop->Execute(pStk1) ) return FALSE; // interrupted here?

    // passes to the next step
    pStk1->SetState(1);                         // ready for further

    // requires a little more stack to not touch the result of the left
    // which is on the stack, precisely.

    CBotStack* pStk2 = pStk1->AddStack();       // adds an item to the stack
                                                // or is found in case of recovery

    // Second state, evaluates the right operand
    if ( !m_rightop->Execute(pStk2) ) return FALSE; // interrupted here?

    int     type1 = pStk1->GetType();           // what kind of results?
    int     type2 = pStk2->GetType();

    // creates a temporary variable to put the result
    CBotVar*    result = new CBotVar( nullptr, MAX(type1, type2));

    // is the operation as requested
    switch (GetTokenType())
    {
    case ID_ADD:
        result->Add(pStk1->GetVar(), pStk2->GetVar());      // addition
        break;
    case ID_SUB:
        result->Sub(pStk1->GetVar(), pStk2->GetVar());      // subtraction
        break;
    }
    pStk2->SetVar(result);                      // puts the result on the stack

    pStk1->Return(pStk2);                       // frees the stack
    return pStack->Return(pStk1);               // transmits the result
}
Пример #10
0
bool CBotTwoOpExpr::Execute(CBotStack* &pStack)
{
    CBotStack* pStk1 = pStack->AddStack(this);  // adds an item to the stack
                                                // or return in case of recovery
//  if ( pStk1 == EOX ) return true;

    // according to recovery, it may be in one of two states

    if ( pStk1->GetState() == 0 )                   // first state, evaluates the left operand
    {
        if (!m_leftop->Execute(pStk1) ) return false;   // interrupted here?

        // for OR and AND logic does not evaluate the second expression if not necessary
        if ( (GetTokenType() == ID_LOG_AND || GetTokenType() == ID_TXT_AND ) && pStk1->GetVal() == false )
        {
            CBotVar*    res = CBotVar::Create("", CBotTypBoolean);
            res->SetValInt(false);
            pStk1->SetVar(res);
            return pStack->Return(pStk1);               // transmits the result
        }
        if ( (GetTokenType() == ID_LOG_OR||GetTokenType() == ID_TXT_OR) && pStk1->GetVal() == true )
        {
            CBotVar*    res = CBotVar::Create("", CBotTypBoolean);
            res->SetValInt(true);
            pStk1->SetVar(res);
            return pStack->Return(pStk1);               // transmits the result
        }

        // passes to the next step
        pStk1->SetState(1);         // ready for further
    }


    // requires a little more stack to avoid touching the result
    // of which is left on the stack, precisely

    CBotStack* pStk2 = pStk1->AddStack();               // adds an item to the stack
                                                        // or return in case of recovery

    // 2e état, évalue l'opérande de droite
    if ( pStk2->GetState() == 0 )
    {
        if ( !m_rightop->Execute(pStk2) ) return false;     // interrupted here?
        pStk2->IncState();
    }

    assert(pStk1->GetVar() != nullptr && pStk2->GetVar() != nullptr);
    CBotTypResult       type1 = pStk1->GetVar()->GetTypResult();      // what kind of results?
    CBotTypResult       type2 = pStk2->GetVar()->GetTypResult();

    CBotStack* pStk3 = pStk2->AddStack(this);               // adds an item to the stack
    if ( pStk3->IfStep() ) return false;                    // shows the operation if step by step

    // creates a temporary variable to put the result
    // what kind of result?
    int TypeRes = std::max(type1.GetType(), type2.GetType());

    // see "any type convertible chain" in compile method
    if ( GetTokenType() == ID_ADD &&
        (type1.Eq(CBotTypString) || type2.Eq(CBotTypString)) )
    {
        TypeRes = CBotTypString;
    }

    switch ( GetTokenType() )
    {
    case ID_LOG_OR:
    case ID_LOG_AND:
    case ID_TXT_OR:
    case ID_TXT_AND:
    case ID_EQ:
    case ID_NE:
    case ID_HI:
    case ID_LO:
    case ID_HS:
    case ID_LS:
        TypeRes = CBotTypBoolean;
        break;
    case ID_DIV:
        TypeRes = std::max(TypeRes, static_cast<int>(CBotTypFloat));
    }

    // creates a variable for the result
    CBotVar*    result = CBotVar::Create("", TypeRes);

    // get left and right operands
    CBotVar*    left  = pStk1->GetVar();
    CBotVar*    right = pStk2->GetVar();

    // creates a variable to perform the calculation in the appropriate type
    if ( TypeRes != CBotTypString )                                     // keep string conversion
    {
        TypeRes = std::max(type1.GetType(), type2.GetType());
    }
    else
    {
        left->Update(nullptr);
        right->Update(nullptr);
    }

    if ( GetTokenType() == ID_ADD && type1.Eq(CBotTypString) )
    {
        TypeRes = CBotTypString;
    }

    CBotVar*    temp;

    if ( TypeRes == CBotTypPointer ) TypeRes = CBotTypNullPointer;
    if ( TypeRes == CBotTypClass ) temp = CBotVar::Create("", CBotTypResult(CBotTypIntrinsic, type1.GetClass() ) );
    else                           temp = CBotVar::Create("", TypeRes );

    CBotError err = CBotNoErr;
    // is a operation according to request

    switch (GetTokenType())
    {
    case ID_ADD:
        if ( !IsNan(left, right, &err) )    result->Add(left , right);      // addition
        break;
    case ID_SUB:
        if ( !IsNan(left, right, &err) )    result->Sub(left , right);      // substraction
        break;
    case ID_MUL:
        if ( !IsNan(left, right, &err) )    result->Mul(left , right);      // multiplies
        break;
    case ID_POWER:
        if ( !IsNan(left, right, &err) )    result->Power(left , right);    // power
        break;
    case ID_DIV:
        if ( !IsNan(left, right, &err) )    err = result->Div(left , right);// division
        break;
    case ID_MODULO:
        if ( !IsNan(left, right, &err) )    err = result->Modulo(left , right);// remainder of division
        break;
    case ID_LO:
        if ( !IsNan(left, right, &err) )
            result->SetValInt(temp->Lo(left , right));  // lower
        break;
    case ID_HI:
        if ( !IsNan(left, right, &err) )
            result->SetValInt(temp->Hi(left , right));  // top
        break;
    case ID_LS:
        if ( !IsNan(left, right, &err) )
            result->SetValInt(temp->Ls(left , right));  // less than or equal
        break;
    case ID_HS:
        if ( !IsNan(left, right, &err) )
            result->SetValInt(temp->Hs(left , right));  // greater than or equal
        break;
    case ID_EQ:
        if ( IsNan(left, right) )
            result->SetValInt(left->GetInit() ==  right->GetInit()) ;
        else
            result->SetValInt(temp->Eq(left , right));  // equal
        break;
    case ID_NE:
        if ( IsNan(left, right) )
             result->SetValInt(left ->GetInit() !=  right->GetInit()) ;
        else
            result->SetValInt(temp->Ne(left , right));  // different
        break;
    case ID_TXT_AND:
    case ID_LOG_AND:
    case ID_AND:
        if ( !IsNan(left, right, &err) )    result->And(left , right);      // AND
        break;
    case ID_TXT_OR:
    case ID_LOG_OR:
    case ID_OR:
        if ( !IsNan(left, right, &err) )    result->Or(left , right);       // OR
        break;
    case ID_XOR:
        if ( !IsNan(left, right, &err) )    result->XOr(left , right);      // exclusive OR
        break;
    case ID_ASR:
        if ( !IsNan(left, right, &err) )    result->ASR(left , right);
        break;
    case ID_SR:
        if ( !IsNan(left, right, &err) )    result->SR(left , right);
        break;
    case ID_SL:
        if ( !IsNan(left, right, &err) )    result->SL(left , right);
        break;
    default:
        assert(0);
    }
    delete temp;

    pStk2->SetVar(result);                      // puts the result on the stack
    if ( err ) pStk2->SetError(err, &m_token);  // and the possible error (division by zero)

//  pStk1->Return(pStk2);                       // releases the stack
    return pStack->Return(pStk2);               // transmits the result
}
Пример #11
0
void DumpAccessToken(CAccessToken& at)
{
	CIndent scope;

	CSid sidUser;
	if (!at.GetUser(&sidUser))
		Log(_T("Failure retrieving User from Token"));
	else
	{
		Log(_T("User:"******"Failure retrieving Groups from Token"));
	else
	{
		Log(_T("Groups:"));
		DumpGroups(groups);
	}

	CTokenPrivileges priv;
	if (!at.GetPrivileges(&priv))
		Log(_T("Failure retrieving Privileges from Token"));
	else
	{
		Log(_T("Privileges:"));
		DumpPrivileges(priv);
	}

	CSid sidOwner;
	if (!at.GetOwner(&sidOwner))
		Log(_T("Failure retrieving Owner from Token"));
	else
	{
		Log(_T("Default Owner:"));
		DumpSid(sidOwner);
	}

	CSid sidPrimaryGroup;
	if (!at.GetOwner(&sidPrimaryGroup))
		Log(_T("Failure retrieving Primary Group from Token"));
	else
	{
		Log(_T("Primary Group:"));
		DumpSid(sidPrimaryGroup);
	}

	CDacl dacl;
	if (!at.GetDefaultDacl(&dacl))
		Log(_T("Failure retrieving Default Dacl from Token"));
	else
	{
		Log(_T("Default Dacl:"));
		DumpAcl(dacl, mapGenericAccess);
	}

	TOKEN_SOURCE source;
	if (!at.GetSource(&source))
		Log(_T("Failure retrieving Source from Token"));
	else
	{
		Log(_T("Source:"));
		Log(_T("Source Name: %.8s"), CString(source.SourceName));
		Log(_T("Source Identifier: 0x%.8x%.8x"), source.SourceIdentifier.HighPart, source.SourceIdentifier.LowPart);
	}

	TOKEN_TYPE type;
	if (!at.GetType(&type))
		Log(_T("Failure retrieving Type from Token"));
	else
		Log(_T("Type: %s"), (LPCTSTR)GetTokenType(type));
	
	if (type == TokenImpersonation)
	{
		SECURITY_IMPERSONATION_LEVEL sil;
		if (!at.GetImpersonationLevel(&sil))
			Log(_T("Failure retrieving Impersonation Level from Token"));
		else
			Log(_T("Impersonation Level: %s"), (LPCTSTR)GetImpersonationLevel(sil));
	}

	TOKEN_STATISTICS stats;
	if (!at.GetStatistics(&stats))
		Log(_T("Failure retrieving Statistics from Token"));
	else
	{
		Log(_T("Statistics:"));
		DumpStatistics(stats);
	}
}
Пример #12
0
	bool Context::operator () (int argc, char* argv[])
	{
		while (pTokenIndex < argc)
		{
			arg = argv[pTokenIndex];

			switch (GetTokenType(arg))
			{
				// The current argument seems to be a short name of an option
				case ttShortOption:
					{
						while ('\0' != *(++arg))
						{
							OptionsOrderedByShortName::iterator i = pParser.pShortNames.find(*arg);
							if (i != pParser.pShortNames.end())
							{
								if (not findNextParameter(i->second, argc, argv))
									std::cerr << "Error: The parameter is missing for `" << arg << "`" << std::endl;
							}
							else
							{
								if (*arg == 'h' or *arg == '?')
								{
									pParser.helpUsage(argv[0]);
									return false;
								}
								optionIsUnknown(arg);
							}
						}
						break;
					}

				// The current argument seems to be a long name of an option
				case ttLongOption:
					{
						++arg;
						++arg;
						if ('\0' == *arg) // End of options
							return (0 == pParser.pErrors);

						if ((sub = strchr(arg, '=')))
						{
							const uint size = static_cast<uint>(sub - arg);

							if (size < YUNI_GETOPT_LONGNAME_MAX_LENGTH)
							{
								buffer.assign(arg, size);
								arg += size;
								++arg;

								OptionsOrderedByLongName::iterator i = pParser.pLongNames.find(buffer.c_str());
								if (i != pParser.pLongNames.end())
								{
									i->second->addValue(arg, static_cast<String::size_type>(::strlen(arg)));
								}
								else
								{
									if (0 == ::strcmp(buffer.c_str(), "help"))
									{
										pParser.helpUsage(argv[0]);
										return false;
									}
									optionIsUnknown(buffer.c_str());
								}
							}
							else
							{
								STD_CERR << "Error: name too long" << std::endl;
								++pParser.pErrors;
							}
						}
						else
						{
							OptionsOrderedByLongName::iterator i = pParser.pLongNames.find(arg);
							if (i != pParser.pLongNames.end())
							{
								if (not findNextParameter(i->second, argc, argv))
									parameterIsMissing(arg);
							}
							else
							{
								if (0 == ::strcmp(arg, "help"))
								{
									pParser.helpUsage(argv[0]);
									return false;
								}
								optionIsUnknown(arg);
							}
						}
						break;
					}

					// The current argument is a parameter actually (not attached to any option)
				case ttParameter:
					{
						if (pTokenIndex >= pParameterIndex)
						{
							pParameterIndex = pTokenIndex;
							if (pParser.pRemains)
								pParser.pRemains->addValue(arg, static_cast<String::size_type>(::strlen(arg)));
						}
						break;
					}
			}
			++pTokenIndex;
		}

		return (0 == pParser.pErrors);
	}
Пример #13
0
/*#F:Parses the current line for a token. Skips whitespace and loads succesive 
lines if neccessary. If ReturnSameToken BOOL was set, the line is not parsed, the 
current token is returned and the BOOL unset. The new token type is determined.
#R:A pointer to the current token.*/
const char* CTokenParser::NextToken()
  {
  if (bReturnSameToken)
    {
    bReturnSameToken = 0;
    return (const char*)sCurTok;
    }
  sCurTok = "";
  eTokType = TokNull;
  if (m_TokenQ.Length()>0)
    {
    Strng *p=m_TokenQ.First();
    sCurTok=(*p)();
    m_TokenQ.Remove(p);
    eTokType = GetTokenType((const char*)sCurTok);
    }
  else
    {
    BOOL BlankEnclosedStr = FALSE;
    while ((sCurTok.GetLength()==0) && (!bAtEnd) && !BlankEnclosedStr)
      {
      SkipWhiteSpace();
      while ((sTokenLine.GetLength()==0) && (!bAtEnd))
        {
        NextLine();
        SkipWhiteSpace();
        }

      if (bAtEnd)
        sCurTok = "";
      else
        {
        bFirstToken = bNewLine;
        char c = sTokenLine[0];
        if (pFileInfo && pFileInfo->bUseIncludes && c==pFileInfo->sIncludeChars[0])
          if (pFileInfo->CheckForInclude())
            {//include file found
            sCurTok = "";
            sTokenLine = "";
            return NextToken();
            }
        if (bIgnoreComments && c==';')
          {//comment found
          sCurTok = "";
          sTokenLine = "";
          }
        else if (bUseStringChar && c==cStringChar)
          {//start of enclosed string found
          eTokType = TokString;
          sTokenLine = sTokenLine.Right(sTokenLine.GetLength()-1);
          int APos = (int)sTokenLine.Find(cStringChar);
          if (APos<0)
            {
            sCurTok = sTokenLine;
            sTokenLine = "";
            }
          else if (APos==0)
            {
            sCurTok = "";
            sTokenLine = sTokenLine.Right(sTokenLine.GetLength() - 1);
            BlankEnclosedStr = TRUE;
            }
          else
            {
            sCurTok = sTokenLine.Left(APos);
            sTokenLine = sTokenLine.Right(sTokenLine.GetLength() - APos - 1);
            }
          }
        else    
          {
          WORD i = 0;
          while (i<iSeperatorSetLen && SeperatorSet[i]!=c)
            i++;
          if (i<iSeperatorSetLen)
            {//token seperator character found
            sTokenLine = sTokenLine.Right(sTokenLine.GetLength()-1);
            sCurTok = c; 
            }
          else
            {//default action
            SkipToSeperator(sCurTok);
            sTokenLine = sTokenLine.Right(sTokenLine.GetLength() - sCurTok.GetLength());
            }
          }
        }
      }
    if (eTokType!=TokString)
      eTokType = GetTokenType((const char*)sCurTok);
    bNewLine = 0;
    }
  bLastToken = (sTokenLine.GetLength()==0);
  return (const char*)sCurTok;
  }
Пример #14
0
	bool Context::operator () (int argc, char* argv[])
	{
		while (pTokenIndex < argc)
		{
			arg = argv[pTokenIndex];
			switch (GetTokenType(arg))
			{
				// The current argument seems to be a short name of an option
				case ttShortOption:
					{
						while ('\0' != *(++arg))
						{
							OptionsOrderedByShortName::iterator i = pParser.pShortNames.find(*arg);
							if (i != pParser.pShortNames.end())
							{
								if (!findNextParameter(i->second, argc, argv))
									std::cerr << "Error: The parameter is missing for `" << arg << "`" << std::endl;
							}
							else
							{
								if (*arg == 'h' || *arg == '?')
								{
									pParser.helpUsage(argv[0]);
									return false;
								}
								optionIsUnknown(arg);
							}
						}
						break;
					}

				// The current argument seems to be a long name of an option
				case ttLongOption:
					{
						++arg;
						++arg;
						if ('\0' == *arg) // End of options
							return (!pParser.pErrors);
						if ((sub = strchr(arg, '=')))
						{
							const size_t size = static_cast<size_t>(sub - arg);
							if (size < sizeof(buffer))
							{
								# ifdef YUNI_OS_MSVC
								strncpy_s(buffer, sizeof(buffer), arg, size);
								# else
								strncpy(buffer, arg, size);
								# endif
								buffer[size] = '\0';
								arg += size;
								++arg;

								OptionsOrderedByLongName::iterator i = pParser.pLongNames.find(buffer);
								if (i != pParser.pLongNames.end())
									i->second->addValue(arg, static_cast<String::size_type>(::strlen(arg)));
								else
								{
									if (!::strcmp(buffer, "help"))
									{
										pParser.helpUsage(argv[0]);
										return false;
									}
									optionIsUnknown(buffer);
								}
							}
							else
							{
								std::cerr << "Error: name too long" << std::endl;
								++pParser.pErrors;
							}
						}
						else
						{
							OptionsOrderedByLongName::iterator i = pParser.pLongNames.find(arg);
							if (i != pParser.pLongNames.end())
							{
								if (!findNextParameter(i->second, argc, argv))
									parameterIsMissing(arg);
							}
							else
							{
								if (!::strcmp(arg, "help"))
								{
									pParser.helpUsage(argv[0]);
									return false;
								}
								optionIsUnknown(arg);
							}
						}
						break;
					}

					// The current argument is a parameter actually (not attached to any option)
				case ttParameter:
					{
						if (pTokenIndex >= pParameterIndex)
						{
							pParameterIndex = pTokenIndex;
							if (pParser.pRemains)
								pParser.pRemains->addValue(arg, static_cast<String::size_type>(::strlen(arg)));
						}
						break;
					}
			}
			++pTokenIndex;
		}
		return (!pParser.pErrors);
	}