short 
ListForm :: ProcItem(wListRegion *regp, char *itemtext, char **prevdata, short cmd)
{
	char mbuf[12];
	bMoney newVal;

	if (cmd != RegDelete)
	{
		regp->ExtractColumnText(itemtext, mbuf, 2);		// get money value
		newVal =mbuf;
	}
	switch (cmd)
	{
		case RegInsert:								// new item entered?
			regp->SetInsertIndex(LiEnd);
			total += newVal;
			break;
		
		case RegModify:								// edit existing line item?
		{
	   		regp->SetInsertIndex(regp->GetCurrentItem());
			bMoney oldVal(prevdata[2]);
			total -= oldVal;
			total += newVal;
			break;
		}
		case RegDelete:
		{
			bMoney oldVal(prevdata[2]);
			total -= oldVal;
		}
	}
	GetField(E_TOTAL)->Update();
	return TRUE;
}
bool AbstractBitfieldDataInformation::setData(const QVariant& valueVariant,
        Okteta::AbstractByteArrayModel *out, Okteta::Address address, BitCount64 bitsRemaining,
        quint8 bitOffset)
{
    AllPrimitiveTypes oldVal(mValue);
    bool ok;
    AllPrimitiveTypes valToWrite = valueVariant.toULongLong(&ok);
    Q_ASSERT(ok);
    if (!ok)
        return false;
    AllPrimitiveTypes newVal(oldVal);
    //this handles remaining < size() for us
    bool wasAbleToWrite = newVal.writeBits(width(), valToWrite, out, effectiveByteOrder(), address,
            bitsRemaining, &bitOffset);
    return wasAbleToWrite;
}
qint64 AbstractBitfieldDataInformation::readData(Okteta::AbstractByteArrayModel *input,
        Okteta::Address address, BitCount64 bitsRemaining, quint8* bitOffset)
{
    Q_ASSERT(mHasBeenUpdated); //update must have been called prior to reading
    if (bitsRemaining < BitCount64(width()))
    {
        mWasAbleToRead = false;
        mValue = 0;
        return -1;
    }
    bool wasValid = mWasAbleToRead;
    AllPrimitiveTypes oldVal(mValue);
    AllPrimitiveTypes newVal(mValue);

    mWasAbleToRead = newVal.readBits(size(), input, effectiveByteOrder(), address, bitsRemaining,
            bitOffset);

    if (oldVal != newVal || wasValid != mWasAbleToRead)
    {
        topLevelDataInformation()->setChildDataChanged();
        mValue = newVal;
    }
    return width();
}
void EnvironmentConfig::ApplyEnv(wxStringMap_t *overrideMap, const wxString &project, const wxString &config)
{
    // We lock the CS here and it will be released in UnApplyEnv
    // this is safe to call without Locker since the UnApplyEnv 
    // will always be called after ApplyEnv (ApplyEnv and UnApplyEnv are 
    // protected functions that can only be called from EnvSetter class
    // which always call UnApplyEnv in its destructor)
    m_cs.Enter();
    ++m_envApplied;
    
    if ( m_envApplied > 1 ) {
        //CL_DEBUG("Thread-%d: Applying environment variables... (not needed)", (int)wxThread::GetCurrentId());
        return;
    }

    //CL_DEBUG("Thread-%d: Applying environment variables...", (int)wxThread::GetCurrentId());
    //read the environments variables
    EvnVarList vars;
    ReadObject(wxT("Variables"), &vars);

    // get the active environment variables set
    EnvMap variables = vars.GetVariables(wxEmptyString, true, project, config);

    // if we have an "override map" place all the entries from the override map
    // into the global map before applying the environment
    if(overrideMap) {
        wxStringMap_t::iterator it = overrideMap->begin();
        for(; it != overrideMap->end(); it++) {
            variables.Put(it->first, it->second);
        }
    }

    m_envSnapshot.clear();
    for (size_t i=0; i<variables.GetCount(); i++) {

        wxString key, val;
        variables.Get(i, key, val);

        //keep old value before changing it
        wxString oldVal(wxEmptyString);
        if( wxGetEnv(key, &oldVal) == false ) {
            oldVal = __NO_SUCH_ENV__;
        }

        // keep the old value, however, don't override it if it
        // already exists as it might cause the variable to grow in size...
        // Simple case:
        // PATH=$(PATH);\New\Path
        // PATH=$(PATH);\Another\New\Path
        // If we replace the value, PATH will contain the original PATH + \New\Path
        if ( m_envSnapshot.count( key ) == 0 ) {
            m_envSnapshot.insert( std::make_pair( key, oldVal ) );
        }

        // Incase this line contains other environment variables, expand them before setting this environment variable
        wxString newVal = DoExpandVariables(val);

        //set the new value
        wxSetEnv(key, newVal);
    }
}