Beispiel #1
0
cxAny cxActionRootCreate(cxConstChars xml)
{
    cxEngine engine = cxEngineInstance();
    cxActionRoot this = cxHashGet(engine->actions, cxHashStrKey(xml));
    if(this != NULL){
        return this;
    }
    cxXMLScript script = cxEngineGetXMLScript(xml);
    if(script == NULL || script->bytes == NULL){
        CX_ERROR("%s script not register",xml);
        return NULL;
    }
    this = CX_CREATE(cxActionRoot);
    xmlTextReaderPtr reader = cxXMLReaderForScript(script,cxActionRootReaderError, this);
    if(reader == NULL){
        CX_ERROR("create xml reader failed");
        return NULL;
    }
    CX_EVENT_FIRE(this, onBegin);
    cxActionRootLoadCodesWithReader(this, reader);
    cxHashKey key = cxHashStrKey(xml);
    cxHashSet(this->codes, key, script->bytes);
    cxHashSet(engine->actions, key, this);
    CX_EVENT_FIRE(this, onEnd);
    return this;
}
Beispiel #2
0
cxBool cxHashRootLoad(cxAny root,cxConstChars xml)
{
    cxXMLScript script = cxEngineGetXMLScript(xml);
    if(script == NULL){
        CX_ERROR("%s script not register",xml);
        return false;
    }
    if(script->bytes == NULL){
        CX_ERROR("xml script not load bytes");
        return false;
    }
    xmlTextReaderPtr reader = cxXMLReaderForScript(script, cxHashRootReaderError, root);
    if(reader == NULL){
        CX_ERROR("create xml reader failed");
        return false;
    }
    return cxHashRootLoadWithReader(root, reader);
}
Beispiel #3
0
cxString cxEngineGetLuaScript(cxConstChars file)
{
    cxXMLScript script = cxEngineGetXMLScript(file);
    return script != NULL ? script->bytes : NULL;
}