//-------------------------------  Function  -----------------------------------
BOOL PropGSDModule::SetState(LPCTSTR &buffer)
{
    int nParams = GetNextValue(buffer);
    for (int i=0; i<nParams; i++) {
        int iParam = GetNextValue(buffer);
        POSITION pos = ExtUserParams.GetHeadPosition();
        ExtParam*pParam = NULL;

        for (int j=0; j<=iParam && pos; j++)	{
            ExtParam*pNext = (ExtParam*)ExtUserParams.GetNext(pos);
            if (j == iParam)
                pParam = pNext;
            
        }

        if (pParam == NULL || pParam->IsConstantParam() || pParam->IsUsed()) {
            return FALSE;
        }

        m_bExtUserPrms = TRUE;
        pParam->SetUsed(TRUE);
        if (!pParam->SetState(buffer)) {
            return FALSE;
        }
    }
    return TRUE;
}
Exemplo n.º 2
0
Type* Negative::Operate()
{
	std::stringstream ss("");
		
	Type* lValue = GetNextValue();
	Type* rValue = GetNextValue();

	if (lValue == nullptr || rValue == nullptr)
	{
		return new Error("Either or both values point to nothing!", Error::OperationError);
	}

	else if (TypeResolution() == "Error")	
	{
		return new Error(rValue->GetString(), static_cast<Error::ErrorID>(rValue->GetInt()));
	}

	else if (TypeResolution() == "Int")
	{
		ss << -lValue->GetInt();

		return new Int(ss.str());
	}

	else if (TypeResolution() == "Float")
	{
		ss << -lValue->GetFloat();

		return new Float(ss.str());
	}

	return new Error("Type must resolve to either Int or Float", Error::OperationError);
}
Exemplo n.º 3
0
Type* LogicalAnd::Operate()
{
	bool retVal = false;

	Type* lValue = GetNextValue();
	Type* rValue = GetNextValue();

	if (lValue == nullptr || rValue == nullptr)
	{
		return new Error("Either or both values point to nothing!", Error::OperationError);
	}

	else if (TypeResolution() == "Error")	
	{
		return new Error(rValue->GetString(), static_cast<Error::ErrorID>(rValue->GetInt()));
	}

	else if (TypeResolution() == "Int")
	{
		retVal = lValue->GetInt() && rValue->GetInt();
	}
	else if (TypeResolution() == "Bool")
	{
		retVal = lValue->GetInt() && rValue->GetInt();
	}

	else
		return new Error("Expected comparable values: bool or int.", Error::ErrorID::OperationError);

	if (retVal == true)
		return new Bool("true");
	else
		return new Bool("false");

}
//-------------------------------  Function  -----------------------------------
HRESULT CSheetConfigGSD::SetState(CString &state)
{
    LPCTSTR buffer = state;
    LONG version = GetNextValue(buffer);
    LONG identnr = GetNextValue(buffer);
    if (version != CONFIG_GSD_STATE_VERSION ||
        identnr != GetIdentNumber())
        return E_INVALIDARG;

    BOOL bOK = m_pModuleSpec->SetState(buffer);
    bOK = bOK && m_pSlaveModule->SetState(buffer);
    bOK = bOK && !*buffer;
    return bOK ? S_OK : S_FALSE;
}
Exemplo n.º 5
0
BOOL CParser::GetRect(LPRECT lpRect, LPSTR lpEntry, LPSTR lpValues, int nValues)
/***********************************************************************/
{
	long l;
	LPSTR lpValue;
	LPINT lpRectValue;
	BOOL bError;

	if (nValues != 4)
	{
		Print("'%s'\n Invalid rectangle '%s'", lpEntry, lpValues);
		return(FALSE);
	}

	lpRectValue = (LPINT)lpRect;
	while (--nValues >= 0)
	{
		lpValue = GetNextValue(&lpValues);
		l = latol(lpValue, &bError);
		if ( bError || l < 0 )
		{
			Print("'%s'\n Bad number at '%s'", lpEntry, lpValue);
			return(FALSE);
		}
		*lpRectValue++ = (int)l;
	}
	return(TRUE);
}
Exemplo n.º 6
0
//************************************************************************
BOOL CNutDropParser::GetSuccessWaves (LPNUTDROPSCENE lpScene, LPSTR lpEntry,
										LPSTR lpValues, int nValues)
//************************************************************************
{
	LPSTR lpValue;

	if (nValues < 1)
	{
		Print ("'%s'\n Invalid success waves key '%s'", lpEntry, lpValues);
		return (FALSE);
	}

	// Don't overrun our buffer
	if (nValues > MAX_SUCCESSWAVES)
	{
		Print ("Too many Success Waves entered, currently %d is supported", MAX_SUCCESSWAVES);
		nValues = MAX_SUCCESSWAVES;
	}

	for (int i = 0 ; i < nValues ; ++i)
	{
		lpValue = GetNextValue (&lpValues);
		lstrcpy (lpScene->m_szSuccessLevel[i], lpValue);
	}
 	return (TRUE);
}
Exemplo n.º 7
0
BOOL CParser::GetPoint(LPPOINT lpPoint, LPSTR lpEntry, LPSTR lpValues, int nValues)
/***********************************************************************/
{
	long l;
	LPSTR lpValue;
	LPINT lpPtValue;
	BOOL bError;

	if (nValues != 2)
	{
		Print("'%s'\n Invalid point '%s'", lpEntry, lpValues);
		return(FALSE);
	}

	// even though the idiots at Microsoft made POINT use
	// INTs in 16-bit and LONGs in 32-bit, using an INT will
	// work fine since it naturally grows from 16 to 32 bits.
	lpPtValue = (LPINT)lpPoint;
	while (--nValues >= 0)
	{
		lpValue = GetNextValue(&lpValues);
		l = latol(lpValue, &bError);
		if ( bError )
		{
			Print("'%s'\n Bad number at '%s'", lpEntry, lpValue);
			return(FALSE);
		}
		*lpPtValue++ = (int)l;
	}
	return(TRUE);
}
Exemplo n.º 8
0
void pgSequence::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	UpdateValues();
	if (properties)
	{
		CreateListColumns(properties);

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("OID"), GetOid());
		properties->AppendItem(_("Owner"), GetOwner());
		properties->AppendItem(_("ACL"), GetAcl());
		properties->AppendItem(_("Current value"), GetLastValue());
		properties->AppendItem(_("Next value"), GetNextValue());
		properties->AppendItem(_("Minimum"), GetMinValue());
		properties->AppendItem(_("Maximum"), GetMaxValue());
		properties->AppendItem(_("Increment"), GetIncrement());
		properties->AppendItem(_("Cache"), GetCacheValue());
		properties->AppendYesNoItem(_("Cycled?"), GetCycled());
		properties->AppendYesNoItem(_("Called?"), GetCalled());
		properties->AppendYesNoItem(_("System sequence?"), GetSystemObject());
		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));

		if (!GetLabels().IsEmpty())
		{
			wxArrayString seclabels = GetProviderLabelArray();
			if (seclabels.GetCount() > 0)
			{
				for (unsigned int index = 0 ; index < seclabels.GetCount() - 1 ; index += 2)
				{
					properties->AppendItem(seclabels.Item(index), seclabels.Item(index + 1));
				}
			}
		}
	}
}
Exemplo n.º 9
0
BOOL CCreditsParser::GetColor(COLORREF FAR *lpColor, LPSTR lpEntry, LPSTR lpValues, int nValues)
/***********************************************************************/
{
	long l;
	LPSTR lpValue;
	BOOL bError;
	BYTE rgb[3];

	if (nValues != 3)
	{
		Print("'%s'\n Invalid color '%s'", lpEntry, lpValues);
		return(FALSE);
	}

	for (int i = 0; i < 3; ++i)
	{
		lpValue = GetNextValue(&lpValues);
		l = latol(lpValue, &bError);
		if ( bError || l < 0 )
		{
			Print("'%s'\n Bad number at '%s'", lpEntry, lpValue);
			return(FALSE);
		}
		rgb[i] = (BYTE)l;
	}
	*lpColor = RGB(rgb[0], rgb[1], rgb[2]);

	return(TRUE);
}
Exemplo n.º 10
0
//************************************************************************
BOOL CBelongsParser::HandleKey(LPSTR lpEntry, LPSTR lpKey, LPSTR lpValues, int nValues, int nIndex, DWORD dwUserData)
//************************************************************************
{
	LPSTR lpValue;

	LPBELONGSNAME pName = (LPBELONGSNAME)dwUserData;
	pName += nIndex;

	if (nValues > 1)
	{
		Print("Too many filenames specified");
		return(TRUE);
	}
	if (lstrlen(lpKey) >= MAX_NAME_LEN)
	{
		Print("Name too long");
		return(TRUE);
	}
	lpValue = GetNextValue(&lpValues);
	if (lstrlen(lpValue) >= MAX_FILE_LEN)
	{
		Print("Filename too long");
		return(TRUE);
	}
	lstrcpy(pName->m_szName, lpKey);
	lstrcpy(pName->m_szFileName, lpValue);

	return(TRUE);
}
Exemplo n.º 11
0
bool wxRegKey::GetFirstValue(wxString& strValueName, long& lIndex)
{
  if ( !Open(Read) )
    return false;

  lIndex = 0;
  return GetNextValue(strValueName, lIndex);
}
Exemplo n.º 12
0
void cIntConnectedList::PrintAll()
{
   // int TempElement = FirstValue;
   // int i;
   // for( i=0 ; i!=NumElements ; i++ )
    //{
    //    std::cout << "Element no " << i << " value: " <<  TempElement << "\n";
    //    TempElement = Data[TempElement].NextVal;
   // }

    int TempElement;
    ResetIterator();
    int i = 0;
    for( TempElement = GetNextValue(); TempElement != ITERATOR_END ; TempElement = GetNextValue() )
    {
        std::cout << "Element no " << i << " value: " <<  TempElement << "\n";
        i++;
    }

}
Exemplo n.º 13
0
	void SubRectAllocator::GetRect(CRect& rect, const Subtitle* s, const Align& align, int tlb, int brb)
	{
		SubRect sr(rect, s->m_layer);
		sr.rect.InflateRect(tlb, tlb, brb, brb);

		StringMapW<SubRect>::CPair* pPair = Lookup(s->m_name);

		if(pPair && pPair->m_value.rect != sr.rect) {
			RemoveKey(s->m_name);
			pPair = NULL;
		}

		if(!pPair) {
			bool vertical = s->m_direction.primary == _T("down") || s->m_direction.primary == _T("up");

			bool fOK = false;

			while(!fOK) {
				fOK = true;

				POSITION pos = GetStartPosition();
				while(pos) {
					const SubRect& sr2 = GetNextValue(pos);

					if(sr.layer == sr2.layer && !(sr.rect & sr2.rect).IsRectEmpty()) {
						if(vertical) {
							if(align.h < 0.5) {
								sr.rect.right = sr2.rect.right + sr.rect.Width();
								sr.rect.left = sr2.rect.right;
							} else {
								sr.rect.left = sr2.rect.left - sr.rect.Width();
								sr.rect.right = sr2.rect.left;
							}
						} else {
							if(align.v < 0.5) {
								sr.rect.bottom = sr2.rect.bottom + sr.rect.Height();
								sr.rect.top = sr2.rect.bottom;
							} else {
								sr.rect.top = sr2.rect.top - sr.rect.Height();
								sr.rect.bottom = sr2.rect.top;
							}
						}

						fOK = false;
					}
				}
			}

			SetAt(s->m_name, sr);

			rect = sr.rect;
			rect.DeflateRect(tlb, tlb, brb, brb);
		}
	}
Exemplo n.º 14
0
BOOL CParser::GetFilename(LPSTR lpFilename, LPSTR lpEntry, LPSTR lpValues, int nValues)
/***********************************************************************/
{
	LPSTR lpValue;

	if (nValues != 1)
	{
		Print("'%s'\n Expected filename parameter", lpEntry);
		return(FALSE);
	}
	lpValue = GetNextValue(&lpValues);
	lstrcpy(lpFilename, lpValue);
	return(TRUE);
}
Exemplo n.º 15
0
Type* Modulus::Operate()
{
	std::stringstream ss("");

	Type* lValue = GetNextValue();
	Type* rValue = GetNextValue();

	if (lValue == nullptr || rValue == nullptr)
	{
		return new Error("Either or both values point to nothing!", Error::OperationError);
	}

	else if (TypeResolution() == "Error")	
	{
		return new Error(rValue->GetString(), static_cast<Error::ErrorID>(rValue->GetInt()));
	}

	else if (TypeResolution() == "Int")
	{

		//this should never happen!:
		if (lValue == nullptr || rValue == nullptr)
			return nullptr;
		
		if (rValue->GetInt() == 0);
		{
			return new Error("Can't divide by zero!", Error::OperationError);
		}

		ss << lValue->GetInt() % rValue->GetInt();

		return new Int(ss.str());
	}

	return new Error("Type must resolve to an Int", Error::OperationError);
}
Exemplo n.º 16
0
BOOL CParser::GetString(LPSTR lpString, LPSTR lpEntry, LPSTR lpValues, int nValues)
/***********************************************************************/
{
	LPSTR lpValue;

	lpString[0] = '\0';
	while (--nValues >= 0)
	{
		lpValue = GetNextValue(&lpValues);
		lstrcat(lpString, lpValue);
		if (nValues)
			lstrcat(lpString, " ");
	}
	return(TRUE);
}
Exemplo n.º 17
0
bool wxRegKey::Copy(wxRegKey& keyDst)
{
    bool ok = true;

    // copy all sub keys to the new location
    wxString strKey;
    long lIndex;
    bool bCont = GetFirstKey(strKey, lIndex);
    while ( ok && bCont ) {
        wxRegKey key(*this, strKey);
        wxString keyName;
        keyName << GetFullName(&keyDst) << REG_SEPARATOR << strKey;
        ok = key.Copy(keyName);

        if ( ok )
            bCont = GetNextKey(strKey, lIndex);
        else
            wxLogError(_("Failed to copy the registry subkey '%s' to '%s'."),
                   GetFullName(&key), keyName.c_str());

    }

    // copy all values
    wxString strVal;
    bCont = GetFirstValue(strVal, lIndex);
    while ( ok && bCont ) {
        ok = CopyValue(strVal, keyDst);

        if ( !ok ) {
            wxLogSysError(m_dwLastError,
                          _("Failed to copy registry value '%s'"),
                          strVal.c_str());
        }
        else {
            bCont = GetNextValue(strVal, lIndex);
        }
    }

    if ( !ok ) {
        wxLogError(_("Failed to copy the contents of registry key '%s' to '%s'."),
                   GetFullName(this), GetFullName(&keyDst));
    }

    return ok;
}
Exemplo n.º 18
0
Type* doc::Operate()
{
	Interpreter interpreter;
	MemoryUnit mem;

	Type* code = GetNextValue();
	
	Queue* queue = dynamic_cast<Queue*>(code);
	//this should ofcourse always work!
	std::string codeString = queue->GetString();

	GetArgs();

	interpreter.doc(codeString);

	Type* ret = mem.ReadProgramStack()->clone();
	
	return ret;
}
Exemplo n.º 19
0
bool wxRegKey::DoExport(wxOutputStream& ostr) const
{
    // write out this key name
    if ( !WriteAsciiChar(ostr, '[') )
        return false;

    if ( !WriteAsciiString(ostr, GetName(false /* no short prefix */)) )
        return false;

    if ( !WriteAsciiChar(ostr, ']') || !WriteAsciiEOL(ostr) )
        return false;

    // dump all our values
    long dummy;
    wxString name;
    wxRegKey& self = const_cast<wxRegKey&>(*this);
    bool cont = self.GetFirstValue(name, dummy);
    while ( cont )
    {
        if ( !DoExportValue(ostr, name) )
            return false;

        cont = GetNextValue(name, dummy);
    }

    // always terminate values by blank line, even if there were no values
    if ( !WriteAsciiEOL(ostr) )
        return false;

    // recurse to subkeys
    cont = self.GetFirstKey(name, dummy);
    while ( cont )
    {
        wxRegKey subkey(*this, name);
        if ( !subkey.DoExport(ostr) )
            return false;

        cont = GetNextKey(name, dummy);
    }

    return true;
}
Exemplo n.º 20
0
void Device::Update()
{
	if (debug)
	{
		 Serial.print("Current Value: ");
		Serial.println(currentValue);
		Serial.println("-----------");
	}
	if (TimeToUpdate())
	{
		//if (pinNumber = 8)
			//Serial.println("Time To update");
		lastUpdated = millis();
		currentValue = GetNextValue();

		WriteValue(currentValue);
		
	}

}
Exemplo n.º 21
0
BOOL CParser::GetInt(LPINT lpInt, LPSTR lpEntry, LPSTR lpValues, int nValues)
/***********************************************************************/
{
	long l;
	LPSTR lpValue;
	BOOL bError;

	if (nValues != 1)
	{
		Print("'%s'\n Invalid integer '%s'", lpEntry, lpValues);
		return(FALSE);
	}

	lpValue = GetNextValue(&lpValues);
	l = latol(lpValue, &bError);
	if ( bError || l < 0 )
	{
		Print("'%s'\n Bad number at '%s'", lpEntry, lpValue);
		return(FALSE);
	}
	*lpInt = (int)l;
	return(TRUE);
}
Exemplo n.º 22
0
bool pgRegKey::GetFirstValue(wxString &strkey, long &lIndex) const
{
	lIndex = 0;
	return GetNextValue(strkey, lIndex);
}
Exemplo n.º 23
0
void InterceptLog::GetFunctionString(const FunctionData *funcData,uint index, const FunctionArgs & args, string &retString)
{
  //Append the function name first
  retString = funcData->GetName() + "(";

  //Get a copy of the arguments
  FunctionArgs newArgs(args);

  //Loop for all the parameters
  for(uint i=0;i<funcData->parameterArray.size();i++)
  {
//	  LOGERR(("arg.size()=%d\n",funcData->parameterArray.size()));
    //Get the parameter
    const ParameterData * paramData = &funcData->parameterArray[i];
	LOGERR(("The paramDateName:%d, %s\n",paramData->type,paramData->paramName.c_str()));

    //Determine if we are processing pointers
    bool isPointer=false;
    if(paramData->pointerCount > 0 || paramData->length != -1)
    {
      isPointer=true;
    }
	//Get the value	
	ParamValue value;
	
	////¼Ó²âÊÔÖ¸Õë
	if(strcmp((funcData->GetName()).c_str(),"glLightfv")==0&&isPointer){
		 const GLfloat* V; newArgs.Get(V);
		value.pointerValue =(void*) V;
		LOGERR(("The length of this parametre is : lengh = %d\n ,Count = %d\n ", paramData->length,paramData->pointerCount));
		LOGERR(("glLightfv:%f,%f,%f,%f\n",V[0],V[1],V[2],V[3]));
		//LOGERR(("²ÎÊýÐòºÅ%d\n",i))

	}
	////²âÊÔÖ¸ÕëÍê±Ï
    else if(!GetNextValue(paramData->GetGLType(),newArgs,isPointer, value))
    {
      break;
    }


    //Test if this is an array value
    if(paramData->length != -1)
    {
      bool isArrayOfPointers = false;

      //Test for an array of pointers
      if(paramData->pointerCount > 0)
      {
        isArrayOfPointers = true;
      }

      //Assign the array
      void * array =  value.pointerValue;

      //Loop and print the array
      retString += "[";
      for(uint i2=0;i2<(uint)paramData->length;i2++)
      {
        //Get the value from the array
        if(!GetNextArrayValue(paramData->GetGLType(),&array,isArrayOfPointers, value))
        {
          break;
        }
       
        //Convert and print the value
        retString += ConvertParam(value,isArrayOfPointers,paramData);
        
        //Add a comma
        if(i2 != (uint)(paramData->length - 1))
        {
          retString += ",";
        }
      }
      retString += "]";
    }
    else
    {
      //Just get the single value
      retString += ConvertParam(value,isPointer,paramData);
    }

    //Add a comma if there are more parameters
    if(i != funcData->parameterArray.size() - 1)
    {
      retString += ",";
    }
  }

  //If there are no parameters (unknown function)
  if(funcData->parameterArray.size() == 0)
  {
    retString += " ??? ";
  }

  //Close the bracket
  retString += ")";
}