Ejemplo n.º 1
0
mc_message _self_response_to_h(const mo obj, const char* methodname, MCHash hashval)
{
	//we will return a struct
	mc_hashitem* res = mull;
	mc_message tmpmsg = {mull, mull};

	if(obj == mull){
		//no need to warning user
		return tmpmsg;
	}
	if(obj->isa == mull){
		error_log("_self_response_to(obj, '%s') obj->isa is mull. return {mull, mull}\n", methodname);
		return tmpmsg;
	}

	if((res=get_item_byhash(obj->isa->table, hashval, methodname)) != mull){
		tmpmsg.object = obj;
		tmpmsg.address = res->value.mcfuncptr;
		runtime_log("return a message[%s/%s]\n", nameof(obj), methodname);
		return tmpmsg;
	}else{
        if (obj->nextResponder != mull) {
            return _self_response_to_h(obj->nextResponder, methodname, hashval);
        }else{
            runtime_log("self_response_to class[%s] can not response to method[%s]\n", nameof(obj), methodname);
            if (MC_STRICT_MODE == 1) {
                exit(-1);
            }else{
                return tmpmsg;
            }
        }
	}
}
Ejemplo n.º 2
0
mc_message _self_response_to(const mo obj, const char* methodname)
{
	return _self_response_to_h(obj, methodname, hash(methodname));
}
Ejemplo n.º 3
0
mc_message _response_to_h(const mo obj, const char* methodname, MCHash hashval, int strict)
{
    return _self_response_to_h(obj, methodname, hashval);
}