engine/source/scriptlib/Interpreter.c
/******************************************************************************
*  PutValue -- This method copies the VARIANT in pValue into the symbol
*  designated by variable.
*  Parameters: variable -- a LPCSTR which denotes which symbol to copy this
*                          value into.
*              pValue -- a pointer to a ScriptVariant which contains the value
*                        to be copied into the symbol.
*  Returns: S_OK
*           E_INVALIDARG
*           E_FAIL
******************************************************************************/
- This method copies the VARIANT in pValue into the symbol
designated by variable.
Parameters: variable -- a LPCSTR which denotes which symbol to copy this
value into.
pValue -- a pointer to a ScriptVariant which contains the value
to be copied into the symbol.
- This method copies the VARIANT in pValue into the symbol designated by variable . Parameters : variable -- a LPCSTR which denotes which symbol to copy this value into . pValue -- a pointer to a ScriptVariant which contains the value to be copied into the symbol .
HRESULT Interpreter_PutValue(Interpreter *pinterpreter, LPCSTR variable, ScriptVariant *pValue , int refFlag)
{
    HRESULT hr = E_FAIL;
    Instruction *pref = NULL;
    Symbol *pSymbol = NULL;
    if ((pValue == NULL) || (variable == NULL ))
    {
        hr = E_FAIL;
    }
    else
    {
        pref = (Instruction *)List_Retrieve(&(pinterpreter->theInstructionList));
        if(refFlag && pref->theRef)
        {
            *(pref->theRef) = *pValue;
            hr = S_OK;
        }
        else if (StackedSymbolTable_FindSymbol(&(pinterpreter->theSymbolTable), variable, &pSymbol ))
        {
            ScriptVariant_Copy(&(pSymbol->var), pValue);
            if(refFlag && pSymbol->theRef)
            {
                pref->theRef = pSymbol->theRef->theVal;
            }
            hr = S_OK;
        }
    }
    return hr;
}
HRESULT Interpreter_PutValue ( Interpreter * pinterpreter , LPCSTR variable , ScriptVariant * pValue , int refFlag ) { HRESULT hr = E_FAIL ; Instruction * pref = NULL ; Symbol * pSymbol = NULL ; if ( ( pValue == NULL ) || ( variable == NULL ) ) { hr = E_FAIL ; } else { pref = ( Instruction * ) List_Retrieve ( & ( pinterpreter -> theInstructionList ) ) ; if ( refFlag && pref -> theRef ) { * ( pref -> theRef ) = * pValue ; hr = S_OK ; } else if ( StackedSymbolTable_FindSymbol ( & ( pinterpreter -> theSymbolTable ) , variable , & pSymbol ) ) { ScriptVariant_Copy ( & ( pSymbol -> var ) , pValue ) ; if ( refFlag && pSymbol -> theRef ) { pref -> theRef = pSymbol -> theRef -> theVal ; } hr = S_OK ; } } return hr ; }
PutValue -- This method copies the VARIANT in pValue into the symbol
designated by variable.
PutValue -- This method copies the VARIANT in pValue into the symbol designated by variable .
//Check arguments //Get the CSymbol that contains the VARIANT we need //Copy the valye from the argument to the CSymbol