示例#1
0
 void rule_manager::mk_rule(expr* fml, proof* p, rule_set& rules, symbol const& name) {              
     scoped_proof_mode _sc(m, m_ctx.generate_proof_trace()?PGM_FINE:PGM_DISABLED);
     proof_ref pr(p, m);
     expr_ref fml1(m);
     bind_variables(fml, true, fml1);
     if (fml1 != fml && pr) {
         pr = m.mk_asserted(fml1);
     }
     remove_labels(fml1, pr);        
     mk_rule_core(fml1, pr, rules, name);
 }
示例#2
0
jsval CharacterNetwork::getNetworkObjects()
{
    jsval ls;
    JSObject *global = _sc()->getGlobalObject();
    //JSObject *global = sc->getDebugGlobal();
    // get global var ls
    JS_GetProperty(_cx(), global, "ls", &ls);
    if (ls == JSVAL_VOID)
        printf("CharacterCmd can't get js object 'ls'\n");
    else
    {
        jsval networkObjects;
        JS_GetProperty(_cx(), &ls.toObject(), "NetworkObjects", &networkObjects);
        
        if(networkObjects == JSVAL_VOID)
            printf("CharacterCmd can't get js object 'ls.NetworkObjects'\n");
        else
            return networkObjects;
    }
    return JSVAL_VOID;
}
示例#3
0
    void resolve_rule(replace_proof_converter* pc, rule& r1, rule& r2, unsigned idx, 
                      expr_ref_vector const& s1, expr_ref_vector const& s2, rule& res) {
        if (!pc) return;
        ast_manager& m = s1.get_manager();
        dl_decl_util util(m);
        expr_ref fml1(m), fml2(m), fml3(m);
        r1.to_formula(fml1);
        r2.to_formula(fml2);
        res.to_formula(fml3);
        vector<expr_ref_vector> substs;
        svector<std::pair<unsigned, unsigned> > positions;
        substs.push_back(s1);
        substs.push_back(s2);

        scoped_coarse_proof _sc(m);
        proof_ref pr(m);
        proof_ref_vector premises(m);
        premises.push_back(m.mk_asserted(fml1));
        premises.push_back(m.mk_asserted(fml2));
        positions.push_back(std::make_pair(idx+1, 0));

        TRACE("dl", 
              tout << premises[0]->get_id() << " " << mk_pp(premises[0].get(), m) << "\n";
              tout << premises[1]->get_id() << " " << mk_pp(premises[1].get(), m) << "\n";); 
示例#4
0
	}
	_bitmaps.clear();

	delete _parser;
	delete _themeEval;
	delete[] _cursor;
	delete _themeArchive;
}



/**********************************************************
 * Rendering mode management
 *********************************************************/
const ThemeEngine::Renderer ThemeEngine::_rendererModes[] = {
	{ _s("Disabled GFX"), _sc("Disabled GFX", "lowres"), "none", kGfxDisabled },
	{ _s("Standard Renderer (16bpp)"), _s("Standard (16bpp)"), "normal_16bpp", kGfxStandard16bit },
#ifndef DISABLE_FANCY_THEMES
	{ _s("Antialiased Renderer (16bpp)"), _s("Antialiased (16bpp)"), "aa_16bpp", kGfxAntialias16bit }
#endif
};

const uint ThemeEngine::_rendererModesSize = ARRAYSIZE(ThemeEngine::_rendererModes);

const ThemeEngine::GraphicsMode ThemeEngine::_defaultRendererMode =
#ifndef DISABLE_FANCY_THEMES
	ThemeEngine::kGfxAntialias16bit;
#else
	ThemeEngine::kGfxStandard16bit;
#endif
示例#5
0
void
QtXMLReaderAdaptor::setProperty(const string& name, void * value)
{
    _impl->setProperty(_sc(name), value);
}
示例#6
0
void
QtXMLReaderAdaptor::setFeature(const string& name, bool value)
{
    _impl->setFeature(_sc(name), value);
}
示例#7
0
void CharacterNetwork::CharacterCmd(NetworkID id, RakNet::RakString cmd, int characterState)
{
    const char* idstr = RakNet::RakNetGUID(id).ToString();
    printf("CharacterCmd %s %s\n", cmd.C_String(), idstr);
    
    jsval networkObjects = CharacterNetwork::getNetworkObjects();
    jsval jsCharacterNetwork = CharacterNetwork::getNetworkObjectById(idstr);

    if (jsCharacterNetwork != JSVAL_VOID)
    {
        jsval jsCharacter;
        JS_GetProperty(_cx(), &jsCharacterNetwork.toObject(), "delegate", &jsCharacter);
        if (jsCharacter == JSVAL_VOID)
            printf("CharacterCmd can't get js object 'NetworkObject.delegate'\n");
        else
        {
            //jsval jsState = int32_to_jsval(cx, characterState);
            //printf("js get s: %d\n", characterState);
            // update Character State first
            //sc->executeFunctionWithOwner(jsCharacter, "updateStateByIndex", 1, &jsState);
            // then execute cmd
            if (!strcmp(cmd.C_String(), "run"))
            {
                cocos2d::CCPoint direction = ccp(CharacterNetwork::_floatParameters[0], CharacterNetwork::_floatParameters[1]);
                //printf("js get d: %f %f\n", direction.x, direction.y);
                jsval jsPoint = ccpoint_to_jsval(_cx(), direction);
                _sc()->executeFunctionWithOwner(jsCharacter, cmd.C_String(), 1, &jsPoint);
            }
            else if (!strcmp(cmd.C_String(), "cast"))
            {
                jsval castIndex;
                castIndex.setInt32(CharacterNetwork::_intParameters[0]);
                _sc()->executeFunctionWithOwner(jsCharacter, cmd.C_String(), 1, &castIndex);
            }
            else if (!strcmp(cmd.C_String(), "hurt"))
            {
                NetworkID attackerId = CharacterNetwork::_idParameters[0];
                const char* attackerIdstr = RakNet::RakNetGUID(attackerId).ToString();
                
                jsval jsAttackerNetwork;
                JS_GetProperty(_cx(), &networkObjects.toObject(), attackerIdstr, &jsAttackerNetwork);
                if (jsAttackerNetwork == JSVAL_VOID)
                    printf("CharacterCmd can't get js attacker network object %s", attackerIdstr);
                else
                {
                    //CCLog("sc->hurt");
                    jsval jsAttacker = CharacterNetwork::getCharacterById(attackerIdstr);
                    JS_GetProperty(_cx(), &jsAttackerNetwork.toObject(), "delegate", &jsAttacker);
                    if (jsAttacker != JSVAL_VOID)
                    {
                        jsval knockDown;
                        knockDown.setBoolean(CharacterNetwork::_boolParameters[0]);
                        jsval knockFly;
                        knockFly.setBoolean(CharacterNetwork::_boolParameters[1]);
                        jsval knockUp;
                        knockUp.setBoolean(CharacterNetwork::_boolParameters[2]);
                        jsval hurtIndex;
                        hurtIndex.setInt32(CharacterNetwork::_intParameters[0]);
                        
                        JS_SetProperty(_cx(), &jsAttacker.toObject(), "_knockDown", &knockDown);
                        JS_SetProperty(_cx(), &jsAttacker.toObject(), "_knockFly", &knockFly);
                        JS_SetProperty(_cx(), &jsAttacker.toObject(), "_knockUp", &knockUp);
                        
                        jsval argv[2] = {
                            jsAttacker,
                            hurtIndex
                        };
                        
                        _sc()->executeFunctionWithOwner(jsCharacter, cmd.C_String(), 2, argv);
                    }
                }
            }
            // attack stop jump
            else
            {
                _sc()->executeFunctionWithOwner(jsCharacter, cmd.C_String());
            }
        }
    }

}