bool express_calcu(string express) {
    trim(express);
    if (execute_calculation_express(express)) {
        copy_variant(JAVASCRIPT_VARIANT_KEYNAME_CALCULATION_RESULT,JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT);
        return true;
    } else if (execute_function_call(express)) {
        copy_variant(JAVASCRIPT_VARIANT_KEYNAME_CALCULATION_RESULT,JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT);
        return true;
    }/* else if (execute_calculation_term(express)) {  //  WARNING ,it will crash because of STL lib ..
        copy_variant(JAVASCRIPT_VARIANT_KEYNAME_CALCULATION_RESULT,JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT);
        return true;
    }*/
    express_type express_type_=get_express_type(express);
    if (EXPRESSION_UNKNOW!=express_type_) {
        if (EXPRESSION_NUMBER_DECIMAL==express_type_) {
            set_variant(JAVASCRIPT_VARIANT_KEYNAME_CALCULATION_RESULT,(void*)atoi(express.c_str()),NUMBER);
        } else if (EXPRESSION_NUMBER_HEX==express_type_) {
            set_variant(JAVASCRIPT_VARIANT_KEYNAME_CALCULATION_RESULT,(void*)hex_string_to_number(express),NUMBER);
        } else if (EXPRESSION_STRING==express_type_) {
            set_variant(JAVASCRIPT_VARIANT_KEYNAME_CALCULATION_RESULT,(void*)(express.substr(1,express.length()-2)).c_str(),STRING);
        } else if (EXPRESSION_ARRAY==express_type_) {
            string variant_name(express.substr(0,express.find('[')));
            express_calcu(express.substr(express.find('[')+1,express.find(']')-express.find('[')-1));
            unsigned long array_index=0;
            support_javascript_variant_type array_type=NONE;
            get_variant(JAVASCRIPT_VARIANT_KEYNAME_CALCULATION_RESULT,(void*)&array_index,&array_type);
            if (NUMBER!=array_index)
                return false;
            get_variant_array(variant_name,array_index,&array_index,&array_type);
            set_variant(JAVASCRIPT_VARIANT_KEYNAME_CALCULATION_RESULT,(void*)array_index,array_type);
        }
        return true;
    }
    return false;
}
示例#2
0
文件: reg.c 项目: ZoloZiak/reactos
static HRESULT enum_key( HKEY root, const WCHAR *subkey, VARIANT *names, VARIANT *retval )
{
    HKEY hkey;
    HRESULT hr = S_OK;
    WCHAR buf[256];
    BSTR *strings, *tmp;
    DWORD count = 2, len = sizeof(buf)/sizeof(buf[0]);
    LONG res, i = 0;

    TRACE("%p, %s\n", root, debugstr_w(subkey));

    if (!(strings = heap_alloc( count * sizeof(BSTR) ))) return E_OUTOFMEMORY;
    if ((res = RegOpenKeyExW( root, subkey, 0, KEY_ENUMERATE_SUB_KEYS, &hkey )))
    {
        set_variant( VT_UI4, res, NULL, retval );
        heap_free( strings );
        return S_OK;
    }
    for (;;)
    {
        if (i >= count)
        {
            count *= 2;
            if (!(tmp = heap_realloc( strings, count * sizeof(BSTR) )))
            {
                RegCloseKey( hkey );
                return E_OUTOFMEMORY;
            }
            strings = tmp;
        }
        if ((res = RegEnumKeyW( hkey, i, buf, len )) == ERROR_NO_MORE_ITEMS)
        {
            if (i) res = ERROR_SUCCESS;
            break;
        }
        if (res) break;
        if (!(strings[i] = SysAllocString( buf )))
        {
            for (i--; i >= 0; i--) SysFreeString( strings[i] );
            hr = ERROR_OUTOFMEMORY;
            break;
        }
        i++;
    }
    if (hr == S_OK && !res) hr = to_bstr_array( strings, i, names );
    set_variant( VT_UI4, res, NULL, retval );
    RegCloseKey( hkey );
    heap_free( strings );
    return hr;
}
示例#3
0
文件: process.c 项目: AlexSteel/wine
static HRESULT get_owner( VARIANT *user, VARIANT *domain, VARIANT *retval )
{
    DWORD len;
    UINT error = 8;

    len = 0;
    GetUserNameW( NULL, &len );
    if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) goto done;
    if (!(V_BSTR( user ) = SysAllocStringLen( NULL, len - 1 ))) goto done;
    if (!GetUserNameW( V_BSTR( user ), &len )) goto done;
    V_VT( user ) = VT_BSTR;

    len = 0;
    GetComputerNameW( NULL, &len );
    if (GetLastError() != ERROR_BUFFER_OVERFLOW) goto done;
    if (!(V_BSTR( domain ) = SysAllocStringLen( NULL, len - 1 ))) goto done;
    if (!GetComputerNameW( V_BSTR( domain ), &len )) goto done;
    V_VT( domain ) = VT_BSTR;

    error = 0;

done:
    if (error)
    {
        VariantClear( user );
        VariantClear( domain );
    }
    set_variant( VT_UI4, error, NULL, retval );
    return S_OK;
}
示例#4
0
文件: reg.c 项目: ZoloZiak/reactos
static HRESULT enum_values( HKEY root, const WCHAR *subkey, VARIANT *names, VARIANT *types, VARIANT *retval )
{
    HKEY hkey = NULL;
    HRESULT hr = S_OK;
    BSTR *value_names = NULL;
    DWORD count, buflen, len, *value_types = NULL;
    LONG res, i = 0;
    WCHAR *buf = NULL;

    TRACE("%p, %s\n", root, debugstr_w(subkey));

    if ((res = RegOpenKeyExW( root, subkey, 0, KEY_QUERY_VALUE, &hkey ))) goto done;
    if ((res = RegQueryInfoKeyW( hkey, NULL, NULL, NULL, NULL, NULL, NULL, &count, &buflen, NULL, NULL, NULL )))
        goto done;

    hr = E_OUTOFMEMORY;
    if (!(buf = heap_alloc( (buflen + 1) * sizeof(WCHAR) ))) goto done;
    if (!(value_names = heap_alloc( count * sizeof(BSTR) ))) goto done;
    if (!(value_types = heap_alloc( count * sizeof(DWORD) ))) goto done;

    hr = S_OK;
    for (;;)
    {
        len = buflen + 1;
        res = RegEnumValueW( hkey, i, buf, &len, NULL, &value_types[i], NULL, NULL );
        if (res == ERROR_NO_MORE_ITEMS)
        {
            if (i) res = ERROR_SUCCESS;
            break;
        }
        if (res) break;
        if (!(value_names[i] = SysAllocString( buf )))
        {
            for (i--; i >= 0; i--) SysFreeString( value_names[i] );
            hr = ERROR_OUTOFMEMORY;
            break;
        }
        i++;
    }
    if (hr == S_OK && !res)
    {
        hr = to_bstr_array( value_names, i, names );
        if (hr == S_OK) hr = to_i4_array( value_types, i, types );
    }

done:
    set_variant( VT_UI4, res, NULL, retval );
    RegCloseKey( hkey );
    heap_free( value_names );
    heap_free( value_types );
    heap_free( buf );
    return hr;
}
示例#5
0
文件: reg.c 项目: ZoloZiak/reactos
static HRESULT get_stringvalue( HKEY root, const WCHAR *subkey, const WCHAR *name, VARIANT *value, VARIANT *retval )
{
    HRESULT hr = S_OK;
    BSTR str = NULL;
    DWORD size;
    LONG res;

    TRACE("%p, %s, %s\n", root, debugstr_w(subkey), debugstr_w(name));

    if ((res = RegGetValueW( root, subkey, name, RRF_RT_REG_SZ, NULL, NULL, &size ))) goto done;
    if (!(str = SysAllocStringLen( NULL, size / sizeof(WCHAR) - 1 )))
    {
        hr = E_OUTOFMEMORY;
        goto done;
    }
    if (!(res = RegGetValueW( root, subkey, name, RRF_RT_REG_SZ, NULL, str, &size )))
        set_variant( VT_BSTR, 0, str, value );

done:
    set_variant( VT_UI4, res, NULL, retval );
    if (res) SysFreeString( str );
    return hr;
}
示例#6
0
文件: reg.c 项目: ZoloZiak/reactos
static HRESULT to_i4_array( DWORD *values, DWORD count, VARIANT *var )
{
    SAFEARRAY *sa;
    HRESULT hr;
    LONG i;

    if (!(sa = SafeArrayCreateVector( VT_I4, 0, count ))) return E_OUTOFMEMORY;
    for (i = 0; i < count; i++)
    {
        if ((hr = SafeArrayPutElement( sa, &i, &values[i] )) != S_OK)
        {
            SafeArrayDestroy( sa );
            return hr;
        }
    }
    set_variant( VT_I4|VT_ARRAY, 0, sa, var );
    return S_OK;
}
示例#7
0
文件: service.c 项目: Dimillian/wine
static HRESULT start_service( const WCHAR *name, VARIANT *retval )
{
    SC_HANDLE manager, service = NULL;
    UINT error = 0;

    if (!(manager = OpenSCManagerW( NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE )))
    {
        error = map_error( GetLastError() );
        goto done;
    }
    if (!(service = OpenServiceW( manager, name, SERVICE_START )))
    {
        error = map_error( GetLastError() );
        goto done;
    }
    if (!StartServiceW( service, 0, NULL )) error = map_error( GetLastError() );

done:
    set_variant( VT_UI4, error, NULL, retval );
    CloseServiceHandle( service );
    CloseServiceHandle( manager );
    return S_OK;
}
示例#8
0
文件: service.c 项目: Dimillian/wine
static HRESULT control_service( const WCHAR *name, DWORD control, VARIANT *retval )
{
    SC_HANDLE manager, service = NULL;
    SERVICE_STATUS status;
    UINT error = 0;

    if (!(manager = OpenSCManagerW( NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE )))
    {
        error = map_error( GetLastError() );
        goto done;
    }
    if (!(service = OpenServiceW( manager, name, SERVICE_STOP|SERVICE_START|SERVICE_PAUSE_CONTINUE )))
    {
        error = map_error( GetLastError() );
        goto done;
    }
    if (!ControlService( service, control, &status )) error = map_error( GetLastError() );

done:
    set_variant( VT_UI4, error, NULL, retval );
    CloseServiceHandle( service );
    CloseServiceHandle( manager );
    return S_OK;
}
static bool execute_calculation_express(string& express) {
    long next_calculation_flag=get_next_calculation_flag(express);
    if ('+'==express[next_calculation_flag]) {
        string left_express(express.substr(0,next_calculation_flag));
        trim(left_express);
        express_type left_express_type=get_express_type(left_express);
        unsigned long left_express_calcu_value=0;
        support_javascript_variant_type left_express_calcu_value_type=NONE;
        if (EXPRESSION_UNKNOW==left_express_type)  //  12kk4+321 or +321
            return false;
        if (EXPRESSION_VARIANT==left_express_type) {
            get_variant(left_express,(void*)&left_express_calcu_value,&left_express_calcu_value_type);
        } else if (EXPRESSION_EXPRESS==left_express_type) {  //  (123+321)+1
            if (!execute_calculation_express(left_express))
                return false;
            get_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)&left_express_calcu_value,&left_express_calcu_value_type);
        } else if (EXPRESSION_STRING==left_express_type) { //  'AAA'+'A'
            left_express=left_express.substr(1,left_express.length()-2);
        }
        if (NUMBER==left_express_calcu_value_type || 
            EXPRESSION_NUMBER_DECIMAL==left_express_type || EXPRESSION_NUMBER_HEX==left_express_type) {
            left_express_type=EXPRESSION_NUMBER_DECIMAL;
        } else {
            left_express_type=EXPRESSION_STRING;
        }

        string right_express(express.substr(next_calculation_flag+1));
        trim(right_express);
        express_type right_express_type=get_express_type(right_express);
        unsigned long right_express_calcu_value=0;
        support_javascript_variant_type right_express_calcu_value_type=NONE;
        if (EXPRESSION_UNKNOW==right_express_type)  //  321+12kk4 or 321+
            return false;
        if (EXPRESSION_VARIANT==right_express_type) {
            get_variant(right_express,(void*)&right_express_calcu_value,&right_express_calcu_value_type);
        } else if (EXPRESSION_EXPRESS==right_express_type) {  //  123+123+123
            if (!execute_calculation_express(right_express))
                return false;
            get_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)&right_express_calcu_value,&right_express_calcu_value_type);
        } else if (EXPRESSION_STRING==right_express_type) {  //  'AAA'+'A'
            right_express=right_express.substr(1,right_express.length()-2);
        }
        if (NUMBER==right_express_calcu_value_type || 
            EXPRESSION_NUMBER_DECIMAL==right_express_type || EXPRESSION_NUMBER_HEX==right_express_type) {
            right_express_type=EXPRESSION_NUMBER_DECIMAL;
        } else {
            right_express_type=EXPRESSION_STRING;
        }
        //  123+123 or (123+321)+123+123 or '123'+'123' or '123'+123
        if (EXPRESSION_STRING==left_express_type && EXPRESSION_STRING!=right_express_type) {
            if (NONE!=right_express_calcu_value_type) {
                string connect_string(left_express);
                connect_string+=right_express;
                set_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)connect_string.c_str(),STRING);
            } else {
                char conver_buffer[0x20]={0};
                sprintf(conver_buffer,"%d",right_express_calcu_value);
                string connect_string(left_express);
                connect_string+=conver_buffer;
                set_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)connect_string.c_str(),STRING);
            }
        } else if (EXPRESSION_STRING!=left_express_type && EXPRESSION_STRING==right_express_type) {
            if (NONE==left_express_calcu_value_type) {
                string connect_string(left_express);
                connect_string+=right_express;
                set_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)connect_string.c_str(),STRING);
            } else {
                char conver_buffer[0x20]={0};
                sprintf(conver_buffer,"%d",left_express_calcu_value);
                string connect_string(conver_buffer);
                connect_string+=right_express;
                set_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)connect_string.c_str(),STRING);
            }
        } else if (EXPRESSION_STRING==left_express_type && EXPRESSION_STRING==right_express_type) {  //  alloc in heap ..
            //string connect_string;
            unsigned long connect_string_length=0;
            if (NONE!=left_express_calcu_value_type)
                connect_string_length=strlen((char*)left_express_calcu_value);
            else
                connect_string_length=left_express.length();
            if (NONE!=right_express_calcu_value_type)
                connect_string_length+=strlen((char*)right_express_calcu_value);
            else
                connect_string_length+=right_express.length();

            char* connect_string=(char*)alloc_memory(connect_string_length+1);
            unsigned long copy_offset=0;
            if (NONE!=left_express_calcu_value_type) {
                copy_offset=strlen((char*)left_express_calcu_value);
                memcpy(connect_string,(const void*)left_express_calcu_value,copy_offset);
            } else {
                copy_offset=left_express.length();
                memcpy(connect_string,left_express.c_str(),copy_offset);
            }
            if (NONE!=right_express_calcu_value_type)
                memcpy((void*)((unsigned long)connect_string+copy_offset),(const void*)right_express_calcu_value,strlen((char*)right_express_calcu_value));
            else
                memcpy((void*)((unsigned long)connect_string+copy_offset),right_express.c_str(),right_express.length());

            set_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)connect_string,STRING);
        } else {
            long left_express_value=0;
            if (NONE!=left_express_calcu_value_type) {
                left_express_value=left_express_calcu_value;
            } else {
                if (EXPRESSION_NUMBER_HEX==left_express_calcu_value_type)
                    left_express_value=hex_string_to_number(left_express);
                else
                    left_express_value=atoi(left_express.c_str());
            }
            long right_express_value=0;
            if (NONE!=right_express_calcu_value_type) {
                right_express_value=right_express_calcu_value;
            } else {
                if (EXPRESSION_NUMBER_HEX==right_express_calcu_value_type)
                    right_express_value=hex_string_to_number(right_express);
                else
                    right_express_value=atoi(right_express.c_str());
            }
            left_express_value+=right_express_value;
            set_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)left_express_value,NUMBER);
        }
        return true;
    } else if ('-'==express[next_calculation_flag]) {
        string left_express(express.substr(0,next_calculation_flag));
        trim(left_express);
        express_type left_express_type=get_express_type(left_express);
        unsigned long left_express_calcu_value=0;
        support_javascript_variant_type left_express_calcu_value_type=NONE;
        if (EXPRESSION_UNKNOW==left_express_type)
            return false;
        if (EXPRESSION_EXPRESS==left_express_type || EXPRESSION_VARIANT==left_express_type) {
            if (!execute_calculation_express(left_express))
                return false;
            get_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)&left_express_calcu_value,&left_express_calcu_value_type);
            if (NUMBER==left_express_calcu_value_type)
                left_express_type=EXPRESSION_NUMBER_DECIMAL;
        } else if (EXPRESSION_NUMBER_HEX==left_express_type) {
            left_express_calcu_value=hex_string_to_number(left_express);
        } else if (EXPRESSION_NUMBER_DECIMAL==left_express_type) {
            left_express_calcu_value=atoi(left_express.c_str());
        }

        string right_express(express.substr(next_calculation_flag+1));
        trim(right_express);
        express_type right_express_type=get_express_type(right_express);
        unsigned long right_express_calcu_value=0;
        support_javascript_variant_type right_express_calcu_value_type=NONE;
        if (EXPRESSION_UNKNOW==right_express_type)
            return false;
        if (EXPRESSION_EXPRESS==right_express_type || EXPRESSION_VARIANT==right_express_type) {
            if (!execute_calculation_express(right_express))
                return false;
            get_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)&right_express_calcu_value,&right_express_calcu_value_type);
            if (NUMBER==right_express_calcu_value_type)
                right_express_type=EXPRESSION_NUMBER_DECIMAL;
        } else if (EXPRESSION_NUMBER_HEX==right_express_type) {
            right_express_calcu_value=hex_string_to_number(right_express);
        } else if (EXPRESSION_NUMBER_DECIMAL==right_express_type) {
            right_express_calcu_value=atoi(right_express.c_str());
        }
        left_express_calcu_value-=right_express_calcu_value;
        set_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)left_express_calcu_value,NUMBER);
        return true;
    } else if ('*'==express[next_calculation_flag]) {
        string left_express(express.substr(0,next_calculation_flag));
        trim(left_express);
        express_type left_express_type=get_express_type(left_express);
        unsigned long left_express_calcu_value=0;
        support_javascript_variant_type left_express_calcu_value_type=NONE;
        if (EXPRESSION_UNKNOW==left_express_type)
            return false;
        if (EXPRESSION_EXPRESS==left_express_type || EXPRESSION_VARIANT==left_express_type) {
            if (!execute_calculation_express(left_express))
                return false;
            get_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)&left_express_calcu_value,&left_express_calcu_value_type);
            if (NUMBER==left_express_calcu_value_type)
                left_express_type=EXPRESSION_NUMBER_DECIMAL;
        } else if (EXPRESSION_NUMBER_HEX==left_express_type) {
            left_express_calcu_value=hex_string_to_number(left_express);
        } else if (EXPRESSION_NUMBER_DECIMAL==left_express_type) {
            left_express_calcu_value=atoi(left_express.c_str());
        }

        string right_express(express.substr(next_calculation_flag+1));
        trim(right_express);
        express_type right_express_type=get_express_type(right_express);
        unsigned long right_express_calcu_value=0;
        support_javascript_variant_type right_express_calcu_value_type=NONE;
        if (EXPRESSION_UNKNOW==right_express_type)
            return false;
        if (EXPRESSION_EXPRESS==right_express_type || EXPRESSION_VARIANT==right_express_type) {
            if (!execute_calculation_express(right_express))
                return false;
            get_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)&right_express_calcu_value,&right_express_calcu_value_type);
            if (NUMBER==right_express_calcu_value_type)
                right_express_type=EXPRESSION_NUMBER_DECIMAL;
        } else if (EXPRESSION_NUMBER_HEX==right_express_type) {
            right_express_calcu_value=hex_string_to_number(right_express);
        } else if (EXPRESSION_NUMBER_DECIMAL==right_express_type) {
            right_express_calcu_value=atoi(right_express.c_str());
        }
        left_express_calcu_value*=right_express_calcu_value;
        set_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)left_express_calcu_value,NUMBER);
        return true;
    } else if ('/'==express[next_calculation_flag]) {
        string left_express(express.substr(0,next_calculation_flag));
        trim(left_express);
        express_type left_express_type=get_express_type(left_express);
        unsigned long left_express_calcu_value=0;
        support_javascript_variant_type left_express_calcu_value_type=NONE;
        if (EXPRESSION_UNKNOW==left_express_type)
            return false;
        if (EXPRESSION_EXPRESS==left_express_type || EXPRESSION_VARIANT==left_express_type) {
            if (!execute_calculation_express(left_express))
                return false;
            get_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)&left_express_calcu_value,&left_express_calcu_value_type);
            if (NUMBER==left_express_calcu_value_type)
                left_express_type=EXPRESSION_NUMBER_DECIMAL;
        } else if (EXPRESSION_NUMBER_HEX==left_express_type) {
            left_express_calcu_value=hex_string_to_number(left_express);
        } else if (EXPRESSION_NUMBER_DECIMAL==left_express_type) {
            left_express_calcu_value=atoi(left_express.c_str());
        }

        string right_express(express.substr(next_calculation_flag+1));
        trim(right_express);
        express_type right_express_type=get_express_type(right_express);
        unsigned long right_express_calcu_value=0;
        support_javascript_variant_type right_express_calcu_value_type=NONE;
        if (EXPRESSION_UNKNOW==right_express_type)
            return false;
        if (EXPRESSION_EXPRESS==right_express_type || EXPRESSION_VARIANT==right_express_type) {
            if (!execute_calculation_express(right_express))
                return false;
            get_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)&right_express_calcu_value,&right_express_calcu_value_type);
            if (NUMBER==right_express_calcu_value_type)
                right_express_type=EXPRESSION_NUMBER_DECIMAL;
        } else if (EXPRESSION_NUMBER_HEX==right_express_type) {
            right_express_calcu_value=hex_string_to_number(right_express);
        } else if (EXPRESSION_NUMBER_DECIMAL==right_express_type) {
            right_express_calcu_value=atoi(right_express.c_str());
        }
        left_express_calcu_value/=right_express_calcu_value;
        set_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)left_express_calcu_value,NUMBER);
        return true;
    } else if ('('==express[next_calculation_flag]) {
        string resolve_express(express);
        for (unsigned long left_bracket_index=resolve_express.find('(');
                           left_bracket_index!=INVALID_VALUE;
                           left_bracket_index=resolve_express.find('(')) {
            unsigned long next_right_bracket=get_matching_outside_right_bracket(express,0);
            if (!next_right_bracket)
                return false;
            if (!execute_calculation_express(resolve_express.substr(left_bracket_index+1,next_right_bracket-left_bracket_index-1)))
                return false;
            unsigned long express_calcu_result_value=0;
            support_javascript_variant_type express_calcu_result_value_type=NONE;
            get_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)&express_calcu_result_value,&express_calcu_result_value_type);
            resolve_express=express.substr(0,left_bracket_index);
            if (NUMBER==express_calcu_result_value_type) {
                char conver_buffer[0x20]={0};
                sprintf(conver_buffer,"%d",express_calcu_result_value);
                resolve_express+=conver_buffer;
            } else {
                resolve_express+="\'";
                resolve_express+=(const char*)express_calcu_result_value;
                resolve_express+="\'";
            }
            resolve_express+=express.substr(next_right_bracket+1);
        }
        if (!execute_calculation_express(resolve_express))
            return false;
        return true;
    }
    if (is_exist_variant(express)) {  //  test_var
        copy_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,express);
        return true;
    } else if (INVALID_VALUE!=express.find('[') && INVALID_VALUE!=express.find(']')) {  //  test_array
        unsigned long left_brcket_index=express.find('[');
        unsigned long right_brcket_index=express.find(']');
        string array_name(express.substr(0,left_brcket_index));
        trim(array_name);
        string array_index_string(express.substr(left_brcket_index+1,right_brcket_index-left_brcket_index-1));
        trim(array_index_string);
        if (!express_calcu(array_index_string))
            return false;
        unsigned long array_index=0;
        support_javascript_variant_type array_index_type=NONE;
        get_variant(JAVASCRIPT_VARIANT_KEYNAME_CALCULATION_RESULT,(void*)&array_index,&array_index_type);
        unsigned long array_index_data=0;
        support_javascript_variant_type array_index_data_type=NONE;
        get_variant_array(array_name,array_index,(void*)&array_index_data,&array_index_data_type);
        set_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)array_index_data,array_index_data_type);
        return true;
    }
    return false;  //  TIPS ! all bug had been debug success ..
}
bool execute_calculation_term(string& express) {
    if (INVALID_VALUE!=express.find("==")) {
        if (express_calcu(express.substr(0,express.find("==")))) {
            copy_variant(JAVASCRIPT_VARIANT_KEYNAME_EXPRESS_LEFT_RESULT,JAVASCRIPT_VARIANT_KEYNAME_CALCULATION_RESULT);
            if (express_calcu(express.substr(express.find("==")+2))) {
                unsigned long left_term_data=0;
                support_javascript_variant_type left_term_data_type=NONE;
                unsigned long right_term_data=0;
                support_javascript_variant_type right_term_data_type=NONE;
                get_variant(JAVASCRIPT_VARIANT_KEYNAME_EXPRESS_LEFT_RESULT,(void*)&left_term_data,&left_term_data_type);
                get_variant(JAVASCRIPT_VARIANT_KEYNAME_CALCULATION_RESULT,(void*)&right_term_data,&right_term_data_type);
                if (left_term_data_type!=right_term_data_type) {
                    left_term_data=0;
                    left_term_data_type=NUMBER;
                    set_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)left_term_data,left_term_data_type);
                } else if (NUMBER==left_term_data_type) {
                    if (left_term_data==right_term_data)
                        left_term_data=1;
                    else
                        left_term_data=0;
                    left_term_data_type=NUMBER;
                    set_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)left_term_data,left_term_data_type);
                } else if (STRING==left_term_data_type) {
                    if (!strcmp((const char*)left_term_data,(const char*)right_term_data))
                        left_term_data=1;
                    else
                        left_term_data=0;
                    left_term_data_type=NUMBER;
                    set_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)left_term_data,left_term_data_type);
                }
                return true;
            }
        }
    } else if (INVALID_VALUE!=express.find("!=")) {
        express.replace(express.find("!="),2,"==");
        if (express_calcu(express)) {
            unsigned long calcu_term_value=0;
            support_javascript_variant_type calcu_term_value_type=NONE;
            get_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)&calcu_term_value,&calcu_term_value_type);
            calcu_term_value=(calcu_term_value)?0:1;
            set_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)calcu_term_value,calcu_term_value_type);
            return true;
        }
    } else if (INVALID_VALUE!=express.find(">=")) {
        express.replace(express.find(">="),2,"<");
        if (express_calcu(express)) {
            unsigned long calcu_term_value=0;
            support_javascript_variant_type calcu_term_value_type=NONE;
            get_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)&calcu_term_value,&calcu_term_value_type);
            calcu_term_value=(calcu_term_value)?0:1;
            set_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)calcu_term_value,calcu_term_value_type);
            return true;
        }
    } else if (INVALID_VALUE!=express.find("<=")) {
        express.replace(express.find("<="),2,">");
        if (express_calcu(express)) {
            unsigned long calcu_term_value=0;
            support_javascript_variant_type calcu_term_value_type=NONE;
            get_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)&calcu_term_value,&calcu_term_value_type);
            calcu_term_value=(calcu_term_value)?0:1;
            set_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)calcu_term_value,calcu_term_value_type);
            return true;
        }
    } else if (INVALID_VALUE!=express.find("<")) {
        if (express_calcu(express.substr(0,express.find('<')))) {
            copy_variant(JAVASCRIPT_VARIANT_KEYNAME_EXPRESS_LEFT_RESULT,JAVASCRIPT_VARIANT_KEYNAME_CALCULATION_RESULT);
            if (express_calcu(express.substr(express.find('<')+1))) {
                unsigned long left_term_data=0;
                support_javascript_variant_type left_term_data_type=NONE;
                unsigned long right_term_data=0;
                support_javascript_variant_type right_term_data_type=NONE;
                get_variant(JAVASCRIPT_VARIANT_KEYNAME_EXPRESS_LEFT_RESULT,(void*)&left_term_data,&left_term_data_type);
                get_variant(JAVASCRIPT_VARIANT_KEYNAME_CALCULATION_RESULT,(void*)&right_term_data,&right_term_data_type);
                if (left_term_data_type==right_term_data_type && NUMBER==left_term_data_type) {
                    if (left_term_data<right_term_data)
                        left_term_data=1;
                    else
                        left_term_data=0;
                    left_term_data_type=NUMBER;
                    set_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)left_term_data,left_term_data_type);
                    return true;
                }
            }
        }
    } else if (INVALID_VALUE!=express.find(">")) {
        if (express_calcu(express.substr(0,express.find('>')))) {
            copy_variant(JAVASCRIPT_VARIANT_KEYNAME_EXPRESS_LEFT_RESULT,JAVASCRIPT_VARIANT_KEYNAME_CALCULATION_RESULT);
            if (express_calcu(express.substr(express.find('>')+1))) {
                unsigned long left_term_data=0;
                support_javascript_variant_type left_term_data_type=NONE;
                unsigned long right_term_data=0;
                support_javascript_variant_type right_term_data_type=NONE;
                get_variant(JAVASCRIPT_VARIANT_KEYNAME_EXPRESS_LEFT_RESULT,(void*)&left_term_data,&left_term_data_type);
                get_variant(JAVASCRIPT_VARIANT_KEYNAME_CALCULATION_RESULT,(void*)&right_term_data,&right_term_data_type);
                if (left_term_data_type==right_term_data_type && NUMBER==left_term_data_type) {
                    if (left_term_data>right_term_data)
                        left_term_data=1;
                    else
                        left_term_data=0;
                    left_term_data_type=NUMBER;
                    set_variant(JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT,(void*)left_term_data,left_term_data_type);
                    return true;
                }
            }
        }
    } else {
        if (!express.empty()) {
            if (express_calcu(express)) {
                unsigned long calcu_term_value=0;
                support_javascript_variant_type calcu_term_value_type=NONE;
                get_variant(JAVASCRIPT_VARIANT_KEYNAME_CALCULATION_RESULT,(void*)&calcu_term_value,&calcu_term_value_type);
                if (calcu_term_value)
                    return true;
            }
        }
    }
    return false;
}